Skip to content

Instantly share code, notes, and snippets.

View tonymtz's full-sized avatar
💻
Working From a Cafe

tonymtz tonymtz

💻
Working From a Cafe
View GitHub Profile
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active May 7, 2024 13:07
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
sudo apt install postgresql-9.4
@tonymtz
tonymtz / default.conf
Created March 4, 2018 07:37
Nginx configuration for HTML5 routing
server {
listen 80 default_server;
listen [::]:80 default_server;
root /your/root/path;
index index.html;
server_name you.server.com;
@tonymtz
tonymtz / gist:714e73ccb79e21c4fc9c
Created November 15, 2014 00:02
Uninstall XQuartz.app from OSX Yosemite
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
# Log out and log in
@tonymtz
tonymtz / class-based vs functional components.jsx
Created June 1, 2020 23:19
class-based vs functional components
// class-based component
class Text extends React.Component {
render() {
return <span>{this.props.children}</span>
}
}
// functional component
const Text = props => {
return <span>{props.children}</span>;
@tonymtz
tonymtz / composition over inheritance code example.jsx
Created June 1, 2020 23:16
Composition over inheritance code example
// Ugly way
const Text = () => {
// ... some implementation ...
}
class H1 extends Text {
// ... override some implementation ...
}

Goodies:

  1. zsh & oh-my-zsh
  2. zsh-autosuggestion & zsh-syntax-highlighting plugins. Add git and history
  3. docker-ce and docker-compose

Mandatory:

  1. Install rbenv and nodenv
  2. Ruby 2.5.3
  3. Node 12.16.1
  4. Install yarn

Useful scripts for development.

Kill process listening a given port. I.e. 3500.

$ kill $(lsof -t -i :3500)

Aliases for HB.

alias godev='cd ~/workspace/homebase1'
@tonymtz
tonymtz / PlayMusic.cs
Created September 24, 2019 03:34
Unity Audio Manager for Sfx and Music
using UnityEngine;
public class PlayMusic : PlaySfx {
[SerializeField] private bool repeat;
public override void Play() {
soundManagerController.PlaySfx(audioClip, volume);
}
void OnDestroy() {