Skip to content

Instantly share code, notes, and snippets.

@chriseppstein
chriseppstein / lucky_shot.txt
Created July 17, 2014 19:01
Boom. Hit the race condition on the first try.
➜ Projects ruby -rubygems test_race_condition.rb
FUCK
➜ Projects ruby -rubygems test_race_condition.rb
➜ Projects ruby -rubygems test_race_condition.rb
➜ Projects ruby -rubygems test_race_condition.rb
➜ Projects ruby -rubygems test_race_condition.rb
➜ Projects ruby -rubygems test_race_condition.rb
➜ Projects ruby -rubygems test_race_condition.rb
➜ Projects ruby -rubygems test_race_condition.rb
➜ Projects ruby -rubygems test_race_condition.rb
@chriseppstein
chriseppstein / SassMeister-input.scss
Created July 17, 2014 15:13
Generated by SassMeister.com.
// ----
// Sass (v3.4.0.rc.1)
// Compass (v1.0.0.alpha.20)
// ----
#orchard .apple, .pear {
@at-root #{selector-append(".tree", &)} {example: selector-append;}
// Space after .tree doesn't do anything
@at-root #{selector-append(".tree ", &)} {example: selector-append;}
// Space before .tree throws an error
@chriseppstein
chriseppstein / SassMeister-input.scss
Created July 14, 2014 21:39
Generated by SassMeister.com.
// ----
// Sass (v3.4.0.rc.1)
// Compass (v1.0.0.alpha.20)
// ----
nav{
ul {
li {
$new-selector: append(nth(&, 1), unquote(".abc"));
@at-root #{$new-selector} {
@function index-of-last-class($selector) {
$index: null;
$counter: 1;
@each $component in $selector {
@if str-index($component, ".") == 1 {
$index: $counter;
}
$counter: $counter + 1;
}
@return $index;
@mixin default-arg($s: &) {
default-arg: inspect($s);
}
@mixin defaulted-in-body($s: null) {
$s: & !default;
defaulted-in-body: inspect($s);
}
output {
@import susy
@for $i from 1 through 100
.span#{$i}
+span($i)
foo = 1 unless defined?(foo)
foo #=> nil
FOO = 1 unless defined?(FOO)
FOO # => 1
module Sass::Script::Functions
def file_exists(path)
return bool(false) unless options[:filename] # not all sass has a file name (e.g. std input)
current_directory = File.dirname(options[:filename]) rescue nil # a sass filename from an importer may not be processable by File.dirname
return bool(false) unless current_directory && File.exist?(current_directory) # not all sass files are served from the filesystem
full_path = File.expand_path(path.value, current_directory) # a relative path will be expanded against the current_directory of the sass file, symlinks will be followed, absolute paths will be left alone.
return bool(File.exist?(full_path))
end
end
@chriseppstein
chriseppstein / SassMeister-input.scss
Created May 21, 2014 20:05
Generated by SassMeister.com.
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
$debug-browser-support: true;
$svg-gradient-shim-threshold: 1%;
@import "compass/css3/images";
div {
$journey: (states: complete in-progress current, packets: (strengths: blue, others: green, networking: pink, approach: yellow, coworker: purple))
@function journey-image($state, $packet-color)
@if $state == complete
@return url('/assets/journey/#{$packet-color}-gem.png')
@else
@return url('/assets/journey/#{$packet-color}-gem-outline.png')
@each $packet, $packet-color in map-get($journey, packets)
@each $state in map-get($journey, states)