Skip to content

Instantly share code, notes, and snippets.

Piotr Mionskowski miensol

Block or report user

Report or block miensol

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
miensol / spec_helper.js
Created Mar 18, 2016
Fake Express.js Request and Response
View spec_helper.js
module.exports.request = () => {
class IncomingMessage extends require('http').IncomingMessage {
const request = new IncomingMessage();
request.__proto__ = require('express')().request;
return request;
module.exports.response = (request) => {
class ServerResponse extends require('http').ServerResponse {
miensol /
Last active Mar 22, 2019
Jpa Json Converter
package sample.json;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectReader;
import sample.json.Json;
import org.springframework.util.StringUtils;
import javax.annotation.Nonnull;
View StackQuesion_34773958.kt
package sample.stackanswers;
import org.junit.Assert
import org.junit.Before;
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith;
import org.mockito.*
import org.mockito.junit.MockitoJUnit
public class RetrofitTest {
public void configure() throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JodaModule());
Retrofit retrofit = new Retrofit.Builder()
miensol / MsdnExample.cs
Created Dec 25, 2015
SimpleConfigSections samples
View MsdnExample.cs
public class PageAppearanceSection : ConfigurationSection<IPageAppearance>
public interface IPageAppearance
bool RemoteOnly { get; }
IFont Font { get; }
IColor Color { get; }
miensol / aws-elasticbeanstalk-ec2-role-trust.json
Created Dec 15, 2015
ElasticBeanstaclk Default IAM Policies
View aws-elasticbeanstalk-ec2-role-trust.json
"Version": "2008-10-17",
"Statement": [
"Effect": "Allow",
"Principal": {
"Service": ""
"Action": "sts:AssumeRole"
import pl.brightinventions.databinding.databinding.ActivityRegisterBinding;
public class RegisterActivity extends Activity {
RegisterApi registerApi; // inject or create remote api
protected void onCreate(Bundle savedInstanceState) {
ActivityRegisterBinding viewDataBinding = DataBindingUtil.setContentView(this, R.layout.activity_register);
interface Action2<T,Throwable> {
void call(T t, Throwable error);
interface RegisterApi {
class RegistrationModel {
String firstName;
void register(RegistrationModel data, Action2<RegistrationModel, Throwable> result);
public abstract class UserBehavior {
private boolean shouldRunDefault;
public void byDefault(UserReference reference){}
public void onAnonymous(UserReference user){
shouldRunDefault = true;
public void onRegular(RegularUserReference user) {
shouldRunDefault = true;
interface UserReference {
void dispatchBehavior(@NonNull UserBehavior behavior);
class AnonymousUserReference implements UserReference {
public void dispatchBehavior(@NonNull UserBehavior behavior) {
You can’t perform that action at this time.