Skip to content

Instantly share code, notes, and snippets.

View mattvague's full-sized avatar

Matt Vague mattvague

View GitHub Profile
@mattvague
mattvague / alpine-data-clash.html
Created February 27, 2024 18:30
Example of Alpine.js data clashes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Alpine.js Example</title>
<script>
document.addEventListener('alpine:init', () => {
Alpine.directive('modal', ($el) => {
@mattvague
mattvague / delete-dev-stores.sh
Last active February 7, 2023 01:10
Delete all shopify dev themes for a store
while read i; do echo "Deleting $i" && shopify theme delete --theme $i -f --store=[YOUR STORE NAME] ; done < <(shopify theme list --store=[YOUR STORE NAME] | awk '/Development \(.*\)/ {print $4}' | sed 's/#//')
/**
* @typedef {import('mdast').Root} Root
* @typedef {import('mdast-util-math')} DoNotTouchAsThisImportIncludesMathInTree
* @typedef Options
* @property {string} [startDelimiter=string]
* @property {string} [endDelimiter=string]
*/
import {visit, CONTINUE} from 'unist-util-visit'
import * as acorn from 'acorn'
name: ci
on:
push:
paths-ignore:
- 'README.md'
- 'docs/**'
env:
PGUSER: postgres
PGPASSWORD: postgres
jobs:
@mattvague
mattvague / Normalizing-Denormalizing-JSONAPI-in-redux.js
Last active January 14, 2019 18:18
How I do Normalizing / Denormalizing of JSONAPI data in redux
//
// This is quick demo of how I currenty normalize / denormalize JSON API responses into redux
//
import normalize from 'json-api-normalizer'
// Given this example response from a JSONAPI endpoint
const json = {
data: [{
import React from 'react'
import { PureComponent } from 'react'
class ScrollVelocity extends PureComponent {
constructor (props, context) {
super(props, context)
this.state = {
lastScrollTop: 0,
lastScrollLeft: 0,
namespace :invalid_records do
task check: [:environment] do
puts "Checking for invalid records...\n"
invalid_records = []
total_record_count = 0
# Make sure that all AR models are required
Dir["#{Rails.root}/app/models/**/*.rb"].each { |file_path| require file_path rescue nil }
class BulkFileJob
@queue = :bulk
#-----------------------------------------------------------------------------
# Class methods
#-----------------------------------------------------------------------------
def self.perform(bulk_id)
new(bulk_id).perform
// Retina helper mixins for Compass
// http://www.joelambert.co.uk
//
// Copyright 2012, Joe Lambert.
// Free to use under the MIT license.
// http://joelambert.mit-license.org/
// Inline for standard / URL for retina
=inline-background-image-retina($image)
background-image: asset-data-uri($image)
classes =
aClass: class AClass
constructor: ->
alert("A class")
# Should say "A class"
new classes.aClass
class bClass extends classes.aClass
constructor: ->