Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'smoke'
Smoke.yql(:flickr) do
prepare do
select :all
from 'flickr.photos.search'
where :user_id, flickr_user_id
end
end
// 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">
<!--
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...
@philoye
philoye / Gemfile
Created December 2, 2011 00:32
problem with sass media queries + variables
source :rubygems
gem 'fssm'
gem 'sass', git: 'git://github.com/nex3/sass.git', branch: 'master'
@philoye
philoye / router.coffee
Created May 31, 2012 04:28 — forked from toolmantim/router.coffee
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
super(arguments...)
@philoye
philoye / Gemfile
Last active August 29, 2015 14:01
Minitest in Rails without minitest_rails
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
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.
#!/bin/sh -e
# ------------------------------------------------------------------
# Phil Oye
# heroku_deploy
# A simple wrapper around `git push heroku` to gracefully handle
# when you have migrations to run.
#
# ------------------------------------------------------------------
# HOW IT WORKS
#
@philoye
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.
module Rack
class Heartbeat
def initialize(app)
@app = app
end
def call(env)
if env['PATH_INFO'] == "/pulse"
@messages = []
@philoye
philoye / nyc-recommendations.markdown
Last active August 29, 2015 14:06
NYC Recommendations

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:

DRINKS

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

@philoye
philoye / pages_controller.rb
Last active March 2, 2016 11:21
static-ish files in rails, while allowing for nesting
class PagesController < ApplicationController
before_action :authorize!, :only => [ :welcome ]
def welcome
end
def show_doc
begin
render "/pages/docs/#{params[:page]}"