Skip to content

Instantly share code, notes, and snippets.

View majames's full-sized avatar
👨‍💻

Michael James majames

👨‍💻
View GitHub Profile
@majames
majames / get-2023-songs.ts
Last active December 12, 2023 11:48
useful script for getting all of the songs in a spotify playlist that were released in 2022 and 2023
/*
* This script can be executed via bun.sh: https://bun.sh/
*
* bun get-2023-songs.ts
*/
import fs from "fs";
import axios from "axios";
// auth token can be retrieved by visiting the spotify API docs (linked below)
# did they create this test data for you? or did you create it yourself?
ROWS_FROM_SHEET = [
{
label: 'Versed Roof',
format: 'string',
value: 'some value',
date: nil,
@majames
majames / Metro.js
Last active February 3, 2021 23:26
Metro inline module IDs
// Dummy example of Metro compiled code demonstrating dependency handling
// Each module is wrapped in a function. A modules dependencies are passed to it
// via a dependency array argument, "d".
//
// In this example Module 0 is passed 3 dependencies (modules 1, 2 and 3)
__d((function(g, r, i, a, m, e, d) {
"use strict";
Object.defineProperty(e, "__esModule", {
value: !0
}), e.default = void 0;
@majames
majames / markdown-files.md
Last active September 19, 2019 20:43
Audit of Kaggle in repo markdown documentation
  • ./README.md - some documentation about trouble shooting failed npm installs and links to Kaggle.Web/README and Kaggle.Web/docs/README.linux.md
  • ./Kaggle.Sdk/README.md - brief documentation related to creating a handler and exposing it to the frontend
  • ./Kaggle.Sdk/Competitions/README.md - contains links to other readmes in the repo related to competitions
  • ./Kaggle.Browser.Tests/README.md -
  • ./Kaggle.Services.Competitions/README.md - empty documentation, ignore

Typescript Markdown Files

  • ./typescript/configs/README.md - briefly describes that directory contains typescript configs
  • ./typescript/README.md - unify with Kaggle.Web/README.md and lift into root
@majames
majames / jest-error.log
Created May 27, 2019 06:23
react hooks and enzyme error
console.error ../../../node_modules/react-dom/cjs/react-dom.development.js:506
Warning: An update to QuickLook inside a test was not wrapped in act(...).
When testing, code that causes React state updates should be wrapped into act(...):
act(() => {
/* fire events that update state */
});
/* assert on the output */
private containerLoadingMessage = (): InflightUploadMessage | undefined => {
const { container } = this.state;
if (isUploadContainer(container)) {
const inflightUploadCount = this.getInflightLocalUploadsCount(container);
if (inflightUploadCount > 0) {
const { children } = container;
const completeUploadCount = children.length - inflightUploadCount;
@majames
majames / hacks.tsx
Created March 28, 2019 17:34
@material/react-drawer hacks
import DefaultDrawer, { DrawerProps } from "@material/react-drawer";
// creating the styled component
const Wrapper = styled((props: DrawerProps) => (
// HACK: workaround buggy drawer typings
<DefaultDrawer {...props as any} />
))`
&& {
/* HACK: work around buggy drawer styles */
position: fixed;
@majames
majames / DatasetListing.cshtml
Created January 25, 2019 18:26
[GREENDOC] Razor Templating
<!-- File located in Kaggle.Web project under Views/Datasets/Listing -->
<!-- Template extends default layout which has basic HTML scaffold -->
@model DatasetListingDto
@{ PageTitle = "Kaggle | Datasets Listing" }
@section HeadTags {
<meta name="twitter:card" content="summary" />
...
}
@majames
majames / ExampleRoute.cs
Last active March 20, 2019 21:30
[GREENDOC] Static HTML Files
[Route("datasets")]
public async Task<ActionResult> ViewDatasetListing() {
if (/*user is auth'd*/) {
return ServeStaticFile("datasets", "listing");
} else {
return PageNotFound();
}
}
@majames
majames / NestedImportExample.tsx
Last active January 9, 2019 23:38
Internal package structure in @kaggle/web and @kaggle/components
// Component deeply nested within the src/kernels/ folder
// For example, src/kernels/Editor/Sidebar/KernelsComponent/KernelsComponent.tsx
// TypeScript path mappings are used to map this import back to the root of the src directory (i.e. src/datasets/)
// This makes is easier for devs to "do the right thing" and only import dataset components that the team has agreed to support
import { DatasetUploader } from '@datasets';