Skip to content

Instantly share code, notes, and snippets.

@nurbek-ab
nurbek-ab / break-point.html
Last active August 29, 2015 14:10
Twitter bootstrap helper block that displays current break point
<div class="well" style="position: fixed; bottom: 0; left: 0; display: inline-block; height: auto; z-index: 99999">
<div class="visible-xs text-center text-danger">
<b>xs (extra small)</b>
</div>
<div class="visible-sm text-center text-warning">
<b>sm (small)</b>
</div>
<div class="visible-md text-center text-primary">
<b>md (middle)</b>
</div>
@nurbek-ab
nurbek-ab / foreach.js
Last active August 29, 2015 14:10
forEach for NodeList and HTMLCollection
NodeList.prototype.forEach = function(fn){
var list = this;
for(var i = 0; i < list.length; i++){
fn.call(list[i], list[i], i, list);
}
};
HTMLCollection.prototype.forEach = NodeList.prototype.forEach;
/**
* Object.prototype.watch polyfill
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch
*
* Known limitations:
* - `delete object[property]` will remove the watchpoint
*
* Based on Eli Grey gist https://gist.github.com/eligrey/384583
* Impovements based on Xose Lluis gist https://gist.github.com/XoseLluis/4750176
* This version is optimized for minification
@nurbek-ab
nurbek-ab / delete.bat
Created January 25, 2015 16:47
Reset folder permissions on Windows 7 after system reinstall
SET DIRECTORY_NAME="C:\OldWindows"
TAKEOWN /f %DIRECTORY_NAME% /r /d y
ICACLS %DIRECTORY_NAME% /reset /T
PAUSE
@nurbek-ab
nurbek-ab / five-column.css
Created March 23, 2015 06:56
Bootstrap five column layout
.col-xs-five,
.col-sm-five,
.col-md-five,
.col-lg-five {
position: relative;
min-height: 1px;
padding-right: 10px;
padding-left: 10px;
}
@nurbek-ab
nurbek-ab / no-gutters.css
Last active September 24, 2015 09:14
Bootstrap no gutters
.container.no-gutters {
padding-left: 0;
padding-right: 0;
}
.container.no-gutters .row {
margin-right: 0;
margin-left: 0;
}
@nurbek-ab
nurbek-ab / supress_notices.php
Created October 15, 2015 09:39
Supress all notices and warnings in wordpress.
<?php
// place this to mu-plugins folder under wp-content
// set WP_DEBUG to true in wp_config.php to see all other errors
error_reporting(E_ALL & ~( E_NOTICE | E_USER_NOTICE | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED | E_WARNING | E_CORE_WARNING | E_USER_WARNING | E_COMPILE_WARNING | E_PARSE ));
@nurbek-ab
nurbek-ab / isDateString.js
Created June 24, 2016 12:05
Check if a string is a date string
function isDateString(str) {
return !isNaN(Date.parse(str));
}
@nurbek-ab
nurbek-ab / inspect.js
Last active October 21, 2016 13:19
Logs prettyfied and colored objects to console
var util = require('util');
var _ = require('lodash');
/**
* Logs prettyfied and colored objects to console
* @param msg - message
* @param title - log message title
* @param depth - property depth
* @param showHidden - show hidden properties
*/
@nurbek-ab
nurbek-ab / modal-centered.css
Created October 31, 2016 11:27
Bootstrap modal centered vertically via CSS only.
/*https://codepen.io/dimbslmh/full/mKfCc*/
.modal {
text-align: center;
padding: 0!important;
}
.modal:before {
content: '';
display: inline-block;
height: 100%;