Skip to content

Instantly share code, notes, and snippets.

View crypto-js
CryptoJS v3.1.2
(c) 2009-2013 by Jeff Mott. All rights reserved.
var CryptoJS=CryptoJS||function(u,l){var d={},n=d.lib={},p=function(){},s=n.Base={extend:function(a){p.prototype=this;var c=new p;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
q=n.WordArray=s.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=l?c:4*a.length},toString:function(a){return(a||v).stringify(this)},concat:function(a){var c=this.words,m=a.words,f=this.sigBytes;a=a.sigBytes;this.clamp();if(f%4)for(var t=0;t<a;t++)c[f+t>>>2]|=(m[t>>>2]>>>24-8*(t%4)&255)<<24-8*((f+t)%4);else if(65535<m.le
blanchma / application_controller.rb
Created Sep 7, 2012 — forked from scottwb/application_controller.rb
Get a list of all the filters on a given Rails 3 controller.
View application_controller.rb
# Add these methods to your ApplicationController. Then, any controller
# that inherits from it will have these methods and can programmatically
# determine what filters it has set.
class ApplicationController < ActionController::Base
def self.filters(kind = nil)
all_filters = _process_action_callbacks
all_filters ={|f| f.kind == kind} if kind
blanchma / gist:3455080
Created Aug 24, 2012 — forked from sasimpson/gist:1112739
Ruby Net:HTTP chunked transfer
View gist:3455080
require 'uri'
require 'net/http'
class Chunked
def initialize(data, chunk_size)
@size = chunk_size
if data.respond_to? :read
@file = data
View gist:3166569
database: logservice_development
- localhost:27017
# Change whether the session persists in safe mode by default.
# (default: false)
View captain_logger.rb
# Example
# class Foo
# include CaptainLogger
# log_to :file => "foo.log"
# end
module CaptainLogger
def self.included(base)
class << base
blanchma / logger_module
Created Jul 6, 2012
Simple logger module
View logger_module
# Example
# class Foo
# include CaptainLogger
# config_logger ::file => "foo.log"
# end
module CaptainLogger
def self.included(base)
class << base
blanchma /
Created May 6, 2012 — forked from isaacs/
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl | sh
blanchma / .bashrc
Created Jan 4, 2012
Add Git Branch data to shell
View .bashrc
# GIT Prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
PS1="\u@\h:\w \$(parse_git_branch)\$ "
blanchma / geocoding.js
Created Nov 15, 2011
Get latitude and longitude from browser
View geocoding.js
// if the browser supports the w3c geo api
// get the current position
// if this was successful, get the latitude and longitude
var lat = position.coords.latitude;
var lon = position.coords.longitude;