Super fast js templating library

ref: http://jsperf.com/string-format-underscore-vs-hot

var template = {};
template.format = function(string, context){
    return string.replace(/\{(\S+)\}/g), function(str, key){ return context[key]; });
};
// using
// template.format(“{x}”, { x: 1 });
// template.format(“{x}, {y}”, { x: 1, y: 2 });

but it will only supported “replace variable”
no more condition or loop in template string :p

useful for simple replace variable

Link

ศาสตร์และศิลป์ที่สอนในเมืองไทย

ศาสตร์และศิลป์ที่สอนในเมืองไทย

น่าสนใจนะ
น่าจะเอามาสร้างเป็น web application ที่ list รายวิชาทั้งหมดในทุกๆมหาวิทยาลัย และเปิดให้สามารถแสดงความคิดเห้นได้ด้วย

ใช้ dropbox เป็น git repository

ref: http://ianoxley.com/blog/2012/12/22/dropbox-remote/

1. สร้าง folder งานใน dropbox
2. ถ้าคุณติดตั้ง git bash for window ไปแล้ว ก็คลิ๊กขวาเลือห “git init here” เพื่อสร้าง git repository ใน dropbox โดยจะสร้างโฟลเดอร์ .git

ทีนี้ใน dropbox folder นั้นก็จะกลายเป็น git repository 
เพราะว่าเมื่อไฟล์มีการเปลี่ยนแปลงก็จะมีการอัพเดทไฟล์ใน dropbox ด้วย
ซึ่งข้อมูลของ branch ก็จะถูกเก็บไว้ในโฟลเดอร์ .git เสมอๆ

เหมือน git server แป๊ะๆ

ฤษีแปลงสาส์น กับ ฟังไม่ได้ศัพท์จับไปกระเดียด

จากข่าวใน FB

โพลเผย “เฉลิม อยู่บำรุง” เหมาะสมที่จะเป็นนายกรัฐมนตรีคนต่อไป หากเกิดอุบัติเหตุทางการเมือง http://news.sanook.com/1179778/

ใครเห็นพาดหัวแบบนี้คงใจหายกันหมด

แต่ถ้าตามไปดูข้อมูลในข่าวจริงๆแล้วจะพบว่า
50% บอกว่ายังไม่มีคนเหมาะสม
8% บอกว่าเหลิมโอเค

และก็ยังไม่สรุปว่า ตอนนี้ยังไม่มีใครเหมาะสม
แต่ข่าวเสือกพาดหัวว่า “โพลบอกว่าเหลิมเหมาะที่จะเป็นนายกคนต่อไป…”

มันคนละข้อความ คนละผลลัพท์ คนละความหมายกับโพลเลยนะ

ต้องบอกว่าสื่อสมัยนี้ชอบทำตัวเป็น ฤษีแปลงสาส์น
ส่วนคนอ่านก็เป็นพวก ฟังไม่ได้ศัพท์จับไปกระเดียด

กลุ้ม 😦

Link

a fast and lightweight javascript utility that detects browser vendor, touch features and retina displays

a fast and lightweight javascript utility that detects browser vendor, touch features and retina displays

น่าขะเล็กและไวกว่า Modernizr เยอะ

ใช้งานผ่านฟังก์ชั่น Conditionizr() โดยใส่ option ที่จะเป็นตัวกำหนดการทำงานภายใต้ condition ต่างๆ
เช่น

{
  debug: true // disable/enable console.log
  ieLessThan: {
    version: 9 // if IE less than version 9 then
    scripts: false, // disable scripts
    styles: false, // disable styles 
    classes: true // add ‘lt-ie9’ class to the <html> tag
  }
}