Skip to content

Instantly share code, notes, and snippets.

Chao Huang realguess

Block or report user

Report or block realguess

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:f7bdb85810955b155906
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();
}
});
@realguess
realguess / amazon-s3-starter.js
Created Mar 10, 2015
A starter template for using Amazon S3 with Amazon SDK.
View amazon-s3-starter.js
// 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();
View git-author-rewrite.sh
#!/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 Jun 10, 2014
Understand Jasmine testing framework setup and teardown by examples.
View jasmine-setup-teardown.js
// 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 Mar 21, 2014
A simple Amazon SNS HTTP endpoint server that subscribe to a topic and show request and response logs related to Amazon SNS activities.
View amazon-sns-server.js
// 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 Jan 3, 2016
Authorize or revoke the public IP address of the current machine on all AWS security groups.
View aws-security-group
#!/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 Sep 11, 2013
Get the number of days since the beginning of the year.
View days_passed.js
// 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));
}
You can’t perform that action at this time.