I hereby claim:
- I am msch on github.
- I am msch (https://keybase.io/msch) on keybase.
- I have a public key whose fingerprint is 6A3B C7D2 D3B2 D5CE 4C46 F279 E851 70D1 DB52 D668
To claim this, I am signing this object:
module MyApp::ModelNameFix | |
def model_name | |
@_model_name ||= ActiveModel::Name.new(self, nil, self.name.sub(/^#{self.parent.name}::/, '')) | |
end | |
def namespaced_model_name | |
@_namespaced_model_name ||= ActiveModel::Name.new(self) | |
end | |
# Work with Draper |
self.collectionView = ({ | |
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; | |
UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds | |
collectionViewLayout:flowLayout]; | |
collectionView.delegate = self; | |
collectionView.dataSource = self; | |
collectionView; |
% brew --config :( | |
HOMEBREW_VERSION: 0.9.4 | |
ORIGIN: https://github.com/mxcl/homebrew.git | |
HEAD: ba09af5da322ce5506be593629a20835702c5d26 | |
HOMEBREW_PREFIX: /usr/local | |
HOMEBREW_CELLAR: /usr/local/Cellar | |
CPU: quad-core 64-bit arrandale | |
OS X: 10.8.4-x86_64 | |
Xcode: 5.0 => /Applications/Xcode5-DP5.app/Contents/Developer | |
CLT: 5.0.0.0.1.1372877146 |
$state = 0 | |
def lol(x, y) | |
$state += 1 | |
puts "Incrementing state it's now #{$state}" | |
[:bla, $state] | |
end | |
a, e = lol(:screw, :this) until e == 3 | |
puts "a=#{a} e=#{e}" |
$state = 0 | |
def lol(x, y) | |
$state += 1 | |
puts "Incrementing state it's now #{$state}" | |
[:bla, $state] | |
end | |
a, e = lol(:screw, :this) until e == 3 | |
puts "a=#{a} e=#{e}" |
module ActiveRecord | |
class Connection | |
def connect | |
Thread.current.thread_variable_set(:connection_id, 123) | |
end | |
end | |
end | |
module Sequel | |
class Connection |
I hereby claim:
To claim this, I am signing this object:
defmodule Mix.TasksServer do | |
@moduledoc false | |
use GenServer.Behaviour | |
def start_link() do | |
:gen_server.start_link({ :local, __MODULE__ }, __MODULE__, :ok, []) | |
end | |
def clear_tasks() do | |
call :clear_tasks |
defmodule Stemmer do | |
def stem(word) do | |
IO.puts "stemming #{word}" | |
case Regex.run(~r/^(.+?)(ASD|QWE)$/u, word) do | |
[pattern_matching, like, "ASD"] -> IO.inspect like | |
[pattern_matching, like, "QWE"] -> IO.puts "whatever" | |
end | |
end | |
end |
Benchfella.start duration: 1.0#, format: :machine | |
defmodule StringDuplicateBench do | |
use Benchfella | |
@iterations [100, 1000, 10000, 100000] | |
Enum.each(@iterations, fn n -> | |
@str "1234567890" | |
@n n |