Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am zrsmith92 on github.
  • I am zsmith (https://keybase.io/zsmith) on keybase.
  • I have a public key whose fingerprint is BD36 AF85 0A1C 2835 04FD 9AF0 0407 9D4A DAC9 1974

To claim this, I am signing this object:

@zrsmith92
zrsmith92 / external.rs
Created March 2, 2015 18:41
Rust printf interface
use libc::{c_char, c_int};
extern {
#[allow(dead_code)]
pub fn puts(str: *const c_char) -> c_int;
#[allow(dead_code)]
pub fn printf(format: *const c_char, ...) -> c_int;
}
@zrsmith92
zrsmith92 / TimeInterval.java
Created August 3, 2011 14:20
Time Interval
public static String formatTimeInterval(Date time) {
Date now;
if (getInstance().getVirtualDate() != null) {
now = getInstance().getVirtualDate();
} else {
now = new Date();
}
StringBuilder sb = new StringBuilder("in ");
@zrsmith92
zrsmith92 / Locations.java
Created August 1, 2011 20:04
ListActivity subclass with requestWindowFeature()
package edu.northwestern.NUShuttle;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import android.app.ListActivity;
@zrsmith92
zrsmith92 / ScheduleGenerator.js
Created April 16, 2011 20:54
Generates a schedule for multiple meetings in a week to minimize conflicts and maximize attendance.
function GenerateSchedule (rows, members, dates) {
/* ARGUMENTS:
* rows: 2D array of all rows and columns from the table.
* members: 1D array of numbers of members required at each meeting.
* dates: 1D array of date strings pulled from the google spreadsheet.
*/
var c = 0,
i = maxIdx(members),
j = 0,
used = [], // Stores dates previously used.