Skip to content

Instantly share code, notes, and snippets.

View tyrel86's full-sized avatar

Tyrel Richey tyrel86

View GitHub Profile
require 'spec_helper'
describe User do
before { @user = FactoryGirl.build :user }
it "should have a factory ready to test" do
@user.should be_valid
end
end
@tyrel86
tyrel86 / spec_helper.rb
Created June 15, 2012 17:47
trying to get models to reload on rerun of specs
require 'rubygems'
require 'spork'
Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
test for one model:
it "Should protect id from mass assignment" do
attributes = @user.attributes
attributes['id'] = 42
lambda do
User.create(attributes).id.should_not equal 42
end.should raise_error ActiveModel::MassAssignmentSecurity::Error
end
@tyrel86
tyrel86 / gist:2943535
Created June 17, 2012 05:44
apache advise
*** tyrel86 [[email protected]] has joined #linode
*** Topic is: Linode Community Support | http://www.linode.com/ | Linode Birthday Giveaway! - http://bit.ly/LVZ36y
*** Topic set by [email protected] [Sat Jun 16 19:27:26 2012]
*** tyrel86 cnasal NateCup MagiC3PO pharaun Defenestrator Nemykal danblack choonming Austinh100 KHobbits_ Dreamer3 brambles tparker eyepulp gadams|away NdFeB lsabota sandeep wrf Daevien jeremyb @restelow Lydia JshWright staticsafe rsdehart tacticus encode dopey_ dan64 nenolod monokrome ekes ChatLeper solipsist minerale G jacob Pici thegodlikehobo EugeneKay Aka danieldg jonas__ WindPower @deaton Badgerer rasengan @stan_theman bss peper avenj Hydroxide eblack lkb_ array
*** auraka dhunter tharkun darkex Peng Eman_ randallman jvaughan_ bradoaks warewolf HalJorda1 scorche|1h eronel jtsage BlandSauce gmcharlt u3q jchen JDLSpeedy vinic ghostbar elky cooldude Drone4four waltman bmn vervain aziwoqpd Sputnik7 rmayorga Justasic pjkh HockeyInJune Chris___ si
@tyrel86
tyrel86 / gist:3130606
Created July 17, 2012 17:02
mod rails vs
<VirtualHost *:80>
ServerName www.bigaviation.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /aviation/public
RailsSpawnMethod smart
PassengerPoolIdleTime 1000
RailsAppSpawnerIdleTime 0
PassengerMaxRequests 5000
PassengerMinInstances 3
<Directory /aviation/public>
@tyrel86
tyrel86 / gist:3244486
Created August 3, 2012 04:53
nginx conf
worker_processes 1;
user nobody nogroup;
pid /tmp/nginx.pid;
error_log /tmp/nginx.error.log;
events {
worker_connections 1024; # increase if you have lots of clients
# Set this to on if you have more than 1 working processes
# This will allow only one child to watch the pollset and accept
@tyrel86
tyrel86 / gist:3244508
Created August 3, 2012 04:54
unicron.rb
worker_processes 4
working_directory "/home/CannaPages/"
# This loads the application in the master process before forking
# worker processes
# Read more about it here:
# http://unicorn.bogomips.org/Unicorn/Configurator.html
preload_app true
timeout 30
@tyrel86
tyrel86 / gist:3244540
Created August 3, 2012 05:00
net stat
root@ID12103:/home/CannaPages# netstat -pln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 787/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4969/nginx
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 734/sshd
tcp6 0 0 :::22 :::* LISTEN 734/sshd
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 1548 787/mysqld /var/run/mysqld/mysqld.sock
@tyrel86
tyrel86 / adilas.rb
Created October 17, 2012 02:01
Adilas Ruby Helper
class AdilasHelper
def initialize( corperate_key )
@key = corperate_key
@client = Savon.client("http://www.adilaswebservices.biz/inventory/webComponents/adilasWeb.cfc?wsdl")
@live_menu = requestLiveMenu
end
def request( action_as_sym, params = {} )
params[:corp_key_id] = @key
@tyrel86
tyrel86 / gist:5146499
Created March 12, 2013 20:05
Bundler ZenTest Clash of the Titens
gem update --system
gem install bundler
bundle install