Skip to content

Instantly share code, notes, and snippets.

/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@csaftoiu
csaftoiu / clemint.py - gold
Last active August 29, 2015 14:06
Interpreter for Clem, v1
import sys,os,copy as C
L=len
S=[]
n=[S]
Q=lambda:S and S.pop()or 0
def P(o):
if o:n[0].append(o)
def X():x=Q();P(x);P(C.deepcopy(x))
def W():S[-2::]=S[-1:-3:-1]
def R():a,b,c=Q(),Q(),Q();P(a);P(c);P(b)
HELLO_WORLD = """\
; Hello, world!
0"Hello, world!"(>)w%10>"""
ECHO = """\
; Echos whatever it receives on STDIN. Dies on EOF.
1(%<#>+)w"""
import subprocess
from clemtest_data import test_data
TMPF = "____tmptest_____"
def run_test(test_name, program, expected_out, stdin=''):
with open(TMPF, "wb") as f:
f.write(program)
p = subprocess.Popen(["python", "clemint.py", TMPF],
@csaftoiu
csaftoiu / isprime.golf
Created May 13, 2015 19:42
Output of compiling isprime.golfc
call main
pop a, z
halt a
readint:
# 3: int res = 0
mov a, 0
# 4: int c
read_loop_start:
# 6: c = getchar()
@csaftoiu
csaftoiu / isprime.golf.c
Created May 13, 2015 19:43
Output of assembling isprime.golf
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#define MAX_RECURSION 1024
#define MAX_HEAP (64*1024*1024)
#define MAX_STACK (64*1024*1024)
@csaftoiu
csaftoiu / foundation-datepicker-angular.js
Created November 9, 2015 21:50
Angular binding for Foundation Datepicker
'use strict';
/**
* @ngdoc overview
* @name foundation.datepicker.angular
* @description
* # foundation.datepicker.angular
*
* Add angular support for {@link http://foundation-datepicker.peterbeno.com/example.html foundation-datepicker}.
*/
@csaftoiu
csaftoiu / foundation-datepicker-angular.html
Created November 9, 2015 21:52
Auto-generated doc for foundation-datepicker-angular
<h1><code ng:non-bindable="">datePicker</code>
<div><span class="hint">directive in module <code ng:non-bindable="">foundation.datepicker.angular</code>
</span>
</div>
</h1>
<div><h2 id="description">Description</h2>
<div class="description"><div class="foundation-datepicker-angular-directive-page foundation-datepicker-angular-directive-datepicker-page"><p>Element directive for
<a href="http://foundation-datepicker.peterbeno.com/example.html">foundation-datepicker</a>.
Adds a text input field which, when clicked, pops up the datepicker.</p>
</div></div>
@csaftoiu
csaftoiu / test
Created November 17, 2015 19:58
test
test
@csaftoiu
csaftoiu / example.html
Last active November 17, 2015 20:05
foundation-range-slider-angular example 1
<range-slider></range-slider>