[ Launch: just another inlet to tributary ] 4568428 by arwagner
[ Launch: An inlet to Tributary ] 4565635 by arwagner
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 static Sprite fromSpriteSheet(String path, int totalWidth, int width, int height, int x, int y) throws IOException{ | |
BufferedImage target = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); | |
int[] pixels = ((DataBufferInt)target.getRaster().getDataBuffer()).getData(); | |
BufferedImage source = ImageIO.read(Sprite.class.getResource(path)); | |
int[] sourcePixels = ((DataBufferInt)source.getRaster().getDataBuffer()).getData(); | |
for (int i = 0; i < width; i++){ | |
for (int j = 0; j < height; j++){ | |
pixels[width * j + i] = sourcePixels[totalWidth * y + x + 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
public class Main { | |
static final int CALCULATIONS_PER_TRIAL = 10000000; | |
static final int TRIALS_PER_RUN = 100; | |
public static void main(String[] args) throws InterruptedException{ | |
int bitwiseWins = 0; | |
for (int trial = 0; trial < TRIALS_PER_RUN; trial++){ | |
long modulusStart = System.nanoTime(); | |
for (int calculation = 0; calculation < TRIALS_PER_RUN; calculation++){ |
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
require 'observer' | |
class Target | |
include Observable | |
end | |
class Watcher | |
def initialize target | |
target.add_observer self | |
end |
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 Changes < Actor | |
out :timeline_tweets_out | |
takes :tweets_in, :friends_in | |
def before | |
@friends = @friends_in.pop | |
end | |
def pump | |
tweet = @tweets_in.pop |
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
Building native extensions. This could take a while... | |
ERROR: Error installing nokogiri: | |
ERROR: Failed to build gem native extension. | |
/Users/andrewwagner/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb | |
checking for libxml/parser.h... *** extconf.rb failed *** | |
Could not create Makefile due to some reason, probably lack of | |
necessary libraries and/or headers. Check the mkmf.log file for more | |
details. You may need configuration options. |
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 Recumbent < Bicycle | |
attr_reader :flag | |
def post_initialize(args) | |
@flat = args[:flag] | |
end | |
def local_spares | |
{flag: flag} | |
end |
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 f | |
([x] (f x 1)) | |
([x y] | |
( ... ))) |
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
user=> (for [[x y] (seq {'a 1 'b 2})] (prn x)) | |
(a | |
b | |
nil nil) | |
user=> |