Skip to content

Instantly share code, notes, and snippets.

View napcs's full-sized avatar

Brian P. Hogan napcs

View GitHub Profile
@napcs
napcs / env.rb
Created February 9, 2009 21:58 — forked from jeffrafter/env.rb
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'shoulda'
require 'webrat'
require 'factory_girl'
require 'test/factories/clearance'
require 'clearance/../../shoulda_macros/clearance'
require 'cucumber/rails/world'
Cucumber::Rails.use_transactional_fixtures
njero - http://neverlet.be
sutto - http://blog.ninjahideout.com
zapnap - http://blog.zerosum.org
tpope - http://tpope.net
reinh - http://reinh.com
bryanl - http://smartic.us
linoj - http://www.vaporbase.com
technicalpickles - http://technicalpickles.com
MaD15 - enlightsolutions.com/
qrush - http://litanyagainstfear.com/
site = ARGV[0]
raise "Fail." if site.nil? || site == ""
`staticmatic setup #{site}`
Dir.chdir(site)
`wget http://960.gs/files/960_download.zip`
`unzip 960_download.zip`
`rm 960_download.zip`
`mv 960_download/code/css/*.css site/stylesheets`
`rm -rf 960_download`
@napcs
napcs / gist:210599
Created October 15, 2009 02:04
Deploy static sites to your production servers. Built for StaticMatic.
# Scans your project for CSS and JS files and
# runs them through the Yahoo Compression utility
# and then uploads the entire site to your web server via SCP.
# Install prerequisites:
# sudo gem install net-scp
# Download http://www.julienlecomte.net/yuicompressor/
# Create a bin/ folder and place the following files from the download into the folder:
@napcs
napcs / associations.rb
Created February 9, 2010 03:53 — forked from eladmeidar/associations.rb
update_attributes fix for counter_cache
def belongs_to(association_id, options = {})
association_column = options[:foreign_key] ||= association_id.to_s + "_id" #
reflection = create_belongs_to_reflection(association_id, options)
if reflection.options[:polymorphic]
association_accessor_methods(reflection, BelongsToPolymorphicAssociation)
else
association_accessor_methods(reflection, BelongsToAssociation)
association_constructor_method(:build, reflection, BelongsToAssociation)
association_constructor_method(:create, reflection, BelongsToAssociation)
class Person
def say_hello
"Hello"
end
end
class Person
def say_goodbye
"goodbye"
end
# Main sinatra app
require 'sinatra'
require 'activerecord'
require 'activesupport'
include ActionView::Helpers::DateHelper # add the required helpers here.
require 'controllers.rb'
# controllers.rb
@napcs
napcs / .vimrc
Last active December 14, 2022 17:40
Set up Vim on Mac, Linux, or Windows. For Mac and Linux: sh <(curl -s https://gist.githubusercontent.com/napcs/532968/raw/vim.sh)
if has('win32') || has ('win64')
let $VIMHOME = $HOME."/Dropbox/dotfiles/.vim"
if !empty($CONEMUBUILD)
set term=xterm
set t_Co=256
let &t_AB="\e[48;5;%dm"
let &t_AF="\e[38;5;%dm"
endif
@napcs
napcs / gems2gemfile
Created November 22, 2010 20:22 — forked from MSch/gems2gemfile
#!/usr/bin/env ruby
require 'rubygems'
gems = Gem.source_index.search(Gem::Dependency.new(//, Gem::Requirement.default))
gems.each do |gem|
puts "gem '#{gem.name}', '#{gem.version.to_s}'"
end
set nocompatible "don't need to keep compatibility with Vi
filetype plugin indent on " enable detection, plugins and indenting in one step
syntax on "Turn on syntax highlighting
set background=dark "make vim use colors that look good on a dark background
set showcmd "show incomplete cmds down the bottom
set showmode "show current mode down the bottom