Skip to content

Instantly share code, notes, and snippets.

View masotime's full-sized avatar
💭
I may be slow to respond.

Benjamin Goh masotime

💭
I may be slow to respond.
  • San Francisco
  • 00:38 (UTC -08:00)
View GitHub Profile
@masotime
masotime / ellipsis-detection.js
Last active August 29, 2015 14:26
Determining if one-liner span has ellipsis overflow
function getVisibleWidth(elem) {
// cross browser, returns decimals for ultra-precision
return elem.getBoundingClientRect().right - elem.getBoundingClientRect().left;
}
function getNaturalWidth(elem) {
var old = {
overflow: elem.style.overflow,
width: elem.style.width,
display: elem.style.display
@masotime
masotime / index.js
Created May 14, 2015 23:06
sudoku-generator-WIP
(function sudokuGenerator() {
'use strict';
var test4 = [
1, 2, 3, 4,
3, 4, 1, 2,
2, 3, 4, 1,
4, 1, 2, 3
];
@masotime
masotime / install.sh
Created November 12, 2012 02:40
Quick script to set up yeoman on a Mac
#!/bin/bash
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
brew doctor
sudo gem update --system
gem install compass
brew install phantomjs
brew install jpeg-turbo && brew link jpeg-turbo
brew install optipng
sudo npm install -g yeoman