Skip to content

Instantly share code, notes, and snippets.

View richardcalahan's full-sized avatar
🎯
Focusing

Richard Calahan richardcalahan

🎯
Focusing
View GitHub Profile
WITH
custom_values AS (
SELECT
location_id,
COALESCE(
JSONB_OBJECT_AGG(name, value) FILTER (WHERE name IS NOT NULL),
'{}'
) AS data
FROM custom_values
GROUP BY location_id
#!/bin/bash
BUCKET="sgw-pd-t1"
PAGE_SIZE=10
# Search and replace this key
NEW_META_KEY="file-permissions"
NEW_META_VALUE="0777"
# can manually set in case of script failure, new token is output every `PAGE_SIZE` requests.
@richardcalahan
richardcalahan / lakeandskye.test
Last active September 21, 2023 13:49
lakeandskye.test
server {
listen 80;
server_name api.lakeandskye.test;
return 301 https://api.lakeandskye.test$request_uri;
}
server {
listen 80;
server_name cms.lakeandskye.test;
return 301 https://cms.lakeandskye.test$request_uri;
@richardcalahan
richardcalahan / commoncitizen.test
Created March 9, 2022 13:31
Craft CMS - NGINX
server {
listen 80;
server_name api.commoncitizen.test;
return 301 https://api.commoncitizen.test$request_uri;
}
server {
listen 80;
server_name cms.commoncitizen.test;
return 301 https://cms.commoncitizen.test$request_uri;
import Promise from 'bluebird'
import Cookies from 'js-cookie'
export const init = () => {
return Promise.map(window.vinoshipper.accounts, account => {
return $
.get(`https://vinoshipper.com/json-api/v2/wine-list?id=${account.id}`)
.then(data => {
account.shipsTo = data.shipsTo
account.wines = data.wines
@richardcalahan
richardcalahan / checkout.tag
Last active October 30, 2020 21:37
Lake and Skye - Narritiv Checkout Script
<script type="text/javascript">
var productsPurchased = [];
var orderTotal = 0;
{% for item in checkout.order.line_items %}
productsPurchased.push({
product_id: '{{ item.variant_id }}',
product_name: '{{ item.title }}',
product_brand: '{{ item.vendor }}',
product_size: '{{ item.grams }}',
product_price: '{{ item.final_price }}',
@richardcalahan
richardcalahan / new.js
Last active June 23, 2020 17:49
userCreateProps
exports.userCreateProps = functions.auth.user().onCreate( (user) => {
const props = {};
props["email"] = user.email;
if ( user.displayName ) {
props["displayName"] = user.displayName;
}
if ( user.phoneNumber ) {
props["phoneNumber"] = user.phoneNumber;
{
"development": {
"shopify_api_key":"[your key]",
"shopify_password":"[your password]",
"shopify_url":"[your dev shop url]",
"shopify_theme":"[the theme id to sync to]"
}
}
@richardcalahan
richardcalahan / README
Created April 24, 2012 21:13
PhoneGap HTML config
NOTES!
This is the single html page to be loaded by phonegap.
The only elements to be hard coded are the initial host locations for the
css/js assets. Currently set to my rails app on the network.
(note, localhost won't work in development. Must be an explicit IP)
In a phonegap app, we have to explicitly declare a host for all ajax request.
This is because the main html page is not being served from a web server.