Skip to content

Instantly share code, notes, and snippets.

View arifsetiawan's full-sized avatar

arif setiawan arifsetiawan

View GitHub Profile
@arifsetiawan
arifsetiawan / gist:10014113
Last active March 3, 2017 17:09
Firebase for chat

Update

archiving will be handled in server, so no push to offline necessary. This will make client more light.

NOTE always set ts to current time when you push or set the data.

Firebase for chat

To create a chat, necessary firebase components :

A nodejs based server will archive user online-offline state and store all chat data. This will make client more light.

NOTE always set ts to current time when you push or set the data.

##Chat Apps with Firebase :

To create a chat, necessary firebase components :

  • User - Handle real time online-offline status changes of user.
@arifsetiawan
arifsetiawan / git-workflow-one.md
Last active August 29, 2015 14:01
Git workflow #1

Git workflow #1

Create your working branch

Clone the repo

$ git clone https://arifsetiawan@bitbucket.org/someuser/great-website.git greatwebsite
@arifsetiawan
arifsetiawan / slim-route-middleware.php
Last active August 29, 2015 14:01
slim-route-middleware
<?php
error_reporting(E_ALL | E_STRICT);
//
// Require modules
require 'Slim/Slim.php';
\Slim\Slim::registerAutoloader();
require 'Slim/Log.php';
// Get Slim Extras from here https://github.com/codeguy/Slim-Extras
@arifsetiawan
arifsetiawan / Acl.php
Created May 30, 2014 03:32
slim middleware
<?php
//
// Here, we define route and its auth requirements
function getAcl() {
$acls = array(
"/secret" => array("member"),
"/moresecret" => array("member","subscribe")
);
var B = require("bluebird/js/main/promise")();
var Bproto = B.prototype;
var deferredPrototype = B.pending().constructor.prototype;
deferredPrototype.makeNodeResolver = function() {
return this.asCallback;
};
function bind(fn, ctx) {
@arifsetiawan
arifsetiawan / azurecamp-workingwithcli.md
Last active October 24, 2017 11:29
Working with azure cli
@arifsetiawan
arifsetiawan / azurecamp-deploynodeapp.md
Last active August 29, 2015 14:06
Deploy Node.js App

Deploy Node.js app

SSH to VM

$ ssh azurecamp@azurecamp.cloudapp.net -i MyAzure.key

Create setup script

@arifsetiawan
arifsetiawan / azurecamp-asynctask.java
Last active August 29, 2015 14:07
Simple Android AsyncTask
// execute("GET","url","Body")
private class ApiClient extends AsyncTask<String, Void, String> {
// This runs in other thread
@Override
protected String doInBackground(String... params) {
String method = params[0];
String url = params[1];
String body = params[2];
@arifsetiawan
arifsetiawan / console.xml
Created May 7, 2015 04:59
my console2 seting. copy to console2 folder
<?xml version="1.0"?>
<settings>
<console change_refresh="10" refresh="100" rows="32" columns="120" buffer_rows="9999" buffer_columns="0" shell="" init_dir="E:\ArifSetiawan" start_hidden="0" save_size="0">
<colors>
<color id="0" r="0" g="0" b="0"/>
<color id="1" r="0" g="0" b="128"/>
<color id="2" r="0" g="150" b="0"/>
<color id="3" r="0" g="150" b="150"/>
<color id="4" r="170" g="25" b="25"/>
<color id="5" r="128" g="0" b="128"/>