Skip to content

Instantly share code, notes, and snippets.

Avatar

Stefan Krecher StefanKrecher

View GitHub Profile
View RSI+MA.js
//@version=2
study("RSI+MA", overlay=true)
// data series for RSI with length 14
rsi = rsi(close, 14)
// data series for Moving Average with length 9
ma = sma(close, 9)
// data series for buy signals:
//price should be below the moving average and RSI should be smaller than 40
View SmalltalkGroovyExample.groovy
// Booleans
false.ifTrue { assert false }.ifFalse { assert true };
// Exceptions
{-> throw new NullPointerException("Buh!") }.on(NullPointerException).do { e ->
assert e in Exception
assert e in NullPointerException
assert !(e in ArithmeticException)
@StefanKrecher
StefanKrecher / Smalltalk.groovy
Last active Aug 29, 2015
Smalltalkify Groovy: ifTrue/ ifFalse, on Exception do
View Smalltalk.groovy
class Smalltalk {
static Boolean ifTrue (Boolean self, Closure c) {
if(self) c()
self
}
static Boolean ifFalse (Boolean self, Closure c) {
if(!self) c()
self
}
static Boolean 'do' (Boolean self, Closure c) {
@StefanKrecher
StefanKrecher / workspace.st
Created Sep 19, 2012
simple workspace for GNU Smalltalk on Android
View workspace.st
PackageLoader fileInPackage: 'Android'.
| layout event droid samples |
droid := Android new.
layout := '<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/background"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@StefanKrecher
StefanKrecher / GET-Request+JFrame.st
Created Jan 5, 2012
Ambrhino (Smalltalk/Amber-, Java-, Javascript-Mixture) example: makes HTTP-GET-Request & display result on a JFrame
View GET-Request+JFrame.st
| url con is isr br line content pane frame |
<importPackage(java.net)>.
<importPackage(java.io)>.
url := <new URL('http://www.esvapi.org/v2/rest/passageQuery?key=IP&passage=Psalm+23&include-headings=false')>.
con := url openConnection.
is := con getInputStream.
isr := <new InputStreamReader(is)>.
br := <new BufferedReader(isr)>.
content := ''.
line := ''.