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

tldr; always read off of full paths with Vite's define.

// GOOD
const MY_THING = import.meta.env.MY_THING 
// BAD
const { MY_THING} = import.meta.env

Context

An example for this issue

@NickTomlin
NickTomlin / instructions.md
Last active October 18, 2024 11:52
iTerm 2 "done" notifications

Add a trigger in Iterm2>Prefernces>Advanced>Triggers

(Those who have paid for Growl can simply use the growl action)

regex: #done#
action: run a command
arguments: /usr/local/bin/notify "Done" (ensure that you've copied the script to that location and made it executable)

Fooo

@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 () {
@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 / 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 / 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 / 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 / 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 {