Skip to content

Instantly share code, notes, and snippets.

View ricvillagrana's full-sized avatar
🏠

Ricardo Villagrana ricvillagrana

🏠
View GitHub Profile
<div x-data="{ open: false, filter: '', selected: <%= @options.select { |option| @form.object.send(@field).any?(option[1]) } %>, options: <%= @options %> }" class="flex flex-col">
<div class="flex flex-row justify-between">
<label for="<%= @field %>">
<%= @label %>
</label>
<button type="button" class="link text-sm" @click="selected = []">
Clear <%= @label.downcase %>
</button>
</div>
@ricvillagrana
ricvillagrana / easy_broker_api.rb
Created March 20, 2023 17:36
EasyBroker Property reader
# frozen_string_literal: true
require 'uri'
require 'net/http'
require 'openssl'
require 'json'
class EasyBrokerApi
BASE_URL = 'https://api.stagingeb.com/v1'
@ricvillagrana
ricvillagrana / javascript-proxy-as-rest-client.js
Created February 8, 2022 17:26 — forked from DavidWells/javascript-proxy-as-rest-client.js
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
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
return async function(id = "") {
const response = await fetch(`${url}/${key}/${id}`)
if (response.ok) {
return response.json();

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

@ricvillagrana
ricvillagrana / deploy-to-digital-ocean.markdown
Created March 22, 2019 21:27 — forked from montrealist/deploy-to-digital-ocean.markdown
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

HackerRank Exercises

Introduction

Hello HackerRank

print "Hello HackerRank!!"

Everything is a Object