- avoid committing tangled changes
- commit changes to build and pass unit-tests
- make a lot of small commits rather than a huge commit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MyComponent from "./components/MyComponent"; | |
export { MyComponent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// promisified rl.question | |
import * as readline from 'readline' | |
import * as util from 'util' | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { | |
Animated, | |
StyleSheet, | |
View | |
} from 'react-native' | |
export default class App extends React.Component { | |
constructor() { | |
super() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
NewerOlder