View gist:d317830a9d494dc502ad
//
// This sketch will print some of interesting predefined constants to Serial.
//
// For more information, look at
// http://electronics4dogs.blogspot.com/2011/01/arduino-predefined-constants.html
// helper macro
#define LINE(name,val) Serial.print(name); Serial.print("\t"); Serial.println(val);
void setup()
View new_gist_file.php
// This function is part of Laravel's ./Illuminate/Support/helpers.php:663:
function preg_replace_sub($pattern, &$replacements, $subject)
{
return preg_replace_callback($pattern, function($match) use (&$replacements)
{
return array_shift($replacements);
}, $subject);
}
View bootstrap.php
use \Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
$app->error(function (\Exception $e) use ($app) {
if ($e instanceof NotFoundHttpException) {
return $app->json(array('error' => 'Page Not Found'), 404);
}
$code = ($e instanceof HttpException) ? $e->getStatusCode() : 500;
return $app->json(array('error' => $e->getMessage()), $code);
});
View terminal
rm -rf app/cache/*
rm -rf app/logs/*
APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1`
sudo chmod +a "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
View symfony2.md

Symfony2

Files loaded on standard edition request (253)

  • Acme\DemoBundle\AcmeDemoBundle
  • Acme\DemoBundle\Controller\DemoController
  • Acme\DemoBundle\EventListener\ControllerListener
  • Acme\DemoBundle\Twig\Extension\DemoExtension
  • Assetic\Extension\Twig\AsseticExtension
  • Assetic\Extension\Twig\ValueContainer
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
View index.html
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-animate.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-cookies.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-resource.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-route.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-sanitize.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-touch.min.js"></script>
View index.php
<?php
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpKernel\EventListener\RouterListener;
use Symfony\Component\Routing\Matcher\UrlMatcher;
View silex_bootstrap.php
<?php
use Silex\Application;
use Symfony\Component\HttpFoundation\Response;
use Silex\Provider\SessionServiceProvider;
/* include the silex autoload */
require_once __DIR__.'/../vendor/autoload.php';
$app = new Application();