This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// n.b. assumes a code formatter (eg. Prettier) which enforces that css vars look exactly like `var(--x[, y])` | |
// var(--x) -> true | |
// var(--x, red) -> true | |
// red -> false | |
@function is-css-var($str-val) { | |
@return str-index($str-val, "var(--") == 1; | |
} | |
// var(--x, y) -> y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
tagName: 'label', | |
classNames: ['cl-checkbox'] | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
actions: { | |
yo: function() { | |
this.set('yo', !this.get('yo')); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
actions: { | |
onSubmitForm: function(){ | |
alert('you submitted form'); | |
} | |
onClickButton: function(){ | |
alert('you clicked button'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first replace spaces in file names with underscores | |
find ~/Pictures/ -depth -name '* *' \ | |
| while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done | |
# then use graphicsmagick to print filenames of appropriate dimensions | |
gm identify -format "%w %h %f\n" ~/Pictures/*.jpg | awk '{if ($1 > 1024 && $2 > 768) print $3}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires: jQuery as $ and underscore as _, uses Modernizr if available | |
# normalized string for transitionEnd event name | |
transitionEnd = "webkitTransitionEnd oTransitionEnd transitionend" | |
# feature test for CSS transitions in the browser | |
hasTransitions = Modernizr?.csstransitions or ( -> | |
return _.some [ | |
"transition", | |
"webkitTransition", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* use the first form if the @2x image is the same url with "@2x" inserted before the extension */ | |
.responsive-background(@url-1x, @background-size) { | |
@url-2x: ~`@{url-1x}.replace(/(\.[a-z0-9]{2,4})$/i, '@2x$1')`; | |
.responsive-background(@url-1x, @url-2x, @background-size); | |
} | |
/* use the second form to specify the url for the @2x image manually */ | |
.responsive-background(@url-1x, @url-2x, @background-size) { | |
display: inline-block; | |
text-indent: -9999px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(win, doc, $){ | |
var next = function() { | |
var $next = $gallery.find('li.ng-scope.selected').next('li.ng-scope'); | |
if ($next.length === 0) { | |
$next = $gallery.find('li.ng-scope').filter(':first'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ensure that no stray console.log calls break functionality by defining an | |
// empty console object and log function in browsers where they do not exist. | |
if (typeof console == "undefined" || typeof console.log == "undefined") { | |
var console = { log: function() {} }; | |
window.console = { log: function() {} }; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var select = $('select#SignedPrints'), | |
form = select.closest('form'), | |
dst = $('<img>').css({display:'block',margin:'0 auto 5px'}); | |
form.before(dst); | |
select.bind('change', function(){ | |
var option = $(this), | |
id = $(this).val().replace(/.*-0?(\d*)-.*/, '$1'), | |
uri = 'http://xkcd.com/' + id; |