Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

/usr/lib/libsora.so if1live

💭
I may be slow to respond.
View GitHub Profile
@if1live
if1live / index.ts
Created Jul 18, 2020
API spec based api server/client library
View index.ts
import yup = require('yup');
import express from 'express';
import fetch, { Response } from 'node-fetch';
type Method = 'get' | 'post' | 'delete' | 'put';
interface Api<Req, Resp> {
name: string;
method: Method;
// url = resource + page
@if1live
if1live / index.ts
Last active Jul 15, 2020
generic based rosie constructor
View index.ts
import { Factory } from 'rosie';
import { NonFunctionKeys } from 'utility-types';
// maybe typeorm entity
class Entity {
constructor() {
this.a = 0;
this.b = null;
}
public a: number;
@if1live
if1live / cls-hooked-express-logging.js
Created Jul 11, 2020
cls-hooked + express + console.info()
View cls-hooked-express-logging.js
/**
* test
* curl "http://127.0.0.1:3000/?id=1" & curl "http://127.0.0.1:3000/?id=2"
*/
const express = require('express');
const delay = require('delay');
const { getNamespace, createNamespace } = require('cls-hooked');
const NSID = 'writer';
@if1live
if1live / httpclient_unity_sample.cs
Created Jan 15, 2019
C# HttpClient + Unity + GET + json body
View httpclient_unity_sample.cs
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Text;
using UnityEngine;
using UnityEngine.Networking;
using System.Net.Http;
using System.Net;
@if1live
if1live / httpclient_sample.cs
Created Jan 15, 2019
c# HttpClient + GET + json body
View httpclient_sample.cs
using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Threading.Tasks;
namespace httpclient
View hangul_number.js
/*
오늘의 코딩 퀴즈
숫자를 기수로 변환하기
1 =>
73 => 칠십삼
598 => 오백구십팔
1920 => 일천구백이십
View timezone.sql
SHOW VARIABLES LIKE '%time_zone%'
@if1live
if1live / sample.ts
Created Nov 8, 2018
indexedDBShim + dexie + typescript test
View sample.ts
const setGlobalVars = require('indexeddbshim');
(global as any).window = global; // We'll allow ourselves to use `window.indexedDB` or `indexedDB` as a global
setGlobalVars(); // See signature below
(window.indexedDB as any).__setConfig({
checkOrigin: false,
});
const Dexie = require('dexie');
var db = new Dexie('friend_database');
db.version(1).stores({
View NoLock.cpp
//to use standard input/output
#include <iostream>
//to use ofstream
#include <fstream>
//to use thread class
#include <thread>
//to use mutex lock
#include <mutex>
//to use vector
#include <vector>
@if1live
if1live / localization.js
Last active Mar 23, 2018
json localication example
View localization.js
var type_a = {
"questions": [
{
"id": 1,
"order": 1,
"correct_answer": 1,
"question": {
"en": "[EN] 2017년 트위터에 140자였던 글자 제한이 어떻게 되었는가?",
"th": "[TH] 2017년 트위터에 140자였던 글자 제한이 어떻게 되었는가?"
},