Skip to content

Instantly share code, notes, and snippets.

View speedmax's full-sized avatar

Taylor luk speedmax

View GitHub Profile
[Google](http://google.com "google search engine")
// outputs <a href="http://google.com" title="google search engine">Google</a>
[Google](http://google.com ":button")
// outputs <a href="http://google.com" class="button">Google</a>
[Google](http://google.com "google search engine :button")
// outputs <a href="http://google.com" class="button" title="google search engine">Google</a>
[Google](http://google.com "google search engine :button :external")
@speedmax
speedmax / minimal set of modules
Created January 31, 2009 02:20
low memory vps apache conf
mods-enabled/alias.load
mods-enabled/authz_owner.load
mods-enabled/env.load
mods-enabled/negotiation.load
mods-enabled/auth_basic.load
mods-enabled/autoindex.load
mods-enabled/headers.load
mods-enabled/authz_default.load
mods-enabled/deflate.load
mods-enabled/mime.load
<?php
/** Dynamic method injection to php **/
class Dog {
static $_methods;
function __call($method, $args) {
if (isset(self::$_methods[$method])) {
$method = self::$_methods[$method]
}
class Transaction < ActiveRecord::Base
belongs_to :transactable, :polymorphic => true
end
function findClosestLine($line) {
$Line->find('first', array(
'conditions' => array('line <='=>5.1),
'order' => 'line desc'
));
}
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..
{{ '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>
// 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
rake db:drop
rake db:migrate
rake seed:load
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