This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getData(method, url) { | |
return new Promise(function(resolve, reject){ | |
var xhr = new XMLHttpRequest(); | |
xhr.open(method, url); | |
xhr.onload = function() { | |
if (this.status >= 200 && this.status < 300) { | |
resolve(xhr.response); | |
} else { | |
reject({ | |
status: this.status; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Jekyll Quick Reference (Cheat Sheet) | |
## Table of Contents | |
- [Jekyll Commands](#jekyll-commands) | |
- [Octopress Commands](#octopress-commands) | |
- [Folder Structure](#folder-structure) | |
- [Global Variables](#global-variables) | |
- [Site Variables](#site-variables) | |
- [Page Variable](#page-variables) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="img-500.jpg" srcset="img-250.jpg 250w, img-500.jpg 500w, img-1000.jpg 1000w" sizes="(min-width: 700px) 700px, 100vw"> | |
<!-- | |
Great for responsive images; let the browser choose the best image to download __before__ it downloads it by giving it some hints on how big each image actually is AND what size it will be rendered in the final page. With this information the browser will load the smallest image it needs to fulfil the image size requirements. | |
In the above example, we provide the `src` attribute for old browsers that don't support `srcset` and then for those that do we give a choice of images and their actual widths (in pixels). | |
In the `sizes` attribute we tell the browser that all images will be rendered the full width of the viewport (100vw, the default) except when the viewport size is >= 700px in which case we're going to use CSS (somewhere) to limit the size of the image to 700px. Then the browser knows that it doesn't need to download, say, a 1000px-wide image on a 1200px wide screen (as |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' | |
' Be careful, this will report false if you provide | |
' &view&anotherQS=something | |
' you have to include the = thus | |
' &view=&anotherQS=something | |
' | |
if(request.queryString("view").count > 0) then | |
' a queryString named view was provided | |
' even if it had no value &view= | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Ensure that older browsers <IE8 won't freak out when seeing a `console.log()` statement. | |
if(!window.console){window.console={log:function(){}};} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*source: <http://alistapart.com/article/axiomatic-css-and-lobotomized-owls> */ | |
* + * { | |
margin-top: 1.5em; | |
} | |
/* Or for book-like justified paragraphs… */ | |
p { | |
text-align: justify; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { | |
box-sizing: border-box; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
'// Usage: | |
'// | |
'// dim l : set l = new logger | |
'// l.log("Hello")("World") | |
'// l.includeTimetamp = false | |
'// l("Lorem ipsum") | |
'// l.setLogFile("c:\temp\log_2.log").log("This is a new log!") | |
'// set l = nothing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:var n = prompt("width?"); var d = prompt("height?"); gcd = function(a, b){if (b === 0) return a; return gcd(b, a % b);}; var div = gcd(+n, +d); alert(n/div + ":" + d/div); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en-gb"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>Document</title> | |
<link href="/css/style.css" rel="stylesheet" type="text/css"> | |
</head> | |
<body> |
NewerOlder