Skip to content

Instantly share code, notes, and snippets.


Pablo Orellana holamendi

  • Prague, Czech Republic
View GitHub Profile
andrewmcodes / Gemfile
Created Jul 11, 2020
HEY's Gemfile annotated with annotate_gem
View Gemfile
# Generated with
ruby '2.7.1'
# Full-stack web application framework. (
gem 'rails', github: 'rails/rails'
# Timezone Data for TZInfo (
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# ==== Action Text ====
hiteshkr / Graylog02DarkTheme.css
Last active Oct 18, 2020
CSS for Dark theme for Graylog 02
View Graylog02DarkTheme.css
@-moz-document url-prefix("https://graylog"), url-prefix("") {
body {
background-color: black;
color: #999;
h1, h2, h3, h4, h5, h6 {
color: #ddd;
svg {
background-color: #666;
View add_order_units.rb
order_code = 'ABCXXX'
variant_id = 123
variant_units = 3 # unidades a agregar
# encuentra pedido existente
order = shop.order(id: order_code) # si no existe, creamos una nueva
# construimos un array de line_items
# a partir de los items del pedido existente
# si es que la variante que queremos agregar
matiasleidemer / paginate.rb
Last active Jan 8, 2018 — forked from be9/paginate.rb
kaminari + JSON API pagination helper
View paginate.rb
def paginate(scope, default_per_page = 20)
collection =[:page]).per((params[:per_page] || default_per_page).to_i)
current, total, per_page = collection.current_page, collection.total_pages, collection.limit_value
render json: [{
pagination: {
current: current,
previous: (current > 1 ? (current - 1) : nil),
next: (current == total ? nil : (current + 1)),
javan /
Last active Mar 19, 2019
Active Storage direct uploads
mankind / rails-jsonb-queries
Last active Feb 16, 2021
Rails-5 postgresql-9.6 jsonb queries
View rails-jsonb-queries
#payload: [{"kind"=>"person"}]
Segment.where("payload @> ?", [{kind: "person"}].to_json)
#data: {"interest"=>["music", "movies", "programming"]}
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json)
Segment.where("data #>> '{interest, 1}' = 'movies' ")
Segment.where("jsonb_array_length(data->'interest') > 1")
henrik /
Last active Dec 24, 2020
Notes from running Dokku on Digital Ocean.

My notes for Dokku on Digital Ocean.

These may be a bit outdated: Since I originally wrote them, I've reinstalled on a newer Dokku and may not have updated every section below.


Install dokku-cli (gem install dokku-cli) for a more Heroku-like CLI experience (dokku config:set FOO=bar).

# List/run commands when not on Dokku server (assuming a "henroku" ~/.ssh/config alias)
ssh henroku dokku
colszowka / dns_check.rb
Last active Jan 25, 2021
Ruby DNS Check
View dns_check.rb
require 'resolv'
class DnsCheck
attr_reader :host
def initialize(host)
@host = host
def a
@a ||=, Resolv::DNS::Resource::IN::A)
View gist:dc53d8d7034512a995bc

Integrating TinyMCE in an ember-cli app

TinyMCE is a javascript WYSIWYG editor that is highly configurable and has a ton of features and plugins. It integrates with jQuery and, with a bit of work, it can be integrated in your ember-cli app.

Step 1: Install TinyMCE:

bower install --save tinymce

Step 2: Import the required files into your app via broccoli. In order to do that you will need a plugin called broccoli-static-compiler:

lopezjurip / gist:a817e96ec833e7667274
Last active Jun 9, 2020
View gist:a817e96ec833e7667274
# Based on:
# Add to gemfile:
ruby '2.1.2'
gem 'pg'
gem 'puma'
gem 'rails_12factor'
gem 'searchkick'
gem 'typhoeus'