Skip to content

Instantly share code, notes, and snippets.

View bradly's full-sized avatar

Bradly Feeley bradly

  • San Diego, California
View GitHub Profile
@bradly
bradly / 1st_chunk[py2k].py
Created August 26, 2012 21:53
Stripe CTF 2.0, level8, py2k webhook for getting the 1st chunk
from os import curdir, sep
import httplib
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
workvar = 0
# arrvar holds the remaining possible solutions to this block
arrvar = range(999)
globport = 0
# config vars:
serva8 = "level08-3.stripe-ctf.com" #level8 server
@bradly
bradly / gist:1525252
Created December 27, 2011 21:43
Ryan's For People Not Getting It
How I Explained REST to My Dad
Sunday, December 12, 2004
Translations of the following dialog available in Japanese, French, Vietnamese, Italian, Spanish, Portuguese, and Chinese. Huge thanks to YAMAMOTO Yohei, Karl Dubost, jishin, Barbz, Tordek, Edgard Arakaki, keven lw, respectively. If you know of additional translations, please leave a comment with the location.
Dad: Who is Roy Fielding?
Ryan: Some guy. He’s smart.
@bradly
bradly / i18n.js
Created August 26, 2011 17:31
Simple JavaScript Unit Testing
// i18n.js
// Copyright 2011 Bradly Feeley
// Language attribute should be added to the html nodes.
// <html lang="en">
//
// Alternatively, you can set the language by passing an argument to the I18n.set_locale function.
//
// Early in the layout view before all other js:
// <script src="/javascripts/i18n.js" type="text/javascript" charset="utf-8"></script>
@bradly
bradly / clear_input.js
Created August 9, 2011 21:17 — forked from kevinthompson/clear_input.js
Clear Default Text Input Value on Focus
// Clear Default Text Input Value on Focus
function hasPlaceholderSupport() {
var input = document.createElement('input');
return ('placeholder' in input);
}
if ( hasPlaceholderSupport() == false ) {
$('input[type="text"]').each(function(){
var def = $(this).attr('placeholder') != '' && $(this).attr('placeholder') != undefined ? $(this).attr('placeholder') : $(this).attr('value');
@bradly
bradly / Questions
Created August 9, 2011 17:27
Frozen Rails Give-away
Day job:
Your Rails contributions (if any):
What's your Ruby/Rail experience?:
How do you use GitHub?:
@bradly
bradly / deploy.rake
Created July 27, 2011 03:58
Simple Rails Deployments with Net/SSH
require 'net/ssh'
desc "Deploy site to production"
task :deploy => :environment do
host = 'yourhost.com'
user = 'username'
options = {:keys => '~/.ssh/keys/yourserver.pem'}
remote_path = '/path/to/rails_app'
commands = [
string = "FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthe
@bradly
bradly / gist:394216
Created May 8, 2010 01:21
Snake in Canvas
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Snakezz</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
</head>
<body>
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
include Clearance::Authentication
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
@@ -221,7 +221,7 @@ module ActiveSupport #:nodoc:
case params.class.to_s
when "Hash"
params.inject({}) do |h,(k,v)|
- h[k.to_s.underscore.tr("-", "_")] = unrename_keys(v)
+ h[k.to_s.tr("-", "_")] = unrename_keys(v)
h
end
when "Array"