Skip to content

Instantly share code, notes, and snippets.

View MrDHat's full-sized avatar
🍟

Akshay Katyal MrDHat

🍟
View GitHub Profile
@MrDHat
MrDHat / Hacking on B2G moz-central
Created July 31, 2013 18:53
Awesome explanation by jdep
<jedp> getting started https://developer.mozilla.org/en-US/docs/Mozilla/Firefox_OS/Preparing_for_your_first_B2G_build
<jedp> slightly out of date, but basically the right steps: https://gist.github.com/jedp/3778932
<jedp> where it says mozilla-inbound, use mozilla-central instead
<jedp> a file called .mozconfig
<jedp> a b2g desktop mozconfig http://www.pastebin.mozilla.org/2752657
<jedp> instead of console.log … used dump("some message\n")
<jedp> to build
<jedp> ./mach build
<jedp> no more make -f client.mk
<jedp> don't do that
@MrDHat
MrDHat / EventEmmiter.js
Last active December 19, 2015 15:48
A Pub/Sub API (Originally written for Gaia)
this.EventEmmiter = (function() {
var events = {};
var UUID = -1;
// Function to publish/trigger events
function trigger(evt, args) {
if (!events[evt]) {
return false;
function inherit(proto, literal) {
var result = Object.create(proto);
for (var prop in literal) {
if (literal.hasOwnProperty(prop)) {
result[prop] = literal[prop];
}
}
return result;
}

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after

ETags: a pretty sweet feature of HTTP 1.1

HTTP caching review

HTTP provides two ways for servers to control client-side caching of page components:

  • freshness may be based on a date or a token whose meaning is app-specific
  • whether or not the client needs to confirm the cached version is up-to-date with the server

This breaks down as follows:

  • Cache locally and don't check before using.
@MrDHat
MrDHat / PiCl-Contacts-JSON
Last active December 16, 2015 21:49
Firefox OS Contacts PiCL Sample Data Format
{
"id": "some_id",
"version": "verson_no",
"timstamp": "timestamp_at_which_product_was_last_modified",
"payload": [
{
"startIndex": 10,
"itemsPerPage": 10,
"totalResults": 12,
"entry": [