Skip to content

Instantly share code, notes, and snippets.

View GeorgeWS's full-sized avatar

George Woodliff-Stanley GeorgeWS

View GitHub Profile
#!/usr/bin/env ruby -rjcode -Ku
# TaskPaper to Markdown converter
# Usage: tp2md.rb filename.taskpaper > output.md
require 'ftools'
infile = ARGV[0]
title = File.basename(infile,'.taskpaper').upcase
output = "# #{title} #\n\n"
prevlevel = 0
begin
@kylefox
kylefox / color.m
Created January 27, 2012 17:45
Generate a random color (UIColor) in Objective-C
/*
Distributed under The MIT License:
http://opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
//
// NSObject+PropertyListing.h
// PropertyFun
//
// Created by Andrew Sardone on 8/27/10.
//
#import <Foundation/Foundation.h>
@siqin
siqin / gist:4201667
Created December 4, 2012 07:57
Remove Emoji in NSString
// XCode 4.2.1
@implementation NSString(EmojiExtension)
- (NSString*)removeEmoji {
__block NSMutableString* temp = [NSMutableString string];
[self enumerateSubstringsInRange: NSMakeRange(0, [self length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop){
@poritsky
poritsky / ingredient-list-to-omnifocus.applescript
Last active April 30, 2022 11:09
Launch OmniFocus. Create a project called "Recipes". Go to any recipe site in Safari. Run the script.
tell application "Safari" to set recipetitle to name of front document
tell application "Safari" to set recipeurl to URL of front document
set ingredients to (do shell script "curl http://recipedistiller.com/recipe/classify/?recipeurl=" & recipeurl & " | textutil -convert txt -stdin -stdout | grep '.' | sed 's/ • DELETE //g' | sed '$d'")
set my text item delimiters to "VIEW RECIPE"
set ingredients to text item 2 of ingredients
set my text item delimiters to "©"
set ingredients to text item 1 of ingredients
@doitian
doitian / README.md
Last active April 1, 2021 23:37
Scripts to control Vitamin-R

Usage

osascript Start.applescript "objective" "tag1,tag2"
osascript Stop.applescript

I have skipped most Vitamin-R workflows. See the attached settings snapshot. If you have them enabled, you need to update the script to handle different steps.

I use the scripts in my org pomodoro script

@nicklockwood
nicklockwood / Hacking UIView Animation Blocks.md
Last active June 18, 2024 15:35
This article was originally written for objc.io issue 12, but didn't make the cut. It was intended to be read in the context of the other articles, so if you aren't familiar with concepts such as CALayer property animations and the role of actionForKey:, read the articles in that issue first.

Hacking UIView animation blocks for fun and profit

In this article, I'm going to explore a way that we can create views that implement custom Core Animation property animations in a natural way.

As we know, layers in iOS come in two flavours: Backing layers and hosted layers. The only difference between them is that the view acts as the layer delegate for its backing layer, but not for any hosted sublayers.

In order to implement the UIView transactional animation blocks, UIView disables all animations by default and then re-enables them individually as required. It does this using the actionForLayer:forKey: method.

Somewhat strangely, UIView doesn't enable animations for every property that CALayer does by default. A notable example is the layer.contents property, which is animatable by default for a hosted layer, but cannot be animated using a UIView animation block.

@roop
roop / makemake.pl
Last active January 2, 2021 12:30
Script to create a Makefile to build your Swift project
#!/usr/bin/perl -w
use strict;
# Makefile generator for quick compilation of Swift projects
# By: Roopesh Chander
# Thanks: Andy Matuschak
# Works only for swift-only projects.
# Usage:
# > perl makemake.pl
# > make
@primaryobjects
primaryobjects / gist:2f1a55afa341458f08ab
Created April 2, 2015 17:40
Google Spreadsheet script to remember the last edited cell position and automatically scroll to it when opening the document.
//
// Remember Last Edited Cell Position in Google Spreadsheets
//
// Install:
// 1. Open spreadsheet in Google Drive.
// 2. Click Tools->Script editor.
// 3. Paste the contents of this file into the text field.
// 4. Click Run->install
// 5. When prompted for permission, click OK.
// 6. Click Run->install a second time. Done!
@zxbodya
zxbodya / source-map-unpacker.js
Created June 8, 2015 23:28
script to extract sources, from sourcesContent field in sourcemap
'use strict';
var fs = require('fs');
var maps = [
fs.readFileSync('./main.xxxx.js.map'),
fs.readFileSync('./1.chunk.xxxx.js.map'),
fs.readFileSync('./2.chunk.xxxx.js.map'),
fs.readFileSync('./3.chunk.xxxx.js.map')
];