Skip to content

Instantly share code, notes, and snippets.

View vcavallo's full-sized avatar

Vinney Cavallo ~sogrum-savluc vcavallo

View GitHub Profile
@vcavallo
vcavallo / vim-centerpane
Last active October 19, 2017 03:19
vimscript function to center a lone pane in the window
" 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 August 25, 2020 09:01
rails + webpacker + webpack-dev-server + vue + remote dev vps and nginx

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 / version.rake
Created December 6, 2016 19:49 — forked from muxcmux/version.rake
Manage your rails app version with this rake task
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 / explanation.md
Created June 14, 2018 19:30
remote dev VPS webpack-dev-server nginx setup

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 = {