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
(function(){ | |
/** | |
* Module to workout CORS requests with CSRF | |
*/ | |
angular.module('CorsCSRF') | |
.config(function($httpProvider) | |
{ | |
// CSRF Interceptor | |
$httpProvider.interceptors.push(function($cookies) { |
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
{ | |
'AC': 'Acre', | |
'AL': 'Alagoas', | |
'AP': 'Amapá', | |
'AM': 'Amazonas', | |
'BA': 'Bahia', | |
'CE': 'Ceará', | |
'DF': 'Distrito Federal', | |
'ES': 'Espírito Santo', | |
'GO': 'Goiás', |
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
The following example shows how to use the gcore utility to force a hung process to dump core, and then shows how the gdb utility can be used to retrieve a stack backtrace from the core file: | |
$ gcore 5649 | |
$ gdb -q /usr/sbin/httpd core.5649 | |
(gdb) backtrace | |
#0 0x0046e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 | |
#1 0x0063b681 in accept () from /lib/tls/libpthread.so.0 | |
#2 0x00b14814 in apr_socket_accept (new=0xbff85740, sock=0x9671538, |
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
sudo service udev restart | |
sudo service networking restart | |
sudo service network-manager restart |
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 TestCase extends Laravel\Lumen\Testing\TestCase | |
{ | |
/** | |
* Inject session ID into request, so api can persist on session | |
*/ | |
public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) | |
{ |
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 | |
require_once dirname( __FILE__ ) . '/lib/php-ga/src/autoload.php'; | |
use UnitedPrototype\GoogleAnalytics; | |
if (!function_exists('ga_tracker')) { | |
function ga_tracker() { | |
// Initilize GA Tracker | |
$tracker = new GoogleAnalytics\Tracker('UA-12345678-9', 'website.com'); | |
return $tracker; |
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 | |
const FEATURE_FLAGS = [ | |
'MY_NEW_FEATURE' => false, | |
'MY_RELEASED_FEATURE' => true, | |
]; |
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 -S 0.0.0.0 -t /home/site /home/site/wp-router.php |
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
/** | |
* Creates a app object in the global scope | |
*/ | |
function initAppSingleton() { | |
global = global || window; | |
if (!global.app) { | |
global.app = {}; | |
} | |
return global.app; |
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
const sinon = require('sinon'); | |
module.exports = function() { | |
/** | |
* Fake timers (setImmediate, setTimeout) | |
*/ | |
before(function() { | |
this.clock = sinon.useFakeTimers(new Date()); | |
}); |