Skip to content

Instantly share code, notes, and snippets.

Author

Carlos Martinez

Context

React renders all children components whenever the parent component updates its state, e.g:

class Parent {

Author

Carlos Martinez

Context

Rendering the TimeEntry component is having a huge impact in the performance of the application, the render times (using the development build) look like this:

Inclusive render time:

Author

Carlos Martinez

Context

To update the timer when started, we are setting an interval that runs each second and updates the state with the new values for the timer.

The problem is that this doing this, is causing the whole Timer component to rerender each second. And because that component acts as a parent for the TimeEntriesList component this rerender will cause performance issues.

Problem Overview

The smooch component is breaking when used together with Turbolinks, what happens is that whenever turbolinks changes the page, the component gets confused and causes unexpected behaviours.

Findings

There's a way to manually embed the smooch component, using the { embedded: true } option, this way we could manually add the styling for the component. I created a react component to wrap this behaviour:

class SmoochComponent extends React.Component {

Estoy usando gem 'browserify-rails' para traer modulos de NPM al project

En el package.json estoy importando react, browserify, y babelify con presets para es2015 y react:

{
  "dependencies": {
    "babel-preset-es2015": "^6.14.0",
    "babel-preset-react": "^6.11.1",
    "babelify": "^7.3.0",

Inline editing time entries

Disclaimer

WIP

Author

Carlos Martinez.

@carlows
carlows / bulkactions.md
Last active August 1, 2016 13:13
Bulk Actions Denbora Spec

Bulk Actions

Disclaimer

WIP

Author

Carlos Martinez

Hasta ahora hay varios approaches que he intentado para solucionar el problema actual de Hashbot, el problema parte luego de crear el repositorio, cuando intentamos hacer requests enseguida luego de crearlo, la api devuelve dos errores distintos.

Utilizando octonode, puedo utilizar el método createContents para crear los archivos commit tras commit por separado.

function addFilestoRepository(data) {
    var repository = format("{company}/{repository}", { company: config.COMPANY_GITHUB_USER, repository: data.name });
    ghrepoPromise = Promise.promisifyAll(client.repo(repository));
    var teamGithubAccounts = team.githubUsers.join('\n');
@carlows
carlows / datmethodthough.js
Created July 26, 2016 18:18
long method crap
function createInitialCommitWithContents(repoData, ghrepoPromise, files) {
var defaultOptions = {
headers: {
"Authorization": format("token {token}", { token: config.GITHUB_TOKEN })
},
json: true
};
// getting the SHA for the latest commit
var shaCommitOptions = _.extend({}, defaultOptions, {
@carlows
carlows / curl.md
Created July 25, 2016 22:34 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin