This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private Version normalizeVersionNumber(String version) { | |
| int major = 0; | |
| int minor = 0; | |
| int patch = 0; | |
| // Now create matcher object. | |
| Matcher m = Pattern.compile("(\\d+)(?:.(\\d+))?(?:.(\\d+))?").matcher(version); | |
| if (m.find()) { | |
| String majorString = m.group(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SimpleCallbackWrapper<T> implements retrofit2.Callback<T> { | |
| private final String TAG = this.getClass().getSimpleName(); | |
| private Callback callback; | |
| public SimpleCallbackWrapper(Callback callBack) { | |
| this.callback = callBack; | |
| } | |
| @Override | |
| public final void onResponse(Call<T> call, Response<T> response) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * target is the class object, | |
| * key is method name as String, | |
| * descriptor is the meta-data behind the | |
| * target | |
| */ | |
| function readonly(target, key, descriptor) { | |
| target[key] = function() { | |
| console.log('roar!'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "fmt" | |
| type Vertex struct { | |
| X int | |
| Y int | |
| } | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { connect } from 'react-redux'; | |
| import { getTranslate } from 'react-localize-redux'; | |
| connect( | |
| (state, ownProps) => ({translate: getTranslate(state.locale)}), | |
| (dispatch, ownProps) => ({}) | |
| )(Component) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "reflect" | |
| ) | |
| type Foo struct { | |
| FirstName string `tag_name:"tag 1"` | |
| LastName string `tag_name:"tag 2"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo off | |
| :begin | |
| cls | |
| echo Build Image for: | |
| echo ============= | |
| echo - | |
| echo 1) Development (TODO) | |
| echo 2) UAT (TODO) | |
| echo 3) Production | |
| echo - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| img { | |
| transition:transform 0.25s ease; | |
| } | |
| img:hover { | |
| transform:scale(1.5); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Message { | |
| private int mType; | |
| private String mMessage; | |
| private List<String> mUsername; | |
| private Message() {} | |
| public int getType() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class BitwiseCheckNthBit { | |
| /* | |
| * for more tutorial on bitwise operations | |
| * http://www.catonmat.net/blog/low-level-bit-hacks-you-absolutely-must-know/ | |
| */ | |
| public static void main(String []args){ | |
| int num = 2; | |
| System.out.println(String.format("%b", getNth(num, 1))); | |
| } | |
OlderNewer