Skip to content

Instantly share code, notes, and snippets.

View EragonJ's full-sized avatar
🇯🇵
Learning Japanese

Ryu | Chia-Lung Chen EragonJ

🇯🇵
Learning Japanese
View GitHub Profile
@EragonJ
EragonJ / readme.md
Last active August 21, 2019 09:26
Tips you need to know when contributing to Mozilla/Gaia

Why this list ?

There are many times we have contributors who want to contribute to Mozilla/Gaia, but we always would meet some new friends who are not so familiar with our working flows and Git.

In spite of keep telling them how to do that every time, I think it would be better to record screencasts about how to do that step by step. By following these instructions, you can easily jump into the ecosystem of Mozilla without too many obstacles.

Please fasten your seatbelt and let's start to hack :)

How to rebase and fix conflicts ?

作者 c9s (Cornelius) 看板 IronSea
標題 [符] Perl 常用模組
時間 Mon Mar 8 16:16:43 2010
───────────────────────────────────────
Plack
PSGI toolkit and server adapters
see: http://github.com/miyagawa/Plack
window.navigator.mozSetMessageHandler('connection',
function onConnected(request) {
var keyword = request.keyword;
var port = request.port;
port.onmessage = function onReceivedMessage(evt) {
// this is the message you sent
var message = evt.data;
// do whatever you want to do later
};
{
"connections": {
"ftucomms": {
"description": "Communicate between communications/ftu and System",
"rules": {}
}
}
}
if (this.currentStep > this.numTutorialSteps) {
Tutorial.tutorialScreen.classList.remove('show');
Tutorial.tutorialFinish.classList.add('show');
// for large devices, we have to use IAC to tell system ftu is done
if (this.layout !== 'tiny') {
navigator.mozApps.getSelf().onsuccess = function(evt) {
var app = evt.target.result;
app.connect('ftucomms').then(function onConnAccepted(ports) {
ports.forEach(function(port) {
window.addEventListener('iac-ftucomms', function() {
var message = evt.detail;
if (message === 'done') {
self.setBypassHome(true);
}
});
@EragonJ
EragonJ / gist:7366183
Created November 8, 2013 04:14
grep and update
ack -l 'pattern' | xargs perl -pi -E 's/pattern/replacement/g'
@EragonJ
EragonJ / gist:7300364
Created November 4, 2013 09:49
Template 2 with Handlebars.js
<script id="entry-template" type="text/x-handlebars-template">
<div id="tmpl">
<h1 class="header">{{header}}</h1>
<p class="content">{{content}}</p>
</div>
</script>
<body>
<div class="target"></div>
</body>
@EragonJ
EragonJ / gist:7300164
Last active December 27, 2015 08:59
Template 1 with jQuery
$(document).ready(function(){
// you can cache this $tmpl for later use
var $tmpl = $("#tmpl").remove().clone();
$tmpl.find(".header").text("This is header");
$tmpl.find(".content").text("This is Content");
$tmpl.removeClass("hide");
$(".target").append($tmpl);
});
var div = document.getElementsByTagName("div");
for ( var i = 0; i < div.length; i++ ) {
for ( var e = 0; e < elems.length; e++ ) {
div[i].appendChild( elems[e].cloneNode(true) );
}
}