Skip to content

Instantly share code, notes, and snippets.

View othree's full-sized avatar
:accessibility:
On the way to refactoring

othree othree

:accessibility:
On the way to refactoring
View GitHub Profile

JavaScript 品質工具:CodePaint 與 Plato

介紹協助提昇 F2E Code Style 的兩個工具。

分享者

josephj@faria

問題

let behavs = { 'javascript': [], 'html': [] }
call add(behavs.javascript, {
\ 'command' : "\<C-x>\<C-u>",
\ 'completefunc' : 'acp#completeSnipmate',
\ 'meets' : 'acp#meetsForSnipmate',
\ 'onPopupClose' : 'acp#onPopupCloseSnipmate',
\ 'repeat' : 0,
\})
call add(behavs.javascript, {
\ 'command' : g:acp_behaviorKeywordCommand,
@othree
othree / 0_reuse_code.js
Last active August 29, 2015 14:10
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
var T = function (id) {
var p = new Promise(function (resolve) {
setTimeout(function () {
console.log(id, 'resolved');
resolve(id);
}, Math.random()*3000);
});
return p;
var removeElements = function(head, val) {
if (head === null) { return null; }
if (head.val === val) {
return removeElements(head.next, val);
} else {
head.next = removeElements(head.next, val);
}
return head;
};
var rangeBitwiseAnd = function(m, n) {
if (m === 0) { return 0; }
if (m === n) { return m; }
var min = m;
var l2m = Math.floor(Math.log2(m)) + 1;
var l2n = Math.floor(Math.log2(n)) + 1;
if (l2m !== l2n) { return 0; }
@othree
othree / convert_textile_to_markdown.rake
Created June 4, 2015 08:25
redmine_convert_textile_to_markdown.rake
task :convert_textile_to_markdown => :environment do
require 'tempfile'
WikiContent.all.each do |wiki|
([wiki] + wiki.versions).each do |version|
textile = version.text
src = Tempfile.new('textile')
src.write(textile)
src.close
dst = Tempfile.new('markdown')
dst.close
git config --global alias.user '!f() { if [ "$1" = "360" ]; then git config user.name "othree"; git config user.email othree@360.cn; else git config user.name "othree"; git config user.email othree@gmail.com; fi; }; f'
{
"celebrate":"BQADBQADhwADMqsKAuEXXyu4ilLCAg",
"busy bee":"BQADBQADogADMqsKAiykgKeu_QqfAg",
"enthusiast":"BQADBQADpAADMqsKAvrSFOHsu44HAg",
"evergreen":"BQADBQADpgADMqsKAuYN0dN0aGTUAg",
"middle manager":"BQADBQADqAADMqsKAvnjyOmGak8JAg",
"stalwart":"BQADBQADqgADMqsKAruaTkuu2qMjAg",
"wizard":"BQADBQADrAADMqsKAsOBf5BSdIygAg",
"happy":"BQADBQADrgADMqsKAk-8VDZI5syBAg",
"angry":"BQADBQADsAADMqsKAsjoJq9W1mnJAg",