Skip to content

Instantly share code, notes, and snippets.

View ptgolden's full-sized avatar

Patrick Golden ptgolden

View GitHub Profile
@samrocketman
samrocketman / libimobiledevice_ifuse_Ubuntu.md
Last active January 11, 2024 22:47
On Ubuntu 16.04, since iOS 10 update, libimobiledevice can't connect to my iPhone. This is my attempt to document a fix.

Why this document?

I upgraded my iPhone 5s to iOS 10 and could no longer retrieve photos from it. This was unacceptable for me so I worked at achieving retrieving my photos. This document is my story (on Ubuntu 16.04).

The solution is to compile libimobiledevice and ifuse from source.

Audience

Who is this guide intended for?

Virtual DOM and diffing algorithm

There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.

However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.

@BlameOmar
BlameOmar / content_negotiation.lua
Last active December 22, 2015 08:49
Content Negotiation Lua Script for nginx
-- Content negotiation for nginx using the lua module
-- Version 0.2
-- ©2013 Omar Stefan Evans
-- Based on the content negotiation script for Lighttpd written by Michael Gorven
-- (http://michael.gorven.za.net/blog/2009/04/13/content-negotiation-lighttpd-lua)
-- It is licensed under a BSD license.
-- 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
@harthur
harthur / debug-devtools.js
Last active December 16, 2015 14:19
Open a Firefox devtools window that's debugging the devtools window that's debugging the currently selected tab.
/*
* Running this scratchpad in chrome mode will open a devtools window that's debugging
* the devtools window that's debugging the currently selected tab.
*/
let {devtools} = Components.utils.import("resource:///modules/devtools/gDevTools.jsm", {});
let tabTarget = devtools.TargetFactory.forTab(gBrowser.selectedTab);
let toolbox = gDevTools.getToolbox(tabTarget);
let win = toolbox._host.frame.contentWindow;
@cpjolicoeur
cpjolicoeur / gist:3590737
Created September 1, 2012 23:15
Ordering a query result set by an arbitrary list in PostgreSQL

I'm hunting for the best solution on how to handle keeping large sets of DB records "sorted" in a performant manner.

Problem Description

Most of us have work on projects at some point where we have needed to have ordered lists of objects. Whether it be a to-do list sorted by priority, or a list of documents that a user can sort in whatever order they want.

A traditional approach for this on a Rails project is to use something like the acts_as_list gem, or something similar. These systems typically add some sort of "postion" or "sort order" column to each record, which is then used when querying out the records in a traditional order by position SQL query.

This approach seems to work fine for smaller datasets, but can be hard to manage on large data sets with hundreds (or thousands) of records needing to be sorted. Changing the sort position of even a single object will require updating every single record in the database that is in the same sort group. This requires potentially thousands of wri

@drj42
drj42 / org-mode-reference-in.org
Created February 6, 2012 23:53
This is a cheat sheet for Emacs org-mode... in org-mode format!
@mamund
mamund / gist:794419
Created January 25, 2011 02:39
JSON Link Standardization Examples
/* some suggestions on implementing hyperlinks in json */
// 5988-style (http://tools.ietf.org/html/rfc5988)
{ "link" :
{
"href" : "...",
"rel" : "...",
"hreflang" : "...",
"media" : "...",
"title" : "...",