Skip to content

Instantly share code, notes, and snippets.

View NickTomlin's full-sized avatar
📚
Reading a book

Nick Tomlin NickTomlin

📚
Reading a book
View GitHub Profile
@NickTomlin
NickTomlin / SassMeister-input.scss
Created December 18, 2013 15:59
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
// --- atoms
// tiny, reusable elements of a style that modules
// can extend. They should function like variables.
// @issue
// changes here effect all of the modules that have
describe("jasmine.objectContaining", function() {
var filters = {
available: [
{name: "foo"},
{name: "majors"}
]
};
it("matches objects with the expect key/value pairs", function() {
expect(filters.available).not.toEqual(jasmine.objectContaining({
@NickTomlin
NickTomlin / double-to-single.md
Created August 25, 2014 15:40
double to single bash

Replace double quotes with single quotes

# thanks to http://stackoverflow.com/questions/16154007/replace-all-double-quotes-with-single-quotes and http://stackoverflow.com/questions/22768645/how-to-use-find-exec-and-tr-to-process-a-large-number-of-files
find src -name "*.js" -exec sed -i "s/\"/'/g" {} \;
@NickTomlin
NickTomlin / app.html
Last active August 29, 2015 14:06
Angular directive controller
<!doctype html>
<html ng-app="Demo">
<head>
<meta charset="utf-8" />
<title>
Directive controllers and wrapper error states
</title>
<style>
.input-group-error {
@NickTomlin
NickTomlin / reflatten.js
Created December 24, 2014 18:15
Recursively flatten an array (e.g. _.flatten but less performant probs)
var assert = require('assert');
function reflatten (source, accum) {
accum = accum || [];
if (Array.isArray(source)) {
source.forEach(function (child) {
if (Array.isArray(child)) {
reflatten(child, accum);
} else {
@NickTomlin
NickTomlin / basic-call.js
Last active August 29, 2015 14:13
nodeschool functional-programming
function firstAttempt () {
return Array.prototype.reduce.call(arguments, function (accum, arg) {
return Object.prototype.hasOwnProperty.call(arg, 'quack') ?
accum + 1
: accum;
}, 0);
};
// a tweak on their solution that avoids calling slice
function secondAttempt () {
@NickTomlin
NickTomlin / gulpfile.js
Created February 6, 2015 15:10
pseudo coded gulp helper function
function buildJs () {
// bify returns a vinyl-source-stream wrapped browserify bundle
var browserified = bify();
return gulp.src(SRC.js)
.pipe(browserified)
.pipe(size());
}
gulp.task('js', function () {
@NickTomlin
NickTomlin / keybase.md
Created February 16, 2015 21:27
keybase identification

Keybase proof

I hereby claim:

  • I am nicktomlin on github.
  • I am nicktomlin (https://keybase.io/nicktomlin) on keybase.
  • I have a public key whose fingerprint is 30F9 4A3F 150C 1E85 280E F445 38F6 4F20 6B2A E4AF

To claim this, I am signing this object:

@NickTomlin
NickTomlin / highlight-snippet
Last active April 15, 2017 22:18
Step through reveal.js code as fragments
// stolen from http://stackoverflow.com/a/25396283
// add this in the "callback" block of the highlight plugin definition
// https://github.com/hakimel/reveal.js/blob/master/index.html#L399
[].forEach.call( document.querySelectorAll( '.highlight' ), function( v, i ) {
hljs.highlightBlock(v);
});
@NickTomlin
NickTomlin / reveal-video.js
Created June 1, 2015 17:30
reveal.js video shortcuts
(function (global, document) {
'use strict';
// pause/play && accelerate/decellerate video in a slide
var video;
var debugEnabled = global.videoDebugEnabled;
var modifier = 'altKey'; // change this to whatever key you want to use
function debug () {