-
Cool [stackoverflow][define_objects] post about defining js objects and when to use one.
-
Conversion Tricks: http://samuli.hakoniemi.net/
var myVar = "3.14159", str = ""+ myVar,// to string int = ~~myVar, // to integer
-
Visual File structure of directory
brew install tree tree -d ./dir_name/
-
Combine two files
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
import traceback | |
defaultDelimiter = '#' | |
altDelimiter = '=' | |
altTwoDelimter = '%' | |
def formatError(err, errLocation='main', errMsgDelimiter=defaultDelimiter): | |
errorHdr = '{dell}{dell}{dell}{dell} {loc} {dell}{dell}{dell}{dell}'.format(dell=errMsgDelimiter, loc=errLocation) | |
errorFooter = '{dell}{dell}{dell}{dell} END {loc} {dell}{dell}{dell}{dell}'.format(dell=errMsgDelimiter, loc=errLocation) |
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
module.exports = { | |
removeWhitespace: function(str){ | |
return str.replace(/\s+/g, ''); | |
}, | |
randomNumber: function(max, min){ | |
return Math.floor(Math.random() * max) + min; | |
}, | |
stringRepeater: function (str, rptCnt) { | |
return new Array(rptCnt).join(str); | |
}, |
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 HipChatClient = require('hipchat-client'), | |
CronJob = require('cron').CronJob; | |
var cfg = { | |
APIKey: '', | |
Host: '', | |
Schedule: '', | |
FromID: '', | |
Rooms: [], | |
notifierSchedule: '', |
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
/* Found here: http://www.sociallystacked.com/2012/05/style-your-promotions-disclaimer-text/ */ | |
/*Style Promotion Disclaimer Text*/ | |
.ss_promotion_disclaimer{ | |
color: #CCCCCC; /*Color of Disclaimer Text*/ | |
font-size:10px; /*Font Size of Disclaimer Text*/ | |
font-family: Arial, Helvetica, sans-serif; /*Web Safe Font Family of Disclaimer Text*/ | |
} |
Print X one thousands time
[>++++++++<-]><------[>....<-]
Print X one thousands time but to many iterations
+[--->++<]>++>+++>------[<[<.>-]++++>-]
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
//source: answer to http://stackoverflow.com/questions/1184624/convert-form-data-to-javascript-object-with-jquery | |
$.fn.serializeObject = function() | |
{ | |
var o = {}; | |
var a = this.serializeArray(); | |
$.each(a, function() { | |
if (o[this.name] !== undefined) { | |
if (!o[this.name].push) { | |
o[this.name] = [o[this.name]]; |
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 mongodb = require('mongodb'); | |
var MongoClient = mongodb.MongoClient; | |
var baseController = function (collectionName) { | |
var _settings = { | |
url: 'mongodb://localhost:27017/ghfive', | |
collectionName: collectionName | |
}; | |
this.default = { | |
get: function (req, res) { |
- Change Tabs:
option+command+