Skip to content

Instantly share code, notes, and snippets.

@rofrol
rofrol / index.html
Created January 31, 2016 20:34
cycle.js minimal example
<!doctype html>
<!-- https://medium.com/@fkrautwald/we-are-not-writing-much-code-5404fb7d39e -->
<div id="app"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.7/rx.all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cyclejs-core/6.0.0/cycle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cyclejs-dom/9.0.2/cycle-dom.min.js"></script>
<script>
Cycle.run((sources) => ({DOM: Rx.Observable.timer(0, 1000).map(i => CycleDOM.h(`div`, `Seconds elapsed: ${i}`))}),{DOM: CycleDOM.makeDOMDriver(`#app`)})
</script>
@rofrol
rofrol / index.html
Last active January 31, 2016 20:49
cycle.js embed from another gist
<!doctype html>
<!-- https://medium.com/@fkrautwald/we-are-not-writing-much-code-5404fb7d39e -->
<div id="app"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.7/rx.all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cyclejs-core/6.0.0/cycle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cyclejs-dom/9.0.2/cycle-dom.min.js"></script>
<script src="https://rawgit.com/rofrol/c11c3926742b0ce65b87/raw/app.js"></script>
@rofrol
rofrol / index.html
Created January 31, 2016 20:50
cycle.js embed from another 2
<!doctype html>
<!-- https://medium.com/@fkrautwald/we-are-not-writing-much-code-5404fb7d39e -->
<div id="app"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/rxjs/4.0.7/rx.all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cyclejs-core/6.0.0/cycle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cyclejs-dom/9.0.2/cycle-dom.min.js"></script>
<script src="https://rawgit.com/rofrol/c11c3926742b0ce65b87/raw/app.js"></script>
@rofrol
rofrol / app.js
Created January 31, 2016 20:57
cycle.js embed single in medium.com
function main({DOM}) {
const h = CycleDOM.h;
return {
DOM:
// click, click, click -> [2.. 4.. 4..]
DOM.select('button').events('click').
map(evt => parseInt(evt.target.innerText)).
filter(val => val % 2 === 0).
@rofrol
rofrol / Cycle.js timer demo.markdown
Last active January 31, 2016 21:14
Cycle.js timer demo
@rofrol
rofrol / Cargo.toml
Last active August 19, 2016 11:47 — forked from gkbrk/Cargo.toml
Asynchronous server example in Rust
[package]
name = "rust-async-qotd"
version = "0.1.0"
authors = ["Gökberk Yaltıraklı <webdosusb@gmail.com>"]
[dependencies]
tokio = { git = "https://github.com/tokio-rs/tokio" }
rand = "0.3"
[[bin]]
@rofrol
rofrol / .psqlrc
Created August 17, 2017 09:52 — forked from tkalfigo/.psqlrc
My .psqlrc
\set QUIET 1
\pset null '(null)'
\pset linestyle unicode
\pset border 2
\timing
\set ON_ERROR_ROLLBACK interactive
\set HISTFILE ~/.psql_history- :HOST - :DBNAME
\set HISTSIZE 2000
\set PROMPT1 '%n@%/[%M:%>] # '
\set PROMPT2 '> '
@rofrol
rofrol / .psqlrc
Created August 17, 2017 09:52 — forked from tkalfigo/.psqlrc
My .psqlrc
\set QUIET 1
\pset null '(null)'
\pset linestyle unicode
\pset border 2
\timing
\set ON_ERROR_ROLLBACK interactive
\set HISTFILE ~/.psql_history- :HOST - :DBNAME
\set HISTSIZE 2000
\set PROMPT1 '%n@%/[%M:%>] # '
\set PROMPT2 '> '

linter-elm-make

Always Compile Main: Yes

You can have the main paths set per project with file linter-elm-make.json and content like:

{
  "mainPaths": [
    "src/elm/Main.elm"

]

@rofrol
rofrol / flatten.js
Last active March 27, 2018 11:52
flatten.js
/*
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
Your solution should be a link to a gist on gist.github.com with your implementation.
When writing this code, you can use any language you're comfortable with. The code must be well tested and documented if necessary, and in general please treat the quality of the code as if it was ready to ship to production.
Try to avoid using language defined methods like Ruby's Array#flatten.*