Skip to content

Instantly share code, notes, and snippets.

View matkovsky's full-sized avatar

Peter Matkovsky matkovsky

View GitHub Profile
/* Courtesy of Steve Souders, #ImageCon17, San Francisco, US */
/* Details: https://developer.mozilla.org/en-US/docs/Web/API/Performance */
<link rel="stylesheet" href="/huge-slow.css">
<img src="hero.jpg"
onload="performance.clearMeasures('hero');
performance.measure('hero')">
<script>
@arvidkahl
arvidkahl / eventbus-advanced-prototype.js
Created February 12, 2017 08:14
eventbus-advanced-prototype.js
// Create a global Event Bus
var EventBus = new Vue()
// Add to Vue properties by exposing a getter for $bus
Object.defineProperties(Vue.prototype, {
$bus: {
get: function () {
return EventBus;
}
}
const original = [0,1,2,3];
const copy = Object.assign([], original, { 2: 42 }); // [0,1,42,3]
console.log(original);
// [ 0, 1, 2, 3 ]
console.log(copy);
// [ 0, 1, 42, 3 ]
<?php
error_reporting(E_ALL & ~E_NOTICE);
ini_set('display_errors', 1);
$_HTTP = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
// change this by country (gls-hungary.com, gls-slovakia.sk, gls-czech.com, gls-romania.ro, gls-slovenia.com, gls-croatia.com)
$wsdl_path = $_HTTP.'online.gls-slovakia.sk'.'/webservices/soap_server.php?wsdl&ver=14.11.03.01';
$client = new SoapClient($wsdl_path);
<svg preserveAspectRatio="xMinYMin" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 560 1388">
<defs>
<mask id="canTopMask">
<image width="560" height="1388" xlink:href="img/can-top-alpha.png"></image>
</mask>
</defs>
<image mask="url(#canTopMask)" id="canTop" width="560" height="1388" xlink:href="can-top.jpg"></image>
</svg>
@szkrd
szkrd / commit-msg.sh
Created July 16, 2014 13:42
git commit message hook with ticket check
#!/bin/sh
# halp!!4
if [ $# -eq 0 ] || [ $1 == "--help" ] || [ $1 == "-h" ] || [ $1 == "/?" ]; then
echo "check ticket online, pinging jira; usage:"
echo "script (-v) [filename]"
echo "-v = verbose, optional; dumps messages, not just the exit codes"
echo "filename = name of the file containing the commit message, required"
exit 0
fi
@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active May 17, 2024 08:05
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,