Skip to content

Instantly share code, notes, and snippets.

👀
Looking for inspirations

TC Liu liuderchi

View GitHub Profile
@liuderchi
liuderchi / .graphqlconfig.yml
Last active Dec 26, 2018
Project config example for Graphql Playground App ( https://github.com/prisma/graphql-playground )
View .graphqlconfig.yml
# For Graphql Playground
# Steps in Toolbar:
# Workspace > New Workspace > select a folder containing this file
#
# example: https://github.com/prisma/graphql-playground/pull/757/files
#
# NOTE for .env
# prepare .env with following content, in same directory as .graphqlconfig.yml
# GH_TOKEN=paste-my-github-token-here
# AIA_TOKEN_LOCAL=paste-aia-token-here
View medium-res-20180519.csv
語法 包含 Non-Enumerable 屬性? 包含原型鍊? Note
'name' in person ✔️ ✔️ 範圍超過自己本身
Object.getOwnPropertyNames(person) ✔️ no
Object.keys(person) no no Enumerable props ONLY
for (let x in person) no ✔️ Enumerable props ONLY
@liuderchi
liuderchi / .zshrc
Last active Jan 23, 2018
My `.zshrc` config with installed `oh-my-zsh` and `PowerLevel9k` theme
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/$USER/.oh-my-zsh"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# ZSH_THEME="robbyrussell"
@liuderchi
liuderchi / shuffle.js
Created Jan 22, 2018
shuffle a string in js
View shuffle.js
// https://stackoverflow.com/a/46545530/1618628
function shuffle = (str) => str.split('')
.map((a) => ({sort: Math.random(), value: a}))
.sort((a, b) => a.sort - b.sort)
.map((a) => a.value)
.join('')
console.log(shuffle('abbychui'))
View demo_read_write.py
# -*- coding: utf-8 -*-
def clean(li):
return map(float, li)
def avg(li):
return sum(clean(li)) / len(li)
def main():
with open('./in.txt', 'r') as input_file, \
@liuderchi
liuderchi / guess_num.py
Last active Jan 4, 2018
classical game: Guess Number for 4A0B !
View guess_num.py
import getpass
def guess_num(guess, ans):
resA, resB = 0, 0
for index, c in enumerate(guess):
findAnsRes = ans.find(c)
if findAnsRes == index:
resA += 1
elif findAnsRes >= 0 :
@liuderchi
liuderchi / iterm2-solarized.md
Created Dec 25, 2017 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)
View iterm2-solarized.md

Default

Default

Powerlevel9k

Powerlevel9k

@liuderchi
liuderchi / create_repo_labels.sh
Last active Jan 16, 2018
To Create Labels for your Repo
View create_repo_labels.sh
#!/bin/bash
set -e
# NOTE to create labels for your repo
# to support types from commit message guide (feat, fix, docs, style, refactor, test, chore)
# by hitting GitHub API v3
#
# https://developer.github.com/v3/issues/labels/#create-a-label
# https://gist.github.com/caspyin/2288960
@liuderchi
liuderchi / curl.md
Created Nov 23, 2017 — forked from caspyin/curl.md
A curl tutorial using GitHub's API
View curl.md

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@liuderchi
liuderchi / GIF-Screencast-OSX.md
Created Nov 22, 2017 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF
View GIF-Screencast-OSX.md

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

You can’t perform that action at this time.