Skip to content

Instantly share code, notes, and snippets.

<html ng-app>
<head>
<title></title>
<script>
function MyCtrl($scope) {
$scope.animals = ["Dog", "Cat", "Elephant"];
}
</script>
</head>
<body>
Animal := Object clone
Animal name := "Jack"
Dog := Animal clone
Dog bark := "Bark"
Dog bark // "Bark"
Dog name // "Jack"
1.8.6 :001 > def method_one(arg)
1.8.6 :002?> puts arg
1.8.6 :003?> end
=> nil
1.8.6 :004 > def method_two(&block)
1.8.6 :005?> block.call('sup')
1.8.6 :006?> end
=> nil
1.8.6 :007 > x = self.method(:method_one)
=> #<Method: Object#method_one>
EventTableViewController *eventTableViewController = [[EventTableViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *eventNavController = [[UINavigationController alloc] initWithRootViewController:eventTableViewController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = eventNavController;
class VenuePresenter < ApplicationPresenter
def venue
@venue ||= Venue.find_by_id(params[:id])
end
def sidebar_image
image_tag(google_maps_url(venue), :class => 'sidebar-image', :alt => venue.readable_location)
end
def self.for_venue(venue, options = {})
filter = options[:filter]
date_conditions = case options[:date]
when 'upcoming' then 'e.datetime < :datetime'
when 'past' then 'e.datetime > :datetime'
end
sql_query = [
"SELECT #{search_fields}",
def self.for_venue(venue, options = {})
filter = options[:filter]
date_conditions = case options[:date]
when 'upcoming' then 'e.datetime < :datetime'
when 'past' then 'e.datetime > :datetime'
end
sql_query = [
"SELECT #{search_fields}",
describe "building a sql query" do
it "builds with out any options" do
expected_query = "SELECT search_fields FROM events e search_joins WHERE e.venue_id = 69 AND e.deleted = 0"
ActiveRecord::Base.should_receive(:prepare_sql).with([expected_query, { :datetime => Time.now.beginning_of_day }])
BIT::Event.for_venue(@venue)
end
it "builds for upcoming events" do
expected_query = "SELECT search_fields FROM events e search_joins WHERE e.datetime > :datetime AND e.venue_id = 69 AND e.deleted = 0"
ActiveRecord::Base.should_receive(:prepare_sql).with([expected_query, { :datetime => Time.now.beginning_of_day }])
BIT::Event.for_venue(@venue, :date => 'upcoming')
class CreateFacebookVenuesTable < ActiveRecord::Migration
extend MigrationHelpers
def self.up
create_table :facebook_venues do |t|
t.integer :uid, :null => false
t.string :name, :null => false
t.text :description
t.string :phone
t.string :address
module Facebook
module PageCategories
LOCAL_BUSINESS = ["Airport","Arts/Entertainment/Nightlife","Attractions/Things to Do","Automotive","Bank/Financial Services","Bar","Book Store","Business Services","Church/Religious Organization","Club","Community/Government","Concert Venue","Doctor","Education","Event Planning/Event Services","Food/Grocery","Health/Medical/Pharmacy","Home Improvement","Hospital/Clinic","Hotel","Landmark","Lawyer","Library","Local Business","Movie Theater","Museum/Art Gallery","Outdoor Gear/Sporting Goods","Pet Services","Professional Services","Public Places","Real Estate","Restaurant/Cafe","School","Shopping/Retail","Spas/Beauty/Personal Care","Sports Venue","Sports/Recreation/Activities","Tours/Sightseeing","Transportation","University"]
ORGANIZATION = ["Aerospace/Defense","Automobiles and Parts","Bank/Financial Institution","Biotechnology","Cause","Chemicals","Church/Religious Organization","Community Organization","Company","Computers/Technology","Consulting/Business Serv