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
// fail | |
test("test1", () => { | |
const mockTest = jest.fn(() => ({ | |
testMethod: jest.fn(() => "test"), | |
})); | |
// false | |
console.log(mockTest().testMethod === mockTest().testMethod); | |
expect(mockTest().testMethod()).toBe("test"); | |
// fail - 毎回新しくjest.fn()が作られるため、呼び出された事が記録されない |
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
// ==UserScript== | |
// @name Disable Shortcut | |
// @namespace https://gist.github.com/from-unknown | |
// @version 0.1 | |
// @description disable shortcuts | |
// @author from-unknown | |
// @include */editpage.action?* | |
// @include */createpage.action?* | |
// @run-at document-idle | |
// @grant none |
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
#!/usr/bin/env bash | |
input_file=$1 | |
if ! [ $# -eq 1 ]; then | |
echo "Please specify INPUT_FILE" | |
echo Usage: | |
echo "$(basename $0)" INPUT_FILE | |
echo ex: | |
echo "$(basename $0)" unixtime.txt |
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
#!/bin/bash | |
cat DUMP_FILE | docker-compose exec -T CONTAINER_NAME mysql -v -uUSER_NAME -pPASSWORD DB_NAME |
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
#!/bin/bash | |
docker-compose exec mongo mongorestore --drop --gzip --archive=FILE_NAME |
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
#!/usr/bin/env bash | |
env=$1 | |
if ! [ $# -eq 1 ]; then | |
echo "Please specify ENV" | |
echo Usage: | |
echo "$(basename $0)" ENV | |
echo ex: | |
echo "$(basename $0)" develop |
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
// show state or saved value and when delete all inputs, still show empty field | |
export const showStateOrSavedValue: (state: string, savedValue: string) => string = ( | |
state, | |
savedValue, | |
) => { | |
return state || state === '' ? state : savedValue; | |
}; |
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
#!/usr/bin/env bash | |
# count | |
aws dynamodb scan --table-name Users --select "COUNT" --filter-expression "Name = :name" --expression-attribute-values '{":name":{"S":"John"}}' | |
# get item | |
aws dynamodb get-item --table-name Users --key '{ "Name": {"S": "John"} }' |
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
# https://github.com/golang/go/issues/35164 | |
export GO111MODULE=on | |
export GOPROXY=direct | |
export GOSUMDB=off |
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
# for remote debug Node.js | |
ssh -L 9229:localhost:9229 dev-server [-N] |
NewerOlder