Skip to content

Instantly share code, notes, and snippets.

@nullcookies
Forked from sshkarupa/email_js.rb
Created January 10, 2020 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nullcookies/47bd36b8b7c4b9b24f8c64c0b3529eb9 to your computer and use it in GitHub Desktop.
Save nullcookies/47bd36b8b7c4b9b24f8c64c0b3529eb9 to your computer and use it in GitHub Desktop.
letters generator for email.js.slim
str = '<a href="mailto:#{ARGV[0]}">#{ARGV[0]}</a>'
# ARGV[0] = 'user@example.com'
# str = '<a href="mailto:user@example">user@example</a>'
original = str.split("")
new_arr = []
original.each_index {|i| new_mas << { i => original[i] } }
new_arr.shuffle!
letters = []
positions = []
new_arr.each { |i| letters << i.values[0]; positions << i.keys[0] }
print "var aixccwp = #{letters};"
puts ""
print "var fsklvjp = #{positions};"
puts ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment