Skip to content

Instantly share code, notes, and snippets.

View bruno-'s full-sized avatar
♦️
Async Ruby enthusiast

Bruno Sutic bruno-

♦️
Async Ruby enthusiast
View GitHub Profile
@bruno-
bruno- / standalone_active_record.rb
Last active August 29, 2015 14:06
Using standalone ActiveRecord is really easy
require "active_record"
require "pg"
# AR connection
ActiveRecord::Base.establish_connection(
adapter: "postgresql",
database: "lynda_test",
username: "<db_username>",
password: "<db_password>",
host: "localhost",
@bruno-
bruno- / example_1.rb
Last active August 29, 2015 14:08
Arel Examples
#--------------
# Basic Example
#--------------
require "./models"
name_variable = "Bill Smith"
# ActiveRecord
puts Customer.where(name: name_variable)
@bruno-
bruno- / gist:2197a0a8e29233174380
Created November 28, 2014 14:22
basic_tmux_conf.txt
# source tmux.conf
bind R source-file ~/.tmux.conf
# tmux defaults: prefix + arrow
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# tmux defaults:
@bruno-
bruno- / gist:171bd1a70b5a6a574ddc
Created November 28, 2014 14:24
basic_tmux_conf_with_plugins.txt
# https://github.com/tmux-plugins/tpm
# install TPM:
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-pain-control \
tmux-plugins/tmux-sessionist \
'
set -g @almost-sensible 'on'
@bruno-
bruno- / 1.exp
Last active August 29, 2015 14:14
The venerable "expect" - scripts
#!/usr/bin/expect
# start ssh process
spawn ssh root@expect
# expect this string on the screen
expect "password"
# type this to the screen
send "foobar123\r"
Vim Development
===============
Vim source code repository is on hosted on Github:
https://github.com/vim/vim
Apart from Github, development also happens on the vim-dev maillist with people
contributing patches via email. Subscribe if you want to get involved, see
[here](maillist.php#vim-dev).

Rubocop

Installation & usage

$ gem install rubocop

  • usage $ rubocop #=> bunch of errors (1000's maybe)
@bruno-
bruno- / keybase.md
Last active September 28, 2015 16:47

Keybase proof

I hereby claim:

  • I am bruno- on github.
  • I am bruno_ (https://keybase.io/bruno_) on keybase.
  • I have a public key whose fingerprint is C464 17C1 4F7B D54E A082 7090 CAFA 7B1B 2914 ED81

To claim this, I am signing this object:

class SmsNotifier
# We want to reuse code from this class,
# and we try to do that by using inheritance.
def notify!
# texting magic happens here
end
end
class ReportGenerator < SmsNotifier
@bruno-
bruno- / gist:eddd6298deaa4940c52c
Created August 13, 2014 19:05
signing git commits - cheat sheet

Article: http://mikegerwitz.com/papers/git-horror-story

Theory

  • faking other user's commits is easy with --author flag $ git commit --author='Foo Bar <foo@bar.com>' -m 'some commit'

  • signing commits ensures:

    • someone else can't commit as myself
  • I really commited all the commits I sign