Skip to content

Instantly share code, notes, and snippets.

View GPHemsley's full-sized avatar
🦁
Truth be told, I'm a lion (rawr)

Gordon P. Hemsley GPHemsley

🦁
Truth be told, I'm a lion (rawr)
View GitHub Profile
State RESIDENT_POPULATION Lower House Upper House Lower Root Upper Root Average Root Lower Target Upper Target Lower Difference Upper Difference
Nevada 3104614 42 21 3.99939038936978 4.9099325939538 4.45466149166179 146 42 -104 -21
California 39538223 80 40 3.99193795273853 4.74203037818364 4.36698416546109 341 80 -261 -40
Arizona 7151502 60 30 3.85478865363811 4.64037548883024 4.24758207123418 193 52 -133 -22
Texas 29145505 150 31 3.4302658740141 5.00520538749239 4.21773563075325 308 74 -158 -43
Delaware 989948 41 21 3.71755480908996 4.53450679962861 4.12603080435929 100 32 -59 -11
Oregon 4237256 60 30 3.72695219368894 4.48648659150584 4.10671939259739 162 46 -102 -16
Ohio 11799448 99 33 3.54366454842385 4.65709369204142 4.10037912023264 228 59 -129 -26
Alaska 733391 40 20 3.66112106153829 4.50822471091858 4.08467288622843 91 30 -51 -10
Colorado 5773714 65 35 3.72960750859633 4.37898788988597 4.05429769924115 180 50 -115 -15

Rust Error Handling Cheatsheet - Result handling functions

Introduction to Rust error handling

Rust error handling is nice but obligatory. Which makes it sometimes plenty of code.

Functions return values of type Result that is "enumeration". In Rust enumeration means complex value that has alternatives and that alternative is shown with a tag.

Result is defined as Ok or Err. The definition is generic, and both alternatives have

@GPHemsley
GPHemsley / python_collections.mediawiki
Last active August 29, 2015 13:57
Table of collection data types in Python
container ordered members? unique members? immutable type? used for keys in
No
No
@1wErt3r
1wErt3r / SMBDIS.ASM
Created November 9, 2012 22:27
A Comprehensive Super Mario Bros. Disassembly
;SMBDIS.ASM - A COMPREHENSIVE SUPER MARIO BROS. DISASSEMBLY
;by doppelganger ([email protected])
;This file is provided for your own use as-is. It will require the character rom data
;and an iNES file header to get it to work.
;There are so many people I have to thank for this, that taking all the credit for
;myself would be an unforgivable act of arrogance. Without their help this would
;probably not be possible. So I thank all the peeps in the nesdev scene whose insight into
;the 6502 and the NES helped me learn how it works (you guys know who you are, there's no
@gavinsharp
gavinsharp / dominant-color.js
Created June 9, 2011 17:06 — forked from leibovic/dominant-color.js
Dominant Color
function getDominantColor(aImg) {
let canvas = document.createElement("canvas");
canvas.height = aImg.height;
canvas.width = aImg.width;
let context = canvas.getContext("2d");
context.drawImage(aImg, 0, 0);
// keep track of how many times a color appears in the image
let colorCount = {};