Skip to content

Instantly share code, notes, and snippets.

View cpsubrian's full-sized avatar

Brian Link cpsubrian

  • Dropbox
  • Fremont, CA
View GitHub Profile
@cpsubrian
cpsubrian / photo.js
Created July 5, 2011 07:18
Figuring out scope
// Constants
var API_HOST = 'api.instagram.com';
var API_BASE_URL = '/v1';
var CLIENT_ID = 'the id';
var CLIENT_SECRET = 'the secret';
var OAuth= require('oauth').OAuth;
var https = require('https');
var util = require('util');
@cpsubrian
cpsubrian / broken-test.js
Created August 1, 2011 01:12
Figuring out tests with Tobi and Vows.
/**
* When I try to test with my app ... I get the error below.
*/
process.env['NODE_ENV'] = 'test';
var vows = require('vows'),
tobi = require('tobi'),
should = require('should'),
app = require('../app'),
conf = require('../conf');
@cpsubrian
cpsubrian / test.js
Created August 1, 2011 01:58
Using tobi with vows.
var vows = require('vows')
, tobi = require('tobi')
, port = 80
, host = 'www.google.com';
/**
* Topic macro to GET a url.
*/
var getUrl = function(url) {
return function() {
@cpsubrian
cpsubrian / results.txt
Created August 1, 2011 02:21
Testing FC
♢ FreedomConnector
An unauthenticated visit to the front page
✓ should have a status of 200
✓ should have an active logo anchor
✓ OK » 2 honored (1.087s)
@cpsubrian
cpsubrian / gist:1331736
Created November 1, 2011 20:03
Testing npm in msysgit
$ npm.cmd --version
/c/node/npm.cmd: line 1: unexpected EOF while looking for mat
/c/node/npm.cmd: line 7: syntax error: unexpected end of file
$ node -e 'console.log(process.platform)'
win32
$ npm --version
sh.exe": npm: command not found
@cpsubrian
cpsubrian / npm-debug.log
Created November 12, 2011 02:07
npm ar errors
info it worked if it ends with ok
verbose cli [ 'node',
verbose cli '/home/vagrant/.nvm/v0.4.12/bin/npm',
verbose cli 'install' ]
info using npm@1.0.105
info using node@v0.4.12
verbose config file /home/vagrant/.npmrc
verbose config file /home/vagrant/.nvm/v0.4.12/etc/npmrc
verbose config file /home/vagrant/.nvm/v0.4.12/lib/node_modules/npm/npmrc
silly testEngine { name: 'kaching',
@cpsubrian
cpsubrian / gac_privatemsg.module
Created November 15, 2011 20:25
Testing sublime 2 text git plugin.
// Disable replies to a message.
$items[$url_prefix . '/lock/%privatemsg_thread'] = array(
'title' => 'Lock Thread',
'page callback' => 'gac_privatemsg_lock_thread',
'page arguments' => array($url_prefix_arg_count + 1),
'access callback' => 'gac_privatemsg_lock_access',
'access arguments' => array($url_prefix_arg_count + 1),
'type' => MENU_CALLBACK,
);
@cpsubrian
cpsubrian / gac_privatemsg.php
Created November 15, 2011 20:25
This is a test
<?php
// Archived (deleted) messages.
$items[$url_prefix . '/archived'] = array(
'title' => 'Archived Messages',
'page callback' => 'privatemsg_list_page',
'page arguments' => array('archived', $url_prefix_user_arg_position),
'file' => 'privatemsg.pages.inc',
'file path' => drupal_get_path('module', 'privatemsg'),
'access callback' => 'privatemsg_menu_access',
'type' => MENU_LOCAL_TASK,
@cpsubrian
cpsubrian / example-equivalent.coffee
Created November 20, 2011 04:35
Parse readable string vows into should.js assertions
###
This is what the below example produces.
###
vows = require 'vows'
should = require 'should'
# Create the test suite.
suite = vows.describe('QuickVows')
# Test quickVows
@cpsubrian
cpsubrian / spawn.coffee
Created November 20, 2011 21:54
Getting spawn to work
###
The following is in a Cakefile and when I run it it causes errors.
However, if I just run: `vows test/*.coffee --spec` on the command line, all is fine.
###
{spawn} = require 'child_process'
task 'test', 'Run Vows tests', ->
args = ['test/*.coffee', '--spec']