See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
/* Using a JavaScript proxy for a super low code REST client */ | |
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg | |
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3 | |
// also see https://github.com/fastify/manifetch | |
// also see https://github.com/flash-oss/allserver | |
// and https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb | |
const createApi = (url) => { | |
return new Proxy({}, { | |
get(target, key) { |
<%%= form_with(model: <%= model_resource_name %>, local: true) do |form| %> | |
<div class="card mb-4"> | |
<div class="card-body"> | |
<%% if <%= singular_table_name %>.errors.any? %> | |
<div id="error_explanation" class="alert alert-danger"> | |
<h2 class="h4"><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2> | |
<ul> | |
<%% <%= singular_table_name %>.errors.full_messages.each do |message| %> | |
<li><%%= message %></li> |
#!/usr/bin/env node | |
const { exec } = require('child_process'); | |
exec('code --list-extensions', (err, stdout) => { | |
if (err) console.log('Error occurred', err); | |
const extensions = stdout.split('\n').filter(extension => extension); | |
console.log(`\n✅ Installed VS Code Extensions: ${extensions.length} \n`); |
# Example Request | |
# My Devise model is named Merchant | |
# Key lines to note are 16, 21, 27, 28, 29 | |
require 'rails_helper' | |
RSpec.describe 'POST /api/v2/customer_groups', type: :request do | |
let(:merchant) { FactoryGirl.create(:merchant) } | |
let(:user) { FactoryGirl.create(:user) } | |
let(:customer) { merchant.customers.create(user_id: user.id)} | |
let(:params) {{ |
node_modules | |
dist/ | |
yarn.lock | |
wwwroot |
How to get auto-deploy working from Gitlab to your Digital Ocean (DO) server.
Install https://github.com/olipo186/Git-Auto-Deploy (via apt-get):
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:olipo186/git-auto-deploy
sudo apt-get update
sudo apt-get install git-auto-deploy
Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.
You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.
set nocompatible " Disable vi-compatibility | |
set t_Co=256 | |
colorscheme xoria256 | |
set guifont=menlo\ for\ powerline:h16 | |
set guioptions-=T " Removes top toolbar | |
set guioptions-=r " Removes right hand scroll bar | |
set go-=L " Removes left hand scroll bar | |
set linespace=15 |
What this guide will cover: the code you will need in order to include Redis and Resque in your Rails app, and the process of creating a background job with Resque.
What this guide will not cover: installing Ruby, Rails, or Redis.
Note: As of this writing I am still using Ruby 1.9.3p374, Rails 3.2.13, Redis 2.6.11, and Resque 1.24.1. I use SQLite in development and Postgres in production.
Background jobs are frustrating if you've never dealt with them before. Over the past few weeks I've had to incorporate Redis and Resque into my projects in various ways and every bit of progress I made was very painful. There are many 'gotchas' when it comes to background workers, and documentation tends to be outdated or scattered at best.