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 HundredContainer: Sequence { | |
var count = 0; | |
typealias GeneratorType = GeneratorOf<Int> | |
func generate() -> GeneratorType { | |
return GeneratorOf<Int>({ | |
if self.count < 100 { | |
self.count += 1 | |
return self.count | |
} else { |
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
trait Trait { | |
fn method() { println!("delegation") } | |
} | |
struct Component { x: int } | |
impl Trait for Component { } | |
struct Composition { comp: Component } | |
#[delegate="comp"] |
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
all: | |
rustc test.rs | |
./test | |
run: all | |
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
#!/bin/bash | |
for size in 29 57 72 512; do | |
f=Icon_"$size"x"$size".png | |
cp "$1" "$f" | |
sips -z $size $size "$f" | |
done | |
for size in 29 50 57 60 72 76 512; do | |
f=Icon_"$size"x"$size"@2x.png | |
cp "$1" "$f" |
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
#include <stdio.h> | |
#define PRINT printf("%c", (i*X>j*Y&&j*X>i*Y) ? '9'-((i<j?i*X-Y*j:j*X-Y*i)*9)*X/((X-Y)*X*size) : ' ') | |
int main() { | |
int size; | |
int i, j; | |
int X, Y; | |
printf("input size of star> "); | |
scanf("%d", &size); | |
printf("input space by ratio type (X/Y), X and Y should be positive integer> "); |
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
jugstates (fst_max, snd_max) = bfs [[(0, 0)]] | |
where | |
bfs [] = [] | |
bfs (s@(h@((a,b):_)):ss) = s : bfs (ss++(map (:h) next_states)) | |
where | |
fill_first = (fst_max,b) | |
fill_second = (a,snd_max) | |
first_to_second | |
| snd_max > a+b = (0, a+b) |
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
/* Created by youknowone <hangulize@youknowone.org> in 2011 | |
NO right reserved. | |
This script provides inline functions to hangulize html document based on 'lang' attribute of each element. | |
For example, | |
<span lang="eo">La Espero</span> | |
upper one will be replaced to | |
<span lang="eo"><abbr title="라 에스페로">La Espero</abbr></span> | |
In complex case, |
NewerOlder