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
bjelli
March 23, 2012
Programming
340
1
Share
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
590
Berufe im World Wide Web
bjelli
0
260
Javascript Closures
bjelli
3
900
Teach (all the) Rails
bjelli
0
450
Other Decks in Programming
See All in Programming
t *testing.T は どこからやってくるの?
otakakot
1
800
How We Benchmarked Quarkus: Patterns and anti-patterns
hollycummins
1
160
AI-DLC Deep Dive
yuukiyo
9
4.9k
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
500
AIと共に生きる技術選定 2026
sgash708
0
110
ふりがな Deep Dive try! Swift Tokyo 2026
watura
0
250
実用!Hono RPC2026
yodaka
2
280
Swift Concurrency Type System
inamiy
1
560
JOAI2026 1st solution - heron0519 -
heron0519
0
150
UIの境界線をデザインする | React Tokyo #15 メイントーク
sasagar
2
400
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
890
PHP で mp3 プレイヤーを実装しよう
m3m0r7
PRO
0
290
Featured
See All Featured
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
770
Color Theory Basics | Prateek | Gurzu
gurzu
0
300
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
160
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
280
Un-Boring Meetings
codingconduct
0
280
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.9k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
110k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
170
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
210
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
170
Heart Work Chapter 1 - Part 1
lfama
PRO
6
35k
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