Skip to content

Instantly share code, notes, and snippets.

View thefonso's full-sized avatar

thefonso thefonso

View GitHub Profile
@thefonso
thefonso / about.md
Created July 3, 2012 16:44 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@thefonso
thefonso / gist:3375436
Created August 17, 2012 02:42 — forked from jugyo/gist:865454
TextMate command to convert haml to html
#!/usr/bin/env ruby
# Input: Selected Text or Nothing
# Output: Replace Selected Text
require 'tempfile'
def unindent(text)
lines = text.split(/\n/)
level = lines.map{|l| l[/^\s*/].size}.min
@thefonso
thefonso / example2.js
Created November 15, 2012 18:16 — forked from anonymous/example2.js
MongoDB map reduce example 2
// suggested shell cmd line to run this:
//
// mongo --shell example2.js
//
// Note: the { out : … } parameter is for mongodb 1.8+
db.things.insert( { _id : 1, tags : ['dog', 'cat'] } );
db.things.insert( { _id : 2, tags : ['cat'] } );
db.things.insert( { _id : 3, tags : ['mouse', 'cat', 'dog'] } );
db.things.insert( { _id : 4, tags : [] } );
@thefonso
thefonso / theme.html
Created December 1, 2012 21:34 — forked from soemarko/theme.html
embed github gist to tumblr
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->
@thefonso
thefonso / gist_line_numbers.css
Created December 1, 2012 22:21 — forked from potch/gist_line_numbers.css
CSS to add line numbers to embedded gists
.gist-highlight {
border-left: 3ex solid #eee;
position: relative;
}
.gist-highlight pre {
counter-reset: linenumbers;
}
.gist-highlight pre div:before {
@thefonso
thefonso / gistembed.js
Created December 1, 2012 22:41 — forked from vitorbal/gistembed.js
Use writeCapture to embed gists to Tumblr
$(document).ready(function() {
var prefix = "https://gist.github.com/";
$('a[href^="' + prefix + '"]').each(function(i) {
var $anchor = $(this),
$el = $("<p></p>");
$anchor.replaceWith($el);
writeCapture.html($el, '<script src="'+$anchor.text()+'.js"></scr' + 'ipt>');
$anchor.remove();
});
});
#!/usr/bin/ruby
=begin
Usage: rtftomarkdown.rb FILENAME.rtf
Uses textutil, available on Mac only (installed by default)
Outputs to STDOUT
Notes:
Links are replaced with Markdown references (duplicate links combined).

Solving an algorithm for a friend to be able to tell his emacs what window he wants to replace his current window when he closes it.

@thefonso
thefonso / curl.md
Created January 12, 2013 19:25 — forked from btoone/curl.md

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin