Skip to content

Instantly share code, notes, and snippets.

View napcs's full-sized avatar

Brian P. Hogan napcs

View GitHub Profile
@napcs
napcs / README.md
Created January 9, 2015 19:42
DigitalOcean Setup

Quickly build a DigitalOcean box

You can use Chef or Puppet to build out your infrastructure, but if you just need a quick and dirty box set up,

Installation

First, download Vagrant and install it.

After that, visit your DigitalOcean account and obtain your API key.

@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 / README.md
Created September 9, 2015 14:09
Learning Preferences App

I'm looking for your help to help me understand React better.

I have an idea for a simple app. It’s based on an educational activity I did in a training session once, and I think it’s a good opportunity for me to learn React.

Here’s the premise. You’re given a shuffled deck of cards. Each card has a type of activity on the card and is a certain color based on the type of learning preference it targets. For example one card may say “You use music during breaks”. You go through the card and place all the ones you actively do in your classroom into one pile, and place the ones you don’t in the discard pile. At the end of the activity, you have a clearer picture of what learning preferences you target, and what preferences you don’t. And you get ideas for activities to do in the classroom.

I thought making a digital version of this would work well. The app would present each card to you and ask you if you do that activity. When you’re all done, the cards would be displayed in both piles.

Here’s where I n

@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