Skip to content

Instantly share code, notes, and snippets.

View MSch's full-sized avatar

Martin Schürrer MSch

View GitHub Profile

Keybase proof

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:

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
@MSch
MSch / stem.ex
Last active August 29, 2015 14:02 — forked from avgerin0s/stem.ex
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
@MSch
MSch / dup_bench.exs
Last active August 29, 2015 14:04 — forked from alco/dup_bench.exs
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

MORPHEUS: For the longest time, I wouldn't believe it. But then I saw the fields with my own eyes, watched them liquefy the dead so they could be fed intravenously to the living -

NEO (politely): Excuse me, please.

MORPHEUS: Yes, Neo?

NEO: I've kept quiet for as long as I could, but I feel a certain need to speak up at this point. The human body is the most inefficient source of energy you could possibly imagine. The efficiency of a power plant at converting thermal energy into electricity decreases as you run the turbines at lower temperatures. If you had any sort of food humans could eat, it would be more efficient to burn it in a furnace than feed it to humans. And now you're telling me that their food is the bodies of the dead, fed to the living? Haven't you ever heard of the laws of thermodynamics?

MORPHEUS: Where did you hear about the laws of thermodynamics, Neo?

asd
class A
def a
5
end
def demo
puts a # => 5
puts self.a # => 5
a = 6
puts a # => 6
puts self.a # => 5
require 'bigdecimal'
class BigDecimal
def singleton_method_added(id)
end
end
a = BigDecimal('3.14')
def a.to_s(s = 'E')
'foo'
end
require 'rubygems'
require 'sinatra'
require 'dm-core'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'sqlite3::memory:')
# Don't use this in production code! Extending lots of objects during runtime
# will have a negative impact on performance/memory because ruby clears out
# the method cache.
.text
.globl _asma
_asma:
LFB2:
pushq %rbp
LCFI0:
movq %rsp, %rbp
LCFI1:
movl $0, %ecx
L2: