Skip to content

Instantly share code, notes, and snippets.

@papsl
papsl / tSQLt.PrepareTableForFaking.sql
Last active May 28, 2019 09:51
tSQLt prepare table for faking
/*
Source: http://harouny.com/2013/04/19/tsqlt-taketable-indexed-view/
Description: With small modifications on REPLACE part and code style improvments
*/
CREATE PROCEDURE [tSQLt].[PrepareTableForFaking]
@TableName NVARCHAR(MAX),
@SchemaName NVARCHAR(MAX)
AS
BEGIN
@papsl
papsl / xmlsort.ps1
Created April 12, 2019 09:01
Sorts an XML file by element and attribute names, removes not needed empty tags. Useful for diffing XML files.
<#
.SYNOPSIS Sorts an XML file by element and attribute names, removes not needed empty tags. Useful for diffing XML files.
.NOTES
Original https://danielsmon.com/2017/03/10/diff-xml-via-sorting-xml-elements-and-attributes/
Last change: Peter Pirc (remove empty end tag)
Licence Public domain
#>
param (
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
@papsl
papsl / ionic.html
Last active February 24, 2019 18:39
Ionic Latest HTML - just start HTML coding with Ionic without building entire App
<!DOCTYPE html>
<html>
<head>
<link href="https://unpkg.com/@ionic/core@latest/css/ionic.bundle.css" rel="stylesheet">
<script src="https://unpkg.com/@ionic/core@latest/dist/ionic.js"></script>
<script src="https://unpkg.com/ionicons@latest/dist/ionicons.js"></script>
</head>
<body>
<ion-app>
<ion-content>
@papsl
papsl / fix-wordpress-permissions.sh
Last active November 13, 2015 20:34 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@papsl
papsl / Value cannot be null Parameter name: browser.md
Last active October 10, 2015 13:58
Cordova: $exception {"Value cannot be null.\r\nParameter name: browser"} System.ArgumentNullException on Windows Phone

Error:

$exception	{"Value cannot be null.\r\nParameter name: browser"}	System.ArgumentNullException

Reason: config.xml

  <preference name="SplashScreenDelay" value="0" />
@papsl
papsl / idea.md
Last active October 2, 2015 14:26
live gist - idea

Using placeholders (inspired by SublimeText snippets)

curl https://api.github.com/users/${0:git user name}/gists --insecure

curl https://api.github.com/users/${0:git user name}/gists --insecure

Using handlebars

@papsl
papsl / 0_reuse_code.js
Created October 2, 2015 10:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@papsl
papsl / EmulatorRun.cmd
Created August 25, 2015 15:00
How can I run Visual Studio Android emulator from Command line
%programfiles(x86)%\Microsoft Emulator Manager\1.0\emulatorcmd launch /sku:Android /id:0076019F-F03D-41CC-984F-D92FCBD52648
@papsl
papsl / gist:7f499e4690a58e885319
Created August 17, 2015 12:06
Azure - Open PowerShell session to Azure Virtual Machine (complete with publish settings)
#Download file
Get-AzurePublishSettingsFile
#Import Publishing file
Import-AzurePublishSettingsFile -PublishSettingsFile "publishsettingsfile.publishsettings"
#List all profiles
Get-AzureSubscription
#Select active AzureSubscription
@papsl
papsl / CreateTemporaryTable.sql
Created March 6, 2015 10:03
Example of improper creation of temporary table with Primary key (Microsoft SQL Server)
-- 1.) Problematic way
-- This example will fail on a second execution (when first table not dropped, even in case it is executed in different connection or user context).
-- PK_SomeTable will already exist in tempdb
CREATE TABLE #SomeTable
(
Id INT IDENTITY(1, 1) ,
[Name] [varchar](255) NULL ,
CONSTRAINT [PK_SomeTable] PRIMARY KEY CLUSTERED ( [Id] ASC )
)
-- Output: