Skip to content

Instantly share code, notes, and snippets.

@drunkensouljah
drunkensouljah / get_url.scpt
Created November 12, 2021 20:58 — forked from prashanthrajagopal/get_url.scpt
AppleScript to get url from Safari, Firefox and Chrome
display dialog "Name of the browser?" default answer "Safari"
set inp to text returned of result
tell application "System Events"
if inp is "Google Chrome" then
tell application "Google Chrome" to return URL of active tab of front window
else if inp is "Safari" then
tell application "Safari" to return URL of front document
else if inp is "Firefox" then
tell application "Firefox" to activate
@drunkensouljah
drunkensouljah / OSX-Dock-Spacers.md
Created November 12, 2021 20:51 — forked from lukeed/OSX-Dock-Spacers.md
OSX Dock Spacers

Huh?

Some MacOS users have very cluttered Docks & wish they could organize them without removing any App icons from the mix.

This snippet will add an empty "spacer" that you can drag around and use to separate icons into groups! See example.

Command

Paste this into your Terminal. Run the command for additional placeholders!

@drunkensouljah
drunkensouljah / TelekomDataUsage.js
Created September 7, 2021 21:47 — forked from Sillium/TelekomDataUsage.js
Telekom Data Usage - iOS 14 Widget for Scriptable app
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: pink; icon-glyph: exchange-alt;
const DEBUG = false
const log = DEBUG ? console.log.bind(console) : function () { };
// configure the library
const libraryInfo = {
name: 'TelekomDataUsageLibrary',
version: '1.0.3',
@drunkensouljah
drunkensouljah / wordpressPluginStats.js
Created September 7, 2021 21:46 — forked from danielmilner/wordpressPluginStats.js
WordPress plugin stat widget for iOS 14 and Scriptable app
/**
* Setup Begin
*/
const pluginSlug = "hey-notify";
const backgroundColor = "#009bff"; // In HEX format
const textColor = "#ffffff"; // In HEX format
/**
* Setup End
*/
@drunkensouljah
drunkensouljah / benzinpreis-widget.js
Created September 7, 2021 21:45 — forked from andreasRedeker/benzinpreis-widget.js
A Scriptable widget, that shows you the cheapest gas station near you (for germany only)
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-blue; icon-glyph: gas-pump;
// share-sheet-inputs: plain-text;
// Script by Andreas Redeker <hello@andreasredeker.de>
// Get your own API key from https://creativecommons.tankerkoenig.de/
const apiKey = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
const radius = 3
@drunkensouljah
drunkensouljah / index.html
Created December 6, 2020 02:04
HTML Skeleton
<!DOCTYPE html>
<html lang="en">
<head>
<title>Your Page Title</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Your name">
<meta name="description" content="Brief description">
const apiUrl = "https://pass.telekom.de/api/service/generic/v1/status"
let widget = await createWidget()
widget.backgroundColor = new Color("#777777")
if (!config.runsInWidget) {
await widget.presentSmall()
}
Script.setWidget(widget)
Script.complete()
@drunkensouljah
drunkensouljah / fetch.js
Created October 14, 2020 19:50
Get JSON Data with JavaScript Fetch API
// Replace ./data.json with your JSON feed
fetch('./data.json')
.then((response) => {
return response.json()
})
.then((data) => {
// Work with JSON data here
console.log(data)
})
.catch((err) => {
{
"name": "<name of the root dir>",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Ankit Jain <ankitjain28may77@gmail.com>",
@drunkensouljah
drunkensouljah / sort-to-subfolder.sh
Created June 17, 2020 22:03
Sort files to subfolders named after files
for x in ./*.txt; do
mkdir "${x%.*}" && mv "$x" "${x%.*}"
done