Skip to content

Instantly share code, notes, and snippets.

View jarodreyes's full-sized avatar

Jarod Reyes jarodreyes

View GitHub Profile
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
@jarodreyes
jarodreyes / Key Bindings - User
Created June 13, 2012 22:16
Wrap a Selection in a %trans tag - Sublime2
// wrap selection in Trans tag
[
{ "keys": ["super+3"], "command": "run_macro_file", "args": {"file": "Packages/User/trans.sublime-macro"} }
]
@jarodreyes
jarodreyes / reading-window.coffee
Created April 17, 2013 05:02
Renders a window on my portfolio that allows a visitor to see the most recent books added to my GoodReads account. ReadingWindow extends WindowView so I have included both for context.
define ['window', 'jquery.xml2json'],
(WindowView, xml2json) ->
String.prototype.trunc =
(n) ->
return @substr(0,n-1)+ (if @length > n then '...' else '')
class ReadingWindow extends WindowView
className:'reading-window'
template: _.template $('#reading-template').html()
el: '.reading'
@jarodreyes
jarodreyes / translate-popup.coffee
Created April 17, 2013 05:12
This widget, built for Voxy.com allows our 3 Million users to translate a string selected on the website. This demonstrates how simply a complex widget liket this can be built using modern frameworks like BackboneViews and CoffeeScript. Compile JS included as well as the Jade template (which compiles to HTML).
define ['event-bus',
'activities/utility-pane',
'text!templates/activities/translate-popup.jade'],
(EventBus, UtilityPane, translatePopupTemplate) ->
class TranslatePopup extends UtilityPane
tagName: 'li'
paneId: 'translate'
events:
'click .btn-search': 'sendToGoogle'
'click .btn-switch': 'switchLang'
@jarodreyes
jarodreyes / export_sprites.js
Created April 17, 2013 05:19
This javascript file was created to automate a repetitive and time-wasting process of exporting image sprites created from Adobe Illustrator files (Vectors).
var createLargeSprite, createMiniSprite, createRetinas, createSmallSprite, createSprite, document, folder, forEach, hideAllLayers, layer, layers, scaleMe, showAllLayers, _i, _len;
folder = Folder.selectDialog();
document = app.activeDocument;
createMiniSprite = function() {
var file;
file = new File(folder.fsName + "/" + layer.name + "-mini.png");
return scaleMe(file, 50);
@jarodreyes
jarodreyes / style.css
Created April 17, 2013 05:26
Styles for my personal website. Included compiled CSS.
@import url('http://fonts.googleapis.com/css?family=Fjalla+One|Oleo+Script+Swash+Caps:400,700|Miltonian+Tattoo|Piedra');
@import "fonts.css";
[class^="icon-"]{color:#808080;display:inline-block;font-family:"FontIcons";font-style:normal;font-weight:normal;line-height:1;text-align:center;vertical-align:middle;-webkit-font-smoothing:antialiased;font-size:64px;height:70px;line-height:70px;width:70px;}
.icon-reading:before{content:"\e206";}
.icon-seeing:before{content:"\e204";}
.icon-news:before{content:"\e101";}
.icon-listening:before{content:"\e203";}
.icon-chart:before{content:"\e208";}
.icon-github:before{content:"\e301";}
@-webkit-keyframes bounce{0%,20%,50%,80%,100%{-webkit-transform:scale(1);} 40%{-webkit-transform:scaleY(1.8);} 60%{-webkit-transform:scaleY(1.5);}}@keyframes bounce{0%,20%,50%,80%,100%{-webkit-transform:scale(1);} 40%{-webkit-transform:scaleY(1.8);} 60%{-webkit-transform:scaleY(1.5);}}.tap-window{text-align:center;margin-bottom:20px;position:relative;cursor:pointer;}.tap-window .window{posit
@jarodreyes
jarodreyes / gist:7479517
Created November 15, 2013 05:21
leaderboard.json for The Hacker Olympics.js.
{"1":{"points":1080,"name":"Bajoran raider"},"2":{"points":290,"name":"Basestars"},"3":{"points":940,"name":"Bebop"},"4":{"points":605,"name":"Bellerophon"},"5":{"points":410,"name":"Blackbird"},"6":{"points":350,"name":"Cardassian Pursuit"},"7":{"points":510,"name":"Colonial Viper"},"8":{"points":585,"name":"Cylon Raider"},"9":{"points":790,"name":"Death Glider"},"10":{"points":545,"name":"Destiny Ascension"},"11":{"points":415,"name":"Enterprise"},"12":{"points":825,"name":"Event Horizon"},"13":{"points":550,"name":"Federation Fighter"},"14":{"points":535,"name":"Geonosian starfighter"},"15":{"points":0,"name":"Heart of Gold"},"16":{"points":45,"name":"Horatius"},"17":{"points":0,"name":"Hyperion"},"18":{"points":0,"name":"Icarus"},"19":{"points":0,"name":"Independence"},"20":{"points":0,"name":"Jedi starfighter"},"21":{"points":0,"name":"Jem'Hadar fighter"},"22":{"points":0,"name":"Kronos Fighter"},"23":{"points":0,"name":"Magellan"},"24":{"points":0,"name":"Mayflower One"},"25":{"points":0,"name":"Minbari
<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)