Skip to content

Instantly share code, notes, and snippets.

@jacobq
jacobq / components.my-component\.js
Created May 12, 2022 15:35
component arg types
//import { tracked } from '@glimmer/tracking';
import Component from '@glimmer/component';
export default class extends Component {
get result() {
return typeof this.args.arg1;
}
}
@jacobq
jacobq / controllers.application\.js
Last active April 28, 2022 21:58
Nested tracking
import { tracked } from '@glimmer/tracking';
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { VERSION } from '@ember/version';
import { later } from '@ember/runloop';
// Can't use this in Ember Twiddle yet because it
// needs to build with Embroider
// See https://github.com/ember-cli/ember-twiddle/issues/732
//import { deepTracked } from 'ember-deep-tracked';
@jacobq
jacobq / scan-wifi-channels.js
Created April 28, 2021 22:16
NodeJS script to select 2.4GHz wifi channel using output from `iwlist wlan0 scan`
let log = () => {};
try {
const debug = require('debug'); // if we have it
log = debug('scan-wifi-channels');
} catch(e) {}
const { execSync } = require('child_process');
const input = execSync('iwlist wlan0 scan').toString('utf-8');
const lines = input.split('\n');
const stations = [];
@jacobq
jacobq / update-dynamic-dns.sh
Last active December 14, 2024 15:30
FreeDNS (afraid.org) dynamic DNS updater script: e.g put in /etc/cron.hourly/update-dynamic-dns.sh
#!/bin/sh
# FreeDNS updater script
# Adapted from https://freedns.afraid.org/scripts/update.sh.txt
# sudo apt install dnsutils wget
DOMAIN="foo.my-custom-domain.com"
API_KEY="put your API key (base64 string) here"
SHOULD_UPDATE=0
# -f is the only argument supported right now (forces update even if address appears correct)
@jacobq
jacobq / index.html
Created January 9, 2020 17:26
Electron Fiddle Gist
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Dialog Demo</title>
</head>
<body>
<h1>Click the button</h1>
<button id="save">Show save dialog</button>
<pre id="output"></pre>
### Keybase proof
I hereby claim:
* I am jacobq on github.
* I am jacobq (https://keybase.io/jacobq) on keybase.
* I have a public key ASBCStR5tBI73pYYyJPV117dkY1cIlCQGd_6q7bZbl8w-wo
To claim this, I am signing this object:
@jacobq
jacobq / electron-prep.sh
Last active January 9, 2020 16:01
Build electron from source
#!/bin/bash
ORIGINAL_DIR=${pwd}
# Optional caching step
#export GIT_CACHE_PATH="${HOME}/.git_cache"
#mkdir -p "${GIT_CACHE_PATH}"
# Use electron's build cache
export SCCACHE_BUCKET="electronjs-sccache-ci"
@jacobq
jacobq / index.html
Last active January 8, 2020 19:42
Repro of printToPDF problem in electron 8.0.0-beta.5 (Electron Fiddle Gist)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
We are using Node.js <script>document.write(process.versions.node)</script>,
@jacobq
jacobq / index.js
Created December 20, 2019 17:31
csv-stringify context.header bug repro
const { createWriteStream } = require('fs');
const intoStream = require('into-stream');
const csvStringify = require('csv-stringify');
const makePromise = () => {
let resolve;
let reject;
const promise = new Promise((resolve_, reject_) => {
resolve = resolve_;
reject = reject_;
@jacobq
jacobq / controllers.application.js
Last active November 22, 2019 15:52
New Twiddle
import Ember from 'ember';
const Foo = Ember.Object.extend({
array: [1,2,3]
});
const Bar = Foo.extend({
array: [2,3,4]
});
const Baz = Foo.extend({
//array: this._super.array.map(x => 1)