Skip to content

Instantly share code, notes, and snippets.

View daviferreira's full-sized avatar

Davi Ferreira daviferreira

View GitHub Profile
@Daenero
Daenero / quill-fix-indent.ts
Created November 13, 2020 14:29
Fix for Quill.js issue with list indent (use of css class instead of pure HTML)
// https://github.com/quilljs/quill/issues/979
interface NestedElement {
content: string;
indent: number;
classes: string;
}
export function quillDecodeIndent(text: string) {
if (!text || text.length === 0) {
@sergiospagnuolo
sergiospagnuolo / analise_popularidade.R
Last active July 1, 2021 20:46
Código para captura de busca de tuítes
library(lubridate)
library(scales)
library(tidyverse)
# regulariza o formato da data do tweet, corrige para fuso certo
d$created_at <- as.POSIXct(strptime(d$created_at, "%Y-%m-%d %H:%M:%S"))
d$created_at <- d$created_at - hours(3)
d$dia <- as.POSIXct(strptime(d$created_at, "%Y-%m-%d"))
# cria coluna com minuto arredondado
@scwood
scwood / largestRemainderRound.js
Last active December 14, 2021 14:07
Largest remainder round
/**
* largestRemainderRound will round each number in an array to the nearest
* integer but make sure that the the sum of all the numbers still equals
* desiredTotal. Uses largest remainder method. Returns numbers in order they
* came.
*
* @param {number[]} numbers - numbers to round
* @param {number} desiredTotal - total that sum of the return list must equal
* @return {number[]} the list of rounded numbers
* @example

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals

This is a proposal for a lightning talk at the Reactive 2016 conference. If you like this, star the Gist.


Thinking metrics on React applications

In regular websites, it is common to send multiple events to track user clicks. Single Page Applications change the way you look at metrics. This is a talk about a simple pattern we created at Globo.com to manage a metrics layer for http://globoplay.globo.com. The talk will cover how to track user flow using Google Analytics and other services. We solved the challenge of tying metrics and components, keeping information across pages and having global data. Also some React, React Router and React Side Effects concepts like context, higher order components, history state will be covered.

@dmvaldman
dmvaldman / FRPandPhilosophy.md
Last active February 23, 2024 16:24
Descartes, Berkeley and Functional Reactive Programming

Descartes, Berkeley and Functional Reactive Programming

By @dmvaldman

Functional Reactive Programming (FRP) is generating buzz as an alternative to Object Oriented Programming (OOP) for certain use cases. However, an internet search quickly leads a curious and optimistic reader into the rabbit-hole of monads, functors, and other technical jargon. I’ve since emerged from this dark and lonely place with the realization that these words are mere implementation details, and that the core concepts are far more universal. In fact, the groundwork was laid down many centuries before the first computer, and has more to do with interpretations of reality, than structuring programs. Allow me to explain.

There’s an old thought experiment that goes like this:

Tree

@rikukissa
rikukissa / POST.md
Last active January 27, 2020 08:10
Unit testing Angular.js app with node.js, mocha, angular-mocks and jsdom #angular.js #testing
title slug createdAt language preview
Unit testing Angular.js app with node.js, mocha, angular-mocks and jsdom
unit-testing-angular-js-app-with-node
2015-07-05T18:04:33Z
en
Majority of search result about unit testing Angular.js apps is about how to do it by using test frameworks that run the tests in a real browser. Even though it's great to be able to test your code in multiple platforms, in my opinion it creates a lot of boilerplate code and makes it hard to run the tests in, for instance a CI-server.

Testing Angular.js app headlessly with node.js + mocha

Lean unit tests with minimal setup

@Munter
Munter / fusile-intro.md
Last active August 29, 2015 14:16
Work in progress Fusile description
npm install -g fusile

General usage: fusile <sourceDir> <mountPoint>

Fusile is a compiling file system proxy. In order to get it to compile your assets you need to install one or more of these precompilers: LiveScript, babel, coco, coffee-script, dogescript, less, marked, myth, node-sass, stylus, swig

When any of the above precompilers are available in the context of fusile (in your project root or globally installed), fusile will automatically load it and start compiling files with the corresponding file extension when you read the files from the mountpoint.

@giuseppeg
giuseppeg / app-structure.md
Last active August 29, 2015 14:10
app front-end structure

Components (or modules) talk to each other via events.

  • vendor [3rd party scripts, this could as well be bower_components if you use bower]
  • core [app core functionalities/utilities]
  • component
    • component1
      • index.js [the actual js component]
      • spec.js [tests]
      • style.css [component styles]
  • index.partial.template
@Zauberfisch
Zauberfisch / install-wkhtml2pdf.sh
Last active March 14, 2017 10:53
Install wkhtml2pdf on ubuntu precise 64bit (12.04 LTS) with patched QT
# I managed to get the compiled version with patched QT working on ubuntu precise 64bit (12.04 LTS) and thought I'd share my bash history in the hopes it might spare others some trouble shooting.
# Also note that this install process takes rather long, you might want to consider running it in a screen or something
# you will be needing git if you haven't got it yet
sudo apt-get install git-core
# as per installation instructions, install dependencies for wkhtmltopdf
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev
# clone the repo
git clone git://github.com/antialize/wkhtmltopdf.git wkhtmltopdf