Skip to content

Instantly share code, notes, and snippets.

View milang's full-sized avatar

Milan Gardian milang

  • Calgary, Alberta, Canada
  • 17:49 (UTC -06:00)
View GitHub Profile
@echo off
rem | Remove old npm and bower modules, then install them from scratch.
rem | Intended to be used in TeamCity as a preparation step when building
rem | any node projects.
rem |
rem | Source-controlled in https://gist.github.com/milang/692088e4301dab3bfe2a
setlocal
@echo off
rem | Source-controlled in https://gist.github.com/milang/574854b76a31b30712aa
echo ##teamcity[blockOpened name='nuget install']
call build\NuGet\NuGet.exe install .nuget\Packages.config -ConfigFile build\NuGet\NuGet.config -ExcludeVersion || goto :failed-install
echo ##teamcity[blockClosed name='nuget install']
echo ##teamcity[blockOpened name='clientconfiggen']
call build\NuGet\nuget_modules\Pandell.Pli.Tools\tools\ClientConfigGen.exe ^
/*jslint indent: 2, vars: true, browser: true */
/*global indexedDB: false */
(function () {
"use strict";
function changeStoreName(oldName, newName, db) {
if (oldName) {
window.console.log("DB upgrade: renaming '" + oldName + "'' to '" + newName + "'");
db.deleteObjectStore(oldName);
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Event cancel test</title>
<style>
html,body { margin:0; padding:0; background-color:White; overflow:auto; }
body { font:11px Helvetica,Arial,sans-serif; }
#container { background-color:#FFB0B0; padding:5em; float:left; }
private static int[] SelectionSort(int[] value)
{
if (value != null && value.Length > 1)
{
for (var targetIndex = 0; targetIndex < value.Length - 1; ++targetIndex)
{
var minIndex = targetIndex;
for (var index = targetIndex + 1; index < value.Length; ++index)
{
if (value[index] < value[minIndex])
using System;
using System.Collections.Generic;
using System.Linq;
namespace SelectionSort
{
public static class Program
{
private static int[] SelectionSort(int[] value)
{
@milang
milang / TeamCityProperties.ps1
Last active May 5, 2016 21:08
TeamCity artifact properties
#Requires -version 3
$errorActionPreference = 'Stop'
function UnzipProperties($zipName) {
$zipName = (Resolve-Path $zipName).Path
$zipOutName = $zipName -replace '\.gz$', ''
try {
$in = New-Object System.IO.FileStream $zipName, ([IO.FileMode]::Open), ([IO.FileAccess]::Read), ([IO.FileShare]::None)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Input data
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let stringToDigits = Seq.map (Char.GetNumericValue >> int)
let data = stringToDigits "525544371475555531777715244182678432191828599959422153163624294499836371611929484583857994356254324723996955579177239268156788344983798211923953632534126352441539712382435846789196376294872332777454571585154242983211917913991447152351533224731744171918455689136217926736832548664237668565775962387685495872163657421987124964577373859775142995943746687616627375552487335145295141162847935252236771426971851483893328386142598256285484547151265255563392287812855892612393594185853244637881592957345277534859969398283469975773471418783133754647451567857715872175192156214559116663427969929941826915855755799658388164246827461819633526734289749848686992526289612514686712459658798953149589164668152825962467479272814652684971113914626879943633461897454753956158758126888644929181733523285939149383916711124637649319198514584853
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Input data
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let parse filename =
File.ReadAllLines(filename)
|> Seq.map (fun line ->
line.Split('\t') |> Seq.map Int32.Parse)
let data = parse "queries/Advent/Advent2017-day02.txt"
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Input data
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let parse filename =
File.ReadAllLines(filename)
|> Seq.map (fun line -> line.Split(' '))
let data = parse "queries/Advent/Advent2017-day04.txt"