Skip to content

Instantly share code, notes, and snippets.

View wintercounter's full-sized avatar
🧩
Solving the unsolvable puzzle of life.

Viktor Vincze wintercounter

🧩
Solving the unsolvable puzzle of life.
View GitHub Profile
/* focusin/out event polyfill (firefox) */
!function(){
var w = window,
d = w.document;
if( w.onfocusin === undefined ){
d.addEventListener('focus' ,addPolyfill ,true);
d.addEventListener('blur' ,addPolyfill ,true);
d.addEventListener('focusin' ,removePolyfill ,true);
d.addEventListener('focusout' ,removePolyfill ,true);
@mixin animation($animate...) {
$max: length($animate);
$animations: '';
@for $i from 1 through $max {
$animations: #{$animations + nth($animate, $i)};
@if $i < $max {
$animations: #{$animations + ", "};
}
<img src="large-default-file.jpg">
<source src="smaller.jpg" media="max-width:600px">
<source src="tiny.jpg" media="max-width:320px">
</img>
@wintercounter
wintercounter / gist:49863501f5085e0c3300
Created August 30, 2014 18:28
MutationObserver Polyfill
(function() {
var MutationObserver;
if (window.MutationObserver != null) {
return;
}
MutationObserver = (function() {
function MutationObserver(callBack) {
this.callBack = callBack;
@wintercounter
wintercounter / Permutation.js
Created September 15, 2014 21:22
Permutation class
var Permutation = function(str){
this.construct(str);
};
Permutation.prototype.originalString = undefined;
Permutation.prototype.results = new Object();
Permutation.prototype.mirrorResults = new Object();
Permutation.prototype.usedChars = new Array();
Permutation.prototype.construct = function(str){
@wintercounter
wintercounter / gist:47bc9bde072430acd3e9
Created September 26, 2014 21:25
My hair animating
s = Snap(900, 620);
var path = s.path("M250.5,126.4l4,55.1c-12.7,7.5-28.8,7.7-47,3.5c9.8,15.8,22.6,27.6,43,29.5 c-9.8,12.6-25.3,13.9-43,10.5c16.6,25.2,44.9,37.9,79,47.5c-4.2-84.3,13-140.7,56.5-179c22.7,27.4,52,42.3,85,50.5 c-16.2-15.3-24.5-30.2-24-44.5c20,27,47.6,44,80,54.5c12.2,43.8,9.6,84.9-5.5,123.5c34.5-1.9,67.9-13.3,100.5-31 c-21.4-0.6-38.3-8.4-50.5-24c21.9,2.7,38.2-6.8,50.5-25c-20.8-2.4-41.1-6.8-46.5-30.5c-3-30-24.5-116-59.5-138 c-16.8-11.3-29.5-10.3-49.5-13.5C323-18.5,248,68,250.5,126.4z");
path.animate({ d: "M290,31.8l0.1,181.6v29.3v15.5v24.4v23.4c0,8.1,9.6,13.3,15.5,9l95.6-68.5l32.8-23.5 l31.3-22.4l9.6-6.9l15.3-11.1c12.8-9.1,12.2-17.8-0.4-26.8l-31-22.3L407.9,97L305.6,23.7C298.3,18.7,290.1,22.7,290,31.8z" }, 1000, mina.backin);
@wintercounter
wintercounter / SassMeister-input.scss
Created December 30, 2014 01:22
Generated by SassMeister.com.
// ----
// libsass (v3.1.0-beta)
// ----
@function str-explode($string, $delimiter: '') {
$result: ();
$length: str-length($string);
@if str-length($delimiter) == 0 {
@for $i from 1 through $length {
@wintercounter
wintercounter / JsonArea.js
Created October 12, 2018 11:02
Editable react-json-view
import React, { Component } from 'react'
import ReactJson from 'react-json-view'
import FormField from 'grommet/components/FormField'
export default class JsonArea extends Component {
static isValid(str, warn = false) {
try {
JSON.parse(str)
return true
}
@wintercounter
wintercounter / flex-reset.css
Last active February 28, 2020 13:24
Some extra reset on top of your reset/normlizer you already using to make block elements flex by default
/* @see https://developers.google.com/web/updates/2013/10/Flexbox-layout-isn-t-slow */
div, article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: flex;
flex-direction: column;
}