Skip to content

Instantly share code, notes, and snippets.

newacct

Block or report user

Report or block newacct

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rfc4231.js
var crypto = require("crypto"),
assert = require("assert");
var hexstr2bytearray = function(str) {
var bytestrs = [];
for(var i=0;i<str.length;i+=2) {
bytestrs.push(parseInt(str.substr(i,2), 16));
}
return bytestrs;
}
View Colour Shade
def colour_shade(colour,shade,scale=10)
# default the scale to 100 if it is greater...
scale = 100 if scale > 100
# if the shade is out of the range of scale then reset shade to scale...
if shade > 0
shade = scale if shade > scale
else
shade = scale * -1 if shade < scale * -1
end
View find_mac.rb
require "rubygems"
require "snmp"
mac = ARGV.shift.dup
unless mac.gsub! /^(..)[-: ]?(..)[-: ]?(..)[-: ]?(..)[-: ]?(..)[-: ]?(..)[-: ]?$/, '\1 \2 \3 \4 \5 \6'
puts "illegal mac"
exit
end
mac = mac.split(" ").collect { |x| x.hex }.join "."
View cucumber-no-eval.rb
Then /^I should be editing "([^\"]*)"$/ do |login|
URI.parse(current_url).path.should == edit_user_path(User.find_by_login(login))
end
Then /^I should be viewing "([^\"]*)"$/ do |login|
URI.parse(current_url).path.should == user_path(User.find_by_login(login))
end
You can’t perform that action at this time.