Skip to content

Instantly share code, notes, and snippets.

View burlresearch's full-sized avatar

Scott Burlington burlresearch

View GitHub Profile
@burlresearch
burlresearch / Document.php
Last active December 9, 2017 04:03
Laravel relationships with multiple linking tables.
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Document extends Model
{
protected $guarded = ['id'];
public $timestamps = false;
@burlresearch
burlresearch / Publication.php
Created November 24, 2017 03:54
Publication Types as JSON Field
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Publication extends Model
{
protected $guarded = ['id'];
protected $casts = [
<?php
use Core\Memory;
use Core\Session;
require_once dirname(dirname(__FILE__)) . '/private/bootstrap.php';
header("Content-Type: text/plain");
session_start();
/** @var Memory $mem */
/** @var Session $sess */
@burlresearch
burlresearch / ximport-people-errs-160729.log
Last active August 3, 2016 22:58
cpa-dataimport-snippets
3272 : USERNAME_DUPLICATE : {"Comp_CompanyId"=>22873, "Comp_IdCust"=>"1902162 ", "Pers_PersonId"=>22888, "comp_orgtype"=>"Member", "Comp_Status"=>"Active", "Comp_Type"=>"Customer ", "comp_membertier"=>"FFT", "comp_district"=>nil, "comp_cpadivisions"=>nil, "Pers_LastName"=>"Munro", "Pers_FirstName"=>"Jeffrey", "Pers_MiddleName"=>"D.", "Pers_Salutation"=>"Mr.", "Pers_Title"=>"", "Pers_EmailAddress"=>"kateandjeff@live.ca", "Pers_Gender"=>"Male ", "pers_language"=>"US", "comp_language"=>"US", "pers_birthlastname"=>"", "Pers_PhoneAreaCode"=>"709", "Pers_PhoneCountryCode"=>nil, "Pers_PhoneNumber"=>"466-5235", "pers_birthday"=>1978-01-09 00:00:00 UTC, "Addr_Address1"=>"130", "Addr_Address2"=>"Harbour Dr", "Addr_Address3"=>"", "Addr_Address4"=>"", "Addr_City"=>"Clarenville", "Addr_State"=>"NL", "Addr_PostCode"=>"A5A 4J4", "Addr_Country"=>"CA", "pers_webusername"=>"kateandjeff@live.ca ", "pers_webpasswor
@burlresearch
burlresearch / fabfile.py
Created December 17, 2015 18:05
An example Fabric build file with the ability to `build` and `deploy` to a variety of targets.
import os
from fabric.api import *
from fabric.context_managers import lcd
from fabric.contrib.project import rsync_project
@task
def build(composer_extra=""):
with lcd('src/private'):
local("composer install %s" % composer_extra)
@burlresearch
burlresearch / TranslatableTrait.php
Created April 14, 2015 22:49
This is my thinking to override the Model:Accessors for the translatable fields in the dbase. Then we just add nullable() fields with '_fr' suffix and fill them in as warranted.
<?php
/*
* (C) Copyright 2015 76design Inc (https://76design.com) and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@burlresearch
burlresearch / json2csv.php
Created April 2, 2015 13:35
Convert JSON files each to CSV.
<?php
$AS_ARRAY = true;
$files = glob('*.json');
foreach($files as $fname) {
echo $fname . PHP_EOL;
$json_data = file_get_contents($fname);
$json_obj = json_decode($json_data, $AS_ARRAY);
$fp = fopen(basename($fname, '.json') . '.csv', 'w');
@burlresearch
burlresearch / .muttrc
Created November 19, 2014 13:48
Mutt IMAP setup for Google Apps account
set realname = "Scott Burlington"
set from = "scott@burlresearch.com"
set imap_user = "scott@burlresearch.com"
set imap_pass = "XXX"
set smtp_url = "smtp://scott@burlresearch.com@smtp.gmail.com:587/"
set smtp_pass = "XXX"
set folder = imaps://imap.gmail.com/
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
@burlresearch
burlresearch / gist:6091421
Created July 26, 2013 19:07
cintia.si.2013
$ curl http://i.cdn.turner.com/si/pr/subs/swimsuit/images/13/13_cintia-dicker_[01-30].jpg -o cintia-2013-#1.jpg
@burlresearch
burlresearch / apache.sh
Last active December 19, 2015 23:18
preliminary mahout vectors and clustering
#!/bin/bash
MAHOUT_LOCAL=1 # skip hadoop for now
K=3
set -ex
mahout seqdirectory -i issblog -o issblog-seqfiles -ow
#-filter org.apache.lucene.analysis.en.EnglishMinimalStemFilter
#-filter org.apache.lucene.analysis.miscellaneous.StemmerOverrideFilter