http://www.ersinakinci.com/riot-js-gotchas/
http://happy-css.com/lessons/riotjs/
http://riotgear.js.org/
http://ricostacruz.com/cheatsheets/riot.html
Apr 2, 2016
Jan 5, 2016
PEP8 Fix on save
komodo.assertMacroVersion(3);
if (komodo.view.scintilla) {
komodo.view.scintilla.focus();
} // bug 67103
var koDoc = (komodo.koDoc === undefined ? komodo.document : komodo.koDoc);
var formatter = null;
var onlyWholeFile = false;
switch (koDoc.language) {
case 'Python':
case 'Python3':
formatter = 'autopep8 --aggressive -';
break;
}
// Save cursor Position
try {
if (formatter) {
// Group operations in a single undo
// Select Buffer, pipe it into formatter.
var wholeFile = onlyWholeFile || komodo.editor.selText == '';
var currentPos = komodo.editor.currentPos;
komodo.editor.beginUndoAction();
if (wholeFile) {
komodo.doCommand('cmd_selectAll');
}
ko.run.runEncodedCommand(window, formatter + " {'insertOutput': True, 'operateOnSelection': True}");
komodo.editor.gotoPos(currentPos);
}
} catch (e) {
alert(e);
}
finally {
komodo.editor.endUndoAction();
}
Nov 30, 2015
Auto format code in Komodo
This is a macro in Javascript to align, fixing and make code auto-beautified.
Tested with Komodo Edit 8/9.
/*
Install dependencies:
pip install --upgrade autopep8
pip3 install --upgrade autopep8
brew install astyle
brew install tidy-html5
brew install homebrew/php/php-cs-fixer
gem install ruby-beautify
*/
komodo.assertMacroVersion(3);
if (komodo.view.scintilla) {
komodo.view.scintilla.focus();
} // bug 67103
var koDoc = (komodo.koDoc === undefined ? komodo.document : komodo.koDoc);
var formatter;
var language = koDoc.language;
var cannot_tidy_selection = false;
switch (language) {
case 'C#':
cannot_tidy_selection = true;
formatter = 'astyle --style=ansi --mode=cs --convert-tabs --indent=spaces=4 %F > /dev/null 2>&1; cat %F';
break;
case 'C++':
cannot_tidy_selection = true;
formatter = 'astyle --style=linux --mode=c --convert-tabs --indent=spaces=4 %F > /dev/null 2>&1; cat %F';
break;
case 'CSS':
formatter = 'csstidy - --preserve_css=true --lowercase_s=true --case_properties=true --sort_properties=true --remove_bslash=false --silent=true --template=medium';
break;
case 'HTML5':
case 'HTML':
cannot_tidy_selection = true;
formatter = 'tidy -q -i -b -c -w 120 --show-warnings no --show-errors 0 --tidy-mark no --css-prefix block --drop-proprietary-attributes yes --anchor-as-name no --enclose-text yes';
break;
case 'Java':
cannot_tidy_selection = true;
formatter = 'astyle --style=java --mode=java --convert-tabs --indent=spaces=4 %F > /dev/null 2>&1; cat %F';
break;
case 'Perl':
formatter = 'perltidy';
break;
case 'PHP':
cannot_tidy_selection = true;
formatter = 'php php-cs-fixer.phar fix %F';
break;
case 'Python':
case 'Python3':
cannot_tidy_selection = true;
formatter = 'autopep8 --in-place --aggressive %F';
break;
case 'Ruby':
formatter = 'rbeautify.rb -';
break;
case 'XSLT':
cannot_tidy_selection = true;
formatter = 'tidy -q -xml -i -w 120 --show-warnings no --show-errors 0 --tidy-mark no';
break;
case 'XML':
cannot_tidy_selection = true;
formatter = 'xmllint --format --recover -';
break;
default:
alert("Syntax Undefined, Add Case to Macro " + language);
return null;
}
// Save cursor Position
var currentPos = komodo.editor.currentPos;
try {
// Save the file, Check Changes with "File -> Show Unsaved Changes"
komodo.doCommand('cmd_save');
// Group operations in a single undo
// Select Buffer, pipe it into formatter.
var text_not_selected = cannot_tidy_selection || komodo.editor.selText == "";
if (text_not_selected) {
komodo.doCommand('cmd_selectAll');
ko.run.runEncodedCommand(window, formatter + " {'insertOutput': True}");
} else {
ko.run.runEncodedCommand(window, formatter + " {'insertOutput': True, 'operateOnSelection': True}");
}
komodo.doCommand('cmd_cleanLineEndings');
if (text_not_selected) {
// Reload file
var view = ko.views.manager.currentView;
if (view) {
// Ref: http://docs.activestate.com/komodo/9.0/macroapi.html#macroapi_file
var currentURI = koDoc.file.URI,
currentLine = view.scimoz.lineFromPosition(komodo.editor.currentPos);
// now close and re-open
view.closeUnconditionally(); // or close()
ko.open.URI(currentURI + "#" + currentLine);
}
}
StatusBar_AddMessage("Formatted");
}
catch (e) {
alert(e);
}
finally {
// End Undo Action to Avoid Edit Buffer Corruption
// komodo.editor.endUndoAction();
return true;
}
Sep 6, 2015
Go language in weekend
I'm curious about Go language. I found it more like Python than C, such as import, len, multiple assignment...
Very good resources on it:
http://openmymind.net/The-Little-Go-Book/
https://www.gitbook.com/book/codegangsta/building-web-apps-with-go/details
Very good resources on it:
http://openmymind.net/The-Little-Go-Book/
https://www.gitbook.com/book/codegangsta/building-web-apps-with-go/details
Aug 15, 2015
Woodwork resources
Woodworking for beginners
https://www.gutenberg.org/files/43604/43604-h/43604-h.htm
CARPENTRY FOR BOYShttps://www.gutenberg.org/files/20763/20763-h/20763-h.htm
Joints
https://www.gutenberg.org/files/21531/21531-h/21531-h.htm
Handwork in wood
https://www.gutenberg.org/files/20846/20846-h/20846-h.htm
Seasoning of wood
https://www.gutenberg.org/files/26598/26598-h/26598-h.htm
https://www.gutenberg.org/files/43604/43604-h/43604-h.htm
CARPENTRY FOR BOYShttps://www.gutenberg.org/files/20763/20763-h/20763-h.htm
Joints
https://www.gutenberg.org/files/21531/21531-h/21531-h.htm
Handwork in wood
https://www.gutenberg.org/files/20846/20846-h/20846-h.htm
Seasoning of wood
https://www.gutenberg.org/files/26598/26598-h/26598-h.htm
Aug 13, 2015
A new setup for web reverse proxy
I'm feed up with setup /etc/hosts and nginx just to have some name proxy to a port on localhost.
I think there is a better way to do it.
My idea is: Browser <-> dnsmasq (dns) / (proxy server) Squid <-> Python / nginx / ...
http://passingcuriosity.com/2013/dnsmasq-dev-osx/
http://derpturkey.com/squid-as-a-reverse-proxy/
I think there is a better way to do it.
My idea is: Browser <-> dnsmasq (dns) / (proxy server) Squid <-> Python / nginx / ...
http://passingcuriosity.com/2013/dnsmasq-dev-osx/
http://derpturkey.com/squid-as-a-reverse-proxy/
Aug 7, 2015
Real easte references in Japan
Look up for actual transaction real easte price:
http://www.land.mlit.go.jp/webland/servlet/MainServlet
Glossary
http://www.nomu.com/glossary/law/
Some interesting terms:
おとり広告
is some kind of ads for "luring" customers, with unfeasible ads to trade, or settled false deal. This action is forbid by law.
http://www.land.mlit.go.jp/webland/servlet/MainServlet
Glossary
http://www.nomu.com/glossary/law/
Some interesting terms:
おとり広告
is some kind of ads for "luring" customers, with unfeasible ads to trade, or settled false deal. This action is forbid by law.
http://www.nomu.com/glossary/law/417.html
Subscribe to:
Posts (Atom)