Skip to content

Instantly share code, notes, and snippets.

View hanksudo's full-sized avatar
:octocat:
Follow your passion.

Hank Wang hanksudo

:octocat:
Follow your passion.
View GitHub Profile
@clementi
clementi / jquery.stringify.js
Created May 3, 2011 17:24
jQuery Stringify
/**
* jQuery.stringify (https://gist.github.com/953765)
*
* converted stringify() to jQuery plugin.
* serializes a simple object to a JSON formatted string.
* uses browser's native JSON.stringify() if it exists.
* Note: stringify() is different from jQuery.serialize() which URLEncodes form elements
*
* UPDATES:
* Added a fix to skip over Object.prototype members added by the prototype.js library
@Joony
Joony / HexToUIColorMacro.m
Created March 1, 2012 09:27
On Objective-C Macro for converting Hex values (or any number) to a UIColor object.
#define UIColorFromRGBA(rgbaValue) [UIColor colorWithRed:((float)((rgbaValue & 0xFF0000) >> 16)) / 255.0 \
green:((float)((rgbaValue & 0xFF00) >> 8)) / 255.0 \
blue:((float)(rgbaValue & 0xFF)) / 255.0 \
alpha:((float)((rgbaValue & 0xFF000000) >> 24)) / 255.0]
@dlutzy
dlutzy / gist:2469037
Created April 23, 2012 05:59
Multi VM Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# David Lutz's Multi VM Vagrantfile
# inspired from Mark Barger's https://gist.github.com/2404910
boxes = [
{ :name => :web, :role => 'web_dev', :ip => '192.168.33.1', :ssh_port => 2201, :http_fwd => 9980, :cpus =>4, :shares => true },
{ :name => :data, :role => 'data_dev', :ip => '192.168.33.2', :ssh_port => 2202, :mysql_fwd => 9936, :cpus =>4 },
{ :name => :railsapp, :role => 'railsapp_dev', :ip => '192.168.33.3', :ssh_port => 2203, :http_fwd => 9990, :cpus =>1}
]
@antsa
antsa / placeholder.scss
Created March 23, 2012 12:00
Placeholder mixin for Sass
// Placeholder @mixin for Sass
//
// A mixin to style placeholders in HTML5 form elements.
// Includes also a .placeholder class to be used with a polyfill e.g.
// https://github.com/mathiasbynens/jquery-placeholder
// Requires Sass 3.2.
//
// Example usage (.scss):
//
// input {
@JeffreyWay
JeffreyWay / gist:1525217
Created December 27, 2011 21:29
Instant Server for Current Directory
alias server='open http://localhost:8000 && python -m SimpleHTTPServer'
@ijt
ijt / http_get.go
Last active August 23, 2021 12:37
Example of using http.Get in go (golang)
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)
@ryu1
ryu1 / HowToDisableESET.MD
Last active May 13, 2022 06:36
ESET セキュリティソフトの有効/無効

ESET セキュリティソフトの有効/無効

ときおり、邪魔になるセキュリティソフトを一時的に無効にしたいときに使用する.

Disable

$ sudo killall esets_gui
$ sudo launchctl unload /Library/LaunchDaemons/com.eset.esets_daemon.plist
$ sudo launchctl unload /Library/LaunchDaemons/com.eset.esets_pidmapper.plist
$ sudo launchctl unload /Library/LaunchDaemons/com.eset.remoteadministrator.agent_daemon.plist
@asafge
asafge / ng-really.js
Created November 12, 2013 13:06
ng-really? An AngularJS directive that creates a confirmation dialog for an action.
/**
* A generic confirmation for risky actions.
* Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function
*/
angular.module('app').directive('ngReallyClick', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;
@thomseddon
thomseddon / gist:3511330
Last active March 8, 2023 03:39
AngularJS byte format filter
app.filter('bytes', function() {
return function(bytes, precision) {
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) return '-';
if (typeof precision === 'undefined') precision = 1;
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});
@turtlesoupy
turtlesoupy / nginx.conf
Created July 8, 2012 21:16
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;