Skip to content

Instantly share code, notes, and snippets.

View actsasbuffoon's full-sized avatar

Michael Tomer actsasbuffoon

  • Corista
  • Boston, MA
View GitHub Profile
/Users/michaeltomer/Sites/Patient361/vendor/plugins/formtastic/lib/formtastic.rb:1280:in `send'
/Users/michaeltomer/Sites/Patient361/vendor/plugins/formtastic/lib/formtastic.rb:1280:in `default_input_type'
/Users/michaeltomer/Sites/Patient361/vendor/plugins/formtastic/lib/formtastic.rb:79:in `input'
/Users/michaeltomer/Sites/Patient361/app/views/notifications/_inputs.html.haml:2
/Users/michaeltomer/Sites/Patient361/vendor/gems/haml-2.2.14/lib/haml/helpers.rb:322:in `call'
/Users/michaeltomer/Sites/Patient361/vendor/gems/haml-2.2.14/lib/haml/helpers.rb:322:in `capture_haml'
/Users/michaeltomer/Sites/Patient361/vendor/gems/haml-2.2.14/lib/haml/helpers.rb:523:in `with_haml_buffer'
/Users/michaeltomer/Sites/Patient361/vendor/gems/haml-2.2.14/lib/haml/helpers.rb:318:in `capture_haml'
/Users/michaeltomer/Sites/Patient361/vendor/plugins/formtastic/lib/formtastic.rb:1202:in `field_set_and_list_wrapping'
/Users/michaeltomer/Sites/Patient361/vendor/plugins/formtastic/lib/formtastic.rb:258:in `inputs'
/Users/michaeltomer/.rvm/gems/ruby-1.8.7-p249/gems/formtastic-0.9.8/lib/formtastic.rb:1345:in `send'
/Users/michaeltomer/.rvm/gems/ruby-1.8.7-p249/gems/formtastic-0.9.8/lib/formtastic.rb:1345:in `default_input_type'
/Users/michaeltomer/.rvm/gems/ruby-1.8.7-p249/gems/formtastic-0.9.8/lib/formtastic.rb:87:in `input'
/Users/michaeltomer/Sites/Patient361/app/views/notifications/_inputs.html.haml:2
/Users/michaeltomer/Sites/Patient361/vendor/gems/haml-2.2.14/lib/haml/helpers.rb:322:in `call'
/Users/michaeltomer/Sites/Patient361/vendor/gems/haml-2.2.14/lib/haml/helpers.rb:322:in `capture_haml'
/Users/michaeltomer/Sites/Patient361/vendor/gems/haml-2.2.14/lib/haml/helpers.rb:523:in `with_haml_buffer'
/Users/michaeltomer/Sites/Patient361/vendor/gems/haml-2.2.14/lib/haml/helpers.rb:318:in `capture_haml'
/Users/michaeltomer/.rvm/gems/ruby-1.8.7-p249/gems/formtastic-0.9.8/lib/formtastic.rb:1267:in `field_set_and_list_wrapping'
/Users/michaeltomer/.rvm/gems/ruby-1.8.7-p249/gems/formtastic-0.9.8/lib/formtastic.rb:266:in `i
ruby-1.8.7-p249 > u1 = User.first(:username => "mtomer")
=> #<User username: "mtomer", _id: $oid4b4df1f6af64e72ac6000001, master_user_id: nil>
ruby-1.8.7-p249 > u2 = User.first(:username => "mtomer2")
=> #<User username: "mtomer2", _id: $oid4b869089af64e75e58000003, master_user_id: $oid4b4df1f6af64e72ac6000001>
ruby-1.8.7-p249 > u1._id.class
=> BSON::ObjectID
ruby-1.8.7-p249 > u2.master_user_id.class
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}")
require 'rubygems'
require 'metaid'
class Video
attr_reader :unreachable
def initialize
@unreachable = 'cant read this'
end
require 'rubygems'
require 'mongo'
def rand_string(ary, len = 16)
r = []
len.times {r << ary[rand ary.length]}
r.join("")
end
class PeriodicUpdater
$('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()
$('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) {
@actsasbuffoon
actsasbuffoon / simple_editor.js
Created January 31, 2011 20:25
A very simple jQuery based textarea editor
// 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) {
@actsasbuffoon
actsasbuffoon / csv_date_irb.rb
Created March 19, 2011 17:24
A strange issue with Date and the CSV stdlib.
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