Skip to content

Instantly share code, notes, and snippets.

View revnode's full-sized avatar
🏙️

Marat A. Denenberg revnode

🏙️
View GitHub Profile
@revnode
revnode / DNS Prefetching
Created May 26, 2013 18:19
DNS hostname resolution is one of the issues that can make any website slow. Modern browsers start to be very smart when it comes to DNS resolution, they try to resolve domain names then cache them before the user tries to follow any link on the webpage. With the dns-prefetch feature you are allowed to manually control this operation by telling …
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//google-analytics.com">
<link rel="dns-prefetch" href="//www.google-analytics.com">
<link rel="dns-prefetch" href="//platform.twitter.com">
@revnode
revnode / Link Prefetching
Created May 26, 2013 18:20
Link prefetching allows developers to specify pages or assets they want to silently preload once the page load, like loading the first search results.
@revnode
revnode / Link Prerendering
Created May 26, 2013 18:21
Also you can use the prerendering feature which will make your website even faster, the browser will fetch and render the entire next page on the background and show it only when the user click on the link.
@revnode
revnode / Download Attribute
Created May 26, 2013 18:22
The HTML5 download attribute allows developers to force a file to download rather than go to that specific page, you no longer need to rely on server side code to do that.
<a href="download_pdf.php?id=15" download="myfile.pdf">Download PDF</a>
@revnode
revnode / Regular Expressions
Created May 26, 2013 18:23
I know you'll fall in love with this feature, no more js or a server side code to check if the user's input is a valid email or url adress, with the pattern attribute you can use regular expressions directly.
<input type="email" pattern="[^ @]*@[^ @]*" value="">
@revnode
revnode / Links
Created May 28, 2013 18:33
Links
@revnode
revnode / kwicks
Created May 28, 2013 18:36
Kwicks in CSS
<ul id="kwicks">
<li><a class="john" href="http://en.wikipedia.org/wiki/John_lennon" title="John Lennon">John Lennon</a></li>
<li><a class="paul" href="http://en.wikipedia.org/wiki/Paul_mccartney" title="Paul McCartney">Paul McCartney</a></li>
<li><a class="george" href="http://en.wikipedia.org/wiki/George_harrison" title="George Harrison">George Harrison</a></li>
<li><a class="ringo" href="http://en.wikipedia.org/wiki/Ringo_starr" title="Ringo Starr">Ringo Starr</a></li>
</ul>
<style>
/* structure */
#kwicks { width: 590px; overflow-x: hidden; }
@revnode
revnode / calc
Created May 28, 2013 18:42
CSS Calc
/* basic calc */
.simpleBlock {
width: calc(100% - 100px);
}
/* calc in calc */
.complexBlock {
width: calc(100% - 50% / 3);
padding: 5px calc(3% - 2px);
margin-left: calc(10% + 10px);
@revnode
revnode / tar.gz with gpg-encryption on the fly
Created June 5, 2013 17:46
Create a encrypted tar.gz file from a directory on the fly. The encryption is done by GPG with a public key. The resulting filename is tagged with the date of creation. Very usefull for encrypted snapshots of folders.
tar -cvz /<path>/ | gpg --encrypt --recipient <keyID> > /<backup-path>/backup_`date +%d_%m_%Y`.tar.gz.gpg
@revnode
revnode / push a string in a command's stdin
Created June 5, 2013 19:02
Using a bash "here strings" and "here documents" look leeter than piping echo into the command. Also prevents subshell execution. Word is also expanded as usual.
command <<< word