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 | |
// Mustache only support single dimensional array | |
// With this patch, we can pass an array of objects to Mustache::renderString | |
$string = '{{var.foo}}'; | |
$parameters = array('var' => new Object()); |
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 | |
0 => | |
array | |
empty | |
1 => | |
array | |
empty | |
2 => | |
array | |
empty |
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
security: | |
access_control: | |
- { path: /admin/.*, role: ROLE_ADMIN } | |
- { path: /.*, role: IS_AUTHENTICATED_ANONYMOUSLY } | |
encoders: | |
admin: { algorithm: sha1, class: Sas\CoreBundle\Entity\Account } | |
providers: | |
fos_user: | |
id: fos_user.user_manager | |
firewalls: |
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
security: | |
acl: ~ | |
access_control: | |
- { path: /admin/.*, role: ROLE_ADMIN, host: resowl2.com } | |
- { path: /.*, roles: [IS_AUTHENTICATED_ANONYMOUSLY, ROLE_USER] } | |
encoders: | |
admin: { algorithm: sha1, class: Sas\CoreBundle\Entity\Account } | |
providers: | |
fos_user: | |
id: fos_user.user_manager |
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] | |
;;;;;;;;;;;;;;;;;;; | |
; About php.ini ; | |
;;;;;;;;;;;;;;;;;;; | |
; PHP's initialization file, generally called php.ini, is responsible for | |
; configuring many of the aspects of PHP's behavior. | |
; PHP attempts to find and load this configuration from a number of locations. | |
; The following is a summary of its search order: |
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 | |
$lines = file('http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1'); | |
$two = array(); | |
$three = array(); | |
$four = array(); | |
$five = array(); | |
foreach ($lines as $line) { |
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 | |
foreach ($this->models as $model) { | |
$_file = '../' . $this->app . 'Models/' . $model . 'Model.php'; | |
$_class = $model . 'Model'; | |
if (file_exists($_file)) { | |
require_once $_file; | |
$this->{ucfirst($model)} = new $_class(null, dbConfig::$default); | |
} else { |
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 | |
// Alternative to the long polling system used in lichess (github.com/ornicar/lichess) | |
// - We could use an ajax request on a php script with an infinite loop until version has changed. | |
$userVersion = $_GET['version'] | |
$version = $db->stack->find($_GET['player_id'])->getVersion(); | |
while ($userVersion <= $version) { | |
usleep(10000); |
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 | |
// Usage: | |
// | |
// $ php benchmar.php | |
// or | |
// $ php benchmark.php 1000 // to execute 1000 times | |
$pdo = new \PDO('sqlite://:memory:'); | |
$pdo->exec("CREATE TABLE IF NOT EXISTS `Users` ( |
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
// Let you listen to SocketIO events into your Collection | |
var socket | |
Backbone.Collection.prototype.initialize = function() { | |
var events = this.socketEvents | |
for (var eventName in events) { |
OlderNewer