Skip to content

Instantly share code, notes, and snippets.

View ericcholis's full-sized avatar

Eric Cholis ericcholis

View GitHub Profile
@ericcholis
ericcholis / object-watch.js
Created October 27, 2011 13:02 — forked from eligrey/object-watch.js
Cross-browser object.watch and unwatch. Modified for use with MooTools and MooTools More
// Cross-browser object.watch and object.unwatch
// Requires Mootools 1.4 or greater
// object.watch
(function(){
if (!Object.prototype.watch) {
Object.implement('watch',function(prop,handler){
var oldval = this[prop], newval = oldval,
getter = function () {
return newval;
@ericcholis
ericcholis / node.sh
Created November 9, 2011 14:06
Ubuntu Node.js Install
#!/bin/sh
##############################################################
#
# Author: Ruslan Khissamov, email: rrkhissamov@gmail.com
# Taken from http://apptob.org/, use that url to customize to your needs
##############################################################
# Add MongoDB Package
echo 'Add MongoDB Package'
echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" >> /etc/apt/sources.list
@ericcholis
ericcholis / gist:3794892
Created September 27, 2012 16:15
Long Select List
<select name="country" style="display: none; ">
<option value="AD">Andorra</option>
<option value="AE">United Arab Emirates</option>
<option value="AF">Afghanistan</option>
<option value="AG">Antigua and Barbuda</option>
<option value="AI">Anguilla</option>
<option value="AL">Albania</option>
<option value="AM">Armenia</option>
<option value="AO">Angola</option>
<option value="AQ">Antarctica</option>
@ericcholis
ericcholis / reveal_ajax.js
Created October 23, 2012 12:01 — forked from jeduan/reveal_ajax.js
Use Zurb reveal with ajax
$('a.reveal').click(function(event) {
event.preventDefault();
var $div = $('<div>').addClass('reveal-modal').appendTo('body'),
$this = $(this);
$.get($this.attr('href'), function(data) {
return $div.empty().html(data).append('<a class="close-reveal-modal">&#215;</a>').reveal();
});
});
import os, sys
import datetime
import base64
import cloudservers
import cloudlb
import urllib2
#import paramiko
from time import sleep
@ericcholis
ericcholis / openssl.pp
Created July 31, 2013 16:02
Puppet Open SSL Self Signed Certificate
$location = "Mountain View"
$country = "US"
$state = "CA"
$organization = "Google"
$unit = "Search"
$commonname = "www.example.com"
$keyname = "www_example_com"
$subject = "/C=${country}/ST=${state}/L=${location}/O=${organization}/OU=${unit}/CN=${commonname}"
$createcertificate = "openssl req -new -newkey rsa:2048 -x509 -days 365 -nodes -out ${keyname}.crt -keyout ${keyname}.key -subj \"${subject}\""
<?php
use lithium\action\Dispatcher;
use lithium\storage\Session;
use lithium\security\validation\RequestToken;
use lithium\action\Response;
Dispatcher::applyFilter('run', function($self, $params, $chain) {
$request = $params['request'];
@ericcholis
ericcholis / media.php
Last active December 24, 2015 00:29
Lithium CSV Media Handler
<?php
Media::type('csv', 'text/plain', array(
'encode' => function($data) {
ob_start();
$out = fopen('php://output', 'w');
foreach ($data as $record) {
fputcsv($out, $record);
}
fclose($out);
@ericcholis
ericcholis / gist:8606045
Created January 24, 2014 20:46
jQuery Sortable
<!doctype html>
<head>
<meta charset="utf-8">
<title>jQuery Sortable</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap-theme.min.css">
</head>
@ericcholis
ericcholis / random-string
Created April 16, 2014 13:19
Random String Generator
#!/usr/bin/env bash
usage()
{
cat << EOF
usage: random-string
This script run the test1 or test2 over a machine.
OPTIONS: