Skip to content

Instantly share code, notes, and snippets.

View guidoschmidt's full-sized avatar

Guido Schmidt guidoschmidt

View GitHub Profile
@brenapp
brenapp / fuzzysearch.js
Created September 26, 2015 02:14
A very basic Fuzzy Search in 66 bytes
/* Fuzzy Search in JavaScript in 66 bytes by SpeedyNinja
Creates a Regex of the Form x.*y.*z.* for query xyz and tests it against the list of terms
*/
f=t=>s=>t.filter(x=>eval("/"+s.replace(/./,"$&.*")+"/gi").test(x))
/*
Usage:
var search = f(["list", "of", "search", "terms"])
search("er") -> ["search", "terms"]
^ ^ ^^
@bahmutov
bahmutov / index.js
Last active April 7, 2016 14:08
Is it pure?
// A: is this pure function?
function sum(a, b) { return a + b }
// B: is this a pure function?
const k = 2
function addK(a) { return a + k }
// C: is this a pure function?
function sub(a, b) { return sum(a, -b) }
// D: is this a pure function?
function sub(a, b, summer) { return summer(a, b) }
// E: is this a pure function?
@rwaldron
rwaldron / ambient-light-sensor.md
Created November 4, 2016 13:20
Ambient Light Sensor landed in Chromium (this gist is a collection of useful bits I picked out of a w3c email thread)
@guidoschmidt
guidoschmidt / hide-all-the-scrollbars.md
Last active April 26, 2017 08:34
Hide overflow scrollbars

So first, a little background… my preliminary research revealed the following:

There is a CSS rule that can hide scrollbars in Webkit-based browsers (Chrome and Safari). That rule is:

.element::-webkit-scrollbar { width: 0 !important }

There is a CSS rule that can hide scrollbars in IE 10+. That rule is:

.element { -ms-overflow-style: none; }

@nesffer
nesffer / .eslintrc.js
Last active October 5, 2017 19:03
.eslintrc.js
module.exports = {
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "standard",
"plugins": [
"standard",
"promise"
@guidoschmidt
guidoschmidt / _responsive-font-size.sass
Last active October 28, 2017 18:38
SASS responsive-font-size
$screensize-phones: 480px
$screensize-desktops: 1280px
$font-size-min: 16px
$font-size-max: 32px
@function strip-unit($number)
@if type-of($number) == 'number' and not unitless($number)
@return $number / ($number * 0 + 1)
@return $number
@AmnonOwed
AmnonOwed / gist:dcd42ee3e95b843d0eae4e7639d38194
Created December 4, 2016 17:06
Registering mouse & key events in Processing
/* Code snippet about registering mouse & key events in Processing
* by Amnon Owed / @AmnonOwed
* Tested in Processing 3.2.3
*/
Test test;
void setup() {
size(400, 400);
@guidoschmidt
guidoschmidt / Autofade
Last active March 5, 2018 14:01
After Effects Expressions
//Autofade: Add to opacity
transition = 20; // transition time in frames
if (marker.numKeys<2){
tSecs = transition / ( 1 / thisComp.frameDuration); // convert to seconds
linear(time, inPoint, inPoint + tSecs, 0, 100) - linear(time, outPoint - tSecs, outPoint, 0, 100)
}else{
linear(time, inPoint, marker.key(1).time, 0, 100) - linear(time, marker.key(2).time, outPoint, 0, 100)
}
@manoloide
manoloide / rectShadows.pde
Created January 9, 2018 07:48
Rect Shadows Particles
ArrayList<Rect> rects;
float mx, my, mm, time;
void setup() {
size(720, 720, P2D);
generate();
}
void draw() {
@chrisdone
chrisdone / slow-keys.el
Last active April 16, 2018 09:12
Slow keys mode
;;; slow-keys.el --- Slow keys mode to avoid RSI
;; Copyright (c) 2018 Chris Done. All rights reserved.
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,