Skip to content

Instantly share code, notes, and snippets.

View chetan's full-sized avatar
🙌
like my work? sponsor me!

Chetan Sarva chetan

🙌
like my work? sponsor me!
View GitHub Profile
@headius
headius / gist:1234935
Created September 22, 2011 14:38
OS X 'pickjdk' command with single-command selection and updated JDK location
#!/bin/bash
#
# Provides a function that allows you to choose a JDK. Just set the environment
# variable JDKS_ROOT to the directory containing multiple versions of the JDK
# and the function will prompt you to select one. JAVA_HOME and PATH will be cleaned
# up and set appropriately.
_macosx()
{
if [ $(uname -s) = Darwin ]; then
@etorreborre
etorreborre / gist:1387113
Created November 22, 2011 21:50
An example of a non-terminating compilation with javac
/** from http://www.reddit.com/r/programming/comments/mlbna/scala_feels_like_ejb_2/c31z0co */
interface Pong<T> {}
class Ping<T> implements Pong<Pong<? super Ping<Ping<T>>>> {
static void Ping() {
Pong<? super Ping<Long>> Ping = new Ping<Long>();
}
}
> javac Ping.java
@chetan
chetan / install_cpanm_oneliner.sh
Created December 22, 2011 21:23
install cpanm in oneline
## don't screw around with cpan! just just cpan-minus!!
##
## run as root!
cd /usr/local/bin; curl -fsSLO http://xrl.us/cpanm; chmod 755 cpanm
## then install away!
## -q = queit, -n no test (who needs those pesky things?!)
cpanm -qn Moose
@jonathantneal
jonathantneal / templatejs.js
Created January 21, 2012 07:23
templatejs.js
// TemplateJS v3.1.1 MIT/GPL2 @jon_neal
(function (global) {
function escapeJS (str) {
return str.replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r');
}
function TemplateWalk (str, chars, helpers, instance) {
// check for the opening delimiters and init our array buffer
var index = str.indexOf(chars.START_PROP), buffer = '', helper;
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@peternixey
peternixey / securing_rails_updates.md
Created March 5, 2012 13:10
How Homakov hacked GitHub and how to protect your application by Peter Nixey

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey


@codahale
codahale / pom.xml
Last active April 20, 2024 01:38
Take this and save it as pom.xml in your project directory.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- none yet -->
@jrochkind
jrochkind / gist:2161449
Created March 22, 2012 18:40
A Capistrano Rails Guide

A Capistrano Rails Guide

by Jonathan Rochkind, http://bibwild.wordpress.com

why cap?

Capistrano automates pushing out a new version of your application to a deployment location.

I've been writing and deploying Rails apps for a while, but I avoided using Capistrano until recently. I've got a pretty simple one-host deployment, and even though everyone said Capistrano was great, every time I tried to get started I just got snowed under not being able to figure out exactly what I wanted to do, and figured I wasn't having that much trouble doing it "manually".

@eungjun-yi
eungjun-yi / gfm.coffee
Created April 10, 2012 08:53
Coffeescript port of gfm at https://gist.github.com/118964
crypto = require 'crypto'
gfm = (text) ->
# Extract pre blocks
extractions = {}
text = text.replace /<pre>(\n|.)*?<\/pre>/gm, (match) ->
md5 = crypto.createHash('md5').update(match).digest('hex')
extractions[md5] = match
'{gfm-extraction-' + md5 + '}'
@jimtla
jimtla / underscoreR.coffee
Created May 6, 2012 21:51
Add CoffeeScript friendly argument order to Underscore.js
# Five lines of code that will make your underscore + CoffeeScript use cleaner.
# Creates an underscore function for each function in to_reverse with R (short for Reversed) appended to the name.
# The R version moves the function argument (first argument in normal underscore) to the end,
# so you can write:
$(window).scroll _.throttleR 500, ->
console.log "This print's at most every 500ms"
# Instead of:
$(window).scroll _.throttle ->
console.log "This prints at most every 500ms too"