Skip to content

Instantly share code, notes, and snippets.

View diva-D's full-sized avatar

David Gentile diva-D

View GitHub Profile
/*
Get a list of all files within the Shopify Admin (/admin/settings/files)
This needs to be run within the Chrome Browser. Paste into the debug console and run...
A text file will download when done.
*/
(function(){
var debug = false; // enable logging
r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"
r"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"
dicts = [{...},{...}, {...}]
with open('output.json', 'w') as f:
json_data = json.dumps(dicts)
f.write(json_listings)
# git only
git rm -r --cached .env
# commit and push to delete (but still in previous history)
# remove from Github history
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch .env" HEAD
git push --force
# file still there but content will be empty
@diva-D
diva-D / Setup mock dynamodb table for testing.py
Created April 27, 2022 22:02
This example also shows how to use it for the "Flow" framework to replace the automatically created database instance with the mock one
import os
import boto3
import pytest
from moto import mock_dynamodb2
from flow import Flow, FlowDynamoDB
flow = Flow(name="test", database=FlowDynamoDB())
def create_table():
@diva-D
diva-D / html coverage config file.txt
Created May 26, 2022 04:05
https://coverage.readthedocs.io/en/6.4/config.html#config omit is for files/folders you want to not be included in report exclude lines are the ones that shouldn't be covered in report
[run]
omit = *tests*, *venv*, */usr/local/lib*, config.py
[report]
exclude_lines =
if __name__ == .__main__.:
@diva-D
diva-D / Airtable metadata.js
Last active June 8, 2022 01:40
Visit https://airtable.com/api and select a base. Then open your browsers console (Developer Tools) and run the following https://community.airtable.com/t/metadata-api-for-schema-and-mutating-tables/1856/6
var myapp = {
id:window.application.id,
name:window.application.name,
tables:[]
};
for (let table of window.application.tables){
var mytable = {
id:table.id,