This file contains 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 | |
class ActiveRecord { | |
public static function find($id) { | |
echo $id, PHP_EOL; | |
} | |
} | |
class ActiveRecordCache { | |
This file contains 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
require 'rubygems' | |
require 'sinatra' | |
require 'hpricot' | |
require 'open-uri' | |
helpers do | |
def episodes_form | |
body = '<form method="post" action="/"><select name="link">' | |
doc = Hpricot(open("http://podcast.rubyonrails.pro.br/")) |
This file contains 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 html($closure) { | |
return tag('html', func_get_args()); | |
} | |
function head($closure) { | |
return tag('head', func_get_args()); | |
} | |
function title($closure) { |
This file contains 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 | |
class Project { | |
public function __construct() { | |
echo 'calling constructor', PHP_EOL; | |
} | |
public function __get($name) { | |
echo 'getting: ', $name, PHP_EOL; | |
} |
This file contains 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
SET CHARACTER SET utf8 |
This file contains 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
sqlite3 twibot.db 'CREATE TABLE statuses (id INTEGER PRIMARY KEY, status_id VARCHAR NOT NULL)' |
This file contains 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
# extracted from | |
# http://www.codecodex.com/wiki/index.php?title=Round_a_number_to_a_specific_decimal_place#Ruby | |
class Float | |
def round_to(x) | |
(self * 10**x).round.to_f / 10**x | |
end | |
def ceil_to(x) | |
(self * 10**x).ceil.to_f / 10**x | |
end |
This file contains 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
<!-- JEITO FEIO E BOBO --> | |
<a href="javascript:void(0);">texto do link</a> | |
<!-- JEITO BUNITO --> | |
<a href="#" onclick="return false;">texto do link</a> |
This file contains 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 | |
class Callable { | |
public function __invoke(array $options) { | |
print_r($options); | |
} | |
} | |
class Model { |
This file contains 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
using System.Web.Mvc; | |
/* | |
* return new SimpleResult("Hello World"); | |
* return new SimpleResult(1); | |
* return new SimpleResult(1257.14); | |
* return new SimpleResult(true); | |
*/ | |
namespace Custom.Mvc | |
{ |
OlderNewer