Skip to content

Instantly share code, notes, and snippets.

View dalager's full-sized avatar

Christian Dalager dalager

View GitHub Profile
@dalager
dalager / gist:7571978
Created November 20, 2013 22:08
BoxStarter
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Enable-RemoteDesktop
cinst fiddler4
cinst git-credential-winstore
cinst EthanBrown.ConEmuConfig
cinst sublimetext2
cinst poshgit
cinst 7zip
cinst filezilla
/// <summary>
/// Get a specific user's profile
/// </summary>
/// <param name="encodedUserId"></param>
/// <param name="callback"></param>
/// <returns></returns>
public void GetUserProfile(string encodedUserId, Action<UserProfile, FitbitException> callback)
{
string apiCall;
@dalager
dalager / Program.cs
Created February 23, 2012 14:25
Kolonnesplitter
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
@dalager
dalager / JsonExpandoTests.cs
Created October 11, 2011 12:51
UnitTest illustrating JSON.NET ExpandoObject Serialization
[TestFixture]
public class JsonExpandoTests{
[Test]
public void FromJsonToExpando()
{
var json = "{\"Name\":\"Eksponent\",\"Rate\":33.2,\"OrgCode\":123}";
dynamic org = JsonConvert.DeserializeObject<ExpandoObject>(json);
Assert.AreEqual("Eksponent",org.Name);
@dalager
dalager / PodioClient.cs
Created October 10, 2011 11:34
Simple Podio Auth with .NET
public class PodioClient
{
public PodioClient()
{
_authkeys = new AuthKeys();
}
private DateTime ExpectedExpiry { get; set; }
private double ExpiresIn { get; set; }
private string RefreshToken { get; set; }
@dalager
dalager / gist:1180730
Created August 30, 2011 11:51
Javascript Lint
<?xml version="1.0" encoding="utf-8" ?>
<Project DefaultTargets = "Main" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<siteRoot>$(MSBuildProjectDirectory)\..\Intranet Project\Intranet website</siteRoot>
</PropertyGroup>
<ItemGroup>
<JsFiles Include="$(siteRoot)\content\js\BHFUtil.js" />
@dalager
dalager / assemblalist.js
Created July 26, 2011 18:48
Assembla Simple Ticket List bookmarklet
jQuery('.menu-submenu').after(jQuery('<div style="overflow:auto;width:400px;height:500px;margin:10px;">').html(jQuery('table.tickets tbody tr').map(function(i,e){return '<a href="https://www.assembla.com'+jQuery(e).find('td.number a').attr('href')+'">#'+jQuery(e).find('td.number').text().trim()+'</a> '+jQuery(e).find('td.summary').text();}).toArray().join('<br>\n\r')));
@dalager
dalager / DisplayNameHelper.cs
Created July 22, 2011 07:56
GetDisplayNameFor<MyType>(x=>x.MyProperty);
/// <summary>
/// Get the DataAnnotation attributed DisplayName attribute value.
/// </summary>
/// <example>
/// GetDisplayNameFor&lt;VagtTyper&gt;(x =&gt; x.Doegnvagt) ==&gt; "Døgnvagt"
/// </example>
/// <typeparam name="TSource"></typeparam>
/// <param name="propLambda"></param>
/// <returns></returns>
public string GetDisplayNameFor<TSource>(Expression<Func<TSource,object>> propLambda)
@dalager
dalager / twitrotator.html
Created May 24, 2011 11:23 — forked from jesperbjensen/twitrotator.html
Simple tweet rotator
<!DOCTYPE html>
<html>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js">
</script>
<script type="text/javascript" charset="utf-8">
var query = 'askhybel';
$(function() {
$.getJSON("http://search.twitter.com/search.json?callback=?&q=" + query,
function (r) {
@dalager
dalager / gist:842109
Created February 24, 2011 12:27
Log.cs - log4net wrapper
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using log4net;
using log4net.Config;
namespace Core
{
/// <summary>