Skip to content

Instantly share code, notes, and snippets.

@LiYiBin
LiYiBin / machine.js
Last active July 28, 2020 08:06
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@LiYiBin
LiYiBin / machine.js
Created July 28, 2020 08:04
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="13">
<profile kind="CodeFormatterProfile" name="GoogleStyle" version="13">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
# Put Makefile in Laravel Project
init:
docker volume create --driver=local composer_cache_data && \
docker volume create --driver=local npm_cache_data
composer:
docker run --rm -ti \
-v composer_cache_data:/tmp \
-v $(PWD):/app -w /app \
// Helpers
const recursiveCompiling = (path, outputPath, funcName, appendedPath = '') => {
const dirPath = `${path}${appendedPath}`;
const filenames = fs.readdirSync(dirPath);
filenames
.filter(filename => !(filename.charAt(0) === '_'))
.filter(filename => !(filename.charAt(0) === '.'))
.forEach(filename => {
const filePath = `${path}${appendedPath}/${filename}`;
var uri = $0.toDataURL();
function download(dataurl, filename) {
var a = document.createElement('a');
a.href = dataurl;
a.setAttribute('download', filename);
var e = document.createEvent('MouseEvents');
e.initEvent('click', false, true);
a.dispatchEvent(e);
@LiYiBin
LiYiBin / gist:3ee40d39098ad39a9cd9192b49f5aa3c
Last active September 12, 2017 06:34
yb_cte_example.sql
#
CREATE DATABASE IF NOT EXISTS `test_cte`;
USE `test_cte` ;
#
CREATE TABLE IF NOT EXISTS `test_cte`.`trees` (
`id` INT NOT NULL ,
`parent_id` INT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
#
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateExistTables extends Migration
{
private $sqlFolder = 'database/migrations/Dump20170907';
private function getDumpSQLs()
@LiYiBin
LiYiBin / installDockerClient
Created August 29, 2017 07:04
Install Docker client
# Install Docker client
ARG DOCKER_VERSION=1.13.1
ARG DOCKER_COMPOSE_VERSION=1.14.0
RUN curl -fsSL https://get.docker.com/builds/Linux/x86_64/docker-$DOCKER_VERSION.tgz | tar --strip-components=1 -xz -C /usr/local/bin docker/docker
RUN curl -fsSL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch for Chrome Debug",
"type": "chrome",
"request": "launch",
"url": "<YOUR_URL>",
"webRoot": "${workspaceRoot}/public"
},