Skip to content

Instantly share code, notes, and snippets.

View dashed's full-sized avatar
👨‍💻
Busy transpiling ☕ into ✨

Alberto Leal dashed

👨‍💻
Busy transpiling ☕ into ✨
View GitHub Profile
@dashed
dashed / gulpfile-env.js
Created January 7, 2014 12:38
Interesting and useful gulp snippets.
/*
From https://github.com/gulpjs/gulp/issues/101. Organize gulpfile.js using concept of environment variables.
1. Set up sub-tasks to behave in a certain according to env var; may be env agnostic.
2. Set up high-level tasks to run a group of sub-tasks to orchestrate a behaviour (testing, staging, prod, etc)
*/
var R = 0;
var ENV_SWITCH = void 0;
/* gulpfile.js - https://github.com/wearefractal/gulp */
var gulp = require('gulp');
var gutil = require('gulp-util');
var coffee = require('gulp-coffee');
var path = require('path');
var srcCoffeeDir = './coffee/';
var destDir = './src/';
@dashed
dashed / optimize.sh
Created December 10, 2012 06:45 — forked from ryansully/optimize.sh
image optimization script (pngcrush & jpegtran)
#!/bin/sh
# script for optimizing images in a directory (recursive)
# pngcrush & jpegtran settings from:
# http://developer.yahoo.com/performance/rules.html#opt_images
# pngcrush
for png in `find $1 -iname "*.png"`; do
echo "crushing $png ..."
pngcrush -rem alla -reduce -brute "$png" temp.png
const Immutable = require('immutable');
const Cursor = require('immutable/contrib/cursor');
const immstruct = require('immstruct');
const Iterable = Immutable.Iterable;
/**
(work in progress)
Wrapped immutable.js cursors:
@dashed
dashed / events.js
Created February 2, 2015 23:18
immstructor - wrapper around immstruct [WIP - very experimental]
/**
* Events utility mixin for immstructor
*/
var
Promise = require('bluebird');
var
// TODO: Expose this?
/**
// custom jshint-loader reporter
// Based on https://github.com/sindresorhus/jshint-stylish
var
beeper = require('beeper'),
chalk = require('chalk'),
table = require('text-table'),
stringLength = require('string-length'),
logSymbols = require('log-symbols');
function pluralize(str, count) {
var structure = immstruct({turtles: []});
var TurtlesComponent = React.createClass({
componentWillMount: function() {
this.setState({turtlesCursor: structure.cursor()}
structure.on('swap', () =>
this.setState({turtlesCursor: structure.cursor()}));
"use strict";
/**
* Deps:
* npm install benchmark EventEmitter3
*/
var EventEmitter = require('events').EventEmitter;
var bus = new EventEmitter();
function nextTick(callback) {
// setTimeout(callback, 0);
var mori = require("mori");
function Calendar(appointments, previousCalendar) {
appointments = appointments;
var cal = {};
cal.add = function(appointment) {
var withAppointments = mori.conj(appointments, appointment);
return Calendar(withAppointments, cal);