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
create_table "posts", :force => true do |t| | |
t.string "sender", :null => false | |
t.string "receiver", :null => false | |
t.text "interaction", :default => "What happened?" | |
t.integer "score", :default => 0, :null => false | |
t.boolean "approved", :default => false | |
t.datetime "created_at" | |
t.datetime "updated_at" |
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
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title>Action Controller: Exception caught</title> | |
<style> | |
body { background-color: #fff; color: #333; } | |
body, p, ol, ul, td { | |
font-family: verdana, arial, helvetica, sans-serif; | |
font-size: 13px; |
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
#1.TEST.RB FROM http://wiki.neo4j.org/content/Getting_Started_With_Ruby | |
#require "rubygems" | |
#require 'neo4j' | |
#create one node | |
#Neo4j::Transaction.run do | |
# #create a node and on property | |
# node = Neo4j::Node.new :age => 21 | |
# | |
# #update the node with another property |
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
#config/database.rb | |
ActiveRecord::Base.configurations[:development] = { | |
:adapter => 'postgresql', | |
:host => 'localhost', | |
:port => '5432', | |
:database => 'trustmob_ui_development', | |
:username => 'postgres', | |
:password => '' | |
} |
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
rake aborted! | |
ActiveRecord::ConnectionNotEstablished | |
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/connection_pool.rb:317:in `retrieve_connection' | |
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection' | |
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection' | |
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/migration.rb:488:in `initialize' | |
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/migration.rb:435:in `new' | |
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/migration.rb:435:in `up' | |
/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.9/lib/active_record/migration.rb:417:in `migrate' | |
/usr/lib/ruby/gems/1.9.1/gems/padrino-gen-0.9.29/lib/padrino-gen/padrino-tasks/activerecord.rb:136:in `block (2 levels) in <top (required)>' |
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 'net/http' | |
require 'json' | |
require 'hashie' | |
class Geolocate | |
def self.ip(ip) | |
#REGEX FOR VALID IP ADDRESSES | |
if /\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/.match(ip).nil? | |
raise "Not a valid IP address (e.x. '123.456.78.9')" |
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
$(document).ready(function() | |
{ | |
$('blockquote.text').expander(); | |
function initialize() { | |
var mapDiv = $('#map_canvas'); | |
var lat = mapDiv.data('latitude'), | |
lng = mapDiv.data('longitude'); | |
var mapOptions = { | |
center: new google.maps.LatLng(lat,lng), |
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
#Let say I'm getting back a JSON nested hash (or array of hashes) from an API | |
@example = {"results" = > {{"poop" => "shoop"},{"foo" => {"shizz" => "fizz", "nizzle"=>"bizzle"}}} | |
# YAML VIEW OF ABOVE | |
#- poop: shoop | |
#- foo: | |
# shizz: fizz | |
# nizzle: bizzle |
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 duplicate_writers(artist_list) | |
FasterCSV.open("duplicate_writers_report.csv", "wb") do |csv| | |
csv << ["WRITER_ID","WRITER_NAME","ARTIST_BAND","WRITER_PRO_ID","WRITER_PRO_NUMBER","WRITING_CREDITS_COUNT"] | |
artist_list.each do |id| | |
artist = User.find(id) | |
writer_names = artist.writers.collect {|writer| writer.old_name.gsub(/\W+/,"").downcase} | |
artist.writers.each do |person| | |
#make their name downcase |
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 ToDoList | |
def initialize | |
puts "What's your name, good sir?" | |
name = gets.strip | |
puts greeting(name) #this uses the greeting below | |
puts "1.) Make A To-Do List \n2.) Load A To-Do List\n" | |
while do_action = gets.chomp | |
case do_action |
OlderNewer