Skip to content

Instantly share code, notes, and snippets.

View javorszky's full-sized avatar
🏠
Working from home

Gabor Javorszky javorszky

🏠
Working from home
View GitHub Profile
<?php
$urlPattern = '/^(?!mailto:)(?:(?:https?):\/\/)(?:\S+(?::\S*)?@)?(?:(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[0-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:www.)?)?(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?-?_?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]+-?-?_?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))|localhost)(?::(\d{1,5}))?(?:(?:\/|\?|#)[^\s]*)?$/iu';
@javorszky
javorszky / simpviews.php
Last active August 29, 2015 14:06
This is the entire php code of the simpleviews plugin. I'm posting it here, because I need it repaired for a project, and the plugin doesn't have a github repository. Plugin url: http://wordpress.org/plugins/simple-post-views-counter/
<?php
/*
Plugin Name: Simple Post Views Counter
Plugin URI: http://wordpress.org/extend/plugins/simple-post-views-counter/
Description: This plugin will enable you to display how many times a post has been viewed. The hits/views are displayed in the posts entry meta. Please refer to the included readme file for proper install instructions and use.
Version: 1.2
Author: RS Publishing
License: GPLv2
*/
var foo = function () {
return this;
},
a = new foo(),
b = foo.apply({});
console.log(a); // {}
console.log(b); // {}
a == b // false
@javorszky
javorszky / create-wp-admin-account.sql
Created October 14, 2015 14:29 — forked from azizur/create-wp-admin-account.sql
Create a WordPress Administrator user account using SQL
USE __DATABASE__;
SET @username = 'azizur';
SET @password = MD5('password');
SET @fullname = 'Azizur Rahman';
SET @email = 'azizur@example.com';
SET @url = 'http://azizur.com/';
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_status`, `display_name`) VALUES (@username, @password, @fullname, @email, @url, NOW(), '0', @fullname);
<?php
array(
'/' => array('GP_Route_Index', 'index'),
/**
* No permission check
*/
@javorszky
javorszky / wordpress-plugin-svn-to-git.md
Created July 11, 2017 12:47 — forked from kasparsd/wordpress-plugin-svn-to-git.md
Using Git with Subversion Mirroring for WordPress Plugin Development
@javorszky
javorszky / colortest.sh
Created March 16, 2021 21:36
small sh file to test coloring in terminals, 16 colors
#!/bin/sh
echo "\033[30m Black"
echo "AAAAAAAAAAA"
echo ""
echo "\033[31m Red"
echo "AAAAAAAAAAA"
echo ""
echo "\033[32m Green"
echo "AAAAAAAAAAA"