-
markdown preview enhanced is a Atom package
- preview markdown in Atom editor on the fly
- allow you to draw flow chart using power of
mermaid
- you can export the document in
html
orpdf
-
mermaid let you draw diagram like writing markdown
- supporting lots of diagram
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom | |
//Where el is the DOM element you'd like to test for visibility | |
function isHidden(el) { | |
return (el.offsetParent === null); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.csie.ntnu.edu.tw/~u91029/DynamicProgramming.html#2 | |
function stairs(n) { | |
var res = []; | |
res[0] = 1; // first stair | |
res[1] = 1; // second stair | |
if (n > 0 && n < 2) return res[n-1]; | |
for (var i = 2; i < n; i++){ |
brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var R = require('ramda') | |
var DAY = 'DAY' | |
var fn = R.pipe( | |
function(x) { | |
console.log(R.equals(DAY)(x)) | |
return x | |
}, | |
R.equals(DAY), | |
function(x) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// steps: | |
// 1. copy this file to ~/.atom/init.js | |
// 2. in Atom, dispatch command "Window:Reload", Atom would run this file rather than init.coffee | |
// 3. create new empty file Foo.js | |
// 4. focus to new tab, send command "react:insert-functional-component-template" | |
atom.commands.add('atom-text-editor', 'react:insert-functional-component-template', () => { | |
editor = atom.workspace.getActiveTextEditor() | |
if (!editor) { return null } | |
const fileNameCap = getCamelCaseNameFromPath(editor.getPath()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// sample reference https://www.npmjs.com/package/graphql-client | |
// GitHub API v4 reference https://developer.github.com/v4/explorer/ | |
const graphqlClient = require('graphql-client') | |
// GET your token https://github.com/settings/tokens | |
const TOKEN = 'YOUR-TOKEN-HERE' | |
// choose fields of user info https://developer.github.com/v4/reference/object/user/#fields | |
const USERFIELDS = [ | |
'login', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
語法 | 包含 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 |