Skip to content

Instantly share code, notes, and snippets.

View rnewman's full-sized avatar

Richard Newman rnewman

  • AWS
View GitHub Profile
@rnewman
rnewman / gist:26cdd2d5845e0dc0e636
Created February 1, 2016 23:06
Basic merging output.
Deleted locally:
Deleted remotely:
Deleted from mirror:
Root:
[V: □ M □ root________ Unchanged ]
[S: Unchanged ]
..
[V: □ M L menu________ Local ]
[S: Local ]
..
@rnewman
rnewman / gist:3b498b8ad586893279b2
Created January 13, 2016 01:44
Making Xcode faster
* If you use SourceTree, command line Git, etc:
* Preferences > Source Control > uncheck Enable Source Control.
* This will also stop Xcode from screwing up your `git rebase` calls by taking the lock file!
* Hide the sidebars.
* Disable live issues.
* Preferences > General > Show live issues.
* Turn off compiler warnings for subprojects (e.g., deprecation warnings for Breakpad).
* Sidebar: click "Breakpad.xcodeproj". Build Settings > search for "Deprecated Functions", set the middle two columns to "No".
@rnewman
rnewman / gist:ac0ffe4f7a86d149b42a
Created December 7, 2015 19:13
--reviewid didn't do what I expected
$ hg push --reviewid 27327 review (12-07 11:11)
pushing to ssh://reviewboard-hg.mozilla.org/gecko
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 7 changesets with 9 changes to 16 files (+1 heads)
remote: recorded push in pushlog
submitting 7 changesets for review
@rnewman
rnewman / bookmark-sync-2.md
Created December 5, 2015 01:58
Bookmark Sync 2

Implementing bookmarks sync… again

Since our first installment we've implemented batched downloading for bookmarks: Bug 1201108.

This incrementally populates a local snapshot of the server (initially termed the ‘mirror’, now more accurately renamed the ‘buffer’), validating each record and fitting the contents into a relational schema. As it processes folders it also fills a table with the top-down structure of the downloaded records. We can be confident that when the downloader finishes, we'll have everything the server currently contains, minus any records that aren't well-formed.

What's next?

We're not done with schema changes: Bug 1201110. The buffer is a blind and forgetful one: it truly represents the current state of the server. We need more than that to sync — in order to find out what changed on each end since we last synced we n

2015-10-06 20:02:38.834 [Debug] [Profile.swift:675] syncSeveral > Syncing bookmarks…
2015-10-06 20:02:38.834 [Debug] [Profile.swift:619] mirrorBookmarksWithDelegate(_:prefs:ready:) > Mirroring server bookmarks to storage.
2015-10-06 20:02:38.834 [Info] [Synchronizer.swift:130] init(scratchpad:delegate:basePrefs:collection:) > Synchronizer configured with prefs 'synchronizer.bookmarks.'.
2015-10-06 20:02:38.835 [Debug] [Profile.swift:761] greenLight() > Checking green light. Backgrounded: false.
2015-10-06 20:02:38.835 [Info] [BookmarksDownloader.swift:176] init(collectionClient:basePrefs:collection:) > Downloader configured with prefs 'downloader.bookmarks.'.
2015-10-06 20:02:38.835 [Debug] [BookmarksDownloader.swift:127] go(_:greenLight:) > Downloading up to 100 records.
2015-10-06 20:02:38.836 [Debug] [BookmarksDownloader.swift:239] go(_:limit:) > Modified: 1444186946620; last 1444186729270.
2015-10-06 20:02:38.836 [Debug] [BookmarksDownloader.swift:259] downloadNextBatchWithLimit(_:advancingOnCompletionTo:
/*
I'm trying to define a method in a protocol that's generic,
then implement it in a class and allow the class to also have
a member that refers to that type.
*/
class AAA {
let a: String
init(a: String) {
self.a = a
@rnewman
rnewman / bookmark-sync-1.md
Last active December 2, 2017 00:48
Bookmark Sync 1

Designing bookmark sync… again

For the second time, I'm building an implementation of bookmark sync on a new platform. The last one, in early 2012, was Firefox for Android. That turned out relatively well, considering the circumstances, but it didn't go far enough in avoiding some ancient errors baked into the desktop codebase.

For Firefox on iOS we have a new set of platform constraints and a strong desire to avoid some of the known pitfalls. This post sets out some of the considerations. A future post will set out the proposed solution.

Our goal: keep a tree of bookmarks in sync across multiple devices.

Syncs occur to and from a server. Devices don't communicate directly.

@rnewman
rnewman / gist:cbaa0b7eb4619de62a8b
Created August 27, 2015 13:41
Sync horrors from 2012
19:50 <@rnewman> well, this might be a problem.
19:50 <@rnewman> 0:01.90 Sync.Engine.Bookmarks DEBUG Mapped: Bookmarks Toolbar,fTaggy tag,fake-guid-1,false
19:50 <@rnewman> 0:01.90 Sync.Engine.Bookmarks DEBUG Finding mapping: , fBookmarks Toolbar
19:50 <@rnewman> 0:01.90 Sync.Engine.Bookmarks DEBUG Mapped dupe: toolbar
19:50 <@rnewman> 0:01.90 Sync.Engine.Bookmarks DEBUG zzzzzzzzzzzz mapped to toolbar 0:01.90 Sync.Engine.Bookmarks DEBUG Local item toolbar is a duplicate for incoming item zzzzzzzzzzzz 0:01.90 Sync.Store.Bookmarks DEBUG Number of rows matching GUID toolbar: 0
19:50 <@rnewman> trivial test
19:50 <@rnewman> create a folder on a client somewhere
19:50 <@rnewman> name it "Bookmarks Toolbar"
19:51 <@rnewman> any desktop client that applies that record is gonna have a bad time.
19:51 * rnewman tries it for real
historyID url title guid domain_id domain localVisitDate remoteVisitDate localVisitCount remoteVisitCount frecency
---------- ---------------------------------------------------- ------------- ------------ ---------- ------------- -------------------- --------------- --------------- ---------------- ----------------
8055 http://www.ericajong.com/poems/autumnperspective.htm 404 Not Found VfZh4ANR4Eab 516 ericajong.com 1.43949352420582e+15 0 7 0 8365.95843605489
4684 https://irccloud.mozilla.com/#!/ircs://irc1.dmz.scl3 * #mobile | M kjktO6fWWlek 857 irccloud.mozi 1.43553051130267e+15 1.4394982251373 1 521 5679.44351381141
8230 http://www.thekitchenwhisperer.net/2012/07/15/better Better than r TKOaEazO7Dzz 1035 thekitchenwhi 1.43939192547637e+15 0 4 0
@rnewman
rnewman / failure.log
Created August 6, 2015 02:14
Startup race in browser DB.
2015-08-05 19:13:13.859 [Info] [Profile.swift:177] init(localName:app:): New profile. Removing old account data.
2015-08-05 19:13:13.868 [Debug] [BrowserDB.swift:73] init(filename:secretKey:files:): Initializing BrowserDB.
2015-08-05 19:13:13.869 [Debug] [BrowserDB.swift:142] createOrUpdate: Create or update tableList version 1.
2015-08-05 19:13:13.874 [Debug] [BrowserDB.swift:92] createTable(_:table:): Try create tableList version 1
2015-08-05 19:13:13.875 [Debug] [SwiftData.swift:125] transaction: Op in transaction succeeded. Committing.
2015-08-05 19:13:13.876 [Debug] [BrowserDB.swift:142] createOrUpdate: Create or update favicons version 0.
2015-08-05 19:13:13.877 [Debug] [BrowserDB.swift:92] createTable(_:table:): Try create favicons version 0
2015-08-05 19:13:13.878 [Debug] [SwiftData.swift:125] transaction: Op in transaction succeeded. Committing.
2015-08-05 19:13:13.879 [Info] [BrowserTable.swift:73] init(version:): SQLite version: 3.8.8.3 (3008008).
2015-08-05 19:13:13.879 [Debug] [BrowserDB.swift:14