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
ssh-keygen -t rsa -b 4096 -C "[email protected]" |
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
#if (${PACKAGE_NAME} == "" )package ${PACKAGE_NAME} | |
#end | |
import org.scalatest.Assertions | |
import org.scalatest.mock.MockitoSugar | |
import org.testng.annotations.Test | |
import org.scalatest.Assertions | |
import org.scalatest.mock.MockitoSugar | |
import org.testng.Assert._ |
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
Protocol easyhttps = new Protocol("https", (ProtocolSocketFactory)new EasySSLProtocolSocketFactory(), 443); | |
Protocol.registerProtocol("https", easyhttps); | |
HttpClient client = new HttpClient(); | |
HostConfiguration config = client.getHostConfiguration(); | |
config.setProxy("localhost", 8888); |
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
// Requires Google Guava 10 or greater | |
Cache<Key, Graph> graphs = CacheBuilder.newBuilder() | |
.concurrencyLevel(4) | |
.weakKeys() | |
.maximumSize(10000) | |
.expireAfterWrite(10, TimeUnit.MINUTES) | |
.build( | |
new CacheLoader<Key, Graph>() { | |
public Graph load(Key key) throws AnyException { |
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
ObjectMapper mapper = new ObjectMapper(); | |
mapper.getDeserializationConfig().without(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); |
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 devnulled; | |
import java.util.Date; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class DateTimeUtils { | |
/** | |
* <p> | |
* Parses a Microsoft .NET style JSON timestamp and returns a Java Date irrespective of time zones (but can parse them) |
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
* g o a t s e x * g o a t s e x * g o a t s e x * | |
g g | |
o / \ \ / \ o | |
a| | \ | | a | |
t| `. | | : t | |
s` | | \| | s | |
e \ | / / \\\ --__ \\ : e | |
x \ \/ _--~~ ~--__| \ | x | |
* \ \_-~ ~-_\ | * | |
g \_ \ _.--------.______\| | g |
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
// flatMap | |
// This code is equivalent to: | |
// option.flatMap(foo(_)) | |
option match { | |
case None => None | |
case Some(x) => foo(x) | |
} | |
// flatten | |
// This code is equivalent to: |
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
resolvers += Resolver.url("artifactory", url("http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns) |
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
def doSomething() = { | |
val s = System.nanoTime | |
// do stuff here | |
println("time: "+(System.nanoTime-s)/1e6+"ms") | |
} |
OlderNewer