Skip to content

Instantly share code, notes, and snippets.

View joshje's full-sized avatar

Josh Emerson joshje

View GitHub Profile

Keybase proof

I hereby claim:

  • I am joshje on github.
  • I am joshje (https://keybase.io/joshje) on keybase.
  • I have a public key ASDCnV5pterqvlBYRNzpVFNwU1ov27u0PY1_HhnenBFcgQo

To claim this, I am signing this object:

@joshje
joshje / update-intercom-company.js
Created November 24, 2016 16:19
Update intercom company
const intercomClient = new require('intercom-client').Client({appId:"he1f413x" ,appApiKey: "************"});
intercomClient.companies.create({ company_id: '636e7949-f0ac-4b73-bedf-ba8204205714', custom_attributes: { plan:"STARTER_ANNUAL", trial_ended: true } }, function (r) { console.log(r); });
@joshje
joshje / styles.less
Created July 6, 2016 09:19
Atom editor custom stylesheet
// Make close icons always visible
.tab-bar .tab,
.tab-bar .tab.active {
.title {
padding-right: 20px;
}
.close-icon {
transform: scale(1);

Keybase proof

I hereby claim:

  • I am joshje on github.
  • I am joshje (https://keybase.io/joshje) on keybase.
  • I have a public key whose fingerprint is 3224 62D2 9BFD 69ED 9312 2D02 4A47 F6D0 7BB0 495D

To claim this, I am signing this object:

@joshje
joshje / netmag-wordcount.js
Last active August 29, 2015 14:07
Word counter for net magazine article submissions (1 line of code = 10 lines). Uses <pre> tags in the page to determine code blocks.
(function() {
var codeBlocks = document.getElementsByTagName('pre'),
codeLines = 0,
body = document.getElementsByTagName('body')[0],
text = function(el) {
if (el.innerText) return el.innerText;
return el.textContent;
};
var wordCount = text(body).split(' ').length;
@joshje
joshje / ikealist.js
Last active December 19, 2015 15:08
Reveal product codes on IKEA shopping list (http://www.ikea.com/webapp/wcs/stores/servlet/InterestItemDisplay)
(function() {
var l = document.querySelectorAll('.prodInfoContainer a');
for (i=0; i<l.length; i++) {
s = document.createElement('span');
s.innerHTML = l[i].href.replace(/[^0-9]/,'') + '<br>';
l[i].appendChild(s);
}
}();
@joshje
joshje / fontloading.html
Created October 30, 2012 11:36
Load Fontdeck fonts asynchronously with hidden text timeout
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script>
function async(url) {
var a = document.createElement('script');
a.async = true;
a.src = url;
var b = document.getElementsByTagName('script')[0];
@joshje
joshje / supportsFFS.html
Created June 21, 2012 11:02
CSS font-feature-settings support detection
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Opentype Test</title>
<style>
span.opentype-test {
font-family: Corbel;
font-size: 100px;
position: absolute;
@joshje
joshje / reveal-titles.js
Created April 30, 2012 17:19
Reveal title attribute within innerHTML of time elements
// Uncompressed:
(function() {
var els = document.querySelectorAll('[title]');
for (var i=0,len=els.length;i<len;++i) {
var el = els[i];
if (el.title!='') {
el.innerHTML+=' <span style="background:#EEE;color:#333;padding:2px;font-weight:normal;font-style:normal">'+el.title+'</span>';
el.removeAttribute('title');
}
}
@joshje
joshje / async
Created January 10, 2012 01:14
Asyncronously load javascript by passing in a URL
function async(url) {
var a = document.createElement('script');
a.async = true;
a.src = url;
var b = document.getElementsByTagName('script')[0];
b.parentNode.insertBefore(a, b);
}