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.io._ | |
import java.nio._ | |
val f = new File("/dev/zero") | |
val size = 10000 | |
val count = 100000 | |
def readUsingInputStream() { | |
val is = new FileInputStream(f) |
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 scala.collection._ | |
import scala.collection.generic._ | |
import scala.collection.mutable.Builder | |
trait ManagedResource[+A] { self => | |
def acquireFor[R](f: A => R): R | |
def map[B](g: A => B): ManagedResource[B] = new ManagedResource[B] { | |
override def acquireFor[R](f: B => R) = { | |
self.acquireFor(x => f(g(x))) |
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
.file "hello.c" | |
.text | |
.p2align 4,,15 | |
.globl find_newline | |
.type find_newline, @function | |
find_newline: | |
.LFB3: | |
xorl %edx, %edx | |
testq %rsi, %rsi | |
je .L3 |
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
size_t find_newline(const char* ptr, size_t len) { | |
size_t i = 0; | |
while (i < len) { | |
if (ptr[i] == '\n') | |
return i + 1; | |
if (ptr[i] == '\r') { | |
if (i + 1 < len && ptr[i + 1] == '\n') | |
return i + 2; | |
else | |
return i + 1; |
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
/* | |
* Copyright (c) 1999 | |
* Silicon Graphics Computer Systems, Inc. | |
* | |
* Copyright (c) 1999 | |
* Boris Fomitchev | |
* | |
* This material is provided "as is", with absolutely no warranty expressed | |
* or implied. Any use is at your own risk. | |
* |
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
" | |
" Author: Alex Naanou | |
" | |
" WARNING: The following will kill most indent functionality in vim. | |
" though you still can use ^F | |
" | |
" to install just drop me into your plugin dir. | |
nnoremap o ^y<home>o<esc>pI | |
nnoremap O ^y<home>O<esc>pI |
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 scala.tools.nsc | |
object Junk { | |
def currentTimeMicros = System.nanoTime / 1000 | |
case class Current(stack: List[String], start: Long) | |
var current: Option[Current] = None | |
val map = new scala.collection.mutable.HashMap[String, Long] | |
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
Index: Global.scala | |
=================================================================== | |
--- Global.scala (revision 18483) | |
+++ Global.scala (working copy) | |
@@ -848,6 +848,7 @@ | |
} | |
} | |
for ((sym, file) <- symSource.iterator) resetPackageClass(sym.owner) | |
+ Junk.printStats() | |
informTime("total", startTime) |
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
object XmlHelpers { | |
val docBuilder = | |
javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder() | |
} | |
class NodeExtras(n: Node) { | |
def toJdkNode(doc: org.w3c.dom.Document): org.w3c.dom.Node = | |
n match { | |
case Elem(prefix, label, attributes, scope, children @ _*) => | |
// XXX: ns |
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
** unknown exception encountered, details follow | |
** report bug details to http://www.selenic.com/mercurial/bts | |
** or [email protected] | |
** Mercurial Distributed SCM (version 1.2) | |
** Extensions loaded: forest, graphlog, hg-git, hgsubversion, mq, patchbomb | |
Traceback (most recent call last): | |
File "/usr/bin/hg", line 27, in ? | |
mercurial.dispatch.run() | |
File "/var/lib/python-support/python2.4/mercurial/dispatch.py", line 16, in run | |
sys.exit(dispatch(sys.argv[1:])) |