Skip to content

Instantly share code, notes, and snippets.

Avatar

Piotr Niełacny LTe

View GitHub Profile
@LTe
LTe / main.py
Created Dec 20, 2019 — forked from mypy-play/main.py
Shared via mypy Playground
View main.py
from typing import Iterator
def fib(n: int) -> Iterator[int]:
a, b = 0, 1
while a < n:
yield a
a, b = b, a + b
View gist:04cb06b29a7c0b05bd18a5d949979028
center h1 {
display: inline-block;
background-color: rgba(0, 0, 0, 0.5);
padding: 10px;
margin-top: 170px;
}
center h3 {
display: inline-block;
background-color: rgba(0, 0, 0, 0.5);
View SubclassEquality.playground
class EventFeed: Hashable, Equatable {
var eventId = 0
var hashValue : Int { return eventId }
func equals(another: EventFeed) -> Bool {
return self.eventId === another.eventId
}
}
func ==(lhs: EventFeed, rhs: EventFeed) -> Bool {
View gist:9990305
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-19-generic", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/share/maven/conf/settings.xml
[DEBUG] Reading user settings from /home/lite/.m2/settings.xml
[DEBUG] Using local repository at /home/lite/.m2/repository
View .vimrc
set tags=./tags;$HOME
@LTe
LTe / bm.rb
Created May 14, 2013 — forked from paneq/bm.rb
View bm.rb
require 'benchmark'
s1 = Struct.new(:login, :password).new("login", "password")
class S
attr_accessor :login, :password
def initialize(login, password)
@login = login
@password = password
end
View gist:5454430
require 'delegate'
class Foo
end
class Bar < SimpleDelegator
def my_method
"YAY!"
end
end
View gist:5270348
# Logfile created on 2013-03-29 11:33:37 +0100 by logger.rb/v1.2.7
I, [2013-03-29T11:33:56.887927 #9031] INFO -- :
{
"user-agent": "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; en) Presto/2.10.289 Version/12.00",
"host": "ruby-blog.pl:8080",
"accept": "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1",
"accept-language": "en,en-US;q=0.9",
"accept-encoding": "gzip, deflate",
"connection": "Keep-Alive"
}
View benchmark.rb
require 'benchmark'
require 'exoteric'
counter = Exoteric.new(:url => 'http://github.com/')
Benchmark.bm do |x|
x.report { 10.times { counter.count(:twitter, :facebook, :plusone) } }
end
View gist:3234492
class BasicObject
def class
classes = []
::ObjectSpace.each_object(::Class).each do |x|
case self
when x then classes << x
end rescue nil
end
classes.reject! { |k| classes.any? { |c| c < k } }.first
end
You can’t perform that action at this time.