This file contains hidden or 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
| git log --full-history --name-status --diff-filter=D -- <file-path> |
This file contains hidden or 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
| { | |
| "ruby.locate": { | |
| "include": "**/*.rb" | |
| }, | |
| "ruby.useBundler": true, | |
| "ruby.codeCompletion": "rcodetools", | |
| "ruby.interpreter.commandPath": "~/.asdf/shims/irb", | |
| "ruby.lintDebounceTime": 500, | |
| "ruby.lint": { | |
| "ruby": true, |
This file contains hidden or 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
| =begin | |
| Include in your rspec config like so: | |
| RSpec.configure do |spec| | |
| spec.include RSpec::RedisHelper, redis: true | |
| end | |
| This helper will clean redis around each example. | |
| =end |
This file contains hidden or 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
| ApplicationController.allow_forgery_protection = false | |
| app.post('/sign_in_path', | |
| { ':user_model': { 'email': 'users@email.com', 'password': 'plain_text_password' } }) |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| items = range(1, 100) | |
| # 1 | |
| for (index, value) in enumerate(items): | |
| if index == 1 or index == 21 or index == 41: | |
| print("Do something only at:", index) | |
| print() |
This file contains hidden or 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
| function debug(showError = true) { | |
| if (window.indexedDB) { | |
| try { | |
| const request = window.indexedDB.open('demo', 1); | |
| request.onsuccess = function (event) { | |
| // not raised | |
| }; | |
| request.onupgradeneeded = function (event) { | |
| // not raised | |
| }; |
This file contains hidden or 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
Show hidden characters
| { | |
| "presets": [["@babel/preset-env"], "@babel/preset-react"], | |
| "plugins": [ | |
| [ | |
| "@babel/plugin-transform-runtime", | |
| { | |
| "corejs": 3, | |
| "proposals": true | |
| } | |
| ], |
This file contains hidden or 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
| { | |
| "name": "ILoveFatCat", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "browserslist": [ | |
| "defaults" | |
| ], | |
| "scripts": { | |
| "start": "webpack-dev-server --open --hot --mode development", |
This file contains hidden or 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
| // 假設你是要一到某個 node 到另一個 node "之後" | |
| function moveElementInSelect(parentId, srcIndex, destIndex) { | |
| const parent = document.getElementById(parentId); | |
| const nodeList = parent.children; | |
| const src = nodeList.item(srcIndex); | |
| const dest = nodeList.item(destIndex + 1); | |
| // 將 src element 直接搬到 dest 之前 | |
| parent.insertBefore(src, dest); | |
| } |
This file contains hidden or 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 React = (function() { | |
| let hooks = []; | |
| let idx = 0; | |
| function useState(initValue) { | |
| const state = hooks[idx] || initValue; | |
| const _idx = idx; | |
| const setState = newValue => { | |
| hooks[_idx] = newValue; |
NewerOlder