Skip to content

Instantly share code, notes, and snippets.

Working from home

Junyi mytharcher

Working from home
View GitHub Profile
mytharcher / generateCombinationsFromLists.js
Created Sep 17, 2019
View generateCombinationsFromLists.js
const lists = [
[1, 2],
[3, 4],
const combinations = lists
.reduce((all, current) => current
.map(item => => g.concat([item])))
mytharcher / .env
Last active Jul 9, 2018
Royal Mail API test
View .env
mytharcher / package.json
Last active Dec 4, 2017
Really simple and useful practice for React project
View package.json
"scripts": {
"dev": "webpack-dev-server --port 3000 --hot --inline --history-api-fallback --colors --progress",
"build": "NODE_ENV=production webpack -p --optimize-occurence-order --optimize-dedupe --output-public-path '[hash]/'",
"release": "npm run build && bin/deploy"
"dependencies": {
"axios": "0.12.0",
"classnames": "2.2.5",
"qrcode.react": "0.6.1",
mytharcher / index.html
Created Aug 10, 2016
overwatch loading by css3 BY CCG
View index.html
<div class="loader">
<ul class="hexagon-container">
<li class="hexagon hex_1"></li>
<li class="hexagon hex_2"></li>
<li class="hexagon hex_3"></li>
<li class="hexagon hex_4"></li>
<li class="hexagon hex_5"></li>
<li class="hexagon hex_6"></li>
<li class="hexagon hex_7"></li>
View LANG.json
"en_US": {"dir": "ltr", "name": "English"},
"de": {"dir": "ltr", "name": "Deutsch"},
"fr_FR": {"dir": "ltr", "name": "français (France)"},
"fr_CA": {"dir": "ltr", "name": "français (Canada)"},
"ca": {"dir": "ltr", "name": "català"},
"pt_BR": {"dir": "ltr", "name": "português"},
"fa_IR": {"dir": "rtl", "name": "پارسی"},
"zh_CN": {"dir": "ltr", "name": "中文"},
"nl": {"dir": "ltr", "name": "Nederlands"},
mytharcher / Class.js
Last active Aug 29, 2015
Tiny OO inheritance of JavaScript
View Class.js
function Class (proto, Super) {
// use noop function as default constructor if user not defined as in Java
var i, newClass = proto.hasOwnProperty('constructor') ? proto.constructor : function () {};
if (Super) {
var SuperHelper = function () {};
SuperHelper.prototype = Super.prototype;
// make `instanceof` could be use to check the inheritance relationship
mytharcher /
Last active Nov 26, 2017
Grammar Descriptions in PEG.js

Elimination of left recursion

C -> D o D
D -> C
D -> t

D -> D o D
D -> t
View figureMdImgInDir.js
var fs = require('fs');
var path = require('path');
var ENCODING = 'utf8';
var target = process.argv[2];
fs.readdirSync(target).forEach(function (file) {
var filePath = path.join(__dirname, target, file);
var content = fs.readFileSync(filePath, ENCODING)
mytharcher / .htaccess
Last active Mar 3, 2021
Used for automated deploy web site code from Bitbucket to Dreamhost test site via git POST hook.
View .htaccess
# This config is used for Dreamhost which HTTP basic authoriztion is forbidden.
# The PHP Server variable 'PHP_AUTH_USER' & 'PHP_AUTH_PW' could be implement by
# this config via a CGI environment variable.
# From [HTTP Authentication on PHP as CGI (like Dreamhost)](
RewriteEngine on
RewriteRule ^git-hook.*\.php - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
View MY_Session.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
* CodeIgniter
* @package php-bootstrap
* @author mytharcher
* @copyright Copyright (c) since 2013
* @license MIT Licenced