Skip to content

Instantly share code, notes, and snippets.

@JaminFarr
JaminFarr / gulp-to-gulp4-codemod.js
Created Jan 30, 2020 — forked from Saturate/gulp-to-gulp4-codemod.js
Convert Gulp 3 to Gulp 4 with a codemod
View gulp-to-gulp4-codemod.js
// 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'
View resolve-on.es5.js
// 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);
}
View rxjs_operators_by_example.md
View promise-utils.js
// 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(); }
View rx-fixed-interval.js
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 Apr 16, 2020
Laravel Blade mixins for jade for use with laravel-elixir-jade
View blade-mixins.pug
//- For use with https://github.com/CREEATION/laravel-elixir-jade
mixin blade()
='\r\n'
block
='\r\n'
mixin phpblock()
!='\r\n<?php '