Skip to content

Instantly share code, notes, and snippets.

@MartinMuzatko
MartinMuzatko / gist:18bfb4f72de5abca72c40c22a202ba9c
Last active April 27, 2024 05:41
Information Architecture Cheatsheet
How do you get that JSON?
Data is what drives our apps and tools.
Whenever you need data, you need to figure out what is the best way to use that data in the front-end.
Depending on your options and the way you use that data, you can figure out what to do with it.
Control over the data
Does it belong to you? Have you created the data?
Can you host it?
Is it static?
Is it dynamic?
Does it have to be managed? By Who?
@mandiwise
mandiwise / Sync gh-pages + master branches
Last active April 27, 2024 05:41
Keep gh-pages up to date with a master branch
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/
$ git add .
$ git status // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin master
$ git checkout gh-pages // go to the gh-pages branch
$ git rebase master // bring gh-pages up to date with master
$ git push origin gh-pages // commit the changes
@dhh
dhh / linux-setup.sh
Last active April 27, 2024 05:40
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl docker.io \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@AnalyzePlatypus
AnalyzePlatypus / getImageKitModifiers.js
Created September 5, 2019 10:18
Generate image editing modifiers for ImageKit.io
/*
Usage:
import getImageKitModifierQueryString from "getImageKitModifiers.js";
const IMAGEKIT_CDN_ROOT = "https://ik.imagekit.io/my-app/";
const myImageKey = "image.jpg";
const modifierQueryString = getImageKitModifierQueryString({
width: 45,
readFileAsync(file) {
return new Promise((resolve, reject) => {
let reader = new FileReader()
reader.onload = () => {
resolve(reader.result)
}
reader.onerror = reject
@sainf
sainf / jsPDF_line_wrap.md
Last active April 27, 2024 05:40 — forked from AnalyzePlatypus/jsPDF_line_wrap.md
Helper function for line-wrapping in jsPDF
@AnalyzePlatypus
AnalyzePlatypus / jsPDF_line_wrap.md
Last active April 27, 2024 05:39
Helper function for line-wrapping in jsPDF
@AnalyzePlatypus
AnalyzePlatypus / jsPDF_convert_points_to_other_units.js
Last active April 27, 2024 05:39
jsPDF helper function: Convert points to other units
function convertPointsToUnit(points, unit) {
// Unit table from https://github.com/MrRio/jsPDF/blob/ddbfc0f0250ca908f8061a72fa057116b7613e78/jspdf.js#L791
var multiplier;
switch(unit) {
case 'pt': multiplier = 1; break;
case 'mm': multiplier = 72 / 25.4; break;
case 'cm': multiplier = 72 / 2.54; break;
case 'in': multiplier = 72; break;
case 'px': multiplier = 96 / 72; break;
case 'pc': multiplier = 12; break;

Stripe Checkout: Multiple Checkout buttons on the same page

Suppose you have a Stripe Checkout page setup to sell a product.

To link to your payment page, you must generate a Checkout button HTML snippet for display on your site. However, the default snippet only supports one Checkout button. You cannot have several Checkout buttons for the same product on the same page.

This gist modifies Stripe's generated snippet to support several buttons.

Using (and debugging) Pre-signed S3 URLS

Architecture - A Brief Overview

A Pre-signed URL is used to allow untrusted users to temporary access to private S3 resources. (Example: upload an image to a private S3 bucket).

The URL is a string consists of:

  1. AWS URL of the object to be accessed, and
  2. A signed base64 string describing the HTTP request: