Skip to content

Instantly share code, notes, and snippets.

Avatar

James Doyle james2doyle

View GitHub Profile
@james2doyle
james2doyle / Node Build.sublime-build
Last active Jul 28, 2020
A sublime build system for better Node.js output by highlighting with the right syntax
View Node Build.sublime-build
{
"target": "node_build",
"selector": "source.js",
"variants": [
{
"name": "JSON Output",
"json": true
}
]
}
@james2doyle
james2doyle / .editorconfig
Created Jul 27, 2020
Basic editor config file that applies rules to all files the same way
View .editorconfig
# EditorConfig is awesome: https://EditorConfig.org
# Get the plugin: https://editorconfig.org/#download
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
@james2doyle
james2doyle / shopify-template-links.md
Last active Jul 24, 2020
A list of links to the documentation for the required templates in a Shopify theme
@james2doyle
james2doyle / Popover.vue
Last active Jul 24, 2020
A popover component for Vue.js
View Popover.vue
<!--
Popover Component
Usage:
<popover class="ml-3 inline-block align-text-top" v-cloak>
<template #icon>
<div class="w-5 icon-plus"></div>
</template>
<template #content>
<strong>Title</strong>
@james2doyle
james2doyle / hot-reload.js
Created Jul 23, 2020
Simple hot reload snippet
View hot-reload.js
if (module.hot) {
// reload the page when this global code is changed
module.hot.accept([
'./hot-reload.js', // same name as this file!
], window.location.reload);
}
@james2doyle
james2doyle / android-create-keystore.sh
Created Jul 17, 2020
React native android automated build with a downloadable APK output
View android-create-keystore.sh
#!/usr/bin/env bash
cd android && keytool -genkey -v -keystore keystores/release-key.keystore -storepass MYAPP -alias MYAPP -keypass MYAPP -keyalg RSA -keysize 2048 -validity 10000 -dname \"CN=Android,O=Android,C=US\"
View get-shopify-metafields.py
# Usage:
# python3 check-metafields.py # everything
# python3 check-metafields.py products # just products
# python3 check-metafields.py collections # just collections
# python3 check-metafields.py {PRODUCT_ID} # a specific product ID
#
import http.client
import json
import sys
View sign-apk.sh
#!/usr/bin/env bash
rm app/build/outputs/apk/release/app-release-unsigned-aligned.apk
rm app/build/outputs/apk/release/app-release.apk
$HOME/Library/Android/sdk/build-tools/29.0.0-rc3/zipalign -v -p 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release-unsigned-aligned.apk
$HOME/Library/Android/sdk/build-tools/29.0.0-rc3/apksigner sign --ks android.keystore --out app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/app-release-unsigned-aligned.apk
echo "signed: app/build/outputs/apk/release/app-release.apk"
@james2doyle
james2doyle / docker-compose.yml
Created Jul 15, 2020
Use docker to showcase streaming with nginx rtmp
View docker-compose.yml
version: '3'
services:
web:
image: tiangolo/nginx-rtmp
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "8080:80"
- "1935:1935"
@james2doyle
james2doyle / cache-buster.js
Last active Jul 14, 2020
A cache-busting pattern based on a version file. Checks to see if an hour has passed before clearing or reseeding
View cache-buster.js
// <meta name="build-version" content="build-12345" />
// window.localStorage.setItem('cacheTime', '{{ date("%H") }}');
const CACHE_TIME = Number(window.localStorage.getItem('cacheTime') || '0');
const CURRENT_TIME = (new Date).getHours();
/**
* The path to fetch the version text file from
*
* @type {String|null} VERSION_PATH
*/
You can’t perform that action at this time.