Skip to content

Instantly share code, notes, and snippets.

View tburry's full-sized avatar

Todd Burry tburry

View GitHub Profile
@tburry
tburry / htaccess.txt
Last active March 10, 2022 01:58
.htaccess file for pretty urls that route through index.php
# Original
# If you modify this file then change the above line to: # Modified
<IfModule mod_rewrite.c>
RewriteEngine On
# Certain hosts may require the following line.
# If vanilla is in a subfolder then you need to specify it after the /.
# (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
# RewriteBase /
# The basic rewrtie rule.
@tburry
tburry / bootstrap.before.php
Created April 13, 2015 17:00
A boostrap.before for multiple Vanilla installations in one folder.
<?php
/**
* This file will make Vanilla use a different config depending on which site you're on.
* Drop this file into your /conf folder.
*/
// Get the config.
if (isset($_SERVER['NODE_SLUG'])) {
// This is a site per folder setup.
@tburry
tburry / vanilla.dev.conf
Created April 13, 2015 17:03
An nginx configuration file for multiple Vanilla installations in one folder.
server {
server_name vanilla.dev;
listen 80;
root /var/www/vanilla;
location ^~ /static {
access_log /dev/null;
error_log /dev/null crit;
@tburry
tburry / git-prune-local.sh
Last active August 29, 2015 14:21
A handy script to clean up merged git branches.
# Remove stale remote tracking branches.
git remote prune origin
# Remove stale local tracking branches.
git branch --merged | grep -v "\*" | egrep -v "master|development" | xargs -n 1 git branch -d
@tburry
tburry / composer-bin-autoload.php
Last active May 16, 2019 09:46
A snippet for including your composer autoloader in your /bin files.
<?php
$paths = [
__DIR__.'/../vendor/autoload.php', // locally
__DIR__.'/../../../autoload.php' // dependency
];
foreach ($paths as $path) {
if (file_exists($path)) {
require_once $path;
break;
@tburry
tburry / git-normalize-lines.sh
Created May 29, 2015 18:59
Normalize all line endings in the current git repo to the config setting.
# Normalize all line endings in the current repo to the config setting.
git rm --cached -rf .
git diff --cached --name-only -z | xargs -n 50 -0 git add -f
@tburry
tburry / php-lint.sh
Created November 16, 2015 20:27
Lint a directory tree of PHP files.
#!/bin/bash
me=`basename $0`
if [ $# -lt 1 ]; then
echo "Usage: $me [-q] <folder>"
exit 1;
fi
quick=false
if [ "$1" = "-q" ]; then
@tburry
tburry / cla.md
Created May 2, 2016 18:55
Vanilla Forums' contributor license agreement.

Vanilla Forums Contributor License Agreement

These terms apply to your contribution of materials to a product or project owned or managed by us ('project'), and set out the intellectual property rights you grant to us (Vanilla Forums Inc) in the contributed materials. If this contribution is on behalf of a company, the term 'you' will also mean the company for which you are making the contribution. If you agree to be bound by these terms, check the box below.

Read this agreement carefully before agreeing.

  1. The term 'contribution' means any source code, object code, patch, tool, sample, graphic, specification, manual, documentation, or any other material posted or submitted by you to a project.

  2. With respect to any worldwide copyrights, or copyright applications and registrations, in your contribution:

@tburry
tburry / counts.sql
Last active June 1, 2016 15:26
Update database counts in Vanilla.
-- Count discussions.
update GDN_Category c
set CountDiscussions = (select coalesce(count(d.DiscussionID), 0) from GDN_Discussion d where c.CategoryID = d.CategoryID);
-- Count comments.
update GDN_Discussion d
set CountComments = (select coalesce(count(c.CommentID), 0) from GDN_Comment c where c.DiscussionID = d.DiscussionID);
update GDN_Category c
set CountComments = (select coalesce(sum(d.CountComments), 0) from GDN_Discussion d where c.CategoryID = d.CategoryID);
@tburry
tburry / vanilla-developer-articles.md
Last active August 30, 2017 21:02
Vanilla Developer Reading List

Vanilla Developer Reading List

Although we abstract away PDO in most cases it's good to know about how it works. You will be interacting directly with PDO from time to time and there are some things you should know (spoiler: setting a few defaults is necessary).

We want to develop features with an API-first mentality. Everyone developing for Vanilla should undersdand how to design a RESTful API endpoint so that we can have a common language for feature design.