Skip to content

Instantly share code, notes, and snippets.

View ruslansavenok's full-sized avatar

Ruslan ruslansavenok

View GitHub Profile
@ruslansavenok
ruslansavenok / String.prototype.isEmpty.js
Created October 7, 2013 10:50
Checks If String Contains Only White Spaces
/*
* Checks If String Contains Only White Spaces
*
* Useful for Fields Validation $input.val().isEmpty()
*/
String.prototype.isEmpty = function () {
return /^\s*$/.test(this);
}
@ruslansavenok
ruslansavenok / Array.prototype.randomizeData.js
Created October 8, 2013 12:54
Randomly slice an array and rearrange elements
/*
* Randomly slice an array and rearrange elements
*
* Useful for fake ajax data
*
* jQuery Example:
* $.get("/fake-ajax.json", function (data) {
* renderSomething(data.randomizeData());
* });
*
var testReplies = 10000,
testCode = function() {
/* code to test */
//$(this) is #actionBox, use it as your container
//#actionBox that will be removed after test
},
actionBoxConfigure = function(){
/* put elements into actionBox here */
//var i=100;
@ruslansavenok
ruslansavenok / css_reset.css
Last active June 21, 2018 16:56
My CSS Reset
/* -------------------------------------------------------
Based on css reset & normalaize.css
-------------------------------------------------------*/
:focus {outline: 0;}
input, button, textarea { padding: 0; margin: 0;}
input[disabled] { opacity: 1; }
h1, h2, h3, h4, h5, h6 {font-weight: inherit;}
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
@ruslansavenok
ruslansavenok / css_reset_min.css
Created January 17, 2014 13:50
CSS Reset MIN
/* -------------------------------------------------------
CSS Reset (https://gist.github.com/ruslansavenok/7468826)
-------------------------------------------------------*/
:focus{outline:0}input,button{padding:0;margin:0}h1,h2,h3,h4,h5,h6{font-weight:normal}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;vertical-align:baseline}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}sub,
@ruslansavenok
ruslansavenok / helpers.css
Created September 2, 2014 10:29
helpers.css
.no-selection {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.clearfix:after {
content: "";
$(document).ready(function () {
$debug = $('<div class="debug"></div>').css({
position: 'fixed',
bottom: 0,
right: 0,
color: "#fff",
background: "#000",
padding: "5px",
"z-index": 99999
}).appendTo('body');
<style id="jsbin-css">
.page-header {
position: fixed;
background: rgba(0, 0, 0, 0.7);
width: 100%;
height: 60px;
z-index: 1000;
}
.page-header select {
<style id="jsbin-css">
.page-header {
position: fixed;
background: rgba(0, 0, 0, 0.7);
width: 100%;
height: 60px;
z-index: 1000;
}
.page-header select {
{
type: 'Page',
match: '/:uid',
path: '/preview-page',
filter: data => data.node._meta.uid !== 'index',
component: require.resolve('./src/templates/page.js'),
langs: ['en-us'],
},
{
type: 'Page',