Skip to content

Instantly share code, notes, and snippets.

View mariusbutuc's full-sized avatar
🌏

Marius Butuc mariusbutuc

🌏
  • Toronto, ON
  • 12:02 (UTC -04:00)
View GitHub Profile
@mariusbutuc
mariusbutuc / tasks.exs
Created September 28, 2017 19:20 — forked from zacid/tasks.exs
Comparison between parallel map in Elixir and map
# p_map is a parallel map which runs each and every process concurrently
> p_map = fn -> 1..5 |> Enum.map(fn(i) -> Task.async(fn -> :timer.sleep(200); i + 1 end) end) |> Enum.map(fn(tsk) -> Task.await(tsk) end) end
# slow_map runs each and every iteration one after the other
> slow_map = fn -> 1..5 |> Enum.map(fn(i) -> :timer.sleep(200); i + 1 end) end
> :timer.tc(fn -> p_map.() end, [])
{200830, [2, 3, 4, 5, 6]}
> :timer.tc(fn -> slow_map.() end, [])
# .git/hooks/pre-push
#!/usr/bin/env bash
set -e
trap 'echo interrupted; exit' INT
cd $(git rev-parse --show-toplevel)
if [ -f "mix.exs" ]; then
mix compile --warnings-as-errors
@mariusbutuc
mariusbutuc / PV.js
Created August 31, 2017 21:20 — forked from ghalimi/PV.js
PV Function
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function PV(rate, periods, payment, future, type) {
// Initialize type
var type = (typeof type === 'undefined') ? 0 : type;
// Evaluate rate and periods (TODO: replace with secure expression evaluator)
rate = eval(rate);
periods = eval(periods);
@mariusbutuc
mariusbutuc / install-elm-test.sh
Created June 15, 2017 02:06
Wow, all those dependencies…
$ npm install -g elm-test
└─┬ elm-test@0.18.6
├─┬ binstall@1.2.0
│ ├─┬ request@2.79.0
│ │ ├── aws-sign2@0.6.0
│ │ ├── aws4@1.6.0
│ │ ├── caseless@0.11.0
│ │ ├─┬ combined-stream@1.0.5
│ │ │ └── delayed-stream@1.0.0
│ │ ├── extend@3.0.1
@mariusbutuc
mariusbutuc / readable_amp.css
Created May 29, 2017 18:28
More readable AMP articles
amp-ad, .advertisement {
display: none !important;
}
p {
width: 80ch !important; /* classic! */
}
@mariusbutuc
mariusbutuc / sample-nginx.conf
Last active March 14, 2017 20:37 — forked from cjus/sample-nginx.conf
Nginx and React URL routing
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location / {
expires 5m;
try_files $uri $uri/ /index.html;
}

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

@mariusbutuc
mariusbutuc / introrx.md
Created January 4, 2017 18:33 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing

Back-end

  • Elixir
  • Elixir Metaprogramming
  • Phoenix
  • Ecto
  • GraphQL
  • Absinthe

Front-end

  • Relay