Skip to content

Instantly share code, notes, and snippets.

View tommymarshall's full-sized avatar

Tommy Marshall tommymarshall

View GitHub Profile
<?php
class ImportGrantRecordJob extends Job
{
/**
* Workflow States that may be imported
*
* @var array
*/
private $allowableStates = [
@tommymarshall
tommymarshall / splicey.js
Created January 13, 2016 19:44
recreating Array.splice from scratch
Array.prototype.splicey = function(position, number, values) {
if (!position) return this
var newNumber = number || this.length
var newThis = []
for (var i = position; i <= position + newNumber; i++) {
if (values) {
if (Array.isArray(values)) {
this[i].push(values)
@tommymarshall
tommymarshall / ForumVariable.php
Last active January 12, 2016 01:49
Attempting to retrieve nested data for a relationship
<?php
namespace Craft;
class ForumVariable
{
public function getThreadById($id)
{
$record = craft()->forum_thread->getThreadById($id);
// This gets me the nested relationship data I am wanting (user.email, user.fullName, etc)
@tommymarshall
tommymarshall / commands.log
Created December 6, 2015 16:19
Errors encountered when installing gulp-starter
npm WARN engine hoek@2.16.3: wanted: {"node":">=0.10.40"} (current: {"node":"0.10.33","npm":"1.4.28"})
> spawn-sync@1.0.13 postinstall /home/forge/default/node_modules/gulp-sass/node_modules/node-sass/node_modules/cross-spawn/node_modules/spawn-sync
> node postinstall
Installing native dependencies (this may take up to a minute)
> node-sass@3.4.2 install /home/forge/default/node_modules/gulp-sass/node_modules/node-sass
> node scripts/install.js
@tommymarshall
tommymarshall / fluxx_error.txt
Created November 10, 2015 16:09
Error respons
POST /oauth/token HTTP/1.1 Host: atlantic.fluxx.io User-Agent: Guzzle/5.3.0 curl/7.35.0 PHP/5.6.11-1+deb.sury.org~trusty+1 Content-Length: 183 Content-Type: application/x-www-form-urlencoded client_id=ad05a03232c9dd20a1617ba92002d53f1dc162508f9da1863f79070ad2b6b7f9&client_secret=49454209df1414818a75808eb5fafc68b1d56fcb52549ed269b82047ab79e249&grant_type=client_credentials HTTP/1.1 401 Unauthorized cache-control: no-store Content-Type: application/json; charset=utf-8 Date: Tue, 10 Nov 2015 16:08:36 GMT pragma: no-cache Server: Apache Status: 401 Unauthorized Strict-Transport-Security: max-age=8640000 X-Frame-Options: SAMEORIGIN x-rack-cache: invalidate, pass x-request-id: c35d5d1700ef86fa26682c0fa2d9863c x-ua-compatible: IE=Edge,chrome=1 Content-Length: 173 Connection: keep-alive {"error":"invalid_client","error_description":"Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method."} POST /oauth/token HTTP/1.1 Host: atlantic.fluxx.io User-Agen
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"caret_extra_width": 2,
"caret_style": "wide",
"close_windows_when_empty": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"detect_indentation": true,
"draw_centered": true,
"draw_white_space": "all",
@tommymarshall
tommymarshall / general.php
Created September 25, 2015 15:11
Craft CMS general.php using .env files
<?php
return [
'allowAutoUpdates' => getenv('CRAFT_ENVIRONMENT') === 'development',
'devMode' => getenv('CRAFT_ENVIRONMENT') === 'development',
'environmentVariables' => [
'env' => getenv('CRAFT_ENVIRONMENT'),
'siteUrl' => getenv('CRAFT_SITE_URL'),
],
];
@tommymarshall
tommymarshall / _grid.sass
Created September 2, 2015 17:33
How I do a grid.
// Variables
$total-columns : 14
$grid-max-width : 1400px
$max-page-width : 1800px
$column-gutter : 0%
$column-width : (100 - $column-gutter * ($total-columns - 1)) / $total-columns
$span-real-width : round($grid-max-width * $column-width / 100%)
// Mixins
=space-span($space, $span: 1)
@tommymarshall
tommymarshall / ribs.jsx
Last active August 29, 2015 14:21
simple ajax fill options
var React = require('react')
var request = require('superagent')
module.exports = React.createClass({
getInitialState: function() {
return {
ready : false,
options : [],
}
@tommymarshall
tommymarshall / deploy.rb
Last active August 29, 2015 14:21
Backup for capistrano-wpcli
time = Time.new
backup_timestamp = time.strftime("%Y%m%d%H%M")
set :db_backup_file_name, -> {"wpcli_db_backup.#{backup_timestamp}.sql.gz"}
set :local_db_folder_path, -> {"./db_backups"}
set :local_db_folder_file_path, -> {"./db_backups/#{fetch(:db_backup_file_name)}"}
set :remote_db_folder_path, -> {"#{fetch(:deploy_to)}/db_backups"}
set :remote_db_folder_file_path, -> {"#{fetch(:deploy_to)}/db_backups/#{fetch(:db_backup_file_name)}"}
before 'wpcli:db:pull', :backup_local_db do