Skip to content

Instantly share code, notes, and snippets.


Alvin C unforswearing

View GitHub Profile
unforswearing / Tiny JavaScript tokenizer.js
Created Jun 2, 2021 — forked from borgar/Tiny JavaScript tokenizer.js
A compact tokenizer written in JavaScript.
View Tiny JavaScript tokenizer.js
* Tiny tokenizer
* - Accepts a subject string and an object of regular expressions for parsing
* - Returns an array of token objects
* tokenize('this is text.', { word:/\w+/, whitespace:/\s+/, punctuation:/[^\w\s]/ }, 'invalid');
* result => [{ token="this", type="word" },{ token=" ", type="whitespace" }, Object { token="is", type="word" }, ... ]
unforswearing / shellcheck.yml
Last active May 13, 2021 — forked from ttscoff/dontforget.bash
Quick reminders from Terminal (bash)
View shellcheck.yml
- master
name: 'shellcheck'
name: shellcheck
unforswearing /
Last active Jul 4, 2019
Hack to convert Google Doc editing url
View gist:17f196b4278964aaa1d8f0f5001819a8

One Click Submit a Google Form

The process below will allow you to submit a google form by clicking a single link. Documenting because I never seem to remember.

Initial steps:

  • Get the id of the form, located after the /d/e portion of the Form URL
  • Grab the textarea name from the Google Form page source. I normally do a manual search entry. and find the form field name from there.
View new-text-file-in-finder.applescript
tell application "Finder"
set FoldName to selection as text
set FoldName to POSIX path of FoldName
set newfile to text returned of (display dialog "Enter file name and extension" default answer "")
set FileName to FoldName & newfile
set FileName to POSIX path of FileName
set FileName to quoted form of FileName
do shell script "touch " & FileName
do shell script "open " & FileName
end tell
View script-launcher.applescript
set _Path to "<<enter path to your script folder here>>"
set scriptLaunch to text returned of (display dialog "Enter name of script to run" default answer "" buttons "OK" default button "OK")
if scriptLaunch contains "" then
error number -128
else if scriptLaunch contains scriptLaunch then
set scriptRun to _Path & "/" & scriptLaunch & ".scpt"
run script scriptRun
on error
display alert "Your script failed to launch."
View nv-new-note-from-dialog.applescript
set newnote to display dialog "Create a NV note" default answer ""
set newnote to text returned of newnote
tell application "Finder" to set the clipboard to newnote as text
tell application "Notational Velocity"
tell application "System Events"
key code 9 using {command down, shift down}
key code 124 using command down
key code 36
key code 36
View copy-to-nv.applescript
tell application "System Events"
set w1 to the name of first application process whose frontmost is true
tell w1
tell application "System Events"
key code 0 using command down
key code 8 using command down
set bodytext to the clipboard
set the clipboard to bodytext as string
tell application "Notational Velocity"
unforswearing / githubLabels.js
Created Mar 9, 2016
Github Labels Bookmarklet
View githubLabels.js
var labels=[],current=window.location.href,re=/.*github.*\/labels$/i;current.match(re)?([]".label-link")).forEach(function(e){labels.push({name:e.textContent.trim(),color:e.getAttribute("style").replace("background-color:","").replace(/color:.*/,"").trim().replace(/^#/,"").replace(/;$/,"").trim()})}),data=JSON.stringify(labels,null,2),"data:text/html,"+encodeURIComponent(data),"_blank","width=400,height=400"),mW.focus()):window.alert("Page needs to be:");