Skip to content

Instantly share code, notes, and snippets.

View ricvillagrana's full-sized avatar
🏠

Ricardo Villagrana ricvillagrana

🏠
View GitHub Profile
@DavidWells
DavidWells / javascript-proxy-as-rest-client.js
Last active May 12, 2024 14:24
Using a javascript proxy as low code REST client
/* 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) {
@ali-sheiba
ali-sheiba / _form.html.erb
Last active August 12, 2023 15:22
Rails scaffold with Bootstrap 4
<div class="page-header">
<div class="row">
<div class="col">
<%%= link_to "All <%= plural_table_name.capitalize %>", <%= index_helper %>_path, class: 'btn btn-default' %>
</div>
<div class="col text-right">
<%%= link_to "Edit", edit_<%= singular_table_name %>_path(@<%= singular_table_name %>), class: 'btn btn-primary' %>
</div>
</div>
<h1>Show <%= singular_table_name %></h1>
@gokulkrishh
gokulkrishh / index.js
Last active December 10, 2021 20:17
List the visual studio code installed extensions (https://git.io/installed-vscode-extenstions)
#!/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`);
@niinyarko
niinyarko / create_spec.rb
Last active November 16, 2021 19:03
Request Spec Example for Devise Token Auth Gem with Rails 5.1
# 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) {{
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 24, 2024 16:11
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@iffy
iffy / .gitignore
Last active April 17, 2024 07:19
Example using electron-updater with `generic` provider.
node_modules
dist/
yarn.lock
wwwroot
@montrealist
montrealist / deploy-to-digital-ocean.markdown
Last active January 7, 2024 11:57
How to deploy files to Digital Ocean when pushing to Gitlab

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
@noelboss
noelboss / git-deployment.md
Last active May 16, 2024 20:41
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

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.

@JeffreyWay
JeffreyWay / .vimrc
Last active January 22, 2024 11:42
My .vimrc file
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
@Diasporism
Diasporism / redis_and_resque.mkd
Last active March 13, 2024 08:37
How to configure Redis and Resque for your Rails app.

Redis and Resque

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.