Skip to content

Instantly share code, notes, and snippets.

View kylewelsby's full-sized avatar
🏠
Working from home

Kyle Welsby kylewelsby

🏠
Working from home
View GitHub Profile
@kylewelsby
kylewelsby / startup.sh
Created January 5, 2012 17:46
Start EVERYTHING!
#!/bin/sh
sudo /usr/local/sbin/nginx;
sudo apachectl start
mysql.server start;
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
exit;
@kylewelsby
kylewelsby / clean.sh
Created January 20, 2012 08:51
Deploying Heroku Safe Style
#!/bin/bash
# This tool checks if there are any uncommitted changes in the current git branch.
# If it finds any uncommited changes it exits with an error.
# We use it to prevent pushing dirty changes to production.
clean=$(git status | grep "nothing to commit (working directory clean)")
if [ -z "$clean" ]; then
echo There are uncommitted changes.
exit 1
else
@kylewelsby
kylewelsby / index.json.rabl
Created April 11, 2012 17:08
View Specs Real Example
if @grouped
object @days
node do |date|
node(:changed) { date[:changed].format }
node(:balance) { date[:balance].format }
child date[:transactions] => :transactions do
extends 'transactions/show'
end
node(:date) { date[:date] }
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics.
@kylewelsby
kylewelsby / application_helper.rb
Created October 2, 2012 14:46
testing a application helper
def active_tab
link_to("Homepage", root_path, :class => ("active" if current_page? root_path))
end
@kylewelsby
kylewelsby / risk.rb
Created October 18, 2012 18:04
Example for NWRUG visitor
require 'rspec'
class Risk
def code(user)
user_site = user.site[0..1]
if department
department_name = department.name[0..1]
end
[user_site,department_name,"001"].compact.join('-').upcase
require 'capistrano/ext/multistage'
require "rvm/capistrano"
require "bundler/capistrano"
require "delayed/recipes"
require 'new_relic/recipes'
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system
set :default_environment, {
'PATH' => "/home/rails/.rvm/gems/ruby-1.8.7-p370@appname/bin:/home/rails/.rvm/bin:/home/rails/.rvm/rubies/ruby-1.8.7-p370/bin:$PATH",
@kylewelsby
kylewelsby / client_controller.rb
Created February 27, 2013 10:10
Simple RSpec Controller Examples
class ClientController < ApplicationController
respont_to :html
def show
@client = Client.find(params[:id])
respond_with @client
end
end
app = angular.module('Simple')
@SimpleCtrl = ['$scope', ($scope) ->
$scope.data = {output: 'hello world'}
doSomething = () ->
$scope.data.output => "hello application."
]
###
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<base href="http://localhost:3000/proxy/">
</head>
<body>
<p>Open the console and notice the following error
<code>