Skip to content

Instantly share code, notes, and snippets.

@MouseZero
MouseZero / pipepromise.js
Last active September 25, 2017 02:17
Pipe Promises
function promisePipe(promises, argsToFirstPromise) {
return promises.reduce((prev, promise) => {
return prev.then(x => promise(x))
}, Promise.resolve(argsToFirstPromise))
}
// use promise pipe
promisePipe([
add1,
@MouseZero
MouseZero / index.html
Created October 1, 2017 22:01
Pulse Button
<!DOCTYPE html>
<html>
<head>
<link href='http://fonts.googleapis.com/css?family=Lato:900' rel='stylesheet' type='text/css'>
<style type="text/css">
.pulse-button {
margin: 100px;
background: #FFFFFF;
@MouseZero
MouseZero / gist:d1ca35db120f6c7eab1d21c8f13cae0e
Created September 12, 2018 17:36
Curl request with JSON
curlData='
{
"set": {
"uuid": "59097720-9676-11e8-bccf-5dc6be09647d",
"name": "Test Set",
"cards": [
{
"question": "Test question 1",
"answer": "Test answer 1",
"isMarkdown": true,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Component Functions</title>
</head>
<body>
<my-component></my-component>
// ==== Class 1 ====
function Person(componentName) {
this.componentName = componentName
}
// talk will end up being in __proto__
Person.prototype.talk = function () {
console.log(this.name)
}
const john = new Person('div1')
#!/bin/bash
projectName=$1
folderPath="/code/tmp/${projectName}"
if [[ ! $projectName ]]; then
echo "You need to specify a project name"
exit 1
fi
if [ -d "${folderPath}" ]; then
@MouseZero
MouseZero / server.js
Last active May 3, 2019 06:08
http-proxy-server
var app, server,
proxy = require('express-http-proxy')
express = require('express'),
path = require('path'),
host = process.env.HOST || '127.0.0.1',
port = process.env.PORT || 3333,
root = path.resolve(__dirname, './src');
app = express();
app.use(function(req, res, next) { console.log(req.url); next(); });