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
@javorszky
javorszky / wtfphparray_reduce.php
Last active August 29, 2015 13:56
Why is $and not 1?
<?php
if( !function_exists('es_preit') ) {
function es_preit( $obj, $echo = true ) {
if( $echo ) {
echo '<pre>';
print_r( $obj );
echo '</pre>';
} else {
return '<pre>' . print_r( $obj, true ) . '</pre>';

Keybase proof

I hereby claim:

  • I am javorszky on github.
  • I am javorszky (https://keybase.io/javorszky) on keybase.
  • I have a public key whose fingerprint is 40FB C961 9B8E 2647 C406 0D4C 17D5 290D 17F9 7DA8

To claim this, I am signing this object:

<?php
/*
* This is the contents of $_SESSION
* Array
* (
* [qty] => 3
* [sizes] => Array
* (
* [0] => 10-x-12-x-1
* [1] => 10-x-12-x-1
$(document).ready(function(){
setInterval(countdomains(), 1000);
function countdomains(){
var cb;
$(".letters").each(function(){
cb = $(this);
$.getJSON("/api/domain/countByLetter?letter="+$(this).data('letter'), null, function(data){
cb.text(data);
});
});
<?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 / test.php
Created November 24, 2012 16:11
A test gist
<?php
$something = 'something';
global $post;
foreach( $post as $_t ) {
print_r( $_t );
}
?>
@javorszky
javorszky / functions.php
Created November 26, 2012 01:23
Adding extra classes to wp_nav_menu - part 2
<?php
if( !function_exists( 'preit' ) ) {
function preit($obj, $return = false ) {
if( !$return ) {
echo '<pre>';
print_r($obj);
echo '</pre>';
} else {
$ret = '<pre>' . print_r( $obj, true ) . '</pre>';
return $ret;
@javorszky
javorszky / modified_classes.php
Created November 26, 2012 01:32
Adding extra classes to wp_nav_menu - part 4
<?php
function display_nav_menu_items( $items, $args ) {
foreach ($items as $item) {
if( $item->current ) {
$item->classes[] = 'active';
}
}
return $items;
}