This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop | |
class Player | |
attr_accessor :health, :x, :y, :width, :height | |
def initialize(args = {}) | |
args.each_pair {|k, v| send "#{k}=", v} | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop | |
class Player | |
attr_accessor :health, :x, :y, :width, :height | |
def initialize(args = {}) | |
args.each_pair {|k, v| send "#{k}=", v} | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Attempt1 | |
require 'rubygems' | |
Gem.clear_paths | |
ENV['GEM_HOME'] = `echo $GEM_HOME` | |
ENV['GEM_PATH'] = `echo $GEM_PATH` | |
require 'awesome_print' | |
class Array | |
def random | |
self[rand length] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-p180 :001 > require 'Date' | |
=> true | |
# The date parses as it should. | |
ruby-1.9.2-p180 :002 > Date.parse '1/2/1903' | |
=> #<Date: 1903-02-01 (4832293/2,0,2299161)> | |
# Requiring the CSV stdlib causes a whole mess of conflicts with Date. | |
ruby-1.9.2-p180 :003 > require 'csv' | |
/Users/michaeltomer/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/date.rb:236: warning: already initialized constant MONTHNAMES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is shamelessly copied from http://stackoverflow.com/questions/263743/how-to-get-cursor-position-in-textarea#answer-3373056 | |
function getInputSelection(el) { | |
var start = 0, end = 0, normalizedValue, range, textInputRange, len, endRange; | |
if (typeof el.selectionStart == "number" && typeof el.selectionEnd == "number") { | |
start = el.selectionStart; | |
end = el.selectionEnd; | |
} | |
else { | |
range = document.selection.createRange(); | |
if (range && range.parentElement() == el) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('input[type=submit]').each(function(i, eo) { | |
var btn, cls, elem, icon, text; | |
elem = $(eo); | |
text = elem.attr('value'); | |
cls = elem.attr('class'); | |
if (/icon_(.+)/i.test(cls)) { | |
icon = cls.replace(/^icon_/, ''); | |
elem.after(("<a href='javascript:void(0)' class='button'><img alt='icon' class='icon' src='/images/icons/" + (icon) + ".png' />" + (text) + "</a>")); | |
btn = elem.next(); | |
btn.click(function(b) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('input[type=submit]').each (i, eo) -> | |
elem = $(eo) | |
text = elem.attr 'value' | |
cls = elem.attr('class') | |
if /icon_(.+)/i.test(cls) | |
icon = cls.replace(/^icon_/, '') | |
elem.after "<a href='javascript:void(0)' class='button'><img alt='icon' class='icon' src='/images/icons/#{icon}.png' />#{text}</a>" | |
btn = elem.next() | |
btn.click (b) -> | |
elem.click() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'mongo' | |
def rand_string(ary, len = 16) | |
r = [] | |
len.times {r << ary[rand ary.length]} | |
r.join("") | |
end | |
class PeriodicUpdater |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'metaid' | |
class Video | |
attr_reader :unreachable | |
def initialize | |
@unreachable = 'cant read this' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def aireplay(essid,iface) | |
system("aireplay-ng -3 -e #{essid} #{iface}") | |
end | |
def airmon(iface,channel) | |
system ("airmon-ng start #{iface} #{channel}") | |
end | |
def airodump(iface) | |
system("airodump-ng --ivs #{iface}") |