This file contains hidden or 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
# DANGER - Kills all processes for a specific database | |
-- DECLARE @SQL varchar(max); | |
-- SELECT @SQL = COALESCE(@SQL,'') + 'Kill ' + Convert(varchar, r.session_id) + ';' from sys.dm_exec_requests r left join sys.dm_os_waiting_tasks t | |
-- on r.session_id = t.session_id where r.session_id >= 50 and r.session_id <> @@spid | |
-- EXEC(@SQL) |
This file contains hidden or 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
//External state | |
let z = 5; | |
//this closure implicitly contains the value of z | |
let closure = function(x){ | |
return x + z; | |
} | |
//The above loosely translates to.. | |
class ObjectClosure{ |
This file contains hidden or 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
module App { | |
export class PagedList<T>{ | |
private page: number; | |
private list: IList<T>; | |
private items: T[]; | |
private itemsPerPage: number; | |
private numOfPages: number; | |
private count: number; | |
constructor(list: IList<T>, itemsPerPage = 10) { |
This file contains hidden or 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
module App.Directives { | |
var Directive = function (): ng.IDirective { | |
return { | |
restrict: "A", | |
scope: { | |
location: "@navigate" | |
}, | |
link: function (scope: any, el, attrs) { | |
el.click(function () { | |
document.location.href = scope.location; |
This file contains hidden or 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
(* SICP Chapter #01 Examples in F# *) | |
#light | |
(* 1.1.1 The Elements of Programming - Expressions *) | |
486 | |
137 + 349 | |
1000 - 334 | |
5 * 99 | |
10 / 5 | |
2.7 + 10.0 |
This file contains hidden or 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
namespace Ninject.Web | |
open Ninject.Modules | |
open Pocket.Core | |
open System | |
open System.Reflection | |
open System.Web.Mvc | |
open Ninject | |
open Microsoft.FSharp.Core.Operators |
This file contains hidden or 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 partial class Prelude | |
{ | |
/// <summary> | |
/// Curry the function 'f' provided. | |
/// You can then partially apply by calling: | |
/// | |
/// var curried = curry(f); | |
/// var r = curried(a)(b) | |
/// | |
/// </summary> |
This file contains hidden or 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
// This sample will guide you through elements of the F# language. | |
// | |
// ******************************************************************************************************* | |
// To execute the code in F# Interactive, highlight a section of code and press Alt-Enter in Windows or | |
// Ctrl-Enter Mac, or right-click and select "Send Selection to F# Interactive". | |
// You can open the F# Interactive Window from the "View" menu. | |
// ******************************************************************************************************* | |
// For more about F#, see: |
This file contains hidden or 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
// Licensed to the .NET Foundation under one or more agreements. | |
// The .NET Foundation licenses this file to you under the MIT license. | |
// See the LICENSE file in the project root for more information. | |
using System.Collections.Generic; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
using System.Threading.Tasks; | |
This file contains hidden or 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
/** | |
* Credit http://www.myersdaily.org/joseph/javascript/md5-text.html | |
*/ | |
module MD5 { | |
function md5cycle(x, k) { | |
var a = x[0], | |
b = x[1], | |
c = x[2], | |
d = x[3]; |