Skip to content

Instantly share code, notes, and snippets.

@iangreenleaf
iangreenleaf / gist:2361836
Created April 11, 2012 19:44
Projects to do someday

These are projects I would build if I had more hours in the day. If you build one of these, let me know!

  • License-bot: Trawl a user's Github repos and look for:
    1. Projects with no license attached.
  1. Licenses with outdated copyright years.
@iangreenleaf
iangreenleaf / php_test.rb
Created December 22, 2011 23:39
Rough tests for tap_out
# ruby -Ilib php_test.rb
require 'test/phpunit'
require 'test/unit'
class PHPTest < Test::Unit::TestCase
extend Test::PHPUnit
phpunit "test.php"
end
https = require 'https'
module.exports.request = ( options, success_handler, error_handler) ->
req_data = if options.data? then JSON.stringify options.data else ""
options['headers'] ?= {}
options['headers']['Content-length'] = req_data.length
req = https.request options, (res) ->
data = ''
res.on 'data', (c) ->
data += c
@iangreenleaf
iangreenleaf / gist:1403976
Created November 29, 2011 08:14
Twitter doesn't know shit about frontend
// This came straight from Twitter's index.html. Enclosed in <script> tags.
// Apparently they do not know about minifiers, or the document-ready event.
// Magical invocations for frame-busting is a great plan, though.
// No, I don't know what their goddamn problem is either.
function bust() {
document.write = "";
window.top.location = window.self.location;
setTimeout(function () {
document.body.innerHTML = '';
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=3
inherit eutils git
DESCRIPTION="A package manager for nodejs."
HOMEPAGE="https://github.com/isaacs/npm/"
SRC_URI=""
@iangreenleaf
iangreenleaf / rvmrc
Created June 21, 2011 06:27
rvm ebuild for Gentoo - not completely kosher
umask g+w
export rvm_path="/usr/local/rvm"
@iangreenleaf
iangreenleaf / gist:941090
Created April 25, 2011 19:57
CSS makes my head hurt
<!DOCTYPE html>
<html>
<head>
<title>Hola</title>
</head>
<body style="background-color: gray;">
<div id="outer" style=" background-color:pink;">
<div style="width:5000px; height:200px; background-color: green;">
Hi
</div>
@iangreenleaf
iangreenleaf / gist:908604
Created April 7, 2011 20:07
the best horoscope I've received

Thoughtful to the extreme, you are often obsessed with perfection and the rules governing your own personal interests. Your world is black and white. You love to work within a logical system, such as language, computer programming, or mathematics. Manipulating a system that can be completely understood is a distinct pleasure to you, because of your confidence in the underlying veracity of your belief system. Because of your appreciation for logic and order, those who speak or think in a sloppy manner are apt to generate more than their share of wrath. Although very amiable, you are not drawn to friendships out of a sense of personal need. You are just as happy by yourself with a good book or puzzle. Because you are so involved with thought, you will on occasion have difficulty dealing with the day-to-day problems of a normal life. Taking out the trash, doing the dishes, these are often left until the last possible moment, if at all.

# Mergesort
# precondition: no nils in the array
def sort some_array
return some_array if some_array.length == 1
half_length = some_array.length / 2
first_half = sort(some_array[0,half_length])
second_half = sort(some_array[half_length, some_array.length - half_length])
result = []
@iangreenleaf
iangreenleaf / gist:562724
Created September 2, 2010 18:47
Impromptu Scheme session
;; Semicolons are comments
> (+ 2 4)
6
> (+ 2 4 8)
14
> (define double (lambda (a) (+ a a)))
> (double 3)
6
> '(1 2 3) ; this is a list
(1 2 3)