Skip to content

Instantly share code, notes, and snippets.

View ptz0n's full-sized avatar

Erik Eng ptz0n

View GitHub Profile
{
"add": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M12 4C12.5523 4 13 4.44772 13 5V11H19C19.5523 11 20 11.4477 20 12C20 12.5523 19.5523 13 19 13H13V19C13 19.5523 12.5523 20 12 20C11.4477 20 11 19.5523 11 19V13H5C4.44772 13 4 12.5523 4 12C4 11.4477 4.44772 11 5 11H11V5C11 4.44772 11.4477 4 12 4Z\" fill=\"#3F545B\"/></svg>",
"archive": "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M2 5C2 3.89543 2.89543 3 4 3H20C21.1046 3 22 3.89543 22 5V7C22 7.74708 21.5904 8.39848 20.9835 8.74188C20.9944 8.82638 21 8.91253 21 9V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V9C3 8.91253 3.00561 8.82638 3.0165 8.74188C2.40961 8.39848 2 7.74707 2 7V5ZM20 7V5H4V7H20ZM5 9V19H19V9H5ZM8 12C8 11.4477 8.44772 11 9 11H15C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13H9C8.44772 13 8 12.5523 8 12Z\" fill=\"#3F545B\"/></svg>",
"arrow-down": "<svg width=\"24\" height=\"24\"
@bakura10
bakura10 / microdata-schema.liquid
Last active February 21, 2024 14:49
This is the last microdata-schema for our Shopify themes
{%- comment -%}
This snippet structures the micro-data using JSON-LD specification. Please note that for Product especially,
the schema often changes. We try to output as much info as possible, but Google may add new requirements over time,
or change the format of some info
LAST UPDATE: May 10th 2023 (we added the "hasMerchantReturnPolicy" and "shippingDetails" to include the shipping and
return policy if they have been specified as store policies).
{%- endcomment -%}
{%- if request.page_type == 'product' -%}
@vanjacosic
vanjacosic / gdpr_template.md
Created August 3, 2018 12:36
GDPR email template

Email template for requesting data deletion

To:

Their Data Protection Officer, usually dpo@companyname.com

Subject:

Request for erasure (GDPR)

@nsbingham
nsbingham / local-dnsserver.md
Last active June 5, 2023 21:44
Testing a CNAME

Setting up a local DNS server with bind on OSX Mavericks

This is really just an approach for locally testing DNS changes, which can easily be done with a HOSTS file if the change involves an IP address, but gets a bit trickier when things like CNAMEs are involved. This is only meant to test locally off a single machine.

  1. Install bind using homebrew

    brew install bind

  2. Follow the installation steps to start up bind

@tlrobinson
tlrobinson / post-receive
Last active December 7, 2022 08:15
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f
@SchumacherFM
SchumacherFM / Magento-HHVM.md
Last active May 17, 2018 18:26
Running Magento Enterprise Edition with Facebook HipHop HHVM

Running Magento Enterprise Edition with Facebook HipHop HHVM

Prerequisites

Hardware

MacBook Air (MBA) Mid 2012

@paneq
paneq / page.conf
Created April 3, 2013 14:57
nginx maintenance page that is JSON friendly
if (-f $document_root/system/maintenance.html) {
return 503;
}
error_page 503 @maintenance;
location @maintenance {
internal;
if ($http_accept ~ json) {
return 503 "{}";
}
@steve-taylor
steve-taylor / doSynchronousLoop.js
Last active December 4, 2022 00:51
Synchronous for loop in JavaScript to ensure that the n+1th item isn't processed until the callback of the nth item's processor has been called.
/**
* Process an array of data synchronously.
*
* @param data An array of data.
* @param processData A function that processes an item of data.
* Signature: function(item, i, callback), where {@code item} is the i'th item,
* {@code i} is the loop index value and {@code calback} is the
* parameterless function to call on completion of processing an item.
*/
function doSynchronousLoop(data, processData, done) {
@JoeStanton
JoeStanton / deploy.rb
Created January 25, 2013 10:13
Example Capistrano Deployment file for Node.js Projects
set :application, "SampleApp"
set :repository, "."
set :scm, :none
set :use_sudo, false
set :keep_releases, 5
#Use the copy method which will compress and scp the files
set :deploy_via, :copy
set :main_js, "app.js"
@luishdez
luishdez / redis.sh
Created January 13, 2013 17:27
Redis lua scripts Update Set and Sorted Set only if the value / score is higher or lower …
# Basic benchmarks
# SET key val # 87489.06
# SETRANGE key2 6 "Redis" # 75757.58 req/s
# INCR key 245 # 70224.72 req/s
# INCRBY key 245 22 # 67114.09 req/s
# EVAL SET key val # 46296.29 req/s
# SETIFHIGHER (set or update key if new value is higher than current) # 41666.67 req/s
# if not exists return OK , if updated return the increment , if not updated return 0
SCRIPT LOAD "local c = tonumber(redis.call('get', KEYS[1])); if c then if tonumber(ARGV[1]) > c then redis.call('set', KEYS[1], ARGV[1]) return tonumber(ARGV[1]) - c else return 0 end else return redis.call('set', KEYS[1], ARGV[1]) end"