Skip to content

Instantly share code, notes, and snippets.

Avatar

Benjamin Charity benjamincharity

View GitHub Profile
@benjamincharity
benjamincharity / autonomous.txt
Last active May 10, 2021
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
View autonomous.txt
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
@benjamincharity
benjamincharity / .travis.sync-s3.yml
Last active May 9, 2021
Set up TravisCI to sync an S3 bucket.
View .travis.sync-s3.yml
" Two env variables must be added to TravisCI settings:
" AWS_SECRET_ACCESS_KEY
" AWS_ACCESS_KEY_ID
before_deploy:
pip install --user awscli
deploy:
provider: script
script: ~/.local/bin/aws s3 sync dist s3://MY_BUCKET_NAME --region=us-west-2 --delete
skip_cleanup: true
@benjamincharity
benjamincharity / mockActivatedRoute.ts
Created Apr 12, 2017
Mock ActivatedRoute with params, data and snapshot.
View mockActivatedRoute.ts
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
MdToolbarModule,
],
providers: [
{
provide: Router,
useClass: MockRouter,
},
@benjamincharity
benjamincharity / master.vim
Last active Apr 8, 2021 — forked from gmccreight/master.vim
Master Vim with this interactive tutorial.
View master.vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@benjamincharity
benjamincharity / clearCache.sh
Created Mar 3, 2017
Clear the cache for a CircleCI project.
View clearCache.sh
curl -X DELETE https://circleci.com/api/v1/project/:username/:project/build-cache?circle-token=:token
View get-sum.js
function getSum(a: number, b: number): number {
if (a === b) {
return a;
}
const [start, end] = [a, b].sort((a, b) => a - b);
return Array(end - start + 1)
.fill(null)
.map((_, idx) => start + idx)
.reduce((acc, curr) => acc + curr);
}
View html-outlet.directive.ts
import {
Component,
Directive,
NgModule,
Input,
ViewContainerRef,
Compiler,
ComponentFactory,
ModuleWithComponentFactories,
ComponentRef,
View textMaskCore.js
!(function (e, r) {
"object" == typeof exports && "object" == typeof module ? (module.exports = r()) : "function" == typeof define && define.amd ? define([], r) : "object" == typeof exports ? (exports.textMaskCore = r()) : (e.textMaskCore = r());
})(this, function () {
return (function (e) {
function r(n) {
if (t[n]) return t[n].exports;
var o = (t[n] = { exports: {}, id: n, loaded: !1 });
return e[n].call(o.exports, o, o.exports, r), (o.loaded = !0), o.exports;
}
var t = {};
@benjamincharity
benjamincharity / CreateGuid.ts
Created Aug 10, 2017
A TypeScript class that generates a guid
View CreateGuid.ts
// http://stackoverflow.com/questions/26501688/a-typescript-guid-class
class Guid {
static newGuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = Math.random() * 16 | 0, v = c === 'x' ? r : ( r & 0x3 | 0x8 );
return v.toString(16);
});
}
}
View ep.html
<div [@detailExpand]="shouldExpand ? 'expanded' : 'collapsed'">
Test
</div>