Skip to content

Instantly share code, notes, and snippets.

View kutyel's full-sized avatar
🌊
数学者に俺は成る!

Flavio Corpa kutyel

🌊
数学者に俺は成る!
View GitHub Profile
@kutyel
kutyel / Optics.hs
Created October 9, 2020 22:19 — forked from robrix/Optics.hs
Optics via fused-effects
{-# LANGUAGE RankNTypes #-}
module Optics where
import Control.Category ((>>>))
import qualified Control.Category as Cat
import Control.Effect.Empty
import Control.Effect.NonDet hiding (empty)
import Control.Monad ((<=<))
-- riffing off of @serras’s post https://gist.github.com/serras/5152ec18ec5223b676cc67cac0e99b70
{ nixpkgs ? (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-19.09.tar.gz)
, system ? builtins.currentSystem
}:
let
haskellnix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz);
overlay = _: pkgs:
let
hnPkgs = pkgs.haskell-nix.stackProject {
src = ./.;
module GoogleChart exposing (..)
import Html exposing (Html)
import Html.Attributes as HtmlA
import Json.Encode as E
import List.Extra as List
import Chart exposing (..)
colors =
@kutyel
kutyel / bling.js
Created August 16, 2017 07:20 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@kutyel
kutyel / debounce-es2015.js
Last active June 14, 2017 12:14 — forked from vincentorback/debounce-es2015.js
Smarter debouncing
export function debounce(fn, wait = 200) {
let timeout;
return function (...args) {
clearTimeout(timeout);
timeout = setTimeout(() => fn.call(this, ...args), wait);
}
}
@kutyel
kutyel / slim-redux.js
Created August 4, 2016 08:31 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@kutyel
kutyel / fish_greeting.fish
Created August 4, 2016 07:51 — forked from dan-c-underwood/fish_greeting.fish
Custom fish greeting (for fish shell)
function fish_greeting
echo ' '(set_color F00)'___
___======____='(set_color FF7F00)'-'(set_color FF0)'-'(set_color FF7F00)'-='(set_color F00)')
/T \_'(set_color FF0)'--='(set_color FF7F00)'=='(set_color F00)') '(set_color red)(whoami)'@'(hostname)'
[ \ '(set_color FF7F00)'('(set_color FF0)'0'(set_color FF7F00)') '(set_color F00)'\~ \_'(set_color FF0)'-='(set_color FF7F00)'='(set_color F00)')'(set_color yellow)' Uptime:'(set_color white)(uptime | sed 's/.*up \([^,]*\), .*/\1/')(set_color red)'
\ / )J'(set_color FF7F00)'~~ \\'(set_color FF0)'-='(set_color F00)') Theme: '(set_color white)(echo $fish_theme)(set_color red)'
\\\\___/ )JJ'(set_color FF7F00)'~'(set_color FF0)'~~ '(set_color F00)'\) '(set_color yellow)'Version: '(set_color white)(echo $FISH_VERSION)(set_color red)'
\_____/JJJ'(set_color FF7F00)'~~'(set_color FF0)'~~ '(set_color F00)'\\
'(set_color FF7F00)'/ '(set_color FF0)'\ '(set_color FF0)', \\'(set_color F00)'J'(set_color
@kutyel
kutyel / monkey-patch.js
Created June 28, 2016 08:07 — forked from naholyr/monkey-patch.js
JS monkey patching
// Original method
var object = {
method: function (x, y) {
return x+y;
}
}
// Add operations before or after!
object.method = (function (original) {
return function (x, y) {
@kutyel
kutyel / functional-programming-polyfill.js
Last active June 7, 2016 12:29 — forked from keropodium/array.js
Immutable-Functional-Array 🐑💨
Array.prototype.push = function(x) {
return [].concat(this, x);
};
Array.prototype.pop = function() {
return this.slice(0, this.length-1);
};
Array.prototype.unshift = function(x) {
return [].concat(x, this);
@kutyel
kutyel / async_await.js
Last active August 8, 2017 10:58 — forked from Jviejo/asyncawait.ts
async / await, finally in ES2017
// las funciones con await deben de tener el prefijo async
async function main () {
try {
const result = await pedirPermisos();
// dependemos del servicio anterior para realizar el siguiente
if (result) {
const geolocation = await llamarAPIGoogleMaps();
console.log(geolocation);