Skip to content

Instantly share code, notes, and snippets.

View ULei's full-sized avatar

藍月 ULei

View GitHub Profile
@ULei
ULei / Readme.md
Last active August 29, 2015 14:06 — forked from gabrielemariotti/Readme.md

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Example:

        //Your RecyclerView
@ULei
ULei / Hello.scala
Last active August 29, 2015 14:06
介紹Play框架中controller如何與view mapping 資料
package controllers
import play.api._
import play.api.mvc._
object Hello extends Controller {
def index(name :String, message :String) = Action {
Ok(views.html.hello(message, name))
}
package com.bluemoon.main;
import org.testng.annotations.*;
import org.testng.annotations.Test;
/**
* Created by chris_jeng on 2015/8/4.
*/
public class TestTest {
@BeforeSuite
package org.apache.http;
public interface HttpStatus {
int SC_ACCEPTED = 202;
int SC_BAD_GATEWAY = 502;
int SC_BAD_REQUEST = 400;
int SC_CONFLICT = 409;
int SC_CONTINUE = 100;
int SC_CREATED = 201;
int SC_EXPECTATION_FAILED = 417;
@ULei
ULei / OkHttpStack.java
Created October 19, 2015 08:13 — forked from bryanstern/OkHttpStack.java
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@ULei
ULei / jmockit_demo.java
Last active November 7, 2015 13:17
千年一遇: JMockit神兵介紹 - http://goo.gl/78J9KU
@Test(expected = EmailException.class)
public void doBusinessOperationXyzWithInvalidEmailAddress() throws Exception
{
new Expectations() {{
email.addTo((String) withNotNull()); result = new EmailException();
}};
EntityX data = new EntityX(5, "abc", "someone@somewhere.com");
new MyBusinessService(data).doBusinessOperationXyz();
}
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.testng.annotations.Test;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
/**
* Created by chris_jeng on 2016/1/12.
*/
@ULei
ULei / jmockit_demo2.java
Created March 8, 2016 07:37
千年一遇: JMockit神兵介紹 - http://goo.gl/78J9KU
import org.testng.annotations.Test;
import mockit.Delegate;
import mockit.Expectations;
import mockit.Mocked;
/**
* Created by chris_jeng on 2016/1/12.
// in JavaScript
com = { acme: {} };
com.acme.Foo = function() {
this.x = 40;
this.y = 2;
};
com.acme.Foo.prototype.sum = function() { return this.x + this.y; };
// in Java
package com.acme;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>