Skip to content

Instantly share code, notes, and snippets.

View andytlr's full-sized avatar

Andy Taylor andytlr

View GitHub Profile
@andytlr
andytlr / gist:4052412
Created November 10, 2012 20:41
Insert time and date
do shell script "date +%Y-%m-%d\\ %H:%M:%S"
{% capture truncated_content %}{{ page.content | truncatewords: 250 }}{% endcapture %}
{% if page.content != truncated_content %}
Reading time ~<span class="time">{{ page.content | number_of_words | append: '.0' | divided_by:180 }}</span>min.
{% endif %}
@andytlr
andytlr / _description.md
Last active August 1, 2023 08:02
Convert SVG <polyline> to <path> so they can be animated with D3 etc.

Convert SVG polyline to path

Replace all instances of <polyline with <path and points=" with d="M.

 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1000px" height="1000px" viewBox="0 0 1000 1000" enable-background="new 0 0 1000 1000" xml:space="preserve">
-<polyline fill="#FFFFFF" stroke="#000000" stroke-miterlimit="10" points="100.712,141.534 582.904,227.835 425.37,478.521
+
@andytlr
andytlr / screenshots.sh
Last active August 29, 2015 14:01
Better OS X Screenshots
# This will capture a screenshot, put it in your Public Dropbox folder,
# reveal it in Finder and copy a sharable URL to the clipboard. E.g.
# https://dl.dropboxusercontent.com/u/21267/shots/shot_2014-05-19_12-30-48.png
# Uncomment options below for things like opening in Preview,
# copying a Markdown/HTML image tag etc.
# Replace with your Dropbox user ID.
#
# Share something from your Public folder to find it.
n=0
while read line ; do
let n=n+1
filename=`basename "$line"`
dropboxuser=21267 # Replace with your ID
directory=/shots/keep/ # This is the full path iside your Public Dropbox directory. The slashes are important.
path=~/Dropbox/Public$directory
mkdir -p $path
date=$(date +%H-%M-%S)-
if [ -f $path$filename ] ;then
@andytlr
andytlr / non-public-screenshot.sh
Created June 23, 2014 02:02
Non-public Dropbox folder screenshot
dropboxuser=21267 # Replace with your ID
directoryname=shots
filename=shot_`date '+%Y-%m-%d_%H-%M-%S'`.png
path=~/Dropbox/$directoryname/
mkdir -p $path
screencapture -o -i $path$filename
open --reveal $path$filename
@andytlr
andytlr / byword-delete-line.scpt
Last active August 29, 2015 14:27
Replicates 'Delete Line' functionality in Byword
-- Byword doesn't have a Delete Line function.
-- This is basically a macro to select the current line and delete it.
-- Make a Service that recieves no input and assign a keyboard shortcut.
on run {input, parameters}
tell application "System Events"
-- Command + Option + Up
key code 126 using {command down, option down}
-- Command + Option + Up
@andytlr
andytlr / snippets.md
Last active July 16, 2018 07:35
Swift Snippets

Swift Snippets

Change Status Bar

To make it light, put this inside the View Controller class:

override func preferredStatusBarStyle() -> UIStatusBarStyle {
    return .LightContent
}
# List merged branches
git branch --merged
# Delete all merged branches.
git branch --merged | grep -v "\*" | grep -v master | xargs -n 1 git branch -d
# Restage last commit. E.g. Whoops, just committed to master.
git reset --soft HEAD~
@andytlr
andytlr / spotify-genres.md
Created January 22, 2016 02:26
Spotify Genres

Spotify has heaps of genres but there not surfaced in the UI. Here's 1383 (perhaps all) of them.

Search for genre:"Genre Name"

  1. A Cappella
  2. Abstract
  3. Abstract Beats
  4. Abstract Hip Hop
  5. Abstract Idm
  6. Abstractro