Skip to content

Instantly share code, notes, and snippets.

View korobochkin's full-sized avatar

Kolya Korobochkin korobochkin

View GitHub Profile
<?php
/**
* Template Name: Movie Template
* Description: A Page Template for a movies pages.
*/
function get_page_mediablock( $url ) {
global $wp_embed;
return $wp_embed->run_shortcode( '[embed width="1200"]' . esc_url_raw( $url ) . '[/embed]' );
}
@nikolov-tmw
nikolov-tmw / multiple-roles-per-user.php
Last active October 5, 2021 03:56
Multiple roles per user WordPress plugin.
<?php
/**
* Plugin Name: Multiple Roles per User
* Description: Allows anyone who can edit users to set multiple roles per user. In a default WordPress environment that wouldn't have much of an effect, since the user would have the privileges of the top-privileged role that you assign to him. But if you have custom roles with custom privileges, this might be helpful.
* Version: 1
* Author: nikolov.tmw
* Author URI: http://paiyakdev.com/
* License: GPL2
*/
/*
@louy
louy / is_email.js
Created July 8, 2013 10:47
is_email function from WordPress written in Javascript
/**
* is_email function from WordPress
* written in Javascript
*
* by Louy Alakkad <me@l0uy.com>
*
* Verifies that an email is valid.
*
* Does not grok i18n domains. Not RFC compliant.
*
@simX
simX / hidpi.txt
Created July 28, 2012 04:58
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES;
sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled;
// by the way, you need to logout and log back in for this to take effect. Or at least that's what
// Quartz Debug says. Who knows, maybe it's lying?
// P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging
// back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from.
@jubianchi
jubianchi / sf2_standalone_form.php
Created August 25, 2011 07:31
How to use Symfony2 Form Component Standalone
<?php
namespace Standalone\Form;
use \Symfony\Component\HttpFoundation as SHttp;
use \Symfony\Component\Form as SForm;
use \Symfony\Component\DependencyInjection as SDI;
use \Symfony\Bridge as SBridge;
//Register all your autoload function here
//...