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
# Generics | |
*~ | |
*.lock | |
*.DS_Store | |
*.sublime-workspace | |
# Logs | |
logs | |
*.log |
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
#!/bin/bash | |
# Simple note keeper script. | |
# Creates files based on date and timestamps entries. | |
# setup date format to ##.##.## | |
dateStamp=$(date +"%m.%d.%y") | |
# write note to: | |
fileName=$HOME/TakeNote/note_${dateStamp}.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
var decomposeTimestamp = function (timestamp) { | |
var month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], | |
d = new Date(timestamp), | |
component = {}; | |
return component = { | |
day: function () { return d.getDate(); }, | |
month: function (type) { // call month('num') for 1 thru 12 instead of Names | |
if (type === 'num') { | |
return d.getMonth() +1; |
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
// Util for cleaning up the BV Timestamp | |
var decomposeTimestamp = function (timestamp) { | |
var month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], | |
d = new Date(timestamp), | |
component = {}; | |
return component { | |
day: function () { return d.getDate(); }, | |
month: function (type) { // call month('num') for 1 thru 12 instead of Names | |
if (type === 'num') { |
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
$(document).ready(function () { | |
var $selector = $('#selector'), | |
$options = $selector.find('option'), | |
sortedOptions = [], i; | |
for(i = 0; i < $options.length; i += 1) { | |
sortedOptions.push([$($options[i]).text(), 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
if (app.get('env') === 'development') { | |
app.use(function(req, res, next) { | |
app.locals.pretty = true; | |
next(); | |
}); | |
} |
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
/js | |
/libs | |
jquery-private.js | |
jquery.js | |
config.js | |
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
// Superconstructor | |
function Person(name) { | |
this.name = name; | |
} | |
Person.prototype.sayHelloTo = function (otherName) { | |
console.log(this.name + ' says hello to ' + otherName); | |
}; | |
Person.prototype.describe = function () { | |
return 'Person name ' + this.name; | |
}; |
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 jqxhr = $.ajax({ | |
url: url, | |
type: 'GET', // default is GET but you can use other verbs based on your needs. | |
cache: true, // default is true, but false for dataType 'script' and 'jsonp', so set it on need basis. | |
data: {}, // add your request parameters in the data object. | |
dataType: 'json', // specify the dataType for future reference | |
jsonp: 'callback', // only specify this to match the name of callback parameter your API is expecting for JSONP requests. | |
statusCode: { // if you want to handle specific error codes, use the status code mapping settings. | |
404: handler404, | |
500: handler500 |
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
// http://www.mathsisfun.com/percentage-difference.html | |
// get percentage difference of 2 numbers | |
// returns optional unitType as well in the form of '%, px, em' etc | |
getPercentageDifference(v1, v2, unitType = '') | |
return unit(((v1 - v2) / ((v1 + v2) / 2)) * 100, unitType) | |
// get percentage difference of 2 numbers then returns the result minus a given max value | |
// returns optional unitType as well in the form of '%, px, em' etc | |
getPercentageDifferenceMinusMax(v1, v2, max, unitType = '') | |
return unit(max - getPercentageDifference(v1, v2), unitType) |
OlderNewer