Skip to content

Instantly share code, notes, and snippets.

View radar's full-sized avatar

Ryan Bigg radar

View GitHub Profile
@radar
radar / _form.html.erb
Created November 30, 2015 02:24
trying to use jquery to change the starting bid field to readonly if fixed price is selected from the drop down menu
<script>
$("format").change(function () {
if(document.getElementById('format').selected=='Fixed price')
{
// do something
}
});
</script>
@radar
radar / application_controller.rb
Last active November 17, 2015 21:36 — forked from brunoalano/application_controller.rb
Path: app/controllers/company/api/application_controller.rb
module Company
module Api
class ApplicationController < Company::ApplicationController
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session
# Disable Layout
layout false
end
<package xmlns="http://www.idpf.org/2007/opf" version="3.0" xml:lang="en" unique-identifier="BookId" dir="ltr">
def mode(array)
hash = Hash.new(0)
array.each do |i|
hash[i]+=1
end
return hash.max.select{|x, y| x }
end
task :your_name_goes_here do
# your ruby code goes here
end
Hash.new { |_, _| raise "Key not found" }
require 'rspec'
require 'rspec/autorun'
class Foo
end
RSpec.describe Foo do
it "tests" do
expect(subject.class).to eq(Foo)
end
#!/usr/bin/env ruby
#
# This file was generated by RubyGems.
#
# The application 'railties' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym "API"
end
source 'https://rubygems.org'
gem 'rails', '3.2.17'
gem 'timecop'
gem 'tzinfo', '0.3.38'