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 / 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 / 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']
@cpsubrian
cpsubrian / Cakefile
Created December 1, 2011 06:56
Cakefile help. Need a better way than console.log.
{exec, spawn} = require 'child_process'
task 'test', 'Run Mocha tests', ->
proc = spawn 'mocha', ['-R', 'spec', '--colors']
proc.stdout.on 'data', (buffer) -> console.log buffer.toString()
proc.stderr.on 'data', (buffer) -> console.error buffer.toString()
proc.on 'exit', (status) ->
process.exit(1) if status != 0
@cpsubrian
cpsubrian / example.html
Created December 13, 2011 18:08
Minimal overhead hover
<a href="javascript: void(0);" onmouseover="(function(elem) { someLibraryFunction(elem); })(this);">Fancy Text</a>
@cpsubrian
cpsubrian / download_image.php
Created February 17, 2012 02:13
Download and save an external image to a Drupal 6 site.
<?php
/**
* Save a remote image. Returns a file object.
*/
function download_image($url) {
// Check if the file extension is valid.
$extensions = 'jpg jpeg png gif';
$parsed = parse_url($url);
$regex = '/\.(' . @ereg_replace(' +', '|', preg_quote($extensions)) . ')$/i';
if (!preg_match($regex, $parsed['path'], $matches)) {
@cpsubrian
cpsubrian / output.txt
Created February 25, 2012 03:34
Workign on a repl
cpsubrian@blink ~/projects/node/gac (master)
$ cake repl
--------------------------
____ _ ____
/ ___| / \ / ___|
| | _ / _ \| |
| |_| |/ ___ \ |___
\____/_/ \_\____|
GAC REPL - try 'help'