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 biggestHeight = "0"; | |
// Loop through elements children to find & set the biggest height | |
$(".container *").each(function(){ | |
// If this elements height is bigger than the biggestHeight | |
if ($(this).height() > biggestHeight ) { | |
// Set the biggestHeight to this Height | |
biggestHeight = $(this).height(); | |
} | |
}); |
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).height() |
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
aa |
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
date |
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
#!/usr/bin/env bash | |
# | |
# Authorize or revoke the public IP address of the current machine on all AWS | |
# security groups. | |
# | |
# Usage: | |
# | |
# # Authorize TCP port 22 access on all security groups: | |
# aws-security-group authorize 22 us-east-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
// Days Passed Since New Year | |
// ========================== | |
// | |
// (c) 2013 Chao Huang <chao@realguess.net> | |
// Quick Example | |
// ------------- | |
function days() { | |
return (new Date(new Date().toISOString().substr(0,10)).getTime() - new Date('' + new Date().getFullYear()).getTime()) / (1000 * (60 * 60 * 24)); | |
} |
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
// Node server displaying HTTP method | |
// ================================== | |
var http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end(req.method + '\n'); | |
}).listen(3000, '127.0.0.1'); | |
console.log('Server running at http://127.0.0.1:3000/'); |
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
/** | |
* Add CORS support. | |
*/ | |
app.all('*', function (req, res, next) { | |
if (!req.get('Origin')) { | |
return next(); | |
} | |
// use "*" here to accept any origin | |
res.set('Access-Control-Allow-Origin', '*'); |
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 mongodb = require('mongodb') | |
, server = new mongodb.Server('localhost', 27017, {}) | |
, db = new mongodb.Db('test', server, {}) | |
; | |
console.log('[1]', db.serverConfig._serverState); | |
db.open(function (err, db) { | |
console.log('[2]', err, db.serverConfig._serverState); | |
db.close(); | |
console.log('[3]', err, db.serverConfig._serverState); |
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
// Put message to S3. | |
var aws = require('aws-sdk'); | |
aws.config.update({ | |
accessKeyId: 'accessKeyId', | |
secretAccessKey: 'secretAccessKey', | |
region: 'us-east-1' | |
}); | |
var s3 = new aws.S3(); |
NewerOlder