Skip to content

Instantly share code, notes, and snippets.

Vinney Cavallo vcavallo

View GitHub Profile
@vcavallo
vcavallo / version.rake
Created Dec 6, 2016 — forked from muxcmux/version.rake
Manage your rails app version with this rake task
View version.rake
def valid? version
pattern = /^\d+\.\d+\.*\d*(\-(dev|beta|rc\d+))?$/
raise "Tried to set invalid version: #{version}".red unless version =~ pattern
end
def correct_version version
ver, flag = version.split '-'
v = ver.split '.'
(0..2).each do |n|
v[n] = v[n].to_i
@vcavallo
vcavallo / vim-centerpane
Last active Oct 19, 2017
vimscript function to center a lone pane in the window
View vim-centerpane
" centers the current pane as the middle 2 of 4 imaginary columns
" should be called in a window with a single pane
function CenterPane()
lefta vnew
wincmd w
exec 'vertical resize '. string(&columns * 0.75)
endfunction
" optionally map it to a key:
@vcavallo
vcavallo / notes.md
Last active Dec 2, 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 = {
You can’t perform that action at this time.