Skip to content

Instantly share code, notes, and snippets.

View vigorouscoding's full-sized avatar

Kai Schwaiger vigorouscoding

View GitHub Profile
#!/usr/bin/env bash
set -e
target_osx=$(sw_vers -productVersion)
project_dir=/Users/rkmax/development/aseprite
skia_dir=/Users/rkmax/development/skia
arch="$(uname -m)"
bundle_trial_url=https://www.aseprite.org/downloads/trial/Aseprite-v1.2.40-trial-macOS.dmg
@vigorouscoding
vigorouscoding / .bash_profile
Created August 20, 2016 19:44
structr helpers for bash_profile
backup_structr() {
[ ! -d files ] || [ ! -d db ] && echo "db and files must be present. not in structr-ui folder?" && return 1
local OPT=""
[ ! -z $1 ] && OPT="-"$1 && OPT=${OPT//[^a-zA-Z0-9-_]/}
local BAKFILE=db-files-$(date +%Y%m%d-%H%M%S)$OPT.tar.bz2
echo "backing up to "$BAKFILE
tar cvfj $BAKFILE db files
}
cdstructr() {
@vigorouscoding
vigorouscoding / structr_bookmarklet.js
Created August 15, 2016 07:46
Bookmarklet (seethis article https://support.mozilla.org/en-US/kb/bookmarklets-perform-common-web-page-tasks for more infos on bookmarklets) for Structr to have a fast way to perform some tasks via the REST interface.
javascript:
/**
* Structr-UI Helpers - a couple of simple functions to send REST requests to Structr.
* Calls to Structr automatically get the header flag 'Structr-Websocket-Broadcast' set to 'disabled' so that
* performance does not suffer too much when doing larger tasks.
*/
function structr_rest(method, path, data, callback) {
var allow = true;
if (!method || method == '') {
allow = false;
@vigorouscoding
vigorouscoding / gist:f5abeedd3c17fa6eb9f47602890245e9
Created July 26, 2016 14:26 — forked from juri/gist:5677168
Parse a GPX file and add extra locations by interpolation. This allows you to slow down a simulated route in Xcode/iOS Simulator.
#!/usr/bin/python
# Interpolate GPX waypoints to slow a simulated route down.
import itertools
import sys
import xml.etree.ElementTree as ET
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
@vigorouscoding
vigorouscoding / KSTimingHelper.h
Last active August 29, 2015 13:57
Block-based timing function - easily compare the runtime for different code paths or snippets
#import <Foundation/Foundation.h>
@interface KSTimingHelper : NSObject
// Thanks to Mattt Thompson -> http://nshipster.com/benchmarking/
extern uint64_t dispatch_benchmark(size_t count, void (^block)(void));
+(unsigned long long)timeForBlock:(void (^)(void))actions;
+(unsigned long long)timeForBlock:(void (^)(void))actions runCount:(NSUInteger)runCount;
@vigorouscoding
vigorouscoding / maximize.js
Last active December 17, 2015 14:39
iStockphoto bookmarklets. The is used to maximize preview images on a single image page. The second is used in the search results to double the size of all preview images.
javascript:(function () {
/* zoom the image if it is not yet zoomed */
if (jQuery("#s3img").length == 0) {
jQuery("#ZoomImage").click();
jQuery("#ZoomImage").click();
jQuery("#ZoomImage").click();
}
/* Either open the image in a new window or */
if (confirm("Open image in new window? (you might get 'access forbidden')")) {
@vigorouscoding
vigorouscoding / DateFlowLayout.h
Created March 13, 2013 20:10
UICollectionView with sticky headers which works for horizontal as well as vertical scrolling
#import <UIKit/UIKit.h>
@interface DateFlowLayout : UICollectionViewFlowLayout
@end
@vigorouscoding
vigorouscoding / Create App Icons.jsx
Last active January 24, 2017 20:05 — forked from twonjosh/Create iOS Icons.jsx
Photoshop script for automated generation of iOS and Mac App Icons (http://www.vigorouscoding.com/2013/02/photoshop-script-for-app-icon-creation-for-ios-and-mac-apps/) - Enabled non-PNG file support. - Removed some (IMHO unnecessary) checks since the user can load PSDs or some kind of vector-based image - Added a dialog to select for which platf…
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete permanently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com
@vigorouscoding
vigorouscoding / KSImageView.h
Last active August 17, 2020 16:45
NSImageView subclass to get the filename of the dropped image and to disable deleting and cutting the image. The class sends a "KSImageDroppedNotification" with the image filename in the userinfo dictionary. I got the idea from: http://www.cocoabuilder.com/archive/cocoa/121824-how-do-capture-the-filename-of-an-image-dropped-in-an-nsimageview.html
#import <Cocoa/Cocoa.h>
@interface KSImageView : NSImageView
@end
@vigorouscoding
vigorouscoding / NSString+Templating.h
Last active December 11, 2015 20:29 — forked from popcornylu/NSString+template.c
A simple templating category for NSString. I made a couple of small changes to better suit my needs. (check out the diff to see what)
#import <Foundation/Foundation.h>
@interface NSString (Templating)
+(NSString*)stringWithTemplate:(NSString*)tpl
fromMap:(NSDictionary*)map;
@end