Skip to content

Instantly share code, notes, and snippets.

@Happy-Ferret
Happy-Ferret / fooClass.js
Last active March 17, 2017 23:23
Javascript library example
class fooClass {
constructor(options) {
this.label = options.label
this.bar()
}
bar() {
console.log(this.label)
}
}
@Happy-Ferret
Happy-Ferret / connpair.go
Created March 19, 2017 11:28 — forked from tsavola/connpair.go
Like socketpair, but for Golang, and TCP instead of Unix sockets
package connpair
import (
"net"
)
func ConnPair() (serverConn, clientConn net.Conn, err error) {
l, err := net.Listen("tcp", "localhost:0")
if err != nil {
return
@Happy-Ferret
Happy-Ferret / coverage_recipe.md
Created March 22, 2017 21:04 — forked from gregglind/coverage_recipe.md
Code Coverage in Mozilla Code
@Happy-Ferret
Happy-Ferret / auto-deploy_documentation.md
Created March 23, 2017 14:18 — forked from vidavidorra/auto-deploy_documentation.md
Auto-deploying Doxygen documentation to gh-pages with Travis CI

Auto-deploying Doxygen documentation to gh-pages with Travis CI

This explains how to setup for GitHub projects which automatically generates Doxygen code documentation and publishes the documentation to the gh-pages branch using Travis CI. This way only the source files need to be pushed to GitHub and the gh-pages branch is automatically updated with the generated Doxygen documentation.

Sign up for Travis CI and add your project

Get an account at Travis CI. Turn on Travis for your repository in question, using the Travis control panel.

Create a clean gh-pages branch

To create a clean gh-pages branch, with no commit history, from the master branch enter the code below in the Git Shell. This will create a gh-pages branch with one file, the README.md in it. It doesn't really matter what file is uploaded in it since it will be overwritten when the automatically generated documentation is published to th

@Happy-Ferret
Happy-Ferret / auto-deploy.md
Created March 24, 2017 19:11 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

#depends on underscore
_.isConstructor = (thing) ->
if thing.name && thing.name[0].toUpperCase() == thing.name[0]
true
else
false
class Instrumentor
constructor: (namespace) ->
@Happy-Ferret
Happy-Ferret / _js-snippet-MDNBuildingDomTrees.js
Created March 27, 2017 07:00 — forked from Noitidart/_js-snippet-MDNBuildingDomTrees.js
_js-snippet-MDNBuildingDomTrees - how to use the jsonToDom function the way I like. This code is a JavaScript snippet but compatabile with privelaged Firefox addon scope. Is not compataible with Google Chrome, I haven't tested other browsers. I do need to work on making it compatabile with other browsers.
function example() {
var hotkeyLabelJson =
['ul', {class: 'apple cf',id:'apple-qwerty'},
['li', {class:'apple'},
['a',{class:'nthotkey-apple-key apple-key'},
[span, {},
1
]
]
],
@Happy-Ferret
Happy-Ferret / _ff-addon-snippet-CreateMenuWithSubmenuAndAttachToWidget.js
Created March 27, 2017 07:00 — forked from Noitidart/_ff-addon-snippet-CreateMenuWithSubmenuAndAttachToWidget.js
_ff-addon-snippet-CreateMenuWithSubmenuAndAttachToWidget - Creates a menu with submenus and then attaches it to an element. Currently set up to attach to widget with id 'widget:jid1-lwNbwJJiiMXM4A@jetpack-open-traveleye'.
function doit() {
//create and add the panel now
var doc = document;
var myWidget = doc.getElementById('widget:jid1-lwNbwJJiiMXM4A@jetpack-open-traveleye'); //we add the menu to this widget, we can add menu to anything by setting the context attribute of it to the id of the menu we want to give it
var myMenuJson =
['xul:menupopup', {id: 'myMenu1'},
['xul:menuitem', {label:'menu item1'}],
['xul:menu', {label:'menu item2 is submenu1'},
['xul:menupopup', {},
INIT=.emacs.el
$(INIT): TC3F.org
time emacs --batch --no-init-file --load .org-mode.emacs.el --find-file TC3F.org --funcall org-babel-tangle --kill
TC3F.txt: $(INIT)
time emacs --batch --no-init-file --load .org-mode.emacs.el --find-file TC3F.org --funcall org-ascii-export-to-ascii --kill
TC3F.html: $(INIT)
time emacs --batch --no-init-file --load .org-mode.emacs.el --find-file TC3F.org --funcall org-html-export-to-html --kill