I hereby claim:
- I am mieko on github.
- I am mieko (https://keybase.io/mieko) on keybase.
- I have a public key whose fingerprint is 2AEC C9D5 4B21 DD55 6B42 214D 22C1 BE53 C942 F1EE
To claim this, I am signing this object:
{ | |
"$schema": "http://json-schema.org/draft-07/schema", | |
"title": "RuboCop configuration schema", | |
"description": "Schema for RuboCop configuration files (e.g. .rubocop.yml), intended for helping IDEs provide autocompletion and validation.", | |
"type": "object", | |
"additionalProperties": false, | |
"definitions": { | |
"inherit_mode": { | |
"type": "object", | |
"minProperties": 1, |
require "rack/utils" | |
# Rails < 4.1 serialized sessions with Marshal, which could distinguish "html_safe" flash strings | |
# from unsafe strings because it encoded actual ActiveSupport::SafeBuffer objects. So when the | |
# flash message came back from the client, its "safe" status was preserved, and it was rendered | |
# correctly under both circumstances. | |
# | |
# This same "magic" ability is also why Rails moved away from it: multiple CVEs due to arbitrary | |
# object creation. But regardless, that was a *really* nice trick. | |
# |
require "shellwords" | |
def terminal_width | |
%x(tput cols).chomp.to_i | |
rescue StandardError | |
80 | |
end | |
def sql_table_command(model_class) | |
table_name = model_class.table_name |
# Tries to find a parent directory containing a file: "$1" | |
find-up() { | |
local path=$(pwd) | |
while [[ -n "$path" && ! -e "$path/$1" ]]; do | |
path=${path%/*} | |
done | |
echo "$path" | |
} | |
try-binstub() { |
Copyright 2016 Mike Owens | |
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: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the | |
Software. |
class Switch < BasicObject | |
def initialize(&body) | |
fail ArgumentError, 'switch body required' unless body | |
@cases = [] | |
@receiver = body.binding.receiver | |
instance_eval(&body) | |
end | |
def given(*spec, &block) |
I hereby claim:
To claim this, I am signing this object:
This is an example of how to configure nginx to allow ActionCable WebSocket connections to use the same host as your primary site. For example, instead of cable.myapp.dev
, you can use myapp.dev/_c/
.
In my case, we have a multi-tenanted environment, e.g., bob.myapp.dev
and jim.myapp.dev
. This lets the ActionCable connection still use the Host:
header to select a tenant, and use normal cookies for user identification. wss://bob.myapp.dev/_c/
is authorized as normal. It also piggybacks off of whatever TLS setup is available.
class MarchingSquares | |
STATE = { "0000" => :r, "1100" => :r, "0011" => :l, "1110" => :r, | |
"0100" => :r, "1000" => :u, "1011" => :u, "1001" => :u, | |
"0101" => :d, "1010" => :u, "0111" => :l, "0110" => :l, | |
"0001" => :d, "0010" => :l, "1101" => :d, "1111" => :r } | |
def self.find_shape(grid, w, h) | |
edge_pos = grid.index('1') | |
return nil if edge_pos.nil? |