I hereby claim:
- I am antonioj-mattos on github.
- I am antoniojm (https://keybase.io/antoniojm) on keybase.
- I have a public key whose fingerprint is AAF9 54B5 B2B1 6C7C 4DCB F26D FB2D A591 4C17 975B
To claim this, I am signing this object:
| // ============================== | |
| // This gist is in response to | |
| // http://programmers.stackexchange.com/questions/228939/how-to-improve-upon-blochs-builder-pattern-to-make-it-more-appropriate-for-use | |
| // | |
| // This is a simple bit of code to do the same thing using the Either monad (e.g. success/failure) and applicatives | |
| // This code is (a) more generic (b) much shorter (c) more type safe | |
| // | |
| // Compare with the Java code at https://gist.github.com/swlaschin/9009343 | |
| // ============================== |
I hereby claim:
To claim this, I am signing this object:
| namespace Newtonsoft.Json.Converters | |
| open Microsoft.FSharp.Reflection | |
| open Newtonsoft.Json | |
| open System | |
| type IdiomaticDuConverter() = | |
| inherit JsonConverter() | |
| [<Literal>] |
| #Make sure 7za is installed | |
| choco install 7zip.commandline | |
| # Create mongodb and data directory | |
| md $env:temp\mongo\data | |
| # Go to mongodb dir | |
| Push-Location $env:temp\mongo | |
| # Download zipped mongodb binaries to mongodbdir |
| /// Code to bind mailbox processors to azure storage queues. | |
| module AzureMailboxProcessor | |
| open System | |
| module private Async = | |
| let AwaitTaskEmpty = Async.AwaitIAsyncResult >> Async.Ignore | |
| module private Option = | |
| let fromNullable (nullable:Nullable<_>) = if nullable.HasValue then Some nullable.Value else None | |
| let toNullable = function |
Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x| def paginate(ctx_name): | |
| """ | |
| View decorator that handles pagination of a ListObject. Expects to find it | |
| in the TemplateResponse context under the name ``ctx_name``. | |
| This needs to not force delivery of the ListObject. | |
| """ | |
| def decorator(view_func): | |
| @wraps(view_func) |
| import base64 | |
| from django.http import HttpResponse | |
| from django.contrib.auth import authenticate | |
| from django.conf import settings | |
| def view_or_basicauth(view, request, *args, **kwargs): | |
| # Check for valid basic auth header | |
| if 'HTTP_AUTHORIZATION' in request.META: |
| """ | |
| Logical deletion for Django models. Uses is_void flag | |
| to hide discarded items from queries. Overrides delete | |
| methods to set flag and soft-delete instead of removing | |
| rows from the database. | |
| """ | |
| from django.apps import apps | |
| from django.contrib.admin.utils import NestedObjects | |
| from django.db import models | |
| from django.db.models import signals |