Skip to content

Instantly share code, notes, and snippets.

View Braunson's full-sized avatar

Braunson Yager Braunson

View GitHub Profile
@Braunson
Braunson / routing_patterns.php
Created November 21, 2016 20:20 — forked from lucasdavies/routing_patterns.php
Routing patterns from laravel-tricks.com
<?php
// This is what you might have right now
Route::get('users/{id}', 'UserController@getProfile')->where('id', '[\d+]+');
Route::get('products/{id}', 'ProductController@getProfile')->where('id', '[\d+]+');
Route::get('articles/{slug}', 'ArticleController@getFull')->where('slug', '[a-z0-9-]+');
Route::get('faq/{slug}', 'FaqController@getQuestion')->where('slug', '[a-z0-9-]+');
// and many more, now imagine you'll have to change the rule
// Instead, you could have a handy list of patterns and reuse them everywhere:
@Braunson
Braunson / ClearBeanstalkdQueueCommand.php
Created November 18, 2016 02:23 — forked from lukaswhite/ClearBeanstalkdQueueCommand.php
Clear a Beanstalkd Queue in Laravel
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ClearBeanstalkdQueueCommand extends Command {
/**
@Braunson
Braunson / nginx-s3.conf
Created February 24, 2016 22:00 — forked from surjikal/nginx-s3.conf
Nginx - Wildcard subdomains, basic auth and proxying to s3. Set a policy to only allow your server's IP.
server {
listen 80;
server_name *.foo.example.com;
# We need this to resolve the host, because it's a wildcard.
# This is google's DNS server.
resolver 8.8.8.8;
include /etc/nginx/includes/proxy.conf;
@Braunson
Braunson / github-remove-diff-markers-bookmarklet.js
Created December 4, 2015 00:47 — forked from jkingsman/github-remove-diff-markers-bookmarklet.js
Remove the '+' and '-' from GitHub diff view; helpful when copying large swaths of code from a diff.
javascript:(function(){for(var elements=document.getElementsByClassName("blob-code-inner"),i=0;i<elements.length;i++)(elements[i].parentNode.classList.contains("blob-code-addition")||elements[i].parentNode.classList.contains("blob-code-deletion"))&&(elements[i].innerHTML=elements[i].innerHTML.substring(1));})();
@Braunson
Braunson / content-length-size.md
Created October 29, 2015 13:38 — forked from voronianski/content-length-size.md
What happens if you serve content with a different length than the Content-Length header?

@jakearchibald done a bit of research around this:

###Loading a page with Content-Length < actual content length

  • Chrome: Truncated content - no indication of error
  • Firefox: Truncated content - no indication of error
  • Safari: Truncated content - no indication of error
  • IE: Truncated content - no indication of error

###Loading a page with Content-Length > actual content length

@Braunson
Braunson / ShopifyMultipass.php
Last active May 22, 2022 11:12 — forked from xthexder/ShopifyMultipass.php
ShopifyMultipass - Ported to PHP
<?php
date_default_timezone_set("UTC");
class ShopifyMultipass {
private $encryption_key;
private $signature_key;
public function __construct($multipass_secret) {
// Use the Multipass secret to derive two cryptographic keys,
// one for encryption, one for signing
@Braunson
Braunson / all-calendar-freebusy-check.php
Last active August 29, 2015 14:22
Checking freebusy on all Google Calendars for an authorized account.
<?php
// Create an authorized calendar service object
$calendarService = new Google_Service_Calendar( $client );
$calendarList = $calendarService->calendarList->listCalendarList();
$calendarArray = [];
// Put together our calendar array
while(true) {
foreach ($calendarList->getItems() as $calendarListEntry) {
#! /usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"