Skip to content

Instantly share code, notes, and snippets.

@lucianosousa
lucianosousa / gist:76f0339876263f281146af3dd7dbe80f
Last active Feb 7, 2021
Fixing Symbol not found: _ffi_prep_closure_loc error on OSX Mojave
View gist:76f0339876263f281146af3dd7dbe80f
```
dyld: lazy symbol binding failed: Symbol not found: _ffi_prep_closure_loc
Referenced from: /Users/ls/.gem/ruby/3.0.0/gems/ffi-1.14.2/lib/ffi_c.bundle
Expected in: /usr/lib/libffi.dylib
dyld: Symbol not found: _ffi_prep_closure_loc
Referenced from: /Users/ls/.gem/ruby/3.0.0/gems/ffi-1.14.2/lib/ffi_c.bundle
Expected in: /usr/lib/libffi.dylib
Abort trap: 6
@lucianosousa
lucianosousa / install.sh
Last active Dec 5, 2020
homebrew install without all branches (only master)
View install.sh
#!/bin/bash
set -u
# Check if script is run non-interactively (e.g. CI)
# If it is run non-interactively we should not prompt for passwords.
if [[ ! -t 0 || -n "${CI-}" ]]; then
NONINTERACTIVE=1
fi
# First check if the OS is Linux.
View gist:eb5ce7f341796151fa4559702f33fad1
autocmd BufWritePre * :%s/\s\+$//e
" Auto reload file
au FocusGained,BufEnter * :checktime
let mapleader=","
" Fzf mapping replacing ControlP command
nnoremap <C-p> :Files<Cr>
" Fzf mapping for find in files
View gist:318489e44a5e36af799566c41ac93366
autocmd BufWritePre * :%s/\s\+$//e
color desert
let mapleader=","
" Fzf mapping replacing ControlP command
nnoremap <C-p> :Files<Cr>
" Fzf mapping for find in files
nnoremap <C-g> :Rg<Cr>
@lucianosousa
lucianosousa / events_helper.rb
Created Aug 22, 2019
sorbet or not sorbet?
View events_helper.rb
# Old file start
module EventsHelper
def user_is_owner?(model)
user_signed_in? && model.user == current_user
end
end
# Old file end
View gist:9f46346e5858a3efabf9
$ lein repl
Mar 18, 2016 7:24:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://repo1.maven.org:443: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
Mar 18, 2016 7:24:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://repo1.maven.org:443
Mar 18, 2016 7:24:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {s}->https://repo1.maven.org:443: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext)
Mar 18, 2016 7:24:39 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://repo1.maven.org:443
Mar 18, 2016 7:24:39 PM org.
View gist:00ca3aebb254395eb0dc
function OffersController($scope, $sce) {
activate();
function activate() {
$('.selectpicker').selectpicker({
style: 'btn-info',
size: 4
});
}
}
View benchmark1.rb
require 'active_support'
require 'active_record'
require 'benchmark/ips'
ActiveRecord::Base.establish_connection(
adapter: 'mysql2',
encoding: 'utf8',
reconnect: true,
pool: 25,
host: 'localhost',
@lucianosousa
lucianosousa / benchmark2.rb
Last active Jan 15, 2016
Second benchmark for AR queries
View benchmark2.rb
require 'active_support'
require 'active_record'
require 'benchmark/ips'
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
ActiveRecord::Base.connection.instance_eval do
create_table(:customers) { |c| c.string :name }
end
class Customer < ActiveRecord::Base; end
View gist:82cd3ed636f6cd6ce918
https://github.com/DamirSvrtan/fasterer
https://github.com/codeclimate/codeclimate
https://github.com/metricfu/metric_fu