Skip to content

Instantly share code, notes, and snippets.

View alexmcroberts's full-sized avatar

Alex McRoberts alexmcroberts

View GitHub Profile
@alexmcroberts
alexmcroberts / gist:6736259
Created September 27, 2013 22:43
rendering a cakephp email in a web browser to get an idea of how it looks...
public function email_test() {
$this->layout = 'Emails/html/default';
return $this->render('Emails/html/account_verification');
}
@alexmcroberts
alexmcroberts / Check for new files in a directory git post merge hook
Created October 3, 2013 18:00
Put the following content into the file at .git/hooks/post-merge in your git repository. It tells you if there any new files in a directory after merging another branch. This is extremely useful as shown below for Migrations to ensure your database is in the same state as the master branch. This could be applied to anything else like new bash sc…
#!/bin/sh
#
# This hook parses the Migrations directory and counts if there are any migrations to run.
# If there are no migrations, nothing will show - leaving the developer in peace :)
git log -m -1 --name-only --pretty="format:" &> new_migrations.log
COUNTER=0
while read CMD; do
if [[ $CMD == *Migration* ]]
then

Keybase proof

I hereby claim:

  • I am alexmcroberts on github.
  • I am alexmcroberts (https://keybase.io/alexmcroberts) on keybase.
  • I have a public key whose fingerprint is EC3A 7E2E 279F 98D6 A9BB D120 5C83 A8D3 04C4 DE64

To claim this, I am signing this object:

@alexmcroberts
alexmcroberts / curlopt_set_ctr
Created June 3, 2015 21:57
adding a crt to curl php
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_CAINFO, '/Path/to/website.com.crt');
@alexmcroberts
alexmcroberts / .Title
Created September 29, 2015 19:42 — forked from congjf/.Title
Using MongoDB in golang with mgo
Using MongoDB in golang with mgo
@alexmcroberts
alexmcroberts / main.go
Last active February 17, 2022 11:52
Golang unmarshal JSON epoch in milliseconds from string to time.Time
package main
import (
"encoding/json"
"fmt"
"strconv"
"strings"
"time"
)
@alexmcroberts
alexmcroberts / google_fit_activity_types
Created March 18, 2016 18:37
Google Fit Activity Types in PHP
$Google_Fit_Activity_Types = array(
"Aerobics" => 9,
"Awake (during sleep cycle)" => 112,
"Back-country skiing" => 66,
"Badminton" => 10,
"Baseball" => 11,
"Basketball" => 12,
"Biathlon" => 13,
"Biking" => 1,
"Boxing" => 20,
@alexmcroberts
alexmcroberts / .git hooks post-merge
Created October 17, 2016 17:05 — forked from anonymous/.git hooks post-merge
are there migrations to run in Migration folder?
#!/bin/sh
#
# This hook parses the Migrations directory and counts if there are any migrations to run.
# If there are no migrations, nothing will show - leaving the developer in peace :)
git log -m -1 --name-only --pretty="format:" &> new_migrations.log
COUNTER=0
while read CMD; do
if [[ $CMD == *Migration* ]]
then
@alexmcroberts
alexmcroberts / cloudSettings
Last active February 6, 2019 20:10
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-02-06T20:10:41.092Z","extensionVersion":"v3.2.4"}
@alexmcroberts
alexmcroberts / macbook.bttpreset
Created December 11, 2020 18:26
BetterTouchTool Presets
{
"BTTPresetCreatorNotes" : "",
"BTTPresetInfoURL" : "",
"BTTPresetName" : "Default",
"BTTPresetColor" : "170.216240, 248.370000, 101.831700, 255.000000",
"BTTGeneralSettings" : {
"BTTPathSampleSize" : 100,
"BTTCMOnTop" : true,
"BTTForceForceClickPressure2F" : 700,
"BSTLeftHalfBlock" : true,