This file contains 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
# Uses built in ruby functions to handle conversions etc | |
# Create 10 IPs | |
for ips in 1...10 | |
ip = "" | |
#generate a random segment for each IP part (4 parts for each IP) | |
for segment in 1...4 | |
ip += rand(255).to_s(16).upcase | |
end | |
puts ip | |
end |
This file contains 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
# Generate 15 random IPs and convert them to Hexadecimal format, | |
# avoiding Ruby's built in conversion functions | |
# | |
# CSCI370 Assignment 1 | |
# | |
# @author dgalarza (Damian Galarza) | |
# Create an array to represent hexadecimal numbers | |
@hexNumbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'] |
This file contains 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
// allows you to log an object while staying in the chain | |
(function($){ | |
var console = ("console" in window) ? window.console : { "log": alert, "dir": alert }; | |
$.extend($.fn, { | |
log: function(){ | |
console.log(this); | |
return this; | |
}, |
This file contains 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
describe Notifications, :type => :helper do #setting type is necessary | |
before(:each) do | |
ActionMailer::Base.delivery_method = :test | |
ActionMailer::Base.perform_deliveries = true | |
ActionMailer::Base.deliveries = [] | |
end | |
it “should sent a nice email with the analyses to the user” do | |
analysis_observer = AnalysisObserver.instance |
This file contains 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
Rails.application.config.middleware.insert_before( | |
ActionDispatch::Session::CookieStore, | |
FlashSessionCookieMiddleware, | |
Rails.application.config.session_options[:key] | |
) |
This file contains 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
function fetchGuildDkp ($filter = NULL) { | |
$filter = $this->db->escape_str($filter); | |
$guild = 'SELECT char_name,char_class,crucApplications.user_id, attendance,sum(transaction_value)AS AvailDkp,round((count(DISTINCT dkp_raids.raid_id)/(SELECT count(raid_id) FROM dkp_raids WHERE raid_date >= join_date)*100))AS RaidAttend,round((count(DISTINCT dkp_raids.raid_id)/(SELECT count(raid_id) FROM dkp_raids)*100))AS OverallAttend, PastMonth.MonthAttend | |
FROM crucApplications | |
LEFT JOIN dkp_naxx_attend ON crucApplications.user_id = dkp_naxx_attend.user_id | |
LEFT JOIN dkp_transactions ON crucApplications.user_id = dkp_transactions.user_id | |
LEFT JOIN dkp_events ON dkp_transactions.event_id = dkp_events.event_id | |
LEFT JOIN dkp_raids ON dkp_events.raid_id = dkp_raids.raid_id | |
LEFT JOIN( |
This file contains 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
## /config/initializers/dynamic_job.rb | |
require 'heroku' | |
# base class for all jobs that you wish to automatically scale and go down in Heroku | |
class DynamicJob | |
#set a cap on maximum number of users ever - just in case. | |
MAX_CONCURRENT_WORKERS = 100 | |
def initialize |
This file contains 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
/** | |
* Takes an RGB object and converts it into a hex string | |
* | |
* @param {Object} RGB Colors {r:255, g:255, b:255} | |
*/ | |
var rgbToHex = function(rgb) { | |
var hex = rgb.b | (rgb.g << 8) | (rgb.r << 16); | |
return hex.toString(16); // 'FFFFFF' | |
}; |
This file contains 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
# Base class that all WoW Armory based resources will inherit from | |
class ArmoryModel | |
include Mongoid::Document | |
field :last_armory_update, :type => Date | |
end | |
class UserCharacter < ArmoryModel | |
end |
OlderNewer