diff --git a/_drafts/swiftui.md b/_drafts/swiftui.md index ae884bb..8b98d89 100644 --- a/_drafts/swiftui.md +++ b/_drafts/swiftui.md @@ -21,6 +21,8 @@ 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) @@ -29,3 +31,149 @@ Filled 3 bugs so far. NSObject.cancelPreviousPerformRequests(withTarget: self) } {% endhighlight %} + +Swift: + +```swift +def print_hi(name) + puts "Hi, #{name}" +end +print_hi('Tom') +#=> prints 'Hi, Tom' to STDOUT. +``` + +Bash: +```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: + +```html + + + + + Title + + + +

Heading

+

This is an example paragraph.

+ + + +``` + +css: +```css +.highlight pre { + width: 100%; +} + +.highlight .hll { + background-color: $base06; +} +.highlight { + .c { + /* Comment */ + color: $base04; + } +} +``` + +Javascript: + +```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"); + } + }; +} +``` \ No newline at end of file diff --git a/assets/css/main.scss b/assets/css/main.scss index 9e56110..b86f04e 100644 --- a/assets/css/main.scss +++ b/assets/css/main.scss @@ -10,11 +10,66 @@ } /* Colors */ +$background-color: #141010 !default; $text-color: #fff6fbb9 !default; $primary-color: #790b61 !default; $link-color: $primary-color !default; $link-color-hover: mix(#fff, $link-color, 25%) !default; $link-color-visited: mix(#000, $link-color, 25%) !default; +$code-background-color: mix(rgb(43, 39, 39), $background-color, 15%) !default; +$code-background-color-dark: mix(rgb(59, 54, 54), $background-color, 20%) !default; + +/* neon syntax highlighting (base16) */ +$base00: #1a191a; +$base01: #e0e0e0; +$base02: #b4a6a6; +$base03: #928e8e; +$base04: #ccc2c2; +$base05: #bd6262; +$base06: #a74040; +$base07: #701b1b; +$base08: #ff0086; +$base09: #fd8900; +$base0a: #aba800; +$base0b: #00c918; +$base0c: #1faaaa; +$base0d: #3777e6; +$base0e: #ad00a1; +$base0f: #926e5c; + // base16-atelier-heath + // base16-synth-midnight-dark + // base16-summerfruit-dark + // base16-seti + // base16-outrun-dark (a bit bright) + // base16-material-darker + // base16-harmonic-dark + // base16-google-dark (little dark for my tastes) + // base16-default-dark (little dull) + // base16-classic-dark + // base16-brewer + + // Hacking the syntax highlighting + .nb { + /* Name.Builtin */ + color: $base0f !important; +} + +.o { + /* Operator */ + color: $base04 !important; +} +.n { + /* Name */ + color: $base05 !important; +} +.p { + /* Punctuation */ + color: #3ab469 !important; +} +.sr { + /* Literal.String.Regex */ + color: $base0c !important; +} @import "minimal-mistakes/skins/{{ site.minimal_mistakes_skin | default: 'default' }}"; // skin @import "minimal-mistakes"; // main partials \ No newline at end of file