Skip to content

Instantly share code, notes, and snippets.

View durrellchamorro's full-sized avatar

Durrell Chamorro durrellchamorro

  • Fleetio
  • 05:51 (UTC -05:00)
View GitHub Profile
@durrellchamorro
durrellchamorro / gist:bd9c35a9c403d5395b1247634db59906
Created February 7, 2021 18:46
jeangenie.com stats the day the MVP was done
+----------------------+--------+--------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+--------+--------+---------+---------+-----+-------+
| Controllers | 2455 | 1995 | 62 | 259 | 4 | 5 |
| Helpers | 135 | 111 | 0 | 18 | 0 | 4 |
| Jobs | 131 | 106 | 12 | 11 | 0 | 7 |
| Models | 1239 | 952 | 24 | 105 | 4 | 7 |
| Mailers | 136 | 110 | 8 | 17 | 2 | 4 |
| Channels | 40 | 34 | 4 | 6 | 1 | 3 |
| Exceptions | 23 | 22 | 4 | 4 | 1 | 3 |
@durrellchamorro
durrellchamorro / rails_webpacker_bootstrap_expose_jquery.md
Created November 19, 2018 03:37 — forked from andyyou/rails_webpacker_bootstrap_expose_jquery.md
Rails 5.2 with webpacker, bootstrap, stimulus starter

Rails 5.2 with webpacker, bootstrap, stimulus starter

This gist will collect all issues we solved with Rails 5.2 and Webpacker

Create Project

# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new <project_name> --webpack=stimulus --database=postgresql --skip-coffee --skip-test
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
--[[
Conky, a system monitor, based on torsmo
Any original torsmo code is licensed under the BSD license
All code written since the fork of torsmo is licensed under the GPL
Please see COPYING for details
@durrellchamorro
durrellchamorro / vim-heroku.sh
Created September 30, 2018 03:15 — forked from dvdbng/vim-heroku.sh
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@durrellchamorro
durrellchamorro / procs_study.rb
Last active October 12, 2017 16:18
Study of Procs Best Used With the Seeing is Believing Gem
# Procs are just closures:
def my_method_1
counter = 0 # => 0
proc { counter += 1 } # => #<Proc:0x007fadc9244ec8@/Users/durrellchamorro/code/scratch.rb:4>
end # => :my_method_1
my_proc = my_method_1 # => #<Proc:0x007fadc9244ec8@/Users/durrellchamorro/code/scratch.rb:4>
my_proc.call # => 1
my_proc.call # => 2
@durrellchamorro
durrellchamorro / perfect_numbers.rb
Last active July 4, 2016 22:28
This module can tell if a number is perfect, abundant or deficient according to the Greek mathematician Nicomachus's classification scheme. The algorithm is fast.
require 'prime'
module PerfectNumber
def self.classify(number)
raise "Number must be greater than or equal to two" if number < 2
aliquot_sum = generate_aliquot_sum(number)
return 'deficient' if aliquot_sum < number
return 'abundant' if aliquot_sum > number
'perfect'
@durrellchamorro
durrellchamorro / perfect_numbers.rb
Last active July 4, 2016 22:57
This program can tell if a number is perfect, abundant or deficient according to the Greek mathematician Nicomachus's classification scheme. This algorithm is fast, but its speed pales in comparison to the algorithm I wrote that uses ruby's Prime class.
require 'benchmark'
class PerfectNumber
def self.classify(number)
raise RuntimeError if number <= 1
sum_of_divisors = add_divisors(number)
return 'deficient' if sum_of_divisors < number
return 'abundant' if sum_of_divisors > number
'perfect'
class Phrase
def initialize(words)
@words = words
end
def word_count
count = Hash.new(0)
@words.scan(/\b[\w']+\b/) do |word|
count[word.downcase] += 1
class Crypto
def initialize(text)
@text = text
end
def normalize_plaintext
@text.gsub(/\W/,'').downcase
end
def size
@durrellchamorro
durrellchamorro / anagram.rb
Last active April 21, 2016 18:19
Anagram
class Anagram
def initialize(word)
@actual_word = word
@sorted_word = sort word
end
def match(list)
selected = list.select { |word| sort(word) == @sorted_word }
selected.delete_if { |word| word.downcase == @actual_word }
end