Skip to content

Instantly share code, notes, and snippets.

View yacafx's full-sized avatar
💭
Coding... 👽👾💻🕹

Sergio Brito yacafx

💭
Coding... 👽👾💻🕹
View GitHub Profile
@timoxley
timoxley / 1.rreaddir.js
Last active August 6, 2023 17:13
async/await recursive fs readdir
import { join } from 'path'
import { readdir, stat } from 'fs-promise'
async function rreaddir (dir, allFiles = []) {
const files = (await readdir(dir)).map(f => join(dir, f))
allFiles.push(...files)
await Promise.all(files.map(async f => (
(await stat(f)).isDirectory() && rreaddir(f, allFiles)
)))
return allFiles
@nrollr
nrollr / MongoDB_macOS_Sierra.md
Last active April 1, 2024 16:23
Install MongoDB on Sierra using Homebrew

Install MongoDB on macOS Sierra

This procedure explains how to install MongoDB using Homebrew on macOS Sierra 10.12.
Official MongoDB install documentation: here

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active January 31, 2024 14:45
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@msmfsd
msmfsd / es7-async-await.js
Last active February 4, 2024 17:38
Javascript fetch JSON with ES7 Async Await
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch
// async function
async function fetchAsync () {
// await response of fetch call
let response = await fetch('https://api.github.com');
// only proceed once promise is resolved
let data = await response.json();
// only proceed once second promise is resolved
@YuMS
YuMS / update-git.sh
Created June 29, 2016 09:28
Update git to latest version on Ubuntu
#!/bin/bash
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y
@HereChen
HereChen / convert-image-to-base64.js
Last active March 29, 2022 11:31
convert image to base64
/**
* version1: convert online image
* @param {String} url
* @param {Function} callback
* @param {String} [outputFormat='image/png']
* @author HaNdTriX
* @example
convertImgToBase64('http://goo.gl/AOxHAL', function(base64Img){
console.log('IMAGE:',base64Img);
})
@spencermefford
spencermefford / 0-model-override.js
Created July 28, 2015 02:51
An alternative to extending Loopback's built in models. In our application, we wanted to create a custom role called "ecm-administrator" that would have the ability to create and manage users.
module.exports = function (app) {
var _ = require('lodash');
var User = app.models.User;
var Role = app.models.Role;
var RoleMapping = app.models.RoleMapping;
var ACL = app.models.ACL;
/*
* Configure ACL's
*/
@vitorbritto
vitorbritto / rm_mysql.md
Last active April 23, 2024 14:21
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

    brew remove mysql
    
@jackgris
jackgris / config.fish
Last active April 13, 2019 13:48
Example of config for fish shell
## Lenguaje Go
set --export GOROOT /usr/local/go
set -gx PATH /usr/local/go/bin $PATH
#set -gx PATH GOROOT/bin $PATH
set --export GOPATH $HOME/GoProjects
set -gx PATH $GOPATH/bin $PATH
## AppEngine para GO
set -gx PATH $HOME/programs/go_appengine $PATH
@geddski
geddski / config.fish
Created October 3, 2014 19:42
useful fish config for git
##----GIT------
alias gs='clear ;and git status'
alias gb='git branch'
alias gbranch='git rev-parse --abbrev-ref HEAD' #get current branch name
alias gl="clear ;and git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias gt='git tag'
alias grm='git rm'
alias gps='git push'
alias gbi='git bisect'
alias gbg='git bisect good'