Skip to content

Instantly share code, notes, and snippets.

View jamietre's full-sized avatar
👨‍💻
hacking

James Treworgy jamietre

👨‍💻
hacking
View GitHub Profile
@jamietre
jamietre / gist:5859816
Last active December 18, 2015 23:09
RunBuild command to invoke a build system for Sublime Text 2 (windows), see http://www.bit-101.com/blog/?p=3439
import sublime
import sublime_plugin
class RunBuildCommand(sublime_plugin.WindowCommand):
def run(self, build_system):
self.window.run_command( "set_build_system", {"file": "Packages/User/"+build_system+".sublime-build" } )
self.window.run_command( "build" )
@jamietre
jamietre / gist:4666146
Last active December 11, 2015 21:58
Arabic encoding test with CsQuery
[Test, TestMethod]
public void TestArabic()
{
bool done = false;
string content = null;
CQ dom;
CQ.CreateFromUrlAsync("http://www.ahram.org.eg/Stars-Arts/News/194972.aspx")
.Then(response =>
@jamietre
jamietre / MethodInfoExtensions
Last active January 7, 2023 06:20
GetSignature extension for PropertyInfo and MethodInfo: returns the detailed method/property signature by reflection
public static class MethodInfoExtensions
{
/// <summary>
/// Return the method signature as a string.
/// </summary>
///
/// <param name="property">
/// The property to act on.
/// </param>
///
@jamietre
jamietre / gist:1285497
Created October 13, 2011 20:54
Example ExpandoObject implementation
public class JsObject : DynamicObject, IDictionary<string, object>, IEnumerable<KeyValuePair<string, object>>
{
public JsObject()
{
Initialize();
}
public JsObject(object missingPropertyValue)
{
Initialize();
@jamietre
jamietre / gist:958863
Created May 6, 2011 12:27
Credit card validator
namespace CreditCards
{
public class CardValidation
{
public bool VerifyDate = true;
public string CardName;
public string CCNumber;
public string CCCSV;
public string CCName;
public string CCExp;