This shard provides environment detection. The selected environment is configured using CRYSTAL_ENV
environment variable.
Add this to your application's shard.yml
:
dependencies:
abstract class Logger2 | |
enum Severity | |
DEBUG | |
INFO | |
end | |
abstract def log(severity : Severity, message, context : String) | |
macro bind(*, context = nil, forward = nil) | |
struct LoggerBinding |
module Logger2 | |
enum Severity | |
DEBUG | |
INFO | |
end | |
abstract def log(severity, message, context) | |
macro using(context, forward = nil) | |
getter logger : Logger2? |
struct NamedTuple | |
macro map_keys(tuple, properties) | |
{% begin %} | |
%tuple = {{tuple}} | |
NamedTuple.new( | |
{% for key, value in properties %} | |
{{value.id}}: %tuple[{{key.symbolize}}], | |
{% end %} | |
) | |
{% end %} |
local action = json.parse(request.body).config.action | |
http.request { | |
url = 'https://hooks.slack.com/services/...', | |
method = 'POST', | |
data = json.stringify({text = 'Action: '..action}) | |
} | |
return 200 |
unless ARGV.size > 0 | |
puts " Missing executable file argument" | |
puts " Usage (in a Dockerfile)" | |
puts " RUN crystal run ./path/to/list-deps.cr -- ./bin/executable" | |
exit 1 | |
end | |
executable = File.expand_path(ARGV[0]) | |
unless File.exists?(executable) |
require "json" | |
struct Slice(T) | |
def to_json(json : JSON::Builder) | |
json.array do | |
each do |e| | |
e.to_json(json) | |
end | |
end | |
end |
require "pg" | |
# start a posgress | |
# $ docker run --name mypg -e POSTGRES_DB=crystal -e POSTGRES_USER=postgress -e POSTGRES_PASSWORD= -p 5432:5432 postgres:9.5 | |
# <ctrl+c> to stop server | |
# restart it | |
# $ docker start -a mypg | |
# <ctrl+c> to stop server |
$ brew install imagemagick
$ brew install tesseract
$ ls -l1
Basic Infrastructure.pdf
extract.rb
$ ruby extract.rb 2> /dev/null
extracting page 1
.....................
This sample show how to attach globally to events over dynamically created elements.
And how can data-*
attributes be used to customize behaviour.