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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
public class Program { | |
public static void main(String args[]) { | |
LocalDateTime sylvester = LocalDateTime.of(2014, Month.DECEMBER, 31, 23, 59, 59); | |
DayOfWeek dayOfWeek = sylvester.getDayOfWeek(); | |
System.out.println(dayOfWeek); // WEDNESDAY | |
Month month = sylvester.getMonth(); | |
System.out.println(month); // DECEMBER |
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
String stringWithNull = null; | |
String nullResult = Optional.ofNullable(stringWithNull) | |
.map(Integer::valueOf) | |
.map(i -> i + 1) | |
.map(Object::toString) | |
.orElse("number not present"); //This or else from optional is of most interest | |
System.out.println(nullResult); | |
String numberInString = "100"; | |
String result = Optional.ofNullable(numberInString) |
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
function vi { | |
running=$(ps aux | grep emacs | grep -v grep) | |
if [ -z "$running" ] | |
then | |
open -a "Emacs" | |
echo "not running" | |
/bin/sleep 8 | |
fi | |
if [[ ! -t 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
rm -rf ~/.zprezto ~/.zlogin ~/.zlogout ~/.zpreztorc ~/.zprofile ~/.zshenv |