Skip to content

Instantly share code, notes, and snippets.

View jrnickell's full-sized avatar

John Nickell jrnickell

View GitHub Profile
@jrnickell
jrnickell / .editorconfig
Created July 31, 2013 17:50
Editor config settings
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@jrnickell
jrnickell / Vagrantfile
Last active December 21, 2015 10:09
Shell provisioning for Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.provision :shell, :inline => "echo \"America/Chicago\" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata"
<?php
class ResourceLocator implements ResourceLocatorInterface
{
protected $defaultMap;
protected $schemes = [];
public function __construct(UriPathMapInterface $defaultMap = null)
{
$this->defaultMap = $defaultMap ?: new UriPathMap();
<?php
class DayCalc
{
protected static $weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
public static function getWeekDay($year, $month, $day)
{
$total = static::getTotalDays($year, $month, $day);
$i = $total % 7;
@jrnickell
jrnickell / JohnnyFive.tmTheme
Created January 26, 2014 22:50
My Sublime Text 2 Theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
======================================================================
JohnnyFive
======================================================================
A Sublime Text 2 / Textmate theme.
Copyright (c) 2014 John Nickell
Released under the MIT License <http://opensource.org/licenses/MIT>
======================================================================
@jrnickell
jrnickell / Preferences.sublime-settings
Created May 3, 2014 16:18
Sublime Text 2 Settings
{
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
".vagrant",
".idea"
@jrnickell
jrnickell / permissions.sh
Created May 22, 2014 15:13
Script to apply command-line (user) and apache write permissions to a folder
#!/bin/bash
APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1`
sudo setfacl -R -m u:$APACHEUSER:rwX -m u:`whoami`:rwX app/storage
sudo setfacl -dR -m u:$APACHEUSER:rwX -m u:`whoami`:rwX app/storage
@jrnickell
jrnickell / setup-dev.sh
Last active August 29, 2015 14:09
Setup Development Machine
#!/usr/bin/env bash
echo -n "==> Choose a password for MySQL and phpMyAdmin: "
read PASSWORD
echo -n "==> Enter your full name for Git configuration: "
read FULLNAME
echo -n "==> Enter your email address for Git configuration: "
read EMAILADD
@jrnickell
jrnickell / random_compat.php
Last active August 29, 2015 14:17
Random compat
if (!function_exists('random_bytes')) {
function random_bytes($length)
{
$buffer = '';
$valid = false;
if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
$buffer = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM);
if ($buffer) {
$valid = true;
}
@jrnickell
jrnickell / create-project
Last active March 24, 2017 13:22
Nginx server config
#!/usr/bin/env bash
function create_index
{
cat <<- __EOF__
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>$PROJECT</title>