Skip to content

Instantly share code, notes, and snippets.

View csturtevant's full-sized avatar

Christopher Sturtevant csturtevant

View GitHub Profile
@csturtevant
csturtevant / 0_reuse_code.js
Created July 10, 2014 21:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@csturtevant
csturtevant / DateTimeWithTimeZoneExample.java
Created July 17, 2016 17:45
Java 8 Date Time Example with Time Zone and Printed List of Available Time Zones
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
@csturtevant
csturtevant / Optional.java
Last active July 17, 2016 18:05
Interesting Use Of Optional
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)
@csturtevant
csturtevant / .zshrc
Created May 4, 2017 20:15
vi pipe to emacs
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 ]]
@csturtevant
csturtevant / uninstal_prezto.zsh
Last active September 13, 2023 22:28
uninstall prezto from home directory
rm -rf ~/.zprezto ~/.zlogin ~/.zlogout ~/.zpreztorc ~/.zprofile ~/.zshenv