Skip to content

Instantly share code, notes, and snippets.

View noomz's full-sized avatar

Siriwat Uamngamsup noomz

View GitHub Profile
@noomz
noomz / js-gis-library.md
Created June 12, 2014 04:20
Javascript GIS library
@noomz
noomz / whenexample.js
Created June 11, 2014 02:49
When example
'use strict';
var when = require('when');
var check = function(value) {
// return promise here and then ready to run next expression without waiting.
return when.promise(function(resolve, reject) {
// simulate delay task.
setTimeout(function() {
if (value === 0) {
// async
var async = require('async');
async.parallel([
function(callback) {
Check.find({ status: 1 }).exec(callback);
},
function(callback) {
Check.find({ status: 2 }).exec(callback);
}
# reg-exp
import re
# use pyserial
import serial
from time import sleep
def checkOK():
isOK = False
lines = ser.readlines()
for line in lines:
@noomz
noomz / gist:7194254
Created October 28, 2013 10:04
Sample apache2 virtual host file
<VirtualHost *:80>
ServerName noomz.in.th
DocumentRoot /var/www/noomz.in.th/html/
<Directory /var/www/noomz.in.th/html/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
@noomz
noomz / gist:7193904
Last active December 26, 2015 18:19
Setup web server on ubuntu 12.04 LTS
# Install apache2 via tasksel
sudo tasksel install lamp-server
# Add user
adduser noomz
# Add user to admin (sudo-able) group
usermod -a -G adm,sudo,www-data noomz
# Logout from root and login as user we have just created
set shiftwidth=2
set tabstop=2
set expandtab
set nu
set ai
set smartindent
map! <F2> <C-x><C-p>
if has("autocmd")
" Drupal *.module and *.install files.
@noomz
noomz / index.php
Created August 30, 2013 14:21
Image zoom
<!DOCTYPE html>
<html>
<head>
<title>x</title>
<link rel="stylesheet" type="text/css" href="main.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<div id="x">
@noomz
noomz / gist:5924690
Created July 4, 2013 03:24
script เอาไว้ลบ like ที่ตั้วกดไว้
as=document.getElementsByTagName('a');for(i in as){if(as[i] && as[i].href && as[i].href.match(/tua\.sarocha$/)){as[i].remove();}}
@noomz
noomz / .htaccess
Created June 23, 2013 14:41
Force browser download any file in directory
SetEnvIf Request_URI "^.*/([^/]*)$" FILENAME=$1
Header set "Content-disposition" "attachment; filename=%{FILENAME}e"
UnsetEnv FILENAME