Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Rampersad ryanmr

View GitHub Profile
View mapbox-change-font.md

Changing the font in a mapboxgl map is really only possible by using a font in the Mapbox Studio system.

      // map.current.setLayoutProperty(
      //   "country-label",
      //   "text-size",
      //   originalSize * Number(e.target.value)
      // );
      // map.current.getLayoutProperty()
      console.log(map.current);
View rng_rust.md

I am using a SeedableRng to make reproducible simulations.

Here's my get_rng function:

use rand::prelude::*;
use rand_xoshiro::rand_core::SeedableRng;
use rand_xoshiro::Xoshiro256StarStar;

pub fn get_rng() -> impl Rng {
View reading-source-code.md

Hey there!

I'm Ryan Rampersad and I'll be giving a talk titled The Art & Science of Reading Other People's Code.

I am looking for short nuggets of wisdom that I could add to my talk. I am sure we'll share many of the same ideas, but I bet there's some really unique and insightful advice, tips and tricks out there.

Want to give it a try?

View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div style="display: flex; justify-content: center">
<div style="padding: 1rem">
View forms.md

Meta

For the last few days, I have been thinking about how much I hate forms and meanwhile, how there are other aspects of the ecosystem that aren't great either.

Forms

What's the deal with forms? Forms, ever since webforms back in the day, seem to be at the unsolvable core of modern frontend development. In today's React take on forms, there have been numerous libraries to help solve them.

Some early work was to integrate them with redux-form. I skipped that one, so I know nothing about it at this point.

View mkdirp.md
warning @nestjs/platform-express > multer > mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning typeorm > mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning @nestjs/cli > webpack > mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning @nestjs/cli > webpack > terser-webpack-plugin > cacache > mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning @nestjs/cli > webpack > watchpack > chokidar > fsevents > node-pre-gyp > mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promise
View typeorm-nestjs-error.md

Trying to use NestJS and TypeORM? Trying to use the provided ConfigModule with forRootAsync? Cool, you might get an error.

import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ConfigModule, ConfigService } from '@nestjs/config';
View exp-cycles-in-data.md

Data in cycles

I'm trying to break a set of data into "cycles" for further processing. The data has no additional flags associated, so I can't identify the cycles any other way except numerically. Visually plotting data shows the cycles, but I'm looking for a robust numerically approach.

example image of cycles

Current approach

Given a list of datapoints...