Skip to content

Instantly share code, notes, and snippets.

View abachman's full-sized avatar
🙌
good times

Adam Bachman abachman

🙌
good times
View GitHub Profile
@abachman
abachman / .gitignore
Last active November 25, 2023 03:22
Rails vs Dates
View .gitignore
Gemfile.lock
test.db*
@abachman
abachman / README.md
Created March 15, 2023 17:11
git rebase --onto
View README.md

I HAVE:

main     -- A -- B
                  \
staging            C -- D
                         \
feature                   E  
@abachman
abachman / db-joins.md
Last active November 3, 2022 14:59
DB Joins in MySQL
View db-joins.md

Given a database with two tables.

select * from users;
+----+------+
| id | name |
+----+------+
@abachman
abachman / jest.d.ts
Last active July 21, 2022 16:22
attempt at an all-in-one jest performance expectation
View jest.d.ts
declare global {
namespace jest {
interface Matchers<R> {
toBeFasterThan(target: number): Promise<CustomMatcherResult>;
}
}
}
@abachman
abachman / passphrase-generator
Created September 7, 2021 13:32
passphrase generator
View passphrase-generator
#!/usr/bin/env ruby
# ws=open('/usr/share/dict/words').readlines.map(&:strip).select{|w|/^[a-z]{7}$/=~w};100.times{p ws.sample(6).join(' ')}
ws=open('/usr/share/dict/words').readlines.select {|w|
/^[a-z]{5,7}\b/ =~ w
}.map(&:strip)
def n
(rand() * 89 + 10).floor.to_s
end
@abachman
abachman / index.js
Created January 25, 2021 02:35
Signaling Server
View index.js
// npm install; npm start
const http = require('http'),
faye = require('faye');
const server = http.createServer(),
bayeux = new faye.NodeAdapter({mount: '/signal', timeout: 45});
bayeux.attach(server);
server.listen(8080);
@abachman
abachman / templates.md
Created January 5, 2021 02:27
new tab Template block demos
View templates.md

cat facts

url: https://cat-fact.herokuapp.com/facts

code:

<div style="border: 1px solid black;padding: 5px;">
  <h3 style="padding:0;margin:0">CAT FACTS</h3>
  {% for fact in data %}
 {{ fact.text }}
@abachman
abachman / colorWiring breakdown.md
Created October 17, 2020 15:04
turning RGB into GRB
View colorWiring breakdown.md

pieces you asked about:

// translate the 24 bit color from RGB to the actual
// order used by the LED wiring.  GRB is the most common.
int colorWiring(int c) {
  int red = (c & 0xFF0000) >> 16;
  int green = (c & 0x00FF00) >> 8;
  int blue = (c & 0x0000FF);
  red = gammatable[red];
@abachman
abachman / textarea-bonanza.rb
Last active June 5, 2020 00:23
grid height bug?
View textarea-bonanza.rb
#!/usr/bin/env ruby
#
# Demo of the "severe typing lag" layout bug we found.
#
# Things that fix the lag:
# - set textarea width to a non-percentage value
# - set .container grid-template-rows: to anything other than `auto`, e.g.,
# `100vh` or `100%` work; or remove the property
# - set .container height: to a fixed value or remove the property
@abachman
abachman / adafruit-io-data-OBS-browser-source.html
Created April 26, 2020 18:18
Locally hosted OBS Browser Source html file pulling temp + humidity from my little office weather station
View adafruit-io-data-OBS-browser-source.html
<!DOCTYPE html>
<html>
<head>
<!-- Fontawesome 5! Get it here: https://fontawesome.com/how-to-use/on-the-web/setup/hosting-font-awesome-yourself -->
<link rel="stylesheet" href="css/all.min.css" />
<style>
body {
background: rgba(0, 0, 0);
color: #ffffff;
font-size: 16px;