View browserify_transforms.markdown

If you're using Browserify and Reactify to write React components and build them for the browser, you may, depending on your setup, see errors along the lines of "unexpected token <", which means that your code is not getting Reactified properly. You will either see this in Gulp, because some subsequent step in the pipeline can't parse your code, or in the browser.

Here's how browserify decides how to apply transforms:

  1. Anything specified when you actually call browserify (i.e. in a gulpfile or on the command line) will be run first. Calls here can specify {global: true}, which will make them be applied to dependencies as well as code in the current module.
  2. If there is a browserify.transform key in package.json, it can list transforms which should be applied, in the order that they should be applied.

You need to specify reactify before anything else which is going to want to parse the code, because obvs. it isn't valid es5 until it's been reactified (so e.g. having `["browserify-shim", "reactify"

View ConEmu Git Bash.md
  1. Open Conemu
  2. Open Settings -> Tasks or go to new tab button -> Setup tasks.
  3. Click + to add a new task
  4. Enter the name as Git Bash or whatever you like
  5. Task parameters:

    /icon "C:\Program Files (x86)\Git\etc\git.ico" /dir "C:\_git"
    
  6. Command:

View gulpfile.js
1 2 3 4 5 6 7 8 9 10
gulp.task("install", function(cb) {
var npm = require("npm");
npmConfig = {};
// sample command line opts, you may have others
if (gUtil.env["npm-cache-path"]) npmConfig.cache = gUtil.env["npm-cache-path"];
if (gUtil.env["npm-log-level"]) npmConfig.loglevel = gUtil.env["npm-log-level"];
 
npm.load(npmConfig, function (er) {
if (er) return cb(er);
npm.commands.install([], function (er, data) { cb(er); });
View requireTime.js
1 2 3 4 5 6 7 8 9 10
/*
* requireTime.js
*
* require()s every thing in your node_modules and tells you how long each one
* took.
*
* USAGE:
* $ cd your_project_folder
* $ node loadTest.js
*
View bash_here.bat
1 2 3 4 5 6 7 8 9 10
@echo off
 
rem If Windows's idea of $HOME is wrong for you, you can use
rem Console2 and instead of using bash directly, use this batch
rem file instead. It will set $HOME to wherever it is located.
 
set PATH=%PATH%;%~dp0
set HOME=%~dp0
 
rem adjust path to suit
View README.md

Deleting a tree of folders using rimraf can be pretty fraught on MS Windows; the OS itself can lock files randomly, and there may be various processes getting in the way, like virus checkers or cloud file syncing apps. rimraf itself will do an exponential-backoff-and-retry for EBUSY and ENOTEMPTY errors on Windows, but you can still see EPERM and others. If you want to do exponential-backoff-and-retry for any error, see the below recipe, using node-retry.

View go_tour_24.go
1 2 3 4 5 6 7 8 9 10
package main
 
import (
"fmt"
"math"
)
 
func Sqrt(x float64) (float64, int) {
last := 0.0
z := 1.0
View pathshrink.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/bash
 
# set this to the problem folder
BASE=/c/Users/ndc/Dropbox/projects/delete-me
 
cd $BASE
for i in `find $BASE -depth`
do
DIR=`dirname $i`
FILE=`basename $i`
View no_caching.cs
1 2 3 4 5
Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
Response.Cache.SetValidUntilExpires(false);
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Something went wrong with that request. Please try again.