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
static VALUE | |
rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str) | |
{ | |
char squeez[256]; | |
rb_encoding *enc = 0; | |
VALUE del = 0, nodel = 0; | |
char *s, *send, *t; | |
int save, modify = 0; | |
int i; | |
int ascompat, singlebyte = single_byte_optimizable(str); |
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 num-threads 50) | |
(def data (ref 0)) | |
(defn hello [data] | |
(doseq [_ (range 500)] | |
(Thread/sleep (rand-int 1000)) | |
(dosync (ref-set data (inc @data))) | |
(println @data))) |
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
(defmacro or | |
"Evaluates exprs one at a time, from left to right. If a form | |
returns a logical true value, or returns that value and doesn't | |
evaluate any of the other expressions, otherwise it returns the | |
value of the last expression. (or) returns nil." | |
([] nil) | |
([x] x) | |
([x & next] | |
`(let [or# ~x] | |
(if or# or# (or ~@next))))) |
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
import java.util.Vector; | |
public final class SlabThread extends Thread { | |
private Vector _data; | |
private int _chunksize = 128 * 1; | |
SlabThread() { | |
_data = new Vector(); | |
} |
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
travis@travis-desktop:~/src/java/slab$ java Slab | |
Writing vector #0 | |
Writing vector #1 | |
Writing vector #2 | |
Writing vector #3 | |
startBucket = 0 | |
endBucket = 1 | |
readOffset = 0 | |
Writing vector #4 | |
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |
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
travis@travis-desktop:/tmp$ mkdir gittest | |
travis@travis-desktop:/tmp$ cd gittest | |
travis@travis-desktop:/tmp/gittest$ git init | |
Initialized empty Git repository in /tmp/gittest/.git/ | |
travis@travis-desktop:/tmp/gittest$ echo 'foo' > foo | |
travis@travis-desktop:/tmp/gittest$ git add . | |
travis@travis-desktop:/tmp/gittest$ git commit -a -m "added foo" | |
[master (root-commit) 73f39aa] added foo | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
create mode 100644 foo |
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
travis@travis-desktop:~/src/blackberry/grooveshark.dev$ git push trav-build | |
warning: You did not specify any refspecs to push, and the current remote | |
warning: has not configured any push refspecs. The default action in this | |
warning: case is to push all matching refspecs, that is, all branches | |
warning: that exist both locally and remotely will be updated. This may | |
warning: not necessarily be what you want to happen. | |
warning: | |
warning: You can specify what action you want to take in this case, and | |
warning: avoid seeing this message again, by configuring 'push.default' to: | |
warning: 'nothing' : Do not push anything |
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
(defn all-permutations [things] | |
(if (= 1 (count things)) | |
(list things) | |
(for [head things | |
tail (all-permutations (disj (set things) head))] | |
(do | |
(cons head tail))))) | |
(def items {"mixed fruit" 2.15, | |
"french fries" 2.75, |
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
(defn all-permutations [things] | |
(if (= 1 (count things)) | |
(list things) | |
(for [head things | |
tail (all-permutations (disj (set things) head))] | |
(do | |
(cons head tail))))) | |
(defn combo-matches-price? [target combo accum] | |
(if (= target (+ (second (first combo)) accum)) |
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
; empty room | |
(def room {:name "the arena", | |
:occupants []}) | |
(def vampire-bat {:hp 17, | |
:name "vampire bat", | |
:alignment "evil", | |
; melee damage 4-2 | |
:melee [4, 2]}) |
OlderNewer