Skip to content

Instantly share code, notes, and snippets.

View januswel's full-sized avatar
🚧
building products by building teams

Takagi Kensuke januswel

🚧
building products by building teams
View GitHub Profile
import MyComponent from "./components/MyComponent";
export { MyComponent };
@januswel
januswel / development-guidelines.md
Last active April 8, 2020 00:38
Development Guidelines

Development Guidelines

commit guideline

  • avoid committing tangled changes
  • commit changes to build and pass unit-tests
  • make a lot of small commits rather than a huge commit

pull request guideline

@januswel
januswel / do-concurrently.ts
Created July 22, 2019 05:50
doTaskNeedsTimeConcurrently
const AsyncLock = require('async-lock')
const lock = new AsyncLock()
const N = 10
const RATE_LIMIT = 2
const src = Array.from({ length: N })
const doTaskNeedsTime = _ =>
new Promise(resolve => {
@januswel
januswel / check-domain.ts
Created July 18, 2019 01:39
checking the domain exists or not
import * as util from 'util'
const resolveMx = util.promisify(dns.resolveMx)
const checkDomain = (domain: string) => {
try {
process.stdout.write(`retrieving MX record of ${domain}\n`)
await resolveMx(domain)
cache.add(domain)
} catch (e) {
process.stderr.write(`domain does not exist: ${mailAddress}\n`)
@januswel
januswel / question.ts
Last active June 7, 2019 10:16
promisify `question` of readline in TypeScript on Node.js
// promisified rl.question
import * as readline from 'readline'
import * as util from 'util'
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
})
@januswel
januswel / rn-node-version.sh
Created January 13, 2019 14:31
check if Node.js version meets React Native requirements or not
#!/bin/sh
set -eux
MAJOR_REQUIREMENT=8
MINOR_REQUIREMENT=3
version="$(node -v | tr -d '^v' | tr '.' '\n')"
major=$(echo "${version}" | head -1)
minor=$(echo "${version}" | head -2 | tail -1)
@januswel
januswel / App.js
Created June 22, 2018 03:26
Farmnote Sponsor LT in React Native meetup #8
import React from 'react'
import {
Animated,
StyleSheet,
View
} from 'react-native'
export default class App extends React.Component {
constructor() {
super()
@januswel
januswel / ackermann.cpp
Created August 14, 2017 05:19
Ackermann function with expansion in m = 3
/*
* ackermann.cpp
* g++ -O2 --pedantic -Wall ackermann.cpp && ./a.out 4 1
* */
#include <cmath>
#include <cstdlib>
#include <iostream>
double ackermann(const double m, const double n) {
@januswel
januswel / ackermann.cpp
Created August 14, 2017 05:06
Ackermann function
/*
* ackermann.cpp
* g++ -O2 --pedantic -Wall ackermann.cpp && ./a.out 4 1
* */
#include <cstdlib>
#include <iostream>
double ackermann(const double m, const double n) {
if (m == 0) {
@januswel
januswel / index.ios.js
Created May 20, 2017 02:02
CureApp Quiz in React Native meetup #5
import React, { Component } from 'react';
import { AppRegistry, Text, View, TouchableWithoutFeedback, TouchableOpacity } from 'react-native';
export default class QuizSample extends Component {
render() {
return (
<TouchableWithoutFeedback>
<Text>hello world!</Text>
<TouchableOpacity>
<Text>tap</Text>
<Text>me!</Text>