Skip to content

Instantly share code, notes, and snippets.

View jamespsterling's full-sized avatar

James Sterling jamespsterling

View GitHub Profile
@jamespsterling
jamespsterling / coffee-machine.ts
Created August 28, 2023 16:52
Describe an extensible coffee machine class with can also include a grinder or Wifi reordering module
type RoastLevel = 'light' | 'medium' | 'dark';
interface Grinder {
/**
* Grind specific amount of beans at numeric grind setting
*
* @param size
* @param amount
* @returns success boolean
*/
(function() {
'use strict';
const amazonSearchUrls = ['https://www.amazon.com/s', 'https://smile.amazon.com/s']
const sortQsp = '&s=review-count-rank';
if (amazonSearchUrls.some(substr => window.location.href.startsWith(substr)) && !window.location.href.includes(sortQsp)) {
console.log(`adding ${sortQsp}`);
window.location.replace(`${window.location.href}${sortQsp}`)
}
})();
@jamespsterling
jamespsterling / gmail-hide-ads.js
Created July 24, 2022 16:09
Hides Gmail ads as they appear
(function() {
'use strict';
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = '.hidden { display: none; }';
document.getElementsByTagName('head')[0].appendChild(style);
function blockAds() {

Keybase proof

I hereby claim:

  • I am jamespsterling on github.
  • I am jsterling (https://keybase.io/jsterling) on keybase.
  • I have a public key ASAtl88R7meQtKA3KPd8GH_ethEz4FgyR_fQefVIh4urQwo

To claim this, I am signing this object:

@jamespsterling
jamespsterling / index.html
Created June 18, 2014 19:51
A Pen by James Sterling.
<p>
<a class="buttonTeal" href="/workers-comp/group-rating/ac3-form.php">Learn more about our Unemployment<br>Compensation offering</a>
</p>
@jamespsterling
jamespsterling / sql_headers_comma
Created June 18, 2014 16:26
Fast way to get all column headers in a comma-separated list
select GROUP_CONCAT(CONCAT("'",COLUMN_NAME,"'"))
from INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'my_table'
AND TABLE_SCHEMA = 'my_schema'
order BY ORDINAL_POSITION
@jamespsterling
jamespsterling / goKLH.markdown
Created June 12, 2014 20:46
A Pen by A Non Ymous.