Skip to content

Instantly share code, notes, and snippets.

Brian Kung briankung

Block or report user

Report or block briankung

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View binary to float converter.rb
class String
def prettyb
self.chars.reverse.each_slice(4).map(&:join).join("_").reverse
end
def floatify
string = self.gsub('_', '')
if string.length % 16 != 0
raise RuntimeError, "must be a single or a double precision float"
@briankung
briankung / PlayRustBookmarklet.js
Created Jun 27, 2019
Play Rust! Copies selected text into the Rust playground at https://play.rust-lang.org/
View PlayRustBookmarklet.js
javascript:void(
(function() {
window.open(
`https://play.rust-lang.org/?code=${encodeURIComponent(
window.getSelection().toString()
)}`,
"_blank"
);
})();
)
View Vaccine safety and efficacy.md

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 Apr 24, 2019
ActiveRecord vs Arel command comparison
View activerecord vs arel command comparison.mysql
-- 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;
View 01 - i10n.js
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 Mar 29, 2019
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.
View 00 - lobsters top level comment search.js
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 Mar 25, 2019
Bookmarklet to scroll through lobste.rs comments in order
View lobsters new comments.js
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);
};
View timingattack.rb
# $ 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" }
You can’t perform that action at this time.