Skip to content

Instantly share code, notes, and snippets.

View peterschmiz's full-sized avatar

Péter Schmíz peterschmiz

View GitHub Profile
@newyankeecodeshop
newyankeecodeshop / ServingES6.md
Last active June 19, 2021 07:36
Serving ES6 to modern browsers

Background

Recently I noticed that Safari 10 for Mac/iOS had achieved 100% support for ES6. With that in mind, I began to look at the browser landscape and see how thorough the support in the other browsers. Also, how does that compare to Babel and its core-js runtime. According to an ES6 compatability table, Chrome, Firefox, and IE Edge have all surpassed what the Babel transpiler can generate in conjunction with runtime polyfills. The Babel/core-js combination achieves 71% support for ES6, which is quite a bit lower than the latest browsers provide.

It made me ask the question, "Do we need to run the babel es2015 preset anymore?", at least if our target audience is using Chrome, Firefox, or Safari.

It's clear that, for now, we can't create a site or application that only serves ES6. That will exclude users of Internet Explorer and various older browsers running on older iOS and Android devices. For example, Safari on iOS 9 has pretty mediocre ES6 support.

@jammykam
jammykam / MediaRequestHandler.cs
Last active March 5, 2024 17:11
Custom Sitecore Media Request handler to deal with media items with the same name but different extensions. If the media with matching extension is not found then the default Sitecore behaviour is used. This is directly inspired by the post by Martin Davies: http://sitecoreskills.blogspot.co.uk/2014/01/handling-duplicate-media-paths-in.html
using System.Web;
using Sitecore.Diagnostics;
using Sitecore.Resources.Media;
using System;
using System.Linq;
using Sitecore.Data.Items;
using Sitecore.IO;
namespace MyProject.Custom.Media
{
@gkhays
gkhays / DrawSineWave.html
Last active June 22, 2025 08:39
Oscillating sine wave, including the steps to figuring out how to plot a sine wave
<!DOCTYPE html>
<html>
<head>
<title>Sine Wave</title>
<script type="text/javascript">
function showAxes(ctx,axes) {
var width = ctx.canvas.width;
var height = ctx.canvas.height;
var xMin = 0;
@tcr
tcr / t2-fix-windows.md
Last active August 19, 2016 10:54
Fix for Tessel 2 on Windows
@pirate
pirate / parseURLParameters.js
Last active December 15, 2023 07:17
Parse URL query parameters in ES6
function getUrlParams(search) {
const hashes = search.slice(search.indexOf('?') + 1).split('&')
const params = {}
hashes.map(hash => {
const [key, val] = hash.split('=')
params[key] = decodeURIComponent(val)
})
return params
}

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

@ibanez270dx
ibanez270dx / rtc_test_speech.html
Last active December 23, 2020 21:35
HTML5 Audio + Speech to Text...once you enable both microphone and voice recognition, say "facebook", "hack", or "what is my name"
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Web audio capture + Speech Recognition</title>
<link href="http://www.smartjava.org/examples/webaudio-filters/css/bootstrap.css" rel="stylesheet"/>
</head>
<body>
<div class="container">
<h1 class="pagination-centered">HTML5 Web audio capture + Speech Recognition</h1><br />

Lesson's learnt building the Guardian

Below is a collection of my favourite responses I gathered from Guardian engineers when asked the question: What have you learnt starting from scratch and building a mobile-first next generation web platform for the Guardian?

Daithi O Crualaoich

  • Work with great people.
  • Deploy like crazy. This means the team has to control the infrastructure as well as code.
  • Design is not a service. Designers have to sit in the team.
  • Infrastructure is intrinsically unreliable. Discard and replace is the robust strategy.
  • Use your CDN for HTML too.
  • Don't always do as you are told.
@tylshe
tylshe / index.html
Created April 3, 2013 10:08
A CodePen by Adam. Fluid Simulation - Javascript fluid simulation on canvas.
<canvas id= "c"> </canvas>
<button id="reset">new colours</button>
<div id="info">
<div id="top">
<a target="_blank" id="site" href="http://lonely-pixel.com">my website</a>
<a id="close" href="">close</a>
</div>
<p>
<br>
- Alter particles/groups with the GROUPS variable.<br><br>
@mbostock
mbostock / .block
Last active February 20, 2025 10:51
Gradient Along Stroke
license: gpl-3.0