Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ruby One-Liners
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.8k
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
150
JRuby: Past, Present, and Future
headius
0
220
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
390
パーソナライズPodcastを作った話
repunit11
0
130
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
320
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
800
AIに “答え“を書かせるのを やめてみた
___akari11
0
110
Verilogで学ぶCPU自作入門
uyuki234
8
4k
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
110
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.6k
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
350
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
300
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
730
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
580
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.9k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
350
A Tale of Four Properties
chriscoyier
163
24k
A better future with KSS
kneath
240
18k
GraphQLとの向き合い方2022年版
quramy
50
15k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
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