Skip to content

Instantly share code, notes, and snippets.

View johnarban's full-sized avatar

John Arban Lewis johnarban

View GitHub Profile
@johnarban
johnarban / index.html
Created January 20, 2026 13:58
WWT Bug Demo
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>WWT Asteroid Orbit (Hosted Model)</title>
</head>
<body>
<div id="wwtcanvas"></div>
<div id="ui">
@johnarban
johnarban / Testing Vue Reactivity with Classes.vue
Last active January 11, 2026 01:24
Testing Vue Reactivity with Classes
<script setup lang="ts">
import { ref, type Ref, reactive } from 'vue'
class Person {
name: string
age: number
called = 0;
constructor(name: string, age: number) {
this.name = name
this.age = age
@johnarban
johnarban / App.vue
Created September 22, 2025 16:52
Vue SFC Playground showing how refs and values passed to composables work
<script setup>
import { ref } from 'vue'
import { useTest } from './test';
const notRefValue = 3
const refValue = ref(7)
const test = useTest(notRefValue, refValue)
/*
* Binary Ajax 0.1.10
* Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com, http://blog.nihilogic.dk/
* Licensed under the MPL License [http://www.nihilogic.dk/licenses/mpl-license.txt]
*/
var BinaryFile = function(strData, iDataOffset, iDataLength) {
var data = strData;
var dataOffset = iDataOffset || 0;
@johnarban
johnarban / view_nested.py
Created October 29, 2022 20:05
View the nested structure of a pandas DataFrame
from pandas import DataFrame, concat, Series, isna
import json
def expand_subdict(df_col):
"""
Expand a column of dictionaries into a Series
Drop any all nan columns
"""
# drop empty columns that are sometimes created.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johnarban
johnarban / WCSAxes Example.ipynb
Last active June 17, 2021 14:14
Worked example plotting data with WCS defined axes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@johnarban
johnarban / simple cutoff_filter.py
Last active March 6, 2021 19:21
A simple frequency cutoff filter based on FFT
# adapted from > https://scipy-lectures.org/intro/scipy/auto_examples/plot_fftpack.html
import numpy as np
from scipy import fftpack
from matplotlib import pyplot as plt
def signal_gen(time_step):
# generate a random signal with low and high frequency components
np.random.seed(1234)
@johnarban
johnarban / IronFall.py
Last active July 18, 2021 09:44
Time to fall from 1 meter to surface of 100 kg iron ball (CodysLab question)
#this should work with a vanilla python install
from math import sqrt, acos
#equation from https://aapt.scitation.org/doi/pdf/10.1119/1.2344089
# derivation is included in their appendix. it is not openly available
# let's work in kg - m - s, SI units
G = 6.674e-11 # 6.674e-11 in SI units
M = 100 # kg
dens = 7847 # kg/m^3
@johnarban
johnarban / montyhall.py
Last active January 26, 2020 01:38
Brooklyn 99 themed Monty Hall Problem
# Simulate the monty hall probelm
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
#import tqdm # gives you a progress bar using tqdm.trange(n)
def monty_hall(switch = None):
# get some doors
door = np.array([0,1,2])