Skip to content

Instantly share code, notes, and snippets.

View rafaelkallis's full-sized avatar

Rafael Kallis rafaelkallis

View GitHub Profile
@jeffijoe
jeffijoe / app.js
Last active September 1, 2023 07:34
Streaming uploads through Koa.
import Koa from 'koa'
import parse from './busboy'
import AWS from 'aws-sdk'
const app = new Koa()
const s3 = new AWS.S3({
params: { Bucket: 'myBucket' }
})
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define HWMON_BASE "/sys/class/hwmon"
#define GPU_HWMON "hwmon0" // amdgpu
#define GPU_TEMP_TEMP "temp1" // no name
#define GPU_FAN_PWM "pwm1"
@austinhyde
austinhyde / js-observables-binding.md
Last active August 16, 2023 18:19
Vanilla JavaScript Data Binding

Observables

You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5

setN(10);