Skip to content

Instantly share code, notes, and snippets.

@dlidstrom
dlidstrom / watch.ps1
Created June 15, 2016 10:12
watch a file changes in the current directory
# watch a file changes in the current directory,
# execute some command when a file is changed or renamed
param($BatFile)
if (($BatFile -eq $null) -or (-not (Test-Path -Path $Batfile)))
{
"Specify bat file to run continuously."
exit
}
// Preferences.sublime-settings
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
    "draw_white_space": "all",
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true
}
namespace SemanticModelTest
{
[TestFixture]
public class ModelTest
{
[Test]
public void RaisesEvents()
{
// Act
var user = new User();
@dlidstrom
dlidstrom / ppm.py
Last active September 29, 2015 07:41
Intended to be an entry in pcmcontest.
import random
moves = ['R', 'P', 'S']
dna_encode = {
'PP': '1', 'PR': '2', 'PS': '3',
'RP': '4', 'RS': '5', 'RR': '6',
'SS': '7', 'SP': '8', 'SR': '9' }
beat_move = {'R': 'P', 'P': 'S', 'S': 'R'}
output = ''
@dlidstrom
dlidstrom / Bowling.md
Last active September 23, 2015 10:23

“Straighter is greater” — Walter Ray Williams, legendar

“Älska att vinna; få aldrig nog av att göra strike. Alla kan göra strike men vinnaren gör även spärr. Spärra så får du chansen att vinna.” — Lidas, Fredrikshof IF

@dlidstrom
dlidstrom / isPrime.js
Created September 16, 2015 10:05
Primality checking using regular expression.
// http://rosettacode.org/wiki/Primality_by_trial_division#By_Regular_Expression
function isPrime(n) {
var e = /^1?$|^(11+?)\1+$/;
return !e.exec('1'.repeat(n));
}
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using StackExchange.Profiling;
using StackExchange.Profiling.EntityFramework6;
namespace EffortTest
{
@dlidstrom
dlidstrom / Program.cs
Created June 8, 2015 15:02
Complete example on how to retrieve search highlightings using RavenDB
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Raven.Abstractions.Data;
using Raven.Abstractions.Indexing;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
@dlidstrom
dlidstrom / watch.ps1
Last active October 14, 2015 07:46
Runs a batch file continuously whenever another file is changed.
# watch a file changes in the current directory,
# execute all tests when a file is changed or renamed
param($BatFile)
if (($BatFile -eq $null) -or (-not (Test-Path -Path $Batfile)))
{
"Specify bat file to run continuously."
exit
}