Skip to content

Instantly share code, notes, and snippets.

View briankung's full-sized avatar

Brian Kung briankung

  • Chicago
View GitHub Profile
@briankung
briankung / Vaccine safety and efficacy.md
Created June 1, 2019 17:28
Vaccine safety and efficacy

I am in the midst of an argument about vaccine safety and efficacy so I have compiled a list of meta analyses detailing both:

SAFETY

Immunogenicity and safety of pandemic influenza A (H1N1) 2009 vaccine: systematic review and meta‐analysis - Yin - 2011 - Influenza and Other Respiratory Viruses - Wiley Online Library https://onlinelibrary.wiley.com/doi/full/10.1111/j.1750-2659.2011.00229.x

  • "We included 16 articles in the meta‐analysis, covering 17,921 subjects...Two serious (BK note: 2/17,921 == 0.01%) vaccination‐associated adverse events were reported, both of which resolved fully. No death or case of Guillain–Barré syndrome was reported. The pandemic influenza (H1N1) 2009 vaccine, with or without adjuvant, appears generally to be seroprotective after just one dose and safe among healthy populations aged ≥36 months; very young children (6–35 months) may need to receive two doses of non‐adjuvanted vaccine or one dose of AS03A/B‐adjuvanted product to achieve seroprotection."

Immunogenicity and safety

@briankung
briankung / activerecord vs arel command comparison.mysql
Created April 24, 2019 02:56
ActiveRecord vs Arel command comparison
-- Story.base.positive_ranked.joins(:taggings).where(taggings: { tag_id: tags.map(&:id) })
EXPLAIN SELECT `stories`.*
FROM `stories`
INNER JOIN `taggings`
ON `taggings`.`story_id` = `stories`.`id`
WHERE `stories`.`merged_story_id` IS NULL
AND `stories`.`is_expired` = false
AND ( ( Cast(upvotes AS signed) - Cast(downvotes AS signed) ) >= 0 )
AND `taggings`.`tag_id` = 159;
import { FluentBundle } from 'fluent/compat';
import { negotiateLanguages } from 'fluent-langneg/compat';
const MESSAGES_ALL = {
'pl': `
title = Witaj świecie!
today-is = Dziś jest { DATETIME($date, month: "long", day: "numeric") }.
`,
'en-US': `
title = Hello, world!
@briankung
briankung / 00 - lobsters top level comment search.js
Last active March 29, 2019 02:14
lobste.rs top level comment search using the root level comment input. If you're using the bookmarklet, save it as a bookmark and then click it once when you want to search top-level comments. Otherwise just copy the contents into console.
javacript:void((() => {
const topLevelComments = [...document.querySelectorAll('ol.comments > li > div')].slice(1),
hide = (node) => { node.closest('li').style.display = 'none' },
show = (node) => { node.closest('li').style.display = null },
reset = () => { topLevelComments.forEach(show) };
window.query = (query) => {
// Convenient for using it as an event handler
if (query && query.target) { query = query.target.value }
@briankung
briankung / lobsters new comments.js
Last active March 25, 2019 22:03
Bookmarklet to scroll through lobste.rs comments in order
javascript:void(
(function() {
this.distanceFromTop = (a, b) => {
return Math.sign(a.getBoundingClientRect().top - b.getBoundingClientRect().top);
};
this.setUnreadElements = () => {
document.unreadElements = [...document.querySelectorAll('[class*=unread]')].sort(this.distanceFromTop);
};
@briankung
briankung / Advent of Code.md
Last active December 2, 2018 22:45
Advent of Code 2018
@briankung
briankung / timingattack.rb
Created October 7, 2018 14:51
Timing attack test
# $ gem install benchmark-ips
require 'benchmark/ips'
Benchmark.ips do |x|
x.report("long correct string: ") { "abfhbeufangi" == "abfhbeufangi" }
x.report("long mostly correct string: ") { "abfhbeufangx" == "abfhbeufangi" }
x.report("long incorrect string: ") { "bbfhbeufangi" == "abfhbeufangi" }
x.report("too short: ") { "bbfhbe" == "abfhbeufangi" }
x.report("too long: ") { "abfhbeufangibbfhbe" == "abfhbeufangi" }
@briankung
briankung / 00.md
Last active May 14, 2024 19:20
[RFC] Making sense of secure token authentication in Rails

/ be me

/ be working on new Rails API web app

/ ...I can't. I hate this format

...so I was looking up how to do simple, secure authentication in Rails for my super secret project which you definitely can't find by looking at recent activity on my [GitHub account] (Hail [Mammon][[0][zero]]) and realized that I hadn't implemented authentication in Rails in a long time. The closest I'd come to was throwing [Devise] into my app and grumpily remembering to configure the mailer after the fact.

This will seem unrelated, but bear with me: I learned how to calculate interest rates on loans in something like 6th grade. I have since forgotten how to do that without assistance. Much like how I would have been much better prepared to choose a mortgage back then, I would in some ways be much better prepared to figure out authentication a few years ago when I was just starting out in web dev - and had just implemented it from the [Hartl tutorial]. That said, just like how I now know more of what I'm looking for

@briankung
briankung / 00 - I never said it was good.md
Last active May 24, 2018 20:14
[RFC] GitHub Gists are officially the backend of my blog

Well! I'm officially pretty happy with the fruits of my labor. It's not the prettiest, aesthetically or in terms of code quality, but hey, it does exactly what I want it to. Now I can use GitHub Gists as the backend to my blog - at least until I hit [3000 gists]. I count that among problems I probably won't have to deal with, including:

  1. Getting slashdotted / hackernewsed
  2. GitHub changing their access model for public gists
  3. GitHub rate limiting me
  4. Having more blog posts than I know what to do with
  5. Having more viewers or subscribers than I know what to do with

I'll deal with those problems as they come. In the meantime, a quick rundown of what changed since the last post: