Skip to content

Instantly share code, notes, and snippets.

View abraham's full-sized avatar
thanks a latte

Abraham Williams abraham

thanks a latte
View GitHub Profile
@paulmillr
paulmillr / dart.md
Last active July 15, 2023 13:36
Leaked internal google dart email

---------- Forwarded message ----------

From: Mark S. Miller <erights@google.com>
Date: Tue, Nov 16, 2010 at 3:44 PM
Subject: "Future of Javascript" doc from our internal "JavaScript Summit"
last week
To: javascript-standard@google.com
var opts = {};
var io = require('socket.io');
opts.port = 20200;
var rest = require('restler');
var app = require('express').createServer();
var sys = require('sys');
var TwilioClient = require('twilio').Client;
var Twiml = require("twilio").Twiml;
var client = new TwilioClient(ACCOUNT_SID, AUTH_TOKEN, MY_HOSTNAME,opts);
@byronrode
byronrode / twitter.platform.js.markdown
Created May 17, 2011 08:10
Twitter Intents over SSL

Serving Twitter's JS for Intents or Tweet Button's is a pain when it comes to SSL as Twitter has no SSL Cert installed on their serving subdomain. To get around this, without having to manually maintain the JS, I came up with the following workaround.

Create a file called twitter.platform.js.php in your JS Folder and paste the following:

<?php
header('Content-type: text/javascript'); 
echo file_get_contents('http://platform.twitter.com/widgets.js');
?>
@kennethreitz
kennethreitz / 0_urllib2.py
Created May 16, 2011 00:17
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@technoweenie
technoweenie / api_documentation.rb
Created April 29, 2011 11:54
discarded sinatra documentation extension
# Sinatra module for documenting an API. This info can be exported as JSON
# and used to generate other forms of documentation.
#
# Example documentation for a GET request:
#
# desc "List issues for this Repository"
# param :milestone, Fixnum
# param :state, String, :default => 'open', :choices => %w(open closed)
# get "/repos/:user/:repo/issues" do
# ...
@intents
intents / intents.html
Created March 30, 2011 14:50
Invoke Intents
<script type="text/javascript">
(function() {
if (window.__twitterIntentHandler) return;
var intentRegex = /twitter\.com(\:\d{2,4})?\/intent\/(\w+)/,
windowOptions = 'scrollbars=yes,resizable=yes,toolbar=no,location=yes',
width = 550,
height = 420,
winHeight = screen.height,
winWidth = screen.width;
@DTrejo
DTrejo / top3stories.js
Created January 21, 2011 22:41
Gets top three articles from frontpage and newpage of Hacker News. Blog post on scraping: http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga
// Scraping Made Easy with jQuery and SelectorGadget
// (http://blog.dtrejo.com/scraping-made-easy-with-jquery-and-selectorga)
// by David Trejo
//
// Install node.js and npm:
// http://joyeur.com/2010/12/10/installing-node-and-npm/
// Then run
// npm install jsdom jquery http-agent
// node numresults.js
//
@creationix
creationix / streamtest.js
Created January 1, 2011 08:57
A sample client for creationix/jsonparse that consumes the twitter feed and filters out messages and names
var Parser = require('./jsonparse');
var Http = require('http');
var p = new Parser();
// IMPORTANT, put your username and password in here
var username = "yourTwitterUsername", password = "yourPassword";
var client = Http.createClient(80, "stream.twitter.com");
var request = client.request("GET", "/1/statuses/sample.json", {
"Host": "stream.twitter.com",
"Authorization": (new Buffer(username + ":" + password)).toString("base64")
});
Twas the night before launch, when all through the server
Not a process was stirring, not even a crawler;
The init scripts were stored in rc.d,
In hopes that the sys admin soon would be free;
The Damon was nestled all snug in his bed,
While visions of multi-tenant architecture danced in his head;
And nginx all configured, and cap deploy at the ready,
@pdokas
pdokas / Example.js
Created December 1, 2010 19:02
Add a context param to $.fn.bind()
$('h1').bind('click', function() {
this.log('clicked!');
}, console);
$('h2').bind('click', {msg: 'clicked!'}, function(e) {
this.log(e.data.msg);
}, console);