This file contains hidden or 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.AbstractMap; | |
import java.util.ArrayList; | |
import java.util.Map; | |
import java.util.function.BiConsumer; | |
public class EntryList<K,V> extends ArrayList<Map.Entry<K,V>> { | |
public boolean add(K key, V value) { | |
return this.add(new AbstractMap.SimpleEntry<>(key, value)); | |
} |
This file contains hidden or 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 ( | |
"net/http" | |
) | |
func firstOrDefault(r *http.Request, key string, defaultValue string) string { | |
first := r.Header.Get(key) | |
if first != "" { | |
return first | |
} | |
return defaultValue |
This file contains hidden or 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
package main | |
import ( | |
"net/http" | |
"fmt" | |
"io/ioutil" | |
"math/rand" | |
) | |
var letters = []byte("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") |
This file contains hidden or 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
When did this: | |
Optional.ofNullable(value) | |
.map(MyType::getProp) | |
.map(x -> x.equals(MyEnum.VALUE)) | |
.orElse(Boolean.FALSE) | |
get sexier than this: | |
value != null && MyEnum.VALUE.equals(value.getProp()) |
This file contains hidden or 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
; Display the the byte in A as two hex digits at the current | |
; screen position | |
; | |
; Inputs: | |
; A byte to display | |
; | |
; Destroys A | |
display_hex: | |
pha | |
lsr |
This file contains hidden or 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
Process: CoQ [33933] | |
Path: /Users/USER/Library/Application Support/Steam/*/CoQ.app/Contents/MacOS/CoQ | |
Identifier: unity.Freehold Games.CavesOfQud | |
Version: 2.0.1 (0) | |
Code Type: X86 (Native) | |
Parent Process: ??? [1] | |
Responsible: CoQ [33933] | |
User ID: 501 | |
Date/Time: 2017-04-22 14:01:07.053 -0700 |
This file contains hidden or 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 Stuff { | |
void method() { | |
/*.. in a catch block ..*/ | |
throw translate(ex); | |
} | |
@SuppressWarnings("UnusedReturnValue") | |
private static RuntimeException translate(Exception ex) | |
throws SomeCheckedException, SomeOtherException { | |
if (ex instanceof SomeException) { |
This file contains hidden or 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
package codenotes; | |
public class Main { | |
public static void main(String[] args) { | |
Result r = new Result(Result.FIRST_NAME_FLAG|Result.LAST_NAME_FLAG|Result.ADDRESS_FLAG); | |
Result.Match m1 = Result.Match.atLeast().firstName().lastName(); | |
System.out.println(r.matches(m1)); // true | |
Result.Match m2 = Result.Match.exactly().firstName().lastName().address(); |
This file contains hidden or 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
package codenotes.model; | |
import javax.annotation.Nullable; | |
public class Data { | |
private String name; | |
public Data(@Nullable String name) { | |
this.name = name; | |
} |
This file contains hidden or 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/bash | |
# kill the media key program on exit | |
trap 'kill $(jobs -p)' EXIT | |
# prevent iTunes from capturing media keys | |
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2>/dev/null | |
# launch the media key program in the background | |
(cmus-media-keys) & |
NewerOlder