Skip to content

Instantly share code, notes, and snippets.

View aaronmoodie's full-sized avatar
Coffee

Aaron Moodie aaronmoodie

Coffee
View GitHub Profile
@aaronmoodie
aaronmoodie / README.md
Created September 2, 2012 23:55 — forked from hongymagic/README.md
Simple zsh wrapper to launch iA Writer from the terminal

This is a simple script to launch iA Writer from the terminal. It is extremely useful for interacting with Github's own wiki system as it provides git access.

INSTALL

One-liner

curl -L https://raw.github.com/gist/3605724/efcccacb59e5df271ddf603ac92da4deee2440df/ia > /usr/local/bin/ia && chmod u+x /usr/local/bin/ia

Manual, safer way

@aaronmoodie
aaronmoodie / theme.html
Created April 17, 2012 22:55 — 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>
-->
$('#submitForm').click(function(event) {
var total = 0;
$('select.sandwich').each(function() {
total = total + $(this).attr('value');
});
if(total < 10 ) {
event.preventDefault();
$('div.minRequired').css('display', 'block');
} else {
$('div.minRequired').css('display', 'none');
@aaronmoodie
aaronmoodie / config.ru
Created March 6, 2012 10:36
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
# The following lines should come as no surprise. Except by
@aaronmoodie
aaronmoodie / update mongodb on Ubuntu aptitude
Created October 5, 2011 02:10
This is a step by stem walk through for updating to the latest MongoDB distro. It was posted on a site no loger active, so have placed it here for reference.
# 1. Add GPG Key
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
# 2. Open source.list
# Add 10gen as source to end of file: deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
# update Aptitude sources
$ vim /etc/apt/source.list
$ sudo apt-get update
<?php
$clients = 'Whoop!';
$stats = 'Poop!';
if ( $clients || $stats ) {
echo '<h2 class="title"><span>The Results</span></h2>';
if ( $clients ) echo '<div class="clients left">' .$clients. '</div>';
if ( $stats ) echo '<div class="stats left">' .$stats. '</div>';
} else {
echo '<!-- no content -->';
function getImages(setID) {
$.getJSON("http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=yourKeyhere8&photoset_id=" + setID + "&lang=en-us&format=json&jsoncallback=?", displayImages);
}
function displayImages(data) {
var htmlString = "";
$.each(data.photoset.photo, function(i,photo){
var imgSrc = 'http://farm' + photo.farm + '.static.flickr.com/' + photo.server + '/' + photo.id + '_' + photo.secret + '_b.jpg';
htmlString += '<img title="' + photo.title + '" src="' + imgSrc;
def download_file(url)
request = "GET #{url} HTTP/1.0\r\n\r\n"
host = /^https?:\/\/([^\/]+)/.match(url.to_s)
socket = TCPSocket.open(host[1].to_s,80)
socket.print(request)
# find beginning of response body
buffer = ""
while !buffer.match("\r\n\r\n") do
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cross-browser kerning-pairs & ligatures</title>
<style>
body { font-family: sans-serif; background: rgba(30, 10, 0, 0.05); color: rgba(40, 30, 0, 1); width: 500px; margin: 80px auto; padding: 0px; }
a { color: rgba(15, 10, 0, 0.8); text-decoration: none; border-bottom: 1px solid; padding: 1px; -webkit-transition: background 1s ease; }
a:hover { background: rgba(0, 220, 220, 0.2); }
p { line-height: 1.5; padding: 0px 1em 0em 0em; }
atom-text-editor::shadow atom-text-editor-minimap {
background: #282C34;
}