Skip to content

Instantly share code, notes, and snippets.

View MrDHat's full-sized avatar
🍟

Akshay Katyal MrDHat

🍟
View GitHub Profile
@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": [

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.

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
function inherit(proto, literal) {
var result = Object.create(proto);
for (var prop in literal) {
if (literal.hasOwnProperty(prop)) {
result[prop] = literal[prop];
}
}
return result;
}
@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;
@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

B2G Quickstart for Payments and Identity

Before you begin: You want to do this on a Mac. I have been using Linux for months, and unresolved redraw issues (white screen of death) are killing me. Mac works great. Use OSX.

This sets you up to make two separate targets:

  • One for a desktop [simulator] [1]
  • One for the Unagi [device] [2]

These are the moving parts:

  • [mozilla-inbound repo] [3] clone (hg)
[ui]
merge = kdiff3
username = Akshay Katyal <ktyaks@gmail.com>
[diff]
# git diff is required so binary files don't break
git = 1
showfunc = True
unified = 8
## .mozconfig for Firefox desktop (not b2g)
# Import the stock config for building the browser (Firefox)
. $topsrcdir/browser/config/mozconfig
# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=../build_mc
# -s makes builds quieter by default
## Firefox b2g
ENABLE_MARIONETTE=1
# Import the stock config for building the browser (Firefox)
. $topsrcdir/browser/config/mozconfig
# Define where build files should go. This places them in the directory
# "obj-ff-dbg" under the current source directory
mk_add_options MOZ_OBJDIR=../build_trunk_b2g