Skip to content

Instantly share code, notes, and snippets.

@Happy-Ferret
Happy-Ferret / word_wrap.go
Created May 4, 2019 09:49 — forked from kennwhite/word_wrap.go
Basic golang word wrap string split
/*
Wrap long lines on rough column boundaries at spaces
Working example: https://play.golang.org/p/3u0X6NyMua
Based on algo from RosettaCode, which is nifty
https://www.rosettacode.org/wiki/Word_wrap#Go
*/
package main
import (
@jaredhirsch
jaredhirsch / foo.js
Created March 15, 2017 21:05
trying to shutdown + restart embedded webextensions without a restart
// 1. This seems to work. Is it safe to use?
const { EmbeddedExtensionManager } = Cu.import("resource://gre/modules/LegacyExtensionsUtils.jsm");
const webext = EmbeddedExtensionManager.getEmbeddedExtensionFor({id: 'pageshot@mozilla.org'});
webext.shutdown();
webext.started = false;
webext.startup(); // throws no errors, toolbar button reappears, messaging works
// 2. This doesn't work:
const webext = EmbeddedExtensionManager.getEmbeddedExtensionFor({id: 'pageshot@mozilla.org'});
webext.shutdown();
@NorioKobota
NorioKobota / foo.cpp
Created October 16, 2015 06:33
exchange binary data between C++ and JavaScript by using linear-rpc - C++ part
/**
* $ git clone --recursive https://github.com/linaer-rpc/linear-cpp /path/to
* $ cd /path/to/linear-cpp
* $ ./bootstrap && ./configure && make
* $ cp /this/foo.cpp /path/to/linear-cpp/sample
* $ cd sample
* $ g++ -I ../include -I ../deps/msgpack/include -o foo foo.cpp ../src/.libs/liblinear.a ../deps/libtv/src/.libs/libtv.a ../deps/libtv/deps/libuv/.libs/libuv.a
* $ ./foo
*/