Skip to content

Instantly share code, notes, and snippets.

View hamzakc's full-sized avatar

Hamza Khan-Cheema hamzakc

View GitHub Profile
===> Load global config file /home/hamza/.config/rebar3/rebar.config
===> Evaluating config script "/home/hamza/.cache/rebar3/plugins/lfe/rebar.config.script"
===> 25.2.3 satisfies the requirement for minimum OTP version 18
===> Evaluating config script "/home/hamza/.cache/rebar3/plugins/hex_core/rebar.config.script"
===> 25.2.3 satisfies the requirement for minimum OTP version 19.3
===> Setting paths to [deps]
===> Compile (apps)
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Setting paths to [plugins]
@hamzakc
hamzakc / day1.fnl
Created June 16, 2022 08:07
Seven More Languages in Seven Weeks Exercises - Lua => Fennel
;; Exercies 1
;; Write a function called ends_in_3(num) that returns true if the final digit of num is 3, and false otherwise.
(fn ends_in_3 [num]
(let [num-str (.. "" num)]
(let [tbl (icollect [s (string.gmatch num-str "%d")] s)]
(if (= "3" (. tbl (length tbl)))
true
false))))
@hamzakc
hamzakc / AddsUserToList.rb
Created December 11, 2013 07:44
A different way to write a service object. Made in response to http://re-factor.com/blog/2013/09/27/slow-tests-are-the-symptom-not-the-cause/
class AddsUserToList
attr_reader :notifies_user_klass, :user_klass
def initialize(user_klass = User, notifies_user_klass = NotifiesUser)
@user_klass = user_klass
@notifies_user_klass = notifies_user_klass
end
def add(params)
user_klass.find_by_username!(params.fetch(:username).tap do |user|
notifies_user_klass.(user, params.fetch(:mailing_list_name))