Skip to content

Instantly share code, notes, and snippets.

View fanaugen's full-sized avatar
🙂
always learning

Alex Jahraus fanaugen

🙂
always learning
  • Berlin
View GitHub Profile
@fanaugen
fanaugen / comment.md
Created June 26, 2013 14:41
previous content

echo "Please pick up the following from the store: $groceries[0]";

This isn't going to work by the way: inserting a variable's value into a string "like $x this" only works with a simple variable such as $x – for array elements you have two other options:

  1. String concatenation:

    echo "buy ".$groceries[0]." at the store";
    
  2. save in a variable beforehand:

It’s the one whitespace character between the </div> and the next <div!

Because of that whitespace, and because our boxes are displayed as inline-block, the browser renders an actual whitespace in the current font and size between them, and so the smaller box once again breaks to the next "line".

@fanaugen
fanaugen / images to TIFF.scpt
Last active October 25, 2018 06:39
Batch-convert images to TIFF (AppleScript, Mac OS X)
# this script converts all PDFs and images selected in Finder
# to the TIFF format and appends .tif to the file name
set t to (time of (current date))
tell application "Finder" to set sel to selection
set errors to {}
tell application "Image Events"
repeat with img_file in sel
try
set img_file to img_file as text
@fanaugen
fanaugen / date string parser.scpt
Last active October 25, 2018 06:41
simple date parser
(*
* Example of a simple string-to-date parser.
* Uses AppleScript's text item delimiters to split the input string
*)
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"-", "T", ":", "Z"}
set dateString to "2011-12-23T08:00:00Z" -- what's Z for?
@fanaugen
fanaugen / workflow.scpt
Last active July 16, 2025 15:16
Automator workflow to batch-convert MS Word documents (.doc, .docx) into PDF using Apple Pages
(*
* embed this applescript into an Automator workflow to batch-convert
* MS Word documents (.doc, .docx) into PDF using Apple Pages.
*)
on run {input, parameters}
tell application "Pages"
activate
repeat with doc in input