Skip to content

Instantly share code, notes, and snippets.

View amcjen's full-sized avatar

Allison Clift-Jennings amcjen

View GitHub Profile
@amcjen
amcjen / challenge1.php
Created March 3, 2011 03:06
Challenge 1 for Greplin Challenge
<?php
$text = strtolower('FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehig
var sys = require('sys');
var url = require('url');
var oauth = require('oauth');
var request = require('request');
var querystring = require('querystring');
var Extendable = require("extendables").Extendable;
var defaultOptions = {
url: '',
@amcjen
amcjen / gist:1039234
Created June 21, 2011 23:44
node-imap debug output
Connected to host.
Secure connection made.
<<RECEIVED>>: '* OK Gimap ready for requests from 71.9.16.10 e4if334400ann.47\r\n'
<<SENT>>: A1 CAPABILITY
<<RECEIVED>>: '* CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH\r\nA1 OK Thats all she wrote! e4if334400ann.47\r\n'
@amcjen
amcjen / gist:1040905
Created June 22, 2011 19:21
cur[1].toLowerCase(); fix
// starting around line 1010 in imap.js
} else { // single part
next = 7;
part = {
// the path identifier for this part, useful for fetching specific
// parts of a message
partID: (prefix !== '' ? prefix : '1'),
// required fields as per RFC 3501 -- null or otherwise
type: cur[0].toLowerCase(),
@amcjen
amcjen / gist:1043120
Created June 23, 2011 17:53
imap on('end') hang
/*
*
* Copyright (C) 2011, The Locker Project
* All rights reserved.
*
* Please see the LICENSE file for more information.
*
*/
//testing for the IMAP connector against a live IMAP server
@amcjen
amcjen / tester.erl
Created July 11, 2011 16:13
Erlang process spawning profile
-module(tester).
-export([loopTheFucker/2]).
loopTheFucker(N, Total) when N =/= 0 ->
spawn(fun() -> true end),
loopTheFucker(N-1, Total+N);
loopTheFucker(0, Total) -> Total.
%% After downloading this, run the following in the Erlang shell (erl on the command line):
%% 1> c(tester).
@amcjen
amcjen / gist:1150437
Created August 16, 2011 23:27
clucene_bindings snippet
try {
TCHAR* searchString = STRDUP_AtoT(*(*baton->search));
Query* q = QueryParser::parse(searchString, _T(""), &analyzer);
Hits* hits = s.search(q);
HandleScope scope;
//_CLDELETE(q);
free(searchString);
// Build the result array
Local<v8::Array> resultArray = v8::Array::New();
{ type: 'status/twitter',
via: 'synclet/twitter',
timestamp: 1314739860211,
action: 'new',
obj:
{ source: 'twitter_mentions',
type: 'new',
data:
{ in_reply_to_screen_name: 'erictj',
truncated: false,
Can handle failwhale
✗ successfully
TypeError: Cannot read property 'data' of undefined
at Object.<anonymous> (/Volumes/Data/opt/locker/tests/synclet-local-twitter.js:76:34)
at runTest (/Volumes/Data/opt/locker/node_modules/vows/lib/vows.js:95:26)
at EventEmitter.<anonymous> (/Volumes/Data/opt/locker/node_modules/vows/lib/vows.js:78:13)
at EventEmitter.emit (events.js:64:17)
at Array.0 (/Volumes/Data/opt/locker/node_modules/vows/lib/vows/context.js:31:52)
at EventEmitter._tickCallback (node.js:126:26)
2 Sep 10:21:12 - error: [Links]
2 Sep 10:21:12 - error: [Links] /Volumes/Data/opt/locker/Collections/Links/unshortener.js:132
2 Sep 10:21:12 - error: [Links] req.connection.setTimeout(5000);
2 Sep 10:21:12 - error: [Links] ^
2 Sep 10:21:12 - error: [Links] TypeError: Cannot call method 'setTimeout' of undefined
at Object.__request (/Volumes/Data/opt/locker/Collections/Links/unshortener.js:132:24)