Skip to content

Instantly share code, notes, and snippets.

View guanix's full-sized avatar

Guan Yang guanix

  • 44FE 23DB 362F 611C 0CC3 116B D49B 113D 48DC 370E
  • New York
View GitHub Profile
Bomber is a node.js web framework inspired by Rails, Django and anything else out there that has caught our eye.
Main website and documentation: http://bomber.obtdev.com/
Warning! Right now the API is very much in a state of flux. We are still experimenting with the best way to make Bomber both intuitive and powerful. Expect things to change a lot for the forseeable future.
Getting up and running
----------------------
The source code for Bomber is [located on GitHub][bomber-src]. To check it out, run the following command:
// fileIO style continuables example
// Note: All the three examples here are done based on the *same* API,
// namely the fileIO continuables API
// "Promise lite" style with either:
readFile("11.txt")(either(
function (e) {
// handle an error
},
function (obj) {
open("path.tmp")
.then(function (stream) {
return stream.write("some text");
}).then(function (stream) {
return stream.close();
}).then(function () {
return rename("path.tmp", "path");
}, function (e) {
// one error handler for an error at any point in the chain
});
require.paths.unshift('/Users/guan/code/node-promise');
var promise = require('node-promise'),
sys = require('sys');
process.mixin(GLOBAL, require('promise'));
// A promise version of setTimeout
var delay = function (timeout) {
var deferred = new process.Promise();
setTimeout(function () {
deferred.resolve();
var continuables = require('continuables'), sys = require('sys');
function delay(timeout, fail) {
var continuable = continuables.create();
setTimeout(function () {
if (fail)
continuable.fulfill(new Error('fail'));
else
continuable.fulfill(true);
}, timeout);

Watch my video explanation!

in_reply_to_id

in_reply_to_id is a piece of information that may be associated with a tweet. It is a reference to the tweet that is being replied to. On twitter.com, you can tell that in_reply_to_id is set because the “in reply to” link is visible. In other Twitter clients, there may be a similar link or an icon to show a discussion thread.

If in_reply_to_id is not set, then it can be difficult or impossible to tell which tweet is being replied to, and it can be difficult to reconstruct discussion threads.

Reply visibility

Read Ken Rockwell on Modern Exposure.

The steps for taking a good photograph with a digital camera are:

  1. Take a photo.
  2. Look at the screen.
  3. Change settings.
  4. Go to back step 1.

The settings you'll want to change on an S90 are:

#!/opt/python2.7/bin/python
# -*- coding: utf-8 -*-
# Author: Ricardo Garcia Gonzalez
# Author: Danny Colligan
# Author: Benjamin Johnson
# Author: Vasyl' Vavrychuk
# Author: Witold Baryluk
# Author: Paweł Paprota
# License: Public domain code
import cookielib
--- ../yahoo/youtube-dl 2011-02-10 22:10:41.000000000 +0000
+++ youtube-dl 2011-02-21 01:43:43.000000000 +0000
@@ -1714,13 +1714,11 @@
'url': video_url.decode('utf-8'),
'uploader': video_uploader.decode('utf-8'),
'upload_date': u'NA',
- 'title': video_title.decode('utf-8'),
- 'stitle': simple_title.decode('utf-8'),
+ 'title': video_title,
+ 'stitle': simple_title,
--- ../yahoo/youtube-dl 2011-02-10 22:10:41.000000000 +0000
+++ youtube-dl 2011-02-21 01:51:54.000000000 +0000
@@ -535,7 +535,7 @@
template_dict = dict(info_dict)
template_dict['epoch'] = unicode(long(time.time()))
template_dict['autonumber'] = unicode('%05d' % self._num_downloads)
- filename = self.params['outtmpl'] % template_dict
+ filename = (self.params['outtmpl'] % template_dict).replace("/", "_")
return filename
except (ValueError, KeyError), err: