Skip to content

Instantly share code, notes, and snippets.

View adicatur's full-sized avatar

Catur adi nugroho adicatur

  • Qiscus
  • Yogyakarta, Indonesia
View GitHub Profile
@adicatur
adicatur / .gitignore
Created November 19, 2019 13:42
gitignore template for python app
# Editors
.vscode/
.idea/
# Vagrant
.vagrant/
# Mac/OSX
.DS_Store
@adicatur
adicatur / running-project-locally.txt
Last active February 3, 2022 07:45
Running Project Locally (Multiple module)
Step 1: In `settings.gradle` copy paste the following code:
```bash
include 'project-name'
project(':project-name').projectDir = new File('project path')
```
Step 2: In your `builde.gradle` copy paste the following code, your project-name module:
```bash
@adicatur
adicatur / sampleStickerChatAdapterQiscus.java
Created April 11, 2018 11:19
Sample Sticker Chat Adapter Qiscus
public class StickerChatAdapter extends QiscusChatAdapter {
private static final int TYPE_STICKER_ME = 23323;
private static final int TYPE_STICKER_OTHER = 23324;
public StickerChatAdapter(Context context, boolean groupChat) {
super(context, groupChat);
}
@Override
protected int getItemViewTypeCustomMessage(QiscusComment qiscusComment, int position) {
@adicatur
adicatur / main1.js
Last active April 4, 2018 06:22
Sample presence online
/* global $, QiscusSDK */
$(document).ready(function () {
QiscusSDK.core.init({
AppId: 'sdksample',
mode: 'wide',
options: {
avatar: false,
loginSuccessCallback: function () {
loadRoomList();
checkOnlinePresence();
@adicatur
adicatur / Build channel room.java
Created April 3, 2018 06:46
Sample Channel Group
Qiscus.buildGroupChatRoomWith("channel")
.build()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<QiscusChatRoom>() {
@Override
public void call(QiscusChatRoom qiscusChatRoom) {
startActivity(QiscusChatActivity.generateIntent(MainActivity.this, qiscusChatRoom));
}
}, new Action1<Throwable>() {
@adicatur
adicatur / A Sample JWT auth
Last active March 28, 2018 07:22
Sample code JWT auth Ruby on Rails
This is example JWT auth token using Rails on Ruby
@adicatur
adicatur / ApplicationHelper.rb
Created March 28, 2018 07:07
Sample Authentication JWT Ruby on Rails
module ApplicationHelper
def self.create_jwt_token(user, request = nil)
begin
if user.kind_of?(Integer)
user_id = user
elsif user.kind_of?(User)
user_id = user.id
else
raise Exception.new("Parameter must be an user or user id.")
@adicatur
adicatur / SimpleChatFragment
Last active October 16, 2017 08:28
SimpleChatFragmentSDK
public class SimpleChatFragment extends QiscusChatFragment {
public static SimpleChatFragment newInstance(QiscusChatRoom qiscusChatRoom) {
SimpleCustomChatFragment fragment = new SimpleCustomChatFragment();
Bundle bundle = new Bundle();
bundle.putParcelable(CHAT_ROOM_DATA, qiscusChatRoom);
fragment.setArguments(bundle);
return fragment;
}
@adicatur
adicatur / ParserToGson
Created September 8, 2017 09:15
Parsing Raw Json Using Gson
public void init() {
InputStream inputStream = .getResources().openRawResource(R.raw.json);
Writer writer = new StringWriter();
char[] buffer = new char[1024];
try {
Reader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
int n;
while ((n = reader.read(buffer)) != -1) {