Skip to content

Instantly share code, notes, and snippets.

View trjohnst's full-sized avatar

Thomas Johnston trjohnst

View GitHub Profile

Keybase proof

I hereby claim:

  • I am trjohnst on github.
  • I am thomas211 (https://keybase.io/thomas211) on keybase.
  • I have a public key ASC_PrhrvJ68dqVL99WWXnrNKU2PhpS6GfabZSueqgYapwo

To claim this, I am signing this object:

@trjohnst
trjohnst / GithubClient.gs
Created August 16, 2020 09:41 — forked from pamelafox/GithubClient.gs
Google Apps Script for committing a file to Github Repo
/* A bare-bones GithubClient, just used for commits */
function GithubClient(owner, repo, username, passwordOrToken) {
this.owner = owner;
this.repo = repo;
this.username = username;
this.passwordOrToken = passwordOrToken;
}
/*
const dgram = require('dgram');
const convertBinaryToHex = require('./lib/util/convert-binary-to-hex');
const message = Buffer.from([0x42,0x4e,0x58,0x49,0x00,0x14,0x00]);
const PORT = 5121; // Port from server, usually 5121
const HOST = '127.0.0.1'; // IP Address or URL of host
const TIMEOUT_DURATION = 3000;
let timeout;
@trjohnst
trjohnst / components.logger-component.js
Created April 23, 2018 19:52
Component Lifecycle Hook Playground
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super(...arguments);
console.log('init');
},
didReceiveAttrs() {
this._super(...arguments);
console.log('didReceiveAttrs');
@trjohnst
trjohnst / components.my-component.js
Created March 28, 2018 22:57
Inverse Templates and Yields
import Ember from 'ember';
export default Ember.Component.extend({
});
import Ember from 'ember';
export default Ember.Component.extend({
state: 'none',
methodAction() {
this.set('state', 'method');
},
actions: {
actionAction() {
this.set('state', 'action');
@trjohnst
trjohnst / components.recursive-display.js
Created March 15, 2018 22:18
Two-way Bindings Test
import Ember from 'ember';
export default Ember.Component.extend({
value: null,
actions: {
doIt() {
this.set('value', this.get('value') + 1);
}
}
});
@trjohnst
trjohnst / components.element-registerer.js
Last active March 9, 2018 17:37
Scrollable Container with Jump to
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
const onDidInsertElement = this.get('onDidInsertElement');
if (typeof onDidInsertElement !== 'function') return;
@trjohnst
trjohnst / components.action-yielder.js
Last active February 28, 2018 17:58
Curried Closure Functions
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
doAction() {
console.log('hello from action yielder');
}
}
});
@trjohnst
trjohnst / components.button-component.js
Last active February 21, 2018 23:10
Wrapper Yielding Click Actions
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'button',
click() {
this.get('_onClick') && this.get('_onClick')();
this.get('onClick') && this.get('onClick')();
}
});