Skip to content

Instantly share code, notes, and snippets.

@raininglemons
raininglemons / index.html
Created August 26, 2015 15:51
Appcache manifest becomes indefinitely cached after a "clear cache" in FireFox 40.0.2
<html manifest="/manifest.appcache" ><head>
<title>test</title>
</head>
<body>
<h1>Rev. 6</h1>
</body>
</html>
@raininglemons
raininglemons / Idler.js
Created August 24, 2015 19:44
Idler, micro JS lib for binding callbacks to user interactivity and idling.
/**
* Idler
*
* API for binding to user interaction. Created by passing two callbacks, one
* to run on idle and another to run on user interaction resumed. Idler optionally
* takes a third argument, idleTime which defines the period of inactivity required
* to declare a user idled (in ms).
*
* Example usage:
*
@raininglemons
raininglemons / Idler.min.js
Created August 24, 2015 20:14
Idler, minified to 1.53 KB, or just 613 bytes with Gzip compression.
!function(){"use strict";var e=function(n,i,t){t=t||6e4,this.onIdle=n,this.onInteraction=i,this.idleTime=t,this.isIdle=!1,e.initInterval(),e.instances.push(this)};e.getTime=function(){return+new Date},e.instances=[],e.intervalTimer=null,e.lastInteraction=e.getTime(),e.prototype.destroy=function(n){e.instances.splice(e.instances.indexOf(this),1),0==e.instances.length&&(clearInterval(e.intervalTimer),e.intervalTimer=null)},e.prototype.setIdle=function(){this.isIdle=!0,this.onIdle()},e.setIdle=function(){e.forEach(function(e){e.setIdle()})},e.reset=function(){e.lastInteraction=e.getTime(),e.forEach(function(e){e.isIdle&&(e.isIdle=!1,e.onInteraction())})},e.handleTabChange=function(n){n?e.setIdle():e.reset()},e.forEach=function(n){for(var i=0;i<e.instances.length;i++)try{n(e.instances[i])}catch(t){console.error(t)}},e.update=function(){var n=e.getTime();e.forEach(function(i){i.isIdle||i.idleTime+e.lastInteraction<n&&i.setIdle()})},e.initInterval=function(){null===e.intervalTimer&&(e.intervalTimer=setInterval(e.up
@raininglemons
raininglemons / example.js
Created May 5, 2016 15:49
Redux with 'shadow' master model setter / getter.
import createStore from './redux-shadow';
function reducer (state, action) {
switch (action.type) {
case 'init':
this.setShadow(action.data);
return Object.assign({}, this.getShadow());
case 'filter':
const filter = action.filter.toLowerCase();

Keybase proof

I hereby claim:

  • I am raininglemons on github.
  • I am raininglemons (https://keybase.io/raininglemons) on keybase.
  • I have a public key whose fingerprint is F376 CB9B 280F 35DB 2325 D0DA C8C9 F074 7065 1848

To claim this, I am signing this object:

(() => {
class CSSReader {
constructor(input) {
const rules = input.split('\n') //.match(/((#|\.)?[\[\]\(\)a-zA-Z0-9_\-:]+,?\s*)+{.+}/g);
this.rules = rules.map((rule, i) => {
// console.log(`Processing ${i} of ${rules.length}`);
if (rule.substr(0, 1) === '@') {
// Strip out media queries...
rule = rule.substr(rule.indexOf('{'));
}
@raininglemons
raininglemons / .eslintrc
Last active October 18, 2016 13:53
Bwin ESLINT definition
// Use this file as a starting point for your project's .eslintrc.
// Copy this file, and add rule overrides as needed.
{
"extends": "airbnb",
"env": {
"browser": true
},
"rules": {
"comma-dangle": 0,
"react/no-unused-prop-types": [
// @flow
/*
* Core Structure for CasinoGames redux store
*/
type CasinoGamesStore = {
categories: Object<CategoryId, Category>,
currencies: Object<CurrencyId, Currency>,
games: Object<GameId, Game>,
const gulp = require('gulp');
const rename = require('gulp-rename');
const path = require('path');
const named = require('vinyl-named');
const webdav = require('gulp-webdav-sync');
// npm install --save-dev uglify-js@2.6.4
// npm install --save-dev gulp-uglifyjs@0.6.2
const uglifyjs = require('gulp-uglifyjs');
const babel = require('gulp-babel');
const concat = require('gulp-concat');
<script>window.parent.postMessage({ method: 'lobby' }, '*');</script>