Skip to content

Instantly share code, notes, and snippets.

Author: Wander Nauta Created: 2010-05-17 Type: Feature

Abstract date and time handling in ooc

  • Introduction
  • Motivation
  • Rationale
Somedir: Hash
Somedir dirname: Hash
asdfasdf
import os/Terminal
import math
ProgressBar: class {
value: UInt = 0
maxval: UInt = 100
barwidth: UInt = 80
text := "Please wait..."
--- oldindex.php 2010-06-08 17:16:40.090431965 +0200
+++ index.php 2010-06-08 17:16:43.902432724 +0200
@@ -1,6 +1,4 @@
<?php
-sleep(1);
-
// Some settings
$tmp = "/tmp/";
// Example wakefile
all: func (rockflags: ArrayList<String>) {
rock("entrypoint.ooc", rockflags)
}
docs: func () {
sh("markdown blahblah")
}
// Example (test?) code for try.ooc's reference PHP implementation
import os/Terminal
str := "RAINBOW FEVER"
Terminal setAttr(Attr bright)
rb: func() {
for (c in 0..str length()) {
import os/Terminal
Terminal setFgColor(Color white)
"Long time no see" println()
Terminal reset()
import os/Terminal
Terminal setFgColor(Color white)
"Long time no see" println()
Terminal reset()
import os/Terminal
for (c in 30..38) {
Terminal setBgColor(c)
"Background %d" format(c) print()
Terminal reset()
Terminal setFgColor(c)
" Foreground %d" format(c) println()
Terminal reset()
}
foo: func() -> Bool {
return false;
}
bar: func() -> Int {
return 0;
}
"First attempt: %s" format((bar() || foo() || 20) toString()) println()
"Second attempt: %s" format((foo() || bar() || 20) toString()) println()