Skip to content

Instantly share code, notes, and snippets.

View realguess's full-sized avatar

Chao Huang realguess

View GitHub Profile
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();
}
});
$(document).height()
@realguess
realguess / aa
Created January 30, 2016 13:04
aa
aa
date
@realguess
realguess / amazon-s3-starter.js
Created March 10, 2015 09:42
A starter template for using Amazon S3 with Amazon SDK.
// 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();
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@realguess
realguess / jasmine-setup-teardown.js
Created June 10, 2014 02:42
Understand Jasmine testing framework setup and teardown by examples.
// Setup and Teardown
// ==================
//
// Jasmine [Setup and Teardown] examples.
//
// [Setup and Teardown]: http://jasmine.github.io/2.0/introduction.html#section-Setup_and_Teardown
// Specific to Firefox only.
function watchHandler(prop, oldVal, newVal) {
console.log(prop + ' changed from ' + oldVal + ' to ' + newVal);
@realguess
realguess / amazon-sns-server.js
Created March 21, 2014 04:50
A simple Amazon SNS HTTP endpoint server that subscribe to a topic and show request and response logs related to Amazon SNS activities.
// Amazon SNS HTTP Endpoint
// ========================
//
// A simple Amazon SNS HTTP endpoint server that subscribe to a topic and show
// request and response logs related to Amazon SNS activities.
//
// > (c) 2014 Chao Huang <chao@realguess.net>
var http = require('http');
var https = require('https'); // HTTPS is needed for Amazon SNS subscription.
@realguess
realguess / aws-security-group
Last active January 3, 2016 11:29
Authorize or revoke the public IP address of the current machine on all AWS security groups.
#!/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
#
@realguess
realguess / days_passed.js
Created September 11, 2013 19:39
Get the number of days since the beginning of the year.
// 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));
}