Skip to content

Instantly share code, notes, and snippets.

View arifsetiawan's full-sized avatar

arif setiawan arifsetiawan

View GitHub Profile
@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-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"/>
@arifsetiawan
arifsetiawan / pedantically_commented_playbook.yml
Last active August 29, 2015 14:27 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@arifsetiawan
arifsetiawan / uploadsimple.js
Created November 28, 2011 17:27
upload form
var express = require('express');
// express setup
var app = express.createServer();
app.use(express.bodyParser());
app.get('/', function(req, res){
res.writeHead(200, {'content-type': 'text/html'});
res.end(
'<form action="/upload" enctype="multipart/form-data" method="post">'+
@arifsetiawan
arifsetiawan / snaplist
Created June 18, 2012 09:52
horizontal page list view
ListView {
id: contentView
anchors.fill: parent
highlightRangeMode: ListView.StrictlyEnforceRange
orientation: ListView.Horizontal
snapMode: ListView.SnapOneItem
clip: true
model: internalContentModel