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 | |
// Will this cause a memory leak? | |
// Will a new instance of ObjectClass stay in memory each iteration? | |
// If I attach it to a variable will it replace the old memory pointer? | |
foreach ($a as $k) { | |
new ObjectClass($k); | |
} |
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
class LearnMyABCs | |
def initialize | |
@letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] | |
end | |
def speak(text) | |
puts text | |
system 'say ' + text | |
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
<?php | |
class Date { | |
/** | |
* Convert a local timestamp to a GMT timestamp. | |
* | |
* @static | |
* | |
* @param string $timestamp | |
* @param string $timezone | |
* @param string $format |
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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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 | |
//Here we're setting BIT_0, BIT_1, ..., BIT_15 for use with octal notation | |
//It's basically saving 1,2,4,8,16, ..., 32768 to prevent possible typos and less calculations | |
// 2^n = BIT_n | |
$t = 1; | |
for ($i = 0; $i < 16; $i++) { | |
define('BIT_' . $i, $t); | |
$t <<= 1; | |
} |
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 | |
$post = Post::find(1); | |
$post->comments()->insert(array( | |
'body' => $body, | |
'author' => $author | |
)); |
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 | |
$post = Post::find(1); | |
$comment = new Comment(); | |
$comment->fill(array( | |
'post_id' => $post->id, | |
'body' => $body, | |
'author' => $author |
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 Post extends Eloquent { | |
public static $table = 'posts'; | |
public function comments() | |
{ | |
return $this->has_many('Comment'); | |
} |
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 Auth extends System\Auth { } | |
class Benchmark extends System\Benchmark { } | |
class Cache extends System\Cache { } | |
class Config extends System\Config { } | |
class Cookie extends System\Cookie { } | |
class Crypt extends System\Crypt { } | |
class DB extends System\DB { } | |
class Error extends System\Error { } |