This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* MIT License | |
* Copyright (c) 2013 Chris Stefano | |
* [email protected] | |
*/ | |
public static class ControlInvokeSupport | |
{ | |
public delegate void SafeControlInvokeHandler<TControl>(TControl control) | |
where TControl : Control; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MIT License | |
// Copyright (c) 2009 Chris Stefano <[email protected]> | |
// https://gist.github.com/virtualstaticvoid/105255 | |
// | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DelegateExtensions | |
{ | |
public static Func<T> Before<T>(this Func<T> func, Action before) | |
{ | |
return () => | |
{ | |
before(); | |
return func(); | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace MyNamespace | |
{ | |
public static class MyExtensions | |
{ | |
public static void Fire<TSender, TEventArgs>(this EventHandler<TSender, TEventArgs> myEvent, TSender sender, TEventArgs e) | |
where T EventArgs: EventArgs | |
{ | |
if(myEvent != null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# taken from http://www.daybarr.com/blog/how-to-list-all-subdirectories-of-a-directory-in-bash | |
To (non-recursively) list all children of a directory in bash | |
find . -type d -maxdepth 1 -mindepth 1 | |
and to do the same but omitting the .svn directory (subversion's working copy info) | |
find . -type d -maxdepth 1 -mindepth 1 -not -name .svn | |
Useful in constructs such as | |
view sourceprint? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'kernel_using' | |
class ResourceConsumer | |
def open() | |
puts 'Opening up...' | |
end | |
def close() | |
puts 'Closing up...' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Xml; | |
using System.Xml.XPath; | |
public static class XPathHelp | |
{ | |
public static string GetXPathForNode(XmlNode node) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Creates a Git repository, fetches and checks out a single branch from the remote repository | |
# | |
url=$1 | |
branch=$2 | |
git init |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Poor Man's Fiber (API compatible Thread based Fiber implementation for Ruby 1.8) | |
# (c) 2008 Aman Gupta (tmm1) | |
unless defined? Fiber | |
require 'thread' | |
class FiberError < StandardError; end | |
class Fiber | |
def initialize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'ruote' | |
engine = Ruote::Engine.new(Ruote::Worker.new(Ruote::HashStorage.new)) | |
engine.register do | |
catchall Ruote::StorageParticipant | |
end |
OlderNewer