Skip to content

Instantly share code, notes, and snippets.

View Joaquin6's full-sized avatar
🏠
Working from home

Joaquin Briceno Joaquin6

🏠
Working from home
  • Overland Park, KS
View GitHub Profile
@Joaquin6
Joaquin6 / connects.js
Last active February 27, 2019 09:49
a background script for chrome extensions to check internet connection
(function(global, conn) {
"use strict";
if (global.document) {
conn(global)
} else {
return;
}
})(typeof window !== "undefined" ? window : this, function(window, noGlobal) {
@Joaquin6
Joaquin6 / reinstall.js
Created January 28, 2019 18:13
File that takes all devDeps and deps from package.json and uninstalls them and reinstalls them. Sometimes this is necessayr to clean out your yarn slate and start fresh.
#!/usr/bin/env node
// normally this file goes in bin/reinstall.js
// called by "reinstall": "node bin/reinstall.js"
const { promisify } = require('util');
const exec = promisify(require('child_process').exec);
const pkg = require('../package.json');
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
@Joaquin6
Joaquin6 / sizeof.js
Created November 9, 2018 16:20
A function to calculate the approximate memory usage of objects
/* Returns the approximate memory usage, in bytes, of the specified object. The
* parameter is:
*
* object - the object whose size should be determined
*/
function sizeof(object){
// initialise the list of objects and size
var objects = [object];
var size = 0;
@Joaquin6
Joaquin6 / memorySizeOfObject.js
Created November 9, 2018 16:03
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@Joaquin6
Joaquin6 / np.sh
Created October 10, 2018 12:13
npm publish with goodies
# npm publish with goodies
# prerequisites:
# `npm install -g trash conventional-recommended-bump conventional-changelog conventional-github-releaser conventional-commits-detector json`
# `np` with optional argument `patch`/`minor`/`major`/`<version>`
# defaults to conventional-recommended-bump
# and optional argument preset `angular`/ `jquery` ...
# defaults to conventional-commits-detector
np() {
travis status --no-interactive &&
trash node_modules &>/dev/null;
@Joaquin6
Joaquin6 / uuid.sh
Created September 11, 2018 23:53
Generate s UUID in Bash
uuid()
{
local N B C='89ab'
for (( N=0; N < 16; ++N ))
do
B=$(( $RANDOM%256 ))
case $N in
6)
@Joaquin6
Joaquin6 / zshrc
Created October 19, 2017 20:21
New zshrc from Mac Machine
# CONFIGURATION VARIABLES
# -------------------------------
PYTHON_VERSION=2.7
RUBY_VERSION=2.4.0
HOME_LIB_PATH=$HOME/Library
SYS_LIB_PATH=/System/Library
SYS_FRWKS_PATH=$SYS_LIB_PATH/Frameworks
USER_BIN=/usr/bin
@Joaquin6
Joaquin6 / zshrc
Created October 11, 2017 07:08
ZSH RC File as of 10/10/2017 with Mac based confiurations
# CONFIGURATION VARIABLES
# -------------------------------
PYTHON_VERSION=2.7
RUBY_VERSION=2.4.0
HOME_LIB_PATH=$HOME/Library
SYS_LIB_PATH=/System/Library
SYS_FRWKS_PATH=$SYS_LIB_PATH/Frameworks
USER_BIN=/usr/bin
@Joaquin6
Joaquin6 / zshrc
Created October 10, 2017 23:06
ZSH RC File as of 10/10/2017, with Windows configs
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=/mnt/c/Windows/System32:$PATH
export PATH=/cygdrive/c/Users/Joaquin/AppData/Local/atom/bin:$PATH
# export MANPATH="/usr/local/man:$MANPATH"
# export POWERLEVEL9K_PROMPT_ON_NEWLINE=true
# export POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh