Skip to content

Instantly share code, notes, and snippets.

@kovaldn
kovaldn / Javascript: window location
Last active March 17, 2016 14:18
Javascript: window location
/*
* ---------------------
* WINDOW LOCATION
* ---------------------
* http://javascript.ru/window-location
*/
http://www.google.com:80/search?q=javascript#test
@kovaldn
kovaldn / CSS: image replacement
Created April 1, 2013 08:22
CSS: image replacement
/*
* Image replacement
*/
.ir {
background-color: transparent;
border: 0;
overflow: hidden;
/* IE 6/7 fallback */
*text-indent: -9999px;
@kovaldn
kovaldn / CSS: all hidden classes
Created April 1, 2013 08:27
CSS: all hidden classes
/*
* Hide from both screenreaders and browsers: h5bp.com/u
*/
.hidden {
display: none !important;
visibility: hidden;
}
/*
@kovaldn
kovaldn / CSS: clear floats
Created April 1, 2013 08:34
CSS: clear floats
/*
* Clearfix: contain floats
*
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* `contenteditable` attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that receive the `clearfix` class.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
@kovaldn
kovaldn / CSS: print
Created April 1, 2013 08:36
CSS: print
@media print {
* {
background: transparent !important;
color: #000 !important; /* Black prints faster: h5bp.com/s */
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
@kovaldn
kovaldn / CSS: HTML5 Boilerplate
Created April 1, 2013 08:37
CSS: HTML5 Boilerplate
/*
* HTML5 Boilerplate
*
* What follows is the result of much research on cross-browser styling.
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
* Kroc Camen, and the H5BP dev community and team.
*/
/* ==========================================================================
Base styles: opinionated defaults
@kovaldn
kovaldn / Javascript: parse string to object
Created April 5, 2013 08:30
Javascript: parse string to object (underscore)
// string: one=1&two=2&three=3
// result: Object {one: 1, two: 2, three: 3};
// see: underscorejs.org
parseQueryString: function (queryString) {
var params = {};
if(queryString){
_.each(
_.map(decodeURI(queryString).split(/&/g),function(el,i){
@kovaldn
kovaldn / Javascript: serialize functions
Created April 15, 2013 07:06
Javascript: serialize functions
(function($) {
// Сериализовать форму в массив и убрать пустые элементы
$.fn.serializeArrayAndFilterEmpty = function() {
return $.grep(this.serializeArray(), function(item) {
return ($.trim(item.value).length > 0);
});
};
// сериализовать форму в массив (для моделей backbone)
$.fn.serializeObject = function(){
var obj = {}
@kovaldn
kovaldn / JavaScript: array.js
Last active December 17, 2015 01:49
JavaScript: array.js
// Sort numerically and ascending:
var myarray=[25, 8, 7, 41]
myarray.sort(function(a,b){return a - b}) //Array now becomes [7, 8, 25, 41]
@kovaldn
kovaldn / Javascript: datatables.js
Last active December 17, 2015 01:49
Javascript: datatables
/*DATATABLES*/
/*
* 0) Важные настройки
*/
'sScrollX' : '1000px',
'sScrollY' : '1000px',
'sDom' : '<"topbar"Tlf>t<"bottom"pir><"nclear">',