Skip to content

Instantly share code, notes, and snippets.

View mshmsh5000's full-sized avatar

Matt Holford mshmsh5000

View GitHub Profile
@mshmsh5000
mshmsh5000 / geoip-headers.vcl
Last active August 7, 2018 09:33
Fastly GeoIP header injection
# Request headers
sub vcl_recv {
set req.http.X-Fastly-Country-Code = geoip.country_code;
set req.http.X-Fastly-Country-Name = geoip.country_name;
set req.http.X-Fastly-City = geoip.city;
set req.http.X-Fastly-Latitude = geoip.latitude;
set req.http.X-Fastly-Longitude = geoip.longitude;
set req.http.X-Fastly-Region = geoip.region;
#FASTLY recv
@mshmsh5000
mshmsh5000 / gist:b4e60a6a75d28994affa
Created February 18, 2016 19:47
"mexico" in Phoenix code base
$ find . -type f -exec grep -Hni mexico {} \;
./CHANGELOG.md:33:- Campaign Content added by DS Mexico only appearing in Active view - not in Admin/Edit [\#5198](https://github.com/DoSomething/phoenix/issues/5198)
./CHANGELOG.md:228:- figure out how to proxy Mexico and Non-US/BR/MX user experience [\#5008](https://github.com/DoSomething/phoenix/issues/5008)
./CHANGELOG.md:289:- Set default language for brazil and mexico admin [\#4999](https://github.com/DoSomething/phoenix/issues/4999)
./CHANGELOG.md:374:- Brazil Admin/Mexico Admin should see edit tab on campaign view page [\#4951](https://github.com/DoSomething/phoenix/issues/4951)
./CHANGELOG.md:2162:- Hides non translatable fields from Mexico and Brazil admins [\#5004](https://github.com/DoSomething/phoenix/pull/5004) ([deadlybutter](https://github.com/deadlybutter))
./CHANGELOG.md:2242:- Adding Brazil and Mexico admin roles and perms [\#4776](https://github.com/DoSomething/phoenix/pull/4776) ([blisteringherb](https://github.com/blisteringherb))
./lib/modul
@mshmsh5000
mshmsh5000 / redirect.vcl
Created February 10, 2016 15:38
Fastly VCL for redirects stored in dicts
sub vcl_recv {
if (table.lookup(redirects, req.url)) {
error 777 "Moved";
}
#FASTLY recv
if (req.request != "HEAD" && req.request != "GET" && req.request != "FASTLYPURGE") {
return(pass);
@mshmsh5000
mshmsh5000 / notes.md
Last active February 3, 2016 17:00
Monitoring notes

Dev round table: Monitoring strategy & tools

Monitoring framework doc: CORE PHOENIX EXPERIENCES

  • Nami: Walk through

Review of tools

StatHat

@mshmsh5000
mshmsh5000 / ds.org-contribs.txt
Created January 8, 2016 20:57
DoSomething.org GitHub contributions, 2015
TOTAL PROJECTS: 129
TOTAL CONTRIBUTIONS: 8461
BY PROJECT:
phoenix: 2218
LetsDoThis-iOS: 966
LetsDoThis-Android: 471
northstar: 379
voting-app: 365
aurora: 330
@mshmsh5000
mshmsh5000 / dosomething_northstar_get_northstar_user.php
Last active October 8, 2015 15:54
function dosomething_northstar_get_northstar_user($id)
<?php
/**
* Get user data from Northstar.
*
* @param int $id
* Northstar user ID
*
* @return object
*/
@mshmsh5000
mshmsh5000 / paraneue_dosomething.pot
Last active September 2, 2015 16:09
POT extraction of Paraneue theme
# $Id$
#
# LANGUAGE translation of Drupal (general)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from files:
# theme-settings.php: n/a
# templates/user/user-profile.tpl.php: n/a
# paraneue_dosomething.info: n/a
# includes/form.inc: n/a
# includes/auth/register.inc: n/a
@mshmsh5000
mshmsh5000 / Vagrantfile
Created August 6, 2014 02:56
Vagrantfile with new box
Vagrant.configure("2") do |config|
## Choose your base box
config.vm.box = "dosomething/drupal"
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 3072]
end
# SSH Agent forwarding
@mshmsh5000
mshmsh5000 / ds-github-flow.md
Created June 10, 2014 19:52
DoSomething.org's almost-GitHub flow
  • Fork the main repo
  • Make the fork your origin, and clone locally
  • Work from the dev branch. dev is your home base
  • Before you start work, update your local dev from upstream/dev
    • git checkout dev
    • git fetch upstream
    • git merge upstream/dev
    • git push origin
  • Branch from dev locally
  • Add and commit there
@mshmsh5000
mshmsh5000 / import_sql.sh
Created May 28, 2014 14:59
Import SQL from nightly dump
#!/usr/bin/env bash
# Create the MySQL tables
for file in *.sql
do
echo $file
cat $file | mysql -u USER -pPASS DBNAME
cat $file | mysql -u USER -pPASS DBNAME
done