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
0000_create_appointments.rb | |
class CreateAppointments < ActiveRecord::Migration | |
def change | |
create_table :appointments do |t| | |
t.integer :user_id | |
t.integer :receiver_id | |
t.date :prepday | |
t.time :preptime | |
t.string :preplocation |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Directory</title> | |
<%= stylesheet_link_tag "application", :media => "all" %> | |
<%= javascript_include_tag "application" %> | |
<%= csrf_meta_tags %> | |
</head> | |
<body> | |
<header class="navbar navbar-fixed-top navbar-inverse"> |
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
devise_for :users do | |
get 'users', :to => 'users#show', :as => :user_root | |
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
s = File.open("gettysburg.txt").read().downcase | |
maxrange = s.length | |
matched = {} | |
for range in (2..maxrange) | |
(matched["#{range}"] ||= []) << (0..s.length - 1).find_all { |i| s[i,range] == s[i,range].reverse } | |
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
$.fn.raty.defaults.path = "/assets"; | |
$.fn.raty.defaults.half_show = true; | |
$(function(){ | |
$(".star").each(function() { | |
var $readonly = ($(this).attr('data-readonly') == 'true'); | |
$(this).raty({ | |
score: function(){ | |
return $(this).attr('data-rating') | |
}, |
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
def show_overall_rating(value) | |
count = 1 | |
until count == value | |
radio_button :review, :overall, count, options={:class => 'star', :disabled => 'disabled'} | |
count += 1 | |
end | |
radio_button :review, :overall, count, options={:class => 'star', :disabled => 'disabled', :checked => 'checked'} | |
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
public class ListNode { | |
//has two pieces: data and pointer to next node | |
private int value; | |
private ListNode next; | |
//constructors | |
public ListNode() { | |
} | |
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
//same ListNode as SLL except with prev, getPrevious, setPrevious | |
public class ListNode { | |
private int value; | |
private ListNode prev; | |
private ListNode next; | |
//need constructor, get/set values/prev/next | |
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
public class Element { | |
private int value; | |
private Element next; | |
public Element(int value, Element next) { | |
this.value = value; | |
this.next = next; | |
} | |
} |
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
#This goes as a before_filter on your controller. | |
#Requires 'geocoder' gem | |
def check_zipcode | |
if params[:zipcode].nil? | |
return | |
end | |
if !Zipcode.where('zip = ?', params[:zipcode]).empty? | |
zip = Zipcode.where('zip = ?', params[:zipcode]).first | |
return [zip.lat, zip.lng] |
OlderNewer