Skip to content

Instantly share code, notes, and snippets.

View tdantas's full-sized avatar
🏠
Working from home

Thiago Dantas tdantas

🏠
Working from home
View GitHub Profile
@tdantas
tdantas / bulkspace.clj
Created November 29, 2023 09:59 — forked from nikolavojicic/bulkspace.clj
Various Clojure specs + generators
;; String containing bulk space(s)
(s/def ::bulk-space-string
(s/with-gen
(s/and string? #(re-find #"\t|\n|\r| +" %))
#(gen/fmap
str/join
(gen/vector
(gen/one-of
[(gen/string)
@tdantas
tdantas / HOWTO.md
Last active July 5, 2023 20:43
Too Many Connections Postgresql ( HomeBrew Installation)

HOWTO avoid 'too many connections'


Ask postgresql where is the configuration file

$ psql postgres
 psql (9.2.2)
   Type "help" for help.
@tdantas
tdantas / names.txt
Created May 30, 2014 22:33
names
MARY
PATRICIA
LINDA
BARBARA
ELIZABETH
JENNIFER
MARIA
SUSAN
MARGARET
DOROTHY
@tdantas
tdantas / ccs.md
Last active April 15, 2020 22:18
capybara cheat sheet

Copy from capybara's github page

Navigating

visit('/projects')  

Clicking links and buttons

click_link('id-of-link')  
click_link('Link Text')  
click_button('Save')  

click('Link Text') # Click either a link or a button

@tdantas
tdantas / userService.js
Last active November 3, 2019 19:59
Port simple JS function to Clojure ( make it simple to test and isolating side-effects )
/*
Goal:
1. create user database
2. send confirmation email
3. commit or rollback transaction
- 1 and 2 must be somehow transactional
( if sendgrid rejects the email "http response status 400 - 500 range", you must rollback the transaction )
Context:
(ns datomicdemo.core
(:require
[clojure.edn]
[clojure.string :as str]
[datomic.api :as d]))
(def url "datomic:free://localhost:4334/datomicdemo")
(d/create-database url)
@tdantas
tdantas / output
Last active May 6, 2019 01:46
Fiber Ruby
$ ruby poc_fiber.rb
"hello"
"world"
@tdantas
tdantas / vars.clj
Created December 4, 2017 20:22 — forked from reborg/vars.clj
;; (defn full-name ...) is equivalent to:
;; (def full-name (fn []...)) which defines a Var
;; object called full-name pointing at a compiled function
;; returning the static string "Oliv"
(defn full-name [] "Oliv")
;; greetings is a function taking two args.
;; it returns a function of no argument
;; invoking the second argument (f) with no arguments
;; and combining a string with it.
@tdantas
tdantas / angularjs_directive_attribute_explanation.md
Created June 29, 2016 21:28 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@tdantas
tdantas / short.clj
Created April 12, 2016 16:25
shortner
;;adambard
(ns urlshortener.core
(:require
[org.httpkit.server :refer [run-server]]
[taoensso.carmine :as redis])
(:import
clojure.lang.Murmur3
org.apache.commons.validator.routines.UrlValidator))
(def validator (UrlValidator. (into-array ["http" "https"])))