Skip to content

Instantly share code, notes, and snippets.

View cpoDesign's full-sized avatar

Pavel cpoDesign

View GitHub Profile
Statistical analysis of page load speed data collected using the Navigation Timing API shows that an HTTP request can be reasonably approximated to 0.5 seconds.
Permalink to this heading.
Introduction
Whilst newer browsers implement a timing API that can give the time for a request including network latency, this is not available in all browsers. In browsers that do not support the timing API it is only possible, using on page JavaScript, to measure the time taken from the start of the DOM loading to a subsequent event - such as DOM ready. Using information from browsers that support the timing API it is possible to measure both the time from request to DOM ready and the time from DOM start to DOM ready and establish a relationship such that request_time = multiplier x dom_time + constant. Once this relationship is known it can be applied when only the DOM loading to ready time is available to estimate the full request time.
Permalink to this heading.
Method
From visitors that were using a browser that had
@cpoDesign
cpoDesign / gist:03084df8cbcef0e8f7db5ebe62a7d649
Created June 30, 2016 17:30
Non working link for IE9 & Angular 1.2.4
<a href="#" ng-click="doSomeAction()">some action</a>
@cpoDesign
cpoDesign / _favIcons.html
Last active June 7, 2016 08:41
Example of setting up fav icons for Apple +Android + Windows 8/10 + chrome
<!-- iPad and iPad mini (with @2× display) iOS ≥ 8 -->
<link rel="apple-touch-icon-precomposed" sizes="180x180" href="img/touch/apple-touch-icon-180x180-precomposed.png">
<!-- iPad 3+ (with @2× display) iOS ≥ 7 -->
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="img/touch/apple-touch-icon-152x152-precomposed.png">
<!-- iPad (with @2× display) iOS ≤ 6 -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/touch/apple-touch-icon-144x144-precomposed.png">
<!-- iPhone (with @2× and @3 display) iOS ≥ 7 -->
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="img/touch/apple-touch-icon-120x120-precomposed.png">
<!-- iPhone (with @2× display) iOS ≤ 6 -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/touch/apple-touch-icon-114x114-precomposed.png">
@cpoDesign
cpoDesign / app.js
Created May 20, 2016 09:25
Angular JS - custom date format
var app = angular.module('angularjs-starter', []);
app.filter('customCurrency', ["$filter", function ($filter) {
return function(amount, currencySymbol){
var currency = $filter('currency');
if(amount<0){
return '-' + currency(amount, currencySymbol).replace('(','').replace(')','');
}
return currency(amount, currencySymbol);
@cpoDesign
cpoDesign / v
Created April 4, 2016 16:14
vzaar video player example
<html>
<body>
<script src="https://code.jquery.com/jquery-1.12.2.min.js" integrity="sha256-lZFHibXzMHo3GGeehn1hudTAP3Sc0uKXBXAzHX1sjtk=" crossorigin="anonymous"></script>
<script>
function populateVideoElement(videoId) {
var dynamicName = 'vzvd-' + videoId;
var link = "https://view.vzaar.com/"+videoId +"/player";
@cpoDesign
cpoDesign / dynamicIframe.html
Last active April 3, 2016 20:43
example of generating iframe
<html>
<body>
<button onclick="pgen(1)" >open 1 </button>
<div id="gen">
demo
</div>
<script src="https://code.jquery.com/jquery-1.12.2.min.js" integrity="sha256-lZFHibXzMHo3GGeehn1hudTAP3Sc0uKXBXAzHX1sjtk=" crossorigin="anonymous"></script>
<script>
@cpoDesign
cpoDesign / FileHelpers.cs
Created March 29, 2016 16:31
Implementation of XmlSchema Validator
using System;
using System.IO;
using System.Reflection;
namespace XmlSchemaValidator.FileUtility
{
public class FileHelpers
{
public static string AssemblyDirectory
{
@cpoDesign
cpoDesign / video_player.html
Last active March 23, 2016 09:04
Example how to play video in html5
<html>
<body>
<video width="320" height="240" controls id="vieoEl" autoplay>
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<button onclick="setVideoSource()" >Update videSource </button>
<script>
@cpoDesign
cpoDesign / buildError.log
Created March 21, 2016 16:58
TFS Errors workspace does not exists
D:\Builds\01\src\External\Newtonsoft.Json.5.0.8\lib\net45\Newtonsoft.Json.xml: TF14061: The workspace 01_TFS-BUILD01;TFS_BuildService does not exist.
Exception Message: TF14061: The workspace 01_TFS-BUILD01;TFS_BuildService does not exist. (type WorkspaceNotFoundException)
Exception Stack Trace:
Server stack trace:
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.HandleReply(TfsClientOperation operation, TfsMessage message, Object[]& outputs)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, Object[]& outputs)
at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters)
at Microsoft.TeamFoundation.VersionControl.Client.Repository5.UpdateLocalVersion(String workspaceName, String ownerName, ServerItemLocalVersionUpdate[] updates, Int32 maxClientPathLength)
at Microsoft.TeamFoundation.VersionControl.Client.WebServiceLayer.UpdateLocalVersion(String workspa
@cpoDesign
cpoDesign / stopAndUninstallService.nsi
Last active August 12, 2024 08:15
Example of stopping and uninstalling service using nsis
!define APPNAME "App Name"
!define COMPANYNAME "Company Name"
!define DESCRIPTION "A short description goes here"
# These three must be integers
!define VERSIONMAJOR 1
!define VERSIONMINOR 1
!define VERSIONBUILD 1
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://..." # "Support Information" link