Skip to content

Instantly share code, notes, and snippets.

View brianleroux's full-sized avatar
💚
You are now aware that you are breathing

Brian LeRoux brianleroux

💚
You are now aware that you are breathing
View GitHub Profile
system.use("info.webtoolkit.Base64");
var username = "admin";
var password = "password";
var auth = "Basic " + Base64.encode(username + ":"+ password);
checkAuth = function() {
if (!this.request.headers.hasOwnProperty('Authorization') || (this.request.headers.hasOwnProperty('Authorization') && (auth != this.request.headers['Authorization']))) {
this.response.headers['WWW-Authenticate'] = 'Basic realm="SmartAPI"';
this.response.code = 401;
this.response.body = "Not Authorized\n";
var sys = require("sys")
var http = require("http");
var twitter = http.createClient(80, "search.twitter.com");
var count = 10
for (var i = 1; i <= count; i++) {
var request = twitter.request("GET", "/search.json?q=crockfordfact+OR+crockfordfacts&rpp=100&page=" + i, {"host": "search.twitter.com"});
request.addListener('response', function(response) {
(function ($, window, undefined) {
var m = document.createElement('i'),
m_style = m.style,
// TODO support other browsers easings - based on Safari's easing options and ported to Emile easing.
stanardEasing = {
'ease-in-out' : function(pos){if((pos/=0.5)<1){return 0.5*Math.pow(pos,4);}return -0.5*((pos-=2)*Math.pow(pos,3)-2);},
'ease-in' : function(pos){return Math.pow(pos,4);},
'ease-out' : function(pos){return Math.pow(pos,0.25);},
'linear': function (i) {return i;}
var foo = {
toString: function () {
return 5;
},
valueOf: function () {
return "foo";
}
};
alert(foo.toString() + 1); // 6 (bad!)
alert(foo + 1); // "foo1" (no good!)
var people = new Lawnchair({adaptor:'dom'});
// In the .h file …..
#import
#import “PhoneGapCommand.h”
@interface FlurryAPI : PhoneGapCommand {
}
- (void)doit:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;
@end
// in the .m file
var test = (function({ arguments:[] }){
console.log(arguments[0]);
});
test('fffffffffu');
alert.call.call.call.call.call.apply(function (a) {return a}, [1,2]) // 2
// this is just a really silly way of saying this
Function.prototype.call.apply(function (a) {return a}, [1,2])
// 2
// if this still seems weird to you. Consider this:
function logThisAndArgs(){ console.log(this, arguments); }
Function.prototype.call.apply(logThisAndArgs, [{'some':'object'},1,2,3,4])
// logs -> Object { some="object"} [1, 2, 3, 4]
function up() {
git add .
git commit -m $1
git push origin master
}