Skip to content

Instantly share code, notes, and snippets.

View louismullie's full-sized avatar

L louismullie

View GitHub Profile
@dacbd
dacbd / crypt.js
Created September 27, 2012 20:05
SJCL ecc encrypt/decrypt
var data = {
herp: "derp"
};
//Make the keys.
var temp = sjcl.ecc.elGamal.generateKeys(384, 1);
//to encrypt with publickey:
var pubjson = temp.pub.serialize();
var point = sjcl.ecc.curves["c" + pubjson.curve].fromBits(pubjson.point);
@jackkinsella
jackkinsella / blueprint_to_bootstrap.sh
Created July 25, 2012 14:39
Convert Blueprint to Twitter Bootstrap Span Classes - one-liner
# Commit before using this script since it changes your files permanently.
# Run from your web app's root folder.
ack -l "span-[0-9][0-9]?" | xargs sed -i "" -E 's/span-([0-9]{1,2})/span\1/'
@peterc
peterc / mutation_detection.rb
Created July 1, 2012 03:15
Argument mutation detection in Ruby (rough experiment)
# encoding: utf-8
# This is a very early scrappy step in building an automatic memoizer (think IncPy)
# in pure Ruby. Is it possible? Who knows. A first step, then, is to rule out any
# methods that mutate their parameters.. which I attempt to do here.
# Added:
# Added clever define_method and 'store the old method in a closure' trickery
# from Caius Durling's fork at https://gist.github.com/3027213/f900b1ec8e04736267fe445607a4aeb3feea9b54
@piatra
piatra / index.html
Created April 29, 2012 11:47
Record stream from getUserMedia() stream
<!DOCTYPE HTML>
<html>
<head>
<title>Video recording demo</title>
<link rel="stylesheet" type="text/css" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
@stve
stve / sitestream.rb
Created March 26, 2012 04:47
TweetStream SiteStream example
require 'tweetstream'
require 'yajl'
TweetStream.configure do |config|
config.consumer_key = ENV['consumer_key']
config.consumer_secret = ENV['consumer_secret']
config.oauth_token = ENV['oauth_token']
config.oauth_token_secret = ENV['oauth_token_secret']
config.parser = :yajl
config.auth_method = :oauth
@nathanhammond
nathanhammond / Emscripten OS X.md
Created March 4, 2012 21:48
How to get Emscripten running on OS X.

Running emscripten on OS X

There are a number of additional dependencies required for getting things installed on OS X. Starting with a blank slate OS X machine, this is the process it takes:

# Install Xcode Command Line Tools

# Install Homebrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
@Yavari
Yavari / README.markdown
Created February 23, 2012 09:00 — forked from gudbergur/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@jeffreyiacono
jeffreyiacono / Rakefile
Created February 8, 2012 20:15
rake task for precompiling assets using sprockets within a sinatra app + view helpers
require 'rubygems'
require 'bundler'
Bundler.require
require './application'
namespace :assets do
desc 'compile assets'
task :compile => [:compile_js, :compile_css] do
end
class Lisp
def initialize
@env = {
:label => lambda { |(name,val), _| @env[name] = val },
:quote => lambda { |sexpr, _| sexpr[0] },
:car => lambda { |(list), _| list[0] },
:cdr => lambda { |(list), _| list.drop 1 },
:cons => lambda { |(e,cell), _| [e] + cell },
:eq => lambda { |(l,r), _| l == r },
:if => lambda { |(cond, thn, els), ctx| eval(cond, ctx) ? eval(thn, ctx) : eval(els, ctx) },
@voidfiles
voidfiles / textrank.py
Created January 20, 2012 08:22
An implmentation of TextRank in python
"""
From this paper: http://acl.ldc.upenn.edu/acl2004/emnlp/pdf/Mihalcea.pdf
I used python with nltk, and pygraph to do an implmentation of of textrank.
for questions: http://twitter.com/voidfiles
"""
import nltk
import itertools