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
$("li .active span", '#list').each(bindEvenToSpan); | |
function bindEvenToSpan(i, elem) { | |
var $this = $(elem); | |
if($this.hasClass('shouldReact')) { | |
$this.on('mouseenter', addCssToSpan); | |
} | |
} |
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
// is text or equation? | |
if (target.data.type === 'text') { | |
boundingBox.deleteIcon.position = { | |
x: target.bounds.topRight._x + 30, | |
y: target.bounds.topRight._y + 20 | |
}; | |
} else if(target.data.type === 'equation') { | |
boundingBox.deleteIcon.position = { | |
x: target.bounds.topRight._x + 90, | |
y: target.bounds.topRight._y + 40 |
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
AcornsTest.StockRoute = Ember.Route.extend({ | |
model: function(params) { | |
"use strict"; | |
var url_params = params.slug.split('|'), | |
url = AcornsTest.Config.quandl.URL + '/' + url_params[0] + '/' + url_params[1] + '.json', | |
stockInStore = this.store.getById('stock', url_params[1]), | |
promise = Ember.Deferred.create(), | |
today = new Date(), | |
yearAgo = new Date(), | |
self = this; |
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.prototype.diff = function(a) { | |
return this.filter(function(i) {return !(a.indexOf(i) > -1);}); | |
}; |
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
.Absolute-Center { | |
margin: auto; | |
position: absolute; | |
top: 0; left: 0; bottom: 0; right: 0; | |
} |
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
<?php | |
class Calc { | |
public function mult($by = 1) { | |
return function($number) use($by) { | |
return $by * $number; | |
}; | |
} | |
} | |
$calc = new Calc; |
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 sqlite3 = require('sqlite3').verbose(); | |
var db = new sqlite3.Database('./db.db'); | |
var fs = require('fs'); | |
var outputFilename = './output.json'; | |
var jsonOutput = db.serialize(function() { | |
db.each("SELECT * FROM sqlite_master WHERE type='table'", function(err, table) { | |
db.each("SELECT * FROM " + table.tbl_name, function(err, row) { | |
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
# Enable Rewriting | |
RewriteEngine on | |
# Rewrite user URLs | |
# Input: /PAGE/ | |
# Output: index.php?id=PAGE | |
RewriteRule ^(\w+)/?$ index.php?id=$1 |
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
// Visualize at: | |
// http://www.regexplained.co.uk/?pattern=%2F%5E(%3F%3A(%3F%3A0%5BxX%5D%5B0-9a-fA-F%5D%2B)%7C(%3F%3A0%5BoO%5D%5B0-7%5D%2B)%7C(%3F%3A0%5BbB%5D%5B01%5D%2B)%7C(%3F%3A%5Cd%2B%5C.%5Cd*(%3F%3A%5BeE%5D%5B%2B-%5D%3F%5Cd%2B)%3F)%7C(%3F%3A%5C.%5Cd%2B(%3F%3A%5BeE%5D%5B%2B-%5D%3F%5Cd%2B)%3F)%7C(%3F%3A%5Cd%2B(%3F%3A%5BeE%5D%5B%2B-%5D%3F%5Cd%2B)%3F))%24%2F | |
function isNumberLiteral(txt) { | |
var re = /^(?:(?:0[xX][0-9a-fA-F]+)|(?:0[oO][0-7]+)|(?:0[bB][01]+)|(?:\d+\.\d*(?:[eE][+-]?\d+)?)|(?:\.\d+(?:[eE][+-]?\d+)?)|(?:\d+(?:[eE][+-]?\d+)?))$/; | |
return re.test(txt); | |
} | |
isNumberLiteral("42"); // true | |
isNumberLiteral("-42"); // false |
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
<fixed position="top"> | |
<nav> | |
<ul> | |
<li><a href="#">1</a></li> | |
<li><a href="#">2</a></li> | |
<li><a href="#">4</a></li> | |
<li><a href="#">4</a></li> | |
</ul> | |
</nav> | |
</fixed> |