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 | |
namespace sic; | |
/** | |
* Simple [Dependency] Injection Container | |
* | |
* @author Michal Wachowski <[email protected]> | |
* @license New BSD License | |
*/ | |
class SIC { |
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
window.S = function(s) { | |
return document[{ | |
'#': 'getElementById', | |
'.': 'getElementsByClassName', | |
'@': 'getElementsByName', | |
'=': 'getElementsByTagName'}[s[0]] | |
|| 'querySelectorAll'](s.slice(1)) | |
}; | |
// [S('#header'), S('.container'), S('?div')] |
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 | |
error_reporting(-1); | |
// reader | |
// reads n per call starting from last position til EOF | |
$offset = 0; | |
$reader = function ($n = 100) use (&$offset) { | |
$limit = $offset + $n; | |
$ln = 0; | |
$content = array(); |
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 | |
namespace gist; | |
/** | |
* Self nesting node | |
* Can use parent_id/order or left/right nested set or convert one to another | |
* | |
* @package gist | |
* @author Michal Wachowski <[email protected]> | |
*/ |
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
Array(16).join("foo" - 1) + " Batman!" |
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
public Integer max(Integer a, Integer b) { | |
return new If( | |
new GreaterThan(a, b), | |
a, b | |
); | |
} |
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 | |
$mooreLawConst = 18; | |
$defaults = 6; // from initial implementation for normal user | |
$monthsFromPublication = (new \DateTime('1999-12-31'))->diff(new \DateTime()); | |
$monthsFromPublication = $monthsFromPublication->y * 12 + $monthsFromPublication->m + round($monthsFromPublication->d / 31); | |
$cost = $defaults + $monthsFromPublication / $mooreLawConst; | |
var_dump($cost); |
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
interface UserRegistrationVerification | |
{ | |
public function execute(User $user); | |
} | |
final class NoVerification implements UserRegistrationVerification | |
{ | |
public function execute(User $user) | |
{ |
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
group 'group name' | |
version '0.0.0' | |
apply plugin: 'java' | |
apply plugin: 'idea' | |
apply plugin: 'application' | |
sourceCompatibility = 1.8 | |
mainClassName = "Main" |
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
-- Non blocking index creation | |
CREATE INDEX CONCURRENTLY ix_transaction_created_at_status_buyer ON transaction (created_at, status, (seller->>'id'::text)); | |
-- Index usage | |
SELECT | |
t.schemaname, | |
t.tablename, | |
indexname, | |
c.reltuples AS num_rows, | |
pg_size_pretty(pg_relation_size(quote_ident(t.schemaname)::text || '.' || quote_ident(t.tablename)::text)) AS table_size, |
OlderNewer