actions
|—— oneAction
|—— constants.js
|—— index.js
|—— otherAction
|—— constants.js
|—— index.js
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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
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
// example using the raf module from npm. try changing some values! | |
var requestAnimationFrame = require("raf") | |
var canvas = document.createElement("canvas") | |
canvas.width = 500 | |
canvas.height = 500 | |
document.body.appendChild(canvas) | |
var context = canvas.getContext("2d") |
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
class Solution(object): | |
def gameOfLife(self, board): | |
""" | |
:type board: List[List[int]] | |
:rtype: void Do not return anything, modify board in-place instead. | |
""" | |
answer = copy.deepcopy(board) | |
row = len(board) | |
col = len(board[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
import { genAuthHeaderFromState } from '../api'; | |
import { default as apiFetcher } from '../api/apiFetcher'; | |
// redux-api-middleware | |
export const orderList = () => ({ | |
[CALL_API]: ({ | |
endpoint: 'http://food.com/order/list/', | |
method: 'GET', | |
headers: genAuthHeadersFromState, | |
}) |
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
# ~/.aliases | |
# Put alias under this file | |
## Directory | |
alias wk="cd ~/Documents/workspace" | |
## Alias | |
alias sourcealias="source ~/.zshrc" # source new alias | |
alias newalias="createAlias && sourcealias" # eg: $newalias goToHomeAndSayHello "cd ~ && echo 'hello'" | |
createAlias() { |
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
const fetcherCreateReduxStandardAPIActionMiddleware = () => { | |
return next => action => { | |
const { promise, type, ...rest } = action | |
if (!promise) return next(action) | |
const SUCCESS = type + '_SUCCESS' | |
const REQUEST = type + '_REQUEST' | |
const FAILURE = type + '_FAILURE' | |
next({ ...rest, type: REQUEST }) |
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 options = { | |
method: 'GET', | |
headers: myHeaders, | |
} | |
fetch(url, options) | |
.then(response => console.log(response)) | |
.catch(err => console.log(err)) |
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
# Update apt-get sources | |
sudo apt-get update | |
# Install git | |
sudo apt-get install git | |
# Install nvm | |
# To install or update nvm, you can use the install script using cURL: | |
# Check newest version: [release](https://github.com/creationix/nvm/releases) | |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash # OR |
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
// ES6 | |
const add = firstNumber = secondNumber => firstNumber + secondNumber | |
// ES5 | |
var add = function (firstNumber) { | |
return function (secondNumber) { | |
return firstNumber + secondNumber | |
} | |
} |
OlderNewer