Skip to content

Instantly share code, notes, and snippets.

View gcoop's full-sized avatar

Gavin Cooper gcoop

  • Surfline.com
  • Newport Beach, CA
View GitHub Profile
@gcoop
gcoop / gist:7893823
Created December 10, 2013 16:45
Map drive with sshfs
sshfs -o idmap=user username@ip:path mapped_folder
@gcoop
gcoop / qunit.js
Created April 25, 2012 10:31
QUnit for use with the QUnit runner.
/**
* QUnit - A JavaScript Unit Testing Framework
*
* http://docs.jquery.com/QUnit
*
* Copyright (c) 2011 John Resig, Jörn Zaefferer
* Dual licensed under the MIT (MIT-LICENSE.txt)
* or GPL (GPL-LICENSE.txt) licenses.
*/
@gcoop
gcoop / video-id-preg.php
Created February 3, 2012 15:25
hacy way to get the video id from a path
<?php
$urls = array(
"http://vimeo.com/34633836",
"http://vimeo.com/34633836&dsfdsf&dhfjsdf=7fsdfjhdsk",
"http://www.youtube.com/watch?v=sYUKrUdYGHw&feature=youtu.be",
"http://www.youtube.com/watch?v=40F_kNd1VlY&feature=relmfu",
"http://www.youtube.com/watch?v=ia4O3CRSdDE&feature=g-all-u&context=G239539dFAAAAAAAAAAA"
);
function getId($str) {
@gcoop
gcoop / phpunit-selenium-web-driver.php
Created January 11, 2012 22:50
PHPUnit test case extension to include Selenium2.
<?php
require_once "php-webdriver/__init__.php";
class SomeTests extends PHPUnit_Framework_TestCase
{
protected $session;
public function setUp()
{
parent::setUp();
@gcoop
gcoop / phpunit-selenium-runner.js
Created January 11, 2012 21:29
PHPUnit/Selenium test suite runner. Runs single test suite on multiple browser and devices async.
/**
* Lighweight node app that will run phpunit tests async. The concept is to start the app with a environment flag and
* a CSV of browsers. App will then spawn child processes for each browser running your phpunit/selenium test suite
* with that browser and env flag passed. The result is a single test suite run concurrently on multiple browsers and
* devices with a single win/fail result from the node.js app.
*/
// Verify arguments.
if (process.argv.length < 4) {
throw new Error("Usage: node batch-runner.js DEVELOPMENT Chrome,IE6,IE7");
@gcoop
gcoop / qunit-runner.js
Created January 10, 2012 10:42
QUnit runner using PhantomJS.js
//
// Runs a folder of tests or a single test, using QUnit and outputs a JUnit xml file ready for sweet integration with your CI server.
//
// @usage
// DISPLAY=:0 phantomjs qunit-runner.js --qunit qunit.js --tests tests-foler/ --package package.json --junit qunit-results.xml
//
// package.json is a common JS package file which contains a list of files that need to be loaded before the tests are run. In this instance
// the package.json lists the files for a JS SDK, that gets loaded and then the tests test the SDK.
//
// Designed to run via PhantomJS.
@gcoop
gcoop / vimeo-tv-script.html
Created June 24, 2011 12:20
Plays an array of vimeo videos in a row. Just full screen the browser, sit back and relax.
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
@gcoop
gcoop / app.js
Created May 19, 2011 13:40
Basic example of using the accelerometer in Appcelerator's Titanium Mobile.
// Create tab group
var tabGroup = Titanium.UI.createTabGroup({
barColor: "black"
});
// Create home tab.
var win = Ti.UI.createWindow({
title: "Record"
});
// Tab for the recording pane.
@gcoop
gcoop / cachedImageView.js
Created May 18, 2011 13:26
Appcelerator Titanium ImageView /w cache and cacheage. Supports retina display.
cachedImageView = function(basedir, uri, obj, attr, cacheage) {
/**
Appcelerator Titanium ImageView /w cache
This function attempts to cache a remote image and then returns it again
when it's requested.
The file is stored in a directory "basedir," this is to try and help
you keep files unique. It's not special or magical, but not dirty either.
@gcoop
gcoop / gist:954962
Created May 4, 2011 09:04
Benchmark.js
/**
* Simple benchmark class in Titanium.
*
* @usage
* Benchmark.start();
* Benchmark.addMarker("Did some cool stuff.");
* Benchmark.end(); // Print that shit out.
*
* @author Gavin Cooper.
*/