https://github.com/cmfcmf/squeakutils
Some small utilities I use in my Squeak image
https://github.com/cmfcmf/squeakutils
smalltalk squeak
Last synced: 22 days ago
JSON representation
Some small utilities I use in my Squeak image
- Host: GitHub
- URL: https://github.com/cmfcmf/squeakutils
- Owner: cmfcmf
- Created: 2019-05-01T10:32:21.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-12-04T16:47:02.000Z (over 3 years ago)
- Last Synced: 2024-10-11T22:15:31.551Z (6 months ago)
- Topics: smalltalk, squeak
- Language: Smalltalk
- Size: 74.2 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SqueakUtils
This repository contains a few utilities I use in my Squeak image.
## Miscellaneous Stuff
### Temporary Subclasses
Sometimes I want to create a subclass on the fly, without worrying about class name and category. For example, imagine wanting a stepping `Morph` that flashes red and green. You can use the `Object >> #tmpSubclass:` message to create a new temporary subclass that overwrites the specified methods.
This will create a new subclass in the `TmpClasses` category with a unique name and `becomeForward` the instance it is called on.
Temporary subclasses are cleaned up on shutdown if no more instances of them are remaining.```
c := CircleMorph new.
c tmpSubclass: {
#stepTime -> [500].
#step -> [
self color = Color green
ifTrue: [self color: Color red]
ifFalse: [self color: Color green]]}.
c startStepping.
c openInHand
```### Comparative Benchmarking
Sometimes you want to compare the execution speed of two or more blocks. While you could simply send `bench` to all blocks you're interested in, this package provides simpler alternatives for comparing up to four blocks: `BlockClosure >> #vs:`, `BlockClosure >> #vs:vs:`, `BlockClosure >> #vs:vs:vs:`. Example:
```
[10 factorial] vs: [20 factorial]
``````
'6,100,000 per second. 164 nanoseconds per run.
vs. 1,160,000 per second. 863 nanoseconds per run.'
```Original idea by @tom95.
## Battery Indicator Morph and OpenMensa Morph
Both can be installed via:
```
Metacello new
baseline: 'Cmfcmf';
repository: 'github://cmfcmf/SqueakUtils:master';
load.
```### Battery Indicator
You can create your very own battery indicator morph using `CMFBatteryMorph new openInHand`.
The morph updates every two minutes.### OpenMensa Morph
I provide a custom morph that displays the daily meals from https://openmensa.org. To open it, execute `CMFMensaInfo open`.
## Windows FFI Utils
I provide methods for creating processes and pipes using FFI under Windows. To install just them, use:
```
Metacello new
baseline: 'Cmfcmf';
repository: 'github://cmfcmf/SqueakUtils:master';
load: #('winffi').
```
## Toolbuilder Extensions (broken in Squeak 5.3+)I provide a customized `PluggableMultiColumnListMorph` and spec. In contrast to the default implementation, it has gained the following enhancements:
- the list is filterable
- the items are indexed by row, not by columnTo install just them, use:
```
Metacello new
baseline: 'Cmfcmf';
repository: 'github://cmfcmf/SqueakUtils:master';
load: #('toolbuilder').
```