emscripten-core/emscripten#2374
Just download and run compile.sh
$ node unoptimized.js # Works (returns nothing)
#Enter this line in the REPL coffeescript console | |
plot = (f,a,b) -> ((if 0<=n<75*f(i) or 75*f(i)<n<0 then '█' else ' ') for n in [-75..75]).join '' for i in (i for i in [a..b] by 0.05) | |
#Then, you can start plotting functions | |
plot Math.sin, 0, 2*Math.PI |
mixIn = (classes...) -> | |
classes.reduce ((o,n) -> o::[key]=method for key,method of n::;o), (class) |
function byteLength(str) { | |
// returns the byte length of an utf8 string | |
var s = str.length; | |
for (var i=str.length-1; i>=0; i--) { | |
var code = str.charCodeAt(i); | |
if (code > 0x7f && code <= 0x7ff) s++; | |
else if (code > 0x7ff && code <= 0xffff) s+=2; | |
if (code >= 0xDC00 && code <= 0xDFFF) i--; //trail surrogate | |
} | |
return s; |
emscripten-core/emscripten#2374
Just download and run compile.sh
$ node unoptimized.js # Works (returns nothing)
using System; | |
using System.Collections.Generic; | |
class HelloWorld | |
{ | |
public static string NestedWithList (string[] subject, string[] verb) { | |
// Hey, I can haz lists! | |
List<string> sentence = new List<string>(); | |
for (var i=subject.Length-1; i>=0; i--) { | |
sentence.Insert(0, subject[i]); |
Seed code 1: 0x00518240 | |
Seed code 2: 0xffffc380 |
// This beautiful oneliner is a recursive function that counts the nodes in a given node | |
// It uses the ES6 "=>" notation for anonymous functions | |
var count = (node) => 1 + Array.prototype.slice.apply(node.childNodes).reduce((p,q) => count(q)+p, 0); | |
// Count the number of nodes in the current document | |
count(document); |
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf8"> | |
<title>Turfu</title> | |
<style> | |
body{ | |
background-color:black; | |
} | |
svg{ |
extern crate time; | |
use std::fmt; | |
#[deriving(Clone)] | |
struct BigNum { | |
val: Vec<u8>, | |
base: u8, | |
} | |
impl BigNum { |
enum List<T> { | |
Cons(T, Box<List<T>>), | |
Nil, | |
} | |
struct ListIterator<'a, T:'a> { | |
cur: &'a List<T> | |
} | |
impl<'a, T> Iterator<&'a T> for ListIterator<'a, T> { |