Skip to content

Instantly share code, notes, and snippets.

require 'cloudfiles'
no such file to load -- mime/types
sudo gem install mime-types
require 'cloudfiles'
Gem::LoadError: Could not find RubyGem archive-tar-minitar (~> 0.5)
sudo gem install archive-tar-minitar
# encoding: utf-8
module ActionView
module Renderable #:nodoc:
private
def compile!(render_symbol, local_assigns)
locals_code = local_assigns.keys.map { |key| "#{key} = local_assigns[:#{key}];" }.join
source = <<-end_src
def #{render_symbol}(local_assigns)
function probe() {
var count = 1;
function recurse() {
count++;
recurse();
}
try {
recurse();
} catch (e) {
}
@briancollins
briancollins / gist:866899
Created March 12, 2011 01:10
link_to with an "active" class for links to the current page
def link_to_active(*args, &block)
if block_given?
options = args.first || {}
html_options = args.second
link_to_active(capture(&block), options, html_options)
else
name = args[0]
options = args[1] || {}
html_options = args[2]
link_to_unless_current(name, options, html_options) do
From 7f136fa9d68b9f24aa84b02fffcf5fc180e7c658 Mon Sep 17 00:00:00 2001
From: Brian Collins <brian@gastownlabs.com>
Date: Fri, 16 Sep 2011 23:02:34 +0100
Subject: [PATCH] Use glibtoolize on OS X
---
autogen.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/autogen.sh b/autogen.sh
.nH #gb, /* black bar */
.GcwpPb-MEmzyf, /* switch to new look */
.l2.ov.nH.oy8Mbf, /* % full, copyright and last activity */
.T8uMgc.lKgBkb /* chat, invite */
{ display: none; }
@briancollins
briancollins / gist:1781729
Created February 9, 2012 18:15 — forked from boucher/gist:1750375
Stripe PHP simple example
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
@briancollins
briancollins / gist:3098505
Created July 12, 2012 14:36 — forked from boucher/gist:1750375
Stripe PHP simple example
<?php
require 'path-to-Stripe.php';
if ($_POST) {
Stripe::setApiKey("YOUR-API-KEY");
$error = '';
$success = '';
try {
if (!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
irb(main):002:0> cus = Stripe::Customer.retrieve('cus_160IzWW96HzSbp'); nil
=> nil
irb(main):003:0> cus.cancel_subscription(:at_period_end => true); nil
=> nil
irb(main):004:0> cus = Stripe::Customer.retrieve('cus_160IzWW96HzSbp'); nil
=> nil
irb(main):005:0> cus.subscription
=> #<Stripe::StripeObject:0x3ff7eda4cb9c> JSON: {
"plan": {"id":"foo","interval":"month","name":"foo","amount":2000,"currency":"usd","object":"plan","livemode":false,"interval_count":1,"trial_period_days":null},
var currentType = 'unknown';
$('.card-number').keyup(function() {
$('.card-number, .card-number:parent').removeClass(currentType);
currentType = $.payment.cardType($('.card-number').val());
$('.card-number, .card-number:parent').addClass(currentType);
});