Command Line
pry -r ./config/app_init_file.rb- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb- load your rails into a pry session
Debugger
| {%comment%} | |
| ############################################# | |
| # Mohamed El-Ghorfi Discount Code on Cart # | |
| # [UPDATED] # | |
| ############################################# | |
| # Paypal Me: https://paypal.me/elghorfimed # | |
| # Buy Me A Coffee: # | |
| # https://www.buymeacoffee.com/elghorfi # | |
| ############################################# | |
| # elghorfi.med@gmail.com # |
| 2. Given the file with random chars, draw a histogram of chars count. | |
| For example for file with content | |
| === | |
| 123456789012345678909999991234569999 | |
| === | |
| Output should be the following: | |
| 1 *** |
| # For more elaborate use cases, see the IndirectUsesTracker instead: | |
| # https://gist.github.com/christhekeele/fc4e058ee7d117016b9b041b83c6546a | |
| ### | |
| # A way to know, at runtime, what modules a module has used at compile time. | |
| # In this case, you include `UsesTracker` into a module. When that module gets | |
| # used in some other module, it registers itself with the other module. | |
| ## | |
| defmodule UsesTracker do | |
| # For simpler use cases, see the UsesTracker instead: | |
| # https://gist.github.com/christhekeele/e858881d0ca2053295c6e10d8692e6ea | |
| ### | |
| # A way to know, at runtime, what modules a module has used at compile time. | |
| # In this case, you include `IndirectUsesTracker` into a module. When that module gets | |
| # used in some other module, it makes that module registerable under a namespace of your choosing. | |
| # When the registerable module is used into a third module, that third module will know at runtime which | |
| # registerables were `use`d in it at compile time, via a function titled after the namespace. |
| def get_specific_version(id, version, scope) do | |
| datetime = Timex.parse!(version, "%FT%T.%fZ", :strftime) | |
| |> Timex.shift(seconds: -1) | |
| |> Timex.to_datetime | |
| q = """ | |
| SELECT #{version_fields()} FROM #{table()} | |
| WHERE id = $1::integer AND sys_period @> $2::timestamptz AND scope @> $3::ltree | |
| UNION ALL | |
| SELECT #{version_fields()} from #{history_table()} | |
| WHERE id = $1::integer AND sys_period @> $2::timestamptz AND scope @> $3::ltree; |
Command Line
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb - load your rails into a pry sessionDebugger
| /* | |
| Copyright (c) 2015 Paul Jolly <paul@myitcv.org.uk) | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
| skip_filter *_process_action_callbacks.map(&:filter), :only => [:action_goes_here] |