Skip to content

Instantly share code, notes, and snippets.

Avatar
🦊

Juan Hernández jhbabon

🦊
View GitHub Profile
@jhbabon
jhbabon / env-vars.ts
Created Sep 18, 2020
A small environment variables parser in TypeScript
View env-vars.ts
import { env } from 'process'
function isNumber(n: unknown): n is number {
if (typeof n !== 'number' || Number.isNaN(n)) {
return false
}
return true
}
@jhbabon
jhbabon / scout-history.zsh
Created Jun 3, 2020
Filter ZSH history with scout
View scout-history.zsh
setopt hist_ignore_all_dups
# based on: https://gist.github.com/dohq/9b97e07c865bb608108dd254b5e32fea
function scout-history() {
BUFFER=$(history -n -r 1 | scout --inline --lines=10 --search="$LBUFFER")
CURSOR=$#BUFFER
zle clear-screen
}
zle -N scout-history
bindkey '^r' scout-history
@jhbabon
jhbabon / vscout.vim
Last active Dec 12, 2018
scout.vim visual selection
View vscout.vim
" see: http://vimcasts.org/episodes/search-for-the-selected-text/
function! s:VScoutSearch(cmdtype)
let temp = @s
norm! gv"sy
let s:selection = @s
let @s = temp
if a:cmdtype == 'files'
call scout#files#run({ 'search': s:selection })
endif
View keybase.md

Keybase proof

I hereby claim:

  • I am jhbabon on github.
  • I am jhbabon (https://keybase.io/jhbabon) on keybase.
  • I have a public key ASAjX5xO3GLE4GUqMipG9mhji5tjhMfAFM9MVfe1ZdTyiAo

To claim this, I am signing this object:

@jhbabon
jhbabon / test.rb
Last active Dec 4, 2015
Visitor pattern (double dispatch) on Ruby
View test.rb
require_relative 'visitor'
require_relative 'visitable'
class Object
include Visitable
end
class Log < Visitor
def visit_Array(array)
puts 'Logging array:'
@jhbabon
jhbabon / 2.2.3-railsexpress
Created Aug 25, 2015
ruby-build recipe for 2.2.3-railsexpress
View 2.2.3-railsexpress
build_package_reconfigure() {
test -f configure || autoconf
}
build_package_patch_ruby_railsexpress() {
fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master
patch -p1 < rvm-patchsets/patches/ruby/2.2.3/railsexpress/01-zero-broken-tests.patch
patch -p1 < rvm-patchsets/patches/ruby/2.2.3/railsexpress/02-improve-gc-stats.patch
patch -p1 < rvm-patchsets/patches/ruby/2.2.3/railsexpress/03-display-more-detailed-stack-trace.patch
@jhbabon
jhbabon / 2.1.6-railsexpress
Created Apr 21, 2015
ruby-build recipe for 2.1.6-railsexpress
View 2.1.6-railsexpress
build_package_reconfigure() {
test -f configure || autoconf
}
build_package_patch_ruby_railsexpress() {
fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master
patch -p1 < rvm-patchsets/patches/ruby/2.1.6/railsexpress/01-zero-broken-tests.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.6/railsexpress/02-improve-gc-stats.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.6/railsexpress/03-display-more-detailed-stack-trace.patch
@jhbabon
jhbabon / 2.1.5-railsexpress
Created Dec 2, 2014
ruby-build recipe for 2.1.5-railsexpress
View 2.1.5-railsexpress
build_package_reconfigure() {
test -f configure || autoconf
}
build_package_patch_ruby_railsexpress() {
fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master
patch -p1 < rvm-patchsets/patches/ruby/2.1.5/railsexpress/01-zero-broken-tests.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.5/railsexpress/02-improve-gc-stats.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.5/railsexpress/03-display-more-detailed-stack-trace.patch
@jhbabon
jhbabon / 2.1.4-railsexpress
Created Nov 13, 2014
ruby-build recipe for 2.1.4-railsexpress
View 2.1.4-railsexpress
build_package_reconfigure() {
test -f configure || autoconf
}
build_package_patch_ruby_railsexpress() {
fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master
patch -p1 < rvm-patchsets/patches/ruby/2.1.4/railsexpress/01-zero-broken-tests.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.4/railsexpress/02-improve-gc-stats.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.4/railsexpress/03-display-more-detailed-stack-trace.patch
@jhbabon
jhbabon / 2.1.3-railsexpress
Last active Aug 29, 2015
ruby-build recipe for 2.1.3-railsexpress
View 2.1.3-railsexpress
build_package_reconfigure() {
test -f configure || autoconf
}
build_package_patch_ruby_railsexpress() {
fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master
patch -p1 < rvm-patchsets/patches/ruby/2.1.3/railsexpress/01-zero-broken-tests.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.3/railsexpress/02-improve-gc-stats.patch
patch -p1 < rvm-patchsets/patches/ruby/2.1.3/railsexpress/03-display-more-detailed-stack-trace.patch
You can’t perform that action at this time.