Skip to content

Instantly share code, notes, and snippets.

function JayrockChannel()
{
this.rpc = function(call)
{
var async = typeof(call.callback) === 'function';
var xhr = newXHR();
xhr.open('POST', call.url, async, this.httpUserName, this.httpPassword);
xhr.setRequestHeader('Content-Type', this.contentType || 'application/json; charset=utf-8');
xhr.setRequestHeader('X-JSON-RPC', call.request.method);
if (async) xhr.onreadystatechange = function() { xhr_onreadystatechange(xhr, call.callback); }
@atifaziz
atifaziz / s3.py
Created November 25, 2008 21:48
Command-line interface for LitS3
# The MIT License
#
# Copyright (c) 2008, Atif Aziz
#
# 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 the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@atifaziz
atifaziz / procmon.py
Created December 2, 2008 17:11
Re-launches a process if it dies
# Process Monitor
#
# Re-launches a process if it dies.
#
# Public Domain
# http://en.wikipedia.org/wiki/Public_domain
# Written by
# Atif Aziz, http://www.raboof.com
# Adapted from
# http://bartdesmet.net/blogs/bart/archive/2006/08/30/4366.aspx
@atifaziz
atifaziz / gcpdl.py
Created December 2, 2008 23:53
Google Code Project Downloads
# Process Monitor
#
# Re-launches a process if it dies.
#
# Public Domain
# http://en.wikipedia.org/wiki/Public_domain
# Written by
# Atif Aziz, http://www.raboof.com
# Adapted from
# http://bartdesmet.net/blogs/bart/archive/2006/08/30/4366.aspx
@atifaziz
atifaziz / sendmail.py
Created December 8, 2008 16:42
IronPython program to send mail
# Copyright (c) 2008, Atif Aziz.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
@atifaziz
atifaziz / JamesFormatter.cs
Created January 5, 2009 10:49
Updated JamesFormatter from Fun with Named Formats
// http://haacked.com/archive/2009/01/04/fun-with-named-formats-string-parsing-and-edge-cases.aspx#70316
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Web.UI;
namespace StringLib
{
using System.Web;
// http://groups.google.com/group/jayrock/t/4428c08b81d43485
using System;
using Jayrock.Json.Conversion;
class Program
{
static void Main()
{
const string json = @"{
@atifaziz
atifaziz / HenriFormatter.cs
Created January 16, 2009 10:02
Updated HenriFormatter from Named Formats Redux
// http://haacked.com/archive/2009/01/14/named-formats-redux.aspx#70485
using System;
using System.Text;
using System.Web;
using System.Web.UI;
namespace StringLib
{
public static class HenriFormatter
@atifaziz
atifaziz / gist:49432
Created January 20, 2009 11:05
JavaScript map, reduce, group, distinct
Object.properties = function(obj, includeFunctions)
{
var props = [];
for (var prop in obj)
{
if (true === includeFunctions || 'function' !== typeof obj[prop])
props.push(prop);
}
return props;
}
@atifaziz
atifaziz / DictionaryObject.cs
Created January 21, 2009 14:23
KeyedCollection implementing ICustomTypeDescriptor
#region Imports
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Collections.ObjectModel;
#endregion