Skip to content

Instantly share code, notes, and snippets.

View mrbongiolo's full-sized avatar
🚀
Just shiplling

Ralf Schmitz Bongiolo mrbongiolo

🚀
Just shiplling
View GitHub Profile
@mrbongiolo
mrbongiolo / LOKI.md
Last active September 16, 2016 19:25

Settings

Enable Numlock on Login Screen

sudo apt-get install numlockx -y

sudo vim /usr/share/lightdm/lightdm.conf.d/40-pantheon-greeter.conf

# add this line:
@mrbongiolo
mrbongiolo / instructions.md
Last active March 12, 2018 22:13
From Heroku to Digital Ocean (backed by Dokku 0.6.5)

dokku 0.6.5

DO Dashboard

Create a droplet (can be a basic $5 one) and add a SSH key.

On the Browser

Access the droplet ip and finish the basic Dokku setup, basically it's used to setup a domain and add the SSH key to the dokku user.

@mrbongiolo
mrbongiolo / roda.rb
Created May 24, 2016 02:35
Super basic example of Roda + Trailblazer
# This app is an API only, that's why we set :json as response and as params.
# This is the Roda Router.
# This app used roda + hanami model + TRB;
# Those methods `present Ami::V1::Customer::Collection` are calls to the app Operations
# #present and #run are helper methods added to handle the response of an Operation.
# Basically when I `run` and operation and it is successful I'll just call Operation#decorated hash and transform it into JSON;
# If the operation failed then I'll create a json response with status: :unprocessable_entity and call the Operation#error.messages and add it to the json response.
module Ami
module V1
class Routes < Roda
@mrbongiolo
mrbongiolo / manageable_time_range.rb
Last active June 17, 2016 18:23
A horrendous approach to "manage" Time Ranges in ruby.
class ManageableTimeRange < Range
def <=>(other)
leg_min(other)
end
def leg_min(other)
return -1 if self.min < other.min
return 0 if self.min == other.min
return 1
@mrbongiolo
mrbongiolo / FREYA.md
Last active October 25, 2017 11:09
Elementary OS Configs

Settings

Enable Numlock on Login Screen

sudo apt-get install numlockx -y

sudo vim /usr/share/lightdm/lightdm.conf.d/40-pantheon-greeter.conf

# add this line:
@mrbongiolo
mrbongiolo / Gemfile
Created October 22, 2015 17:33
Rack + Lotus Router + Trailblazer
source 'https://rubygems.org'
ruby "2.2.3"
gem 'rack'
gem 'lotus-router'
gem 'lotus-validations'
gem 'trailblazer'
gem 'roar'
gem 'multi_json'
@mrbongiolo
mrbongiolo / _decorator_style.md
Last active October 12, 2015 22:11
Trailblazer Operation usecase using a Decorator instead of the Representer.
@mrbongiolo
mrbongiolo / decorator.rb
Created October 8, 2015 20:58
A Decorator module for Trailblazer, basically it's just a copy of the Representer module, but it only adds the rendering methods.
# Including this will change the way the Operation renders the contract
#
# TODO: so far, we only support JSON, but it's two lines to change to support any kind of format.
module Trailblazer::Operation::Decorator
def self.included(base)
base.inheritable_attr :_decorator_class
base.extend ClassMethods
end
module ClassMethods
@mrbongiolo
mrbongiolo / 00steps.md
Last active January 12, 2017 03:02
Windows Development Environment
@mrbongiolo
mrbongiolo / _tab_relatives.html.erb
Last active August 29, 2015 14:18
React and Rails
<!-- app/views/associates/edit/_tab_relatives.html.erb -->
<!-- The render method is used to get the same data for the resourcesCollection
as I would get if I did a GET request later on to associates/relatives path
TODO: use a Decorator or something like it to fetch this data without the need
to render a view. -->
<%= react_component('RelativesPage', {
resourcesCollectionJSONInitialData: render(
template: 'relatives/index',
formats: :json,
locals: { :@relatives => @associate_relatives }),