Skip to content

Instantly share code, notes, and snippets.

@JaminFarr
JaminFarr / gulp-to-gulp4-codemod.js
Created January 30, 2020 14:57 — forked from Saturate/gulp-to-gulp4-codemod.js
Convert Gulp 3 to Gulp 4 with a codemod
// Use https://astexplorer.net/
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
const gulpTaskCalls = root.find(j.CallExpression, {
callee: {
object: {
name: 'gulp'
// A more straight forward es5 version
function resolveOn(eventEmmiter, resolveEvent, rejectEvent) {
rejectEvent = rejectEvent === undefined ? "error" : rejectEvent;
return new Promise(function(resolve, reject) {
function resolveHandler(value) {
eventEmmiter.removeListener(rejectEvent, rejectHandler);
resolve(value);
}
@JaminFarr
JaminFarr / promise-utils.js
Last active April 27, 2016 13:30
promiseWhile
// Based on http://blog.victorquinn.com/javascript-promise-while-loop and https://github.com/stevenzeiler/promise-while
function promiseWhile(condition, action) {
return new Promise((resolve, reject) => {
const loop = () =>
Promise.resolve(condition())
.then(keepGoing => {
if (!keepGoing) { return resolve(); }
var Rx = require('rx')
/**
* RxFixedInterval
*
* Returns an observable sequence that produces a value after each period.
*
* The difference between FixedInterval and the standard Rx interval is each value is produced when the time
* is divisable by the interval.
*
@JaminFarr
JaminFarr / blade-mixins.pug
Last active April 16, 2020 15:57
Laravel Blade mixins for jade for use with laravel-elixir-jade
//- For use with https://github.com/CREEATION/laravel-elixir-jade
mixin blade()
='\r\n'
block
='\r\n'
mixin phpblock()
!='\r\n<?php '