Skip to content

Instantly share code, notes, and snippets.

@zommarin
zommarin / TypeScriptPatterns.ts
Last active August 25, 2017 08:03
Various good to know TypeScript patterns
// Catch exception in non-async method when async method is called
obj.asyncMethod(arg1, arg2)
.catch(ex => this.handlerMethod(ex))
// Get the name of an enum value as a string
enum MyEnum { Value1 }
const str = MyEnum[MyEnum.Value1]
@zommarin
zommarin / install.sh
Last active March 20, 2016 11:43
Install development CentOS machine in VMware Workstation Pro
# Configuration:
# CPU: 2 vCPU in 1 Socket
# RAM: 8 GB
# Disk: 128GB Growing single file
# 768MB 3D Graphics
# Enable shared folders - map work dir
# Make sure that:
# - Ethernet adapter is enabled (VMware auto install defaults to off)
# - Ethernet adapter is bound to bridged and to an adapter that is connected
@zommarin
zommarin / URLs.md
Created February 17, 2015 16:39
Fibaro HC 2 REST API

/api/panels/event?from=1418655960&to=1424213940&type=time

/api/panels/history?from=1418655960&to=1424213940&type=time

@zommarin
zommarin / Resources.md
Last active August 29, 2015 14:15
Fibaro Lua Resources

https://gist.github.com/leeroybrun/9482703

http://www.fibaro.com/support - Standard support site. Got some materials http://www.fibarouk.co.uk/support/ - UK support site, More materials. http://www.fibarouk.co.uk/support/lua/brief-introduction-lua/ - Intro till Lua https://developer.fibaro.com/ - Registration required. Is in build-up state currently. Have some Lua and JSON API resources. http://www.lua.org/docs.html - Lua docs http://zwave-store.co.uk/about-z-wave/the-fibaro-system/intro-to-fibaro-lua-code

@zommarin
zommarin / gist:baeff9a111821d3e37ff
Last active August 29, 2015 14:15
Sublime Packages to have Installed
PowerShell
SideBarEnhancements
SublimeCodeIntel
@zommarin
zommarin / gist:1edc49ff460098d00c7c
Created February 10, 2015 14:31
Number rows in SQL Server using CTE
;WITH T AS (
SELECT
STEPNO,
Row_Number() OVER (PARTITION BY JOBNAME ORDER BY STEPNO) AS RN
FROM STEP
WHERE BR = '00'
)
UPDATE T
SET
STEPNO = RN
@zommarin
zommarin / CSharpLibs.md
Created December 3, 2014 12:47
Libraries for C#
# Directory of the current script
$ScriptDir = Split-Path -Parent $myInvocation.MyCommand.Path
# Date stuff
$Date.ToString("yyyyMMdd")
$Date.ToString("yyyy-MM-dd")
# GZip XML Document Read
$FileStream = New-Object -TypeName System.IO.FileStream -ArgumentList $FromFile.FullName, Open, Read
@zommarin
zommarin / assembly-commands.md
Created October 21, 2014 06:48
List contents of .NET DLLs and EXEs

Various command line tools that list contents of DLLs etc:

ildasm.exe /text .\bin\OpixTool.exe | clip

DECLARE @dbname sysname, @days int
SET @dbname = NULL --substitute for whatever database name you want (or just NULL to list all databases)
SET @days = -30 --previous number of days, script will default to 30
SELECT
rsh.destination_database_name AS [Database],
rsh.user_name AS [Restored By],
CASE WHEN rsh.restore_type = 'D' THEN 'Database'
WHEN rsh.restore_type = 'F' THEN 'File'
WHEN rsh.restore_type = 'G' THEN 'Filegroup'
WHEN rsh.restore_type = 'I' THEN 'Differential'