Skip to content

Instantly share code, notes, and snippets.

View wraithgar's full-sized avatar

Gar wraithgar

  • GitHub Staff
  • Tri-Cities, WA
View GitHub Profile
@wraithgar
wraithgar / lifecycle.txt
Created February 18, 2021 15:24
npm7 lifecycle scripts notes
npm event lifecycle
cache add
- prepare (pacote.tarball.stream @npmcli/run-script)
ci
- preinstall (@npmcli/run-script)
- install (@npmcli/run-script)
- postinstall (@npmcli/run-script)
- prepublish (@npmcli/run-script)
- preprepare (@npmcli/run-script)
@wraithgar
wraithgar / gen.js
Created July 7, 2020 18:00
quick and dirty password generator
'use strict'
const fs = require('fs')
const words = fs.readFileSync('/usr/share/dict/words', 'utf8').split('\n')
const passwords = []
for (let i = 0; i < 12; i++) {
const randomNumber = Math.floor(Math.random() * words.length)
passwords.push(words[randomNumber])
}
console.log(passwords.join('-'))
@wraithgar
wraithgar / promisify.js
Created May 24, 2020 19:56
Promisify all the functions in any object with a few lines of es6
const handler = {
get: function (target, prop, receiver) {
if (typeof target[prop] !== 'function' ) {
return target[prop]
}
return function () {
return new Promise((resolve, reject) => {
Reflect.get(target, prop, receiver).apply(target, [...arguments, function (err, result) {
if (err) {
return reject(err)
@wraithgar
wraithgar / bug.rb
Created December 5, 2019 17:13
ruby strftime/strptime bug
require 'date'
Date.strptime(Date.new(2006,1,1).strftime('%U-%Y'), '%U-%Y')
#<Date: 2006-01-01 ((2453737j,0s,0n),+0s,2299161j)>
Date.strptime(Date.new(2000,12,31).strftime('%U-%Y'), '%U-%Y')
#<Date: 2000-12-31 ((2451910j,0s,0n),+0s,2299161j)>
Date.strptime(Date.new(2001,1,7).strftime('%U-%Y'), '%U-%Y')
#<Date: 2001-01-07 ((2451917j,0s,0n),+0s,2299161j)>
Date.strptime(Date.new(2001,1,1).strftime('%U-%Y'), '%U-%Y')
# Traceback
const clean = 'bullshit';
let dirty = '';
for (const letter of clean) {
const hex = letter.charCodeAt().toString(16);
dirty = dirty + unescape(`%uDB40%uDD${hex}`);
}
console.log(`Clean: ${clean}`);
console.log(`Dirty: ${dirty}`);
console.log(`Stripped: ${unescape(escape(dirty).replace(/u.{8}/g,''))}`);
@wraithgar
wraithgar / gist:a0712ee04368e5ecb9b9706ceccd25ca
Created March 19, 2019 16:57
How I picked my 2019 Bracket
ROUND 1
Duke/NC - NC because Duke always reminds me of David Duke and that's a non-starter.
VCU/UCF - UCF. Both remind me of Vets without Borders/ Vets Sans Frontieres so I flipped a coin.
Mississippi State / Liberty - Liberty. Originally I was gonna go w/ mississippi cause it's fun to say but then I tried typing it and I don't want to have to do that again.
Virginia Tech / St Louis - Virginia Tech because there are just too many vowels in Louis and I can NEVER type it right the first try
Maryland / Temple / Belmont - Maryland. Come on Temple / Belmont pick a name.
LSU / Yale - Yale in honor of all the crossword puzzle answers this has provided to me over the years (eli)
Louisville / Minnesota - Minnesota. Oh, ya? Ya, donchaknow
Michigan State / Bradley - Bradley. Duh.
Gonzaga / Fairleigh Dickin... - Fairleigh I have never heard of this college and technically still haven't cause the full name didn't even fit on this site.
@wraithgar
wraithgar / meteorology.html
Created April 11, 2017 17:49
readstuff.online file for meteorology etc
<html>
<script>
var go = function(){
\t parent.postMessage(
{"title":"Meteorology etc","description":"Links to great resources for all your meteorological and other planetary science needs","links":[{"url":"https://www.windytv.com/","description":"Windy TV - See what the wind is up to"},{"url":"https://www.wunderground.com/","description":"Weather Underground - Weather data brought to you by weather enthusiasts"},{"url":"https://earthquake.usgs.gov/earthquakes/map/","description":"USGS Earthquake Map - See what's shakin"},{"url":"http://oceanexplorer.noaa.gov/gallery/maps/maps.html","description":"NOAA Ocean Explorer - Find out if it's truly better down where it's wetter"},{"url":"http://volcano.si.edu/reports_weekly.cfm","description":"Global Volcanism Project - Discover what volcanoes were active this week"},{"url":"http://www.cleardarksky.com/","description":"Dark Sky - Astronomical observing conditions for when you want to look up at the infinite universe."}]}, '*')}
</script>
<body onload='go()'/>
<!-- REMARK --> - Allows you to put in your own comments so that if you have
to come back later you can figure out what is going on. No one browsing your
Web page will see this unless they view the source.
Example:<!-- This text Cannot be seen by the user unless the source is viewed. -->
<A> - Allows you to anchor things such as a web page by using the following
<A HREF="Http://www.CompuCure.com">
Example:<A HREF="http://www.CompuCure.com">CompuCure</A>
<ABBREV> - Newer command that is coming out in the new HTML3.0 allows you to
@wraithgar
wraithgar / gist:6431eb458c981fe6c0a8a7ee71754945
Created August 15, 2016 21:46
async foundation validation example
var checkingLogin = false;
var validLogin = true;
var lastCheckedLogin = '';
var checkLogin = Debounce(function (el) {
var code = document.location.search.match(/invite=([^&]*)/);
var val = el.val();
if (code) {
code = code[1];

Keybase proof

I hereby claim:

  • I am wraithgar on github.
  • I am wraithgar (https://keybase.io/wraithgar) on keybase.
  • I have a public key whose fingerprint is 0518 2812 06B9 3CC1 CEDF CA40 A9AB 90AE 879B 73AA

To claim this, I am signing this object: