Skip to content

Instantly share code, notes, and snippets.

View clarkbw's full-sized avatar
🐯
Hiring Product Managers!

Bryan Clark clarkbw

🐯
Hiring Product Managers!
View GitHub Profile
@clarkbw
clarkbw / utils.js
Last active December 14, 2015 00:38
jetpack style loading (and unloading) of a stylesheet into XUL. Only useful for add-ons that need to change chrome UI.
const { CC, Ci } = require('chrome');
const { when: unload } = require('sdk/system/unload');
var ios = Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService);
/* Helper that registers style sheets and remembers to unregister on unload */
exports.addXULStylesheet = function addXULStylesheet(url) {
var uri = newURI(url);
var sss = Cc["@mozilla.org/content/style-sheet-service;1"]
.getService(Ci.nsIStyleSheetService);
@clarkbw
clarkbw / test-stylesheet.js
Created February 21, 2013 00:24
Because you can't easily find a stylesheet in XUL by it's ID you have to look for the data attribute and compare that with what I created as the `css` variable.
function findStylesheet(document, name) {
var uri = data.url(name + ".css"),
css = "href=\"" + uri + "\" type=\"text/css\"",
ORDERED_NODE_SNAPSHOT_TYPE = 7, // XPathResult doesn't exist in context
xpath = null;
xpath = document.evaluate("//processing-instruction(\"xml-stylesheet\")",
document,
document.createNSResolver(document),
@clarkbw
clarkbw / persona.diff
Last active December 14, 2015 01:58
Adds persona support to the discourse platform using the omniauth-persona gem ( https://github.com/pklingem/omniauth-persona )
diff --git a/Gemfile b/Gemfile
index 6966c65..59e7dc3 100644
--- a/Gemfile
+++ b/Gemfile
@@ -34,6 +34,7 @@ gem "omniauth-openid"
gem "openid-redis-store"
gem "omniauth-facebook"
gem "omniauth-twitter"
+gem "omniauth-persona"
gem 'oj'
@clarkbw
clarkbw / devtools-telemetry-metrics.py
Created March 9, 2016 00:54
gathers the DEVTOOLS Telemetry Histograms
import json
from functools import cmp_to_key
import locale
import urllib2
local_fname = 'Histograms.json'
url = 'https://hg.mozilla.org/mozilla-central/raw-file/tip/toolkit/components/telemetry/Histograms.json'
req = urllib2.Request(url)
response = urllib2.urlopen(req)
@clarkbw
clarkbw / datasources.json
Last active March 16, 2016 01:18
Google Time Zone API datasource for Strongloop Loopback
"google": {
"name": "google",
"debug": true,
"connector": "rest",
"operations": [
{
"template": {
"doc": "The Google Time Zone API",
"method": "GET",
"url": "https://maps.googleapis.com/maps/api/timezone/{format=json}",
@clarkbw
clarkbw / server.js
Last active April 21, 2016 14:26
html5mode with strongloop loopback and angularjs
var loopback = require('loopback');
var boot = require('loopback-boot');
var path = require('path');
var app = module.exports = loopback();
// boot scripts mount components like REST API
boot(app, __dirname);
// https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode
I give my permission to license under the MPL 2 any contributions I make to the debugger.html codebase.
@clarkbw
clarkbw / responsive.patch
Created July 25, 2016 18:28
changes to the splitter for a responsive design version of the debugger.html
diff --git a/public/js/components/App.css b/public/js/components/App.css
index 7dc9896..86e507a 100644
--- a/public/js/components/App.css
+++ b/public/js/components/App.css
@@ -25,6 +25,7 @@ body {
.debugger {
display: flex;
flex: 1;
+ flex-flow: row wrap;
}
@clarkbw
clarkbw / formula.xls
Created August 1, 2016 18:37
sql like query of an another google spreadsheet
=QUERY(
IMPORTRANGE(
"1pfBHQvc1A4b6WrByMLfk-VK9ycDwFEvlZZla2V6UWx4",
"data!A2:D260"
),
"Select Col2,Col3 where Col1 = '"&$B2&"'"
)
@clarkbw
clarkbw / addLineWidget.patch
Created August 26, 2016 21:14
Uses addLineWidget in the debugger.html CodeMirror editor
diff --git a/public/js/components/Editor.css b/public/js/components/Editor.css
index ff6160c..3986f92 100644
--- a/public/js/components/Editor.css
+++ b/public/js/components/Editor.css
@@ -52,6 +52,10 @@
z-index: 0;
}
+.new-breakpoint .CodeMirror-linewidget .helpful-message {
+ background-color: yellow;