Skip to content

Instantly share code, notes, and snippets.


Dan Levy justsml

Block or report user

Report or block justsml

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View events.js
const EventEmitter = require('events');
class Eventry extends EventEmitter {
constructor(type = 'none', ...args) {
this.type = type;
// overload .on and .emit func to
// support special event syntax
on(ev, fn) {
View transformy.js
// transformy is an object mapping tool to
// transform objects to another object defaults
function transformy({ mutate = {}, input = {}, schema = {}, omit = [], loose = true }) {
return Object.keys(input).map((key) => {
const mutated = {};
const tkey = mutate.hasOwnProperty(key) ? mutate[key] : null;
if (omit.indexOf(key) !== -1) return mutated;
if (typeof input[key] !== 'undefined' && schema.hasOwnProperty(tkey)) {
mutated[tkey] = input[key];
} else if (typeof schema[key] !== 'undefined') {
justsml /
Created Jul 14, 2016 — forked from joshdover/
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.


I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

justsml / insertAdjacentHTML.js
Last active Oct 15, 2019 — forked from eligrey/insertAdjacentHTML.js
insertAdjacentHTML polyfill
View insertAdjacentHTML.js
* Updated w/ insertAdjacentElement
* @author Dan Levy @justsml
* 2016-06-23
* Credit: @lyleunderwood - afterend patch/fix
* ```js
* import { insertAdjacentElement } from './libs/insertAdjacentHTML.js';
* Use either:
justsml / fun-with-bluebird-promise-patterns.js
Last active Feb 4, 2016 — forked from domenic/not-bad-code.js
Avoiding explicit promise construction antipattern. Added bluebird.js secret sauce.
View fun-with-bluebird-promise-patterns.js
// Promises are great, but bluebird covers :allthethings
var Promise = require('bluebird');
var appContext = {ready: false, error: false};
const INVALID_CTX = {ready: false, error: true, message: 'App or User not initialized'};
// Bluebird-ify around `fetch` API
function getUser(username) {return Promise.resolve('users/' + username + '.json').then(fetch);}
function initApp(username) {
// Use bluebird to do some real-world-ish code:
justsml / test.js
Last active Jan 8, 2016 — forked from dhigginbotham/adobeAnalyticsInspection.js
sometimes I need to know what vars/events/props are getting sent off to omniture / sitecatalyst / adobe analytics or whatever they renamed themselves to again :neckbeard: I got the awesome list of params from
View test.js
var tap = require('tap');
var locationify = require('..');
tap.test('full URLs', function (t) {
t.similar(locationify(''), {
host: '',
hash: '#top',
path: '/justsml',
// call t.end() when you're done
justsml / virustotal_upload
Last active Nov 9, 2015 — forked from luca-m/virustotal_upload
Upload a sample to VirusTotal and pretty print the report. All in a handy alias.
View virustotal_upload
# Upload a sample to VirusTotal and pretty print the report. All in a handy alias.
# Dependecies:
# * python > 2.7
# * pip install Pygments==1.4
# * curl
# * VirusTotal API key
/// MIT license etc. etc.
/// Experimenting with Python-like list comprehensions.
/// An attempt to explore the possibility space for ergonomic improvements
/// in Rust that can come post v1.0. Notice that there are not type declerations.
/// Aside from the "c!" macro invocation, Rust allows for an exact copy of the
/// Python comprehension syntax.
justsml /
Last active Aug 29, 2015 — forked from jookyboi/
Rails-related Gems and guides to accelerate your web project.


  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
justsml /
Last active Aug 29, 2015 — forked from jookyboi/
CSS libraries and guides to bring some order to the chaos.


  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.


You can’t perform that action at this time.