Skip to content

Instantly share code, notes, and snippets.

David Rivera jherax

Block or report user

Report or block jherax

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jherax
jherax / Git commit editior
Created Mar 20, 2019 — forked from S3ak/Git commit editior
How to set git commit editor to sublime
View Git commit editior
Method 1
git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w"
Method 2
git config --global core.editor "subl -n -w"
Method 3
$ echo 'alias subl="/cygdrive/c/Program\ Files/Sublime\ Text\ 3/sublime_text.exe"' >> ~/.bashrc
@jherax
jherax / App.js
Created Feb 18, 2019 — forked from koistya/App.js
How to add `onscroll` event in ReactJS component
View App.js
import React from 'react';
let lastScrollY = 0;
let ticking = false;
class App extends React.Component {
componentDidMount() {
window.addEventListener('scroll', this.handleScroll);
}
@jherax
jherax / README.md
Last active Sep 6, 2019
Debugging with VS Code
View README.md

VS Code: Debugging

Sometimes, debugging with console.log is not enough to find out what is happening in the code, as console.log prints only plain objects but neither functions nor objects with circular references. Besides, it's possible you may need to know the context and flow of the code.

The way we usually debug JavaScript code, is through a web browser and typing the keyword debugger or console.log in our files. But switching between the browser and the editor to make changes can be annoying.

@jherax
jherax / CLI.md
Last active Sep 6, 2019
Debugging Jest
View CLI.md

CLI Arguments

Node:

  • --nolazy force Node’s V8 engine to compile your code ahead of time, so that breakpoints work correctly.
  • --inspect-brk enable Node’s inspector agent which will allow you to connect a debugger.

Jest:

  • --runInBand run test in the same process. Normally Jest parallelizes test runs across
@jherax
jherax / index.html
Created Jan 8, 2019
Disable auto-zoom in input elements - For Safari, iPhone
View index.html
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no" />
@jherax
jherax / git-ssh-auth-win-setup.md
Last active Dec 26, 2018 — forked from bsara/git-ssh-auth-win-setup.md
Setup SSH Authentication for Git Bash on Windows
View git-ssh-auth-win-setup.md

Setup SSH Authentication for Git Bash on Windows

Prepararation

  1. Create a folder at the root of your user home folder (Example: C:/Users/uname/) called .ssh.
    You can run something like: mkdir -p ~/.ssh
  2. Create the following files if they do not already exist (paths begin from the root of your user home folder):
@jherax
jherax / README.md
Last active Sep 9, 2019
Git Alias and Rebase
View README.md

Git Alias and Git Rebase

WHEN TO DO REBASE

After each commit in our branch, in order to be up-to-date with the integration branch.

@jherax
jherax / subl
Created Mar 14, 2018 — forked from cmalard/subl
Cygwin + Sublime Text 3 : works with files and Git
View subl
#!/bin/bash
# To create in [.babun/]cygwin/usr/local/bin/subl with chmod +x
ARGS=""
while test $# -gt 0
do
ARGS="$ARGS ${1#/cygdrive/[a-zA-Z]}"; # Remove /cygdrive and disk letter from the path
shift
done
@jherax
jherax / toUrlParams.js
Last active May 30, 2019
Builds the url query parameters from an object
View toUrlParams.js
const isObject = (it) => it != null && typeof it === 'object';
/**
* Encodes an object to be used as query-string.
* It uses 'encodeURIComponent' to set each value.
*
* @param {object} data an object with key-value pairs to create the query-string
* @returns {string} the query-string
*/
function toUrlParams(data) {
@jherax
jherax / memoize.js
Last active Feb 6, 2019
High-order function that memoizes a function
View memoize.js
/**
* @summary
* High-order function that memoizes a function, by creating a scope
* to store the result of each function call, returning the cached
* result when the same inputs is given.
*
* @description
* Memoization is an optimization technique used primarily to speed up
* functions by storing the results of expensive function calls, and returning
* the cached result when the same inputs occur again.
You can’t perform that action at this time.