Skip to content

Instantly share code, notes, and snippets.

@LPGhatguy
LPGhatguy / main.rs
Created Apr 7, 2019
What percentage of v4 UUIDs are valid UTF-8?
View main.rs
// 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 / compareList.lua
Created Jun 12, 2018
A quick-and-dirty list comparison function in Lua that visualizes each list, handling sparse arrays correctly.
View compareList.lua
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
View WindowedView.lua
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 / selector-example.lua
Created Apr 10, 2018
Copying the Reselect API in ~40 lines of code. Does not allocate on call. Untested.
View selector-example.lua
local function applySelector(selector, ...)
if typeof(selector) == "string" then
return (...)[selector]
else
return selector(...)
end
end
local function listShallowEqual(a, b, len)
for i = 1, len do
@LPGhatguy
LPGhatguy / .cvimrc
Last active Feb 28, 2018
Configuration for cVim
View .cvimrc
set smoothscroll
unmap d u
let blacklists = ["*://mail.google.com/*", "*://play.google.com/*", "*://*.slack.com/*", "*://discordapp.com/*"]
@LPGhatguy
LPGhatguy / main.rs
Created Jun 3, 2017
Start program, attempt to move window, observe that window resizes
View main.rs
extern crate winit;
fn main() {
let events_loop = winit::EventsLoop::new();
let window = winit::WindowBuilder::new()
.with_dimensions(200, 200)
.with_max_dimensions(200, 200)
.build(&events_loop)
.unwrap();
@LPGhatguy
LPGhatguy / generate-community.html
Created May 24, 2017
Generate several 'community' emoji -- families construct with zero-width-joiners joined together. Renders most correctly on Windows 10 w/ Creators Update!
View generate-community.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
#output {
font-size: 3rem;
margin: 0;
padding: 0.5rem;
line-height: 1.2;
@LPGhatguy
LPGhatguy / gist:f4caed3b81e7f84bccb701eb953a59ee
Created May 24, 2017
Community emoji, rendered by GitHub
View gist:f4caed3b81e7f84bccb701eb953a59ee
👩🏽‍🚒‍👩🏻‍👦🏻‍👶🏻‍👩🏻‍🍳‍👩🏼‍👧🏾‍👶🏾‍👩🏽‍🚀‍👨🏽‍👦🏽‍👦🏼‍👨🏾‍🏫‍👨🏼‍👶🏾‍👧🏽‍👨🏽‍✈️‍👨🏾‍👦🏾‍👦🏼‍👨🏼‍🚒‍👩🏼‍👧🏼‍👧🏾‍👨🏾‍🎨‍👨🏼‍👦🏾‍👧🏻‍👨🏾‍✈️‍👨🏾‍👶🏼‍👦🏼‍👨🏼‍🎨‍👩🏿‍👧🏾‍👧🏽‍👩🏿‍💻‍👨🏽‍👦🏽‍👧🏼‍👩🏿‍✈️‍👨🏾‍👧🏿‍👧🏻‍👩🏾‍🎨‍👨🏼‍👦🏼‍👧🏻‍👩🏻‍🌾‍👨🏽‍👧🏾‍👧🏾‍👩🏼‍⚕️‍👨🏽‍👧🏾‍👧🏼‍👨🏾‍🚒‍👨🏿‍👶🏽‍👧🏽‍👨🏻‍💻‍👨🏽‍👧🏾‍👶🏾‍👨🏽‍🚀‍👩🏽‍👧🏼‍👧🏽‍👨🏽‍🏭‍👩🏽‍👶🏼‍👦🏾‍👨🏼‍🚒‍👩🏽‍👶🏾‍👦🏻‍👨🏼‍✈️‍👨🏾‍👧🏽‍👧🏼‍👨🏼‍🏫‍👩🏾‍👧🏻‍👦🏾‍👨🏽‍🍳‍👩🏿‍👶🏾‍👦🏻‍👨🏻‍✈️‍👩🏼‍👶🏼‍👶🏻‍👩🏻‍✈️‍👨🏿‍👧🏻‍👧🏼‍👨🏾‍🎨‍👩🏼‍👶🏽‍👶🏽‍👩🏼‍🚀‍👩🏾‍👦🏼‍👧🏽‍👨🏽‍💻‍👩🏼‍👧🏼‍👦🏾‍👨🏾‍🎤‍👩🏾‍👧🏽‍👦🏾‍👨🏻‍🎨‍👨🏼‍👶🏼‍👧🏽‍👩🏼‍🎤‍👨🏻‍👧🏼‍👧🏾‍👩🏼‍🎓‍👨🏼‍👧🏼‍👧🏾‍👨🏾‍🚒‍👨🏾‍👧🏾‍👶🏿‍👨🏾‍💼‍👨🏾‍👧🏾‍👦🏾‍👩🏽‍🚒‍👩🏼‍👶🏿‍👧🏾‍👨🏿‍🍳‍👩🏽‍👧🏽‍👧🏾‍👩🏾‍🚀‍👩🏼‍👧🏾‍👧🏿‍👩🏿‍🍳‍👩🏽‍👧🏽‍👧🏼‍👨🏽‍🏭‍👨🏿‍👧🏾‍👧🏽‍👨🏽‍🍳‍👩🏼‍👦🏻‍👶🏻‍👨🏽‍🏫‍👩🏻‍👧🏼‍👧🏼‍👨🏻‍🔬‍👨🏿‍👧🏿‍👶🏾‍👩🏾‍🏫‍👨🏽‍👧🏼‍👧🏼‍👨🏼‍🎤‍👨🏽‍👦🏻‍👧🏼‍👨🏽‍🍳‍👩🏻‍👧🏾‍👧🏾‍👩🏻‍🔬‍👩🏾‍👧🏻‍👶🏼‍👨🏽‍🎨‍👩🏻‍👦🏽‍👶🏾‍👩🏻‍💼‍👨🏼‍👧🏽‍👶🏽‍👩🏾‍🎤‍👨🏽‍👶🏻‍👧🏾‍👩🏽‍🔬‍👩🏾‍👦🏽‍👧🏻‍👨🏿‍🎨‍👨🏼‍👧🏾‍👧🏼‍👩🏼‍🚒‍👩🏼‍👦🏾‍👧🏽‍👨🏽‍✈️‍👨🏿‍👧🏾‍👧🏿‍👨🏾‍🏭‍👩🏼‍👶🏾‍👶🏽‍👨🏽‍🎤‍👩🏼‍👶🏾‍👶🏽‍👨🏽‍🚀‍👨🏼‍👧🏿‍👶🏾‍👨🏾‍🏫‍👨🏼‍👶🏼‍👶🏼‍👨🏻‍🏭‍👩🏿‍👧🏼‍👧🏿‍👩🏽‍🎨‍👨🏽‍👶🏾‍👧🏾‍👨🏻‍🚀‍👨🏼‍👦🏾‍👶🏿‍👩🏽‍✈️‍👨🏾‍👦🏿‍👧🏾‍👨🏼‍💻‍👩🏽‍👧🏻‍👶🏼‍👨🏿‍🏭‍👨🏽‍👧🏾‍👧🏼‍👨🏻‍✈️‍👩🏾‍👦🏾‍👶🏽‍👩🏼‍🔬‍👩🏽‍👶🏾‍👶🏾‍👨🏽‍🏭‍👩🏾‍👶🏿‍👦🏾‍👨🏽‍🎤‍👩🏽‍👦🏼‍👶🏾‍👩🏾‍🍳‍👩🏽‍👦🏼‍👶🏾‍👩🏽‍🏫‍👩🏽‍👶🏾‍👧🏽‍👩🏽‍🎨‍👨🏾‍👧🏻‍👦🏽‍👨🏾‍🔬‍👨🏿‍👦🏼‍👧🏿‍👩🏽‍🌾‍👩🏼‍👶🏼‍👧🏽‍👨🏿‍🎓‍👩🏼‍👶🏽‍👶🏿‍👩🏿‍🚀‍👩
@LPGhatguy
LPGhatguy / keybase.md
Created Mar 7, 2017
Proving Keybase.io identity!
View keybase.md

Keybase proof

I hereby claim:

  • I am lpghatguy on github.
  • I am lpghatguy (https://keybase.io/lpghatguy) on keybase.
  • I have a public key ASAlopNHLRvh_NYWSkVIlct6b9hEdlseTDB97NKEtjNUCgo

To claim this, I am signing this object:

@LPGhatguy
LPGhatguy / game.html
Last active Sep 29, 2019
Reglike: A simple roguelike written in Regex!
View game.html
<!DOCTYPE html>
<html>
<head>
<title>Reglike</title>
<style>
*, *::before, *::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}