Skip to content

Instantly share code, notes, and snippets.

@jpoz
Created September 29, 2009 16:38
Show Gist options
  • Select an option

  • Save jpoz/197001 to your computer and use it in GitHub Desktop.

Select an option

Save jpoz/197001 to your computer and use it in GitHub Desktop.
class String
def to_leet(random=false)
leet_alphabet = { :a => %w{ @ 4 /\ /-\ ^ aye ∂ ci λ Z},
:b => %w{ ß 6 8 13 I3 |3 P> |: !3 (3 /3 )3 ]3},
:c => %w{ ( ¢ < ©},
:d => %w{ [) |) |o ∂ ]) I> |> T) 0 ð cl},
:e => %w{ 3 & € £ ë [- |=-},
:f => %w{ |= ]= ph \} (= I=},
:g => %w{ 6 & (_+ 9 C- gee (γ, (_- cj},
:h => %w{ |-| /-/ [-] ]-[ )-( (-) :-: |~| ]~[ },
:i => %w{ : ¡ 1 ! | eye 3y3 ai ][ ]},
:j => %w{ ʝ _| _/ ] ¿ </ (/},
:k => ['ɮ','|X', '|<', '|{'],
:l => %w{ 1 £ 1_ | |_ lJ},
:m => %w{ ^^ |v| em ]V[ (T) [V] nn //\\//\\ |\/| /\/\ (u) (V) (\/) /|\ /|/| //. .\\ /^^\ /V\ []\/[] |^^| },
:n => ['₪','|\|','^/','/\/','[\]','<\>','{\}','[]\\', '//','[]','/V','[]\[]',']\[','~'],
:o => %w{ 0 () oh [] p ¤ Ω},
:p => %w{ ¶ |* |o |º |^(o) |> |" 9 []D |̊ |7 q þ ℗},
:q => %w{ (_,) ()_ 0_ <| 9 O,},
:r => %w{ Я 2 12 |? /2 I2 |^ |~ lz ® |2 [z |` l2 |2 ʁ},
:s => %w{ $ 5 z § ehs es},
:t => %w{ 7 † + -|- 1 '|'},
:u => %w{ µ M |_| Y3W L|},
:v => %w{ √ \/ \\//},
:w => %w{ Ш \/\/ vv '// \\' \^/ (n) \V/ \X/ \|/ \_|_/ \\//\\// \_:_/ (/\) ]I[ LL1 UU ɰ},
:x => ['%','Ж','><','\}{','ecks',')(','ex'],
:y => %w{Ψ `/ `( -/ φ λ Ч ¥},
:z => %w{2 ~/_ % >_ ʒ 7_} }
self.split("").inject("") do |s, ch|
if ch.match(/\w/)
random ? s << leet_alphabet[ch.to_sym][rand(leet_alphabet[ch.to_sym].size)] : s << leet_alphabet[ch.to_sym][0]
else
s << ch
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment