Skip to content

Instantly share code, notes, and snippets.

Tamlyn Rhodes tamlyn

Block or report user

Report or block tamlyn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jakebellacera / css_time_to_milliseconds.js
Created Feb 27, 2014
CSS Time to Milliseconds - useful for timing functions around CSS animations
View css_time_to_milliseconds.js
* CSS Time to Milliseconds
* by Jake Bellacera (
* ============================================
* Converts CSS time into milliseconds. Useful for timing functions around CSS animations.
* It supports both seconds (s) and milliseconds (ms).
* Arguments:
* time_string - string representation of a CSS time unit (e.g. "1500ms" or "1.5s")
sevcsik /
Last active Mar 8, 2018
Sharing modules between NodeJS and AngularJS

They say that one of the pros of NodeJS is that you use the same language on the back-end and the front-end, so it's easy to share code between them. This sounds great in theory, but in practice the synchronous dependency handling in NodeJS works completely different than any client-side frameworks (which are asynchronous).

Usually that means that you end up copy-pasting your code between your NodeJS sources and your client-side sources, or you use some tool like Browserify, which is brilliant, but they add an extra step in the build process and most likely will conflict with the dependency handling of the framework of your choice (like AnularJS DI). I couldn't look in the mirror if I would call that code sharing.

Fortunately, with a couple of lines of boilerplate code, you can write a module which works in NodeJS and AngularJS as well without any modification.

No globals in the front-end, and dependencies will work. The isNode and isAngular va

branneman /
Last active Nov 13, 2019
Better local require() paths for Node.js

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

webdesserts / Gulpfile.js
Last active Aug 6, 2019
Automatically reload your node.js app on file change with Gulp (
View Gulpfile.js
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
* $ gulp server
* description: launch the server. If there's a server already running, kill it.
Rarst / composer.json
Last active Oct 24, 2019
Test project for WordPress stack via Composer
View composer.json
"name" : "rarst/install-test",
"description" : "Test project for WordPress stack via Composer",
"authors" : [
"name" : "Andrey Savchenko",
"homepage": ""
"type" : "project",
istepanov / gist:3950977
Created Oct 25, 2012
Remove PHPStorm settings from Mac OS X 10.8 Mountain Lion
View gist:3950977
rm -rf "$HOME/Library/Preferences/WebIde40"
rm -rf "$HOME/Library/Caches/WebIde40"
rm -rf "$HOME/Library/Application Support/WebIde40"
rm -rf "$HOME/Library/Logs/WebIde40"
lavoiesl / assets_version.php
Created Oct 24, 2012
Automatic cache busting using Git commit in Symfony2
View assets_version.php
// app/config/assets_version.php
$container->loadFromExtension('framework', array(
'templating' => array(
'engines' => array('twig'),
'assets_version' => exec('git rev-parse --short HEAD'),
kasparsd /
Last active Aug 13, 2019
Using Git with Subversion Mirroring for WordPress Plugin Development
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

jlong / uri.js
Created Apr 20, 2012
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "";
parser.protocol; // => "http:"
parser.hostname; // => ""
parser.port; // => "3000"
parser.pathname; // => "/pathname/"; // => "?search=test"
parser.hash; // => "#hash"; // => ""
You can’t perform that action at this time.