Skip to content

Instantly share code, notes, and snippets.

View jcblw's full-sized avatar
💤
Don't wake me, my computer is sleeping in.

Jacob Lowe jcblw

💤
Don't wake me, my computer is sleeping in.
View GitHub Profile
@jcblw
jcblw / _layout.js
Last active December 5, 2015 15:14
React Component Server API proposal.
// this is the main layout file
// essentially the default export is a function which is passed content (as a string)
// and an object which can contain a number of things eg. props, and some meta data about the request
import React from 'react'
import {safeStringify} from 'react-component-server'
export default (content, {props}) => {
return (
@jcblw
jcblw / gist-fs.md
Last active October 29, 2016 22:04
Gist FS

Gist FS

Gist FS is a simple interface to gist file as if writing and reading from the local file system. The way this works is that it will get some intial data using the github API and then use the push and pull to interface with the gist.

This will help make Gist programs work offline with gist data and commit things in a normal git manner. As well as allow other programs to access gist since its just a folder.

const GistFS = require('gist-fs')
const gistFS = new GistFS({baseDir: '~/.gist-fs', ..authStuff});
@jcblw
jcblw / index.js
Last active October 29, 2016 09:03
requirebin sketch
// async-each MIT license (by Paul Miller from http://paulmillr.com).
(function(globals) {
'use strict';
var each = function(items, next, callback) {
if (!Array.isArray(items)) throw new TypeError('each() expects array as first argument');
if (typeof next !== 'function') throw new TypeError('each() expects function as second argument');
if (typeof callback !== 'function') callback = Function.prototype; // no-op
if (items.length === 0) return callback(undefined, items);
@jcblw
jcblw / index.js
Created August 16, 2015 20:06
requirebin sketch
const body = document.body
const vsvg = require('vsvg')
const width = window.innerWidth
const height = window.innerHeight
const svg = vsvg.svg({width: width + 'px', height: height + 'px'})
const paths = require('vsvg-paths')
function pathGen() {
return paths.encode([
{
@jcblw
jcblw / find-assets.js
Last active August 29, 2015 14:25
Find page image assets
(function(){
function getBackgroundImages(tagName) {
var els = document.getElementsByTagName(tagName || '*'),
_els = [];
for (var i = 0; i < els.length; i++) {
var el = els[i],
bgImage = getStyle(el, 'background-image') || '';
if (bgImage.trim().match(/^url\((.*)\.(svg|gif|jpeg|jpg|png)(.*)\)/i)) {
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jcblw
jcblw / stringify-object.js
Created July 7, 2015 03:55
stringify an object with functions
module.exports = function stringifyObject(obj) {
var
ret = '{',
keys = [],
_key = '';
for(var key in obj) {
_key += '\'' + key + '\' : ';
if (typeof obj[key] === 'object') {
_key += stringifyObject(obj[key]);
} else if (obj[key]) {
@jcblw
jcblw / sheru.md
Last active October 1, 2015 04:20
Sheru Controllers

Sheru Controller

Sheru is an isomorphic framework that used jsdom to create server rendered pages. It is based on Backbone and Handlebars.

Sheru controllers

Sheru controllers are very important. They are the main piece that interfaces directly with both the server and the client.

Controllers have a life cycle.

@jcblw
jcblw / nodeschool-la.svg
Created June 29, 2015 15:21
nodeschool la logo (ROUGH)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.