This file contains 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
const manipulator = new DOMManipulator(); | |
// Create a new div element with an ID of "myDiv", a class of "myClass", and some content | |
const myDiv = manipulator.createElement('div', 'myDiv', 'myClass', 'Hello, world!', { | |
'data-id': 123, | |
'data-name': 'John Doe' | |
}); | |
// Modify the div element to update its class and content, and add a new attribute | |
manipulator.modifyElement(myDiv, null, 'myOtherClass', 'Hello, world! How are you?', { |
This file contains 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
/** | |
* Password validation RegEx for JavaScript | |
* | |
* Passwords must be | |
* - At least 8 characters long, max length anything | |
* - Include at least 1 lowercase letter | |
* - 1 capital letter | |
* - 1 number | |
* - 1 special character => !@#$%^&* | |
* |
This file contains 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
<?php | |
/** | |
* First, download phpunit.phar from www.phpunit.de | |
* Navigate to PHP bin folder and enter following command to execute tests: | |
* | |
* php.exe phpunit.phar --bootstrap c:\wamp\www\unit\src\polishcal\polishcalculator.php c:\wamp\www\unit\tests\polishcal_test\polishcalculator_test.php | |
* | |
*/ | |
class polishcalculatorTest extends PHPunit_Framework_Testcase { |
This file contains 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
<?php | |
class polishcalculator { | |
/** | |
* Variables | |
*/ | |
private $expected; | |
private $polishexprestion; | |
private $token; |
This file contains 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
/* This may not work with default browser shortcuts. Need to give it a try though. */ | |
/* Create function */ | |
$.ctrl = function(key, callback, args) { | |
$(document).keydown(function(e) { | |
if(!args) args=[]; // IE barks when args is null | |
if(e.keyCode == key.charCodeAt(0) && e.ctrlKey) { | |
callback.apply(this, args); | |
return false; | |
} |
This file contains 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
<?php | |
// Add custom validation for CF7 form fields | |
function custom_text_validation_filter($result,$tag){ | |
$type = $tag['type']; | |
$name = $tag['name']; | |
$the_value = $_POST[$name]; | |
if($name == 'firstname'){ | |
if( empty($the_value) ) { | |
$result['valid'] = false; |
This file contains 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
/** | |
* Form Validation | |
* | |
* @since 11/04/2014 | |
* @author Harish | |
*/ | |
function enformValidation() { | |
var i = 0; | |
// Validate |
This file contains 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
<?php | |
function foo_duplicate_posts(){ | |
# Only allow admins to run the script | |
if(!current_user_can('manage_options')) | |
return; | |
# Check if keyword is set | |
if(!isset($_GET['duplicate-posts'])) |
This file contains 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
<?php | |
add_action('admin_init', 'foo_duplicate_posts', 99999); | |
function foo_duplicate_posts(){ | |
// Only allow admins to run the script | |
if(!current_user_can('manage_options')) | |
return; | |
// Check if keyword is set | |
if(!isset($_GET['duplicate-posts'])) |
This file contains 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
[ | |
{"name":"Alabama","iso_code":"US-AL"}, | |
{"name":"Alaska","iso_code":"US-AK"}, | |
{"name":"Arizona","iso_code":"US-AZ"}, | |
{"name":"Arkansas","iso_code":"US-AR"}, | |
{"name":"California","iso_code":"US-CA"}, | |
{"name":"Colorado","iso_code":"US-CO"}, | |
{"name":"Connecticut","iso_code":"US-CT"}, | |
{"name":"Delaware","iso_code":"US-DE"}, | |
{"name":"District of Columbia","iso_code":"US-DC"}, |
NewerOlder