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
} else if ([option isEqualToString:@"copyFrom"]) { | |
NSLog(@"Copying..."); | |
AFCApplicationDirectory *appDir = [device newAFCApplicationDirectory:[arguments stringForKey:@"app"]]; | |
AFCFileReference *infile = [appDir openForRead:[arguments stringForKey:@"from"]]; | |
if (!infile) { | |
NSLog(@"Error: %@", [appDir lasterror]); | |
} | |
char buf[0x10000]; | |
int outfile = open([arguments stringForKey:@"to"].UTF8String, O_CREAT | O_WRONLY, 0777); |
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
#!/bin/bash | |
if [ "$#" = "0" ]; then | |
echo "at least one argument is required" | |
exit 1 | |
fi | |
FILE=$1 | |
GUARD="$2$(printf "%s" $FILE | tr '.' '_' | tr '[[:lower:]]' '[[:upper:]]')" |
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
/* | |
* Created by Árpád Goretity on 21/10/2013 | |
* | |
* Sparkling demo: solution to Project Euler problem #89 | |
* (http://projecteuler.net/problem=89) | |
* | |
* For demonstration purposes only -- please don't abuse or cheat. | |
*/ | |
function int2roman(r) |
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
/* | |
* p42.spn | |
* Solution to Project Euler problem #42 | |
* | |
* Created by Arpad Goretity on 10/12/2013 | |
*/ | |
function FileSize(file) | |
{ | |
fseek(file, 0, "end"); |
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
/* | |
* p92.spn | |
* | |
* a solution to Project Euler problem #92 | |
* using the Sparkling scripting language | |
*/ | |
function next(n) | |
{ | |
var s = 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
// | |
// derive.c | |
// just because | |
// (just because I wanted to demonstrate what the Sparkling API is good for) | |
// | |
// created by H2CO3 on 31/01/2014 | |
// use for good, not for evil | |
// | |
#include <stdio.h> |
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 six_factorial = function(f, x) { | |
return f(f, x); | |
}(function(f, x) { | |
return x < 2 ? 1 : x * f(f, x - 1); | |
}, 6); |
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
// | |
// bf.spn | |
// a Brainfuck parser and interpreter in Sparkling | |
// | |
// by Arpad Goretity (H2CO3) | |
// The "zeroise" optimization is based on the idea of Daniel Silverstone | |
// run as: spn bf.spn foo.bf | |
// | |
global ins_incrmt = 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
function rrot(a, begin, k) { | |
var n = k - 1; | |
var tmp = a[begin + n]; | |
for var i = n; i > 0; i-- { | |
a[begin + i % k] = a[begin + (i - 1) % k]; | |
} | |
a[begin] = tmp; | |
} | |
function toFact(n, ndigs) { |
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
function curry(fn) { | |
let curry_argc = argc - 1; | |
var curry_args = {}; | |
for var i = 0; i < curry_argc; i++ { | |
curry_args[i] = #i; | |
} | |
return function() { | |
for var i = 0; i < argc; i++ { |
OlderNewer