I hereby claim:
- I am rblakejohnson on github.
- I am beedewok (https://keybase.io/beedewok) on keybase.
- I have a public key ASDIFdqVU3kvAV17EJHHYaeFew7tkOeQTx1rPMkacfVYRAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
function fakeRequest(delay=1000, result='success') { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
if (result === 'success') { | |
resolve(); | |
} | |
if (result === 'error') { | |
reject(); | |
} | |
if (result === 'random') { |
function setEndOfContenteditable(contentEditableElement) { | |
var range = document.createRange();//Create a range (a range is a like the selection but invisible) | |
var selection = window.getSelection();//get the selection object (allows you to change selection) | |
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range | |
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start | |
selection.removeAllRanges();//remove any selections already made | |
selection.addRange(range);//make the range you have just created the visible selection | |
} | |
// found here https://stackoverflow.com/posts/3866442/revisions |
[ | |
{ "keys": ["super+v"], "command": "paste_and_indent" }, | |
{ "keys": ["super+shift+v"], "command": "paste" }, | |
{ "keys": ["ctrl+s"], "command": "toggle_side_bar" }, | |
{ "keys": ["super+shift+r"], "command": "reindent" } | |
] |
var i = 0; | |
$('input').keypress(function() { | |
if (this.timeoutId) { | |
window.clearTimeout(this.timeoutId); | |
} | |
this.timeoutId = window.setTimeout(function () { | |
// do something | |
}, 200); | |
}); |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Modal Sans-JS</title> | |
<style> | |
* { box-sizing: border-box } | |
body { |
(function(){ | |
var putHere = $("html"), | |
curBrowser; | |
if($.browser.msie){ | |
curBrowser = "ie"; | |
putHere.addClass("ie"+parseInt($.browser.version,10)); | |
} | |
if($.browser.webkit){ | |
curBrowser = "webkit"; |
$('.question').on('click', function(e) { | |
e.preventDefault(); | |
var self = $(this); | |
self.toggleClass("active").next().slideToggle(350); | |
}); | |
$('.answer .close').on('click', function(e) { | |
e.preventDefault(); | |
var answer = $(this).parents(".answer"); | |
answer.slideUp(350); |
$('a').on('click', function() { | |
$('html,body').animate({ | |
scrollTop: $('.box').offset().top - 10 | |
}, 200); | |
}); |
<!DOCTYPE html> | |
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title></title> | |
<meta name="description" content=""> |