Skip to content

Instantly share code, notes, and snippets.

View jpinnix's full-sized avatar

Jeremy Pinnix jpinnix

View GitHub Profile
@jpinnix
jpinnix / gist:821880
Created February 11, 2011 03:32
Janus install problem
rake --trace
(in /Users/jpinnix/.vim)
** Invoke default (first_time)
** Invoke ack.vim (first_time)
** Execute ack.vim
****************************************
* Installing ack.vim *
****************************************
App details:
Rails 3.0.0
Bundler 1.0
http://github.com/challengepost/postmark-rails (fork for Rails 3)
Ran bundle install, everything installed correctly. Checked in Gemfile.lock and
added 'require "bundler/capistrano"' to deploy.rb. Works totally fine on local.
But on deploy it locks up when trying to init submodules:
No submodule mapping found in .gitmodules for path
@jpinnix
jpinnix / gist:547977
Created August 24, 2010 17:55
Help nginx+passenger serve static index pages
# Help nginx+passenger serve static index pages
# Site specific config
server {
listen 80;
server_name domain.com;
index index.html;
access_log logs/appname.access.log;
error_log logs/appname.error.log;
@jpinnix
jpinnix / image.rb
Created August 12, 2010 19:29 — forked from bhauman/image.rb
Paperclip set width and height of an image
class Image < ActiveRecord::Base
before_create, :set_width_and_height
has_attached_file :img,
:url => "/system/images/:attachment/:id/:basename.:extension",
:path => "#{Rails.root}/public/system/images/:attachment/:id/:basename.:extension"
def set_width_and_height
# this next line is the magic line
geo = Paperclip::Geometry.from_file(img.to_file(:original))
@jpinnix
jpinnix / download_twitter_feed.rake
Created July 19, 2010 19:49
Include recent tweets in a Rails app
#lib/tasks/download_twitter_feed.rake
desc "Download Twitter Feed"
task :download_twitter_feed do
require 'open-uri'
etag_cache = open( "#{RAILS_ROOT}/public/system/etag_cache.txt" ).read
begin
@jpinnix
jpinnix / Pixelgrazer.taskpapertheme
Created July 8, 2010 17:59
Pixelgrazer TaskPaper Theme
<theme>
<!-- Window Style -->
<color id="foreground" red="1.0" green="0.776" blue="0.427" alpha="1.0" />
<color id="background" red="0.255" green="0.255" blue="0.255" alpha="1.0" />
<window foregroundColorID="foreground" backgroundColorID="background" shouldUseHUDScrollers="no" />
<!-- Text View Style -->
<color id="tag" red="0.800" green="0.471" blue="0.200" alpha="1.0" />
<color id="handle" extendsColorID="foreground" />
<color id="insertionPoint" red="1.0" green="1.0" blue="1.0" alpha="1.0" />
@jpinnix
jpinnix / gist:400152
Created May 13, 2010 18:07
jQuery - Make all external links open in new tab/window
// JQuery - Make all external links open in new tab/window
// Mashup of:
// http://travisroberts.tumblr.com/post/595428703/jquery-external-links-open-new-window
// http://snipplr.com/view.php?codeview&id=29949
$(document).ready(function() {
$("a[href*='http://']:not([href*='"+location.hostname+"'])").click( function() {
window.open( $(this).attr('href') );
return false;
});
formatted_time_accessor :occurs_at, :occurs_until
# Lo-fi client for the Facebook API. E.g.:
#
# fb = FacebookClient.new(:api_key => 'api-key', :secret => 'secret')
# fb.call 'users.getInfo', :session_key => 'session-key', :uids => 'user-id', :fields => 'birthday'
#
class FacebookClient
def initialize(default_params={})
@default_params = default_params.reverse_merge({
:rest_server => 'http://api.new.facebook.com/restserver.php',
:format => 'JSON',
# Back up your iTunes library to S3
git clone git://github.com/sstephenson/mackerel.git
ruby -rubygems mackerel/examples/itunes_backup.rb amazon-s3://YOUR_ACCESS_KEY_ID:YOUR_SECRET_ACCESS_KEY@s3.amazonaws.com/YOUR_BUCKET_NAME/itunes.mackerel