Skip to content

Instantly share code, notes, and snippets.

View jaimelr's full-sized avatar
🔥
On fire

Jaime Loyola jaimelr

🔥
On fire
View GitHub Profile
@jaimelr
jaimelr / bug_squash
Created December 20, 2024 06:10
MomentJS Bug
## Describe the bug
The docs do specify that the .year() method signature expects a number value, but strings are not outright rejected.
It seems to happen only with the year 2020 and no other leap years. Starting from a moment object with its date set to
2020-02-29 and then setting the year to '2020' (with a string value) changes the day to 28.
If you pass 2020 as a number, the day stays at 29. If you start off with 2012, 2016, 2024 or 2028 and then set the year to
the same value, string or number, the day stays at 29. It only happens with the year 2020 using a string value.
Expected behavior
The day stays at 29.
@jaimelr
jaimelr / rapid_es6_training_summary.md
Last active July 27, 2023 23:48
Rapid ES6 Training

Rapid ES6 Training

An ES6 compatibility chart: kangax.github.io/compat_table/es6

New ES6 Syntax

let, const, and block scoping

  • let: Not hoisting, we make sure the variable exist before using it
  • Block scoping: We can redefine a variable within a block and that variable wil dissapear outside the block
  • const: When we use the const keyword to define a variable we MUST initialize it

With letand const anything declared inside the block, STAYS in the block

Instructions

  1. Clone the repository to your local development environment https://github.com/simple-statistics/simple-statistics
  2. git checkout to tag v7.7.2

Description of the bug

The mean() function does not raise an error for null values in sample, nor is there a note in the documentation specifying this.

Here's an example of where I realized this:

@jaimelr
jaimelr / luxon_bug.md
Created May 11, 2023 16:55
Duration using decimal hours produces wrong output using toFormat #1070

Describe the bug

Creating a duration using a decimal hour then using toFormat produces an incorrect result

The inputs we've seen wrong so far are 2.4 and 5.3

To Reproduce

luxon.Duration.fromObject({hour: 2.4}).toFormat('hh:mm') returns "02:23"
luxon.Duration.fromObject({hour: 5.3}).toFormat('hh:mm') returns "05:17"
@jaimelr
jaimelr / leadership_and_communication_skills_for_software_engineers.md
Created November 21, 2019 17:16
Leadership and Communication Skills for Software Engineers

Leadership and Communication Skills for Software Engineers

Communication is where leadership leaves and breaths

Effective communication is the most critical skill a leader can posses when working with others.

The leader is the message.

First Steps

  • Establish the team way of work ahead of time.
  • Set and clarify goals.
@jaimelr
jaimelr / rapid_es6_training.md
Created November 15, 2019 22:51
Rapid ES6 Training

An ES6 compatibility chart

New ES6 Syntax

let, const and block scoping

  • let: Not hoisting, we make sure the variable exist before using it.
  • Block scoping: We can redefine a variable within a block and that variable will disappear outside the block.
  • const: When we use this keyword to define a variable we MUST initialize it.

With letand const, anything declared inside the block STAYS in the block.

Rule 1 Let your database do what databases are good at, instead of doing it in Ruby.

Rule 2 Write efficient and chainable Scopes

  1. Return an ActiveRecord::Relation (i.e. don't trigger that query)
  2. Filter data in the database (not in Ruby)
  3. Sort in the database (not in Ruby)
  4. Leave ordering out of scopes (or capture in a dedicated scope)

Rule 3 Reduce calls to the Database

@jaimelr
jaimelr / smacss.md
Last active September 12, 2019 01:56

Scalable and Modular Architecture for CSS

Categorization

  • Every style we write serves one of these purposes wheter we're aware of it or not
  • Isolating code allows for easier, reuse, testing and debugging
  • Categorizing reveals patterns; easier to identify when things break the pattern

Base styles

  • Reset
  • Normalize

Layout styles

@jaimelr
jaimelr / the_effective_engineer.md
Created June 27, 2019 23:21
The Effective Engineer notes

Part 1: Adopt the Right Mindsets

Focus on High-Leverage Activities

How should we decide what actually to work on in order to more effectively achieve our goals? Assess the activities' leverage:

Leverage =  (Impact Produce) / (Time Invested)

Another way of thinking about leverage is the commonly-mentioned Pare- to principle, or 80–20 rule—the notion that for many activities, 80% of the im- pact comes from 20% of the work.

Docker Architecture and Theory

The Big Picture

Container: Isolated area of an OS wioth resource usage limits applied. To build containers we use low level kernel controls: namespaces and control groups.

We use the CLI docker container run which makes a call to the appropiate Docker API containers/create

Kernel Internals

We use two main building blocks when creating containers: Namespaces and Control Groups, both of them are Linux kernel primitives.