Skip to content

Instantly share code, notes, and snippets.

View bit-dragon's full-sized avatar
🏠
Working from home

Jorge García bit-dragon

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am bit-dragon on github.
  • I am bdragon (https://keybase.io/bdragon) on keybase.
  • I have a public key ASCW0NM7AnTzYqHAgTrC0cFncIk-_cFjsJr0GDfRe1rRSQo

To claim this, I am signing this object:

@bit-dragon
bit-dragon / keybase.md
Created November 9, 2020 20:52
keybase

Keybase proof

I hereby claim:

  • I am bit-dragon on github.
  • I am bdragon (https://keybase.io/bdragon) on keybase.
  • I have a public key ASCW0NM7AnTzYqHAgTrC0cFncIk-_cFjsJr0GDfRe1rRSQo

To claim this, I am signing this object:

@bit-dragon
bit-dragon / mp1.rb
Last active December 11, 2015 04:58
Meta-programming examples
# Memoization
# Example number one
# Original class
#class Discounter
# def discount(*skus)
# expensive_discount_calculation(*skus)
# end
#
# private
@bit-dragon
bit-dragon / hooks.rb
Created January 16, 2013 15:36
An example of hook class/module
class ShippingOption
@children = []
def self.inherited(child)
@children << child
end
def self.for(weight, international)
@children.select do |child|
child.can_ship?(weight, international)
end
@bit-dragon
bit-dragon / ObserverPattern.js
Last active December 10, 2015 01:18
(Observer Pattern) PubSub on javascript
var publisher = {
subscribers: {
any: [] // Event type: subscribers
},
subscribe: function (fn, type) {
type = type || 'any';
if (typeof this.subscribers[type] === 'undefined') {
this.subscribers[type] = [];
}
@bit-dragon
bit-dragon / .vim
Last active October 11, 2015 19:38
.vim
├── autoload
│   └── pathogen.vim
├── bundle
│   ├── ctrlp.vim
│   ├── gundo
│   ├── nerdcommenter
│   ├── nerdtree
│   ├── quicktask
│   ├── scss-syntax.vim
@bit-dragon
bit-dragon / .vimrc
Created October 17, 2012 23:47
VIMRC
call pathogen#infect()
" Tabs
set shiftwidth=2
set tabstop=2
set vb
" Highlight
set hlsearch!
@bit-dragon
bit-dragon / remove on git
Created October 1, 2012 18:43
Remove many files on git
git ls-files --deleted -z | xargs -0 git rm
@bit-dragon
bit-dragon / spec_helper.rb
Created September 26, 2012 05:41
RSpec configuration for Rails Engine application
# This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../dummy/config/environment", __FILE__)
require 'rspec/rails'
require 'rspec/autorun'
require 'factory_girl_rails'
require 'database_cleaner'
require 'shoulda/matchers/integrations/rspec'
ENGINE_RAILS_ROOT=File.join(File.dirname(__FILE__), '../')
@bit-dragon
bit-dragon / runtest.sh
Last active October 10, 2015 21:08
Run test with an correct order
#! /bin/bash
clear
echo "Running the rspec sorted correctly"
find spec -type f -name '*_spec.rb' | sort | xargs rspec