This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function ($) {"use strict";var Affix = function (element, options) {this.options = $.extend({}, $.fn.affix.defaults, options);this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this)).on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this));this.$element = $(element);this.checkPosition();};Affix.prototype.checkPosition = function () {if (!this.$element.is(':visible')) return;var scrollHeight = $(document).height(), scrollTop = this.$window.scrollTop(), position = this.$element.offset(), offset = this.options.offset, offsetBottom = offset.bottom, offsetTop = offset.top, reset = 'affix affix-top affix-bottom', affix;if (typeof offset != 'object') offsetBottom = offsetTop = offset;if (typeof offsetTop == 'function') offsetTop = offset.top();if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(); affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ?false : offsetBottom != null && (position.top |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var addCommas = function(nStr) { | |
nStr += ''; | |
x = nStr.split('.'); | |
x1 = x[0]; | |
x2 = x.length > 1 ? '.' + x[1] : ''; | |
var rgx = /(\d+)(\d{3})/; | |
while (rgx.test(x1)) { | |
x1 = x1.replace(rgx, '$1' + ',' + '$2'); | |
} | |
return x1 + x2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data = file_get_contents("php://input"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.safeApply = function(fn) { | |
var phase = this.$root.$$phase; | |
if (phase == '$apply' || phase == '$digest') { | |
if (fn && (typeof(fn) === 'function')) { | |
fn(); | |
} | |
} else { | |
this.$apply(fn); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ng\:cloak], | |
[ng-cloak], | |
[data-ng-cloak], | |
[x-ng-cloak], | |
.ng-cloak, | |
.x-ng-cloak { | |
display: none !important; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Usage | |
//jsonSearch(jsonArray,{'key':'value}) | |
var jsonSearch = function(json_array,needle){ | |
return json_array.map(function(d) { return d[Object.keys(needle)[0]]; }).indexOf(needle[Object.keys(needle)[0]]) | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SCDGE : Selector of Container containing dynamically generated element | |
//SDGE : Selector of Dynamically Generated elements | |
jQuery(<SCDGE>).on('focus',<SDGE>,function () { | |
var footerHeight = 200; //footerHeight = footer height + element height + buffer | |
var element = $(this); | |
if (element.offset().top - ($(window).scrollTop()) > ($(window).height() - footerHeight)) { | |
$('html, body').animate({ | |
scrollTop: element.offset().top - ($(window).height() - footerHeight) | |
}, 500); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html class=""><head> | |
<style class="cp-pen-styles">body{ | |
text-align: center; | |
background: lightgrey; | |
font-family: sans-serif; | |
font-weight: 100; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo netstat -nlp | grep :<port> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chown -Rf www-data:www-data <path-to-wordpress> |