Skip to content

Instantly share code, notes, and snippets.

@thecodedrift
thecodedrift / razzle.babel.conf.js
Created November 1, 2018 19:20
Razzle 2 & Babel 7
// https://github.com/jaredpalmer/razzle/blob/e89853267639d62d7930f6ad0e283a5049ccbd35/packages/babel-preset-razzle/index.js
// https://github.com/jaredpalmer/razzle/pull/775
'use strict';
module.exports = (transform = null) => {
// do env check first
var env = process.env.BABEL_ENV || process.env.NODE_ENV;
if (env !== 'development' && env !== 'test' && env !== 'production') {
throw new Error(
'Using `babel-preset-razzle` requires that you specify `NODE_ENV` or ' +
/*
Step 1: Go get the User CSS Chrome Extension
(because chrome lacks a native user stylesheet tool)
https://chrome.google.com/webstore/detail/user-css/okpjlejfhacmgjkmknjhadmkdbcldfcb
Step 2: Go to LinkedIn, open the tool, and paste the
contents of this Gist
You can't stop people from posting terrible parables,
but if that's all your feed has become, then having
@thecodedrift
thecodedrift / gulpfile.js
Last active August 29, 2015 13:56
Async Tasks and Orchestrator
// I'm pretty sure this is a bad idea
setImmediate(function() {
gulp.task('later', function() {
gulp.src('**/*.txt')
.pipe(gulp.dest('output/'))
});
});
// but I really want to...
fs.readFile('some-other-tool.json', function(err, data) {
diff --git a/src/requirecontext.js b/src/requirecontext.js
index 14accf0..5e8e301 100644
--- a/src/requirecontext.js
+++ b/src/requirecontext.js
@@ -293,12 +293,16 @@ var RequireContext = Fiber.extend(function () {
}
}
if (typeof factory === 'function') {
- factory.apply(module, resolved);
+ result = factory.apply(module, resolved);
@thecodedrift
thecodedrift / amd.js
Last active February 11, 2024 22:31
Shim your AMD
/*
================================================================================
ABOUT THIS FILE - amd shim https://gist.github.com/Jakobo/6894733
================================================================================
This file is a helper shim for pure AMD modules. When writing an AMD module,
you need to have access to a global "define" method. This creates a global
define(), a global require(), and a global AMD object.
define/require work like proper sinon stubs. Any define() calls that happen
before your test are automatically queued to run. You can then stub out
@thecodedrift
thecodedrift / rs.js
Last active December 20, 2015 17:58
UnLinked: Standalone
/**
* Redefines some functionality for the APIs, adding support for "clean" methods
*/
IN.Event.on(IN, "frameworkLoaded", function() {
var REGEX_TILDE = /^\~$/,
REGEX_BEGINS_WITH_URL = /^url=(.*)$/,
DEFAULT_KEY_MAPPING = [
{
find: REGEX_TILDE,
@thecodedrift
thecodedrift / javascript.md
Last active December 18, 2015 00:58
JavaScript.js: It's Just JavaScript!

JavaScript to JavaScript Compiler

Lightening Fast Compilation, Runs in Every Browser

There's a bunch of awesome technologies out there for converting to JavaScript. Ever since the days of Google Web Toolkit, it's been possible to write your JavaScript in one language, and have it interpreted into the most optimized output possible. Recently, there's been a glut of these cross compilers: Brython, Coffeescript, and Typescript all come to mind. The biggest limitation of these systems though is that you must either

  • pre-compile your code into JavaScript
  • or use a browser-side parser and interpreter

But no more! JavaScript.js runs natively in all browsers, doesn't require a build step, and hooks into every web browser's native JavaScript engine. To get started, you just need to have a script tag on your page.

#!/bin/sh
if [ -x "node -v" ]; then
echo " "
echo "Node installed correctly; continuing..."
else
echo " "
echo "Node not installed. Installing..."
curl https://raw.github.com/creationix/nvm/master/install.sh | sh
nvm install 0.8
8 -rw-r--r-- 1 jheuser 502 126 Jan 29 14:41 main.js
8 -rw-r--r-- 1 jheuser 502 212 Jan 29 14:41 testa.js
8 lrwxr-xr-x 1 jheuser 502 8 Jan 29 14:37 testb.js -> testa.js
@thecodedrift
thecodedrift / version.txt
Created December 5, 2012 00:50
dot notation
milestone.not-backwards-ok.backwards-ok