Skip to content

Instantly share code, notes, and snippets.

@kilon
kilon / CPPBridgeTestMACOS.st
Created Nov 20, 2016
test CPPBridge on macos
View CPPBridgeTestMACOS.st
c := CPPBridge .
fdNumber := c openFile: '/Users/kilon/cpptest.bin'
flags: (c O_RDWR "| c O_CREAT | c O_TRUNC")
mode: (c FILEMODE).
"lseek := c lSeek_fd: fdNumber range:3999 value:0.
c write_fd:fdNumber value: '' size: 1."
mmapPointer := c mmap_adress: 0
fileSize:4000
@kilon
kilon / hierarchy.st
Created Nov 20, 2016
fileout an hierarchy
View hierarchy.st
class:=CPPBridge .
file:=(class name asString, '-hierarchy.st') asFileReference.
stream:=file writeStream.
class fileOutOn:stream.
class allSubclassesDo: [ :cls |
cls fileOutOn: stream.
].
stream close.
View gist:08fa36c85d31c76179e20cbc8e4c08ee
registeredColorsList := ListModel new.
registeredColorsList
items: Color registeredColorNames;
backgroundColorBlock: [ :item | Color named: item ];
title: 'Registered colors'.
registeredColorsList openWithSpec.
View gist:3df2fa1e1aa8fa9fb7772f382adc4ea6
ui := UIManager default .
ui alert:'You are about to delete your HD'.
ui alert: 'You are about to delete your HD' title: 'Critical Alert'.
(ui chooseDirectory: 'Choose directory to save the file' )inspect.
ui chooseFrom: #(1 'hello' 3 'and' 4.0 'bye' #TheEnd) .
ui confirm: 'You want to delete your HD?'.
ui deny: 'WRONG PASSWORD'.
ui edit: 'I beg you to edit me please, do it, do it fast !!!'.
View gist:90826b52b9b86d96f2b9e08d03405eca
m := Morph new.
m openInWorld.
m extent: 50@50.
m height: 100.
m width: 50.
m openInWindowLabeled: 'My First Morph'.
editor := TextMorph new.
@kilon
kilon / linesOfCode.st
Last active Sep 3, 2016
Compute the lines of code per day with a 12% increase each year to reach a total of 1 million lines of code, starting with 10 lines of code per day
View linesOfCode.st
y := 10.
Transcript clear.
Transcript show: '****************************';cr;
show: '* BEGIN COMPUTATION *';cr;
show: '****************************';cr.
(1 to: 30 ) do: [ :time|
Transcript show:'On year ';show:(time asString );show: ' '.
Transcript show: 'you code ' ;show: ((y*(1.12**time)) rounded)asString ;
show:' lines of code per day.';cr].
@kilon
kilon / getValue
Created Sep 17, 2014
a backup for getValue:
View getValue
getValue: aString
"similar to sendMessage but this method also return the python value "
|stream errString retValue |
stream := SocketStream openConnectionToHostNamed: '127.0.0.1' port: 4000 .
stream sendCommand: 'RetValue: ',aString.
errString := stream nextLineLf .
[errString matchesRegex: '.*end of error.*'] whileFalse:[
Transcript show: 'iterating with error:',errString ;cr.
(errString matchesRegex: '.*no error.*') ifFalse: [
@kilon
kilon / rlx.el
Created Nov 19, 2012 — forked from dto/rlx.el
RLX, early elisp prototype of Blocky
View rlx.el
;;; rlx.el --- RLX development tools for GNU Emacs
;; Copyright (C) 2006, 2007, 2008 David O'Toole
;; Author: David O'Toole <dto@gnu.org>
;; Keywords: multimedia, games
;; Version: 0.81
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
You can’t perform that action at this time.