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
==> Configuration | |
HOMEBREW_VERSION: 0.9.5 | |
HEAD: 80e6a9cbed41cfe4e53bf0bf8711d92b2eb8f090 | |
CPU: quad-core 64-bit sandybridge | |
OS X: 10.9.1-x86_64 | |
Xcode: 5.0.2 | |
CLT: 5.0.1.0.1.1382131676 | |
X11: 2.7.5 => /opt/X11 | |
==> ENV | |
HOMEBREW_CC: clang |
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
AtomicReference<Map> amap; | |
readOnlyMethod() { | |
// get immutable map reference | |
Map m = amap.get(); | |
m.get(key); | |
... | |
m.get(key2); | |
... | |
} |
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
Optional<User> user = users.get(id); | |
if(user.isPresent()) { | |
Optional<Account> account = accounts.get(user.get()); | |
if(account.isPresent()) { | |
Optional<CreditCard> card = cards.get(user.get(), account.get()); | |
if(card.isPresent()) { | |
card.get().destroy(); | |
} | |
} | |
} |
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 Y<T> implements Function<Function<Function<T, T>, Function<T, T>>, Function<T, T>> { | |
@FunctionalInterface | |
private interface FuncToFunc<F> extends Function<FuncToFunc<F>, F> {} | |
@Override | |
public Function<T, T> apply(Function<Function<T, T>, Function<T, T>> r) { | |
final FuncToFunc<Function<T, T>> funcToFunc = f -> f.apply(f); | |
return funcToFunc.apply(f -> r.apply(x -> f.apply(f).apply(x))); | |
} |
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
// Tested with Opera only! | |
// | |
// ==UserScript== | |
// @name reddit sfw | |
// @description Removes reddits from /r/nsfw & with [NSFW] tag in title | |
// @include http://www.reddit.com/* | |
// ==/UserScript== | |
var items = document.getElementsByClassName("thing"); | |
for (i=0; i < items.length; i++) |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
/* Define a constant */ | |
#define NUMBER 110771 | |
int ctoi(char c) | |
{ | |
return (int)c - 48; |
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
(define-syntax (lexer-src-pos-kw s) | |
(define (char->ci-pattern c) | |
(list ':or (char-downcase c) (char-upcase c))) | |
(define (string->ci-pattern s) | |
(if (symbol? s) | |
(string->ci-pattern (symbol->string s)) | |
(cons ':: (map char->ci-pattern (string->list s))))) | |
(define (token-name s) |
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
pipeline.addLast("encoder", new OneToOneEncoder() { | |
@Override | |
protected Object encode(ChannelHandlerContext channelHandlerContext, Channel channel, Object o) throws Exception | |
{ | |
Server.getStatisticator().increaseResponses(); | |
Response response = (Response) o; | |
byte[] bytes = response.getXML().getBytes(); | |
if (Server.isUseEncoder()) |
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
-module(geometry). | |
-export([startN/1]). | |
ringAgent(Next) -> | |
receive | |
{next, N} when Next =:= undefined -> | |
ringAgent(N); | |
kill -> Next ! kill; | |
M -> | |
io:format("~p received ~p~n", [self(), M]), |
OlderNewer