Skip to content

Instantly share code, notes, and snippets.

@goonoo
goonoo / ya9.html
Last active September 23, 2019 07:27
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<!-- This is an automatically generated file.
It will be read and overwritten.
DO NOT EDIT! -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks Menu</H1>
<DL><p>
<DT><H3 ADD_DATE="1560296213" LAST_MODIFIED="1560296263">ya9 (버전2)</H3>
@goonoo
goonoo / replace_multi_files.sh
Created January 14, 2018 05:24
Find and replace all multi files in Mac OS
find . -type f -name '*.coffee' -exec sed -i '' 's/replace_from_string/replace_to_string/' {} +
@goonoo
goonoo / gist:75358a67797e64080f393217c9957dff
Created October 9, 2017 10:13
currenct outgoing network connections
netstat -nputw | wc -l
@goonoo
goonoo / npm_uninstall.sh
Created September 20, 2016 02:24
remove all node modules
npm uninstall `ls -1 node_modules | tr '/\n' ' '`
@goonoo
goonoo / tip.vim
Created September 6, 2016 01:56
vim command tips
"모든 숫자 1씩 더하기
:%s/\[\zs\d\+\ze\]/\=(submatch(0)+1)
@goonoo
goonoo / promise1.js
Last active August 25, 2016 04:10
ES6 promise best practices
// 함수 호출 타이밍에 조건에 따라 promise 실행 분기
// val1 == true, val3 == true인 경우: method1 -> method2 -> method3true
// val2 == true, val3 == false인 경우: method1 -> method2 -> method3false
// val1 == false, val3 == true인 경우: method2 -> method3true
// val2 == false, val3 == false인 경우: method2 -> method3false
function run(val1, val3) {
const p = Promise.resolve(null);
if (val1 === true)
p = p.then(method1);
p = p.then(method2);
@goonoo
goonoo / country_phone_codes.json
Last active August 29, 2015 14:27
Phone codes for all countries
{
"BD": "880",
"BE": "32",
"BF": "226",
"BG": "359",
"BA": "387",
"BB": "+1-246",
"WF": "681",
"BL": "590",
"BM": "+1-441",
@goonoo
goonoo / memorymonitor.config
Last active August 29, 2015 14:27
Elastic Beanstalk Memory Monitor Config
packages:
yum:
perl-DateTime: []
perl-Sys-Syslog: []
perl-LWP-Protocol-https: []
perl-core: []
perl-Switch: []
perl-URI: []
perl-Bundle-LWP: []
sudo netstat -nltp | grep 4000
@goonoo
goonoo / elevator.js
Created January 24, 2015 10:17
My Elevator Saga solution
{
init: function(elevators, floors) {
var MAX_LOAD = 4, elevatorSize = elevators.length;
var fetchElevator = function (floor, callback) {
var candidateIdx = -1, candidateDiff = elevatorSize + 1, candidateLoadFactor = .4;
var currf, fdiff;
for (var i = 0; i < elevatorSize; i++) {
currf = elevators[i].currentFloor();
fdiff = Math.abs(currf - floor.floorNum());
if (elevators[i].destinationQueue.length === 0 &&