Skip to content

Instantly share code, notes, and snippets.

@michaelavila
michaelavila / lens.md
Created July 11, 2017 17:15
Control.Lens Notes

Lens

Control.Lens helps you to get, set, and modify the particulars of your data. The ideas behind lens are interesting for a number of reasons, not the least of which is composability. Because of this, Simon Peyton Jones titled his talk on lens "Compositional Data Access and Manipulation", which is a great title. You should watch that talk.

The agenda is:

@michaelavila
michaelavila / Applicative Functor (part 1) notes.md
Last active June 12, 2017 17:11
Applicative Functor (part 1) notes

Applicative functors

Why is Applicative Functor needed?

To understand the need for applicative, try to write an implementation of the following:

fmap2 :: Functor f => (a -> b -> c) -> (f a -> f b -> f c)
//: Playground - noun: a place where people can play
import UIKit
typealias Properties = Dictionary<String,Any?>
struct TypeKey {
let type: Any.Type
}
@michaelavila
michaelavila / .vimrc
Created August 26, 2016 16:54
Toggle light/dark for terminal + vim
let base16colorspace=256
colorscheme base16-default-dark
let shellbg=$SHELLBG
if shellbg == 'dark'
set background=dark
highlight LineNr ctermfg=blue ctermbg=black
else
set background=light
highlight LineNr ctermfg=blue ctermbg=white
endif
@michaelavila
michaelavila / README.md
Created January 19, 2016 22:23
Colorize maven output
  1. brew install grc
  2. add alias mvn='grc -c conf.mvn mvn' to your ~/.profile
  3. copy the other file in this gist to ~/.grc/conf.mvn

Put the contents of the files in this gist in $HOME/.grc/ in their respective files.

package com.michaelavila;
import java.util.Optional;
import java.util.function.Function;
class Either<A,B> {
private A left = null;
private B right = null;
private Either(A a, B b) {
@michaelavila
michaelavila / .java
Last active August 29, 2015 14:26
java 8: func <$> arg1 <*> arg2 <*> arg3
package com.michaelavila;
import java.util.Optional;
import java.util.function.Function;
/**
* Created by michaelavila on 7/30/15.
*/
public class FunctionalExamples {
public static void main(String[] args) {
@michaelavila
michaelavila / dot.sh
Created November 18, 2014 21:31
Simple dotfiles management.
#!/usr/bin/env sh
DOTVERSION=0.0.1
function dot() {
(( $# )) || (echo "No arguments provided." && dot-usage)
# check for version, and help
for arg in "$@"
do
case $arg in
@michaelavila
michaelavila / .travis.yml
Last active August 29, 2015 14:09
Working Travis-CI config for newly created Swift (iOS) projects
language: objective-c
osx_image: xcode61
script:
- xctool test -project Project.xcodeproj -scheme Project -sdk iphonesimulator