Skip to content

Instantly share code, notes, and snippets.

@thzinc
thzinc / sortabletable.js
Created April 9, 2013 16:44
Quick jQuery-powered script to make tables sortable if they have a <thead/> and <th/> elements.
(function($) {
$(function() {
function sortTable(event) {
var header = $(event.currentTarget);
var column = header.prevAll().length;
var table = header.closest("table");
var body = table.find("tbody");
var rows = body.find("tr");
@thzinc
thzinc / status.sql
Last active December 16, 2015 00:28
T-SQL query to get information from SQL Server 2008 (and R2) about all running requests, along with percentage of completion. Originally got it from a blog somewhere... Can't remember whose it was.
SELECT
r.session_id,
t.text,
r.status,
r.command,
database_name = DB_NAME(r.database_id),
r.cpu_time,
r.total_elapsed_time,
r.percent_complete
FROM sys.dm_exec_requests r
@thzinc
thzinc / Add numbered bullet points to li items.jquery.js
Created April 10, 2013 13:48
jQuery-based JavaScript to add numbers to each <li/> element in a document. (Particularly useful for HTML generated by FreeMind)
(function($) {
$("li").each(function(i, e) {
var current = $(e);
var parent = current.parents("li");
var id = [];
if (parent.length) {
id = parent.data("id").map(function(e) { return e; });
id.push(current.prevAll("li").length + 1);
}
@thzinc
thzinc / test-gateway.sh
Created February 21, 2015 01:17
Test Spreedly Gateway
#!/bin/bash
ENVIRONMENT_KEY=Spreedly_Environment_Key
SECRET=Spreedly_Secret
GATEWAY=Spreedly_Gateway_Token
echo Tokenize request
curl https://core.spreedly.com/v1/payment_methods.json\?environment_key=$ENVIRONMENT_KEY \
-H 'Origin: http://localhost' \
-H 'X-Requested-With: XMLHttpRequest' \
-H 'Content-Type: application/json' \
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
namespace Sonorous.Core.Services
{
public static class StructExtensions
{
public delegate bool TryParseDelegate<T>(string input, out T value);
@thzinc
thzinc / gzip.js
Created June 3, 2016 00:40 — forked from kig/gzip.js
TarGZ = function(){};
// Load and parse archive, calls onload after loading all files.
TarGZ.load = function(url, onload, onstream, onerror) {
var o = new TarGZ();
o.onload = onload;
o.onerror = onerror;
o.onstream = onstream;
o.load(url);
return o;
@thzinc
thzinc / parse.js
Created June 11, 2016 23:47
Script to parse list of barcodes and append additional UPC/ISBN info
var fs = require('fs');
var fileName = process.argv[2];
var barcodes = readFile(fileName, 'utf8')
.then(data => data.split(/\r\n/g))
.then(lines => lines
.slice(1)
.map(line => line.split(/,/g))
.map(a => {
return {
@thzinc
thzinc / README.md
Last active May 10, 2024 05:45
Download all iCloud Photos

Download all iCloud Photos from your account

Thanks to the super-useful PyiCloud module by @picklepete, this script is a way to download all of your photos from iCloud Photos.

On OS X (macOS?), use the icloud utility to save your iCloud password to your keyring. (This keeps it out of the script.) Update the script with your Apple ID email address and run it to download your photos to the current directory.

@thzinc
thzinc / mentorship.md
Last active December 28, 2016 05:08
Tech mentorship notes

Truths and realities

  • I am good at software development
  • I have received excellent mentorship from many people
  • I have benefitted from the privilege of being a white, cis het male in Tech

Desires and passions

  • Sharing awesome things with people
  • Getting others excited about tech
  • Seeing my friends make awesome stuff
  • Seeing my friends enjoy what they do
@thzinc
thzinc / PackageApplication
Created October 9, 2017 20:57
PackageApplication script from Xcode 8.2.1
#!/usr/bin/perl
#
# PackageApplication
#
# Copyright (c) 2009-2012 Apple Inc. All rights reserved.
#
# Package an iPhone Application into an .ipa wrapper
#
use Pod::Usage;