Skip to content

Instantly share code, notes, and snippets.

View jescalan's full-sized avatar

Jeff Escalante jescalan

View GitHub Profile
@jescalan
jescalan / index.md
Last active August 16, 2016 20:27
Differences between jade and the spike-standards stack

Spike v0.11.0 Migration Guide

In this release of spike, we switch posthtml for reshape. Reshape is a complete rewrite of posthtml by the static-dev team with several significant differences:

  • It returns a function by default, so that its results can be used as client-side templates
  • It has a much more clear and robust error reporting system, reporting errors that include the line/col in the original source, and exposing a code snippet to show where it came from
  • It has more clearly written documentation, more thorough tests, consistent code style, and 100% coverage on all core modules

However, as a consequence of this move, the jade plugin is no longer available. The jade plugin was always a hack, and had several crippling caveats. In addition, jade does not fit well with reshape's philosophy of breaking functionality down into small modules. As such, we have replaced ja

@jescalan
jescalan / serializeVerbatim.js
Created August 11, 2016 22:08
serialize an object, with functions, ready to be required
function serializeVerbatim (obj) {
let i = 0
const fns = []
let res = JSON.stringify(obj, (k, v) => {
if (typeof v === 'function') {
fns.push(v.toString())
return `__REPLACE${i++}`
} else {
return v
}
@jescalan
jescalan / app.coffee
Last active August 29, 2015 14:18 — forked from andyshora/app.coffee
axis = require 'axis'
js_pipeline = require 'js-pipeline'
css_pipeline = require 'css-pipeline'
roots_config = require 'roots-config'
W = require 'when'
readdirp = require 'readdirp'
siteFiles = []
# generate files for sitemap
@jescalan
jescalan / index.md
Last active August 29, 2015 14:13
Named Functions

Using Named Functions

In javascript, there are two methods of declaring functions that are seen frequently. They are similar in many ways, but there are a few ways in which they are different. The first one is called a named function. This is how it looks:

function test(){
  console.log('hello world!');
}

"A beginning programmer writes her programs like an ant builds her hill, one piece at a time, without thought for the bigger structure. Her programs will be like loose sand. They may stand for a while, but growing too big they fall apart.

Realizing this problem, the programmer will start to spend a lot of time thinking about structure. Her programs will be rigidly structured, like rock sculptures. They are solid, but when they must change, violence must be done to them.

The master programmer knows when to apply structure and when to leave things in their simple form. Her programs are like clay, solid yet malleable."

-- Master Yuan-Ma, The Book of Programming

@jescalan
jescalan / main.go
Last active August 29, 2015 14:03
Is there any reason to ever use the new keyword in go?
package main
import "fmt"
type Vertex struct {
X, Y int
}
func main() {
v := new(Vertex)
@jescalan
jescalan / fn.js
Last active December 22, 2016 14:33
lazy-loading require in node
/**
* Requires a library, but only loads it when it's actually used.
*
* lazy_require('fs');
* fs.readFileSync('example.js');
*
* var wow = lazy_require('fs');
* wow.readFileSync('example.js');
*
* @param {String} lib - name of the lib you want to load
@jescalan
jescalan / keybase.md
Last active May 12, 2016 14:33
keybase verification

Keybase proof

I hereby claim:

  • I am jescalan on github.
  • I am je (https://keybase.io/je) on keybase.
  • I have a public key whose fingerprint is 6491 2DC4 0D77 ADFF DCAD D2D3 E9E9 CDDA D7FD 94AA

To claim this, I am signing this object:

@jescalan
jescalan / stylus-plugins.md
Created January 5, 2014 01:20
Stylus Plugin Use

Stylus Plugin Use

This document will briefly review a few of the more common ways of using stylus plugins for those who are not familiar. Throughout these examples, we will be using a non-existant stylus plugin called example. Please change example out for whatever plugin you are actually trying to use!

Standalone/Node

First example is for if you are building your own stylus pipeline in node. This is a pretty standard way to do things.

@jescalan
jescalan / index.jade
Created January 4, 2014 01:57
block example
block head
title index page yaaa
block content
p hello world!