Skip to content

Instantly share code, notes, and snippets.

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

Vinícius R. Vieira vinnycrazzy

🏠
Working from home
View GitHub Profile
@vinnycrazzy
vinnycrazzy / cloudSettings
Last active August 11, 2021 16:44
VSCODE
{"lastUpload":"2021-08-11T16:44:44.643Z","extensionVersion":"v3.4.3"}
@vinnycrazzy
vinnycrazzy / __readme.md
Created August 12, 2021 01:30 — forked from maxivak/__readme.md
Tree with ancestry. Rails

Contents:

  • show full path for the item
  • show tree in ol li
  • show tree in dropdown select

Show full path for item

  • one item
Note: this assumes you are using ZSH shell.
## Installation
Install [asdf](https://github.com/asdf-vm/asdf):
```
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.4.0
$ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zshrc
$ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.zshrc
@vinnycrazzy
vinnycrazzy / pg_gem_installation_error_and_solution.txt
Created August 14, 2021 01:48 — forked from vishaltelangre/pg_gem_installation_error_and_solution.txt
pg (postgresql) gem installation error and solution [ubuntu 12.04]
ERROR
=======
$ gem install pg -v '0.17.0'
Building native extensions. This could take a while...
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/home/vishal/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for pg_config... yes
@vinnycrazzy
vinnycrazzy / alias_controller.js
Created August 15, 2021 12:43 — forked from kaspermeyer/alias_controller.js
Stimulus controller to alias other Stimulus controllers
import { Controller } from "stimulus";
export default class extends Controller {
initialize() {
this.registerAliasedControllers()
}
registerAliasedControllers() {
for (let [alias, original] of this.controllerIdentifiersByAlias) {
if (!this.moduleForIdentifier(alias)) {
@vinnycrazzy
vinnycrazzy / pgadmin.txt
Created August 18, 2021 21:20 — forked from ismarsantos/pgadmin.txt
Connect PgAdmin4 on WSL2 Ubuntu 20.04.3 LTS
sudo -u postgres psql -c 'SHOW config_file'
sudo nano /etc/postgresql/13/main/postgresql.conf
# uncomment line 59:
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
@vinnycrazzy
vinnycrazzy / dropzone_controller.js
Created August 23, 2021 23:21 — forked from lazaronixon/dropzone_controller.js
Dropzone.js + Stimulus + Active Storage
import { Controller } from "stimulus"
import { DirectUpload } from "@rails/activestorage"
import Dropzone from "dropzone"
import { getMetaValue, findElement, removeElement, insertAfter } from "helpers"
Dropzone.autoDiscover = false
export default class extends Controller {
static targets = [ "input" ]
@vinnycrazzy
vinnycrazzy / toggleFullscreen.js
Created September 6, 2021 19:04 — forked from demonixis/toggleFullscreen.js
A simple function to toggle fullscreen in JavaScript. It work well on Firefox and Webkit browsers.
/**
* Toggle fullscreen function who work with webkit and firefox.
* @function toggleFullscreen
* @param {Object} event
*/
function toggleFullscreen(event) {
var element = document.body;
if (event instanceof HTMLElement) {
element = event;
@vinnycrazzy
vinnycrazzy / rails http status codes
Created September 13, 2021 18:33 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@vinnycrazzy
vinnycrazzy / youtubeID.rb
Created April 14, 2022 20:56 — forked from eduardinni/youtubeID.rb
Get YouTube ID from various YouTube URL using Ruby
# Get YouTube ID from various YouTube URL
# Ruby port from JavaScript version: https://gist.github.com/takien/4077195/
def get_youtube_id(url)
id = ''
url = url.gsub(/(>|<)/i,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/)
if url[2] != nil
id = url[2].split(/[^0-9a-z_\-]/i)
id = id[0];
else