Skip to content

Instantly share code, notes, and snippets.

View jschoolcraft's full-sized avatar

Jeff Schoolcraft jschoolcraft

View GitHub Profile
@jschoolcraft
jschoolcraft / gist:2876923
Created June 5, 2012 18:52 — forked from chrismdp/gist:2768532
Paypal IPN integration in about 30 lines of Sinatra.
diff --git a/app/account.rb b/app/account.rb
index a108685..c89ad34 100644
--- a/app/account.rb
+++ b/app/account.rb
@@ -1,4 +1,22 @@
+require 'open-uri'
+
module Sol
+ class Url
+ def self.get(url)
#! /usr/bin/env ruby
# Generate all tags for all gems included by bundler in gems.tags
#
# Basically does the same as "bundle show gemname", except for all gems.
# Interestingly enough, "bundle show" without any arguments falls back to
# "bundle list", otherwise the whole thing could have been a bash one-liner.
require 'bundler'
@jschoolcraft
jschoolcraft / os_x_free_memory.txt
Created April 12, 2012 19:48 — forked from remear/os_x_free_memory.txt
Free Memory Command on OS X
echo -e "\n$(top -l 1 | awk '/PhysMem/';)\n"
=> PhysMem: 1701M wired, 6232M active, 976M inactive, 8909M used, 3376M free.
Add to ~/.bash_profile
alias freemem="top -l 1 | awk '/PhysMem/'"
A more brief output:
@jschoolcraft
jschoolcraft / postgresql.rb
Created April 11, 2012 20:08 — forked from KronicDeth/postgresql.rb
Postgres 8.4.8 Homebrew forumula
require 'formula'
require 'hardware'
class Postgresql <Formula
homepage 'http://www.postgresql.org/'
url 'http://ftp2.uk.postgresql.org/sites/ftp.postgresql.org/source/v8.4.8/postgresql-8.4.8.tar.bz2'
md5 '4603e8ea30cee97189b62b39022f2043'
depends_on 'readline'
depends_on 'libxml2' if MACOS_VERSION < 10.6 # Leopard libxml is too old
@jschoolcraft
jschoolcraft / postgresql.rb
Created April 11, 2012 20:04 — forked from ryanwood/postgresql.rb
Postgres 8.4.6 Homebrew forumula
require 'formula'
require 'hardware'
class Postgresql < Formula
homepage 'http://www.postgresql.org/'
url 'http://ftp2.uk.postgresql.org/sites/ftp.postgresql.org/source/v8.4.6/postgresql-8.4.6.tar.bz2'
md5 'fcc3daaf2292fa6bf1185ec45e512db6'
depends_on 'readline'
depends_on 'libxml2' if MACOS_VERSION < 10.6 # Leopard libxml is too old
@jschoolcraft
jschoolcraft / hack.sh
Created March 31, 2012 11:30 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#

Here's how to install PostgreSQL and have it run automatically at startup, on an Ubuntu 10.04 virtual machine using Vagrant. This took me a while to figure out:

Add the default lucid32 base box to your vagrant, if you haven't already:

host> vagrant box add lucid32 http://files.vagrantup.com/lucid32.box 

Now make a new lucid32 virtual machine and install postgresql on it:

@jschoolcraft
jschoolcraft / code_cleanup.sh
Created February 4, 2012 01:04
Used to clean up rubyish code, make unix line endings, tabs to spaces, kill trailing whitespace.
#!/bin/bash
main() {
find_files |
exclude_vcs_dirs |
exclude_common_dirs_that_are_not_ours |
exclude_extra_dirs |
cleanup_the_code
}
@jschoolcraft
jschoolcraft / phonegap.css
Created January 9, 2012 21:36 — forked from danro/phonegap.css
CSS Useful PhoneGap Properties
* {
-webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */
-webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */
-webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
-webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */
margin: 0;
padding: 0;
border: 0;
}
@jschoolcraft
jschoolcraft / ObsidianCode.dvtcolortheme
Created December 4, 2011 15:37 — forked from subdigital/ObsidianCode.dvtcolortheme
Obsidian Code Theme for Xcode
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>