Skip to content

Instantly share code, notes, and snippets.

Steve Pack stevenpack

Block or report user

Report or block stevenpack

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 confluence-api.py
#!/usr/bin/env python
# Copyright (C) 2013 Remy van Elst
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
View ExpiringCache.rs
use std::collections::{BTreeMap, HashMap};
use std::hash::Hash;
use std::cmp::Ordering;
pub struct Cache<'a, K: 'a,V: 'a> where K : Eq + Hash, V: Ord {
map: HashMap<K,V>,
keys: BTreeMap<&'a V, &'a K>
}
impl<'a, K,V> Cache<'a, K,V> where K : Eq + Hash, V: Ord {
View PrintMutSliceBuf.rs
fn accept_udp_connection(mio_server: &MioServer) {
println!("the server socket is ready to accept a UDP connection");
let mut buf = Vec::<u8>::new();
let mut mut_slice_buf = MutSliceBuf::wrap(&mut buf);
match mio_server.udp_server.recv_from(&mut mut_slice_buf) {
Ok(Some(addr)) => {
println!("remaining is {}", mut_slice_buf.remaining());
match String::from_utf8(buf) {
Ok(str) => {
@stevenpack
stevenpack / batch_promise.js
Created Sep 2, 2015
Execute promises in batches
View batch_promise.js
/**
* Created by steve on 1/09/15.
*/
var q = require('q');
function Task(fn, arg) {
this.fn = fn;
this.arg = arg;
}
@stevenpack
stevenpack / Logs Style 1
Created Dec 12, 2011
NullReferenceExceptions from monodroid 4.0 with no stack trace
View Logs Style 1
Error Style 1 (99% of the time)
===============================
2011-12-10 07:51:00.618 I 19579/ActivityThread: Publishing provider
com.xxxdictionary.android.__mono_init__: mono.MonoRuntimeProvider
2011-12-10 07:51:00.628 D 19579/dalvikvm: Trying to load lib
/data/data/com.xxxdictionary.android/lib/libmonodroid.so 0x44e02450
2011-12-10 07:51:00.658 D 19579/dalvikvm: Added shared lib
You can’t perform that action at this time.