Skip to content

Instantly share code, notes, and snippets.

View sirtony's full-sized avatar

Tony King sirtony

  • Philadelphia, PA, USA
  • 07:57 (UTC -04:00)
View GitHub Profile
@sirtony
sirtony / annotations.d
Last active August 29, 2015 14:07
Helpful user-defined attributes for marking TODOs and FIXMEs with code to be notified at compile time, rather than with comments and grepping for them later.
module annotations;
private {
import std.string;
import std.traits;
import std.array;
}
private template TargetInfo( alias target )
{
@sirtony
sirtony / envy.d
Last active August 29, 2015 14:08
A simple class to modify environment variables (Windows-only).
module envy;
version( Windows ):
private {
import std.windows.registry;
}
private enum ENV_KEY = "Environment";
@sirtony
sirtony / NotNull.cs
Last active August 29, 2015 14:12
Represents a reference type that may never be assigned a value of null.
public struct NotNull<T> where T : class
{
private T mValue;
public T Value
{
get { return this.mValue; }
set
{
if( value == null )
throw new ArgumentNullException( "value" );
@sirtony
sirtony / lines.d
Created December 27, 2014 23:29
Counts all lines in source code files.
module lines;
import std.file;
import std.path;
import std.stdio;
import std.regex;
import std.getopt;
import std.string;
import std.traits;
import std.algorithm;
@sirtony
sirtony / Callback.d
Last active August 29, 2015 14:15
A struct that wraps both function and delegate types, allowing them to be used interchangeably.
final struct Callback( TRet = void, TArgs ... )
{
public alias TRet delegate( TArgs ) DelegateType;
public alias TRet function( TArgs ) FunctionType;
private DelegateType dg;
private FunctionType fn;
public this( DelegateType dg ) { this.dg = dg; }
public this( FunctionType fn ) { this.fn = fn; }
@sirtony
sirtony / grep.d
Created March 2, 2015 19:59
A grep-like tool written in D.
module grep;
private:
import std.stdio;
import std.regex;
import std.getopt;
import std.range;
import std.file;
import std.path;
@sirtony
sirtony / Fakku.user.js
Last active July 22, 2017 07:00
A simple userscript to enable direct-downloading of content on fakku.net
// ==UserScript==
// @name FAKKU! Download
// @namespace https://github.com/SirTony
// @version 1.8
// @description Enables direct-downloads on FAKKU.net
// @author Tony J. Ellis
// @include /^https?:\/\/(?:www\.)?fakku\.net\/(?:manga|doujinshi)/
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jszip/2.4.0/jszip.min.js
// @require https://raw.githubusercontent.com/Stuk/jszip-utils/master/dist/jszip-utils.min.js
@sirtony
sirtony / ResourcePool.cs
Created April 2, 2015 23:05
A mirror of the ResourcePool<T> from xnawiki.com
/// <summary>
/// A pre-allocated pool of objects with the ability to sort
/// and maintain objects as they become invalidated.
/// </summary>
/// <typeparam name="T">The type of object the pool will hold.</typeparam>
public class ResourcePool<T> where T : class
{
#region Variables
private ValidateObject objectCheck;
@sirtony
sirtony / Mond.YAML
Created June 25, 2015 08:07
Mond syntax definition for Sublime Text and TextMate.
# [PackageDev] target_format: plist, ext: tmLanguage
---
name: Mond
scopeName: source.mond
fileTypes: [ mond, mnd ]
uuid: 0a4b2933-843d-45c6-bd2f-6615d69f3800
# This syntax definition could be a lot more advanced,
# but it properly colours all the important stuff,
# so it's good enough for now.
@sirtony
sirtony / 0.HowTo.md
Last active August 29, 2015 14:26
Visual Studio Code syntax definition for the D programming language.

How to install

  1. Locate the Visual Studio Code's installation directory (usually this is C:\Users\<UserName>\AppData\Local\Code\app-<version> where <UserName> is the current Windows user name, and where <version> is the version you want to modify [e.x. 0.4.1])
  2. Navigate to <InstallPath>\resources\app\plugins where <InstallPath> is the path you located in step 1.
  3. Create a new folder named vs.language.d and open it.
  4. Inside of vs.landuage.d create a new folder named syntaxes and open it.
  5. Save or download the d.json file in this gist and place it inside the syntaxes folder.
  6. Restart all instances of Visual Studio Code.
  7. Done.