Skip to content

Instantly share code, notes, and snippets.

James Doyle james2doyle

Block or report user

Report or block james2doyle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
james2doyle / get-shopify-section-as-json.js
Last active Jan 3, 2020
Gets a Shopify section and parses it as JSON
View get-shopify-section-as-json.js
* Get section from the rendering API
* @see
* @param {string} section
* @returns {Promise<Object>}
export async function getSection(section) {
try {
james2doyle / test-file.twig
Created Dec 24, 2019
An example file of most of the things you can do in Twig. Used for building syntax highlighting
View test-file.twig
This is the base template used as the application layout which contains the
common elements and decorates all the other templates.
{% do 1 + 2 %}
{{ attribute(foo, 'data-foo') }}
{% set foo = 'foo' %}
{% set foo = [1, 2] %}
{% set foo = {'foo': 'bar'} %}
james2doyle / test-file.liquid
Created Dec 24, 2019
An example of most of the things you can do in Liquid (Shopify). Used for building syntax highlighting
View test-file.liquid
Hello {{ 'tobi' | upcase }}
Hello tobi has {{ 'tobi' | size }} letters!
Hello {{ '*tobi*' | textilize | upcase }}
Hello {{ 'now' | date: "%Y %h" }}
{% if string contains 'hello' %}
string includes 'hello'
{% endif %}
{% for item in collection reversed %} {{item}} {% endfor %}
james2doyle / async-template.js
Last active Dec 13, 2019
A Vue component that emulates the features of ng-include from Angular v1.x
View async-template.js
import Vue from 'vue';
import axios from 'axios';
const AsyncTemplateComponent = Vue.component('async-template', function(resolve) {
name: 'async-template',
props: {
url: {
type: String,
required: true,
james2doyle / vue.sublime-project
Last active Nov 8, 2019
A Sublime project file for Vue projects
View vue.sublime-project
"folders": [
"file_exclude_patterns": [
"folder_exclude_patterns": [
james2doyle / url-basic-auth
Created Nov 7, 2019
Using the browser URL to do basic auth
View url-basic-auth
View testing.json
james2doyle / load-factories.php
Last active Oct 11, 2019
Load model factories from a different folder in Laravel. Useful for tests that use vendor factories
View load-factories.php
// load factories from a different folder - useful for legacy vendor packages
$this->app->singleton(\Illuminate\Database\Eloquent\Factory::class, function ($app) {
$faker = $app->make(\Faker\Generator::class);
return \Illuminate\Database\Eloquent\Factory::construct($faker, base_path('tests/database/factories'));
james2doyle / delete-duplicate-jobs.sql
Created Oct 7, 2019
An SQL statement for Laravel database queue that removes duplicate jobs
View delete-duplicate-jobs.sql
DELETE `t1` FROM `jobs` `t1`
INNER JOIN `jobs` `t2`
WHERE `t1`.`id` < `t2`.`id`
AND `t1`.`payload` = `t2`.`payload`
james2doyle / zapier-webhook-form.html
Last active Sep 27, 2019
An example of using Zapier webhooks to handle file uploads from HTML forms
View zapier-webhook-form.html
<form action="" method="post" enctype="multipart/form-data">
<label for="name">Name:</label>
<input type="text" name="name" id="name">
<label for="email">Email:</label>
<input type="email" name="email" id="email">
<label for="attachment">Attachment:</label>
<input type="file" name="attachment" id="attachment">
<input type="submit" name="submit" value="Submit">
You can’t perform that action at this time.