Skip to content

Instantly share code, notes, and snippets.

@Sequoia
Sequoia / create-some-data.js
Created July 24, 2015 14:53
automigrate example: Create some dummy data for development (obv. don't do this on prod)
//server/boot/create-some-data.js
module.exports = function(app) {
//@TODO: check ENV for NODE_ENV!==PRODUCTION
//data sources
var mongoDs = app.dataSources.mongoDs;
function createReviewers(cb) {
mongoDs.automigrate('Reviewer', function(err) {
if (err) return cb(err);
var Reviewer = app.models.Reviewer;
Reviewer.create([
@Sequoia
Sequoia / README.md
Last active August 29, 2015 14:24 — forked from mbostock/.block

hello werld

Enclosure diagrams use containment to represent the hierarchy. Although circle packing is not as space-efficient as a treemap, it better reveals the hierarchy. Implementation based on work by Jeff Heer. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

See also this zoomable version.

function setupJobs() {
//group nodes into object w/breakpoint as keys
var nodesByBreakpoint = _(vm.claims).chain()
.reduce(function (nodes, claim) {
return nodes.concat(claim.related_nodes);
}, [])
.groupBy(function (node) {
return node.breakpoint;
})
.value();
"scripts": {
"pre-install-cmd": "[[ -a .env ]] || >&2 echo '.env missing. please create .env' && exit 1;"
},
@Sequoia
Sequoia / com
Last active August 29, 2015 14:15
`com` wrapper for composer (for mac) that pops up alert when composer exits
#!/usr/bin/env bash
composer $*
if [[ $? -eq 0 ]]; then
osascript -e 'display notification "composer exited 0 ✨" with title "🔵 Success"'
else
osascript -e 'display notification "composer exited >0" with title "🔴 Failed"'
fi
exit $?;
<?php
require_once 'vendor/autoload.php';
class Tester {
use MyNamespace\Traits\AmazonTraits;
}
@Sequoia
Sequoia / autoload_psr4.php
Created February 4, 2015 17:39
Setting up PSR-4 module
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
/*...*/
'Behat\\Mink\\Driver\\' => array($vendorDir . '/behat/mink-browserkit-driver/src', $vendorDir . '/behat/mink-goutte-driver/src', $vendorDir . '/behat/mink-selenium2-driver/src'),
@Sequoia
Sequoia / mithril_redraw_question.js
Last active August 29, 2015 14:02
Why, when I use `m.module`, does it not automatically rerender the view?
////////app.js
define([ 'mithril', 'propertyPane'],
function(m, propertyPane){
//div#properties exists
m.module(document.getElementById('properties'),propertyPane);
});
///////propertyPane.js

Keybase proof

I hereby claim:

  • I am sequoia on github.
  • I am sequoia (https://keybase.io/sequoia) on keybase.
  • I have a public key whose fingerprint is 92AE B8E8 71C1 0988 02D3 CE92 1997 D382 FF3E EFC3

To claim this, I am signing this object:

@Sequoia
Sequoia / dblr.js
Last active December 28, 2015 03:59
https://gist.github.com/naomik/7178262 Now With More Dependencies!!
// riff off https://gist.github.com/naomik/7178262
var through = require('through');
var doubler = function doubler(data){
data = data.toString();
this.queue(data + data);
};
var uppercaser = function uppercaser(data){
this.queue(data.toString().toUpperCase());