Skip to content

Instantly share code, notes, and snippets.

View jarodreyes's full-sized avatar

Jarod Reyes jarodreyes

View GitHub Profile
<html>
<head>
<style>
.arc path { stroke: #fff; }
</style>
<script src="https://dl.dropboxusercontent.com/u/10861681/blog-post/d3.v3.min.js"></script>
</head>
<body>
</body>
before do
@twilio_number = ENV['TWILIO_NUMBER']
@points_number = ENV['POINTS_NUMBER']
@client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']
puts "num: #{@twilio_number}"
end
route :get, :post, '/points' do
puts 'points/'
@phone_number = Sanitize.clean(params[:From])
@jarodreyes
jarodreyes / candy-sms.rb
Created February 26, 2015 03:20
3rdSpace Candy Machine
# Register a subscriber through the web and send verification code
route :get, :post, '/sms-register' do
@phone_number = Sanitize.clean(params[:From])
@body = params[:Body]
puts @error
if @error == false
user = AnonUser.first_or_create(:phone_number => @phone_number)
if not @body.nil?
user.messages.create(:body => @body)
class Appointment < ActiveRecord::Base
validates :name, presence: true
validates :phone_number, presence: true
validates :time, presence: true
after_save :notify
@@REMINDER_TIME = 10.minutes # minutes before appointment
attr_accessor :time
@jarodreyes
jarodreyes / app.rb
Created March 17, 2015 21:52
Taco Tuesday Code
# 3rdSpace Taco Tuesday webhook
# Phone Number: 6692382267
# Register a subscriber through the web and send verification code
route :get, :post, '/tacos' do
@phone_number = Sanitize.clean(params[:From])
@body = params[:Body]
puts "******************* ERROR: #{@error} **********************"
puts "******************* BODY: #{@body} **********************"
@options = "Please type: 'chicken', 'pork', 'fish' or 'vegetarian'"
@jarodreyes
jarodreyes / codesyntax.less
Created April 17, 2015 19:10
Prevent scroll when user is not in focus mode
// Before the user is in 'focus' mode.
.cw-code, .cw-prose {
&:after {
content: " ";
display: block;
position: absolute;
width: 100%;
height: 100%;
top:0px;
left:0px;
[["Item","Weight","Value"],["HP",4.8,500],["Visual c++",4.38,30],["Apple Laptop",3.6,700],["Joystick (Big)",2.9,120],["Joystick (small)",2.2,75],["Powerpoint Book",1.7,20],["Battery 2",1.375,90],["Sincerely Nuts",1.25,10],["Beef Jerky",1.1,15],["Battery 1",1.078125,90],["Beans",1,10],["Palm Keyboard",0.5,35],["Webcam 1",0.46875,50],["WEbcam 2 (sphere)",0.46875,50],["KIND bars",0.4375,12],["Palm VII",0.41875,200],["Palm Tuncsten",0.40625,300],["Nokia ANimal",0.390625,300],["Nokia Blue",0.3625,300],["Camera",0.3359375,200],["Splitter",0.3125,15],["Gateway Mouse",0.265625,30],["Sprint",0.25,200],["LG",0.234375,100],["PacBell Mouse",0.21875,50],["Razor Prototype",0.203125,900],["Flashlight",0.078125,10],["TOTAL:",30.7346875,4412]]
@jarodreyes
jarodreyes / bizcard.xml
Created August 3, 2015 14:58
Bizcard TwiML
<response>
<message to="params[:Body]">Jarod Reyes: Documentation at Twilio.com
Telephone: (206)650-5813
Email: jreyes@twilio.com
Twitter: https://twitter.com/jreyesdesign
This SMS business card was built in 22 lines of code using Twilio. View the code on Github.
</message>
</response>
@jarodreyes
jarodreyes / recordings_controller.rb
Created August 21, 2015 16:59
All recordings for a phone number
# GET /recordings/:agent
def show
@agent_number = params[:agent]
@recordings = recordings_for_agent(@agent_number)
end
def call_sids(number)
# store the sids here
@call_sids = []
before_filter :iphone_redirect
def iphone_redirect
if request.env["HTTP_USER_AGENT"][/(Mobile\/.+Safari)/]
redirect_to "http://itunes.apple.com/us/app/messageparty/id386579657?mt=8"
end
end
describe ApplicationController do
it 'should redirect request from mobile safari to the app store' do