Skip to content

Instantly share code, notes, and snippets.

@alex-titarenko
alex-titarenko / pwa-browsers-support.csv
Created May 15, 2019 17:56
PWA Blog Post - Code snippets (pwa-browsers-support.csv)
Service Workers Web App Manifest Push Notifications
Chrome yes yes yes
Edge yes no yes
Firefox yes no yes
Safari yes no no
@alex-titarenko
alex-titarenko / index.html
Created May 15, 2019 17:38
PWA Blog Post - Code snippets (index.html)
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#ffffff">
<link rel="manifest" href="/manifest.json">
<title>First PWA</title>
</head>
<body>
<h1>Hello PWA!</h1>
@alex-titarenko
alex-titarenko / serviceworker.js
Created May 15, 2019 17:37
PWA Blog Post - Code snippets (serviceworker.js)
// "Install" event handler will be invoked only once when you first time navigate to the page
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open('app-cache').then(function(cache) {
// Adds index.html page to the cache
return cache.add('index.html');
})
);
});
@alex-titarenko
alex-titarenko / manifest.json
Last active May 15, 2019 17:34
PWA Blog Post - Code snippets (manifest.json)
{
"name": "First PWA",
"short_name": "PWA",
"start_url": "/",
"display": "standalone",
"theme_color": "#ffffff",
"background_color":"#ffffff",
"icons": [
{
"src": "logo-512.png",
@alex-titarenko
alex-titarenko / Retry-Command.ps1
Last active March 5, 2018 23:17
Retry-Command
function Retry-Command {
param (
[Parameter(Mandatory = $true)][string]$Command,
[Parameter(Mandatory = $true)][hashtable]$Args,
[Parameter(Mandatory = $false)][int]$Retries = 5,
[Parameter(Mandatory = $false)][int]$SecondsDelay = 5,
[Parameter(Mandatory = $false)][string]$Name = ""
)
# Setting ErrorAction to Stop is important. This ensures any errors that occur in the command are
@alex-titarenko
alex-titarenko / TablesInfo.sql
Created April 9, 2017 20:38
Get useful information about database tables
declare @t table (name varchar (255),
[rows] varchar(255),
reserved varchar(255),
data varchar (255),
index_size varchar( 255),
unused varchar(255 ))
delete from @t
insert into @t exec sp_MSforeachtable @command1 ='EXEC sp_spaceused ''?''',@whereand= 'or OBJECTPROPERTY(o.id, N''IsSystemTable'') = 1'
select *
from @t
@alex-titarenko
alex-titarenko / FindStoredProcedure.sql
Created April 9, 2017 20:33
How do I find a stored procedure containing <text>? (MSSQL)
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%Foo%'
AND ROUTINE_TYPE='PROCEDURE'
SELECT OBJECT_NAME(id)
FROM SYSCOMMENTS
WHERE [text] LIKE '%Foo%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)