Skip to content

Instantly share code, notes, and snippets.

View andytlr's full-sized avatar

Andy Taylor andytlr

View GitHub Profile
@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 / gist:4052412
Created November 10, 2012 20:41
Insert time and date
do shell script "date +%Y-%m-%d\\ %H:%M:%S"
# 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~
{% 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 %}
# Takes one URL per line on the clipboard.
# Opens each one in a new tab in the default browser.
touch temp.txt
pbpaste > temp.txt
echo "" >> temp.txt
cat temp.txt | while read a; do open $a; done
rm temp.txt
@andytlr
andytlr / proofer.ino
Created March 15, 2017 03:14
Bread Proofer Arduino Project
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int ThermistorPin = 0;
int relayPin = 10;
int Vo;
float R1 = 10000;
float logR2, R2, T, Tc;
@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
}