Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby One-Liners
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
bjelli
March 23, 2012
Programming
350
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ruby One-Liners
A lightning talk at Salzburg Barcamp "The Next Web" in March 2012.
bjelli
March 23, 2012
More Decks by bjelli
See All by bjelli
Intro to Web- and Mobile-Developement
bjelli
0
320
Railsgirls: Where did my HTML and CSS go
bjelli
0
600
Berufe im World Wide Web
bjelli
0
270
Javascript Closures
bjelli
3
900
Teach (all the) Rails
bjelli
0
450
Other Decks in Programming
See All in Programming
Lessons from Spec-Driven Development
simas
PRO
0
170
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
3.6k
jQueryをバージョンアップする前に使いたいjQuery Migrate
matsuo_atsushi
0
200
RTSPクライアントを自作してみた話
simotin13
0
520
A2UI という光を覗いてみる
satohjohn
1
130
CSC307 Lecture 17
javiergs
PRO
0
320
Oxcを導入して開発体験が向上した話
yug1224
4
300
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
5
3.9k
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
320
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
2k
LLM Plugin for Node-REDの利用方法と開発について
404background
0
170
AIで効率化できた業務・日常
ochtum
0
120
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
210
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
200
Optimizing for Happiness
mojombo
378
71k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
330
Game over? The fight for quality and originality in the time of robots
wayneb77
1
190
30 Presentation Tips
portentint
PRO
1
320
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
200
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
The SEO identity crisis: Don't let AI make you average
varn
0
490
Transcript
Ruby One-Liner
mit -e Programmcode angeben ruby -e ' puts "hello" '
ruby -e 'puts "Hello"' mit -e Programm angeben
ruby -e 'puts 24 * 60 * 60 ' mein
Taschenrechner
ruby -p -e '' langer.txt -p print-schleife über datei
ruby -p -e 'puts' langer.txt leerzeile nach jeder zeile
ruby -p -e 'puts $_.length' langer.txt $_ enthält die Zeile
ruby -p -e 'puts "#{$.}.Zeile hat länge #{$_.length} " '
langer.txt $. enthält die Zeilennummer
Korrektur • es geht nicht um Zeilen • sondern um
"Records" • default: Record-Separator ist "\n" • deswegen wird zeilenweise gelesen • Der Separator ist in der Variable $/
ruby -00 -p -e 'puts "#{$.}.Absatz hat länge #{$_.length} "
' l.txt -00 verwende doppelten separator Absatz statt Zeile
ruby -p -e 'puts "."' index.html -n schleif, nicht ausgeben
ruby -n -e 'puts if /Schokolade/' index.html Finden grep
ruby -p -e 'gsub(/Game/, "Web")' index.html Ersetzen
ruby -i.bak -p -e 'gsub(/Game/, "Web")' index.html Ersetzen in der
Datei neu in index.html, alt in index.html.bak
ruby -i.bak -p -e 'gsub(/Game/, "Web")' *.html Ersetzen in vielen
Dateien
ruby command line switches + ruby one-liners + unix |
Learn More