Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Creating something awesome!

Brian Woodward doowb

:octocat:
Creating something awesome!
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am doowb on github.
  • I am doowb (https://keybase.io/doowb) on keybase.
  • I have a public key whose fingerprint is 7BCB 486E B809 F812 E0EC B3D7 FDC4 D02B 2042 C8F0

To claim this, I am signing this object:

View levelup.md
module levelup
version
downloads in the
last 30 days
total downloads
level-sublevel ~0.19.0 151,300 1,226,226
pouchdb 1.3.8 124,983 1,162,731
browserify-fs ^0.18.2 100,027 458,142
pouchdb-adapter-leveldb-core 1.3.8 97,566 419,461
level-packager ~1.3.0 74,165 758,119
merkle-patricia-tree ^1.2.1 13,231 127,025
dynalite ^1.3.3 10,553 258,090
mosca ^1.3.8 9,513 171,844
@doowb
doowb / README.md
Last active Mar 17, 2016
Use es2015 javascript generators as assemble tasks.
View README.md

Using es2015 javascript generators in assemble tasks.

Assemble is now able to directly take a generator function as a task function. This removes the need for a callback when running synchronous code inside tasks.

From

app.task('load', function(cb) {
  app.layouts(['src/layouts/**/*.hbs']);
  app.partials(['src/partials/**/*.hbs']);
View index.js
// require() some stuff from npm (like you were using browserify)
// and then hit Rebuild to run it on the rightvar
// dependencies
var slice = require("array-slice");
var debug = require("debug");
var extend = require("extend-shallow");
var filter = require("filter-type");
var forOwn = require("for-own");
//var matter = require("gray-matter"); // error with `coffee-script` module
View index.js
// require() some stuff from npm (like you were using browserify)
// and then hit Rebuild to run it on the rightvar
// dependencies
var styles = require('ansi-styles');
var flatten = require('arr-flatten');
var slice = require('array-slice');
var compact = require('arrayify-compact');
var chalk = require('chalk');
var clone = require('clone-deep');
@doowb
doowb / simple.js
Created Aug 25, 2014
Put transformations not running.
View simple.js
'use strict';
var _ = require('lodash');
var dat = require('dat');
var through = require('through2');
var products = [
'PROD-001',
// 'PROD-002',
'PROD-003',
@doowb
doowb / program.js
Created Aug 7, 2014
custom naming in template-loader
View program.js
var path = require('path');
var loader = require('./');
var base = path.resolve('test/fixtures');
var relative = path.relative.bind(path, base);
loader({
rename: function (filepath) {
var name = relative(filepath);
return name
@doowb
doowb / generate.js
Created Jun 12, 2014
Generate a bunch of pages
View generate.js
var file = require('fs-utils');
var matter = require('gray-matter');
var max = 10000;
var i = 0;
var obj = matter.read('src/templates/pages/index.hbs');
var str = obj.original;
for (i=1; i <= max; i++) {
file.writeFileSync('src/templates/pages/page_' + i + '.hbs', matter.reconstruct(str, {message: 'This is page number ' + i}));
@doowb
doowb / sample.js
Created Jun 4, 2014
new assemble sample
View sample.js
var assemble = require('assemble');
var matter = require('gray-matter');
var path = require('path');
var file = require('fs-utils');
var counter;
assemble.config({
options: {
data: ['src/data/**/*.{json,yml}']
@doowb
doowb / radius.js
Created May 30, 2014
Radius from Area
View radius.js
var radius = function (area) {
// make the area bigger so we get better values for small areas
area = area * 10000;
// a = PI*r^2 => a/PI = r^2 => sqrt(a/PI) = r
return Math.ceil(Math.sqrt(area/Math.PI));
};
var r = radius(21000);
var d = r*2;