Skip to content

Instantly share code, notes, and snippets.

View ivanbanov's full-sized avatar
:octocat:
undefined

Ivan Banov ivanbanov

:octocat:
undefined
View GitHub Profile
@ivanbanov
ivanbanov / DateDiff.js
Last active August 29, 2015 14:17
Script to calculate how older is some date
;(function(win) {
'use strict';
/*
* CONSTRUCTOR
*/
function DateDiff(date) {
this.date = new Date(date);
this.dateNow = new Date();
}
@ivanbanov
ivanbanov / responsive-grid.scss
Last active August 29, 2015 14:23
Responsive grid focused on mobile first
// BREAKPOINTS
// https://jdsteinbach.com/css/sass-maps-breakpoint-mixin/
$breakpoints: (
small : 320px,
medium: 768px,
large : 992px,
wide : 1400px
);
$columns: 12;
$gutter : 1em;
<!-- *** Simples POC of FormValidator *** -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Validator</title>
<style>
* {
@ivanbanov
ivanbanov / Polling.js
Last active April 28, 2024 23:49
Implements a polling with max retries and exponential retries
const DEFAULT_BACKOFF = 200; // milliseconds
export class Polling {
constructor(fn, maxRetries = 10, initialDelay = DEFAULT_BACKOFF) {
this._fn = fn;
this._remainingRetries = maxRetries;
this._delay = initialDelay;
}
async perform() {
import React from 'react';
import {storiesOf} from '@kadira/storybook';
import mockRelay from '<path-to>/mocks/relay';
import {Component} from '../';
import viewer from './fixtures/viewer'; // json data
const relay = {
variables: {
foo: {},
bar: true,
@ivanbanov
ivanbanov / component.storybook.js
Last active January 9, 2019 09:16
Mock React context
import React from 'react';
import {storiesOf} from '@kadira/storybook';
import mockContext from '<path-to>/js/mocks/context';
import {Component} from '../';
const context = {
user: 'Foo Bar'
};
storiesOf('Component', module)
import React from 'react';
import {storiesOf} from '@kadira/storybook';
import mockRedux from '<path-to>/js/mocks/redux';
import {Component} from '../';
const storeState = {
list: ['foo', 'bar', 'baz'],
someData: {
foo: true,
bar: false
@ivanbanov
ivanbanov / app.js
Last active September 13, 2018 11:50
ELM + SVG Store + SVGO + HTML injection
(() => {
const icons = document.createElement('div');
icons.innerHTML = require('images/icons.svg').match(/<svg.*<\/svg>/, '')[0];
icons.style.display = 'none';
document.body.appendChild(icons);
})();
@ivanbanov
ivanbanov / Brewfile
Last active September 3, 2018 09:30
tap "homebrew/bundle"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
tap "homebrew/core"
brew "docker"
brew "node"
brew "tig"
brew "wget"
brew "yarn"
brew "zsh"
@ivanbanov
ivanbanov / cloudSettings
Last active February 21, 2019 16:01
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-02-21T16:01:47.849Z","extensionVersion":"v3.2.5"}