Skip to content

Instantly share code, notes, and snippets.

@johnnyt
johnnyt / generator.rb
Created June 24, 2015 16:47
URUG 2015-06-23 Trigram Kata - check out: github.com/urug/trigram_kata
module Generator
def self.generate(trigram, prompt, size)
content = prompt.split(' ')
while content.length < size
new_word = trigram.get content[-2..-1].join(' ')
content << new_word
end
content.join(' ')
property menubar_height : 22
property fuzzy_limit : 10 -- number of pixels that the top and bottom could be off by
property unmaximized_window_bounds : {200, 100, 1200, 700} -- size that the unmaximized window should be (it will be places on its current monitor)
property apps_with_wacky_coords : {"Dragon's Lair"}
property apps_without_title_bars : {}
property apps_with_double_title_height : {"Finder", "Thunderbird"}
property not_working_apps : {"Thunderbird"}
global window_is_on_primary_monitor
set window_is_on_primary_monitor to true
property apps_to_maximize : {"MacVim", "iTunes", "Dragon's Lair"}
property menubar_height : 22
property fuzzy_limit : 10 -- number of pixels that the top and bottom could be off by
property unmaximized_window_bounds : {200, 100, 1200, 700} -- size that the unmaximized window should be (it will be placed on its current monitor)
property apps_with_wacky_coords : {"Dragon's Lair", "PivotalTracker"}
property apps_without_title_bars : {"Dragon's Lair", "PivotalTracker"}
property apps_bounds_to_secondary_monitor : {"Dragon's Lair"}
-- We now move ALL apps to primary monitor (except what is listed above)
@johnnyt
johnnyt / gist:1041869
Created June 23, 2011 03:55
Squeak setup
Installer squeakmap update.
#(
'JSON'
'Sport'
'Shout'
'ShoutMonticello'
'ShoutWorkspace'
'HTML-Parser'
loadAmber({
files: ['TrySmalltalk.js'],
prefix: 'examples/trysmalltalk/js',
ready: function() {
smalltalk.Browser._openOn_(smalltalk.ProfStef)
smalltalk.TrySmalltalkWidget._open();
}});
@johnnyt
johnnyt / gist:1854660
Created February 17, 2012 18:04
Amber Smalltalk WebServer - runs on top of node.js
Smalltalk current createPackage: 'Amber-Node' properties: #{}!
Object subclass: #WebServer
instanceVariableNames: 'port app dirname faye app express bayeux fs assets'
category: 'Amber-Node'!
!WebServer methodsFor: 'initialization'!
initialize
super initialize.
<self['@dirname'] = __dirname>.
@johnnyt
johnnyt / gist:3308755
Created August 9, 2012 22:47
MagLev and Big Data

MagLev is a Ruby implementation than runs on top of the GemStone/S Smalltalk VM. It can transparently manage a large amount (terabytes) of data and has a scalable built-in model for parallelism across VMs. Since all connected VMs see the same objects, it can have thousands of truly parallel threads running in a single, shared, transactional object space.

MagLev isn't a Ruby VM with an integrated NoSQL database, it's a pure object database that uses Ruby for its data manipulation language.

This session will show examples of MagLev specific collections (e.g. IdentitySet), indexes (including multi-level indexes like @address.@zip.@average_income) and benchmarks comparing MagLev with other NoSQL databases.

You will see how MagLev lets you have fun when working with Big Data by:

  • Avoiding the cruft, complexity and compromises that arise from the 'Object Relational Impedance Mismatch' (thanks Smalltalk!)
  • Working with and manipul
@johnnyt
johnnyt / setup.sh
Created January 21, 2013 20:55
Setup Linux Mint
sudo sh -c 'sudo add-apt-repository -y ppa:pitti/postgresql \
&& add-apt-repository -y ppa:webupd8team/sublime-text-2 \
&& apt-get update \
&& apt-get install -y linux-headers-generic linux-firmware-nonfree \
sublime-text chromium-browser \
autoconf automake bison build-essential curl git libtool openssl pkg-config sqlite3 subversion \
libc6-dev libncurses5-dev libsqlite3-dev libreadline6-dev libssl-dev libxml2-dev libxslt1-dev libyaml-dev libzmq-dev zlib1g-dev \
python-setuptools dkms pgadmin3 \
htop nethogs iotop tmux vim-nox zsh psmisc quicksynergy grc \
@johnnyt
johnnyt / HTML5.js
Created April 3, 2013 21:38
HTML5 package for Amber Smalltalk
smalltalk.addPackage('HTML5', {});
smalltalk.addClass('LocalStorage', smalltalk.Object, ['scope'], 'HTML5');
smalltalk.LocalStorage.comment=unescape('LocalStorage%20is%20a%20wrapper%20around%20HTML5%20Local%20Storage.%0ATake%20a%20look%20at%3A%20http%3A//diveintohtml5.org/storage.html%0A%0AExample%0A%0A%09%7C%20local%20%7C%0A%09local%20%3A%3D%20LocalStorage%20new.%0A%09local%20at%3A%20%27message%27%20put%3A%20%27Hello%20World%21%27.%0A%09Transcript%20show%3A%20%28local%20at%3A%20%27message%27%29%3B%20cr.')
smalltalk.addMethod(
unescape('_keys'),
smalltalk.method({
selector: unescape('keys'),
category: 'accessing',
fn: function (){
var self=this;
Smalltalk current createPackage: 'HTML5' properties: #{}!
Object subclass: #LocalStorage
instanceVariableNames: 'scope'
category: 'HTML5'!
!LocalStorage commentStamp!
LocalStorage is a wrapper around HTML5 Local Storage.
Take a look at: http://diveintohtml5.org/storage.html
Example