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 P = [ | |
Promise.resolve(1), | |
Promise.reject(0), | |
Promise.resolve(2), | |
]; | |
Promise.all(P).then(res => { | |
console.log(res); | |
}).catch(rej => { | |
console.log(rej); |
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
// you can also use imports, for example: | |
// import java.util.*; | |
// you can write to stdout for debugging purposes, e.g. | |
// System.out.println("this is a debug message"); | |
import java.util.Arrays; | |
class Solution { | |
public int solution(int[] A) { |
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 java.util.*; | |
import java.lang.*; | |
import java.io.*; | |
class BinSearch { | |
int key; | |
int[] elem; | |
public BinSearch( int key, int[] elem ) { |
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
class WeatherStation { | |
private int identifier; | |
public void reportWeather(); | |
public void calibrate (Instrument instrument); | |
public void test(); | |
public void startUp(Instrument instrument); | |
public void shutDown(Instrument instrument); | |
} |
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
class Singleton { | |
private static Singleton instance; | |
private Singleton() { | |
} | |
/** | |
* Reference: http://stackoverflow.com/tags/singleton/info |
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
1. git rebase -i <hash-of-commit-preceding-the-incorrect-one> | |
2. In the editor that opens, change pick to reword on the line for the incorrect commit. | |
3. Save the file and close the editor. | |
4. The editor will open again with the incorrect commit message. Fix it. | |
5. Save the file and close the editor. | |
6. git push --force to update GitHub. | |
Originally taken from http://stackoverflow.com/a/5032614/829533 |