Skip to content

Instantly share code, notes, and snippets.

😺

Brad Heintz bradheintz

😺
Block or report user

Report or block bradheintz

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
View OptHexRadixSort.m
+ (void)hexadecimalRadixSort2:(int[])input length:(int)l {
int max = [self findMax:input length:l];
int partiallySorted[l];
int i;
int powerOf16 = 0;
int bin[16];
while ((1 << (powerOf16 << 2)) < max) {
for (int i = 0; i < 16; i++) bin[i] = 0;
View ParamRadix.m
+ (void)paramRadixSort:(int*)input length:(int)l radix:(int)r {
int max = [self findMax:input length:l];
int partiallySorted[l];
int i;
int sigDig = 1;
int bin[r];
while (sigDig < max) {
for (int i = 0; i < r; i++) bin[i] = 0;
@bradheintz
bradheintz / TestCrashSpikeTests.swift
Created Jul 29, 2015
Wanna see the Swift compiler segfault?
View TestCrashSpikeTests.swift
//
// TestCrashSpikeTests.swift
// TestCrashSpikeTests
//
// Created by Brad Heintz on 7/28/15.
// Copyright (c) 2015 Brad Heintz, but you can do any damn thing
// you please with this code.
//
import UIKit
@bradheintz
bradheintz / gitbash
Created Aug 14, 2013
Show your git branch status (branch name, dirty state) in your bash prompt.
View gitbash
# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo
__gitdir ()
{
if [ -z "${1-}" ]; then
if [ -n "${__git_dir-}" ]; then
echo "$__git_dir"
elif [ -d .git ]; then
echo .git
else
View gist:2662249
$ pod install HowAboutWeHD.xcodeproj --verbose
Updating spec repo `master'
/usr/local/bin/git pull
Already up-to-date.
Installing dependencies of: /Users/fitz/workspace/HowAboutWeHD/Podfile
Using A2DynamicDelegate (1.0.8)
Using BlocksKit (1.0.6)
Generating support files
* Generating xcconfig file at `/Users/fitz/workspace/HowAboutWeHD/Pods/Pods.xcconfig'
* Generating prefix header at `/Users/fitz/workspace/HowAboutWeHD/Pods/Pods-prefix.pch'
View gist:160763
<html>
<head>
<title>Date to Day Converter</title>
</head>
<body>
<p><b>Instructions:</b> Enter a date in MM/DD/YYYY format, get back a day number from 1 to 366.</p>
<?php
if (isset($_POST['fromdate'])) {
$dt = new DateTime($_POST['fromdate']);
echo $_POST['fromdate']." is ".(date_format($dt, 'z') + 1)."<br/>\n";
View gist:66627
# Inheritance Weirdness: I can get a couple of different errors, but no correct behavior out of the following code:
#!/usr/bin/env jruby -d
require 'java'
require '/Users/bradheintz/project/hadoop/current/lib/commons-logging-1.0.4.jar'
require '/Users/bradheintz/project/hadoop/current/lib/log4j-1.2.15.jar'
require '/Users/bradheintz/project/hadoop/current/hadoop-0.18.1-core.jar'
class MyMapper < org.apache.hadoop.mapred.MapReduceBase
View gist:65552
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at org.jruby.javasupport.JavaSupport.loadJavaClass(JavaSupport.java:151)
at org.jruby.javasupport.JavaSupport.loadJavaClassVerbose(JavaSupport.java:160)
at org.jruby.javasupport.JavaClass.forNameVerbose(JavaClass.java:922)
at org.jruby.javasupport.Java.getProxyOrPackageUnderPackage(Java.java:886)
at org.jruby.javasupport.Java.get_proxy_or_package_under_package(Java.java:914)
at org.jruby.javasupport.Java$JavaUtilities.get_proxy_or_package_under_package(Java.java:327)
at org.jruby.javasupport.Java$JavaUtilities$s_method_2_0$RUBYINVOKER$get_proxy_or_package_under_package.call(org/jruby/javasupport/Java$JavaUtilities$s_method_2_0$RUBYINVOKER$get_proxy_or_package_under_package.gen)
View gist:65549
#!/usr/bin/env jruby
require 'java'
require '/Users/bradheintz/project/hadoop/current/lib/commons-logging-1.0.4.jar'
import org.apache.commons.logging.LogFactory
require '/Users/bradheintz/project/hadoop/current/hadoop-0.18.1-core.jar'
import org.apache.hadoop.io.IntWritable
import 'org.apache.hadoop.io.Text'
You can’t perform that action at this time.