Skip to content

Instantly share code, notes, and snippets.

View koji's full-sized avatar
🔍
I may be slow to respond.

koji koji

🔍
I may be slow to respond.
View GitHub Profile
@koji
koji / sparkar_nativeui.js
Last active January 12, 2021 04:03
Native UI Picker for SparkAR Studio
const Scene = require("Scene");
const NativeUI = require("NativeUI");
const Textures = require("Textures");
const Materials = require("Materials");
(async function () {
const button1 = await Textures.findFirst("texture0");
const button2 = await Textures.findFirst("texture1");
const button3 = await Textures.findFirst("texture2");
@koji
koji / js_hashmap.md
Created July 31, 2020 05:16
js hashmap
var intersect = function(nums1, nums2) {
    const result = [];
    hashMap = {};
        
    for(let i=0; i<nums1.length; i++) {
        // console.log(num);
        if(hashMap[nums1[i]]) {
            hashMap[nums1[i]] +=1;
 } else {
@koji
koji / create_crt.md
Last active July 19, 2020 05:51
create .crt file
$ openssl genrsa 2048 > server.key
$ openssl req -new -key server.key > server.csr
$ openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt

ssl
server.key
server.csr
server.crt

@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()