Here's a simple Hello World actor. It is a global actor (not associated with a given browser tab).
let protocol = require("devtools/server/protocol");
let {method, Arg, Option, RetVal} = protocol;
/* | |
* Running this scratchpad in chrome mode will open a devtools window that's debugging | |
* the devtools window that's debugging the currently selected tab. | |
*/ | |
let {devtools} = Components.utils.import("resource:///modules/devtools/gDevTools.jsm", {}); | |
let tabTarget = devtools.TargetFactory.forTab(gBrowser.selectedTab); | |
let toolbox = gDevTools.getToolbox(tabTarget); | |
let win = toolbox._host.frame.contentWindow; |
Every time I start a new project, I want to pull in a log
function that allows the same functionality as the console.log
, including the full functionality of the Console API.
There are a lot of ways to do this, but many are lacking. A common problem with wrapper functions is that the line number that shows up next to the log is the line number of the log function itself, not where log
was invoked. There are also times where the arguments get logged in a way that isn't quite the same as the native function.
This is an attempt to once and for all document the function that I pull in to new projects. There are two different options:
gifify() { | |
if [[ -n "$1" ]]; then | |
if [[ $2 == '--good' ]]; then | |
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png | |
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif | |
rm out-static*.png | |
else | |
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif | |
fi | |
else |
// phantomjs --web-security=no most_used_css_property_names.js | |
var urls = [ | |
'http://google.com', | |
'http://facebook.com', | |
'http://youtube.com', | |
'http://yahoo.com', | |
'https://github.com/', | |
'http://twitter.com/', | |
'http://en.wikipedia.org/wiki/Main_Page', |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
The FAQ maintained by Github covers most stumbling blocks, some other tips and tricks supplied here.
Add _site
to .gitignore
. The generated site should not be uploaded to Github since its gets generated by github.
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence | |
(function(win, doc){ | |
if(win.addEventListener)return; //No need to polyfill | |
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}} | |
function addEvent(on, fn, self){ | |
return (self = this).attachEvent('on' + on, function(e){ | |
var e = e || win.event; | |
e.preventDefault = e.preventDefault || function(){e.returnValue = false} | |
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true} |