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: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;
@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 / 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: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 / 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 / Microsoft.Typescript.targets
Created April 29, 2016 18:14
Better msbuild config for Typescript projects in Visual Studio that tries to use npm modules first
<?xml version="1.0" encoding="utf-8"?>
<!--
***********************************************************************************************
Microsoft.TypeScript.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your web deploy projects from the command-line or the IDE.
This file defines the steps in the standard build process for TypeScript files.
@jamietre
jamietre / transcodemvc.bat
Last active September 16, 2023 01:14
Batch file for transcoding MVC 3D streams in an MKV container
@ECHO OFF
rem usage: transcodemvc input output [-r] [-s]
rem -r will re-use a previously extracted elementary stream from the temp file location
rem -s will swap eyes
set TEMP_DIR=c:\temp\recodemvc
set TEMP_FILE=%TEMP_DIR%\temp_mvc.264
set PROFILE=high
set SWAP=false
@jamietre
jamietre / README.md
Last active July 23, 2017 12:42
List of "right eye first" blu ray movies
  • Bait
  • The Chronicles of Narnia: The Voyage of the Dawn Trader
  • The Darkest Hour
  • Dolphin Tale
  • Drive Angry
  • Edge of Tomorrow
  • Ghostbusters (2016)
  • Gulliver's Travels
  • The Hobbit: An Unexpected Journey
  • The Hobbit: The Desolation of Smaug
@jamietre
jamietre / pc-rules.erb
Last active February 16, 2024 10:51
Karabiner Elements config to map home/end keys to PC-like behavior on MacOS X
{
"title": "MacOS -> PC Shortcuts",
"rules": [
{
"description": "Top/bottom of document (ctrl+home/ctrl+end)",
"manipulators": [
{
"type": "basic",
"from": <%= from("home", ["command"], ["any"]) %>,
"to": <%= to([["up_arrow", ["left_command"]]]) %>,
@jamietre
jamietre / gist:e031894cd689342d8ee47be132b77528
Last active December 27, 2017 15:44
zsh config for windows-like inline text editing in iterm2 console in MacOS X
# add to .zshrc
r-delregion() {
if ((REGION_ACTIVE)) then
zle kill-region
else
zle $1
fi
}