Skip to content

Instantly share code, notes, and snippets.

@bultas
bultas / normalize.css
Created April 5, 2017 10:47
minimalistic CSS Normalize
html {
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
font: 16px/1 sans-serif;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
}
@bultas
bultas / fetching.js
Last active March 6, 2017 19:57
fetching data in React - DataFetcher concept
BucketActions.createBucket(
initValue
);
// > bucketID
BucketActions.addToBucket(
bucketID,
value
);
// > true
@bultas
bultas / transducer.js
Last active February 21, 2017 23:47
Transducer to transform and convert JS iterable data types
function reduce(input, transformator, initialValue = null) {
let response = new Map(initialValue);
for (kv of input.entries()) {
response = transformator((result, [key, value]) => {
return result.set(key, value);
})(response, kv)
@bultas
bultas / filter.js
Last active February 20, 2017 17:40
Filter and Aggregation - immutable, functional, reduce example
import { Map } from 'immutable';
const items = Map({
id1: Map({
name: 'Item Name',
isActive: true
@bultas
bultas / es6.js
Last active November 16, 2016 16:30
ES6 Awesomeness (;
// DESTRUCTURING
// http://www.2ality.com/2015/01/es6-destructuring.html
let obj = { first: 'Jane', last: 'Doe' };
let { first: f, last } = obj;
// f = 'Jane'; last = 'Doe'
@bultas
bultas / script.js
Last active November 13, 2016 14:39
Gmail - Google Apps Script - permanently delete all messages from specific sender
function myFunction() {
var senderEmail = "[email protected]";
var threads = GmailApp.search("from:"+senderEmail);
for (var i = 0; i < threads.length; i++) {
Gmail.Users.Messages.remove('me', threads[i].getId());
}
}
@bultas
bultas / Dispatch.js
Created August 30, 2016 13:30
Dispatch - traverse functions as long as any function return something else then undefined
import {isNil} from 'ramda';
export function dispatch(...funcs) {
return function(...args) {
for (let fun of funcs) {
let ret = fun(...args);
if (!isNil(ret)) return ret;
}
@bultas
bultas / gist:6f4fccc1bb7d21cab9be4eec7c8cb843
Created August 25, 2016 16:47 — forked from n00neimp0rtant/gist:9515611
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@bultas
bultas / composeComponents.js
Last active May 18, 2016 08:40
Composable High-order components
export function composeComponents(component, wrappers = []) {
return wrappers.reduce((c, wrapper) => wrapper(c), component);
}
@bultas
bultas / gist:7a5e0a3974423cef0018
Last active July 14, 2017 09:05
React Stateless component example with props validation
import React from 'react';
import Link from 'components/link';
import { createStyles } from 'styles/styleSheet';
export function Button({ onClick }) {
return (