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
330
Railsgirls: Where did my HTML and CSS go
bjelli
0
620
Berufe im World Wide Web
bjelli
0
270
Javascript Closures
bjelli
3
910
Teach (all the) Rails
bjelli
0
450
Other Decks in Programming
See All in Programming
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
380
Hono + Inertia + React で LP を構築した話
oukayuka
2
170
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
210
プロポーザルを書いてもらう
pvcresin
0
580
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
110
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.7k
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
390
引き算の組織 ― アウトカムとAIに全振りするために辞めたこと ― / Organization by Subtraction
hirokiyamamoto14
PRO
0
300
Flow は今どうなっているか
mizdra
PRO
0
720
ALB ログから Trace を気合で繋げる技術
fohte
5
580
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
360
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
440
Featured
See All Featured
Navigating Weather and Climate Data
rabernat
0
490
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Building AI with AI
inesmontani
PRO
1
1.2k
Ethics towards AI in product and experience design
skipperchong
2
350
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
620
Testing 201, or: Great Expectations
jmmastey
46
8.2k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
360
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
240
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Marketing to machines
jonoalderson
1
5.7k
Music & Morning Musume
bryan
47
7.3k
The agentic SEO stack - context over prompts
schlessera
0
880
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