Skip to content

Instantly share code, notes, and snippets.

@glued
glued / background.js
Last active January 21, 2022 19:20
Tabbycat ~ Chrome extension to group tabs into tabGroups by domain
const URL_REGEX = /^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/gim;
const GOOG = ".google.com";
const domainFromUrl = (url) => {
if (url.includes(GOOG)) {
const segments = url.split("/");
const googIdx = segments.findIndex((item) => item.includes(GOOG));
return segments[googIdx + 1];
}
@glued
glued / golf.js
Last active January 9, 2022 02:35
Gas Pump Golf Perfect score (https://gaspumpgolf.github.io/)
// 1. https://gaspumpgolf.github.io/
// 2. Click play
// 3. Open console
// 4. Paste code and press enter
const down = new MouseEvent("mousedown", { bubbles: true, cancelable: true, view: window });
const up = new MouseEvent("mouseup", { bubbles: true, cancelable: true, view: window });
const btn = document.querySelector('#content > button');
const target = document.querySelector('#content > p:nth-child(3) > mark > strong');
const sale = document.querySelector('#content > p:nth-child(5) > strong');
const observer = new MutationObserver((val)=>{
const data = ['foo', 'bar', 'baz'];
const data2 = {
foo: {
bar: 123,
baz: [
{ title: 'foo', value: 'bar' },
{ title: 'a', value: 'a' },
{ title: 'b', value: 'b' },
],
@glued
glued / deno.ts
Last active May 13, 2020 05:21
denoland
console.log("Welcome to Denos5 🦕");
@glued
glued / deno.ts
Created May 13, 2020 05:12
denoland
console.log("Welcome to Deno 🦕");
@glued
glued / theme.js
Last active October 8, 2019 19:31
Check for OS Dark Theme in the browser
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
@glued
glued / deep-copy-decorator.ts
Created March 8, 2019 05:11
Deep Copy Decorator
function DeepCopy() {
return function(target: any, key: string) {
let value = target[key];
return Object.defineProperty(target, key, {
configurable: true,
get: () => value,
set: val => {
value = JSON.parse(JSON.stringify(val));
},
});
{
"presets": ["es2015", "stage-0"]
}
@glued
glued / ThreejsExportScript.mel
Last active August 29, 2015 14:25
Maya exporter mel script modified because it doesnt save settings
// ThreeJsExportScript.mel
// Author: Sean Griffin
// Email: sean@thoughtbot.com
global proc int ThreeJsExportScript(string $parent, string $action, string $settings, string $callback)
{
if ($action == "post")
{
setParent $parent;
columnLayout -adj true;
@glued
glued / Threejs_maya
Last active August 29, 2015 14:24
Modified THREEJS Maya plugin
__author__ = 'Sean Griffin'
__version__ = '1.0.0'
__email__ = 'sean@thoughtbot.com'
import sys
import os.path
import json
import shutil