Skip to content

Instantly share code, notes, and snippets.

@mrloop
mrloop / start-app.js
Created May 13, 2015 13:27
Set adapter during test run.
...
Ember.run(function() {
application = Application.create(attributes);
application.register('adapter:application', Adapter);
var store = DS.Store.extend({adapter: Adapter});
application.register('store:main', store);
application.setupForTesting();
application.injectTestHelpers();
});
@mrloop
mrloop / csp.js
Created November 6, 2015 08:36
Generate CSP from ember-cli
env = require('./config/environment.js')
var args = process.argv.slice(2);
var contentSecurityPolicy = env(args[0]).contentSecurityPolicy;
cspStr = '';
for (var key in contentSecurityPolicy ){
cspStr = cspStr + key + " " + contentSecurityPolicy[key] + "; ";
}
console.log(cspStr);

Keybase proof

I hereby claim:

  • I am mrloop on github.
  • I am mrloop (https://keybase.io/mrloop) on keybase.
  • I have a public key whose fingerprint is 5941 DB3C 71BE E64A 7B58 1C63 B48C DA17 BABB C60A

To claim this, I am signing this object:

@mrloop
mrloop / part.js
Created March 12, 2016 09:38
Simple minimal version of https://github.com/mrloop/vehicle-app, run via node `node part.js`
var part = function (spec) {
var that = {
getName: function (){
return spec.name
},
toString: function () {
var str = this.getName() + '\n' + this.getCents() + '\n';
return str + this.map(spec.parts, function(part){
return part.toString();
@mrloop
mrloop / adguardhome
Created September 2, 2019 20:50
FreeBSD AdGuardHome process management /etc/rc.d/adguardhome
#!/bin/sh
#
# PROVIDE: AdGuardHome
# REQUIRE: networking
# KEYWORK:
#
# see https://redbyte.eu/en/blog/supervised-freebsd-init-script-for-go-deamon/
# remember to add `adguardhome_enable='YES` to `/etc/rc.conf`
. /etc/rc.subr
npx create-react-app web-ext-react-hello
cd web-ext-react-hello
npm start
yarn add -D web-ext web-ext-react
if (document.isBrowserAction) {
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById("root")
)
}
{
"description": "Bundle ReactJS as web extension",
"manifest_version": 2,
"name": "web-ext-react-hello",
"version": "1.0",
"homepage_url": "https://github.com/mrloop/web-ext-react-hello",
"icons": {
"192": "logo192.png"
},
"scripts": {
"start:firefox": "web-ext-react run | xargs -L1 web-ext run -u http://www.example.org/ -s",
"start:chrome": "web-ext-react run | xargs -L1 web-ext run -u http://www.example.org/ -t chromium -s",
}