Skip to content

Instantly share code, notes, and snippets.

View toklok's full-sized avatar
💭
Permanent 418 status

Joseph Curtis toklok

💭
Permanent 418 status
View GitHub Profile
@getify
getify / 1.html
Last active May 10, 2023 03:25
Ever noticed how vw/vh units in CSS seem to be a bit unreliable on various devices (especially mobile)? Here's my solution.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<title>Test Page</title>
<script>
// early compute the vw/vh units more reliably than CSS does itself
computeViewportDimensions();
@gilakos
gilakos / Astra Developer Sandbox cURL.md
Last active April 15, 2024 16:43
Astra API Endpoints // cURL Collection // Sandbox

Astra Sandbox // cURL collection

User

Authenticate User

curl -X POST 'https://api-sandbox.astra.finance/v1/oauth/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-u your_client_id:your_client_secret \
-d 'grant_type=authorization_code' \
@panoply
panoply / auth.js
Last active April 12, 2023 15:04
Lambda Shopify OAUTH
import { config } from 'dotenv'
import Shopify from 'shopify-api-node'
import cryptographer from '@brixtol/cryptographer'
config()
export const crypto = cryptographer(process.env.SHOPIFY_AUTH_SECRET)
/**
* Request Headers
import m from 'mithril'
import loadjs from 'loadjs'
/* CONSTANTS ---------------------------------- */
const AUTH_API = 'https://api.brixtol.com/shopify/customer/auth'
/**
* Facebook SDK OAuth
*
{%- form 'product'
, product
, data-product-form: ''
, data-product-handle: product.handle
, data-enable-history-state: 'true' -%}
<div
class="row jc-center no-gutters mt-3 product-purchase"
data-controller="purchase"
data-purchase-selected-value="selected">
import { createHash, createDecipheriv, createCipheriv, getCiphers, getHashes } from 'crypto'
import os from 'os'
/**
* Creates hash of an string based on available hashes of platform
*
* @param {string} input
* @param {string} hash
* @returns {string}
*/
import { shopify, headers, crypto } from './connect'
/**
* OAuth
*
* @param {Netlify.NetlifyFunctionEvent} event
* @param {function} callback
*/
export async function Auth ({ queryStringParameters }, callback) {
@drabbytux
drabbytux / plain-js-make-image-change-javascript.js
Last active October 13, 2020 14:02
Thumbnail changes variant, Plain Javascript
document.addEventListener("DOMContentLoaded", function(){
thumbnails = document.querySelectorAll('img[src*="/products/"]');
function addEventListenerList(thumbnails) {
for (var i = 0, len = thumbnails.length; i < len; i++) {
console.log(thumbnails[i].currentSrc);
thumbnails[i].addEventListener('click', thumbImageSwap, false);
}
}
function thumbImageSwap(){
import m from 'mithril'
export default ({
lowStock,
remains,
name,
colour,
price,
pricing,
percent,
@mickeypash
mickeypash / gist:b0b22ab84495fe4b033895a79dd78468
Last active February 5, 2024 13:21
George Hotz - talking hour - 2020-08-31