I hereby claim:
- I am watzon on github.
- I am watzon (https://keybase.io/watzon) on keybase.
- I have a public key ASAaZc4seSN-ph2udQzAl_qP_oBugNBvq57A5mKu5qQh1go
To claim this, I am signing this object:
class CreateOrganizationMembers::V20190614161024 < Avram::Migrator::Migration::V1 | |
def migrate | |
create :organization_member do | |
add_belongs_to user : User, on_delete: :cascade | |
add_belongs_to organization : Organization, on_delete: :cascade | |
add can_add_shards : Bool | |
add can_delete_shards : Bool | |
add can_edit_shards : Bool | |
add can_edit_info : Bool |
abstract class DecoratorBase | |
private macro decorate(ident, name = nil) | |
@_{{ ident.id.stringify.downcase.id }} : {{ ident.id }} | |
forward_missing_to @_{{ ident.id.stringify.downcase.id }} | |
def initialize(@_{{ ident.id.stringify.downcase.id }} : {{ ident.id }}) | |
end | |
end |
require "http/client" | |
require "openssl" | |
module NotPwnedValidation | |
def validate_not_in_hibp | |
password.value.try do |value| | |
hash = get_sha1_hash(value).upcase | |
first_five = hash[0...5] | |
response = HTTP::Client.get("https://api.pwnedpasswords.com/range/" + first_five) | |
hashes = response.body.split("\r\n") |
import { Application } from 'stimulus' | |
import PasswordController from './controllers/password_controller' | |
const application = Application.start() | |
application.register("password", PasswordController) |
I hereby claim:
To claim this, I am signing this object:
# This example will throw an error at compile time | |
# allowing you to catch it sooner and fix it | |
arr = [] of Int32 | |
def sum(arr) | |
arr.reduce(0) { |acc,i| acc + i } | |
end | |
# Works just fine |
# This example throws a runtime error. | |
# Yes. This is intentional. | |
arr = [] | |
def sum(arr) | |
arr.reduce(0) { |acc,i| acc + i } | |
end | |
# Works just fine |
# A very basic HTTP server | |
require "socket" | |
server = TCPServer.new("localhost", 8080) | |
puts "Listening on http://localhost:8080" | |
loop do | |
socket = server.accept | |
request = socket.gets | |
# A very basic HTTP server | |
require "http/server" | |
server = HTTP::Server.new do |context| | |
context.response.content_type = "text/plain" | |
context.response.print "Hello world, got #{context.request.path}!" | |
end | |
puts "Listening on http://127.0.0.1:8080" | |
server.listen(8080) |
class MediaFinder | |
alias FileInfo = NamedTuple(name: String, directory: String, size: UInt64) | |
DEFAULT_MEDIA_TYPES = { | |
images: ["jpg", "jpeg", "gif", "png", "exif", "tiff", "bmp"], | |
videos: ["webm", "mkv", "flv", "vob", "ogv", "ogg", "gifv", "mng", "avi", "mts", "m2ts", "mov", "qt", "wmv", "mp4", "m4p", "mpg", "mpeg", "m4v", "3gp", "3g2"], | |
audios: ["aa", "aac", "aax", "aiff", "flac", "m4a", "m4p", "mp3", "ogg", "sln", "wav", "wma"] | |
} |