Skip to content

Instantly share code, notes, and snippets.

View vcavallo's full-sized avatar

Vinney Cavallo ~sogrum-savluc vcavallo

View GitHub Profile
@anderssvendal
anderssvendal / README.md
Created October 29, 2012 10:20
ubuntu + unicorn + sinatra
-- SQL Basic Syntax --
--initialize SQLite database w/ command line:
sqlite3 database_name.db
--helpful commands
.help -- list of commands
.tables -- see all tables
.mode column / .header on -- helpful for viewing
@zdk
zdk / version.rake
Last active April 14, 2017 15:01
Rake task for Git based Rails app semantic versioning.
#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
@Integralist
Integralist / Vim shortcuts for rspec and cucumber tests.vim
Last active May 28, 2018 15:15
Shortcut Vim mappings for running RSpec and Cucumber tests
" Running Tests...
" See also <https://gist.github.com/8114940>
" Run currently open RSpec test file
map <Leader>rf :w<cr>:!rspec % --format nested<cr>
" Run current RSpec test
" RSpec is clever enough to work out test to run if cursor is on any line within the test
map <Leader>rl :w<cr>:exe "!rspec %" . ":" . line(".")<cr>
@joeybeninghove
joeybeninghove / .postcssrc.yml
Created February 15, 2018 02:21
Tailwind with Rails and Webpacker
plugins:
postcss-import: {}
postcss-cssnext: {}
tailwindcss: "./app/javascript/src/tailwind.js"
@christo16
christo16 / Rails State Select
Created December 3, 2010 00:08
Create a select list for US states in Rails
<%= select(:address, :state, [
['Select a State', 'None'],
['Alabama', 'AL'],
['Alaska', 'AK'],
['Arizona', 'AZ'],
['Arkansas', 'AR'],
['California', 'CA'],
['Colorado', 'CO'],
['Connecticut', 'CT'],
['Delaware', 'DE'],
@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 / 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 = {
@Integralist
Integralist / The Perfect Developer Qualities.md
Last active May 8, 2022 05:48
The Perfect Developer Qualities

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
@manasthakur
manasthakur / grepping.md
Last active September 24, 2022 13:30
Vim: Creating your own ack.vim/ag.vim

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