Skip to content

Instantly share code, notes, and snippets.

@bridgpal
bridgpal / paperclip.md
Created November 12, 2013 18:27
Paperclip gem instructions

#Rails - Paperclip gem

##install

brew install imagemagick

##add gems

@bridgpal
bridgpal / index.md
Created October 22, 2013 04:13 — forked from rstacruz/index.md

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

#Debugging (Use The Duck… )

Find the errors in the following

1.)

require "Rumoji" # See; https://github.com/mwunsch/rumoji
# Customize grid space and player icons as emoji charcters from: http://www.emoji-cheat-sheet.com/
require "Rainbow"
class Grid
attr_accessor :production_run, :player_x_moves, :player_o_moves
def initialize(production_run, player_x_moves, player_o_moves)
@is_debug_mode = false # set to true to invoke debugging statements if needed...
var net = require('net');
var clients = [];
var server = net.createServer(function(socket) {
//add any incoming socket to a clients array
clients.push(socket);
socket.on('data', function (data) {
//iterate over a list of clients and send data
class Show < ActiveRecord::Base
attr_accessible :bands, :date, :venue, :misc
end
require 'nokogiri'
require 'open-uri'
class Extractor
def initialize
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = '[email protected]'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
{
"bold_folder_labels": true,
"caret_style": "phase",
"cross_width": 12,
"fade_fold_buttons": false,
"font_size": 19.0,
"highlight_active_indent_guide": true,
"highlight_line": true,
"highlight_modified_tabs": true,
"hot_exit": false,

#Homework for June 18, 2013

##Calculator 1 Create a command line calculator. It should have a basic and advanced mode.

basic calculator (+, -, *, /) advanced calculator (exponents, square root)

For a basic calculator, press 1.

@bridgpal
bridgpal / statebird.rb
Last active December 17, 2015 14:09
Check for reservation on urbanspoon
require 'nokogiri'
require 'open-uri'
url = "http://rez.urbanspoon.com/reservation/start/2086"
while true
d = Nokogiri::HTML(open(url))
text = d.css("div p").first.text.gsub("this restaurant", "State Bird Provisions")