Skip to content

Instantly share code, notes, and snippets.

@Meorawr
Meorawr / GTT_CreatureInspect.lua
Last active August 30, 2024 20:23
Creature Spawn Inspector
--
-- Creature GUID Inspector
--
function GTT_CreatureInspect(self)
local _, unit = self:GetUnit();
local guid = UnitGUID(unit or "none");
local prefix = string.match(guid, "^([CVP][^l][^-]+)");
if not guid or not prefix then
@Wetxius
Wetxius / ObjectiveTracker.lua
Created November 25, 2020 14:51
ShestakUI\Modules\Quests\ObjectiveTracker.lua
local T, C, L, _ = unpack(select(2, ...))
----------------------------------------------------------------------------------------
-- Move ObjectiveTrackerFrame and hide background
----------------------------------------------------------------------------------------
local frame = CreateFrame("Frame", "ObjectiveTrackerAnchor", UIParent)
frame:SetPoint(unpack(C.position.quest))
frame:SetSize(224, 150)
ObjectiveTrackerFrame:ClearAllPoints()
@DesignFront
DesignFront / detect-dark-mode.js
Last active September 12, 2021 20:04
Detect Darkmode
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
// dark mode
}
// to watch for changes:
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
console.log(`changed to ${e.matches ? "dark" : "light"} mode`)
});
@mmazzarolo
mmazzarolo / service-workers.md
Last active April 22, 2024 03:40
Service Workers Tips

Service Workers Tips

Reloading a service worker

Reloading a page won't update/remove the previous version of its service worker. To make sure you're using the latest version of your service worker, make sure to check the "Update on reload" toggle in the "Application" ⭢ "Service Workers" section of the Chrome DevTools.

Simulate a network condition

To simulate a network condition (e.g.: offline, 3g, etc...) in a service worker on Chrome, uncheck the "Update on reload" toggle.

@kripod
kripod / cssPropertyPrefixesAndAlternativeNames.mjs
Last active September 1, 2020 22:02
Retrieve vendor prefixes and alternative names for every CSS property with Browserslist and mdn-browser-compat-data
import browserslist from "browserslist";
import compareVersions from "compare-versions";
import bcd from "mdn-browser-compat-data";
function normalizeVersion(version) {
return version.replace("≤", "");
}
const browsersByBrowserslistId = new Map([
/* Keys: https://github.com/browserslist/browserslist#browsers */
@kripod
kripod / alternativeCSSPropertiesByStandardName.js
Last active September 1, 2020 22:03
CSS – Properties with alternative names
/* Gathered from mdn-browser-compat-data using the default browserslist config */
export const alternativeCSSPropertiesByStandardName = [
"color-adjust": ["-webkit-print-color-adjust"],
"grid-auto-columns": ["-ms-grid-columns"],
"grid-auto-rows": ["-ms-grid-rows"],
"overflow-wrap": ["word-wrap"],
"scroll-margin-bottom": ["scroll-snap-margin-bottom"],
"scroll-margin-left": ["scroll-snap-margin-left"],
"scroll-margin-right": ["scroll-snap-margin-right"],
import requests
url = 'https://github.com/roundcube/roundcubemail/releases/latest'
r = requests.get(url)
version = r.url.split('/')[-1]
print(version)
@orta
orta / main.gif
Last active June 19, 2023 12:09
Yesterday's PRs:
main.gif
@dpoulopoulos
dpoulopoulos / nlsh.py
Last active May 20, 2024 04:45
OpenAI natural language shell example.
prompt = """
Input: Print the current directory
Output: pwd
Input: List files
Output: ls -l
Input: Change directory to /tmp
Output: cd /tmp