Skip to content

Instantly share code, notes, and snippets.

@gkinsman
gkinsman / about.md
Created August 10, 2011 09:13 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
# .gitignore for .NET projects
# Thanks to Derick Bailey
@gkinsman
gkinsman / DateTimeUtils
Created November 24, 2011 01:50
A utility class for creating a countdown in various timezones to a time of day.
public static class DateTimeUtils {
public static TimeSpan TimeTill(this DateTime now, TimeSpan target) {
//TimeOfDay gives you the time elapsed since midnight as a TimeSpan
var difference = target.Subtract(new TimeSpan(now.Hour,now.Minute,now.Second));
//check for negative TimeSpan,
//it means the target time occurs on the next day, just add 24 hours
if (difference < TimeSpan.Zero)
@gkinsman
gkinsman / gist:1835185
Created February 15, 2012 11:29
Some guy in ##csharp asked for a solution to this...
using System;
using System.Linq;
using System.Collections.Generic;
class Test {
static void Main()
{
var items = new List<string>() {
"foo_20120212",
"foo_20120213",
"foo_20120214",
@gkinsman
gkinsman / jQuery.ajaxQueue.min.js
Created September 4, 2012 04:19 — forked from gnarf/jQuery.ajaxQueue.min.js
jQuery.ajaxQueue - A queue for ajax requests
/*
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
*/
(function(a){var b=a({});a.ajaxQueue=function(c){function g(b){d=a.ajax(c).done(e.resolve).fail(e.reject).then(b,b)}var d,e=a.Deferred(),f=e.promise();b.queue(g),f.abort=function(h){if(d)return d.abort(h);var i=b.queue(),j=a.inArray(g,i);j>-1&&i.splice(j,1),e.rejectWith(c.context||c,[f,h,""]);return f};return f}})(jQuery)
{
"maxcount": 20,
"login-enabled": false,
"msg-hiddennamejoin": "Player joined",
"quitmessage": "%playername% quit",
"webchat-requires-login": false,
"worlds": [
{
"center": {
"z": 300,
@gkinsman
gkinsman / gist:6602731
Created September 18, 2013 00:23
Slight modification of http://tomasp.net/blog/2013/tuples-in-csharp/index.html to group by not only parameter type, but name as well
(*@
Note that this is directly from his blog post on https://github.com/tpetricek/TomaspNet.Website/blob/master/source/blog/2013/tuples-in-csharp.fsx
The only minor addition is on L162:
yield [ for p in meth.GetParameters() -> p.ParameterType.ToString() + ": " + p.Name ] }
where we added the name of the parameter in the key for the grouping. Results are interesting!
Also added a Dump on L180 for LinqPad :)
*)
@gkinsman
gkinsman / Program
Last active August 29, 2015 14:27
Solution to Liam's Challenge 22/08/2015
using System;
namespace SemitoneCalculator
{
public static class ToneExtensions
{
public static Tone Up(this Tone tone)
{
return tone.Name == ToneName.B
? new Tone(ToneName.C, tone.Octave + 1)
@gkinsman
gkinsman / EnumerableOfStringParser
Created March 10, 2016 06:26
EnumerableOfStringParser
public class EnumerableOfStringParser : IValueParser
{
private readonly string _separator;
public EnumerableOfStringParser(string separator = null)
{
_separator = separator;
}
public bool CanParse(Type settingValueType)
import {customAttribute} from 'aurelia-framework';
import {autoinject} from 'aurelia-framework';
import * as $ from "jquery";
@autoinject
@customAttribute('found')
export class FoundationCustomAttribute {
constructor(private element: Element) {
}