Skip to content

Instantly share code, notes, and snippets.

On the way to refactoring

othree othree

On the way to refactoring
Block or report user

Report or block othree

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:103687
int i = 0
if (i == 0) {
// blah...
for (i = 0;i < 10;i++) {
if (i == 0) i++;
// do something same as blah...
View gist:125373
View gist:173967
function moveLast(target) {
if (target.nodeName.toLowerCase() != 'input' || target.type != 'text') return false;
var pos = target.value.length;
if (target.createTextRange) {
var range = target.createTextRange();
range.move("character", pos);;
} else if (target.setSelectionRange) {
target.setSelectionRange(pos, pos);
View plurk and :w.js
// ==UserScript==
// @name Plurk and :w
// @fullname Plurk and :w
// @author othree
// @version 2009-09-09
// @licence (CC) by
// @namespace
// @description strip :w for plurk
// @include*
// ==/UserScript==
View murmur and :w.js
var form = document.getElementById('add-murmur');
form.onsubmit = function (evt) {
var target = form.getElementsByTagName('input')[0];
var text = target.value;
target.value = text.replace(/\s*:w$/, "");
return true;
othree / gist:182971
Created Sep 8, 2009
[vimrc] Auto compile JS/CSS file after saving it.
View gist:182971
function Js_css_compress ()
let cwd = expand('<afile>:p:h')
let nam = expand('<afile>:t:r')
let ext = expand('<afile>:e')
if -1 == match(nam, "[\._]src$")
let minfname = nam.".min.".ext
let minfname = substitute(nam, "[\._]src$", "", "g").".".ext
if ext == 'less'
View Screen Fix.vim
" Screen fix
if &term =~ '^screen'
set t_k1=^[[11~
set t_k2=^[[12~
set t_k3=^[[13~
set t_k4=^[[14~
View 小梅&支倉
支倉「好啊、有什麼事請指教小梅老師(*゜ー゜) 」
支倉「請說(*゜ー゜) 」
支倉「……(*゜ー゜) 」
支倉「是怎樣的情色法呢?(*゜ー゜) 」
支倉「快....壞掉是嗎(*゜ー゜) 」
View gist:573954
"" javascript behavior for acp
function AcpMeetsForJavaScript(context)
let matches = matchlist(a:context, '\(\k\{1}\)$')
if empty(matches)
return 0
return 1
"" html behavior for html
View Readability bug
I found Readability is very useful but not work on my blog.
So I spent some time to trace the problem.
Maybe you can fix this problems in next release.
1. Blank Page: I use google chrome and so a blank page on my blog (using html5 doctype).
It is because the code within line 335-347. There are some entities used in innerHTML.
Which is not allowed in some doctypes.
There are only three safe entities &amp; , $lt; and $gt; .
You can’t perform that action at this time.