Skip to content

Instantly share code, notes, and snippets.

View shanzhong's full-sized avatar

Shan Zhong shanzhong

View GitHub Profile
@shanzhong
shanzhong / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@shanzhong
shanzhong / getNoteColor
Created November 14, 2013 03:29
AppleScript to identify 16-bit color codes from highlight notes in Skim.app
--Adopted from http://www.organognosi.com/skim-and-highlighting-color-codes/
tell application "Skim"
set colorMessage to ""
set pageNotes to notes of current page of document 1
repeat with pageNote in pageNotes
set noteColor to color of pageNote
set noteColorText to ""
repeat with codeColor in noteColor
set noteColorText to noteColorText & codeColor & " "
end repeat
@shanzhong
shanzhong / skimnotes2markdown
Last active August 16, 2016 12:28
My AppleScript for automatically extracting notes from PDF files in Skim and convert to Markdown format (in clipboard) with links (skimmer://) to original PDF file (full path and page number). The converted Markdown format can be pasted into Ulysses III by Edit -> Paste from -> Markdown.
(* Inspired and modified based on http://drosophiliac.com/2012/09/an-academic-notetaking-workflow.html and https://gist.github.com/smargh/6068104 *)
(* PROPERTIES *)
property LF : (ASCII character 10)
property tid : AppleScript's text item delimiters
(* THE SCRIPT *)
tell application "Skim"
set the clipboard to ""
activate
@shanzhong
shanzhong / Skimmer
Created November 14, 2013 02:57
My AppleScript for custom URL handler skimmer://<pdf file name>.pdf#page=N that opens PDF files in Skim and jumps to the specified page N.
--Inspired and modified from http://drosophiliac.com/2012/09/an-academic-notetaking-workflow.html
--It creates a custom URL handler skimmer:// for opening PDF files in Skim and jumping to the specified page
--Usage: Copy and paste this into AppleScript Editor, and save as an app named Skimmer.app. Then, change the info.plist file within the app bundle and add the contents at the end of this gist.
--BEGIN main script
on open location skimmerURL
set skimmerPath to do shell script "php -r 'echo urldecode(\"" & skimmerURL & "\");'"
--When the skimmer url is clicked, we have to extract the arguments from the url and pass them to this script.
set oldDelims to AppleScript's text item delimiters