Skip to content

Instantly share code, notes, and snippets.

View ashsmith's full-sized avatar
:shipit:

Ash Smith ashsmith

:shipit:
View GitHub Profile
@lobster1234
lobster1234 / localstack.md
Last active August 8, 2023 20:06
Working with localstack on command line

Starting localstack

C02STG51GTFM:localstack mpandit$ make infra
. .venv/bin/activate; exec localstack/mock/infra.py
Starting local dev environment. CTRL-C to quit.
Starting local Elasticsearch (port 4571)...
Starting mock ES service (port 4578)...
Starting mock S3 server (port 4572)...
Starting mock SNS server (port 4575)...
@erikhansen
erikhansen / 1_product_queries.sql
Last active April 2, 2024 01:48
Magento 2 - Remove duplicate store view-specific product and category data
/*
* IMPORTANT: The queries below are written for Magento Enterprise. If you're going to run them on Magento Community, you need
* to replace all instances of ".row_id" with ".entity_id". See this for context: http://magento.stackexchange.com/questions/139740/magento-2-schema-changes-for-ee-catalog-staging
*
* When importing products in Magento 2, if you specify store view codes in the store_view_code column, product data will be set at
* both the global scope as well as the specific store view scope. This is not ideal because now you have duplicate
* data at two different scopes that shouldn't actually be duplicated. The scripts below clean up this data by finding
* data set at specific store view scopes and if it's an exact match to the data set at the global store view, then it
* deletes the data set at the specific store view scope.
*
@bobbyshaw
bobbyshaw / service-worker-init.js
Last active December 22, 2019 13:09
Jekyll Service Worker - Cache First, Network Fallback
/**
* Manage service worker setup
*
* @constructor
*/
function ServiceWorkerSetup() {
this.init();
};
/**
@tkh44
tkh44 / sw.js
Created November 4, 2016 18:55
Example of syncing some redux state with a service worker
const swSupported = !!('serviceWorker' in navigator)
const sendMessage = (messageData) => {
if (!swSupported) {
return
}
navigator.serviceWorker.controller.postMessage(messageData)
}
@ralphschindler
ralphschindler / README.md
Last active September 30, 2023 19:28
Docker For Mac Host Address Alias To Enable PHP XDebug (10.254.254.254 Trick)

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loopback device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254.

Once your machine has a well known IP address, your PHP container will then be able to connect to it, specifically XDebug can connect to it at the configured xdebug.remote_host.

Installation Of IP Alias (This survives reboot)

Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

@cdipaolo
cdipaolo / HaversinFormula.go
Created April 15, 2015 01:31
Golang functions to calculate the distance in meters between long,lat points on Earth.
// haversin(θ) function
func hsin(theta float64) float64 {
return math.Pow(math.Sin(theta/2), 2)
}
// Distance function returns the distance (in meters) between two points of
// a given longitude and latitude relatively accurately (using a spherical
// approximation of the Earth) through the Haversin Distance Formula for
// great arc distance on a sphere with accuracy for small distances
//
@joost
joost / ruby_google_analytics_server_to_server.md
Last active November 27, 2023 15:43
Google Analytics API (server-to-server) using Ruby