4.0 KiB
layout | author_profile | read_time | share | related | title | tags | category | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
single | true | true | true | true | SwiftUI |
|
Programming |
Its been a long while since I sat and did programming, but between a life situation and the new technology from Apple for creating user interfaces (SwiftUI), I've been inspired to pickup again an idea I've been kicking around for 10 years.
SwiftUI simplifies designing interfaces Provides a fast means of iterating design Able to quickly see results Easy to mock in data
Buggy. Filled 3 bugs so far.
Swift:
{% highlight swift %} override public func touchesBegan(_ touches: Set, with event: UIEvent?) { super.touchesBegan(touches, with: event) currentTouchPosition = touches.first?.location(in: self)
NSObject.cancelPreviousPerformRequests(withTarget: self)
}
{% endhighlight %}
Swift:
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
Bash:
#!/usr/bin/env bash
set -e # halt script on error
echo
echo "------------------------------------------------------------------------------------------------------------------------"
if [ "$TRAVIS_PULL_REQUEST" != "false" -a "$TRAVIS_BRANCH" == "comments" ]; then
echo
echo "Building site for pull request for $TRAVIS_BRANCH..."
bundle exec jekyll build --config _config.yml --source . --destination ./docs
echo "Site built into /docs"
echo
echo "Proofing links"
bundle exec htmlproofer ./docs --disable-external --allow_hash_href
echo "Proofing links complete"
echo
echo "------------------------------------------------------------------------------------------------------------------------"
exit 0
elif [ "$TRAVIS_BRANCH" == "master" ]; then
echo
echo "Building site for $TRAVIS_BRANCH..."
bundle exec jekyll build --config _config.yml --source . --destination ./docs
echo "Site built into /docs"
echo
echo "Proofing links"
bundle exec htmlproofer ./docs --disable-external --allow_hash_href
echo "Proofing links complete"
echo
echo "------------------------------------------------------------------------------------------------------------------------"
exit 0
else
echo
echo "Build not triggered internally"
echo
echo "------------------------------------------------------------------------------------------------------------------------"
exit 0
fi
Ruby:
{% highlight ruby %} require "gem"
number = 0 regexp = /[abc]/
This is a comment
class Person
attr_accessor :name
def initialize(attributes = {}) @name = attributes[:name] end
def self.greet "hello" end end
person1 = Person.new(:name => "Chris") puts "#{Person::greet} #{person1.name}\n" {% endhighlight %}
html:
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body>
<h1 id="heading">Heading</h1>
<p class="class">This is an example paragraph.</p>
</body>
</html>
css:
.highlight pre {
width: 100%;
}
.highlight .hll {
background-color: $base06;
}
.highlight {
.c {
/* Comment */
color: $base04;
}
}
Javascript:
$(document).ready(function() {
// FitVids init
$("#main").fitVids();
// Sticky sidebar
var stickySideBar = function() {
var show =
$(".author__urls-wrapper button").length === 0
? $(window).width() > 1024 // width should match $large Sass variable
: !$(".author__urls-wrapper button").is(":visible");
if (show) {
// fix
$(".sidebar").addClass("sticky");
} else {
// unfix
$(".sidebar").removeClass("sticky");
}
};
}
notice
{: .notice}primary
{: .notice--primary}info
{: .notice--info}warning
{: .notice--warning}success
{: .notice--success}danger
{: .notice--danger}Text for the notice