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
sub vcl_recv { | |
if (req.url ~ "(?i)^/admin" && req.http.x-forwarded-for !~ "\b(<%= @ips.map{ |ip| Regexp.escape(ip) }.join('|') %>)$") { | |
error 750 "Moved Temporarily"; | |
} | |
} | |
sub vcl_error { | |
if (obj.status == 750) { | |
set obj.http.Location = "/"; | |
set obj.status = 302; |
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
// what to recompile when as asset changes | |
MATCH (changed)<-[:INCLUDES*]-(recompile) | |
WHERE changed.source = "..." AND recompile.target <> NULL | |
RETURN recompile | |
// determine an asset's aggregate mtime | |
MATCH (root)-[:INCLUDES*]->(include) | |
WHERE root.source = "..." | |
RETURN max(collect(include.mtime) + root.mtime) |
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
var React = require('react'); | |
var Router = require('react-router'); | |
var SessionStore = require('../stores/SessionStore'); | |
var Stash = require('../utils/Stash'); | |
function authentication(transition) { | |
if (!SessionStore.isLoggedIn()) { | |
Stash.set('onLogin', transition.retry); | |
transition.redirect('login'); | |
return false; |
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 BaseDoctrineForm extends sfFormDoctrine | |
{ | |
// ... | |
protected function getRequiredFields(sfValidatorSchema $validatorSchema = null, | |
$format = null) | |
{ | |
if (is_null($validatorSchema)) |
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 RequiredLabelsFormatterTable extends sfWidgetFormSchemaFormatterTable | |
{ | |
protected | |
$requiredLabelClass = 'required'; | |
public function generateLabel($name, $attributes = array()) | |
{ | |
// loop up to find the "required_fields" option |
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 BaseDoctrineForm extends sfFormDoctrine | |
{ | |
public function __construct($object = null, $options = array(), $CSRFSecret = null) | |
{ | |
// ... | |
$this->widgetSchema->addFormFormatter('table', | |
new RequiredLabelsFormatterTable($this->widgetSchema) |
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 BaseDoctrineForm extends sfFormDoctrine | |
{ | |
public function __construct($object = null, $options = array(), $CSRFSecret = null) | |
{ | |
parent::__construct($object, $options, $CSRFSecret); | |
// tell the widget schema which fields are required | |
$this->widgetSchema->addOption('required_fields', $this->getRequiredFields()); |
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 BaseDoctrineForm extends sfFormDoctrine | |
{ | |
public function __construct($object = null, $options = array(), $CSRFSecret = null) | |
{ | |
parent::__construct($object, $options, $CSRFSecret); | |
// tell the widget schema which fields are required | |
$this->widgetSchema->addOption( |
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 php | |
<?php | |
$username = $argv[1]; | |
$password = $argv[2]; | |
// copied from http://fabien.potencier.org/article/20/tweeting-from-php | |
$context = stream_context_create(array( | |
'http' => array( | |
'method' => 'POST', |
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 | |
// Doctrine/DataDict/Mysql.php | |
if ($length <= 1) { | |
return 'TINYINT'; | |
} elseif ($length == 2) { | |
return 'SMALLINT'; | |
} elseif ($length == 3) { | |
return 'MEDIUMINT'; | |
} elseif ($length == 4) { |
OlderNewer