Skip to content

Instantly share code, notes, and snippets.

View janmarsicek's full-sized avatar

Jan Marsicek janmarsicek

View GitHub Profile
@janmarsicek
janmarsicek / promises.re
Created December 16, 2018 21:56 — forked from lilactown/promises.re
Notes on using JavaScript Promises in ReasonML/BuckleScript
/**
* Making promises
*/
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok"));
/* Simpler promise creation for static values */
Js.Promise.resolve("easy");
Js.Promise.reject(Invalid_argument("too easy"));
let getListFromSearch = search =>
search
|> Js.String.split("&")
|> Array.to_list;
let parseUrlSearch = (stringToBeFound, search) =>
switch (search |> getListFromSearch |> List.find(stringToBeFound |> Js.String.startsWith)) {
| item => item |> Js.String.replace(stringToBeFound, "")
| exception Not_found => ""
};
https://bethallchurch.github.io/JavaScript-and-Functional-Programming/
////////////////
var add = (x, y) => x + y
var square = (x) => x * x
var addThenSquare = (x, y) => square(add(x, y))
@janmarsicek
janmarsicek / index.ios.js
Last active September 8, 2016 07:31 — forked from Jpoliachik/index.ios.js
ReactNative LayoutAnimation Example
'use strict';
import React, {
AppRegistry,
Component,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
} from 'react-native';
// config
$_color-base-grey: rgb(229,231,234);
$palettes: (
purple: (
base: rgb(42,40,80),
light: rgb(51,46,140),
dark: rgb(40,38,65)
),
grey: (
base: $_color-base-grey,
@janmarsicek
janmarsicek / flexbox-properties.sass
Last active March 10, 2016 22:55
Flexbox Properties
// Flexbox Playground: Visual Guide To Flexbox
// https://scotch.io/demos/visual-guide-to-css3-flexbox-flexbox-playground
// http://www.flexboxdefense.com/
// http://flexboxfroggy.com/
// http://flexboxin5.com/
// Use flexbox while supporting older Internet Explorers
// https://github.com/10up/flexibility/
/*
This widget sets language and shows Recent Posts on your Tumblr blog.
Its dependency is jQuery.
Usage:
1) Add html:
<div id="recent-posts"></div>
2) Add code before closing </body> tag
@janmarsicek
janmarsicek / tumblr-recent-posts.js
Created December 22, 2015 12:49 — forked from jarmo/tumblr-recent-posts.js
Tumblr Recent Posts Widget
/*
This widget shows Recent Posts on your Tumblr blog.
Its dependency is jQuery.
Usage:
1) Add html:
<div id="recent-posts"></div>
2) Add code into the <head>: