Skip to content

Instantly share code, notes, and snippets.

View koji's full-sized avatar
🫚
orz

koji koji

🫚
orz
View GitHub Profile
@koji
koji / special_repo_list.md
Last active July 16, 2020 09:17
People who are using a special repo from Most active GitHub users in Worldwide
@koji
koji / uniqueArray.md
Last active July 6, 2020 13:57
uniqueArray es6
const originalArray = [1, 2, 3, 4, 1, 2, 3, 4];

const uniqueArray = new Set(originalArray);
console.log(uniqueArray);
const originalArray = [1, 2, 3, 4, 1, 2, 3, 4]
const num = 1;
const ret = ( '000' + num ).slice( -3 );
console.log(ret);
$ chsh -s /bin/bash # zsh --> bash
$ chsh -s /bin/sh # bash --> zsh

save screenshots in Screenshot folder

$ defaults write com.apple.screencapture location /Users/[your_username]/Screenshots
const fibonacci = n =>
  Array.from({ length: n }).reduce(
    (acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i),
    []
  );

fibonacci(5);
@koji
koji / factorial.md
Created March 12, 2020 07:02
factorial in python
def factorial(n):
    if n > 1:
        return n * factorial(n-1)
    else:
        return 1
@koji
koji / js_date_snnipet.md
Created March 3, 2020 00:50
javascript Date's get methods
  1. Date.getTime() Get the time in milliseconds elapsed since .

  2. Date.getFullYear() Get the four-digit year ().

  3. Date.getMonth() Get the Date object's month as a zero-indexed number ().

  4. Date.getDate()

@koji
koji / codility.md
Last active February 21, 2020 00:38
codility
function solution(A) {
  let result = 0;

  for (let element of A) {
    result ^= element
  }

  return result
}
@koji
koji / react-native_for_android.md
Last active January 29, 2020 02:30
react-native settings for android

1. install watchman

$ brew install watchman

2. install jdk

brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
@koji
koji / uninstall_nodejs_package_version.md
Created January 26, 2020 20:48
Uninstall nodejs of package version
$ /usr/local/bin/node -v
v13.7.0

$ sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}

$ /usr/local/bin/node -v
zsh: no such file or directory: /usr/local/bin/node