Skip to content

Instantly share code, notes, and snippets.

<?php
namespace KnowTheCode;
require_once( __DIR__ . '/assets/vendor/autoload.php' );
$x = 9;
$y = 0;
//$z = $x / $y;
//echo $z;
<?php
namespace KnowTheCode;
require_once( __DIR__ . '/assets/vendor/autoload.php' );
$x = 9;
$y = 0;
$z = $x / $y;
echo $z;
mv composer.phar composer
chmod 750 composer
mv composer ~/bin
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
@dannygsmith
dannygsmith / SecureSessionHandler.php
Created March 3, 2018 02:48 — forked from eddmann/SecureSessionHandler.php
Secure session handler implementation.
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
@dannygsmith
dannygsmith / wp-db-restore
Last active December 13, 2017 03:47
Restore all WordPress databases in laravel valet
#!/usr/bin/env bash
SUFFIX=`date "+%w"`
#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
@dannygsmith
dannygsmith / _verify-repair-permissions-disk.md
Created December 11, 2017 23:57 — forked from bzerangue/_verify-repair-permissions-disk.md
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@dannygsmith
dannygsmith / wp-mailhog.php
Created November 29, 2017 18:53 — forked from bishless/wp-mailhog.php
Configure WordPress on Valet to use MailHog
<?php
/**
* @link
* @since 1.0.0
* @package TODO
*
* @wordpress-plugin
* Plugin Name: Use MailHog
* Description: Configure WordPress on Valet to use MailHog
* Version: 1.0.0
@dannygsmith
dannygsmith / valet-install
Last active November 18, 2017 14:50
Script to install Laravel Valet by first checking for any other web stacks
#!/usr/bin/env bash
#styles
VP_NONE='\033[00m'
VP_RED='\033[01;31m'
VP_GREEN='\033[01;32m'
VP_YELLOW='\033[01;33m'
VP_PURPLE='\033[01;35m'
VP_CYAN='\033[01;36m'
VP_WHITE='\033[01;37m'
@dannygsmith
dannygsmith / .bash_profile
Last active November 17, 2017 13:49
Sample bash_profile for students
#source ~/.profile
# .bash_profile
mesg n
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi