Skip to content

Instantly share code, notes, and snippets.

View sbpipb's full-sized avatar
👋
looking for new opportunities.

Julian Macmang sbpipb

👋
looking for new opportunities.
View GitHub Profile
@sbpipb
sbpipb / learning.rb
Created April 28, 2021 20:28
code dump
# Concurrency and Parallelism
# https://www.toptal.com/ruby/ruby-concurrency-and-parallelism-a-practical-primer
require 'benchmark'
def fib(n)
n < 2 ? n : fib(n-1) + fib(n-2)
end
puts Benchmark.measure {
@sbpipb
sbpipb / benchmarking.rb
Created December 4, 2019 07:38
benchmarking shiz
Benchmark.ips do |bm|
bm.report("spy") { spy(User, id: 1) }
bm.report("double") { double(User, id: 1) }
bm.report("verifying double") { instance_double(User, id: 1) }
bm.report("actual object") { User.new(id: 1) }
bm.report("via factorygirl") { FactoryGirl.build(:user, id: 1) }
bm.compare!
end
@sbpipb
sbpipb / github.md
Last active December 4, 2019 07:40
GITHUB

Shows git commits on all your local branches, sorted oldest to newest

git for-each-ref --sort=committerdate refs/remotes/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'

removing changes from a branch

Git Rebase Onto

git rebase --onto branch_1 old_branch branch_2

@sbpipb
sbpipb / events.js
Created October 5, 2018 07:19
Jekku does Js
// I'll explain it again
```class MyComponent extends React.Component {
myEvent = () => {
console.log('do something')
}
render () {
<button onClick={this.myEvent}> WOW </button>
Rails Asset Pipeline
the basics of how to use the asset pipeline
best practices for structuring where to put your assets
how to use the precompile array to specify what files are processed by the asset pipeline
how Sass and Coffeescript can be leveraged
how to use Rails asset helper methods, and
some gotchas
Short history
Enable Redis to Start at Boot
If all of your tests worked, and you would like to start Redis automatically when your server boots, you can enable the systemd service.
To do so, type:
sudo systemctl enable redis
Output
Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /etc/systemd/system/redis.service.
@sbpipb
sbpipb / gist:407c033b25bac4fb2353bf59807de8c7
Created February 20, 2018 12:42 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@sbpipb
sbpipb / history.html.arb
Created February 19, 2016 04:23
History Page
# app/views/layouts/history.html.arb
panel "Historia" do
table_for assigns[:versions]
end