Skip to content

Instantly share code, notes, and snippets.

View joshleaves's full-sized avatar

Arnaud 'red' Rouyer joshleaves

View GitHub Profile
@wtaysom
wtaysom / where_is.rb
Created September 23, 2011 08:57
A little Ruby module for finding the source location where class and methods are defined.
module Where
class <<self
attr_accessor :editor
def is_proc(proc)
source_location(proc)
end
def is_method(klass, method_name)
source_location(klass.method(method_name))
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@mattmccray
mattmccray / Makefile
Created October 19, 2012 04:15
Simple comparison of several compile-to-javascript languages, including: CoffeeScript, Dart, Haxe, and TypeScript.
.PHONY: compile
time=/usr/bin/time
compile: dart typescript coffeescript haxe jsx
dart:
$(time) dart2js -ooutput/dart.js source/simple.dart
typescript:
@k4nar
k4nar / download-google-music-collection.py
Created October 19, 2012 09:13
Download all Google Music's collection from user account. Uses gmusicapi (https://github.com/simon-weber/Unofficial-Google-Music-API)
import os
from subprocess import call
from gmusicapi import api
g = api.Api()
print "Loging..."
g.login("email", "password")
print "OK !"
for song in g.get_all_songs():
@rlmattax
rlmattax / gist:3962926
Created October 27, 2012 04:20
Active Admin User Impersonation
ActiveAdmin.register User do
menu :parent => "Users"
member_action :impersonate, :method => :get do
user = User.find(params[:id])
flash[:notice] = "Successfully logged in as : #{user.email} #{view_context.link_to('Be careful!', root_path)}".html_safe
begin
warden.set_user(resource,{:scope=>:user,:run_callbacks=>false})
rescue
flash[:error] = "Unable to log you in. Poop."
@klange
klange / _.md
Last active May 23, 2024 13:45
It's a résumé, as a readable and compilable C source file. Since Hacker News got here, this has been updated to be most of my actual résumé. This isn't a serious document, just a concept to annoy people who talk about recruiting and the formats they accept résumés in. It's also relatively representative of my coding style.

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le
@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger (doppelheathen@gmail.com)
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@jrf0110
jrf0110 / requireDir.js
Created March 23, 2013 22:41
Node.js require a directory
/**
* Require a directory of javascript modules
*
* Each file in the directory is a key in the returning object
* If recursive: true is specified in the options, directories
* will be followed. The directory name will be the key and the
* value be the result of requireDir on that directory
*
* {path} [String] - Path to the directory
* {options} [Object] - Additional options
@trinitronx
trinitronx / truecrypt_fix.bash
Last active April 27, 2023 15:45 — forked from jimjh/truecrypt_fix.bash
Fixes annoying brew doctor messages caused by Truecrypt
#!/bin/bash
libs=( "/usr/local/lib/libmacfuse_i32.2.dylib" \
"/usr/local/lib/libosxfuse_i32.2.dylib" \
"/usr/local/lib/libosxfuse_i64.2.dylib" \
"/usr/local/lib/libmacfuse_i64.2.dylib" \
"/usr/local/lib/libosxfuse_i32.la" \
"/usr/local/lib/libosxfuse_i64.la" \
"/usr/local/lib/pkgconfig/osxfuse.pc" )