Skip to content

Instantly share code, notes, and snippets.

View alexyoung's full-sized avatar
💤

Alex Young alexyoung

💤
View GitHub Profile
alex@mog ~$ figlet HE COMES | zalgo
̵͖͗̎̉͛_̤̙̜̓͐̌͢ ̢̹ͣ̃͘ ̣̯̤̣̩͕̉ͥ͌̑̚ ̨̲̹͔͕͇̄̋͊̄͋͘ͅ_̬̤̭͖͇̭ͦ ͖̗͙̖ͯ̅̊͂̾ͣ_̡̧̞̼̭̈̑͆̈_̘͈̙̆̊̂ͦ̔̋̎̒_̷̹͍̫̥̺ͣ̆͝_͎̟̮͎͎͂̄̓ͫͯ̃ͯ̈̀_̹̭͙̓ͩ̏̆ͫ͝ͅ ̭ͧ̃̎̔̏͒ ̧̛̻̘̟̣̟̋̏ ̛̝̮̑͆̍ͩͩ́̊ͥ ̙̣͎̭̳̝͎ͧ͆ͤ͂ͤͮ̃͒_̳̖̟͍̼́̍̌ͭ̔̇̈̚_̵͍͓͖ͪ͜_̰̤̎̒̈ͤͬͯ͛ͣ_̦̺̭͗͋̿͐ͣ̔͝ ̛͖̲͎̜͔̗͙̆͊͂̈͂ͮ_̨͍̖̄͆́ͧͫͅ_̭̗̼͕̹̱ͧ̓ͧ_ͪͭ̑͏̙͖̝͍̟ͅͅ ̡̗̬̹͈͓̜̟̌̍̌̊̆͐̍̚͟ ͖̳͈̳̳ͨ̆̓̿ͦͯ̅͜_̶͉̜̟̈_̡̻̳̠̤͖̲̤ͪͤͅ ̶̧̦̬̝̤̖̌͑ͣͩ̑ ̶̮̙͖̞̪͚̱ͪͨ̕_̠̯ͮ̃̑̽́̒̑͂_͈̯̟̘̌ͨ̋̓̏̇ ͎͕ͯ̌ͯͨͩ̄̚_̻͚͔́̑͋̀̾ͬ̅͂͠_̝ͤ̊̄_̩̰ͮ̾̉̿_̷̗̲̦̹̆̇̊_͗̎ͩ̇̆ͨͦ̓҉_̮͜ ̶̣̬͉̭̺̩̪̈̊̑̍̚͘_̸̣̫̠̥̟̺̠̃ͮͥͭ́̇͐_̟̰̮͕̻͔̭ͥ̋̿͠͠_̸̙̭͒ͩ̇̌̊̑ͤ_͖̥̰͎̼̣̼̉̃̌ͬͩ̐ͨ̔ͅ ̴̠̙̹ͣ̐ͅͅ ̮ͯͫ͛
̶͇̼͍̞͙ͨͯ̓̐̽̄|̮̼̞̉̓͟͜ ̸͖͖̠̿͢|̰͎̳͓ͬ̅͆ͪ͞ ̠͔̺̥̰̍̾̾͑ͣ̿̚|̢̰̼̝͓͇͙͙ͩ̀ͥͯ͌̇̄̀̚ ̪̖͛̃̑́|̭̱̬̫̳͛̄ͥ͋ͮͬͩ̌́͜ ͍̮̳̫͎̼͉͆̔̍͑̓_͙͎̹͙͕̝̙͓̂̉͜_̥͉̤̦͑͟_̷̩̗̗̪͔̥̥̹ͨ̈͒ͩ͝_̱͋͌̎ͨ̓ͥ̚͘|͚̞̼͎̩̝̣ͩͮͩͬ̿ͮ ̨͎̻͕̼̦̀ͣ̍ ̴̴̰̘̜͈̥͓̖̞̈̄̂̾͌ͨ/͎̹̠̯̜̽̐̉̋ͮ̏̕͜ ̷͈̅̿ͬ̋͋̈͝_͓̩͚̙͈͔́̏̇͌_̵̻̼̻͍͗̏̚͟_͍̐̋̄͡/̵̏̔ͅ ̇ͣ̉̊̾͏̹̯̘̗_̹̥̳̐ͦ ̷͓̝̮̳̇̈̇̏͜\̴͓̞̤̖ͯͦ̀͋̓̈͑͡|̷͕͇͔͚ͨ̉̒̋͡ ̡͍̏̐ ̮ͮ̓̄͐ͭ͘\͔͔̟͚̝̬̱̍̈̇ͪ̈̊̌͘͢/̷̻̳̩̑ͫ̐̔ͣ̏͐͞ ̨͕̳̣͍̝̮͓͕͂̈̿́ͩ̕ ̶͖͖̦̤̬̟̪̣͂͛ͬ̓̓̎̓|͉͇̏̄͐̽͊̃͌͡ ̷̭ͯͥͨ̽̐ͨ͂̚_͂͛̌̾̇͗͋̚҉_̜̼̥̬̝̰̹̩_̥͉̊͌ͅ_̵̻ͫ̋ͬ̑̔̉̈̂̕_̤̞̖͓̲̝̼̦͑/͕̫͈̖͓̞̈ ̧̫̘͔̫͈͙ͦ̈ͤ̂͡_͙̄ͬ̿_̖̬̝̯̖̦̽̀_̗̲͙͉̰̰̾̿

Unobtrusive JavaScript — (subtitle: Making Events Your Bitch)

I was surprised to hear that unobtrusive JavaScript is perhaps a “Kool-Aid” phenomenon. This surprised me because I haven’t really thought about inline JavaScript for a while.

It depends how much inline code you write of course; the odd onclick here and there isn’t a big deal. It’s not really a question of being “strict” though, it’s a question of really feeling comfortable with event handling, and how to organise JavaScript effectively.

If you look at my projects, there is some inline JavaScript. Some of this comes from Rails helpers, assorted ugly hacks that I should replace, or the fact I’ve been building these things for a long time. I’m simply describing the way I work now.

How I Look at a Web Page

#,
###
## ##
## ##
####
:
#####
def reload!
puts 'Reloading Files'
Gem.clear_paths
spec = Gem.searcher.find('jschat/server')
load File.join(spec.full_gem_path, 'lib', 'jschat', 'server.rb')
load File.join(spec.full_gem_path, 'lib', 'jschat', 'server_options.rb')
end
trap 'SIGHUP', lambda { reload! }
require 'formula'
class Cowsay <Formula
url 'http://www.nog.net/~tony/warez/cowsay-3.03.tar.gz'
homepage ''
md5 ''
def install
system "./install.sh #{prefix}"
end
require 'rubygems'
require 'open-uri'
require 'hpricot'
require 'timeout'
TIMEOUT = 5
TOTAL_BYTES = 1024 * 10
def get_page_head(url)
html = nil
#!/usr/bin/env ruby
# Run 'gem install eventmachine' (with sudo if required) if your computer doesn't have it
# gem might also be gem1.8 if you got it from Debian/ubuntu
require 'rubygems'
require 'eventmachine'
require 'json'
ROOM = '#jschat'
PORT = 6789
#!/usr/bin/env ruby
CONFIG = {
:ip_address => 'x.x.x.x'
}
module NetworkSimulator
COMMANDS = %w(slow stop reset show)
class << self
prstat -s cpu -n 5
#!/usr/bin/env ruby
100.times do |file_id|
file_name = "header_file_#{file_id}"
puts "Saving headers to #{file_name}"
result = `curl -D #{file_name} -H 'Accept: application/xml' -H 'Content-Type: application/xml' -d '
<request>
<authentication>
<email>alex@helicoid.net</email>
<password>xxx</password>