Skip to content

Instantly share code, notes, and snippets.

View jonathansampson's full-sized avatar
🦁
*roar*

Sampson jonathansampson

🦁
*roar*
View GitHub Profile
@jonathansampson
jonathansampson / getRetweeters.js
Last active June 9, 2023 17:36
When viewing a list of users who retweeted a Tweet, these functions can extract that list from the global React state, making it easier to analyze the accounts for commonalities and other patterns.
const SELECTORS = {
RT_ROOT: "div[aria-label='Timeline: Retweeted by']",
REACT_ROOT: "#react-root > div > div",
};
/**
* Retrieve the properties of a React element.
* @param {Object} element - The target React element.
* @returns {Object} The properties of the given React element.
* @throws Will throw an error if React props are not found.
@jonathansampson
jonathansampson / intersectsNode.js
Created June 3, 2016 00:40
A polyfill for Range.prototype.intersectsNode
if ( !Range.prototype.intersectsNode ) {
Range.prototype.intersectsNode = function ( node ) {
let range = document.createRange();
range.selectNode( node );
return 0 > this.compareBoundaryPoints( Range.END_TO_START, range )
&& 0 < this.compareBoundaryPoints( Range.START_TO_END, range );
};
}
@jonathansampson
jonathansampson / valueAsNumber.js
Created August 4, 2014 15:48
`valueAsNumber` shim for Internet Explorer 11
(function () {
/* Internet Explorer 11 may have trouble retrieving the number type
of an input value. This short script performs a quick test, and repairs
the functionality if necessary. Load before attempting to use the
`valueAsNumber` property on input elements. */
"use strict";
var a = document.createElement( "input" );
<dl class="messages">
<dt>u/cokechan: Can you talk about the machine learning model that serves ads? What features is the model trained on?</dt>
<dd>Currently betting on ELPH: Entropy Learning Pruned Hypothesis but all the Bayesian tools in the kit work. For proof of humanity (see last answer) we know of potential partners using RNNs. The key with machine learning is data feed quality. Browsers are juicy: navigation, tab clusters, opener/openee relations, scrolling of content, and (bigger) search query log, ecommerce log, form fill data. Plus info you volunteer when onboarding about demographics, brand loyalty, that stays on device and is encrypted with client key if you sync. We can do cross-device attribution via encrypted sync + blind tokens, without any data in clear on servers. This will be huge!</dd>
</dl>
<style>
dl.messages {
max-width: 85%;
font-family: tahoma;
font-size: 16px;

##Pocket Doesn't Work in the Brave Browser

###Windows Users

Open Brave, and navigate to the about:preferences#advanced page. Ensure that Pocket is turned off, and close Brave.

Press Win+E to open Explorer, and navigate to %AppData%\Roaming\brave\Extensions. At this point, you should see numerous folders; delete niloccemoadcdkdjlinkgdfekeahmflj.

Open Brave, and navigate to the about:preferences#advanced page. Turn on Pocket.

@jonathansampson
jonathansampson / gist:6954377
Last active December 25, 2015 09:29
Initial attempts at logging the console support for each major browser/version.
/*
(function () {
var prop, props = [];
for ( prop in console ) {
props.push({
name: prop,
type: Object.prototype.toString.call( console[ prop ] )
@jonathansampson
jonathansampson / dabblet.css
Created February 13, 2013 06:45
Repeating Lateral Text Shadows - By @LeaVerou
/* Repeating Lateral Text Shadows - By @LeaVerou */
body { margin: 0 }
h1 {
color: #3D6AA2;
position: relative;
font: bold 2em/1em 'Segoe UI';
}
@jonathansampson
jonathansampson / dabblet.css
Created February 4, 2013 21:15
A Bandeira do Brasil
/**
* A Bandeira do Brasil
*/
body { margin: 0 }
html { background: #111111 }
.brasil {
/* Adjust for larger/smaller flag */
font-size: 20px;
@jonathansampson
jonathansampson / dabblet.css
Created January 19, 2013 07:13
Make it a marquee
/* Make it a marquee */
.marquee {
width: 450px;
margin: 0 auto;
overflow: hidden;
white-space: nowrap;
box-sizing: border-box;
animation: marquee 50s linear infinite;
}
ul {
padding-left: 0;
list-style: none;
line-height: 1.5em;
font-family: Tahoma;
}
ul::before {
font-weight: 700;
content: "\53\68\2a\74\20\4c\69\73\74\3a";