Skip to content

Instantly share code, notes, and snippets.

local Roact = require(script.Parent.Parent.Roact)
local WindowedView = Roact.PureComponent:extend("WindowedView")
function WindowedView:init()
self.state = {
viewStart = 1,
viewSize = 1,
paddingStart = 0,
}
@LPGhatguy
LPGhatguy / compareList.lua
Created June 12, 2018 18:13
A quick-and-dirty list comparison function in Lua that visualizes each list, handling sparse arrays correctly.
local function compareList(list, len)
-- We use varargs here since spare arrays make Lua upset
return function(...)
len = len or select("#", ...)
local hasDifference = false
local differentIndexes = {}
for i = 1, len do
if list[i] ~= select(i, ...) then
@LPGhatguy
LPGhatguy / main.rs
Created April 7, 2019 22:44
What percentage of v4 UUIDs are valid UTF-8?
// uuid: 0.7.4 with "v4" feature enabled
// Valid UTF-8: 6868 / 100000000
// Valid %: 0.006868
//
// Sample strings:
//
// "2U6!>:N۸\u{1e}cUV3m%"
// "ɷ1e\r}AـΕ+3Wĭ"
// "aTA ?\u{17}KǺ\u{1f}\u{7}\u{19}\u{2}\u{c}\u{7}?"
@LPGhatguy
LPGhatguy / output.json
Created July 22, 2023 20:33
Output of dyn upcasting survey
{"crate_name":"wgpu_core","trait_name":"hub::GlobalIdentityHandlerFactory","entries":"36","entries_ignoring_upcasting":"20","entries_for_upcasting":"16","upcasting_cost_percent":"80"}
{"crate_name":"num_traits","trait_name":"RefNum","entries":"23","entries_ignoring_upcasting":"13","entries_for_upcasting":"10","upcasting_cost_percent":"76.92307692307693"}
{"crate_name":"wgpu","trait_name":"context::ContextData","entries":"6","entries_ignoring_upcasting":"4","entries_for_upcasting":"2","upcasting_cost_percent":"50"}
{"crate_name":"num_traits","trait_name":"NumOps","entries":"12","entries_ignoring_upcasting":"8","entries_for_upcasting":"4","upcasting_cost_percent":"50"}
{"crate_name":"num_traits","trait_name":"NumAssignOps","entries":"12","entries_ignoring_upcasting":"8","entries_for_upcasting":"4","upcasting_cost_percent":"50"}
{"crate_name":"clap_builder","trait_name":"builder::ext::Extension","entries":"10","entries_ignoring_upcasting":"8","entries_for_upcasting":"2","upcasting_cost_percent":"25"}
{"crate_nam
@LPGhatguy
LPGhatguy / comparison.md
Last active October 28, 2024 23:54
Jolt and Rapier

Comparing Rapier and Jolt

General Properties

Both Jolt and Rapier:

  • Support single and double precision simulation

Only Jolt:

  • Supports soft-body physics
  • Supports multiple object layers
  • Supports multiple broad phase layers