Skip to content

Instantly share code, notes, and snippets.

@mikechambers
mikechambers / bungie_ids.dart
Created September 4, 2023 02:28
Destiny 2 Names to test API calls / player search code
This file has been truncated, but you can view the full file.
List<String> ids = [
"#",
"Labradorite#4136",
"Zethos#8910",
"cybil.#0398",
"EPiQ#5973",
"Soffish#1439",
"MrClanker#1356",
@mikechambers
mikechambers / if.js
Created January 1, 2023 00:58
React inline If statements
{(() => {
return "";
})()}
use bevy::prelude::*;
use bevy::window::WindowResized;
//Component to tag a marker
#[derive(Component)]
struct Marker;
fn main() {
App::new()
//add a WindowDescriptor resource. This will be used to set initial
@mikechambers
mikechambers / bevy_breakout.rs
Created October 25, 2022 03:04
Bevy Rust Game Framework Breakout Example with comments
//original at:
//https://github.com/bevyengine/bevy/blob/main/examples/games/breakout.rs
use bevy::{
prelude::*,
sprite::collide_aabb::{collide, Collision},
time::FixedTimestep,
};
//basically our FPS - 60FPS
@mikechambers
mikechambers / gist:0c5abd11529d22082f9027e997b64f45
Created July 25, 2022 19:48
get all medals associated with an activity id
const m = `SELECT
medal_result.reference_id,
count,
character_activity_stats as character_activity_stats_index,
activity.activity_id as activity_id
FROM
medal_result
INNER JOIN
character_activity_stats on character_activity_stats.id = medal_result.character_activity_stats,
activity ON character_activity_stats.activity = activity.id
@mikechambers
mikechambers / format_floats.js
Created January 6, 2022 20:34
Examples of how to format floating point numbers in JavaScript
let output = 123.456789;
let precision = 2;
let mod = Math.pow(10, precision);
let a = Math.round(output * mod) / mod;
let b = output.toFixed(2);
console.log(a);
console.log(b);
@mikechambers
mikechambers / typepad-unfollow.js
Created June 19, 2021 19:20
Tapermonkey Userscript for unfollowing all users in a typepad profile
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// NOTE: CHANGE THE URL TO YOUR PROFILE FOLLOWERS PAGE
// @match https://www.typepad.com/profile/6p00d83429217d53ef/contacts/
// @icon https://www.google.com/s2/favicons?domain=typepad.com
// @grant none
@mikechambers
mikechambers / dclias.sql
Created December 19, 2020 19:51
SQL Scema for storing activity history and stats
BEGIN TRANSACTION;
/* found activities we havent synced details from yet */
CREATE TABLE IF NOT EXISTS 'main'.'activity_id_queue' (
'activity_id' INTEGER NOT NULL,
'character_id' TEXT NOT NULL,
PRIMARY KEY("character_id", "activity_id"),
FOREIGN KEY (character_id)
REFERENCES character (character_id)
@mikechambers
mikechambers / serde_desrialize_with.rs
Created November 14, 2020 23:06
Custom JSON property Deserialization in Rust with Serde
#[derive(Serialize, Deserialize, Debug)]
struct ManifestInfo {
version:String,
#[serde(rename(serialize = "url", deserialize = "mobileWorldContentPaths"), alias="url", deserialize_with = "deserialize_mobile_world_content_Paths")]
url:String,
}
fn deserialize_mobile_world_content_Paths<'de, D>(deserializer: D) -> Result<String, D::Error> where D: serde::de::Deserializer<'de>
{
#[derive(Serialize, Deserialize, Debug)]
struct DestinySearchResponse {
#[serde(rename = "Response")]
response: Vec<DestinyResponseMember>,
#[serde(rename = "ErrorCode")]
error_code: u32,
#[serde(rename = "ThrottleSeconds")]
throttle_seconds: u32,