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
# Hey coops..
#
# Imagine yourself on the other side of the table: two job openings, hundreds of resumes,
# _all of which_ look friggin' identical. Yeah, the HR departments at your MegaCorp XYZ are using
# automated tools to scan for keywords, and the coop department at your school is trying to beat
# you into submission to follow some "predefined template".. But, unless what you're aspiring to
# is to be an automaton at MegaCorp XYZ, relegated to writing test harnesses for code that will
# never see the light of day.. please do yourself a favor, and _be different_! Be bold, dammit.
#
# (Frankly, I'm falling asleep while reading your resumes.. Wake me up! Srsly.)
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@user = User.find(:all)
@users.each do |fbid|
result = JSON.parse(open(URI.encode("https://graph.facebook.com/me/friends?access_token=#{fbid.utoken}")).read)
@friendsp = result['data'][0]['id']
end
<td><%= link_to transferred_from(call), call %></td>
<td><%= link_to transferred_to(call), call %></td>
class Punch < ActiveRecord::Base
attr_accessible :clock_in, :clock_out
belongs_to :user
end
@excid3
excid3 / chef_solo_bootstrap.sh
Created September 4, 2012 19:21 — forked from joelash/chef_solo_bootstrap.sh
Bootstrap Ruby 1.9.3 And Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
make
make install
@excid3
excid3 / time_formatter.rb
Created September 6, 2012 16:41
Format time differences in seconds
class TimeFormatter
def self.format_time(elapsed)
return if elapsed.nil?
seconds = elapsed % 60
minutes = (elapsed / 60) % 60
hours = (elapsed / 3600)
"%d:%02d:%02d" % [hours, minutes,seconds]
# hours.to_s + ":" + format("%02d",minutes.to_s) + ":" + format("%02d",seconds.to_s)
def index
@calls = Call.report(params[:search])
respond_to do |format|
format.html do
@calls.paginate(:per_page => 10, :page => params[:page])
end
format.csv { send_data @calls.to_csv }
format.xls { send_data @calls.to_csv(col_sep: "\t") }
end
end
def close_call(medic, call)
@call = call
@medic = medic
recipients = [@medic.medic_sms, @medic.medic_email]
recipients << @call.transferred_from.facility_email if @call.transferred_from.facility_email?
mail to: recipients, subject: "Call Complete: #{@call.incident_number}"
end
class RepliesController < ApplicationController
require "time"
skip_before_filter :verify_authenticity_token
skip_before_filter :authenticate_teacher!
def receive
# 1. set a @parent based on phone number and/or course number if they exist
# 2/ you then move on to the next state on the parent
@reply = Reply.new