---------- 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
---------- 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); |
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');
?>
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import urllib2 | |
gh_url = 'https://api.github.com' | |
req = urllib2.Request(gh_url) | |
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm() |
# 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 | |
# ... |
<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; |
// 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 | |
// |
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, |
$('h1').bind('click', function() { | |
this.log('clicked!'); | |
}, console); | |
$('h2').bind('click', {msg: 'clicked!'}, function(e) { | |
this.log(e.data.msg); | |
}, console); |