Skip to content

Instantly share code, notes, and snippets.


Chris Dzombak cdzombak

View GitHub Profile
cdzombak /
Created September 28, 2010 21:43
recursive ksort function for PHP
cdzombak /
Created September 28, 2010 21:45
Redirect visitors to a domain without affecting OpenID

You may want to redirect (HTTP 301) visitors from a site which acts as an OpenID endpoint. Of course, you don't want to break everything which relies on that OpenID endpoint.

There is no definitive way to tell whether the client is an OpenID client or a human visitor, but you can look for certain criteria which are usually signs that the client isn't a standard Web browser.

This set of .htaccess rules should accomplish this in most cases. I've put this together based on a few examples online plus my own testing with a few OpenID clients.

cdzombak /
Created May 9, 2011 03:44
check whether an element is currently visible (JS)

This is a small Javascript function which tells you whether an HTML element is currently visible - that is, whether or not it's been scrolled out of view on the page.

This function requires jQuery.

package com.cguild.stopon500;
import java.util.concurrent.atomic.AtomicInteger;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
cdzombak / gist:1452149
Created December 9, 2011 16:08
Git intro links
View gist:1452149
And a few tutorial/cheat sheet style references:
cdzombak / hideyokids.txt
Created March 22, 2012 18:50
Cougar on North Campus
View hideyokids.txt
Received: by with SMTP id m14csp86053faq;
Thu, 22 Mar 2012 10:56:13 -0700 (PDT)
Received: by with SMTP id hi10mr2747102igc.3.1332438972973;
Thu, 22 Mar 2012 10:56:12 -0700 (PDT)
Return-Path: <>
Received: from ( [])
by with ESMTP id cf2si2712340igb.24.2012.;
Thu, 22 Mar 2012 10:56:12 -0700 (PDT)
cdzombak / if.m
Created June 19, 2012 15:19
switch vs if with pointers (if C allowed switch on ptrs)
View if.m
// `item` is a UINavigationItem*
if (item == self.welcomeNavItem) {
return NO;
else if (item == self.emailNavItem) {
[self transitionToWelcomeScreen:YES];
return YES;
else if (item == self.passwordNavItem) {
cdzombak / gist:3860927
Last active October 11, 2015 12:47 — forked from andrewsardone/gist:3859525
enum types in C/Objective-C
View gist:3860927
// unpredictable backing type for this enum
typedef enum {
} CDZType;
// vs.
enum {
cdzombak / CDZTableViewSplitDelegate.h
Created January 4, 2013 17:16
Separate concerns. `UIScrollViewDelegate` deals with a container, while `UITableViewDelegate` deals with content. It's often useful to have two different objects manage these concerns, but Cocoa Touch makes it difficult since `UITableViewDelegate` conforms to `UIScrollViewDelegate` and `UITableView` has only one delegate property. `CDZTableViewS…
View CDZTableViewSplitDelegate.h
#import <Foundation/Foundation.h>
@interface CDZTableViewSplitDelegate : NSObject <UIScrollViewDelegate, UITableViewDelegate>
@property (nonatomic, weak) id<UITableViewDelegate> tvDelegate;
@property (nonatomic, weak) id<UIScrollViewDelegate> svDelegate;
- (id)initWithScrollViewDelegate:(id<UIScrollViewDelegate>)scrollViewDelegate tableViewDelegate:(id<UITableViewDelegate>)tableViewDelegate;
cdzombak / gist:5058153
Created February 28, 2013 16:52 shadiness
View gist:5058153
> dig NS
; <<>> DiG 9.8.3-P1 <<>> NS
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29020
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0