Skip to content

Instantly share code, notes, and snippets.

View noomz's full-sized avatar

Siriwat Uamngamsup noomz

View GitHub Profile
SimpleBroadcast = (function () {
var sub = {};
return {
publish: function (topic, data) {
data = data || {};
(sub[topic] || []).forEach(function (func) {
func(data);
});
@noomz
noomz / clear-yammer.js
Created May 29, 2013 02:43
Clear yammer unread inbox
// Browse to yammer company's home page, then click inbox (mail) link,
// after that run this script in javascript console
var clearYammer = function (interval) {
jQuery('.yj-inbox-list-item').eq(0).trigger('click');
setTimeout(function () {
history.back();
clearYammer(interval);
}, interval);
@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
@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 / 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">
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 / 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
@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>
# reg-exp
import re
# use pyserial
import serial
from time import sleep
def checkOK():
isOK = False
lines = ser.readlines()
for line in lines:
// async
var async = require('async');
async.parallel([
function(callback) {
Check.find({ status: 1 }).exec(callback);
},
function(callback) {
Check.find({ status: 2 }).exec(callback);
}