Skip to content

Instantly share code, notes, and snippets.

View mariusbutuc's full-sized avatar
🌏

Marius Butuc mariusbutuc

🌏
  • Toronto, ON
  • 00:50 (UTC -04:00)
View GitHub Profile
@mariusbutuc
mariusbutuc / quote.txt
Created July 5, 2018 16:13 — forked from OnesimusUnbound/quote.txt
Programming Quotes
[T]he difference between a bad programmer and a
good one is whether he considers his code or his
data structures more important. Bad programmers
worry about the code. Good programmers worry about
data structures and their relationships.
-- Linus Torvalds
~~~
Clarity and brevity sometimes are at odds.
When they are, I choose clarity.
-- Jacob Kaplan-Moss
@mariusbutuc
mariusbutuc / gist:5996261965430a3590865c930a53ab92
Created January 4, 2018 19:37 — forked from twosixcode/gist:1988097
Make "Paste and Indent" the default paste in Sublime Text 2
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
@mariusbutuc
mariusbutuc / RecalculateSellectedCells.gs
Created November 29, 2017 13:46 — forked from katz/RecalculateSellectedCells.gs
Google Apps Script to re-calculate selected cells in Sheets
/**
* @OnlyCurrentDoc Limits the script to only accessing the current spreadsheet.
*/
/**
* Adds a custom menu with items to show the sidebar and dialog.
*
* @param {Object} e The event parameter for a simple onOpen trigger.
*/
@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, [])
@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 / 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
@mariusbutuc
mariusbutuc / modal-video-full.html
Created November 19, 2016 02:33 — forked from anam-hossain/modal-video-full.html
Full example - autoplay youtube video in a Modal (Bootstrap + Jquery)
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
$(function() {
$(".video").click(function () {
var theModal = $(this).data("target"),
videoSRC = $(this).attr("data-video"),
@mariusbutuc
mariusbutuc / cache.rb
Last active April 29, 2016 20:57 — forked from nickhoffman/cache.rb
Code Kata #4: Cache
class Cache
attr_accessor :data
def initialize(data: {})
@data = data
end
def get(key)
return if data.fetch(key, {}).fetch(:expires_at, nil) <= now