Skip to content

Instantly share code, notes, and snippets.

View saikat's full-sized avatar

Saikat Chakrabarti saikat

View GitHub Profile
require 'mocha'
module Mocha
class Mock
def method_missing(symbol, *arguments, &block)
if @responder and not @responder.respond_to?(symbol)
raise NoMethodError, "undefined method `#{symbol}' for #{self.mocha_inspect} which responds like #{@responder.mocha_inspect}"
end
# Just return the last return value that we actually specified
{
"attempt_count": 0,
"attempted": false,
"closed": false,
"customer": "cus_mKpLtN3Mu0gF9U",
"livemode": false,
"next_payment_attempt": 1329187413,
"object": "invoice",
"paid": false,
"subtotal": 5000,
{
"customer":"cus_blahfoo",
"livemode": true,
"attempt" : 2,
"event": "recurring_payment_failed",
"card" : nil,
"invoice": {
"attempted": true,
"charge": nil,
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(cua-mode t nil (cua-base))
'(pop-up-frames nil)
'(transient-mark-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
@saikat
saikat / gist:1084146
Created July 15, 2011 05:43
Stripe sample checkout form
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Sample Form</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.8.1/jquery.validate.min.js"></script>
<script type="text/javascript" src="https://js.stripe.com/v1/"></script>
<script type="text/javascript">
function trackGAPageView(page)
{
if (typeof(gaq) != "undefined" && _gaq)
{
_gaq.push(['_trackPageView', page]);
}
};
function trackMPEvent(event, extraInfo)
{
var dragEnterEventCallback = function (anEvent) {
if (![self validateDraggedFiles:anEvent.dataTransfer.files])
{
return NO;
}
else
{
anEvent.dataTransfer.dropEffect = "copy";
anEvent.stopPropagation();
[self fileDraggingEntered:anEvent];
var theClass = [self class],
dragEnterEventImplementation = class_getMethodImplementation(theClass, @selector(fileDraggingEntered:)),
dragEnterEventCallback = function (anEvent) {
if (![self validateDraggedFiles:anEvent.dataTransfer.files])
{
return NO;
}
else
{
anEvent.dataTransfer.dropEffect = "copy";
** [out :: gomockingbird.com] Running migrations for user:
** [out :: gomockingbird.com] - Nothing to migrate.
** [out :: gomockingbird.com] - Loading initial data for user.
** [out :: gomockingbird.com] No fixtures found.
** [out :: gomockingbird.com] Running migrations for project:
** [out :: gomockingbird.com] - Nothing to migrate.
** [out :: gomockingbird.com] - Loading initial data for project.
** [out :: gomockingbird.com] No fixtures found.
** [out :: gomockingbird.com] Running migrations for export:
** [out :: gomockingbird.com] - Nothing to migrate.
@import <AppKit/CPToolbar.j>
@implementation CPToolbar(ToolbarItemFetching)
{ }
- (CPToolbarItem)itemForIdentifier:(CPString)anIdentifier
{
var count = [_items count];
for (var i = 0; i < count; ++i)
if (_items[i]._itemIdentifier === anIdentifier)