Skip to content

Instantly share code, notes, and snippets.

View phlco's full-sized avatar

Phillip Lamplugh phlco

  • Los Angeles, CA
View GitHub Profile
@phlco
phlco / afternoon.md
Last active December 25, 2015 00:29
afternoon psql

OH SNAP

Let's practice some SQL

CREATE DATABASES based on the following Classes

# create a db called middle_earth_db
class Hobbit
  attr_accessor :name, age, :is_couragous
end
@phlco
phlco / activerecord.rb
Created October 9, 2013 13:28
active_record
require 'active_record'
ActiveRecord::Base.logger = Logger.new( STDOUT )
ActiveRecord::Base.establish_connection(
:adapter => "postgresql",
:host => "localhost",
:username => "philco",
:password => "",
:database => "amazon_db"
@phlco
phlco / Rakefile
Created October 10, 2013 03:25
rake task for homework
require 'git'
require 'date'
require 'logger'
START_DATE = Date.parse('23/09/2013')
namespace :hw do
desc "gets homework"
task :get do
@phlco
phlco / basic heroku sinatra setup
Created October 11, 2013 16:27
pushing to heroku
Pushing to Heroku
Install Heroku
Create an account on Heroku
Install the Heroku Toolbelt
$ heroku login
Enter your Heroku credentials.
Email: [email protected]
Password:subl
Could not find an existing public key.
Would you like to generate one? [Yn]
@phlco
phlco / database.yml
Last active March 24, 2021 04:02
database.yml for postgres
development: &defaults
adapter: postgresql
encoding: unicode
pool: 5
host: localhost
username: <%= `echo $USER`.chomp %>
password:
database: <%= File.basename(Rails.root) %>_development
test:
@phlco
phlco / spec_helper.rb
Created October 21, 2013 13:16
spec_helper.rb
# Configure Rspec to print nice
RSpec.configure do |config|
# Use color in STDOUT
config.color_enabled = true
# Use color not only in STDOUT but also in pagers and files
config.tty = true
# Use the specified formatter
config.formatter = :documentation # :progress, :html, :textmate
# immediately stop running upon first failure
config.fail_fast = true
@phlco
phlco / .travis.yml
Last active December 29, 2015 00:09
travis rake task for jasmine and rspec
language: ruby
rvm:
- 1.9.3
before_script:
- "sh -e /etc/init.d/xvfb start"
- "export DISPLAY=:99.0"
- "export JASMINE_SPEC_FORMAT=documentation"
script:
- "bundle exec rake travis:run"
env:
class XHRConstraint
def matches?(request)
!request.xhr? && !(request.url =~ /\.json$/ && ::Rails.env == 'development')
end
end
match '(*url)' => 'home#index', :constraints => XHRConstraint.new
@phlco
phlco / rails_setup.rb
Last active December 30, 2015 00:59
rails setup
# README
# pass in this file when creating a rails project
#
# for example:
# rails _3.2.14_ new awesome_app -d postgresql -m ~/kickhash_template.rb
remove_file "README.rdoc"
create_file "README.md", "TODO"
gem_group :development, :test do
@phlco
phlco / uninstalls.sh
Last active January 2, 2016 20:39
Installfest Bash script to uninstall Macports and RVM
# This script checks for and removes previous installs of macports and rvm
# http://stackoverflow.com/questions/5735666/execute-bash-script-from-url
# This is meant to be run by pasting the following into Terminal
# bash <(curl -s https://gist.github.com/phlco/8358292/raw/48f61796b20f879cdfa30250614ac40ec2a76d43/uninstalls.sh)
# This script checks for and removes previous installs of macports or rvm
# http://stackoverflow.com/questions/3976362/bash-scripts-requiring-sudo-password
# Run the Script with sudo
sudo -v