// global vars var winWidth = $(window).width(); var winHeight = $(window).height(); // set initial div height / width $(‘div’).css({ ‘width’: winWidth, ‘height’: winHeight, }); // make sure div stays full width/height on resize $(window).resize(function(){ $(‘div’).css({ ‘width’: winWidth, ‘height’: winHeight, }); }); Source: https://coderwall.com/p/nsv3cq/div-full-width-height-of-viewport
Month: September 2017
Beginners-guide-regular-expressions
No programming concept frightens programmers more than regular expressions. For a lot of us, seeing code with regular expressions in it can bring a sense of dread and anxiety. We often have no idea what’s going on or how a regular expression does what it does. Source https://carlalexander.ca/beginners-guide-regular-expressions/
how-show-hidden-files-folders-mac
In MacOS Sierra Apple added a Finder keyboard shortcut that makes it possible to quickly show all the hidden files and folders. You just need to do the following: Open the Finder Go to your Macintosh HD folder (access this from Devices in the left column) Hold down CMD-Shift-. (dot) All the hidden files will become visible…
Centering CSS Complete guide
Centering in CSS: A Complete Guide .parent { position: relative; } .child { position: absolute; top: 50%; transform: translateY(-50%); }
Plugin API/Filter Reference/login redirect « WordPress Codex
/** * Redirect user after successful login. * * @param string $redirect_to URL to redirect to. * @param string $request URL the user is coming from. * @param object $user Logged user’s data. * @return string */function my_login_redirect( $redirect_to, $request, $user ) { //is there a user to check? if ( isset( $user->roles ) &&…
WP Snippet: Block access to the mainsite dashboard in WordPress multisite – WPcustoms Codes
if you are running a WordPress Multisite and want to restrict the access to the dashboard of the main site to everyone apart from the super admin use this snippet Source: WP Snippet: Block access to the mainsite dashboard in WordPress multisite – WPcustoms Codes add_filter(‘body_class’,’browser_body_class’); function browser_body_class($classes) { global $is_lynx, $is_gecko, $is_IE,…
Form Submit button
https://www.tjvantoll.com/2013/01/01/enter-should-submit-forms-stop-messing-with-that/ Therefore, if you have a form with more than one input field, always include a submit button. Specifically an <input> with the type=”submit” attribute, or a <button> element should be present. (Note: IE7 has a bug where the typeattribute of a <button> defaults to button instead of submit. Therefore for IE7 compatibility you’ll need <button type=”submit”>.)
Understanding Bootstrap Modals
Read Bootstrap 3 – JavaScript Components for more JavaScript plugins available from Bootstrap and if you’re new to Bootstrap, you can check out my Bootstrap 3 Tutorial. Source: Understanding Bootstrap Modals
php – Preserve Line Breaks – Simple HTML DOM Parser – Stack Overflow
realized there was actually a built in option to turn off the removal of line breaks. No need to go editing the source.The PHP Simple HTML Dom Parser’s load function supports multiple useful parameters:load($str, $lowercase=true, $stripRN=false, $defaultBRText=DEFAULT_BR_TEXT)When calling the load function, simply pass false as the third parameter.$html = new simple_html_dom();$html->load(“stuff”, true, false);If using file_get_html,…
using jquery serialize in ajax operation for plugin
1 Answer activeoldestvotes up vote0down voteaccepted Provided that your server receives data in the form of a string which it should if you’re using the jQuery serialize() function. It will be something like: name1=value&name2=value&name3=value You just need to parse the string into an array as follows: $parameters = array(); parse_str($_GET, $parameters); See the following for…