Skip to content

Instantly share code, notes, and snippets.

View digitarald's full-sized avatar
🏳️‍🌈

Harald Kirschner digitarald

🏳️‍🌈
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@digitarald
digitarald / index.html
Last active August 29, 2015 14:00
Benchmark for setting transform styles from a 3d matrix
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Famous test</title>
<meta name="viewport" content="width=device-width, maximum-scale=1, user-scalable=no" />
<style>
html, body {
margin: 0;
padding: 0;
@dhylands
dhylands / disable-adb-timer.sh
Last active February 14, 2016 22:22
Sets the "Disable ADB Timer" to zero, which disables the timer.
#!/bin/bash
# Disables the adb timeout
set -e
ADB=${ADB:-adb}
$ADB wait-for-device
B2G_PREF_DIR=/system/b2g/defaults/pref
TMP_DIR=/tmp/adb-timeout-prefs
rm -rf $TMP_DIR
@mikolalysenko
mikolalysenko / gist:5580867
Last active December 17, 2015 08:29
Spring!
//Config variables
var rest_length = 256.0
var spring_constant = 1.0
var dt = 0.01
//Hooke's law
function force(displacement) {
return spring_constant * (rest_length - displacement)
}
@Protonk
Protonk / prng.js
Last active April 7, 2023 09:30
Various PRNGs, implemented in javascript.
// Linear Congruential Generator
// Variant of a Lehman Generator
var lcg = (function() {
// Set to values from http://en.wikipedia.org/wiki/Numerical_Recipes
// m is basically chosen to be large (as it is the max period)
// and for its relationships to a and c
var m = 4294967296,
// a - 1 should be divisible by m's prime factors
a = 1664525,
// c and m should be co-prime
@emilio
emilio / notification.js
Last active September 24, 2020 07:44
window.Notification polyfill
/*
* window.Notification polyfill
* @author Emilio Cobos (http://emiliocobos.net)
*/
/* try prefixed */
if( ! window.Notification ) {
window.Notification = (function() {
return window.Notification || window.webkitNotification || window.mozNotification || window.oNotification || window.msNotification;
})()
@subtleGradient
subtleGradient / README.md
Created July 19, 2012 13:01
How to create a double-click-to-start web server

How to create a double-click-to-start web server

  1. Download the "Start HTTP Server Here.command" file
    • In Safari you can do that by ⌥ (option) clicking the "raw" link next to that script.
  2. Add the executable flag
    so that it will run when you double-click it
    • type chmod +x "$HOME/Downloads/Start HTTP Server Here.command"
  3. Move the command file into the root folder of your website
  4. Double-click it to start your webserver.
    Your browser will load it up automatically
@potch
potch / mozApp.js
Created May 3, 2012 16:22
simple open web app lib
// manage a webapp.
// place <link rel="app-manifest" href="path-to-manifest.webapp"> in your <head>
// mozApp.install() attempts installation
// mozApp.uninstall() removes
// mozApp.isRunning() indicates whether the app is currently installed and open
var mozApp = (function() {
var manLink = document.querySelector('link[rel="app-manifest"]'),
manifestURL = manLink.href;
var self = false;
@banksean
banksean / perlin-noise-classical.js
Created February 15, 2010 10:00
two Perlin noise generators in javascript. The simplex version is about 10% faster (in Chrome at least, haven't tried other browsers)
// Ported from Stefan Gustavson's java implementation
// http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
// Read Stefan's excellent paper for details on how this code works.
//
// Sean McCullough banksean@gmail.com
/**
* You can pass in a random number generator object if you like.
* It is assumed to have a random() method.
*/