Skip to content

Instantly share code, notes, and snippets.

@thalesmg
thalesmg / teste2.elm
Last active January 3, 2017 09:36
Building a very simple tictactoe in Elm
module Main exposing (..)
import Html exposing (..)
import Html.Events exposing (onClick)
import Matrix exposing (..)
import Array as A
import Debug as D
main : Program Never Model Msg
@thalesmg
thalesmg / Poly1.hs
Last active January 13, 2017 12:19
Studying polyvariadicity in Haskell
{-# LANGUAGE FlexibleInstances #-}
class C a where
-- Tipo Args -> Tipo Acumulador -> C a
boom :: String -> a
-- |Tipo final
instance C String where
boom = id

Keybase proof

I hereby claim:

  • I am thalesmg on github.
  • I am thalesmg (https://keybase.io/thalesmg) on keybase.
  • I have a public key ASB3g8BuHvCeGStc3Yd-hdwmZ7BpzjWQ2lcPIYwFj9yXowo

To claim this, I am signing this object:

@thalesmg
thalesmg / haskell-records.md
Created December 7, 2017 23:36 — forked from mtesseract/haskell-records.md
Working around Haskell's namespace problem for records

The Problem

Defining records in Haskell causes accessor functions for the record's fields to be defined. There is no seperate namespace for these accessor functions.

The Goal

Be able to

  • use records in Haskell, which share field names.
  • use lenses for accessing these fields
@thalesmg
thalesmg / gist:1730c67efddf06b83fe25d3a9a85390f
Created June 1, 2018 19:43 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
@thalesmg
thalesmg / Makefile
Last active May 24, 2022 17:06
Makefile that watches for changes and passes arguments to rule
# Usage:
# $ make test sailor
# echo Hello, sailor!
# Hello, sailor!
# $ make watch test sailor
# while true; do \
# make sailor; \
# inotifywait -qre close_write,create,delete .; \
@thalesmg
thalesmg / 0-README.md
Created August 26, 2018 23:43 — forked from abhijeetchopra/0-README.md
Creating automatic scheduled backup copies of your Google Sheets using Google Apps Script

How to "Schedule Automatic Backups" of your Google Sheets

This tutorial demonstrates how to use Google Apps Script to:

  • Create copies of the Google Sheet in the desired destination folder automatically at set intervals.

  • Append the time stamp with each backup file's name.

  • Adjust time trigger for backing up every day/hour/minute.

@thalesmg
thalesmg / reflect.py
Created September 4, 2018 18:53 — forked from 1kastner/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from http.server import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@thalesmg
thalesmg / mais_uma_vez.hs
Last active September 8, 2018 16:50
Mais uma vez tentando entender Cont em Haskell
newtype Cont final a = Cont { runCont :: (a -> final) -> final }
{-
f :: a -> b
suspensa :: Cont final a
fmap f suspensa :: Cont final b
-}
instance Functor (Cont final) where
fmap f suspensa = Cont $ \_pure ->