I hereby claim:
- I am padde on github.
- I am padde (https://keybase.io/padde) on keybase.
- I have a public key whose fingerprint is 7B8E 3327 8E52 E3E1 8392 92AE CCBB 382F 5F9D 1786
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
defmodule Regex.InterpolationError do | |
defexception [:message] | |
end | |
defmodule Regex.Interpolation do | |
def wrap(regex = %Regex{opts: modifiers}) do | |
Regex.source(regex) | |
|> do_wrap(modifiers) | |
end |
iex> <<first, rest::binary>> = "☺ how dare you, unicode!" | |
"☺ how dare you, unicode!" | |
iex> <<first>> | |
<<226>> | |
iex> rest | |
<<152, 186, 32, 104, 111, 119, 32, 100, 97, 114, 101, 32, 121, 111, 117, 44, 32, 117, 110, 105, 99, 111, 100, 101, 33>> | |
# spec/support/devise.rb | |
module DeviseFeatureHelpers | |
def sign_in(user = nil, scope = :user) | |
user ||= build_stubbed :user | |
login_as user, scope: scope | |
end | |
end | |
RSpec.configure do |config| |
defmodule MyStream do | |
def mutate(enum, user_acc, user) do | |
step = fn val, _acc -> {:suspend, val} end | |
next = &Enumerable.reduce(enum, &1, step) | |
&do_mutate([], user_acc, user, next, &1, &2) | |
end | |
defp do_mutate(values, user_acc, user, next, {:suspend, acc}, fun) do | |
{:suspended, acc, &do_mutate(values, user_acc, user, next, &1, fun)} | |
end |
require 'forwardable' | |
class Proc | |
def with(*arguments, &block) | |
proc do |*remaining_arguments| | |
call(*remaining_arguments, *arguments, &block) | |
end | |
end | |
end |
class Post < ActiveRecord::Base | |
include PgSearch | |
pg_search_scope :search, | |
against: :body, | |
using: {tsearch: {dictionary: 'german'}} | |
end |
SELECT to_tsvector('german', 'Ich würde gerne schwimmen gehen'); | |
------------------------------ | |
'geh':5 'gern':3 'schwimm':4 |
SELECT to_tsvector('Ich würde gerne schwimmen gehen'); | |
---------------------------------------------------- | |
'gehen':5 'gern':3 'ich':1 'schwimmen':4 'würde':2 |
SELECT to_tsvector('I like to go swimming'); | |
-------------------------- | |
'go':4 'like':2 'swim':5 |