Skip to content

Instantly share code, notes, and snippets.

View mrxf's full-sized avatar
🚀
努力工作中

张树源 mrxf

🚀
努力工作中
View GitHub Profile
@mrxf
mrxf / ripple.js
Created April 25, 2017 10:11
material ripple effect
function RippleEffect(element){
this.element = element;
this.element.addEventListener('mousedown', this.run.bind(this), false);
}
RippleEffect.prototype = {
run: function(event){
var ripplerContainer = this.element.querySelector('.ripple-container');
var offsetInfo = this.element.getBoundingClientRect();
var rippleContainer = document.createElement('div');
@mrxf
mrxf / prng.js
Created April 10, 2016 16:14 — forked from Protonk/prng.js
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