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
fontconfig=yes | |
subcp=cp1250 | |
subfont-text-scale=4 |
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 Comment | |
include Mongoid::Document | |
field :name | |
# do not generate object_id | |
# for mongoid <=2.0rc7 (in newer mongoid use Mongoid.embedded_object_id = false) | |
def identify | |
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
.clipped_text { | |
white-space: nowrap; | |
width: 100%; # for IE 6 | |
overflow: hidden; | |
text-overflow: ellipsis; | |
} |
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
#1 | |
LOAD DATA INFILE... | |
#2 | |
ALTER TABLE name DISABLE KEYS; // tells MySQL to stop updating nonunique indexes | |
INSERT ... | |
... | |
ALTER TABLE name ENABLE KEYS; // re-creates missing indexes (much faster than inserting one by one) | |
#3 (InnoDB) |
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 | |
// old way | |
$value = $value ? $value : false; | |
// new way | |
$value = $value ?: false; | |
// however... | |
$value = isset($value) ?: false; // if eg. $value="value", then it returns (bool)true, and not (string)"value" |
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 Test | |
{ | |
private $foo; | |
public function __construct($foo) | |
{ | |
$this->foo = $foo; | |
} |
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 | |
$stmt = $pdo_connection->query('SELECT id, name, surname FROM people'); | |
$people = $stmt->fetchAll(\PDO::FETCH_GROUP | \PDO::FETCH_UNIQUE | \PDO::FETCH_ASSOC); | |
/* | |
$people will now contain: | |
array( | |
1 => array( | |
'name' => 'Juan', | |
'surname' => 'Sorin', |
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 SomeClass | |
def self.some_method | |
end | |
end | |
some_obj = SomeClass.new | |
some_obj.class.some_method # = SomeClass.some_method |
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
/** | |
* Global beholder for communication between blocks. | |
* | |
* If any callback returns true, next callbacks are NOT executed. | |
*/ | |
var Beholder = function() { | |
var callbacks = {}; | |
return { | |
observe: function(id, callback) { |