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
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
.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
/* Here's the compiled CSS */ | |
@import url("http://fonts.googleapis.com/css?family=Droid+Sans"); | |
body { | |
font-family: Droid Sans, Helvetica Neue, Helvetica, Arial, sans-serif; | |
font-size: 14px; | |
line-height: 25px; | |
font-weight: 300; | |
color: #444; | |
} |
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
.page-wrapper { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
z-index: 700; /* must be the higher than all other elements */ | |
overflow: auto; /* moves scrollbars inside border */ | |
background: #fff; | |
border: 5px solid #ff9900; |
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
// 1. Add definition to foot of module.js (the required file) | |
// AMD Define | |
define(function(){ | |
return baron; | |
}); | |
// 2. Add the path to main.js (requireJS config) as normal | |
require.config({ | |
baseUrl: "/sites/all/themes/base/js/", |
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
distanceKM = 100 | |
distanceMiles = distanceKM / 0.6 # => 166.66667 | |
distanceMilesRounded = parseFloat(distanceMiles, 10).toFixed 1 # => 166.7 |
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
setTimeout => | |
@_delayedFunc() | |
,1000 |
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
$obj = (object) array('prop' => value, 'prop' => $var); |