Skip to content

Instantly share code, notes, and snippets.

/* For a Firefox only: */
@-moz-document url-prefix() {
fieldset {
display: table-cell;
}
}
/* For a Webkit browsers: */
fieldset {
min-width: 0;
}
@alekskorovin
alekskorovin / query-string.js
Created December 2, 2013 14:44
Query String - get parameters from URL
var QueryString = function () {
var query_string = {},
query = window.location.search.substring(1),
vars = query.split("&");
for (var i=0, j = vars.length; i < vars.length; i++) {
var pair = vars[i].split("=");
// If first entry with this name
if (typeof query_string[pair[0]] === "undefined") {
// Boring
if (isThisAwesome) {
alert('yes'); // it's not
}
// Awesome
isThisAwesome && alert('yes');
// Also cool for guarding your code
var aCoolFunction = undefined;
@alekskorovin
alekskorovin / thumbnails-for-youtube.html
Created November 29, 2013 16:27
Thumbnails for YouTube video
<img alt="" src="http://img.youtube.com/vi/zmPzbZVUp3g/1.jpg" />
<img alt="" src="http://img.youtube.com/vi/zmPzbZVUp3g/2.jpg" />
<img alt="" src="http://img.youtube.com/vi/zmPzbZVUp3g/3.jpg" />
@alekskorovin
alekskorovin / selection.css
Created October 28, 2013 16:35
Styles for selected text
::-moz-selection {
text-shadow: 1px 1px 0 #000;
background: #999;
color: #fff;
}
::selection {
text-shadow: 1px 1px 0 #000;
background: #999;
color: #fff;
}
@alekskorovin
alekskorovin / calculate-size-of-video.js
Created October 17, 2013 14:40
Calculation of Video container with standard proportions. jQuery
var videoWidth = containerOfVideo.width(),
videoHeight = Math.round(videoWidth * 0.5625);
@alekskorovin
alekskorovin / reset-iframe-video.js
Created October 17, 2013 14:36
Reset a Video players - iframes from YouTube or Vimeo, etc.
// Reset a Video players - iframes from YouTube or Vimeo, etc.
var resetIframeVideoPlayer = function () {
var $videoPlayer = $(this), videoIframeSrc;
// Store the src of iframe with video
videoIframeSrc = $player.attr('src');
// Clear src attribute from an iframe
$videoPlayer.attr('src', '');
@alekskorovin
alekskorovin / unique-self-executed-function.js
Created October 17, 2013 14:27
Unique Self Executed function
(function mySelfExecutedFunction() {
//
})();
@alekskorovin
alekskorovin / on.js
Created October 17, 2013 14:21
Handler for jQuery
; (function ($) {
'use strict'
var handler = function() {
//
}
$('.btn-class').on('click', handler);
@alekskorovin
alekskorovin / action-after-confirm.js
Created October 17, 2013 14:02
Setting up a confirm window before performing of an action
var beforeActionMessage = 'Are you sure you want to perform this action?',
confirmWindow = window.confirm(beforeActionMessage);
if (confirmWindow) {
// Do some action here
} else {
return false;
}