Skip to content

Instantly share code, notes, and snippets.

Kai Schwaiger vigorouscoding

Block or report user

Report or block vigorouscoding

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vigorouscoding
vigorouscoding / .bash_profile
Created Aug 20, 2016
structr helpers for bash_profile
View .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 Aug 15, 2016
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.
View structr_bookmarklet.js
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 Jul 26, 2016 — 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.
View gist:f5abeedd3c17fa6eb9f47602890245e9
#!/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 Aug 29, 2015
Block-based timing function - easily compare the runtime for different code paths or snippets
View KSTimingHelper.h
#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 Dec 17, 2015
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.
View maximize.js
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 Mar 13, 2013
UICollectionView with sticky headers which works for horizontal as well as vertical scrolling
View DateFlowLayout.h
#import <UIKit/UIKit.h>
@interface DateFlowLayout : UICollectionViewFlowLayout
@end
@vigorouscoding
vigorouscoding / Create App Icons.jsx
Last active Jan 24, 2017 — 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…
View Create App Icons.jsx
// 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 Aug 18, 2018
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
View KSImageView.h
#import <Cocoa/Cocoa.h>
@interface KSImageView : NSImageView
@end
@vigorouscoding
vigorouscoding / NSString+Templating.h
Last active Dec 11, 2015 — 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)
View NSString+Templating.h
#import <Foundation/Foundation.h>
@interface NSString (Templating)
+(NSString*)stringWithTemplate:(NSString*)tpl
fromMap:(NSDictionary*)map;
@end
You can’t perform that action at this time.