requirements node.js
add in your .zshrc
[[ -s $HOME/bin/prettycurl.sh ]] && . $HOME/bin/prettycurl.sh| /** | |
| * `objFromFlatKeys` Convert the template string into a tree path and set the value into the referenced object path. | |
| * | |
| * @param {string} strPath - template string path to convert in nested object tree | |
| * @param {Object} prevobj - reference for the nested object result | |
| * @param {*} value - value to set at the end of the nested object tree | |
| * | |
| * @example | |
| * // define the target object | |
| * const obj = {}; |
| const mockAsyncProcess = (objToProcess) => { | |
| console.time(objToProcess.id) | |
| console.log(`BEGIN: ${objToProcess.id}`) | |
| return new Promise((resolve) => { | |
| setTimeout(() => { | |
| resolve(`RESULT -> ${objToProcess.id}`); | |
| console.timeEnd(objToProcess.id) | |
| console.log(`END: ${objToProcess.id}`) | |
| }, Math.random() * 1000) | |
| }) |
| #!/usr/bin/env bash | |
| mkdir -p ./app | |
| echo '{ | |
| "name": "my-project", | |
| "version": "0.0.0", | |
| "scripts": { | |
| "dev": "webpack-recipes devserver 9000", | |
| "build": "webpack-recipes build --mode=production" | |
| }, | |
| "devDependencies": { |
| (function() { | |
| 'use strict'; | |
| var dynamicStates = function ($stateProvider, $urlRouterProvider) { | |
| var addRoute = function (name, definition) { | |
| $stateProvider.state(name, definition); | |
| }; | |
| $urlRouterProvider.deferIntercept(); |
| { | |
| "state-one": { | |
| "controller": "stateOneController", | |
| "template": "<h1>State One</h1>" | |
| }, | |
| "state-two": { | |
| "controller": "stateTwoController", | |
| "template": "<h1>State Two</h1>" | |
| } | |
| } |
| (function () { | |
| var _eventsStack = {}; | |
| window.Events = { | |
| emit: function (eventName, message) { | |
| if (!_eventsStack.hasOwnProperty(eventName)) { | |
| _eventsStack[eventName] = []; | |
| } | |
| _eventsStack[eventName].forEach(function (fn) { | |
| fn(message != undefined ? message : {}); | |
| }); |
| const React = require('react'); | |
| const ReactAtellier = require('react-atellier')(React); | |
| class AtellierWrapper extends React.Component { | |
| static propTypes = { message: React.PropTypes.string }; | |
| static defaultProps = { message: 'Hello World!' }; | |
| render() { | |
| const Icon = React.createClass({ | |
| render: function() { | |
| return ( |
| #!/bin/bash | |
| docker-machine start default 1> /dev/null | |
| eval "$(docker-machine env default)" | |
| RUNNING=$(docker inspect --format="{{ .State.Running }}" redis 2> /dev/null) | |
| if [ $? = 1 ]; then | |
| echo "Container redis doesn\'t exists" | |
| docker run -d -p 6379:6379 -v `pwd`/data/redis:/data --name redis redis | |
| fi |