Skip to content

Instantly share code, notes, and snippets.

View noomz's full-sized avatar

Siriwat Uamngamsup noomz

View GitHub Profile
@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);
SimpleBroadcast = (function () {
var sub = {};
return {
publish: function (topic, data) {
data = data || {};
(sub[topic] || []).forEach(function (func) {
func(data);
});
@noomz
noomz / pyramid.js
Created November 26, 2012 10:57
Pyramid
// This require Node.js framework to complete the test case.
var pyramid = function (row, char, bg) {
if (row < 1) {
throw new Error("Row must be greater than 0.");
}
bg = bg || ' ';
var lastRowNumChar = calculateNumChar(row - 1),
@noomz
noomz / pomodoro.rb
Created July 14, 2012 10:50 — forked from pcreux/pomodoro
Pomodoro timer for ubuntu unity
#!/usr/bin/env ruby
#
# Pomodoro script.
#
# Displays a notification after given minutes.
# Use pomodoro.rb with args 10 = 10 min, 10s = 10 seconds
#
# Don't forget to 'sudo apt-get install libnotify-bin'
#
var request = require('request'),
twitter = require('twitter'),
mysql = require("mysql");
var client = mysql.createClient({
database: 'earthquake',
user: 'root'
});
twit = new twitter({
@noomz
noomz / eventsfetch.php
Created October 22, 2011 17:17
thaiflood events fetch
<?php
error_reporting(E_ALL ^ E_NOTICE);
define('EVENTTABLE', 'events');
// Config
$dbconfig = array(
'host' => 'localhost',
'user' => 'root',
'pass' => 'qwer',
@noomz
noomz / gist:1094343
Created July 20, 2011 04:37
for natz
/*!
* Copyleft (c) 2011 ${name}.
* Licensed under the ${license} license.
*
* @version ${Version}
*/
var correctThaiFloatingVowel = function (text, anchor, el, options) {
/**
* @return string from character code provided.
import csv
def clean_cells(row):
row_out = []
for cell in row:
cell = cell.strip().strip(' ').strip('-').strip()
if cell == '*': cell = ''
if cell == 'N/A': cell = ''
row_out.append(str(cell))
<?php
$cities = array(
"Bangkok" => "กรุงเทพมหานคร",
"Krabi" => "กระบี่",
"Kanchanaburi" => "กาญจนบุรี",
"Kalasin" => "กาฬสินธุ์",
"Kamphaeng Phet" => "กำแพงเพชร",
"Khon Kaen" => "ขอนแก่น",
"Chanthaburi" => "จันทบุรี",
"Chachoengsao" => "ฉะเชิงเทรา",