Skip to content

Instantly share code, notes, and snippets.

View stupergenius's full-sized avatar
🙂
🤓

Ben Snider stupergenius

🙂
🤓
View GitHub Profile
@stupergenius
stupergenius / pre-commit hook for Swiftlint
Last active March 26, 2019 20:48 — forked from candostdagdeviren/pre-commit
Git Pre-Commit hook with SwiftLInt
#!/bin/bash
if [ "$SKIP_SWIFTLINT" = "true" ]; then
exit 0
fi
if which swiftlint >/dev/null; then
if [ "$1" = "buildphase" ]; then
swiftlint lint
elif [ "$1" = "postcommit" ]; then
@stupergenius
stupergenius / rst_to_md.sh
Last active December 3, 2021 15:55 — forked from hugorodgerbrown/md_to_rst.sh
Shell script for converting a batch of rst files into markdown files using pandoc
# This script was created to convert a directory full
# of rst files into markdown equivalents. It uses
# pandoc to do the conversion.
#
# 1. Install pandoc from http://johnmacfarlane.net/pandoc/
# 2. Copy this script into the directory containing the .md files
# 3. Ensure that the script has execute permissions
# 4. Run the script
#
# By default this will keep the original .rst file
@stupergenius
stupergenius / wtb_replay_downloader.rb
Last active October 11, 2016 19:02
Downloads all video replays from the With The Best conference site. Download and then play them with VLC at 2x speed 🤘. Built to download videos from the Swift conference but could be easily modified to download from other conferences. *PLEASE* use this only for personal use, and do otherwise abide by the conference policies.
# The MIT License (MIT)
# Copyright (c) 2016 Ben Snider
#
# 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 permit persons to whom the Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WI
@stupergenius
stupergenius / ac_get_tasks.js
Last active December 25, 2015 15:09
Prints a list of non-complete tasks from ActiveCollab API.
var apiUrl = 'http://my.chepri.com/public/api.php';
var authToken = 'Your Auth Token';
var projectSlug = 'project-slug-or-id';
$.getJSON(apiUrl + '?auth_api_token=' + authToken + '&path_info=/projects/' + projectSlug + '/tasks', null, function (response) {
for (var i in response) {
var task = response[i];
if (!task.is_complete) {
console.log(task.task_id + ': ' + task.name);
}
@stupergenius
stupergenius / sim_ss_crop
Created November 5, 2012 14:01
iOS Simulator Screenshot Cropping
convert iOS* -crop 640x1096+0+40 cropped.png # iphone5
convert iOS* -crop 640x920+0+40 cropped.png # iphone4
convert iOS* -crop 1536x2008+0+40 cropped.png # ipad2
@stupergenius
stupergenius / nilable_macros
Created October 23, 2012 17:50
Plist Safe Objects
#define NILABLE(obj) ((obj) != nil ? (NSObject *)(obj) : (NSObject *)[NSNull null])
#define FROM_NILABLE(key, dict) ([dict objectForKey:key] == [NSNull null) ? nil : [dict objectForKey:key]
@stupergenius
stupergenius / clean_build_test_copy_sdk
Created September 19, 2012 14:07
Sencha Clean Build Test Production Copy SDK
rm -fr build && rm -fr archive && sencha app build testing && sencha app build production && cp build/production/sdk/sencha-touch-all.js build/testing/sdk/
@stupergenius
stupergenius / MySQL Dump Tables
Created August 15, 2012 14:10
Bash script that dumps all the tables of a given database, each table to its own file.
#!/bin/bash
if [ "$1" == "" ]; then
echo "Usage: $0 [output-path]"
exit 1
fi
TABLES=`mysql -B -N -e "select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA='$1'"`
OUT="$2"
@stupergenius
stupergenius / load_local_storage.js
Created June 28, 2012 16:11
Sencha Touch 2 manually load and parse local storage items
Ext.each(localStorage.getItem('storage-id').split(','), function(item_id) {
var item = JSON.parse(localStorage.getItem('storage-id-' + item_id));
console.log(item);
});
@stupergenius
stupergenius / jshint_settings
Created May 18, 2012 15:04
JSHint Settings
debug=true forin=true eqnull=true noarg=true noempty=true eqeqeq=true boss=true loopfunc=true evil=true laxbreak=true bitwise=true strict=false undef=true curly=true nonew=true browser=true devel=true trailing=true white=true lastsemic=true