Skip to content

Instantly share code, notes, and snippets.

View International's full-sized avatar
🪲
Debugging

George Opritescu International

🪲
Debugging
View GitHub Profile

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

#!/bin/bash
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:keithw/mosh
sudo apt-get update
sudo apt-get -y install mosh
mkdir -p .config/nvim
curl -L https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage > /tmp/nvim.appimage
sudo mv /tmp/nvim.appimage /usr/bin/nvim
chmod +x /usr/bin/nvim
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
set nocompatible
set exrc
set showbreak=>\ \ \
" set rtp+=~/.vim/bundle/Vundle.vim/
set rtp+=/usr/local/opt/fzf
call plug#begin('~/.vim/plugged')

Keybase proof

I hereby claim:

  • I am international on github.
  • I am geop (https://keybase.io/geop) on keybase.
  • I have a public key ASAOEA9l_PrYrM5fEDzusoKpx7ZuSCQhCHiG7aVz2uEzogo

To claim this, I am signing this object:

@International
International / rubocop_installer.rb
Last active October 4, 2019 12:51
rubocop_installer.rb
lines = File.readlines('Gemfile.lock').grep(/rubocop/i)
pattern = /rubocop \((.*?)\)/
act_rubocop = lines.find{ |e| e =~ pattern }
rubocop_version = act_rubocop[pattern, 1]
installed_ones = {}
abort("Failed to install rubocop: #{rubocop_version}") unless system("gem install rubocop -v #{rubocop_version}")
lines.reject{|e| e == act_rubocop}.reject{|e| e =~ /rubocop \(/}.select{|e| e.index('(')}.each do |other|
gem_name, version = other.split(/\s+/).reject(&:empty?)
@International
International / rails_webpacker_bootstrap_expose_jquery.md
Created November 27, 2018 21:43 — forked from andyyou/rails_webpacker_bootstrap_expose_jquery.md
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collect all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
@International
International / alias_matchers.md
Created October 11, 2018 14:06 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@International
International / install_go_pi.sh
Created August 30, 2018 18:11 — forked from random-robbie/install_go_pi.sh
Install Go Lang 1.10.1 on Raspberry Pi 3
wget https://storage.googleapis.com/golang/go1.10.1.linux-armv6l.tar.gz
sudo tar -C /usr/local -xvf go1.10.1.linux-armv6l.tar.gz
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
@International
International / bucket_sync_service.rb
Created April 27, 2018 17:58 — forked from bantic/bucket_sync_service.rb
ruby class to copy from one aws s3 bucket to another
require 'aws/s3' # gem name is 'aws-sdk'
class BucketSyncService
attr_reader :from_bucket, :to_bucket, :logger
attr_accessor :debug
DEFAULT_ACL = :public_read
# from_credentials and to_credentials are both hashes with these keys:
# * :aws_access_key_id
defmodule MyApp.Auth do
import Comeonin.Bcrypt, only: [checkpw: 2, dummy_checkpw: 0]
alias MyApp.Accounts.User
alias MyApp.Repo
def login(conn, user) do
conn
|> Guardian.Plug.sign_in(user)
end