Skip to content

Instantly share code, notes, and snippets.

View linuxonrails's full-sized avatar

Linux on Rails linuxonrails

View GitHub Profile
@ivanbtrujillo
ivanbtrujillo / readonly.ts
Last active June 17, 2020 09:40
Avoid mutations using Readonly in Typescript
interface User {
id: number;
name: string;
}
// Objects
We are going to change the name of the user. We will have three functions:
- changeName1 : mutates the object. Bad practice because mutations are a source of bugs hard to find.
@brauliodiez
brauliodiez / readme.md
Last active April 15, 2018 07:02
Spread Operator simple samples

spread operator

The spread syntax allows an expression to be expanded in places where multiple arguments (for function calls) or multiple elements (for array literals) or multiple variables (for destructuring assignment) are expected.

steps

Copying an object but replacing some properties:

This one we will need bable to make it work

@brauliodiez
brauliodiez / readme.md
Created June 4, 2017 09:12
javascript currying

Currying

Currying is the act of turning a function into a new function that takes slightly fewer arguments, achieving a slightly more specific task.

http://macr.ae/article/es6-and-currying.html

Steps

Let's start by making a simple function that will sum up two numbers, using currying:

@btroncone
btroncone / rxjs_operators_by_example.md
Last active November 7, 2024 09:19
RxJS 5 Operators By Example
@joyrexus
joyrexus / README.md
Last active November 5, 2024 14:17 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})