Skip to content

Instantly share code, notes, and snippets.

@lesm
lesm / list_properties.rb
Created January 22, 2025 05:32
EasyBroker API
# frozen_string_literal: true
require 'debug'
require 'faraday'
require 'rspec'
############## Entities ###############################################
class Property
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
======== .-----. ========
======== .----------------------. | === | ========
======== |.-""""""""""""""""""-.| |-----| ========
======== || || | === | ========
======== || KICKSTART.NVIM || |-----| ========
@lesm
lesm / payouts
Last active January 22, 2025 05:29
# create user (password)
password = Services::PasswordDigester.new.digest('password')
hash = Entities::User.new(id: SecureRandom.uuid, public_key: 'd3a13bdf38bec706dbf5fe45', secret_key: password, created_at: Time.now, updated_at: Time.now).to_h
Services::Persistence::Repos::UserRepo.new.create(hash)
Agregar logger a la aplicación
#transmission_id = 'e8d9a710-7af0-11eb-b682-5329c90f1393'
@lesm
lesm / uniqness
Last active February 1, 2018 19:38
it { should validate_presence_of :name }
context 'uniqness' do
subject { build(:marca) }
it { should validate_uniqueness_of :sku }
end
FactoryGirl.define do
@lesm
lesm / digital_ocean_setup.md
Created January 19, 2018 18:25 — forked from ChuckJHardy/digital_ocean_setup.md
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions
dataCatalogo = (catalogo) ->
$.getJSON(
url: 'catalogo'
global: false
async: false
data: {catalogo: catalogo}
success: (data) ->
return data
error: (data) ->
console.log 'error', data
= sanitize(text, :tags=>[]).truncate(30, :separator => " ").html_safe
= truncate(strip_tags(post.content), length: 100, omission: '...')
= raw @post.description
@lesm
lesm / web-fonts-asset-pipeline.md
Created April 18, 2017 02:35 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

@lesm
lesm / update_multiple_git_repositories.sh
Created March 16, 2017 10:03 — forked from apux/update_multiple_git_repositories.sh
Update multiple git repositories
#!/bin/sh
dirs=`ls -1d */`
for d in $dirs
do
echo $d
echo '======================'
IFS=$'\n' lines=($(cd $d; git pull))
for l in $lines
do
echo $l
psql -U rails -d name_database -f ./file.sql -h localhost
scp user:domain:/path/file .
ssh-add
BRANCH_NAME=my_branch cap staging deploy
git reset --hard origin/master
CREATE EXTENSION unaccent;
Host *
ServerAliveInterval 60
:new-session -s name -c "/home/silva/..."