Skip to content

Instantly share code, notes, and snippets.

@anaran
anaran / CodeMirrorHelp.js
Created February 24, 2014 22:50
CodeMirror Help Prototype in support of https://github.com/marijnh/CodeMirror/issues/2294
// Code snippet CodeMirrorHelp.js for Google Chrome and Mozilla Firefox.
// Ctrl+F1 opens fixed textarea displaying CodeMirror keymappings and defaults.
// Close by pressing Esc or clicking anywhere in the textarea.
// Navigate it with PageDown, PageUp.
/*jslint browser: true*/
/*globals console: false */
(function() {
var reportCodeMirrorInfo = function() {
if (!window.CodeMirror) {
@anaran
anaran / popchrom2mywords.js
Created August 28, 2014 21:42
Convert Google Chrome Popchrom export file for import into Firefox MyWords
// Begin of popchrom2mywords.js
//
// Run this JavaScript code snippet in Firefox Scratchpad
// or import to Google Chrome devtools source snippets
// in a tab containing a Popchrom export file with
// Character encoding set to Unicode for that tab.
//
// A newly created dialog contains a link to download the
// generated
// 'popchrom2mywords_@' + Date.now() + '.xml'
@anaran
anaran / gist:4ffa2a2e28aa4359cf16
Created September 15, 2014 12:29
Sparse checkout for contributions to small portions of huge repositories
6012 20140720T013413+0200 git pull origin master
6011 20140720T013400+0200 echo "README.rst" >> .git/info/sparse-checkout
6010 20140720T013319+0200 git config core.sparsecheckout true
6009 20140720T013259+0200 git remote add origin https://github.com/anaran/olympia
6007 20140720T013213+0200 cd olympia
6006 20140720T013209+0200 git init olympia
@anaran
anaran / Devtools Snippet to Stringify Couchdb View Functions
Last active August 29, 2015 14:10
Devtools Snippet to Stringify Couchdb View Functions
// Open window with stringified version of couchdb view functions.
function map(doc) {
if(doc.name && doc.age) {
emit(doc.name, doc.age);
}
}
function reduce(keys, values) {
var sum = 0;
values.forEach(function(element) {
@anaran
anaran / Apps.webidl
Last active November 22, 2015 23:44
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
dictionary InstallParameters {
sequence<DOMString> receipts = [];
sequence<DOMString> categories = [];
};
@anaran
anaran / XMLHttpRequest.webidl
Created November 25, 2015 11:43
Make it usable by webidl2 2.0.11
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* www.w3.org/TR/2012/WD-XMLHttpRequest-20120117/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#the-workerglobalscope-common-interface
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera
* Software ASA.
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.w3.org/TR/WebCryptoAPI/
*/
typedef DOMString KeyType;
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// MediaMetadata and MediaPlayStatus are used to keep data from Applications.
// Please see specification of AVRCP 1.3 for more details.
dictionary MediaMetaData
{
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
callback BrowserElementNextPaintEventCallback = void ();
enum BrowserFindCaseSensitivity { "case-sensitive", "case-insensitive" };
enum BrowserFindDirection { "forward", "backward" };