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 index | |
@bugs = nil | |
if request.post? | |
mappings = Hash.new{|k,v|v} | |
allowed_user_attrib = [:company_name, :name] | |
allowed_bug_attrib = [:submitter] | |
user_attrib = params[:user].reject{|k,v| ! allowed_user_attrib.include?(k)} |
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
<h1>Index:</h1> | |
<% form_tag :action => "index" do %> | |
<fieldset> | |
<legend>Enter Search Criteria</legend> | |
<div> | |
<label for="Company">Company Name:</label> | |
<%= collection_select( :user, :company_name, User.all, | |
:company_name, :company_name, options = {:prompt => "-Select a Company"}) %> |
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
<!--- RENDERED PARTIAL > | |
<tr> | |
<td><%=h bug.user.company_name %> </td> | |
<td>Submitted by <%=h bug.submitter %></td> | |
<td><%=h bug.subject %> </td> | |
<td> <%=h truncate(bug.description.gsub(/<.*?>/,''), :length => 80) %> </td> | |
<td> <%= link_to 'Show', bug %> </td> | |
<% if session[:admin] %> | |
<td> <%= link_to 'Edit', edit_bug_path(bug)%> </td> |
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
class Node | |
#sigmoid and derivitive of sigmoid. Might be useful | |
def self.sigmoid(num) | |
1.0 / (1 + Math.exp(-num) ) | |
end | |
def self.sigderiv(num) | |
return (Math.exp(-num) ) / ( (Math.exp(-num) + 1)**2) | |
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
infile = ARGV[0] | |
@gridsize = ARGV[1].to_i | |
@world = Array.new(@gridsize+2){|i| Array.new(@gridsize+2){"."}} | |
File.open(infile, "r") do |f| | |
(1..@gridsize).each do |i| | |
row = f.gets | |
rowarr = row.split(" ") |
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
//attempts to add the given request together, fulfilling all prefs. | |
//if ALL preferences cannot be fulfilled, no change is made and method returns false | |
public boolean add_with_prefs(String[] reqs) | |
{ | |
String[][] tokend = new String[reqs.length][]; | |
//tokenize reqs | |
for(int i = 0; i < reqs.length;i++) | |
{ | |
tokend[i] = reqs[i].split("/"); |
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
puts "Welcome to uber-calculator" | |
puts "Please enter commands in the format:" | |
puts "\tX op Y" | |
puts "Prefix 0x for hex, 0b for binary" | |
puts "... hell, lets do octal too!" | |
puts "Type q(uit) to, y'know, QUIT!" | |
puts "Output in base 10, change output base with base = N" | |
class String | |
def to_10 |
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 'securerandom' | |
require 'thread' | |
mutex = Mutex.new | |
pause = false | |
pauser = Thread.new do | |
while (true) do | |
s = gets | |
mutex.synchronize do |
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 'securerandom' | |
require 'thread' | |
mutex = Mutex.new | |
pause = false | |
pauser = Thread.new do | |
while (true) do | |
s = gets | |
mutex.synchronize do |
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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'yaml' | |
require 'chronic' | |
require 'date' | |
require 'time' | |
FILENAME = File.expand_path "~/.growls" |
OlderNewer