Skip to content

Instantly share code, notes, and snippets.

Denis Savenok designeng

Block or report user

Report or block designeng

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
@designeng
designeng / Gulpfile.js
Created Jul 23, 2019 — forked from webdesserts/Gulpfile.js
Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
View Gulpfile.js
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: launch the server. If there's a server already running, kill it.
@designeng
designeng / gist:b6610ff59ce36cef9dd919f416c73348
Created Apr 14, 2018 — forked from chadhutchins/gist:1440602
Tarjan's strongly connected components algorithm in Javascript - followed pseudocode from http://en.wikipedia.org/wiki/Tarjan%E2%80%99s_strongly_connected_components_algorithm
View gist:b6610ff59ce36cef9dd919f416c73348
window.onload = function() {
var v0 = new Vertex("0");
var v1 = new Vertex("1");
var v2 = new Vertex("2");
var v3 = new Vertex("3");
var v4 = new Vertex("4");
var v5 = new Vertex("5");
var v6 = new Vertex("6");
var v7 = new Vertex("7");
@designeng
designeng / gist:feb653aad8442d3969e34fd929766c87
Created Apr 14, 2018 — forked from chadhutchins/gist:1440602
Tarjan's strongly connected components algorithm in Javascript - followed pseudocode from http://en.wikipedia.org/wiki/Tarjan%E2%80%99s_strongly_connected_components_algorithm
View gist:feb653aad8442d3969e34fd929766c87
window.onload = function() {
var v0 = new Vertex("0");
var v1 = new Vertex("1");
var v2 = new Vertex("2");
var v3 = new Vertex("3");
var v4 = new Vertex("4");
var v5 = new Vertex("5");
var v6 = new Vertex("6");
var v7 = new Vertex("7");
@designeng
designeng / resize.js
Created Dec 4, 2017 — forked from 19h/resize.js
Streamed image resize using lwip (@wtr7)
View resize.js
// modules
var lwip = require('lwip'),
path = require('path'),
fs = require('fs'),
rstream = require('stream').Readable;
// config
var placesPath = '/Users/apx/Downloads/places';
// helper
@designeng
designeng / removeSitemapFiles.js
Created Dec 22, 2016
Just a tool for removing some dev files from database
View removeSitemapFiles.js
import chalk from 'chalk';
import prompt from 'prompt';
import when from 'when';
let Promise = when.promise;
import wire from 'essential-wire';
import wireDebugPlugin from 'essential-wire/source/debug';
import connectToDatabase from '../plugins/connectToDatabase';
import { sitemapDbUrl } from '../../config/database/urls';
View Virtual DOM vs Handlebars
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="output_h"></div>
<div id="output_v"></div>
<script src="virtual-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js"></script>
View html5-dataset.js
/**
* Add dataset support to elements
* No globals, no overriding prototype with non-standard methods,
* handles CamelCase properly, attempts to use standard
* Object.defineProperty() (and Function bind()) methods,
* falls back to native implementation when existing
* Inspired by http://code.eligrey.com/html5/dataset/
* (via https://github.com/adalgiso/html5-dataset/blob/master/html5-dataset.js )
* Depends on Function.bind and Object.defineProperty/Object.getOwnPropertyDescriptor (polyfills below)
* All code below is Licensed under the X11/MIT License
View template.js
/**
* Map object keys in string to its values
*
* @param {String} text
* @param {Object} data
* @return {String}
*/
template: function (text, data) {
return !text ? '' : text.replace(/\{([^\}]+)\}/g, function (value, key) {
return key in data ? data[key] : value;
View function.ast.json
"type": "Program",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "f"
},
"params": [
{
View plugins.test.spec.js
import chai, { expect } from 'chai';
import spies from 'chai-spies';
import when from 'when';
import wire from 'essential-wire';
import wireDebugPlugin from 'essential-wire/source/debug';
import routingSystemPlugin from '../../src/server/plugins/routing/crossroads';
chai.use(spies);
You can’t perform that action at this time.