Skip to content

Instantly share code, notes, and snippets.

View itsmethemojo's full-sized avatar

Marian Pöschmann itsmethemojo

View GitHub Profile
<section class="page" id="dashboard">
    <header>
      <slider-element name="dashboard" display="all"></slider-element>
    </header>
    <div class="contents">
      <ul class="collection">
        <li><a href="#flightdetails">Journey details</a></li>
        <li><a href="#explore">Explore destination</a></li>
        <li><checkin-element></checkin-element></li>
      </ul>
(function() {
  var raf = window.RequestAnimationFrame  ||
      window.mozRequestAnimationFrame ||
      window.webkitRequestAnimationFrame ||
      window.msRequestAnimationFrame;
  // defer loading of all app relevant javascript
  // and non criticial CSS
  function deferLoad() {
    // JS
function _isEmpty = function(obj) {
    if ('undefined' !== Object.keys) {
        return (0 === Object.keys(obj).length);
    }
  for(var prop in obj) {
      if(obj.hasOwnProperty(prop)) {
                return false;
            }
  }
  return true;
var cacheName = 'v1',
    checkinDataRegex = /applicable\?pnr=([a-zA-Z0-9]+)&lastname=([a-zA-Z]+)/
    ticketRegex = /image\/pnr\/([a-zA-Z0-9]+)\/lastname\/([a-zA-Z]+)\/ticket\/([0-9]+)/;
self.addEventListener('fetch', function(event) {
    var request = event.request,
        matchCheckin = checkinDataRegex.exec(request.url);
    if (matchCheckin) {
        // Use regex capturing to grab only the bit of the URL
        // that we care about (in this case the checkinID)
var deferredPromptEvent; 
window.addEventListener('beforeinstallprompt', function(e) {
    e.preventDefault();
    deferredPromptEvent = e;
    return false;
});
// and in the moment your condition is fulfilled
// check if the prompt had been triggered
@itsmethemojo
itsmethemojo / gist:72d8986b68c85beb8c2ac39b11202dd4
Created January 24, 2019 13:03
single line bash (also git bash on windows) command to download all chromecast background images listed in https://github.com/dconnolly/chromecast-backgrounds/
IMG_CNT=0; for URL in $(curl -s https://raw.githubusercontent.com/dconnolly/chromecast-backgrounds/master/README.md |awk -F'(' '{print $2}' | awk -F')' '{print $1}'); do IMG_CNT=$((IMG_CNT + 1)); curl -s "$URL" > $IMG_CNT"."${URL##*.} ; done