Skip to content

Instantly share code, notes, and snippets.

View jpinnix's full-sized avatar

Jeremy Pinnix jpinnix

View GitHub Profile
@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 / 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 / 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;
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: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 *
****************************************
User john:
ssh john@common-machine
screen -S pairprog
Ctrl-a :multiuser on
Ctrl-a :acladd pete
User pete:
@jpinnix
jpinnix / gist:3079197
Created July 9, 2012 21:43
Install MySQL on Lion using Homebrew
$ brew update
$ brew install mysql
$ mysql_install_db --verbose --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
$ mkdir -p ~/Library/LaunchAgents
$ cp /usr/local/Cellar/mysql/5.5.25a/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ mysql -uroot
@jpinnix
jpinnix / gist:3079208
Created July 9, 2012 21:46
Installing Nokogiri on Lion using Homebrew
# From http://nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x
$ brew update
$ brew install libxml2 libxslt
$ brew link libxml2 libxslt
$ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
$ tar xvfz libiconv-1.13.1.tar.gz
$ cd libiconv-1.13.1
$ ./configure --prefix=/usr/local/Cellar/libiconv/1.13.1
$ make
@jpinnix
jpinnix / gist:3186304
Created July 27, 2012 05:25
Installing Ruby 1.8.7-p358 with rbenv on Mountain Lion
Follow the instructions here: The Hitchhiker's Guide to Riding a
Mountain Lion http://j.mp/Qm5UJD, including installing XQuartz.
After installing XQuartz set the correct path to the X11 library to
install Ruby 1.8.7-p358 with rbenv:
export CPPFLAGS=-I/opt/X11/include
then let the compiler know where gcc-4.2 is:
@jpinnix
jpinnix / DCI.md
Created February 13, 2014 14:23
Notes from presentation by Trygve Reenskaug - Object Orientation Revisited. Simplicity and power with DCI.

“Object Orientation Revisited. Simplicity and power with DCI.” by Trygve Reenskaug

Great presentation by Trygve Reenskaug, the creator of MVC, on an extension of OO principles, called DCI (Data, Context, Interaction). If you are a programmer, watch this on Vimeo!

A DCI Class says everything about the inside of an object and nothing about its neighbors.

A DCI Context says everything about a network of communicating objects and nothing about their insides.

The DCI paradigm