Skip to content

Instantly share code, notes, and snippets.

View wojtekerbetowski's full-sized avatar

Wojtek Erbetowski wojtekerbetowski

View GitHub Profile
@wojtekerbetowski
wojtekerbetowski / output.md
Last active March 14, 2017 21:44
Load most common PyWaw speakers

Output on 14.03.2017

$ python pywaw.py 
Collecting beautifulsoup4
  Using cached beautifulsoup4-4.5.3-py3-none-any.whl
Collecting requests
  Using cached requests-2.13.0-py2.py3-none-any.whl
Installing collected packages: beautifulsoup4, requests
Successfully installed beautifulsoup4-4.5.3 requests-2.13.0

Keybase proof

I hereby claim:

  • I am wojtekerbetowski on github.
  • I am wojtekerbetowski (https://keybase.io/wojtekerbetowski) on keybase.
  • I have a public key whose fingerprint is 1104 3368 FEBE 62C8 3748 D647 0AE7 E90D 33F8 7306

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am wojtekerbetowski on github.
  • I am wojtekerbetowski (https://keybase.io/wojtekerbetowski) on keybase.
  • I have a public key whose fingerprint is 3B8A D29B D5D2 E758 FB69 900D 0CAF 5BA8 9ACC 5233

To claim this, I am signing this object:

@wojtekerbetowski
wojtekerbetowski / LoggingSpec.groovy
Created January 2, 2013 08:19
Putting things together
final def advice = new MethodAdvice() {
@Override
void advise(MethodInvocation invocation) {
logger.debug("Entering method")
invocation.proceed()
}
}
def transformer = new PlasticClassTransformer() {
@Override
@wojtekerbetowski
wojtekerbetowski / LoggingSpec.groovy
Last active December 10, 2015 12:18
Creating PlasticManager
PlasticManager
.withContextClassLoader()
.packages(['my.package'])
.delegate(delegate) // a delegate?
.create()
class LoggingSpec extends Specification {
def "fake service should log a message"() {
given:
def logger = Mock(Logger)
and: 'an instance of fake service'
def service = prepareServiceWithLogger(logger)
when:
Too few invocations for:
1 * logger.debug("Entering method") // should log once (0 invocations)
at org.spockframework.mock.InteractionScope.verifyInteractions(InteractionScope.java:66)
at org.spockframework.mock.MockController.leaveScope(MockController.java:20)
at pl.erbetowski.plastic.logging.LoggingSpec.fake service should log a message(LoggingSpec.groovy:17)
@wojtekerbetowski
wojtekerbetowski / FakeService.java
Created December 30, 2012 20:05
Completely doing nothing
package pl.erbetowski.plastic.logging;
public class FakeService {
public void myBusinessMethod() {
// do completely nothing
}
}
@wojtekerbetowski
wojtekerbetowski / build.gradle
Last active December 10, 2015 09:28
Configuration of plastic project
apply {
plugin 'java'
plugin 'eclipse'
plugin 'idea'
plugin 'groovy'
}
repositories {mavenCentral()}
dependencies {
@wojtekerbetowski
wojtekerbetowski / gist:1861032
Created February 18, 2012 21:11
UserRegisterer
class UserRegisterer @Inject() (hasher: hasher) {
def register(username, password) = User(username, hasher.hash(password)).save
}