Skip to content

Instantly share code, notes, and snippets.

View speedmax's full-sized avatar

Taylor luk speedmax

View GitHub Profile
function findClosestLine($line) {
$Line->find('first', array(
'conditions' => array('line <='=>5.1),
'order' => 'line desc'
));
}
class Transaction < ActiveRecord::Base
belongs_to :transactable, :polymorphic => true
end
<?php
/** Dynamic method injection to php **/
class Dog {
static $_methods;
function __call($method, $args) {
if (isset(self::$_methods[$method])) {
$method = self::$_methods[$method]
}
@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
[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")
- **The Largest European Poker Network**
- **Guaranteed US$15 Million won Every Month**
- **Trips to the Greatest Land Based Events**
- **Free $*600 to Get the Action Started**
### Join Today for our 100% MATCH DEPOSIT up to $600 ###
*Minimum deposit required and wagering restrictions apply. For more information read our [Terms and Conditions.][1]
- <var class="parent parent dl casino"/>
- ![Centrebet casino][1]
- param1
![Centrebet Games][2]
param 2
param 3
<?php
/**
* To implment tagging behavior to be able to plug into any data model in the system
*
* Requirements
* You are required to create "tags" table to hold all tag entries
* You are required to create a "[tableName]_tags" table for each object you
* want to tag. for example, to implement tags for pages u need this table
* pages_tags (page_id : int, tag_id)
*
@speedmax
speedmax / 1. argument parsing example
Created February 6, 2009 14:31
H2o hacking guide
H2o hacking guide
argument parsing.
=====================
* variable name turns to ":variable" which uses ruby symbol style string to indicate if its a variable and to speed up context lookup
* arguments are seperated by comma
* anything looks like named argument(name: "peter", age: 18) will parse into a option style array
H2o_Parser::parseArguments("variable")
@speedmax
speedmax / 1. template.html
Created February 11, 2009 07:47
h2o code generation concept, 4 and 5 are executable code
<h1>{{ person.name }}</h1>
{% block content %}
<small>block:{{ block.name }}, level: {{ block.depth }} ?></small>
(i am {{ block.age }} years old)
{% endblock %}
<ul>
{% for hobby in person.hobbies %}
<li>{{ hobby|capitalize }}</li>
{% endfor %}
</ul>