Skip to content

Instantly share code, notes, and snippets.

View mrmike's full-sized avatar

Michal Moczulski mrmike

View GitHub Profile
@mrmike
mrmike / tableField
Last active December 16, 2015 00:09
Eclipse snippet for creating table fields in AUContentProvider
// Add this template in Preferences > Java > Editor > Templates > New
// I stored this snippet with newField name, but you can use any name you want
public static final String ${name} = DataHelper.field(DB_TABLE, "${value}");
@mrmike
mrmike / newTable
Created April 9, 2013 11:46
Eclipse template for creating database table in AUContentProvider library.
// Add this template in Preferences > Java > Editor > Templates > New
// I stored this snippet with newTable name, but you can use any name you want
public static class ${tableName} implements BaseColumns {
public static final String CONTENT_PATH = ${name};
public static final Uri CONTENT_URI = Uri.withAppendedPath(AUTHORITY_URI, CONTENT_PATH);
public static final String CONTENT_ITEM_TYPE = DataHelper.contentItemType(AUTHORITY, CONTENT_PATH);
public static final String CONTENT_DIR_TYPE = DataHelper.contentType(AUTHORITY, CONTENT_PATH);
@mrmike
mrmike / gist:5346240
Created April 9, 2013 14:43
Snippet for creating loader callbacks
// Add this template in Preferences > Java > Editor > Templates > New
// I stored this snippet with newLoader name, but you can use any name you want
// To use this loader your class should implements LoaderCallbacks<Cursor>
private static final int ${loaderName} = 0;
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case ${loaderName}:
@mrmike
mrmike / newFragment
Created April 18, 2013 14:01
Template for creating basic fragment's methods
// Add this template in Preferences > Java > Editor > Templates > New
// I stored this snippet with newFragment name, but you can use any name you want
public static Fragment newInstance() {
return new ${fragment};
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@mrmike
mrmike / newRequest
Created April 25, 2013 13:31
Snippet for creating httpRequests
// Add this template in Preferences > Java > Editor > Templates > New
// I stored this snippet with newRequest name, but you can use any name you want
String url = new GetBuilder(${url}).appendPathSegment(${path})
.build();
Http${type} request = new Http${type}(url);
setupDefaultHeaders(request);
HttpResponse response = getHttpClient().execute(request);
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_ACTION_MODE_OVERLAY);
super.onCreate(savedInstanceState);
mAppPreferences = new AppPreferences(this);
mUserPreferences = new UserPreferences(this);
DownloadHelper.startAsyncDownload(getApplicationContext(),
AppConsts.ACTION_SYNC, AppContract.Category.CONTENT_URI, null,
@mrmike
mrmike / Git Aliases
Created January 15, 2014 14:24
Git Aliases
# GIT aliases
alias doMastera='git push origin HEAD:refs/for/master'
alias zrobFetcha='git fetch origin master && git checkout FETCH_HEAD'
alias gst='git status'
alias gd='git diff'
alias gl='git lg'
alias resetuj='git reset --hard HEAD'
alias amenduj='git commit --amend'
alias vim='~/Developments/vim/src/vim'
alias testuj='./gradlew connectedInstrumentTest'
@mrmike
mrmike / gist:8631798
Last active January 4, 2016 13:59
Copying and pasting current directory path OS X
alias path='echo | pwd | pbcopy'
alias pong='cd `pbpaste`'
@mrmike
mrmike / gist:9354197
Created March 4, 2014 19:50
Copy file to Dropbox folder
# add tou your ~/.profile file
cpToDropbox()
{
cp $1 /Users/michal/Dropbox/destination_folder
echo 'File copied to Dropbox folder'
}
alias drop=cpToDropbox
Single Post
=======
**GET** */api/v1/news/[guid].json?uuid=00xsd*
```json
{
"guid": 213124,
"title": "Some title news about sth",
"content": "Current content field",
"body": "some long article body...",