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
// Depends on code defined here (related to EventLoop and promise implementation): | |
// https://gist.github.com/soywiz/a2a26b9375f1f85048ab3ce7ffdb5501 | |
// More examples here: httpshttps://github.com/kotlin-es/coroutine-examples/blob/master/src/example-async-generator.kt | |
import java.util.* | |
fun main(args: Array<String>) = EventLoop.main { | |
// Asynchronous Producer |
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
// More examples here: https://github.com/kotlin-es/coroutine-examples/blob/master/src/example-await-async.kt | |
import java.net.URL | |
import java.util.* | |
import java.util.concurrent.ConcurrentLinkedDeque | |
fun main(args: Array<String>) { | |
EventLoop.main { | |
async<String> { | |
val secondsToWait = 3 |
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
// More examples here: https://github.com/kotlin-es/coroutine-examples/blob/master/src/example-generator.kt | |
fun main(args: Array<String>) { | |
//val infiniteList = generate<Int> { for (n in 0 .. 3) yield(n) } | |
val infiniteList = generate<Int> { for (n in 0 .. Int.MAX_VALUE) yield(n) } | |
for (i in infiniteList.lazyFilter { it % 2 == 0 }) { | |
//for (i in infiniteList) { | |
println(i) | |
} |
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
root@d49d7666f4b7:/usr/local/lib/lljvm/demo/zlib# make | |
cd ../../thirdparty && make zlib | |
make[1]: Entering directory `/usr/local/lib/lljvm-bin-linux-i386-0.2/thirdparty' | |
wget -c http://zlib.net/fossils/zlib-1.2.3.tar.gz -O zlib-1.2.3.tar.gz.part | |
--2016-05-27 00:22:48-- http://zlib.net/fossils/zlib-1.2.3.tar.gz | |
Resolving zlib.net (zlib.net)... 69.73.132.10 | |
Connecting to zlib.net (zlib.net)|69.73.132.10|:80... connected. | |
HTTP request sent, awaiting response... 200 OK | |
Length: 496597 (485K) [application/x-gzip] | |
Saving to: 'zlib-1.2.3.tar.gz.part' |
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
#include <stdio.h> | |
#include <math.h> | |
#include <stdlib.h> | |
#include <float.h> | |
#include <gd.h> | |
#define max(a, b) ((a > b) ? (a) : (b)) | |
unsigned int nextpot(unsigned int v) { | |
v--; |
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 ; | |
import haxe.Log; | |
import haxe.ds.Vector; | |
import haxe.io.Bytes; | |
class Fixer { | |
static public function main() { | |
var m = Matrix.fromRows([ | |
[0, 0, 0, 1, 0, 1, 1], | |
[0, 0, 0, 1, 0, 0, 0], |
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
var a = 1; | |
var b = 2; | |
swap(a, b); | |
trace('$a, $b'); | |
macro static public function swap(a:Expr, b:Expr) { | |
return macro { | |
var temp = $a; | |
$a = $b; | |
$b = temp; |
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
public struct RGBA | |
{ | |
public byte R, G, B, A; | |
} | |
class MyClass | |
{ | |
static public RGBA[] ColorPixels = new RGBA[800 * 480]; | |
static public byte[] Lookup = new byte[256]; |
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
public class TransitionBlendGpu | |
{ | |
GraphicsDevice GraphicsDevice; | |
SpriteBatch SpriteBatch; | |
BlendState BlendAlpha1; | |
BlendState BlendAlphaAdd; | |
BlendState BlendAlphaSub; | |
Texture2D DummyTexture; | |
public TransitionBlendGpu(GraphicsDevice GraphicsDevice) |
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
class MathEx { | |
/** | |
* Divide the first integer expression by the second constant integer value. | |
* It will just work with numerator being and unsigned short value (0x0000-0xFFFF) | |
* | |
* @param numerator Unsigned short numerator value | |
* @param denominator Constant denominator value | |
* @return | |
*/ | |
@:macro static public function fastUintConstDiv16(numerator:Expr, denominator:Int):Expr { |