using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
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
const moment = require('moment'); | |
const momentDurationFormatSetup = require('moment-duration-format'); | |
function processItems(structure) { | |
const maxSentenceLength = 32; | |
const maxParagraphLength = 64; //we want to keep this to 64 or less (per line) | |
let srtTranscription = "WEBVTT\n\n"; | |
let numberOfChars = 0; | |
let sentence = ""; |
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
zip -r foo.zip foo -x "*.DS_Store" |
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
**Automatically delete orig files after merge** | |
git config --global mergetool.keepBackup false | |
**Interactive git clean** | |
git clean -i | |
**All git commits not pushed** | |
git cherry -v | |
**How to grep (search) committed code in the git history?** |
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
'use strict'; | |
var AWS = require('aws-sdk'); | |
var s3 = new AWS.S3({ | |
apiVersion: '2012-09-25' | |
}); | |
var eltr = new AWS.ElasticTranscoder({ | |
apiVersion: '2012-09-25', | |
region: 'us-east-1' | |
}); |
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
param([string]$publishSettingsFileLocation, [string]$azureSubscriptionName, [string]$storageAccount, [string]$packagePath, [string]$packageName, [string]$containerName, [string]$serviceName, [string]$configPath, [Int32]$instancePollLimit = 1200, [Int32]$instancePollRate = 60, [string]$removeStagingInstance) | |
#The old publish settings file - use Get-AzurePublishSettingsFile to https://windows.azure.com/download/publishprofile.aspx to get the file | |
Write-Host "publishSettingsFileLocation is $publishSettingsFileLocation" | |
#The azure subscription name related to the account, eg. "Window Azure MSDN - Visual Studio Premium" | |
Write-Host "azureSubscriptionName is $azureSubscriptionName" | |
#The storage account where to upload the package. It must exist. E.g. mystorageaccountforupload | |
Write-Host "storageAccount is $storageAccount" |
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
CREATE TABLE [dbo].[AspNetUsers]( | |
[Id] [nvarchar](128) NOT NULL, | |
[Email] [nvarchar](256) NULL, | |
[EmailConfirmed] [bit] NOT NULL, | |
[PasswordHash] [nvarchar](max) NULL, | |
[SecurityStamp] [nvarchar](max) NULL, | |
[PhoneNumber] [nvarchar](max) NULL, | |
[PhoneNumberConfirmed] [bit] NOT NULL, | |
[TwoFactorEnabled] [bit] NOT NULL, | |
[LockoutEndDateUtc] [datetime] NULL, |
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
//Slow Implementation | |
func fib1(x: Int) -> Int { | |
return x < 2 ? x : fib1(x - 1) + fib1(x - 2) | |
} | |
let m = fib1(5) | |
//Fib Trivial Memoization | |
var memoizeDict = Dictionary<Int, Double>() |
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
// Playground - noun: a place where people can play | |
operator infix |> { | |
associativity left | |
} | |
operator infix <| { | |
associativity right | |
} |
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
// Released to the public domain. Use, modify and relicense at will. | |
//#r "OpenTK.dll" | |
open System | |
open System.Drawing | |
open System.Collections.Generic | |
open OpenTK | |
open OpenTK.Graphics | |
open OpenTK.Graphics.OpenGL |