Skip to content

Instantly share code, notes, and snippets.

View reu's full-sized avatar

Rodrigo Navarro reu

View GitHub Profile
@avieth
avieth / gist:334201aa341d9a00c7fc
Last active July 22, 2022 13:42
Interpreting Free Monads of Functor Sums
Interpreting Free Monads of Functor Sums
========================================
This text deals with a way to compose certain kinds of monads, thereby mixing
their capabilities. It is a literate Haskell file, so let's begin with a
bunch of noise.
> {-# LANGUAGE MultiParamTypeClasses #-}
> {-# LANGUAGE FlexibleInstances #-}
> {-# LANGUAGE FlexibleContexts #-}
class Cloudy::CloudWorker
class CurrentStepNotFound < StandardError; end
class StepClassNotFound < StandardError; end
class CanNotAsyncExecuteFirstStep < StandardError; end
# @!attribute customer_repository
# @return [CustomerRepository] the customer repository
attr_accessor :customer_repository
# @!attribute pipeline_manager
@jorinvo
jorinvo / challenge.md
Last active November 19, 2024 02:40
This is a little challenge to find out which tools programmers use to get their everyday tasks done quickly.

You got your hands on some data that was leaked from a social network and you want to help the poor people.

Luckily you know a government service to automatically block a list of credit cards.

The service is a little old school though and you have to upload a CSV file in the exact format. The upload fails if the CSV file contains invalid data.

The CSV files should have two columns, Name and Credit Card. Also, it must be named after the following pattern:

YYYYMMDD.csv.

@robertjpayne
robertjpayne / RCTSwiftBridgeModule.h
Last active January 17, 2024 11:43
React Native - Swift Native Modules
#import <Foundation/Foundation.h>
#import "RCTBridgeModule.h"
#define RCT_EXTERN_MODULE(objc_name, objc_supername) \
RCT_EXTERN_REMAP_MODULE(objc_name, objc_name, objc_supername)
#define RCT_EXTERN_REMAP_MODULE(js_name, objc_name, objc_supername) \
objc_name : objc_supername \
@end \
@interface objc_name (RCTExternModule) <RCTBridgeModule> \
@nmabhinandan
nmabhinandan / .travis.yml
Last active April 28, 2017 15:45
Testing ES6 using Mocha by transpiling (using babel) into AMD(RequireJS) on PhantomJS.
language: node_js
node_js:
- '0.10'
- '0.11'
- '0.12'
- 'iojs-v1.7.1'
matrix:
allow_failures:
@chrisdotcode
chrisdotcode / Promise.hs
Created February 16, 2015 00:07
Abstract Promises in Haskell
module Promise where
import Control.Applicative (Applicative(..))
import Data.Monoid (Monoid(..))
newtype Error = Error { unString :: String } deriving (Eq, Ord, Read, Show)
data Promise a = Failed Error | Deferred | Fulfilled a
deriving (Eq, Ord, Read, Show)
@danclien
danclien / Main.hs
Created February 10, 2015 18:56
Using Aeson without type classes.
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-
build-depends: base >=4.7 && <4.8
, aeson
, aeson-qq
, bytestring
, text
@justmoon
justmoon / custom-error.js
Last active November 19, 2024 02:40 — forked from subfuzion/error.md
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@avdi
avdi / nullenum.rb
Created January 9, 2015 20:32
Behold, the null enumerator.
e = loop
e # => #<Enumerator: main:loop>
e.next # => nil
e.next # => nil
e.peek # => nil
e.size # => Infinity
e.rewind
e.next # => nil