Skip to content

Instantly share code, notes, and snippets.

⌨️
is typing ...

Nathan Fritz fritzy

⌨️
is typing ...
Block or report user

Report or block fritzy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fritzy
fritzy / component.js
Last active Apr 18, 2019
Abusing Object.defineProperty and Object.getPrototypeOf to make a nice interface for ECS Components.
View component.js
class BaseComponent {
constructor(ecs, initialValues) {
Object.defineProperty(this, 'ecs', { enumerable: false, value: ecs });
Object.defineProperty(this, 'type', { enumerable: false, value: this.constructor.name });
Object.defineProperty(this, '_values', { enumerable: false, value: {} });
Object.defineProperty(this, 'id', { enumerable: true, value: componentId });
this.lastTick = this.ecs.ticks;
componentId++;
View LoginImpersonate.cs
using System;
using System.Runtime.InteropServices;
using System.Security.Principal;
using System.Security.Cryptography.X509Certificates;
using System.Collections.Generic;
namespace LoginImpersonate
{
internal class Impersonation : IDisposable
{
@fritzy
fritzy / nodewebcrypto.js
Created Apr 13, 2018
Test of node-webcrypto-ossl
View nodewebcrypto.js
const RSA = { name: 'RSASSA-PKCS1-v1_5' };
const testValue = 'I am the very model of a modern major general.';
const testValue2 = 'I am the very model of a modern majr general.';
//if browser, uses window.crypto, if node wraps openssl
const WebCrypto = require('node-webcrypto-ossl');
const crypto = new WebCrypto();
(async () => {
console.log('generating key');
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@fritzy
fritzy / changes_and_workarounds.md
Last active Dec 15, 2016
2016 Dell XPS 13 9360 Developer Edition
View changes_and_workarounds.md

Upgrade to Linux 4.8

apt-cache search linux | grep 4.8

apt-get install linux-image-4.8xxxxx linux-extras-4.8xxxx linux-headers-4.8.x-xxxx

I used 4.8.0-30-generic flavors of all of those.

linux-image-4.8.0-30-generic - Linux kernel image for version 4.8.0 on 64 bit x86 SMP

View unpublished_mssql.txt
[claptrap] ~/projects/node/seaquell 10:18 AM 89% [master ●]
$ npm test
> seaquell@0.17.1 test /Users/fritzy/projects/node/seaquell
> lab -a code -c -v
testing functions
✔ 1) create temp table proc (737 ms)
✔ 2) create user defined table proc (477 ms)
✔ 3) create get table proc (215 ms)
View promiser_chain_catch.js
function promiser(input) {
if (input === 1) {
return Promise.resolve(input);
}
if (input === 2) {
return Promise.reject(new Error('Rejected'));
}
throw new Error('Broken');
}
@fritzy
fritzy / 1unique_short_id.sql
Last active Sep 15, 2017
Fight the German Tank Problem in Postgresql with short, unique, url-safe ids.
View 1unique_short_id.sql
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
-- Create a trigger function that takes no arguments.
-- Trigger functions automatically have OLD, NEW records
-- and TG_TABLE_NAME as well as others.
CREATE OR REPLACE FUNCTION unique_short_id()
RETURNS TRIGGER AS $$
-- Declare the variables we'll be using.
DECLARE
View Pros and Cons of Meteor.md

Pros:

  • Shallow Learning Curve
  • Easy to get and app running

Cons:

  • It's not composable.
  • DDP is not used anywhere else, REST is, and you'd have to do that in addition to your app.
  • Only MongoDB support right now, which we consider a marketing driven product with a troubled history rather than a technical driven tool (although Postgres support is in the works)
  • Making React views in Meteor client-side is not the point -- the front-end is tightly coupled to the backed via DDP, having the server direct the client state and causing many edge cases.
  • The biggest use case for Meteor is a niche edge case -- simultaneously editing the same field, and can be solved via standards and small packages.
@fritzy
fritzy / basic_proxy_example.js
Last active Dec 30, 2015
Basic Proxy Example
View basic_proxy_example.js
const someObject = {};
const someProxy = new Proxy(someObject, {
get: function (target, property, reciever) {
if (property.substr(0, 6) === 'happy_') {
return Reflect.get(target, property.substr(6), reciever);
}
return 'sad';
},
set: function (target, property, value, reciever) {
You can’t perform that action at this time.