Skip to content

Instantly share code, notes, and snippets.

View excid3's full-sized avatar
:shipit:
Shipping

Chris Oliver excid3

:shipit:
Shipping
View GitHub Profile
@excid3
excid3 / archives.php
Created June 15, 2012 04:42
Wordpress Archives
<?php
/*
Template Name: Archives
*/
?>
<?php get_header(); ?>
<div id="content">
<?php
@excid3
excid3 / routes.rb
Created June 18, 2012 00:37
client calls post route
resources :clients do
collection do
post "calls" # Auto maps to clients#calls
end
end
@excid3
excid3 / deploy.rb
Created June 18, 2012 19:02
Capistrano setup
#$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'bundler/capistrano'
set :stages, %w(production staging)
set :keep_releases, 3
set :default_stage, "staging"
require 'capistrano/ext/multistage'
set :whenever_command, "bundle exec whenever"
set :whenever_environment, defer { stage }
articles = [
{ :id => '1', :type => 'article', :title => 'one', :tags => ['ruby'] },
{ :id => '2', :type => 'article', :title => 'two', :tags => ['ruby', 'python'] },
{ :id => '3', :type => 'article', :title => 'three', :tags => ['java'] },
{ :id => '4', :type => 'article', :title => 'four', :tags => ['ruby', 'php'] }
]
Tire.index 'articles' do
import articles
end
class ApplicationController < ActionController::Base
before_filter do
if request.ssl? && Rails.env.production? && request.domain == "mobicontact.net"
redirect_to :protocol => 'http://', :status => :moved_permanently
end
end
end
def create
medic = Medic.find(params[:paging][:incharge_paging_id])
PagingsMailer.paging(medic, message).deliver
end
class Paging < ActiveRecord::Base
#Associations
def send_mail
if medic_id?
PagingMailer.blah(medic, message).deliver
elsif unit_id?
PagingMailer.blah(unit.in_charge, message).deliver
PagingMailer.blah(unit.attendant, message).deliver
end
call.unit.status.try(:unit_status) => Fails
call => Call(1)
call.unit => Call(1).unit => nil
call.unit.status => Call(1).nil.status => ERROR
def word_to_number(word)
onesPlace = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
tensPlace = [nil, 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']
onesPlace.index(word) || tensPlace.index(word) * 10
end
puts word_to_number('one')
puts word_to_number('two')
puts word_to_number('three')
chris at tyndall using ruby-1.9.3-p194 in ~/code
○ brew install macvim
MacVim compiles against whatever Ruby it finds in your path, and has
problems working with Ruby 1.9. We've detected Ruby 1.9 in your path,
so this compile may fail.
==> Downloading https://github.com/b4winckler/macvim/tarball/snapshot-64
Already downloaded: /Library/Caches/Homebrew/macvim-7.3-64.tgz
==> ./configure --with-features=huge --with-tlib=ncurses --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-pythoninterp --enable-rubyinterp --enable-tclinterp
==> make getenvy
==> make