Skip to content

Instantly share code, notes, and snippets.

philoye / pages_controller.rb
Last active March 2, 2016 11:21
static-ish files in rails, while allowing for nesting
View pages_controller.rb
class PagesController < ApplicationController
before_action :authorize!, :only => [ :welcome ]
def welcome
def show_doc
render "/pages/docs/#{params[:page]}"
philoye / nyc-recommendations.markdown
Last active August 29, 2015 14:06
NYC Recommendations
View nyc-recommendations.markdown

My NYC Recommendations

It is a bit out of date in places (I haven’t lived in NYC since 2007). Make sure you google places to make sure they are still open:


Sunset drinks at the Boom Boom room at the Standard Hotel. It is in the meat packing district. Overpriced cocktails but stupendous view.

philoye / heartbeat.rb
Created August 11, 2014 00:49
Simple rack middleware to provide a health monitor for rails app using sidekiq, memcache, and activerecord.
View heartbeat.rb
module Rack
class Heartbeat
def initialize(app)
@app = app
def call(env)
if env['PATH_INFO'] == "/pulse"
@messages = []
philoye / heroku_deploy.rb
Last active August 29, 2015 14:04
A simple wrapper around `git push heroku` to gracefully handle when you have migrations to run.
View heroku_deploy.rb
#!/bin/sh -e
# ------------------------------------------------------------------
# Phil Oye
# heroku_deploy
# A simple wrapper around `git push heroku` to gracefully handle
# when you have migrations to run.
# ------------------------------------------------------------------
philoye / Gemfile
Last active August 29, 2015 14:01
Minitest in Rails without minitest_rails
View Gemfile
group :test do
gem 'minitest'
gem 'minitest-focus'
gem 'minispec-metadata'
gem 'minitest-reporters'
gem 'capybara'
gem 'capybara-webkit'
gem 'database_cleaner'
gem 'factory_girl_rails'
gem 'launchy'
philoye /
Created May 31, 2012 04:28 — forked from toolmantim/
A Backbone.js router subclass that disables the hash fallback mechanism in favour of just navigating to the location (just like a normal link would behave)
class MyApp.Router extends Backbone.Router
hasPushState: window.history and window.history.pushState
# Override the navigate function to remove Backbone's #hash fallback for
# non-pushState browsers. Instead we just navigate to the new location using
# window.location
navigate: (fragment, trigger) ->
if @hasPushState
philoye / Gemfile
Created December 2, 2011 00:32
problem with sass media queries + variables
View Gemfile
source :rubygems
gem 'fssm'
gem 'sass', git: 'git://', branch: 'master'
View index.html
This is a bit of jquery that enables a show/hide password toggle.
The idea is:
1. Reduce annoyance: Users don't have to type password twice to confirm
2. Reduce errors: Users have option of seeing what they type
3. Security: Users can prevent others seeing their password
Ultimately, I didn't use it, but in case it might be useful to somebody.
I didn't bother to make a proper plugin out of it, but that would be trivial...
View dontConfirmPasswords.jquery.js
// jQuery Plugin: Don't Confirm Passwords
// This marginally useful plugin might be helpful if you don't want to make users type password twice,
// but can't change the backend. The server still gets two password values.
// 1. This should unobtrusively hide a confirm password field and update its value based on the password field.
// 2. It assumes HTML of the following sort:
// <fieldset>
// <ul id="password-wrapper">
View smoke yql test
require 'rubygems'
require 'smoke'
Smoke.yql(:flickr) do
prepare do
select :all
from ''
where :user_id, flickr_user_id