Skip to content

Instantly share code, notes, and snippets.

@kilon
kilon / rlx.el
Created November 19, 2012 18:54 — forked from dto/rlx.el
RLX, early elisp prototype of Blocky
;;; 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
@kilon
kilon / getValue
Created September 17, 2014 12:16
a backup for 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 / linesOfCode.st
Last active September 3, 2016 17:04
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
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].
m := Morph new.
m openInWorld.
m extent: 50@50.
m height: 100.
m width: 50.
m openInWindowLabeled: 'My First Morph'.
editor := TextMorph new.
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 !!!'.
registeredColorsList := ListModel new.
registeredColorsList
items: Color registeredColorNames;
backgroundColorBlock: [ :item | Color named: item ];
title: 'Registered colors'.
registeredColorsList openWithSpec.
@kilon
kilon / hierarchy.st
Created November 20, 2016 09:43
fileout an hierarchy
class:=CPPBridge .
file:=(class name asString, '-hierarchy.st') asFileReference.
stream:=file writeStream.
class fileOutOn:stream.
class allSubclassesDo: [ :cls |
cls fileOutOn: stream.
].
stream close.
@kilon
kilon / CPPBridgeTestMACOS.st
Created November 20, 2016 09:44
test CPPBridge on macos
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
import bpy
import bgl
import blf
from morpheas import *
# this class is defining the action performed when the button is clicked
clase AButtonAction:
def onLeftClick(morph):
print("the button has been clicked")