Skip to content

Instantly share code, notes, and snippets.

@jamie-pate
jamie-pate / index.html
Last active August 16, 2022 02:05
window.matchMedia() #jsbench #jsperf (http://jsbench.github.io/#9fa2ce9499a06417c7432a23ce4c28d5) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>window.matchMedia() #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jamie-pate
jamie-pate / fragment_shader_YUV420P_to_RGB.frag
Created November 23, 2020 23:44 — forked from crearo/fragment_shader_YUV420P_to_RGB.frag
A fragment shader to convert YUV420P to RGB.
/** A fragment shader to convert YUV420P to RGB.
* Input textures Y - is a block of size w*h.
* texture U is of size w/2*h/2.
* texture V is of size w/2*h/2.
* In this case, the layout looks like the following :
* __________
* | |
* | Y | size = w*h
* | |
* |________|
@jamie-pate
jamie-pate / index.html
Last active September 20, 2017 22:52
Array_splice_or_hand_copy #jsbench #jsperf (http://jsbench.github.io/#2a63e16d463941667c36e75aa581d343) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Array_splice_or_hand_copy #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jamie-pate
jamie-pate / index.html
Created September 6, 2017 17:19
Arrayfill_presize_or_grow (http://jsbench.github.io/#02319137bb444c3e6c38d676a5e932ee) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Arrayfill_presize_or_grow</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@jamie-pate
jamie-pate / gist:6582262
Created September 16, 2013 15:34
Validation pop-up directive for angularjs
function ValidationPopup($timeout, $parse) {
return {
require: '?ngModel',
compile: function(element, attr) {
var msg = angular.element('<span>').addClass('validation-popup'),
errorMessages = {required: ' is Required', scwpMax: 'No bottles left'};
element.after(msg);
return function(scope, element, attr, ctrl) {
function popup(value) {
var show = scope.$submitted && !ctrl.$valid;