Skip to content

Instantly share code, notes, and snippets.

View AdamWagner's full-sized avatar

Adam Wagner AdamWagner

View GitHub Profile
@RobTrew
RobTrew / safariXPathGoogleResultLinks.js
Created May 30, 2015 02:24
Harvest Google result links from Safari with XPATH (as MD) with //*[@Class='r']/a
@RobTrew
RobTrew / bashSelectByGlobInFinder.sh
Last active April 5, 2021 15:18
Bash command `lf` - like ls but selects glob-matched files in an OS X Finder window
# An lf command in my ~/.bash_profile
# like a simple ls, but selects the glob-matched files in the Finder
# `lf *.txt` to Finder-select all *.txt files in the working directory
# `lf *.[^t]?? to Finder-select all files with a 3-char extension which doesn't start with t
lf() {
local IFS=":"; local f=$@; local seln=""; fldr="$(pwd)"
for l in ${f[@]}; do
if [[ ! -d $l ]]; then
seln=$seln"file \"$l\", "
fi
@RobTrew
RobTrew / JXA_UIToggle.applescript
Created February 24, 2015 13:06
OS X Yosemite Javascript for Applications (JXA): Toggling background, dark mode, and screen color inversion between day ⇄ night settings
function run() {
// Rob Trew 2015
// Ver 0.01
// UI day/night toggling through OS X 10.10 JXA Javascript for Automation
// SWITCH FROM DAY-TIME DARK MENU BAR AND DOCK WITH DARK BACKGROUND
// TO NIGHT-TIME *ALL DARK*
// (TOGGLE MODE AND BACKGROUND TO BRIGHT, THEN INVERT ALL)
@RobTrew
RobTrew / DraftsFunctions_ScriptEditor.js
Last active May 11, 2024 05:43
OS X 10.10 (Yosemite) definitions of the basic script editing functions used in iOS Drafts 4
// Ver 0.4 Rob Trew
// Library for using OSX Yosemite Script Editor scripts
// written in an idiom compatible with FoldingText, Drafts, 1Writer, TextWell
// In iOS Drafts 4 scripts, the header is simply:
// var drafts = this;
// For headers for FoldingText and other editors, see:
// See: http://support.foldingtext.com/t/writing-scripts-which-run-on-both-foldingtext-and-ios-drafts-4/652/7
// Call functions, after this header, with the prefix:
// drafts.
@dtinth
dtinth / README.md
Last active May 11, 2024 02:21
Batch File Rename Script

Batch File Rename

Use JavaScript for Automation to rename files in batch!

Motivation

@Sennahoi
Sennahoi / extract.js
Created August 5, 2014 14:16
Extract bookmarks from a netscape bookmark file with node.js
var cheerio = require("cheerio"),
fs = require("fs");
fs.readFile('bookmarks.html', "utf-8", function read(err, data) {
if (err) {
throw err;
}
var $ = cheerio.load(data);
$("a").each(function(index, a) {
@hotoo
hotoo / convert.sh
Last active April 15, 2023 01:15
convert vimwiki to markdown: `sed -f ex -i *.md`
#!/usr/bin/env bash
for x
do
filename=$(echo $x|sed -e "s/\.wiki$/.md/")
sed -f ex $x > $filename
done
@gorbiz
gorbiz / trello-card-title-markdown.user.js
Last active September 12, 2023 05:50
Add support for bold and emphasized Markdown in Trello card titles using a User Script.
// ==UserScript==
// @name Trello card title Markdown
// @version 0.4.0
// @homepage https://gist.github.com/gorbiz/6062481
// @description Add support for bold and emphasized Markdown in card titles
// @match https://trello.com/b/*
// @match http://trello.com/b/*
// ==/UserScript==
function markdownAll() {
(function($){
var Responsifier = {
grid: [900, 768, 660, 560, 460, 360],
update: function() {
$('html').add('.responsive').each(function(){
var $el = $(this);
var w = $el.width();
_.each(Responsifier.grid, function(v){
if (w < v)
$el.addClass("responsive-" + v);