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 / 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 / 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 / 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 / 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 / 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 / LSI_how_to_build.md
Last active September 14, 2016 16:15
HOW TO build linux-steam-instegration on ElementaryOS Loki

for those noobs like me

git clone [email protected]:solus-project/linux-steam-integration.git
cd linux-steam-integration
./autogen.sh --with-real-steam-binary=/usr/games/steam --enable-frontend
sudo make
sudo checkinstall --pkgname=linux-steam-integration --pkgversion=0.2 --provides=linux-steam-integration
@mrbongiolo
mrbongiolo / swapesc
Created September 24, 2016 22:50 — forked from berkes/swapesc
#!/bin/bash
current=$(dconf read /org/gnome/desktop/input-sources/xkb-options)
swapped="['caps:swapescape']"
capslock="['caps:capslock']"
echo "Current status: $current"
if [ "$current" == "$swapped" ]
then
echo "Making caps and escape WORK NORMALLY"
@mrbongiolo
mrbongiolo / __steps.md
Created April 29, 2017 13:09
Enable docker user namespace on Solus

Steps on how to enable Docker User Namepsace on Solus

  1. Create the subuid file:
sudo nvim /etc/subuid

# content
myusername:1000:1
myusername:100000:65536
@mrbongiolo
mrbongiolo / README.md
Last active November 18, 2019 15:03
coordinators and projects

Cria os scopes lá no model de Coordinator, assim fica mais fácil organizar. PS: não esqueça de testar isso, não tenho certeza se está funcionando corretamente, só escrevi diretamente aqui no gist.

scope :assigned_to_project, ->(id) { left_outer_joins(:project).where(projects: { id: id }) }
scope :without_projects, -> { assigned_to_project(nil) }
scope :without_projects_or_assigned_to_project, ->(id) { without_projects.or(assigned_to_project(id)) }

No teu controller pode fazer algo assim: