Skip to content

Instantly share code, notes, and snippets.

View gasi's full-sized avatar

Daniel Gasienica gasi

View GitHub Profile
@aseemk
aseemk / app-dev.js
Created July 6, 2011 23:39
Handler for efficiently caching compiled Coffee and/or Streamline files.
// app-dev.js
// Helper script to register CoffeeScript and Streamline extension handlers
// before running an app during development.
//
// Uses https://github.com/aseemk/coffee-streamline for efficient require(),
// caching compiled files between runs. Sweet!
//
// Usage: instead of `_coffee app`, just do `node app-dev app`.
//
// Also works great w/ node-dev <https://github.com/fgnass/node-dev>:
import base64
import hashlib
import hmac
import simplejson as json
def base64_url_decode(inp):
padding_factor = (4 - len(inp) % 4) % 4
inp += "="*padding_factor
return base64.b64decode(unicode(inp).translate(dict(zip(map(ord, u'-_'), u'+/'))))
// cURL: http://php.net/manual/en/book.curl.php
// cURL Options: http://www.php.net/manual/en/function.curl-setopt.php
// @param $url URL of the request, e.g. https://www.sandbox.paypal.com/cgi-bin/webscr
// @param $data URL encoded request data as array, e.g. $data = array('cmd' => '_notify-validate');
function urlopen($url, $data)
{
$curl_handler = curl_init();
$options = array(CURLOPT_URL => $url,
CURLOPT_FAILONERROR => true,
CURLOPT_RETURNTRANSFER => true,