Skip to content

Instantly share code, notes, and snippets.

View btucker's full-sized avatar
👋

Ben Tucker btucker

👋
View GitHub Profile
@btucker
btucker / gist:4506704
Last active December 10, 2015 23:08
dscourse <-> CANLEAD LTI
<form action='http://example.com/shiva/lti/receive.php' encType='application/x-www-form-urlencoded'>
<input name="oauth_consumer_key" type="hidden" value="key" />
<input name="oauth_signature_method" type="hidden" value="HMAC-SHA1" />
<input name="oauth_timestamp" type="hidden" value="1357860362" />
<input name="oauth_nonce" type="hidden" value="bwXOUxuuT2FV2VZ8EIbPqu7TwVetdgXigF30JmoPXrs" />
<input name="oauth_version" type="hidden" value="1.0" />
<input name="context_id" type="hidden" value="13" />
<input name="context_title" type="hidden" value=" Middle School Math (Master)" />
<input name="launch_presentation_return_url" type="hidden" value="http://uva-canlead.dev/modules/13" />
<input name="lis_person_contact_email_primary" type="hidden" value="ben@btucker.net" />
@btucker
btucker / gist:1356347
Created November 10, 2011 21:48
rails 2.3.x-esque remote_form_for in rails 3
<%= form_tag action_path, :id => 'remote_form', :remote => true do %>
<%= submit_tag %>
<% end %>
<div id="result"></div>
<%= javascript_tag do %>
jQuery(function($) {
$("#remote_form").bind("ajax:success", function(ev, data) {
$("#result").html(data);
@btucker
btucker / cache.rb
Created March 26, 2010 19:25
Memcached action caching for Sinatra (doesn't work in sinatra >= 1.0)
# Adds support for passing a :cache parameter to action definitions, eg:
#
# get '/state_map/?', :cache => 'state_map' do
# ...
# end
#
# :cache can also simply be passed true, in which case the route definition is used as the base
# key name. In all cases, any params are also included in the key.
#
# Author: ben tucker <ben@btucker.net>
#!/usr/bin/env ruby
require File.expand_path('../../config/environment', __FILE__)
how_many = 25000
my_class = Foo
my_class.delete_all
sc = my_class.create
my_class.benchmark "#{how_many} finds" do
#!/usr/bin/env perl
=head1 NAME
Rename Parameterized files (as downloaded by wget)
=head1 DESCRIPTION
This script will find any files with question marks in them, replace them with '--' and then
do a multi-file find & replace for any references in all other files in the directory.