Skip to content

Instantly share code, notes, and snippets.

View sdeering's full-sized avatar

Sam Deering sdeering

View GitHub Profile
@sdeering
sdeering / gist:8437725
Created January 15, 2014 14:55
Some .bashrc git alias commands
#-------------------------------------------------------------
# Git Alias Commands
#-------------------------------------------------------------
alias g="git status"
alias ga="git add"
alias gaa="git add ."
alias gau="git add -u"
alias gc="git commit -m"
alias gca="git commit -am"
alias gb="git branch"
@sdeering
sdeering / gist:9bf9bb2ea879ac760cf0dfa19621dbbb
Last active September 12, 2023 06:51
Connect to Sorare API Using PHP + GraphQL
// This script connects to Sorare API to get perform GraphQL queries using PHP
// Playground: https://api.sorare.com/federation/graphql/playground
/*
Steps:
1. Get user salt from Sorare
2. Hash password with salt
3. Get JWT token with email, password hash & aud from Sorare
4. Perform GraphQL query
*/
/**
* Send Google analytics tracking event.
*
* @param mixed $action
* Event action.
*/
public function sendGoogleTrackingEvent($action) {
if (!$this->isProduction()) return;
$googleAnalyticsUA = 'UA-XXXXXXXX-XX';
<?php
/**
* @file
* DB post-updates for blocks.
*/
use Drupal\block_content\Entity\BlockContent;
/**
@sdeering
sdeering / Drupal 8 Custom Block Access Plugin
Created August 28, 2019 01:48
Adds a new tab in the block settings to control the block visibility based on a custom field
<?php
namespace Drupal\slq_blocks\Plugin\Condition;
use Drupal\Core\Condition\ConditionPluginBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a 'Site Theme' condition.
*
@sdeering
sdeering / generate xml sitemap using bash script and jq to fetch remote json
Last active August 9, 2019 04:34
generate xml sitemap using bash script and jq to fetch remote json
#!/bin/bash
# Bash script to generate a sitemap.xml from external json data
# Author: Sam Deering
# POSIX variable reset in case getopts has been used previously
OPTIND=1
# Initialize our own variables:
URL='http://localhost:4200/items.json'
curl http://localhost:4200/assets/settings/collections.json | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["data"]'
@sdeering
sdeering / console-sass-version.json
Last active March 23, 2017 06:48
console-sass-version
{
"minimum_web_client_version": "master-1094"
}
@sdeering
sdeering / gist:8035033
Created December 19, 2013 06:00
Use grunt connect to make the karma test coverage directory browseable.
coverage: {
options: {
// required for output on index.html base filepath
base: __dirname + 'test/coverage/',
// required to override base to make the directory browseable
directory: __dirname + 'test/coverage/',
port: '5555',
keepalive: true
}
}
@sdeering
sdeering / tmux.conf
Created November 28, 2013 09:36
My Tmux Config Linux
# remap prefix to Control + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# quick pane cycling