Skip to content

Instantly share code, notes, and snippets.

View mauricioabreu's full-sized avatar
🇧🇷
always learning

Mauricio Antunes mauricioabreu

🇧🇷
always learning
View GitHub Profile

Como Pensar

Ler e entender um pouco desse artigo. https://wiki.c2.com/?FeynmanAlgorithm

  • Reconhecer como você pensa
  • Descrever métodos que você usa para pensar
  • Entender métodos diferentes de pensar
  • Fazer perguntas sobre tudo(incluindo sobre perguntas)

Perguntas

defmodule Mergesort do
def merge_sort([]), do: []
def merge_sort(list) do
list
|> Enum.map(fn x -> [x] end)
|> merge_lists()
end
def merge_lists([list]), do: list
@hjertnes
hjertnes / doom.txt
Created April 6, 2018 08:28
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch

Crystal vs Node.js Websocket Benchmark

Crystal 0.9.1 with Kemal

require "kemal"

ws "/" do |socket|
  socket.on_message do |message|
 end
@rjeczalik
rjeczalik / qwatch.go
Last active January 13, 2019 00:46
queued watch
package main
import (
"log"
"os"
"sync"
"github.com/rjeczalik/notify"
)
@kgriffs
kgriffs / test_simple.py
Last active July 13, 2018 00:11
Simple Falcon testing example
import falcon
import falcon.testing as testing
QUOTE = (u"\nI've always been more interested in\n"
u'the future than in the past.\n'
u'\n'
u' ~ Grace Hopper\n\n')
class ThingsResource(object):
def on_get(self, req, resp):
@nick-merrill
nick-merrill / merge_model_objects.py
Created December 5, 2014 01:07
A variation on a snippet that handles one-to-one relationships by recursively migrating those relationships' field data to the `primary_object`'s related object.
# Based on https://djangosnippets.org/snippets/2283/
from django.db import transaction
from django.db.models import get_models, Model
from django.contrib.contenttypes.generic import GenericForeignKey
@transaction.atomic
def merge_model_objects(primary_object, alias_objects=None, keep_old=False):
"""
Use this function to merge model objects (i.e. Users, Organizations, Polls,
# Inspired by the following sentence that I ran across this morning:
#
# "f_lineno is the current line number of the frame - writing to
# this from within a trace function jumps to the given line
# (only for the bottom-most frame). A debugger can implement a
# Jump command (aka Set Next Statement) by writing to f_lineno."
#
# https://docs.python.org/2/reference/datamodel.html
#
# There is an older implementation of a similar idea:
@exit99
exit99 / Auto-Dave
Last active March 1, 2016 19:35
Automating Dave's Job
import time
import urllib2
from datetime import datetime
def do_dave():
while 10 < datetime.now().hour < 15:
time.sleep(5)
urllib2.urlopen('http://www.reddit.com/')
@sigmavirus24
sigmavirus24 / pascal's output
Created August 10, 2014 13:21
Pascal's Triangle
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1