Skip to content

Instantly share code, notes, and snippets.

@loren138
loren138 / pf.md
Last active August 29, 2015 14:07 — forked from ryanzhou/pf.md

Getting Apache Port Forwarding to work in OS X Yosemite

Former code: http://echo.co/blog/os-x-109-local-development-environment-apache-php-and-mysql-homebrew

Some parts taken from: https://gist.github.com/kujohn/7209628

ipfw is officially deprecated and removed in OS X Yosemite. Pow requires another program pf to handle the port forwarding.

Note: While this does forward port 80, I haven't figured out how to get apache to see the incoming domain to make things like project.dev work correctly. If anyone gets that to work, please let me know how. (So visiting http://localhost/ or http://localhost/~username/ works as expected. Visiting http://project.dev does not.) I ended up starting apache as root and running it as _www for now.

@loren138
loren138 / curl-fix.sh
Last active September 11, 2015 14:16
Fix Curl SSL Connection Errors in Ubuntu 14.04 14.10 15.04
#!/bin/bash
# Fix curl/gnutls SSLv3 on Ubuntu 14.04
#
# The curl version on Ubuntu 14.04 Trusty Tahr has a bug (through gnutls) in
# its SSLv3 support. This also affects git.
#
# This script will rollback curl, libcurl3, and libcurl3-gnutls to the version in Ubuntu 12.04.
# Unfortionately, it does not seem to be possible to automatically update for security patches
# so you must manually check for curl updates at the url below.
#
@loren138
loren138 / post-merge
Last active August 27, 2015 11:56 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `composer install` if `composer.lock` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@loren138
loren138 / GoogleDirectoryAPI.php
Created October 12, 2015 18:06
Google Apps Password Change PHP Example/Sample Code
<?php
namespace App\Models\User;
/**
* Class GoogleDirectoryApi
*
* Stores all the password reset information
*/
class GoogleDirectoryApi
@loren138
loren138 / .rocketeerconfig.php
Last active January 17, 2021 08:26
MySQL Master Slave and EC2 Laravel Notes with Rocketeer
<?php
use Rocketeer\Services\Connections\ConnectionsHandler;
return [
// The name of the application to deploy
// This will create a folder of the same name in the root directory
// configured above, so be careful about the characters used
'application_name' => 'resources',
@loren138
loren138 / RankedQuery.json
Created October 22, 2015 16:26
Sample Elastic Search Code
{"query":{"function_score":{"query":{"multi_match":{"query":"yoga","type":"most_fields","fields":["title^10","title.std","title.shingles","authors^10","language^10","description^10","description.std","description.shingles","transcript^10","transcript.std","transcript.shingles","scripture^10","tags^10","origin_id^10"]}},"functions":[{"gauss":{"date_created":{"origin":"now\/d","scale":"50w","offset":"4w","decay":"0.5"}}}]}},"_source":{"exclude":["transcript","segments.*"]},"size":"10"}
@loren138
loren138 / readme.md
Created October 22, 2015 16:31
MS SQL with Laravel Homestead

MySBTS (Info Version 2)

To make composer install run after a pull to make sure your versions of things are update date, add this git hook https://gist.github.com/loren138/7038d20d32c206c82393

Upon downloading the API, you will need to run composer install to install the vendor files. This also means that if you update or add a composer dependency eg (composer require or composer update) that you will need to let others know to rerun composer install on their personal machines.

Note: The deploy scripts take care of running composer during the deploy process. (See the rocketeer files here: https://gist.github.com/loren138/27d9f53a4dfb3df206dd)

@loren138
loren138 / SessionTimeout.php
Created December 18, 2015 20:13
Laravel Session Timeout Middleware
<?php
namespace App\Http\Middleware;
use Closure;
use Session;
class SessionTimeout
{
@loren138
loren138 / updateBranch.sh
Created April 15, 2016 20:41
Update and merge current branch with develop via stash for GitFlow or HubFlow
#!/bin/bash
set -e
branch=$(git rev-parse --abbrev-ref HEAD)
stash=false;
if ! git diff-index --quiet HEAD --; then
stash=true
git stash
fi
@loren138
loren138 / RequestValidator.php
Created May 3, 2016 17:03
Validate Twilio TwilML SMS Request with Laravel (also a Twilio Controller for Laravel)
<?php
/**
* Twilio Request Validator Class
* This file goes in app/Models/Twilio (or you can move it around and change the namespace)
* It requires that you have a file config/api.php
* Source: https://raw.githubusercontent.com/twilio/twilio-php/3d02ee1f1bde8e860e7dbfd9d2d0d2b7ca7d625c/Services/Twilio/RequestValidator.php
*/
namespace App\Models\Twilio;