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
// Constructor function makes a Person model | |
var Person = function (lastName, firstName) { | |
// What's that? I'm not feeling like myself today! | |
if (!(this instanceof Person)) { | |
// Just call myself with new then! | |
return new Person(lastName, firstName); | |
} | |
this.lastName = lastName; | |
this.firstName = firstName; |
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 () { | |
setInterval(function () { | |
$.post('/has-changed', function (data) { | |
if (data == '1') { | |
$(document.body).css('backgroundColor', 'red'); | |
} | |
}); | |
}, 15); | |
}); |
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
pruned_list = filter(None, list_of_strings) |
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
tr '\015' '\n' < file_with_carriage_returns.txt > out && mv out file_with_carriage_returns.txt |
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
//PubSub | |
(function(attachTo, defaultContext) { | |
var topics = {}, | |
attachTo = attachTo||this, | |
defaultContext = defaultContext||this, | |
__slice = function (obj) { return [].prototype.slice.call(obj) }; | |
attachTo.publish = function() { | |
var args = __slice(arguments), | |
topic = args.shift(); |
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
var Totp = (function ($, _) { | |
var body = $(document.body), | |
btn = $('<button type="button" class="pill-btn red-btn" id="top_of_the_props">Top Proppers</button>'), | |
counts = {}, | |
pub = {}, | |
names = [], | |
template = "", | |
url = 'https://www.fitocracy.com/notifications/?start=0&end=1000000', | |
key, count, list, renderer; |
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 to calculate optimum weight to use based on preferred and minimum weight increments | |
* Args: | |
* startingWeight: the target weight | |
* minIncrement: the smallest increment that weight can increase by | |
* prefIncrement: this is our normal smallest increment (typically 2 * 2.5 with most weight sets) | |
* minMultiplier: how many of our minimum increment are available before we must return to our preferred | |
* increment. | |
*/ | |
function calcWeight(startingWeight, minIncrement, prefIncrement, minMultiplier) { |
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 resolver(prop_string, obj) { | |
if (!obj) return; | |
if (prop_string.indexOf('.') === -1) return obj[prop_string]; | |
var props = prop_string.split('.'), | |
p = props.length, | |
result = obj, | |
i = 0, | |
prop; | |
for (; i<p; i++) { | |
prop = props[i]; |
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
DO WHAT THE HECK YOU WANT TO PUBLIC LICENSE | |
Version 1, December 2013 | |
Copyright (C) 2013 Aaron McCall <https://github.com/aaronmccall> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE HECK YOU WANT TO PUBLIC LICENSE |
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
# Recursive find in files with line numbers | |
find directory/ -name "*.html" -exec grep -ni "my search here" {} + |