Skip to content

Instantly share code, notes, and snippets.

View jloosli's full-sized avatar

Jared Loosli jloosli

View GitHub Profile
@jloosli
jloosli / youtube-id-bookmarklet.js
Created March 3, 2023 03:08
bookmarklet to get youtube video id
(function() {
const urlParams=new URLSearchParams(window.location.search);
const id=urlParams.get('v');
navigator.clipboard.writeText(id);
})();
void(0);
@jloosli
jloosli / material_colors.json
Last active July 13, 2018 03:24
Material Colors
{
"Red": {
"50": {
"color": "#FFEBEE",
"txt": "dark"
},
"100": {
"color": "#FFCDD2",
"txt": "dark"
},
@jloosli
jloosli / console.js
Last active July 13, 2018 03:24
Get material colors from Material website (using console)
/* Run the following commands to get colors copied to console */
/* https://material.io/design/color/the-color-system.html#tools-for-picking-colors */
const colors = [];
const pallettes = $$('section.module-module-module');
for (p in pallettes) {const dets = $$('.color-tag', pallettes[p]); for (d in dets) {colors.push([$('.shade', dets[d]).innerHTML, $('.hex', dets[d]).innerHTML, dets[d].classList.contains('light') ? 'light':'dark'])}};
let current = '';
const combo = {};
for(c in colors) {let splt = colors[c][0].split(' '); let wt = splt.pop(); if (splt.length > 0) { current =splt.join(' '); combo[current]={}} let hx=colors[c][1]; combo[current][wt]={color: hx, txt: colors[c][2]};}
copy(combo);
@jloosli
jloosli / python starter.py
Last active September 7, 2023 20:34
python project starter file
#!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
DESCRIPTION GOES HERE
"""
import sys
import os
import traceback
import argparse
@jloosli
jloosli / gf_analytics.php
Created March 2, 2012 22:52
Google Analytics Ecommerce notification for Gravity Forms
<?php
function analytics_confirmation($confirmation, $form, $entry, $ajax = 0)
{
$isProduct = false;
foreach ($form['fields'] as $field) {
if ($field['type'] == 'product') {
$isProduct = true;
$fieldID = $field['id'];
$productSKU = $form['id'] . '-' . str_replace(" ", "_", $field['label']);
break;