Skip to content

Instantly share code, notes, and snippets.

View NickJosevski's full-sized avatar

Nick Josevski NickJosevski

View GitHub Profile
@NickJosevski
NickJosevski / hg-to-git-merge.sh
Created May 17, 2012 06:13
A neat migration bash script for migration of Hg to Git, from Paul Jenkins
Requirements: Hg, Hg-Git, Git Bash
#!/bin/sh
hg clone $2 $1
cd $1
hg bookmark -r default master
hg gexport
mv .hg/git .git
rm -rf .hg
git init
@NickJosevski
NickJosevski / site_create.ps1
Created August 22, 2012 12:51
Multiple IIS site creation, via PowerShell
Write-Host "Remember to run in an x86 Powershell"
Import-Module WebAdministration
$start_dir = Get-Location
CD IIS:\
New-Item AppPools\test.pool
Set-ItemProperty IIS:\AppPools\test.pool -name "enable32BitAppOnWin64" -Value "true"
@NickJosevski
NickJosevski / parseUri.coffee
Created August 23, 2012 06:16 — forked from mrclay/UFCOE.parseUri.js
Parse a URI using the browser's DOM (CoffeeScript)
class UriHelpers
parseUri: (url) ->
k = window.Common.UrlHelpers.UriParseModes
a || (a = window.document.createElement('a'))
#Let browser do the work
a.href = url
r = {}
r[k[i]] = a[k[i]] for i in [0..8]
@NickJosevski
NickJosevski / equatable.cs
Created September 18, 2012 03:42
IEquatable<T> Interface implementation
protected bool Equals(MyClass other)
{
return Equals(Id, other.Id) && Equals(Name, other.Name) && Equals(Desc, other.Desc);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj))
{
return false;
@NickJosevski
NickJosevski / jQuery.ajaxQueue.coffee
Created November 25, 2012 02:29
CoffeeScript version of jQuery.ajaxQueue
# <reference path="jquery-1.8.0.min.js" />
# from: https:#gist.github.com/1039247
###
* jQuery.ajaxQueue - A queue for ajax requests
*
* (c) 2011 Corey Frang
* Dual licensed under the MIT and GPL licenses.
*
* Requires jQuery 1.5+
@NickJosevski
NickJosevski / sqlpurgeloop.sql
Created December 10, 2012 04:29
purge loop, why?
SET @rows = 5 --default
IF @purgeDate is NULL SET @purgeDate=getdate()
-- Only execute if there is work to do and continue
-- until all records with a PurgeDate <= now are deleted
WHILE EXISTS(SELECT * FROM WorkItemStatus WHERE PurgeDate <= @purgeDate)
BEGIN
@NickJosevski
NickJosevski / FSharpOptionConverter.cs
Last active March 5, 2016 20:26
FSharpOptionConverter : JsonConverter
public class FSharpOptionConverter : JsonConverter
{
private static MethodInfo _getInnerValue = typeof (FSharpOptionConverter).GetMethod("GetInnerValue",
BindingFlags.Instance |
BindingFlags.NonPublic);
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
if (value != null)
{
var optionValueType = value.GetType().GetGenericArguments().Single();
@NickJosevski
NickJosevski / jira-cookie-auth-comment-post.fs
Last active April 8, 2016 11:53
Cookie based authentication with JIRA (F# and RestSharp)
open RestSharp
type PostData = {
body: string
}
type Login = {
username : string
password : string
}
function Select-Folder($message='Select a folder', $path = 0) {
$object = New-Object -comObject Shell.Application
$folder = $object.BrowseForFolder(0, $message, 0, $path)
if ($folder -ne $null) {
$folder.self.Path
}
}
function Add-Zip
@NickJosevski
NickJosevski / UsedGuidBasicInput.csx
Last active September 10, 2016 10:45
AzureFunctions - UsedGuidBasicInput
using System.Net;
public class Input
{
public string Guid {get;set;}
public string UsedBy { get;set;}
}
public static async Task<HttpResponseMessage>
Run(HttpRequestMessage req, TraceWriter log)