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
This is a test gist... |
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.Collections; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Reflection; | |
using System.Threading; | |
public class ResourceInspector | |
{ |
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
object stringUtil = new ExpandoObject(); | |
// The CallSite that will handle setting the ToUpper member on stringUtil | |
var set_ToUpper_callSite = CallSite<Func<CallSite, object, Func<string, string>, object>>.Create( | |
Binder.SetMember(CSharpBinderFlags.None, "ToUpper", typeof(Program), | |
new[] | |
{ | |
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null), | |
CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, 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
// Languages\Ruby\Ruby\Builtins\RubyEncoding.cs | |
public static RubyEncoding/*!*/ GetRubyEncoding(Encoding/*!*/ encoding) { | |
ContractUtils.RequiresNotNull(encoding, "encoding"); | |
if (encoding == BinaryEncoding.Instance) { | |
return Binary; | |
} else if (encoding.ToString() == Encoding.UTF8.ToString()) { | |
return UTF8; | |
} else { | |
throw new ArgumentException(String.Format("Unknown encoding: '{0}'", encoding)); | |
} |
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
/* | |
Here's an example of how to get info for a given COM type library. | |
*/ | |
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
/// | |
/// Allows basic access to the windows firewall API. | |
/// This can be used to add an exception to the windows firewall | |
/// exceptions list, so that our programs can continue to run merrily | |
/// even when nasty windows firewall is running. | |
/// | |
/// Please note: It is not enforced here, but it might be a good idea | |
/// to actually prompt the user before messing with their firewall settings, | |
/// just as a matter of politeness. | |
/// |
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
class Foo { | |
static void Bar() { | |
// The following strings are identical, but the first is prettier. | |
string baz = @" | |
Here's some text that will | |
be unindented here | |
in a little while".Unindent(); | |
string sameAsBaz = |
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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
public class DateTimeElapsedEventArgs : EventArgs | |
{ | |
public DateTime DateTime { get; private set; } | |
public DateTimeElapsedEventArgs(DateTime dateTime) | |
{ |
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
// UPDATE: For latest code, see https://github.com/cstrahan/Showdown.as | |
// | |
// Showdown.as -- An ActionScript port of showdown.js | |
// | |
// Copyright (c) 2010 Charles Strahan. | |
// | |
// Original Showdown Copyright (c) 2007 John Fraser. | |
// <http://attacklab.net/showdown/> | |
// | |
// Original Markdown Copyright (c) 2004-2005 John Gruber |
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
// Just for future reference, | |
// here's a quick way to interface with the browser's Javascript `alert' function. | |
import flash.external.ExternalInterface; | |
private function alert(text:String):void | |
{ | |
text = text.replace(/\\/g, "\\\\"); | |
ExternalInterface.call("alert", text); | |
} |
OlderNewer