Skip to content

Instantly share code, notes, and snippets.

View vhuerta's full-sized avatar
🦖
Working from home

Victor Huerta vhuerta

🦖
Working from home
  • Mexico
View GitHub Profile
let dragons = [];
for(let i = 0; i < 6e6; i++) {
dragons.push({ name: "Json", size: 3 });
dragons.push({ name: "Groovert", size: 1 });
}
dragons.length; //?
// Transformers
const map = (accum, current) => { accum.push(current); return accum; }
@vhuerta
vhuerta / git-config.sh
Created January 23, 2019 16:08
My git config
# bash
git config --global user.name 'Victor Huerta'
git config --global core.editor 'code --wait'
git config --global user.email vhuertahnz@gmail.com
git config --global merge.tool vscode
git config --global mergetool.vscode.cmd 'code --wait $MERGED'
git config --global diff.tool vscode
git config --global difftool.vscode.cmd 'code --wait --diff $LOCAL $REMOTE'
# verify config at git config --global -e
@vhuerta
vhuerta / gist:ee13ec8712a2a0676cd572dc884a8c40
Last active June 19, 2018 20:36 — forked from lttlrck/gist:9628955
Rename git branch, local and remote
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
import axios from 'axios'
const apiUrl = '/rest/'
// allow use http client without Vue instance
export const http = axios.create({
baseURL: apiUrl,
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
@vhuerta
vhuerta / connect_react_router_redux.js
Last active April 27, 2017 05:05
Connect react-router to redux container
import {connect} from 'react-redux';
import Component from 'component-path';
import actions from 'actions-path';
import {withRouter} from 'react-router-dom';
const mapStateToProps = (state, ownProps) => {
return {};
};
@vhuerta
vhuerta / docker.sh
Last active March 29, 2017 04:49
Up and Running Docker on macos
# Install Docker
brew install Caskroom/cask/docker-toolbox
# Create a Docker machine named default
docker-machine create --driver virtualbox default
# Set ENV vars
eval "$(docker-machine env default)"
##
## Setup mongo
##
@vhuerta
vhuerta / mytheme.itermcolors
Last active July 17, 2017 13:08
My iTerm2 Theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.098039217293262482</real>
@vhuerta
vhuerta / victroll.zsh-theme
Last active March 6, 2020 19:58
My personalized prompt
CURRENT_BG='NONE'
SEGMENT_SEPARATOR=''
collapse_pwd() {
echo $(pwd | sed -e "s,^$HOME,~," | sed "s@\(.\)[^/]*/@\1/@g")
}
prompt_segment() {
local bg fg
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
@vhuerta
vhuerta / restart_bluetooth.sh
Created October 4, 2016 20:03 — forked from nicolasembleton/restart_bluetooth.sh
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
@vhuerta
vhuerta / . jsbeautifyrc
Created August 28, 2016 17:03
Custom beautify configuration for atom
{
"indent_size": 4,
"indent_char": " ",
"other": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 1,
"jslint_happy": true,
"html": {