Skip to content

Instantly share code, notes, and snippets.

View robotlolita's full-sized avatar
🐴
everything happens so much oh no

Quil robotlolita

🐴
everything happens so much oh no
View GitHub Profile
@robotlolita
robotlolita / gist:7216015
Created October 29, 2013 14:46
Basically, every time the subject "correctness" comes up. Every. Single. Time. Damn, no wonder we have bugs everywhere.
<dmanderson> Oh Domo :)
<dmanderson> Nice templater
<Sorella> Oh.
<dmanderson> I've been using an underscore to JST compiler as of late, but
this looks really nice.
<Sorella> I don't quite like Domo, but sure.
<Sorella> Oh Lord, don't use Underscore's templating. Like,
really. Don't. Just. Don't.
<dmanderson> No I'm using JST
<dmanderson> writing the templates in underscore
@robotlolita
robotlolita / oop.md
Last active May 24, 2023 21:23
O que é OOP? Por que Java não deve ser considerado uma linguagem com um bom suporte para esse paradigma?

Objeto é a noção de uma entidade que é definida inteiramente pelo seu comportamento. E esse comportamento é dinâmicamente selecionado. Em outras palavras, eu "peço" um objeto para "andar," e como ele vai fazer isso é inteiramente definido pelo objeto.

O exemplo:

objeto.anda()

Captura bem essa idéia. Eu tenho uma mensagem "anda," mas eu não consigo dizer o que essa função faz direto do meu código, porque isso depende no comportamento dinâmico da execução do programa (em uma linguagem estáticamente tipada você consegue optimizar isso, mas o raciocínio do código continua o mesmo).

@robotlolita
robotlolita / gist:1562746
Created January 4, 2012 23:12
Lightweight documentation markup language.
The `doll` markup language is a *lightweight* markup language inspired
by /org-mode/, /markdown/, /ReStructuredText/ and regular /Emacs Lisp/
documentation, designed to be used as documentation comment syntax for
the Calliope project.
== Commands ===================================================================
TODO.
@robotlolita
robotlolita / loops-are-evil.md
Last active March 2, 2022 17:19
Why `xs.each(f)` should not be considered a "loop".

First and foremost, let's take a look at the following pieces of code. The first one is something you should be rather familiar with, and the second one is also a somewhat familiar idiom these days (at least in languages with higher-order functions):

// Example 1:
30 + 12

// Example 2:
xs.map(f)
// Frees the `[].slice` method to accept `this` as the first actual argument,
// rather than a special argument.
var toArray = Function.call.bind([].slice)
// To make searching efficient (O(1)), we switch the
// list of things to a HashMap, which allows we to
// retrieve an item by its name in constant time.
function indexBy(field, list) {
return list.reduce(function(result, item) {
result[item[field]] = item
const Validation = require('folktale/validation');
const { Success, Failure } = Validation;
// valida se uma string não é vazia
const hasText = (value, name) =>
if (value != "") Success(value)
else Failure([{ code: 'required', name }]);
// valida se uma selecao não é vazia
const hasSelection = (value, name) =>

Unclutter calendar:

javascript:void (() => { Array.from(document.querySelectorAll('.calendar .item')).filter(x => !/\b(green|yellow)\b/.test(x.className)).forEach(x => x.parentNode.removeChild(x)); Array.from(document.querySelectorAll('.browse__content .section')).filter(x => { const a = x.querySelector('h2'); return x.textContent.trim() === a.textContent.trim() }).forEach(x => x.parentNode.removeChild(x)) })()
@robotlolita
robotlolita / gist:1966465
Last active July 17, 2017 19:21
Really naïve and small subset of Lisp
ometa NaiveLispParser {
fromTo :x :y = seq(x) (~seq(y) char*) seq(y),
space = ^space | fromTo(';', '\n'),
symbol = '+' | '=' | '-' | '_' | '*' | '%' | '!' | '/' | '^' | '>' | '<',
idChars = symbol | letterOrDigit,
nil = spaces "nil" -> #nil,
id = spaces idChars+:id -> [#id, id.join('')],
num = spaces digit+:d -> [#num, Number(d.join(''))],
funcall = "(" expr:hd (spaces expr)*:tl ")" -> [hd, tl],
@robotlolita
robotlolita / purr.md
Last active May 10, 2017 20:39
Why Purr is awful

You appear to be advocating a new:

  • functional
  • imperative
  • object-oriented
  • procedural
  • stack-based
  • "multi-paradigm"
  • lazy
  • eager
  • statically-typed
var fs = require("fs");
var helpers = require("./helpers");
var path = require("path");
function readFile(path, options) {
return new Promise(function(resolve, reject) {
fs.readFile(path, options, function(err, data) {
if (err) reject(err);
else resolve(data);
})