Skip to content

Instantly share code, notes, and snippets.

@codingphasedotcom
codingphasedotcom / custom-sessions.js
Created October 21, 2021 18:04
Shopify APP CLI MYSQL Prisma Custom Session Storage
import { PrismaClient } from '@prisma/client';
import Shopify from '@shopify/shopify-api';
import { Session } from '@shopify/shopify-api/dist/auth/session';
const prisma = new PrismaClient();
module.exports.storeCallback = async function storeCallback(session){
console.log('Running storeCallback')
const payload = { ...session }
\documentclass[sigconf,anonymous=$anonymous$]{acmart}
\usepackage{booktabs}
\usepackage{caption} % http://mirror.easyname.at/ctan/macros/latex/contrib/caption/caption-eng.pdf
\usepackage{balance} % balancing bibstyles as per request in accepted submission
\usepackage{graphicx}
% We will generate all images so they have a width \maxwidth. This means
% that they will get their normal width if they fit onto the page, but
% are scaled down if they would overflow the margins.
% curl -v \
-F comment='kommentar' \
-F filename=filnavn.pdf \
-F attachToPayment=false \
-F attachToSale=true \
-F file=@vedlegg.pdf \
-H "Authorization: Bearer <token>" \
https://api.fiken.no/api/v2/companies/<companyname>/sales/<salesid>/attachments
> POST /api/v2/companies/fiken-demo-god-og-tydelig-musikk-as/sales/1029625303/attachments HTTP/1.1
@ZackBoe
ZackBoe / _directories.md
Last active January 18, 2019 16:52
Generate netlify _redirects from Hugo data file for editing in Forestry.io
  • config.toml: /config.toml
  • index.redir: /layouts/index.redir
  • redirects-json.yml: .forestry/front_matter/templates/redirects-json.yml
  • redirects.json: /data/redirects.json
@mayo
mayo / instagram_import.py
Last active May 29, 2021 19:02
Import instagram data into a static site (Jekyll, Hugo, Hana, Metalsmith, etc)
import codecs
from datetime import datetime
import json
import os
import posixpath
import re
import shutil
import sys
# This script will import your instagram photos to your static site. It should work for most, assuming you customize the POST_TEMPLATE to match what your site uses.
@randallmlough
randallmlough / hugo-img-partial.html
Last active June 21, 2021 01:36
Complete hugo img partial using page resources
{{ $image := .Params.image}}
{{ $media := (.Site.GetPage "page" "media").Resources }}
{{ $original := index ($media.Match (printf "%s" $image)) 0 }}
{{ $width := $original.Width}}
{{ $intWidth := int $width }}
{{ $sizes := .Params.sizes}}
{{ $options := .Params.options}}
{{ if le (len $sizes) 1 }}
{{ $oneSize := index $sizes 0}}
@igorbenic
igorbenic / block.js
Last active April 22, 2022 22:25
Gutenberg Select Post - Duplicate Controls
/**
* BLOCK: my-block
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
// Import CSS.
import './style.scss';
import './editor.scss';
@Aerijo
Aerijo / latex_in_atom.md
Last active July 31, 2023 09:31
Setting up Atom for LaTeX

Disclaimer: I wrote the packages language-latex2e, autocomplete-latex, latex-wordcount, and hyperclick-latex. I still try to provide a list of all useful packages though, so let me know if I have missed one.

This is a general guide for how to get started with LaTeX in Atom.

NOTE: This guide assumes you already have LaTeX installed on your computer. If you do not, I recommend TeX Live.

@budparr
budparr / figure.html
Last active September 23, 2020 15:39
Hugo "figure" shortcode that works with https://github.com/aFarkas/lazysizes and uses `markdownify` for title and caption #gohugo
<!-- image -->
<figure {{ with .Get "class" }}class="{{.}}"{{ end }}>
{{ with .Get "link"}}<a href="{{.}}">{{ end }}
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }} class="lazyload" />
<noscript>
<img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}/>
</noscript>
{{ if .Get "link"}}</a>{{ end }}
{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
<figcaption>{{ if isset .Params "title" }}
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A