This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ 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 = ./.; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* bling.js */ | |
window.$ = document.querySelectorAll.bind(document); | |
Node.prototype.on = window.on = function (name, fn) { | |
this.addEventListener(name, fn); | |
} | |
NodeList.prototype.__proto__ = Array.prototype; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function debounce(fn, wait = 200) { | |
let timeout; | |
return function (...args) { | |
clearTimeout(timeout); | |
timeout = setTimeout(() => fn.call(this, ...args), wait); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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])) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original method | |
var object = { | |
method: function (x, y) { | |
return x+y; | |
} | |
} | |
// Add operations before or after! | |
object.method = (function (original) { | |
return function (x, y) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
NewerOlder