Skip to content

Instantly share code, notes, and snippets.

View MrOrz's full-sized avatar
💤
Sleepy everyday

Johnson Liang MrOrz

💤
Sleepy everyday
View GitHub Profile
@MrOrz
MrOrz / graphql-exmaple.js
Created September 5, 2016 10:42
Minimal graphql example
const {
graphql,
GraphQLSchema,
GraphQLObjectType,
GraphQLString,
} = require('graphql');
const schema = new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
@MrOrz
MrOrz / README.md
Created November 21, 2015 04:06
mockStore would emit "done() called multiple times" error.

Steps to reproduce the bug

  1. Download the gist
  2. npm install
  3. npm test

This would lead you to the following output:

@MrOrz
MrOrz / inviteyoself-google-doc.gs
Last active August 29, 2015 14:25
This script adds a trigger to a Google Form to automatically setup submitted email to become an editor of a specific Google document.
/*
Inviteyoself for Google Doc
===========================
Google doc currently records who edited the file if the file is *not* set to `Anyone can edit'.
We cannot track the author of edits in documents that is set to `Anyone with the link can edit'.
This script adds a trigger to a Google Form to automatically setup submitted email to become an
editor of a specific Google document.
KB Article Number(s): 2704299
Language: All (Global)
Platform: i386
Location: (http://hotfixv4.microsoft.com/Windows%207/Windows%20Server2008%20R2%20SP1/sp2/Fix387976/7600/free/448094_intl_i386_zip.exe)
-----------------------------------------------------------
KB Article Number(s): 2704299
Language: All (Global)
Platform: x64
Location: (http://hotfixv4.microsoft.com/Windows%207/Windows%20Server2008%20R2%20SP1/sp2/Fix387976/7600/free/448095_intl_x64_zip.exe)
@MrOrz
MrOrz / README.md
Last active July 22, 2018 15:36
Cross-device BrowserSync with webpack demo
@MrOrz
MrOrz / webpack-dev-server.js
Created March 20, 2015 14:01
My webpack config
// Webpack development server with hot module replacement enabled
// Ref: http://webpack.github.io/docs/webpack-dev-server.html#combining-with-an-existing-server
//
var serverCfg = require('./config');
if(process.env.NODE_ENV !== 'production') {
var WebpackDevServer = require("webpack-dev-server"),
webpackCfg = require("../client/config/webpack"),
webpack = require("webpack");
(new WebpackDevServer(webpack(webpackCfg), {
import unittest
import 你要測的東西
class XxxSpec(unittest.TestCase):
def setUp(self):
"""
每個 test 前都會執行的東西。你可以塞一些常用的東西進 self。
"""
pass
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class BSTIterator:
# @param root, a binary search tree's root node
def __init__(self, root):
@MrOrz
MrOrz / walk.js
Last active August 29, 2015 14:15 — forked from tomchentw/walk.js
walkAsync now does not assume `path` is a directory now.
/*
Recursively traverses the given dir and returns a promise that resolves to
a list of files.
The promise is resolved only after all sub-directories being traversed.
*/
var walkAsync = function(path) {
return statAsync(path).then(function(stat){
if(stat.isDirectory()){