Skip to content

Instantly share code, notes, and snippets.

Janis Pritzkau janispritzkau

Block or report user

Report or block janispritzkau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@janispritzkau
janispritzkau / analytics.js
Last active May 4, 2020
Minimal Google Analytics script in modern javascript (677 bytes minified)
View analytics.js
((document, location, navigator) => {
const domain = location.hostname.split(".")
const match = document.cookie.match(/(^|; ?)_ga=GA1\.\d\.(\d+\.\d+)(;|$)/)
// use existing client id or generate one
const cid = match ? match[2] : ~~(2147483648 * Math.random()) + "." + ~~(Date.now() / 1000)
// set cookie at highest possible domain level
for (let i = domain.length; i--;) {
const cookie = `_ga=GA1.${domain.length - i}.${cid}`
@janispritzkau
janispritzkau / webgl-example.js
Last active Oct 18, 2019
Simple WebGL example with basic error handling
View webgl-example.js
const canvas = document.querySelector("canvas")
canvas.width = 800, canvas.height = 600
canvas.style.width = `${canvas.width / devicePixelRatio}px`
const gl = canvas.getContext("webgl")
const vertexShader = gl.createShader(gl.VERTEX_SHADER)
const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER)
gl.shaderSource(vertexShader, `
@tleen
tleen / gist:6299431
Created Aug 21, 2013
Javascript array of state names
View gist:6299431
['Alabama','Alaska','American Samoa','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','Federated States of Micronesia','Florida','Georgia','Guam','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Marshall Islands','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Northern Mariana Islands','Ohio','Oklahoma','Oregon','Palau','Pennsylvania','Puerto Rico','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virgin Island','Virginia','Washington','West Virginia','Wisconsin','Wyoming']
You can’t perform that action at this time.