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 | |
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html | |
// Start a session (which should use cookies over HTTP only). | |
session_start(); | |
// Create a new CSRF token. | |
if (! isset($_SESSION['csrf_token'])) { | |
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32)); | |
} |
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 | |
// Mode. | |
define('MODE', isset($_SERVER['MODE']) ? $_SERVER['MODE'] : 'development'); | |
// Character Set. | |
ini_set('default_charset', 'UTF-8'); | |
mb_internal_encoding('UTF-8'); | |
mb_regex_encoding('UTF-8'); | |
mb_http_input('UTF-8'); | |
mb_http_output('UTF-8'); |
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
{ | |
"require": { | |
"phpmailer/phpmailer": "5.2.1" | |
}, | |
"repositories": [ | |
{ | |
"type": "package", | |
"package": { | |
"name": "phpmailer/phpmailer", | |
"version": "5.2.1", |
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
# Bash Profile | |
# File: ~/.bash_profile | |
# Set $WEB_DIR and $SCRIPTS_DIR to the appropriate directories. | |
export PATH="./vendor/bin:$PATH" | |
export EDITOR=nano | |
export WEB_DIR="/var/www/vhosts" | |
export SCRIPTS_DIR="~/.web" |
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 | |
require __DIR__ . '/vendor/autoload.php'; | |
use Symfony\Component\Console\Application; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Symfony\Component\Console\Input\InputArgument; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Finder\Finder; |
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 | |
// src/Foobar/Controller/FooController.php | |
namespace Foobar\Controller; | |
class FooController | |
{ | |
public function helloAction($request) | |
{ |
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 | |
define('ENV', getenv('ENV') !== false ? getenv('ENV') : 'development'); | |
/* OR */ | |
define('ENV', isset($_SERVER['ENV']) ? $_SERVER['ENV'] : 'development'); |
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
$.extend({ | |
isMobile: function() { | |
return navigator.userAgent.match(/Android|webOS|iPhone|iPod|iPad|BlackBerry/i) !== 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
sudo useradd -m -d /home/<username> -s /bin/bash -k /etc/skel -g <primarygroup> -G sudo <username> | |
sudo passwd <username> | |
sudo deluser <username> | |
chsh -s /bin/bash <username> |
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($) { | |
$(document).ready(function() { | |
// Highlight Navigation | |
var url = $.parseUrl(document.location); | |
$('a').each(function() { | |
var link = $.parseUrl(this.href); | |
if (link.pathname !== '' && link.pathname === url.pathname) { | |
$(this).siblings().removeClass('active'); | |
$(this).addClass('active'); | |
} |