Skip to content

Instantly share code, notes, and snippets.

View robbiespeed's full-sized avatar

Robbie Speed robbiespeed

  • NS, Canada
  • 10:29 (UTC -04:00)
View GitHub Profile
@robbiespeed
robbiespeed / bench.js
Created November 17, 2024 02:49
JS Class Perf
import { bench, run } from 'mitata';
const rCount = 1000;
const iCount = 1000;
class FooN {
#fooState = 1;
#inc = 13;
run() {
@robbiespeed
robbiespeed / bench.js
Last active November 27, 2023 18:49
Benchmark Node fs stats Private vs ObjectDefineProperty
import { bench, run } from 'mitata';
const nCount = 10000;
const iCount = 10000;
const MathRound = Math.round;
function dateFromMs(ms) {
// Coercing to number, ms can be bigint
return new Date(MathRound(Number(ms)));
@robbiespeed
robbiespeed / getSet.js
Last active October 25, 2023 23:46
JS Benches
import { bench, run } from 'mitata';
// This is a benchmark of the performance impact of using private properties.
const nCount = 1000;
const iCount = 1000;
class FooN {
#state = 1;
#inc = 13;
@robbiespeed
robbiespeed / example.ts
Last active October 15, 2024 16:16
Reactive primitive in the form of Emitters
declare global {
interface SymbolConstructor {
/**
* Similar to Symbol.iterator it is used to lookup the emitter of any Emittable
*/
readonly emitter: unique symbol;
}
/**
* Reactive primitive used for propagating messages through graph connections

Keybase proof

I hereby claim:

  • I am robbiespeed on github.
  • I am robbiespeed (https://keybase.io/robbiespeed) on keybase.
  • I have a public key ASAIL_zrUy2r__CtTsV6YsZ3cKfxH05lNKpiEe3qlAimYAo

To claim this, I am signing this object:

import Ember from 'ember';
const { get, set, computed } = Ember;
export default Ember.Controller.extend({
isButtonOn: false,
// This toggle will run when the button is pressed, it should toggle the isButtonOn property
// which should trigger the value of text to recompute
// -- begin edit area
toggle () {
import Ember from 'ember';
const { get, computed, run, isNone } = Ember;
export default Ember.Component.extend({
tagName: 'input',
attributeBindings: [
'type',
// '_value:value',
],
@robbiespeed
robbiespeed / model-dirtyRelationships.js
Created August 12, 2016 17:31
Ember-Data dirtyRelationships
import Ember from 'ember';
import Model from 'ember-data/model';
const { computed } = Ember;
function checkDirtyRelationships () {
const dirtyRelationships = this.get('_dirtyRelationships');
let anyDirty = false;
this.eachRelationship((key, descriptor) => {
import Ember from 'ember';
export default Ember.Controller.extend({
queryParams: [{
testParam: 'test',
}],
appName: 'Ember Twiddle',
testParam: 'womp'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
queryParams: [
{ perPage: 'per_page'}
],
perPage: 5
});