Skip to content

Instantly share code, notes, and snippets.

@Pestov
Pestov / gist:6237060
Created August 15, 2013 00:05
Convert image to URI
<form method="post" action="#" enctype="multipart/form-data"><input type="file" name="file"/> <input type="submit" value="Кодировать в URI"/></form>
<?php
if(isset($_FILES['file'])){
echo "<textarea rows='1' cols='1' style='margin:10px;width:100%;height:800px;border:2px solid #333'>url(data:{$_FILES['file']['type']};base64,
" . base64_encode(file_get_contents($_FILES['file']['tmp_name'])) . ')</textarea>';
}
?>
/* Reset default Webkit search input style http://stackoverflow.com/questions/9421551/how-do-i-remove-all-default-webkit-search-field-styling */
input[type='search']::-webkit-search-decoration,
input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-results-button,
input[type='search']::-webkit-search-results-decoration {
display: none;
}
/* Reset browser native datepicker http://stackoverflow.com/questions/11320615/disable-browser-native-datepicker */
@Pestov
Pestov / BrowserDetect
Created October 16, 2013 11:01
Browser Detection
// Don't work for Opera 15+
// navigator.userAgent.indexOf(' OPR/') >= 0
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
@Pestov
Pestov / LinkStyles
Created October 16, 2013 11:03
CSS for Links
/*External Link - adds a little external link icon to all of your external links */
a[href^="http:"] {background: url(/images/elementsImages/externalLink.gif) no-repeat right top; padding-right:10px;}
/*IMPORTANT: Reset your internal links that use absolute URLS by replacing yoursite.com with your site's URL, below*/
a[href^="http://www.yoursite.com"], a[href^="http://yoursite.com"] {background-image:none !important; padding-right:0px;}
/*Use on external links that are images or have background colors/borders...when ever you dont want an icon to appear*/
.exempt {background-image:none !important; padding:0px;}
/*This method does not work for IE6 or IE7 (big surpise) you can add the class .external to a few of your important external links so they work in IE6/7 if you wish. IE will just ignore these rules so there are now worries.*/
@Pestov
Pestov / Git Commands.txt
Last active September 20, 2022 18:06
Git Commands
$ git reset --hard HEAD~3 <1>
git remote prune origin - удалить все ветки
git commit --amend -m - Edit commit message
git reset HEAD^ # remove commit locally
git push origin +HEAD # force-push the new HEAD commit
git reset --hard <commit-hash>
@Pestov
Pestov / externalink
Created February 11, 2014 01:27
Style External Links with CSS