Skip to content

Instantly share code, notes, and snippets.


Devon Govett devongovett

View GitHub Profile
View App.js
const pageQuery = createQuery(); // create a top-level query
const App = () => (
// rendering MovieList automatically composes `MovieList.fragment` into the query.
children={({ loaded, data }) => {
let result = pageQuery(data);
return <MovieList data={result.movieList} />;
}} />
devongovett / index.js
Created Aug 13, 2016
requirebin sketch
View index.js
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var AV = require('av');
player = AV.Player.fromURL('').play();
View gist:d7dc23df4afe8bbbf4e6
DBC = new r.Struct
# ...
stringBlockOffset: -> 4 * 5 + @recordCount * @recordSize
ptr: new r.Pointer(uint32le, new r.String(null), relativeTo: 'stringBlockOffset')
View jquery.transitionEnd.js
var $ = require('jquery');
var transitionEvents = 'transitionend msTransitionEnd webkitTransitionEnd';
var visibilityEvents = 'visibilitychange mozvisibilitychange msvisibilitychange webkitvisibilitychange';
* Runs the given callback when the next transition on the selected element finishes.
* Sometimes the transitionend event doesn't fire when the page is in a
* background tab, so we also handle the page visibility events here too.
devongovett /
Created Apr 10, 2014
Bash script to make a pull request from the current git repository. Tries the upstream remote if possible, otherwise uses origin.
# put this in your .bash_profile
pull_request() {
if [ -z $to_branch ]; then
# try the upstream branch if possible, otherwise origin will do
upstream=$(git config --get remote.upstream.url)
origin=$(git config --get remote.origin.url)
devongovett / height.js
Last active Aug 29, 2015
Set the height of a PDF page retroactively
View height.js
// add content
// this sets the height in the actual PDF output
// MediaBox[1] is really the Y, but PDFs use a flipped coordinate system
// where y=0 is at the bottom.
// make sure you do this before adding another page[1] = - doc.y;
devongovett / translate.js
Created Feb 2, 2014
Use PhantomJS to translate stdin to english using Google Translate. Useful as a textmate command or just a command line tool.
View translate.js
#!/usr/bin/env phantomjs
var system = require('system');
var text = encodeURIComponent(;
var url = "" + text;
var page = require('webpage').create();
page.settings.userAgent = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0';
page.onConsoleMessage = function (msg) {
devongovett / spinner.jade
Created Jul 15, 2013
Simple image-free loading spinner using Jade and Stylus
View spinner.jade
- for (var i = 1; i <= 12; i++)
View gist:4417385
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
char * number2filename(char *start, int digits, int num, char *end) {
int size = strlen(start) + strlen(end) + 1;
int formatSize = size + 3 + log10(digits) + 1;
char *format = (char *)malloc(formatSize);
View gist:3933591

Renaming import

I'm looking for name suggestions for my import module. The purpose of the tool is to add file importing abilities to JavaScript and CoffeeScript files via a #import directive similar to other languages.

import is a bad name for the module for a number of reasons:

  1. import is a reserved word in JavaScript/CoffeeScript so you cannot write var import = require('import') without getting syntax errors.
  2. The import command line tool conflicts with another tool of the same name which is commonly installed on Linux and Mac systems as part of the Imagemagick package.

For these reasons, I'm looking for a new name. The criteria are basically that the name must be available on npm and it must not be a JS reserved word. Here are a few that I thought of:

You can’t perform that action at this time.