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 index | |
@az_idols = ("a"..."z").reduce({}) do |result, letter| | |
res = Idol.find :all, :conditions=>["name LIKE ?", "#{letter}%"] | |
result[letter] = res unless res.empty? | |
result | |
end.sort | |
end |
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 adrev_ad_types ( | |
id int(11) NOT NULL auto_increment, | |
name varchar(64) NOT NULL default '', | |
template text, | |
PRIMARY KEY (id), KEY name (name)) | |
CREATE TABLE adrev_ads ( | |
id int(11) NOT NULL auto_increment, | |
userid int(11) NOT NULL default '0', |
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
specials: | |
title: Action all the time | |
country: [au] | |
url: http://centrebet.com/?GoSports | |
from: now | |
to: 02-09-2009 | |
content: > | |
If the world of Sports and Racing has nothing to offer you, then | |
check out Centrebet’s Special & Entertainment Odds. | |
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
/* | |
Standarized Data API design in JSON object | |
we should also learn from google data API recommended attributes for | |
Events & activities | |
-http://base.google.com/base/api/itemTypeDocs?verticalName=events%20and%20activities&verticalLocale=en_US | |
Universal attributes | |
- http://base.google.com/base/api/universalAttributes?verticalLocale=en_US |
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
<?php | |
function openbet($class, $attrs = array()) { | |
$class = "Openbet_".ucwords($class); | |
return new $class; | |
} | |
class Openbet_Object { | |
function __construct($attrs = array()) { | |
# set object 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
class Account < ActiveRecord::Base | |
belongs_to :owner, :class_name => 'User', :foreign_key => 'user_id' | |
has_many :users | |
has_many :transactions | |
has_many :websites | |
has_many :campaigns | |
def display_name | |
company || full_name || '' | |
end |
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 db:drop | |
rake db:migrate | |
rake seed:load |
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
// Map function | |
function(doc) { | |
// Format date to yyyy mm dd | |
var date = doc.created_at.replace(/T|-/g, ' ').replace('+', ' +'); | |
// return advertiser, date | |
emit(doc.accounts.advertiser, date.substring(0,10)) | |
} | |
// Reduce function |
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
{{ 'post_view' | zend_url postid: post.id }} | |
// url for post_view route | |
{{ 'Martel' | links_to_route 'user' username: 'martel' }} | |
// links_to_route helper filter | |
// outputs <a href="<?= $this->url(array('username' => 'martel'), 'user') ?>">Martel</a> |
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
Sign, all my math are forgotten, anyway, | |
10 new customer a day, billed 40bucks monthly over a year = near one million annually, but | |
same condition but 5 customer a day = half million annually | |
Here is the millionaire calculation formula | |
40 * 30 * 12 / 2 * (1 + 12) * x = $$$ | |
given x is the number of new customer yer day.. |