Skip to content

Instantly share code, notes, and snippets.

View rcherny's full-sized avatar

Rob Cherny rcherny

View GitHub Profile
@rcherny
rcherny / wpt.md
Last active August 29, 2015 13:55 — forked from t32k/wpt.md
Mastering Webpagetest
@rcherny
rcherny / lazyeval.html
Last active August 29, 2015 13:56 — forked from kristerkari/lazyeval.html
Lazy JS eval - used with good results on Mackenzie. see that
<html>
<body>
<!-- ----------------------------------------------- -->
<!-- inline script block with commented code inside: -->
<!-- ----------------------------------------------- -->
<script id="myjscode">
/*
(function(h,v){function q(b){if(""===m)return b;
@rcherny
rcherny / gist:6393c47dea452960f5f4
Last active August 29, 2015 14:02
Nightwatch phantom.js wrapper
if(process.env.WEB_DRIVER_PORT == null){
process.env.WEB_DRIVER_PORT = 4444;
}
var webdriverPort = process.env.WEB_DRIVER_PORT;
var childProcess = require('child_process');
var phantomjs = require('phantomjs');
var fs = require('fs');
var mkdirp = require('mkdirp');
@rcherny
rcherny / jsbin.vabud.html
Last active August 29, 2015 14:03
Simple state machine
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
</body>
</html>
@rcherny
rcherny / enhanced-console.logger
Last active August 29, 2015 14:03
Console logger
// from fiddle http://jsfiddle.net/drzaus/pWe6W/
// even better : https://gist.github.com/bgrins/5108712
_log = (function(undefined) {
var Log = Error; // does this do anything? proper inheritance...?
Log.prototype.write = function (args) {
/// <summary>
/// Paulirish-like console.log wrapper. Includes stack trace via @fredrik SO suggestion (see remarks for sources).
/// </summary>
/// <param name="args" type="Array">list of details to log, as provided by `arguments`</param>
@rcherny
rcherny / Log-.md
Last active August 29, 2015 14:03 — forked from bgrins/Log-.md
Custom console logger

Javascript log Function

Every time I start a new project, I want to pull in a log function that allows the same functionality as the console.log, including the full functionality of the Console API.

There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.

This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:

  • The full version: Inspired by the plugin in HTML5 Boilerplate. Use this if you are writing an application and want to create a window.log function. Additionally,
@rcherny
rcherny / better-nodejs-require-paths.md
Last active August 29, 2015 14:05 — forked from branneman/better-nodejs-require-paths.md
Better node.js require paths

Better local require() paths for Node.js

Problem

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:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@rcherny
rcherny / app.js
Last active August 29, 2015 14:05 — forked from branneman/app.js
Express Bootstrap App
#!/usr/bin/env node
'use strict';
var spawn = require('child_process').spawn;
var args = [
'--harmony',
'app/bootstrap.js'
];
@rcherny
rcherny / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rcherny
rcherny / css_resources.md
Last active August 29, 2015 14:11 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides