Skip to content

Instantly share code, notes, and snippets.

View reu's full-sized avatar

Rodrigo Navarro reu

View GitHub Profile
@nikhilm
nikhilm / jscrush-compress-pseudo.js
Created April 15, 2012 17:00
JSCrush 'reverse engineering'
segmentLengthBound = ... // B, originally set to s.length/2
counter = {} // o
bestSavings = 0 // M
maxRepetitions = 0 // N
bestSegment = 0 // e
longestSegmentLength = 0 // Z
segmentLength = 0 // t
while (segmentLength <= segmentLengthBound) {
start = 1;
@todb
todb / cpill.rb
Last active October 3, 2015 17:08
CyanidePill -- poison your own DNS
#!/usr/bin/env ruby
# Note, this must be run as root, and is super dangerous.
# You should not use it. It was written in about 75 minutes total.
# Copyright (c) 2012 Tod Beardsley
# Licensed under the Ruby license.
require 'packetfu'
require 'net/dns'
@aseemk
aseemk / url.coffee
Created April 27, 2012 05:51
Simplified wrapper around Node's native 'url' module
# url.coffee
# by Aseem Kishore ( https://github.com/aseemk ), under MIT license
#
# A simplified wrapper around the native 'url' module that returns "live"
# objects: updates to properties are reflected in related properties. E.g.
# updates to the `port` property will be reflected on the `host` property.
#
# The public API and behavior are pretty close to the native 'url' module's:
# http://nodejs.org/docs/latest/api/url.html Currently lacking / known issues:
#
@lancejpollard
lancejpollard / index.md
Created May 22, 2012 06:32
Notes on Ember.js overcomplicating...

Some random notes on the pangs of ember. Will be expanding as they are uncovered.

Building a form

Say you have a form that maps to a model, something like:

<form>
  <fieldset>
    <legend>Who are you?</legend>
@bokmann
bokmann / ruby-noise-addendum.rm
Created June 1, 2012 03:34
FM Synthesis with portaudio and ruby noise
# FM Synthesis code I wrote whole dorking out with
# https://github.com/awwaiid/ruby-noise
# first, lets define some variables we can use
harmonic_ratio = 1.5 # overtones involving the perfect 5th
#harmonic_ratio = 1.33 # overtones involving the perfect 4th
#harmonic_ratio = 1.25 # overtones involving the major 3rd
#harmonic_ratio = 1.2 # overtones involving the minor 3rd
# harmonic ratios close to these values introduce a wobble
# characteristic of analog synthesizers. Diverge much
@maccman
maccman / juggernaut.rb
Created June 26, 2012 02:49
Sinatra Server Side Event streaming.
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@maccman
maccman / juggernaut_channels.rb
Created June 26, 2012 04:56
Sinatra Server Side Event streaming with private channels.
# Usage: redis-cli publish message.achannel hello
require 'sinatra'
require 'redis'
conns = Hash.new {|h, k| h[k] = [] }
Thread.abort_on_exception = true
get '/' do
@blazingpair
blazingpair / gist:3069750
Created July 8, 2012 07:13
Automatically trim whitespace on git commit, save to .git/hooks/pre-commit
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
# Find files with trailing whitespace
@sgmurphy
sgmurphy / url_slug.js
Created July 12, 2012 02:05
URL Slugs in Javascript (with UTF-8 and Transliteration Support)
/**
* Create a web friendly URL slug from a string.
*
* Requires XRegExp (http://xregexp.com) with unicode add-ons for UTF-8 support.
*
* Although supported, transliteration is discouraged because
* 1) most web browsers support UTF-8 characters in URLs
* 2) transliteration causes a loss of information
*
* @author Sean Murphy <[email protected]>
@kevinelliott
kevinelliott / osx-10.9-setup.md
Last active November 6, 2020 14:19
Clean Install – Mac OS X 10.9 Mavericks

Mac OS X 10.9 Mavericks

Custom recipe to get OS X 10.9 Mavericks running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install.

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Install from App Store