Skip to content

Instantly share code, notes, and snippets.

Vinney Cavallo vcavallo

Block or report user

Report or block vcavallo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vcavallo
vcavallo / notes.md
Last active Feb 24, 2019
rails + webpacker + webpack-dev-server + vue + remote dev vps and nginx
View notes.md

Process goes something like this:

bundle update webpacker
rails webpacker:binstubs
yarn upgrade @rails/webpacker@4.0.0-pre.2 # or 'add' instead of upgrade
yarn upgrade webpack-dev-server@"'3.1.4'  # or 'add' instead of upgrade
yarn add webpack-cli

bundle exec rails webpacker:install # don't do this! the scrpit seems to overwrite the @rails/webpacker version to 3.5.3
@vcavallo
vcavallo / explanation.md
Created Jun 14, 2018
remote dev VPS webpack-dev-server nginx setup
View explanation.md

Remote Dev machine webpack-dev-server HMR + static serving combo

Make sure you have port 8080 (or whatever you use) open on the remote machine!! Don't be like Vinney.

I'm no webpack expert (in fact this is the first project I've set up by hand ever...), but if you know what you're doing you should be able to change the relevant parts of this to fit your project:

# webpack.config.js

module.exports = {
@joeybeninghove
joeybeninghove / .postcssrc.yml
Created Feb 15, 2018
Tailwind with Rails and Webpacker
View .postcssrc.yml
plugins:
postcss-import: {}
postcss-cssnext: {}
tailwindcss: "./app/javascript/src/tailwind.js"
@manasthakur
manasthakur / grepping.md
Last active May 1, 2019
Vim: Creating your own ack.vim/ag.vim
View grepping.md

Creating your own ag.vim

Vim provides built-in mechanisms to search through projects in the form of the grep command. However, on large projects, grep is known to be slow; and hence people have been switching to simpler searchers like ack, and faster, parallel (metal?) searchers like ag and pt. Correspondingly, several plugins have been created that integrate these tools in vim: ack.vim, ag.vim, etc.

However, it's actually very easy to get the functionalities these plugins provide (faster search, results in quickfix-window, jumps, previews, and so on) in vanilla Vim itself; in fact, Vim already populates the grep-search results in a quickfix window. We just need to tell Vim to do the following things (use-case: ag):

  • Use ag as the default grep program
  • Open quickfix window by default
  • Create mappin
@Integralist
Integralist / The Perfect Developer Qualities.md
Last active Sep 24, 2018
The Perfect Developer Qualities
View The Perfect Developer Qualities.md

For me the perfect developer (if there is such a person) has these qualities:

  • Friendly: is respected and liked by all they work with and are always approachable (even in times of stress)
  • Humble: has great humilty and is not driven by ego
  • Calm: doesn't get emotive within discussions (including discussions that are both in their favour and those that aren't)
  • Understanding: appreciates that business requirements do change regularly and that there are no perfect scenarios; so is able to adapt to problematic situations in the appropriate manner
  • Agile: recognises when they are potentially moving down a rabbit hole/time sink/yak shave and will successfully re-evaluate the situation and refocus their attention
  • Patient: appreciates that no dev is born equal and so varying soft/practical skills will be encountered
  • Experienced: has a wide ranging skill set with relevant practical experience and most importantly realises the fundamentals of simple code design and recognised patt
@zulhfreelancer
zulhfreelancer / heroku_pg_db_reset.md
Last active Oct 17, 2019
How to reset PG Database on Heroku?
View heroku_pg_db_reset.md

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

heroku restart; heroku pg:reset DATABASE --confirm APP-NAME; heroku run rake db:migrate

@derblub
derblub / spotify.nowplaying.sh
Last active Aug 2, 2019
Get playback status from Spotify via DBus
View spotify.nowplaying.sh
#!/bin/bash
# if spotify is started
if [ "$(pidof spotify)" ]; then
# status can be: Playing, Paused or Stopped
status=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus'|egrep -A 1 "string"|cut -b 26-|cut -d '"' -f 1|egrep -v ^$`
artist=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 2 "artist"|egrep -v "artist"|egrep -v "array"|cut -b 27-|cut -d '"' -f 1|egrep -v ^$`
album=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata'|egrep -A 1 "album"|egrep -v "album"|cut -b 44-|cut -d '"' -f 1|egrep -v ^$`
title=`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 o
@szydan
szydan / gist:b225749445b3602083ed
Last active Oct 18, 2019
<U+FEFF> character showing up in files. How to remove them?
View gist:b225749445b3602083ed
1) In your terminal, open the file using vim:
vim file_name
2) Remove all BOM characters:
:set nobomb
3) Save the file:
:wq
@zdk
zdk / version.rake
Last active Apr 14, 2017
Rake task for Git based Rails app semantic versioning.
View version.rake
#gem 'colorize'
module Version
VERSION_FILE = "#{Rails.root}/config/initializers/version.rb"
PATTERN = /(\d+)\.(\d+)\.(\d+)-(.*)/
PATTERN_NOMETA = /(\d+\.\d+\.\d+)/
@@major = 0; @@minor = 0; @@patch = 0; @@build = 'a'
@@version_rb = File.read(VERSION_FILE)
def self.version_rb
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active Oct 19, 2019
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew
View fix-homebrew-npm.md

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

You can’t perform that action at this time.