This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
[Nums1] AS (SELECT 1 AS [Value] UNION SELECT 2 AS [Value]) | |
, [Nums2] AS (SELECT A.* FROM [Nums1] AS A, [Nums1] AS B, [Nums1] AS C) | |
, [Nums3] AS (SELECT A.* FROM [Nums2] AS A, [Nums2] AS B, [Nums2] AS C) | |
, [Nums4] AS (SELECT A.* FROM [Nums3] AS A, [Nums3] AS B) | |
, [Nums] AS (SELECT TOP(1000) ROW_NUMBER() OVER(ORDER BY (SELECT 0)) AS [n] FROM[Nums4]) | |
, [Data] AS (SELECT 1 AS [id], N'The upcoming release of SQL Server is codenamed Denali. It is also called SQL11 which refers to version 11 and peple misunderstand it to be SQL Server 2011.' AS [comment] UNION SELECT 2 AS [id], N'SQL Server Denali CTP 3 introduced a number of TSQL enhancements.' AS [comment]) | |
, [Sentences] AS ( | |
SELECT [id] | |
, [comment] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using iTunesLib; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ValueComparer<T> : IEqualityComparer<T> | |
{ | |
private readonly Func<T, object>[] _valueSelectors; | |
private readonly Func<T, int> _hashCodeFunction; | |
public ValueComparer(params Func<T, object>[] valueSelectors) | |
: this(t => t.GetHashCode(), valueSelectors) | |
{ | |
_valueSelectors = valueSelectors; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ChainedComparer<T> : IComparer<T> | |
{ | |
private readonly Func<T, T, int>[] _compareFunctions; | |
public ChainedComparer(params Func<T, T, int>[] compareFunctions) | |
{ | |
_compareFunctions = compareFunctions; | |
} | |
public ChainedComparer(params Func<T, IComparable>[] comparableValueSelectors) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "iTunes" | |
set podcast_playlist to some playlist whose special kind is Podcasts | |
set podcasts_to_convert to file tracks of podcast_playlist | |
repeat with podcast_to_convert in podcasts_to_convert | |
set podcast_location to location of podcast_to_convert | |
if not podcast_location is missing value then | |
set podcast_location to "" & podcast_location | |
if podcast_location does not contain "mp3" then | |
convert podcast_to_convert | |
-- display dialog podcast_location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class SqlCommandExtensions | |
{ | |
public static void ResultsToConsole(this SqlCommand sqlCommand) | |
{ | |
using (var sqlDataReader = sqlCommand.ExecuteReader()) | |
{ | |
while (sqlDataReader.Read()) | |
{ | |
Console.WriteLine(); | |
for (var i = 0; i < sqlDataReader.FieldCount; ++i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var parser = require('xml2json'); | |
var fs = require('fs'); | |
var cwd = process.cwd(); | |
fs.readdir(cwd, function(err, files) { | |
if(err){ | |
console.log(err); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Suit = | |
| Spades | |
| Hearts | |
| Diamonds | |
| Clubs | |
type Rank = | |
| Ace | |
| King | |
| Queen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find /c/src/Git -type d -mindepth 1 -maxdepth 1 -exec git --work-tree={} --git-dir={}/.git fetch \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let (|Array|_|) pattern toMatch = | |
let patternLength = Array.length pattern | |
let toMatchLength = Array.length toMatch | |
let tailLength = toMatchLength - patternLength | |
if patternLength > toMatchLength then | |
None | |
else | |
let firstElementsAreEqual = [ 0 .. (patternLength - 1) ] |> Seq.forall (fun i -> pattern.[i] = toMatch.[i]) | |
if firstElementsAreEqual then |
OlderNewer