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
> GET /49XTeU HTTP/1.1 | |
> User-Agent: curl/7.19.6 (i386-apple-darwin10.0.0) libcurl/7.19.6 OpenSSL/0.9.8k zlib/1.2.3 | |
> Host: bit.ly | |
> Accept: */* | |
> | |
< HTTP/1.1 301 Moved | |
< Server: nginx/0.7.42 | |
< Date: Sat, 31 Oct 2009 18:54:25 GMT | |
< Content-Type: text/html; charset=utf-8 | |
< Connection: keep-alive |
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
var item = things.get(k) | |
if (item eq null) { | |
val newItem = new Item() | |
item = things.putIfAbsent(k, newItem) | |
if (item eq null) { | |
item = newItem | |
} | |
} | |
return item |
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
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-shade-plugin</artifactId> | |
<version>1.2.1</version> | |
<configuration> | |
<createDependencyReducedPom>true</createDependencyReducedPom> | |
</configuration> | |
<executions> |
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
class Monitored extends SomeClass with JmxManaged { | |
val currentThings = new AtomicLong | |
val totalThings = new AtomicLong | |
enableJMX() { jmx => | |
jmx.addAttribute("total-things") { totalThings.get } | |
jmx.addAttribute("current-things") { currentThings.get } | |
} | |
// ... |
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
scala> object Thing1 { | |
| var things = 0 | |
| } | |
defined module Thing1 | |
scala> class Thing1 { | |
| Thing1.things +=1 | |
| } | |
defined class Thing1 |
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
// Scala 2.7.7, immutable map, uses foldLeft to loop over files/words | |
import java.io._ | |
import scala.io._ | |
def time(f: => Unit) = { | |
val t1 = System.currentTimeMillis | |
f | |
((System.currentTimeMillis - t1)/1000.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
def time(f: => Unit) = { | |
val t1 = System.currentTimeMillis | |
f | |
((System.currentTimeMillis - t1)/1000.0) | |
} | |
def write(values: Array[(String, Int)], file: String) { | |
val writer = new PrintWriter(new FileWriter(file)) | |
try { | |
for ((x, y) <- values) { |
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
# ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.2.0], MBARI 0x6770, Ruby Enterprise Edition 2009.10 | |
# user system total real | |
# hash lookup: 21.470000 0.120000 21.590000 ( 23.683924) | |
# method dispatch: 26.980000 0.150000 27.130000 ( 29.014672) | |
# jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2010-01-12 6586) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_17) [x86_64-java] | |
# user system total real | |
# hash lookup: 6.548000 0.000000 6.548000 ( 6.548000) | |
# method dispatch: 10.841000 0.000000 10.841000 ( 10.841000) |
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
protected def  : Seq[(String, Seq[A])] = { | |
ks.pool.withConnection { conn => | |
val results = conn.client.get_range_slices(ks.name, | |
cp, | |
predicate, | |
range, | |
consistency.thrift) | |
results.map { ks => | |
(ks.key, ks.columns.map{ container => new A(container)}) |
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
~/Downloads/node-v0.4.1> less pop-stack.js | |
function doAThing(i) { | |
console.log("Iter " + i); | |
doAThing(i + 1); | |
} | |
doAThing(1); // this should be good | |
~/Downloads/node-v0.4.1> ./node pop-stack.js | |
Iter 1 |