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
.bouncer { | |
display: inline-block; | |
-webkit-animation: bouncing 1s ease-in-out infinite; | |
-webkit-transform-origin: 50% 50%; | |
} | |
@-webkit-keyframes bouncing { | |
0% { | |
-webkit-transform: translateY(-3px); | |
} | |
25% { |
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
now = Date.now() | |
date = new Date(now) | |
m = ('0'+(date.getMonth()+1)).slice(-2) // add leading zero to month |
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
// basics | |
l = /^text$/, // literal notation | |
c = new RegExp("^text$"), // constructor notation | |
ltest = l.test(str), // test for expression, evaluates to true or false | |
ctest = c.test(str); // same test for both notations | |
// matching strings | |
var str = "this is a test"; |
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
_addListeners: -> | |
$(document).on 'click', '.scrollTo', @_onScrollToClick | |
# where <a id="#element"> corresponds to <div id="element"> | |
_onScrollToClick: -> | |
id = $(this).attr 'id' | |
$('html,body').animate {scrollTop: $(id).offset().top},400 |
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
class MinMax | |
@min: (array) -> Math.min.apply Math, array | |
@max: (array) -> Math.max.apply Math, array | |
# Use... | |
min = MinMax.min [0,1,2] | |
max = MinMax.max [5,4,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
# check if page loaded within iframe | |
if window.parent != window | |
console.log 'within iframe' | |
# access properties from the parent window object | |
orientation = window.parent.orientation | |
else | |
console.log 'no iframe' | |
# access properties from the window object as normal | |
orientation = window.orientation |
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
array = [ | |
{ | |
"id":"1", | |
"type":"z" | |
}, | |
{ | |
"id":"2", | |
"type":"a" | |
} | |
] |
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
_randomNum: (max,min=0) -> | |
return Math.floor(Math.random() * (max - min) + min) | |
# min is set to 0 by default but a different value can be passed to function | |
_randomise: -> | |
randomNum = @_randomNum(10) | |
# returns a random integer between 0 and 10 | |
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
array = [ | |
{ | |
"id":"1", | |
"type":"a" | |
}, | |
{ | |
"id":"2", | |
"type":"b" | |
} | |
] |
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
info: Creating snapshot 0.0.1-1 | |
info Uploading: [=============================] 100% | |
error: Error running command deploy | |
error: Nodejitsu Error (500): Internal Server Error | |
help: For help with this error contact Nodejitsu Support: | |
help: webchat: <http://webchat.nodejitsu.com/> | |
help: irc: <irc://chat.freenode.net/#nodejitsu> | |
help: email: <[email protected]> | |
help: | |
help: Copy and paste this output to a gist (http://gist.github.com/) |