2019-05-07

Free Planning Poker

2015-10-14

My Firefox won't paste text! A workaround using AutoHotkey.

In Firefox I often find myself unable to paste into Facebook or YouTube comment boxes. I've been a Mozilla fan since 3.0, but bugs like these make Firefox a pain. Here's a workaround that works in my 64-bit Windows 7:
  1. Install AutoHotkey.
  2. Save this script as "type_clipboard.ahk":
    ; http://www.autohotkey.com/board/topic/76296-type-out-text-in-clipboard/
    ; ctrl+win+v
    ^#v::
        sendraw %clipboard%
    return
  3. Run the script and press Ctrl+Win+V to have AutoHotkey type your clipboard text into Firefox.

2015-03-05

#TheDress

The dress is Coffee and Cool grey according to my new script:

What's that color?

Try these context-dependent colors: rgb(113,94,58) and rgb(135,154,189)

R: G: B: hex

2014-11-04

Cyrillic to Latin

Tired of unreadable Russian characters? Try this JavaScript:
var Cyrillic_Latin = {
 "А":"A", "а":"a",
 "Б":"B", "б":"b",
 "В":"V", "в":"v",
 "Г":"G", "г":"ɡ",
 "Д":"D", "д":"d",
 "Е":"Je", "е":"e",
 "Ё":"Jo", "ё":"jo",
 "Ж":"S", "ж":"s",
 "З":"Z", "з":"z",
 "И":"I", "и":"i",
 "Й":"J", "й":"j",
 "К":"K", "к":"k",
 "Л":"L", "л":"l",
 "М":"M", "м":"m",
 "Н":"N", "н":"n",
 "О":"O", "о":"o",
 "П":"P", "п":"p",
 "Р":"R", "р":"r",
 "С":"S", "с":"s",
 "Т":"T", "т":"t",
 "У":"U", "у":"u",
 "Ф":"F", "ф":"f",
 "Х":"X", "х":"x",
 "Ц":"Ts", "ц":"ts",
 "Ч":"Tj", "ч":"tj",
 "Ш":"Sh", "ш":"sh",
 "Щ":"Sh", "щ":"sh",
 "Ъ":"", "ъ":"",
 "Ы":"E", "ы":"e",
 "Ь":"ʲ", "ь":"ʲ",
 "Э":"E", "э":"e",
 "Ю":"Ju", "ю":"ju",
 "Я":"Ja", "я":"ja",
 "І":"I", "і":"i",
 "Ѳ":"F", "ѳ":"f",
 "Ѣ":"E", "ѣ":"e",
 "Ѵ":"I", "ѵ":"i",
 "Ѕ":"Z", "ѕ":"z",
 "Ѯ":"Ks", "ѯ":"ks",
 "Ѱ":"Ps", "ѱ":"ps",
 "Ѡ":"O", "ѡ":"o",
 "Ѫ":"Ju", "ѫ":"ju",
 "Ѧ":"Ja", "ѧ":"ja",
 "Ѭ":"Ju", "ѭ":"ju",
 "Ѩ":"Ja", "ѩ":"ja"
}

function Cyr2Lat(text){
 var out = ""
 for(i in text) out += Cyrillic_Latin[text[i]] || text[i]
 return out
}
Example:
Cyr2Lat("чем")
"tjem"
Cyr2Lat("форма")
"forma"

Here it is as a bookmarklet that converts the current page (thanks to this snippet):

javascript:(function(){function t(t){var n="";for(var i in t)n+=e[t[i]]||t[i];return n}function n(e){if(e.nodeType==3&&e.nodeValue.trim()!=""){e.nodeValue=t(e.nodeValue)}else{for(var i=e.childNodes.length-1;i>=0;--i){n(e.childNodes[i])}}}var e={"А":"A","а":"a","Б":"B","б":"b","В":"V","в":"v","Г":"G","г":"ɡ","Д":"D","д":"d","Е":"Je","е":"e","Ё":"Jo","ё":"jo","Ж":"S","ж":"s","З":"Z","з":"z","И":"I","и":"i","Й":"J","й":"j","К":"K","к":"k","Л":"L","л":"l","М":"M","м":"m","Н":"N","н":"n","О":"O","о":"o","П":"P","п":"p","Р":"R","р":"r","С":"S","с":"s","Т":"T","т":"t","У":"U","у":"u","Ф":"F","ф":"f","Х":"X","х":"x","Ц":"Ts","ц":"ts","Ч":"Tj","ч":"tj","Ш":"Sh","ш":"sh","Щ":"Sh","щ":"sh","Ъ":"","ъ":"","Ы":"E","ы":"e","Ь":"ʲ","ь":"ʲ","Э":"E","э":"e","Ю":"Ju","ю":"ju","Я":"Ja","я":"ja","І":"I","і":"i","Ѳ":"F","ѳ":"f","Ѣ":"E","ѣ":"e","Ѵ":"I","ѵ":"i","Ѕ":"Z","ѕ":"z","Ѯ":"Ks","ѯ":"ks","Ѱ":"Ps","ѱ":"ps","Ѡ":"O","ѡ":"o","Ѫ":"Ju","ѫ":"ju","Ѧ":"Ja","ѧ":"ja","Ѭ":"Ju","ѭ":"ju","Ѩ":"Ja","ѩ":"ja"};n(document)})()

2014-10-03

Useful comments

While the comments in my Assembly post were useful to beginners, experts who can read the code might find them annoying. Here's an example of helpful comments for experienced programmers:

function delete_month(id, index){
 load_branch(id)
 $(".row[id^="+id+"] .cell:nth-child("+(index+1)+")").each(function(i,e){
  if(i==0 && e.className.indexOf("draggable")<0) return  // only change sandbox budget.
  $(this).nextAll().each(function(i,e){
   this.style.left = (parseInt(this.style.left)-mw)+"px"
   cellBlur(this)  // update availability
  }).addClass("changed")
  $(this).prevAll().addClass("changed")  // needed in case there is no next cell.
  $(this).remove()
 })
 //updateTotals()  // too slow here
 btnSave.value = "Save*"
 setBusy(0)
}
Note that i'm describing WHY the code is there, not HOW it works (which should be obvious to any decent JavaScript coder, who also should have an editor capable of wrapping lines to their preferred width).

2014-09-10

How to freeze a Google Chrome tab

Chrome cares more about speed than user interaction. This simple bug just hung my tab while hogging one CPU core:
function isOverflowed(element){
    return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
}

function resize_to_fit(el){
 var size = parseFloat(el.style.fontSize) || 55
 log("resizing from " + size)
 while(isOverflowed(el) && size > 8){
  el.style.fontSize = size - 1
 }
}
Press Shift+Escape, sort by CPU descending, and end the offending process to recover. Still better than Firefox.

This is what i meant to write, to resize text content to fit an HTML element like a div:
function isOverflowed(element){
 return element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth
}

function resizeToFit(el){
 var size = parseFloat(el.style.fontSize) || 55
 while(isOverflowed(el) && size > 8){
  size -= 1
  el.style.fontSize = size + "px"
 }
}