Skip to content

Instantly share code, notes, and snippets.

View pmuellr's full-sized avatar
🌀
Software developer @ Elastic working on Kibana. Previously @ NodeSource, IBM.

Patrick Mueller pmuellr

🌀
Software developer @ Elastic working on Kibana. Previously @ NodeSource, IBM.
View GitHub Profile
@pmuellr
pmuellr / split-by-comma.js
Created August 16, 2011 13:55
function and test case to split a string by commas
#!/usr/bin/env node
function splitByComma(string) {
string = string.replace(/^\s*/,"")
string = string.replace(/\s*$/,"")
var result = string.split(/\s*,\s*/)
if (result.length == 1) {
if (result[0] == "") {
return []
@pmuellr
pmuellr / Makefile
Created August 30, 2011 22:00
PhoneGap plugin development helper make file
#-------------------------------------------------------------------------------
# Useful while developing a plugin that lives in the phonegap-plugins Git repo.
# - create a new sample PhoneGap project to test your plugin
# - copy this file in there
# - modify PLUGIN_DIR, PLUGIN_FILES as needed
# - run "make watch" while working on your sample to update the
# phonegap-plugins files
#-------------------------------------------------------------------------------
PLUGIN_DIR = ~/Projects/phonegap-plugins/iPhone/BarcodeScanner
@pmuellr
pmuellr / gist:1222574
Created September 16, 2011 17:09
W3C Compass API vs theoretical new-fangled API
@pmuellr
pmuellr / uncompilable-to-cs.js
Created September 27, 2011 13:58
functions from weinre that I couldn't get js2coffee to compile
function __function__6() {
WebInspector.panels.remote = new RemotePanel();
var panel = WebInspector.panels.remote;
var toolbar = document.getElementById("toolbar")
WebInspector.addPanelToolbarIcon(toolbar, panel, toolbar.childNodes[1])
WebInspector.panelOrder.unshift(WebInspector.panelOrder.pop())
WebInspector.currentPanel = panel
@pmuellr
pmuellr / uncompilable-to-cs-2.js
Created September 27, 2011 14:35
functions from weinre that I couldn't get js2coffee to compile
function __function__194 (styleId, propertyIndex, text, overwrite) {
var styleDecl = Weinre.cssStore._getStyleDecl(styleId)
if (!styleDecl) {
Weinre.logWarning("requested style not available: " + styleId)
return null
}
var mirror = styleDecl.__weinre__mirror
if (!mirror) {
@pmuellr
pmuellr / js-idl-in.cs.coffee
Created September 29, 2011 17:22
IDL for JavaScript in CoffeeScript
Classes = []
Callbacks = []
#===============================================================
class Class
constructor: (@name, properties) ->
@properties = []
@methods = []
@staticProperties = []
@pmuellr
pmuellr / element-highlighter-notes.html
Created October 17, 2011 16:05
element highlighter notes
<!-- ======================================================= -->
<h2>section colors</h2>
<table>
<tr><td>margin: <td><tt>#??????</tt>
<tr><td>border: <td><tt>#??????</tt>
<tr><td>padding: <td><tt>#??????</tt>
<tr><td>content: <td><tt>#??????</tt>
</table>
@pmuellr
pmuellr / NetworkNotify.txt
Created October 20, 2011 12:26
WEBIDLish of Web Inspectors NetworkNotify interface
class NetworkNotify
identifier - can it be a string instead of int?
//--------------------------------------------------------------
in a nutshell, trap XHR open, add event handler
in open():
- call identifierForInitialRequest()
@pmuellr
pmuellr / unpack-weinre-build.sh
Created October 28, 2011 15:50
unpack a weinre build to test it
#/bin/sh
rm weinre-???-*.zip
rm -rf weinre-???
cp ~/Projects/callback-weinre/weinre.build/out/archives/weinre-???-*.zip .
ls weinre-???-*.zip | xargs -L 1 unzip
@pmuellr
pmuellr / error-in-click.js
Created October 30, 2011 18:26
generate a runtime error when something is clicked
button.addEventListener("click", function buttonClicked() {
willThrowError()
})
function willThrowError() {
throwsError()
}
function throwsError() {
x = null