Skip to content

Instantly share code, notes, and snippets.

@fuzeman
fuzeman / Procfile
Created July 22, 2013 00:15
iceJabbR origin proxy
web: python icejabbr-origin.py
define([
'jabbr/events'
], function (events) {
return function (processor) {
processor.bind(events.processor.beforeProcessPlainContent, function (event, handler) {
var re = /(?:\*|_)([^\*_]*)(?:\*|_)/g,
match = null,
result = handler.get();
//Replaces *test* occurrences in message with <i>test</i> so you can use italics
@fuzeman
fuzeman / email_regex.cs
Created June 28, 2013 02:40
CodeEval 35 - Email Validation
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
namespace Solutions.EmailValidation
{
public class EmailValidation
{
@fuzeman
fuzeman / primepalindrome.cs
Created June 5, 2013 06:14
CodeEval Prime Palindrome (003)
using System;
using System.Linq;
namespace Solutions.PrimePalindrome
{
public class Program
{
static void Main(string[] args)
{
Console.Write(PrimePalindrome.Solve());
@fuzeman
fuzeman / fizzbuzz.cs
Created June 5, 2013 05:30
CodeEval Fizz Buzz (001)
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
namespace Solutions
{
public class Program
{
@fuzeman
fuzeman / get_default_address
Created March 30, 2013 17:21
Get local IPv4 address using sockets (cross-platform, std lib)
def get_default_v4_address():
return get_default_address("8.8.8.8")
def get_default_address(host):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect((host, 80))
address = s.getsockname()[0]
s.close()
except socket.gaierror, e:
@fuzeman
fuzeman / make_element
Created March 30, 2013 17:14
Element Tree - One-line element creation with text attribute.
def make_element(name, text):
elem = et.Element(name)
elem.text = text
return elem