Skip to content

Instantly share code, notes, and snippets.

View JustinAiken's full-sized avatar
💎
Rubyin'

Justin Aiken JustinAiken

💎
Rubyin'
View GitHub Profile
[228470f4-464e-4f6d-9411-e0e0efaecbda] ActionController::RoutingError (No route matches [GET] "/"):
[8dea6489-61d0-4b71-a379-f66511c79a30] ActionController::RoutingError (No route matches [GET] "/showLogin.cc"):
[736de989-da56-4de2-9133-8f24d0c95933] ActionController::RoutingError (No route matches [GET] "/"):
[bc145798-4030-45da-b973-5eecbc9ed18a] ActionController::RoutingError (No route matches [GET] "/.env"):
[2fbbc967-ca84-43e0-a9e0-7166e641e5f8] ActionController::RoutingError (No route matches [GET] "/"):
[7f36a1d3-3a50-4a9c-a4eb-2f0cdce211f6] ActionController::RoutingError (No route matches [GET] "/"):
[98badd41-8586-461a-a0bb-3e9f9c51ba46] ActionController::RoutingError (No route matches [GET] "/autodiscover/autodiscover.json"):
[561fe96d-1969-435f-b1e5-9fbd4a6de3bc] ActionController::RoutingError (No route matches [GET] "/"):
[8914d830-15f2-4a89-aa68-21297605720d] ActionController::RoutingError (No route matches [GET] "/ecp/Current/exporttool/microsoft.exchange.ediscovery.exporttool.application"):
[9f
#!/usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "net-sftp"
end
require "net/sftp"
cookbook 'build-essential'
cookbook 'apt'
cookbook 'ruby_build'
cookbook 'rbenv', :git => 'https://github.com/fnichol/chef-rbenv'
cookbook 'unicorn'
cookbook 'nginx'
cookbook 'runit'
cookbook 'rails-lastmile', :git => 'git://github.com/DanThiffault/rails-lastmile.git'
@JustinAiken
JustinAiken / order.rb
Created February 21, 2013 19:06
refactoring
def order(n)
i=1, a=1, list=[]
until (i==61 or a==n) do
if (a^i).modulo(n)==1
[a,i]>>list
a+=1
i=1
else
i+=1
This file has been truncated, but you can view the full file.
[2013-01-22 11:14:46] DEBUG Adhearsion::Call: bc22d026-9854-4c87-a6e8-b894fb44e596: Receiving message: #<Punchblock::Event::Asterisk::AMI::Event name="VarSet", attributes_hash={:privilege=>"dialplan,all", :channel=>"SIP/4.55.12.163-00007e7d", :variable=>"PLAYBACKSTATUS", :value=>"SUCCESS", :uniqueid=>"1358871283.32381"}, target_call_id="bc22d026-9854-4c87-a6e8-b894fb44e596", component_id=nil, target_mixer_name=nil>
[2013-01-22 11:14:46] DEBUG Adhearsion::Call: bc22d026-9854-4c87-a6e8-b894fb44e596: Receiving message: #<Punchblock::Event::Asterisk::AMI::Event name="AGIExec", attributes_hash={:privilege=>"agi,all", :subevent=>"End", :channel=>"SIP/4.55.12.163-00007e7d", :commandid=>"1369246299", :command=>"EXEC Playback \"lmc/monitored-and-recorded\"", :resultcode=>"200", :result=>"Success"}, target_call_id="bc22d026-9854-4c87-a6e8-b894fb44e596", component_id=nil, target_mixer_name=nil>
[2013-01-22 11:14:46] DEBUG Adhearsion::Call: bc22d026-9854-4c87-a6e8-b894fb44e596: Receiving message: #<Punchblock::Event::Ast
1.9.2p320 :001 > @call_flow = CallFlow.find_by_id(7107)
=> #<CallFlow id: 7107, provisioned_route_id: 1147, dnis: "2162019670", message: "blank", default_ringto: "0000000000", ouid: 170, caller_to_sms: nil, email_to_notify: nil, play_disclaimer: "before", created_at: "2012-12-19 18:43:14", updated_at: "2012-12-20 16:11:38", country_code: "1", tx_boost: nil, rx_boost: nil, vm_enabled: nil, routable_type: "OutboundRoute", routable_id: 5, webhook_enabled: nil>
1.9.2p320 :002 > call_flow_params = {:country_code=>"1", :ouid=>"170", :dnis=>"2162019670", :message=>"blank", :play_disclaimer=>"before"}
=> {:country_code=>"1", :ouid=>"170", :dnis=>"2162019670", :message=>"blank", :play_disclaimer=>"before"}
1.9.2p320 :003 > @call_flow.update_attributes(call_flow_params)
NameError: undefined local variable or method `to_ary' for #<CallFlow:0xa968ef8>
from /home/jaiken/.rvm/gems/ruby-1.9.2-p320@callengine/gems/activemodel-3.0.8/lib/active_model/attribute_methods.rb:392:in `method_missing'
from /home/jaiken/.rvm/g
@JustinAiken
JustinAiken / facebook_scrape.rb
Created December 4, 2012 22:49
facebook election scraper
require 'koala'
AUTH_TOKEN = ENV["AUTH_TOKEN"]
START_TIME = Date.new(2012,11,5).to_time.to_i
END_TIME = Date.new(2012,11,8).to_time.to_i
@facebook = Koala::Facebook::API.new(AUTH_TOKEN)
friends = @facebook.get_connections("me", "friends").sort_by {|friend| friend["name"]}
friends = friends[161..(friends.count - 1)]
@JustinAiken
JustinAiken / rbenv-howto.md
Created October 29, 2012 22:07 — forked from MicahElliott/rbenv-howto.md
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Not sure how much of this we need

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@JustinAiken
JustinAiken / ahn_api.rb
Created October 21, 2012 22:16
SinAhnTra
require 'sinatra'
require 'json'
require 'ahn_api_helpers'
class AhnApi < Sinatra::Base
set :port, 8080
set :environment, ENV['AHN_ENV']
helpers Helpers
@JustinAiken
JustinAiken / create_geo.rb
Created October 9, 2012 19:46
Logmycalls API methods for routes
get "http://dev.api.logmycalls.com/services/createRoute",
{
api_key: API_KEY,
api_secret: API_SECRET,
criteria:
{
tracking_number: 8013334646,
message: "blank",
default_ringto: 4358675309,
ouid: 1,