This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ZnServer startDefaultOn: 1701) | |
onRequestRespond: [ :request | | |
ZnResponse ok: (ZnEntity text: 'Hello World!') ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ :s | Transcript show: s; show: s printString ] value: '[ :s | Transcript show: s; show: s printString ] value: ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderChartOn: html | |
| graphId graph | | |
graphId := html nextId. | |
html div class: 'chart'; id: graphId. | |
graph := Rickshaw graph element: graphId. | |
graph width: 300. | |
graph height: 200. | |
graph addSerieNamed: 'Demo' color: 'steelblue' elements: { 0 @ 40. 1 @ 49. 2 @ 38. 3 @ 30. 4 @ 32 }. | |
html document addLoadScript: graph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir marina | |
cd marina | |
wget "https://ci.inria.fr/pharo-contribution/job/marina/PHARO=30,VERSION=development,VM=vm/lastSuccessfulBuild/artifact/Marina.zip" | |
wget -O- get.pharo.org/vm | bash | |
git clone https://github.com/tide-framework/marina.git | |
cd marina | |
git submodule init | |
git submodule update | |
bower install | |
cd tide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ivName := 'anIVNameImPrettySureNobodyUses'. | |
all := Smalltalk allClasses flatCollect: [ :e | { e . e class } ]. | |
candidates := all reject: [ :e | e superclass isNil or: [e layout slotScope isKindOf: LayoutEmptyScope ] ]. | |
toRebuild := candidates reject: [ :e | e superclass layout slotScope == e layout slotScope parentScope ]. | |
toRebuild do: [ :e | e addInstVarNamed: ivName ]. | |
toRebuild do: [ :e | | |
(e isClassSide |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"http://instagram-engineering.tumblr.com/post/10853187575/sharding-ids-at-instagram" | |
| epoch generator ids runLength shardId seqId| | |
epoch := '01-01-2014' asDateAndTime asUnixTime. "1388545200" | |
generator := [:seed1 :seed2 | | |
| id | | |
id := (DateAndTime now asUnixTime - epoch) bitShift: 64-41. | |
id := id bitOr: (seed1 bitShift: (64-41-13)). | |
id := id bitOr: seed2 ]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Get client at http://smalltalkhub.com/#!/~NorbertHartl/Mandrill" | |
"Set the api key only once." | |
MandrillClient apiKey: 'yourApiKeyGoesHere'. | |
(MandrillMessage new | |
addRecipient: (MandrillRecipient new email: 'alice@there.com'); | |
fromName: 'Bob'; | |
fromEmail: 'bob@yourdomain.com'; | |
subject: 'Sending mails from Pharo'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Compares the parse speed of three different JSON parsers." | |
{'file1.json'. 'file2.json'. 'file3.json' } do: [ :filename | | |
jsonString := fileName asFileReference contents. | |
Transcript cr; show: jsonString size printString, 'bytes JSON:'; cr. | |
Transcript show: 'NeoJSON: '; show: [ NeoJSONReader fromString: jsonString] bench; cr. | |
Transcript show: 'JSON: '; show: [Json readFrom: jsonString readStream ] bench; cr. | |
Transcript show: 'WAJsonParser: '; show: [WAJsonParser parse: jsonString] bench; cr. | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gofer it | |
smalltalkhubUser: 'estebanlm' project: 'IconsForPharo'; | |
package: 'Polymorph-Icons-Idea'; | |
load. | |
ThemeIcons current: IdeaUIThemeIcons new. | |
AbstractNautilusUI resetIconCaches. | |
"(you will need to reopen all your windows)" | |
"The coolness of this icons set is that they work very fine with Dark Theme too :)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: bitcoin | |
# Required-Start: $local_fs $network $named $time $syslog | |
# Required-Stop: $local_fs $network $named $time $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Description: Bitcoin Fullnode | |
### END INIT INFO |
OlderNewer