Skip to content

Instantly share code, notes, and snippets.

Peter A. Pirc papsl

Block or report user

Report or block papsl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@papsl
papsl / xmlsort.ps1
Created Apr 12, 2019
Sorts an XML file by element and attribute names, removes not needed empty tags. Useful for diffing XML files.
View xmlsort.ps1
<#
.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 Feb 24, 2019
Ionic Latest HTML - just start HTML coding with Ionic without building entire App
View ionic.html
<!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 Nov 13, 2015 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
View fix-wordpress-permissions.sh
#!/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 Oct 10, 2015
Cordova: $exception {"Value cannot be null.\r\nParameter name: browser"} System.ArgumentNullException on Windows Phone
View Value cannot be null Parameter name: browser.md

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 Oct 2, 2015
live gist - idea
View idea.md

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 Oct 2, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// 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 Aug 25, 2015
How can I run Visual Studio Android emulator from Command line
View EmulatorRun.cmd
%programfiles(x86)%\Microsoft Emulator Manager\1.0\emulatorcmd launch /sku:Android /id:0076019F-F03D-41CC-984F-D92FCBD52648
@papsl
papsl / gist:7f499e4690a58e885319
Created Aug 17, 2015
Azure - Open PowerShell session to Azure Virtual Machine (complete with publish settings)
View gist:7f499e4690a58e885319
#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 Mar 6, 2015
Example of improper creation of temporary table with Primary key (Microsoft SQL Server)
View CreateTemporaryTable.sql
-- 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:
@papsl
papsl / CatchWillFailWhenUsedInProcedure.sql
Last active Aug 29, 2015
Example Improper error handling with SQL try catch
View CatchWillFailWhenUsedInProcedure.sql
-- This procedure will fail twice, first time in main TRY block and second time in CATCH statement because of converting ERROR_MESSAGE to INT
CREATE PROCEDURE dbo.SomeWork
AS
BEGIN TRY
-- let's do something
-- ...
-- Exception happens
PRINT 0/0
END TRY
You can’t perform that action at this time.