This file contains 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 extractDataObjects(node) { | |
var objects = {}, | |
attributes = [].slice.call(node.attributes); | |
attributes.forEach(function(attribute) { | |
if (/^data-/.test(attribute.nodeName)) { | |
objects[attribute.nodeName.slice(5)] = attribute.value; | |
} | |
}); |
This file contains 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
// Usage: | |
//>: extractDataOptions( $("<div data-foo='opt1:bar opt2:baz'/>").data("foo") ) | |
//<: { opt1: "bar", opt2: "baz" } | |
function extractDataOptions(attr) { | |
var options = {}; | |
if (!!attr) { | |
attr.split(" ").forEach(function(option) { | |
var pieces = option.split(/:(.+)?/), |
This file contains 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
"atom-workspace atom-text-editor:not([mini])": | |
"alt-shift-down": "editor:add-selection-below" | |
"alt-shift-up": "editor:add-selection-above" |
This file contains 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
# in config/application.rb | |
config.generators do |g| | |
g.helper false | |
g.assets false | |
g.skip_routes true | |
g.controller_specs false | |
g.view_specs false | |
end |
This file contains 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 g { | |
if [[ $# > 0 ]]; then | |
"git" "$@" | |
else | |
git status | |
fi | |
} |
This file contains 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
// Add an event listener to the document | |
$(document).on( "click", "a[data-behavior='scrollTo']", function(event) { | |
// Check for a fragment on the clicked link | |
// `this.hash` = the fragment identifier | |
if ( this.hash !== "" ) { | |
// Animate the viewport's scroll position | |
$("html, body").animate({ scrollTop: $( this.hash ).offset().top }, 500); | |
This file contains 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
// ---- | |
// Sass (v3.3.0.rc.1) | |
// Compass (v0.13.alpha.10) | |
// ---- | |
@mixin calc($property, $value, $fallback) { | |
#{$property}: $fallback; | |
#{$property}: -webkit-calc(#{$value}); | |
#{$property}: calc(#{$value}); | |
} |