Skip to content

Instantly share code, notes, and snippets.

View bangbambang's full-sized avatar

Bambang Catur Pamungkas bangbambang

View GitHub Profile
-module(dispatcher).
-export([dispatch/2]).
dispatch(_, []) -> none;
dispatch(Req, [{Regexp, Handler}|T]) ->
"/" ++ Path = Req:get(path),
Method = Req:get(method),
Match = re:run(Path, Regexp, [global, {capture, all_but_first, list}]),
case Match of
{match, [MatchList]} ->
@bangbambang
bangbambang / nginx.conf
Created January 3, 2014 18:40
Konfig nginx Win7
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
#download paket
ngaur() {
cd ~/abs/aur/;
curl -# https://aur.archlinux.org/packages/${1:0:2}/$1/$1.tar.gz | /bin/tar -xz ;
}
#kompilasi dan instalasi paket
nginstall() {
cd ~/abs/aur/$1 && makepkg -si;
}
<?php
add_theme_support('menus');
/**
* Register Menus
* http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'
@bangbambang
bangbambang / prtscr
Created September 23, 2013 19:48
ganti USER_ID_ANDA dengan user id dropbox anda. ganti juga PATH_KE_FOLDER_DROPBOX dengan path beneran :D
#! /bin/sh
FILENAME=$(date +%F_%H%M%S_%N).png;
URL=https://dl.dropboxusercontent.com/u/USER_ID_ANDA/scrot/$FILENAME;
if [[ $# -eq 0 ]]; then
import -window root /PATH_KE_FOLDER_DROPBOX/$FILENAME;
elif [[ $# -eq 1 && $1=='a' ]]; then
import /PATH_KE_FOLDER_DROPBOX/$FILENAME;
fi
echo $URL | xclip -selection clipboard;
echo saved: $URL;
# use imagemagick to take screenshot and sync automatically to Dropbox
crot() {
import -window root /home/bambang/Dropbox/Public/scrot/$(date +%F_%H%M%S_%N).png;
}
# same as above, but area-specific (select with mouse)
crit() {
import /home/bambang/Dropbox/Public/scrot/$(date +%F_%H%M%S_%N).png;
}
<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=edge,chrome=1"
# `mod_headers` can't match based on the content-type, however, we only
# want to send this header for HTML pages and not for the other resources
<FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$">
Header unset X-UA-Compatible
</FilesMatch>
</IfModule>
<IfModule mod_autoindex.c>