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
"""Multisite - individual site for request""" | |
from django.conf import settings | |
from threading import local | |
def make_tls_property(default=None): | |
"""Creates a class-wide instance property with a thread-specific value.""" | |
class TLSProperty(object): | |
def __init__(self): | |
self.local = local() |
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
from django.conf.urls.defaults import * #@UnusedWildImport | |
from django.contrib.auth.models import Permission, User | |
from django.http import HttpResponse | |
from django.test import TestCase | |
from django.test.client import Client | |
from django.views.generic.base import View | |
class ForbiddenMixin(object): | |
"""ForbiddenMixin""" | |
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
# REPLACE urls parameter of the TestCase and create test.html in order to test | |
# this | |
from django.conf.urls.defaults import * #@UnusedWildImport | |
from django.contrib.auth.models import Permission, User | |
from django.http import HttpResponse | |
from django.test import TestCase | |
from django.test.client import Client | |
from django.views.generic.base import View, TemplateView |
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 | |
$WP_NONQUOTED_POST = array(); | |
/** | |
* Add magic quotes to $_GET, $_POST, $_COOKIE, and $_SERVER. | |
* | |
* Also forces $_REQUEST to be $_GET + $_POST. If $_SERVER, $_COOKIE, | |
* or $_ENV are needed, use those superglobals directly. | |
* |
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
var parseURIMatcher = /^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/; | |
/** | |
* Parses the URI | |
* | |
* @param url | |
* @returns object | |
*/ | |
function parseURI(url) { | |
var m = parseURIMatcher.exec(url); |
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 post_order_type_default_sorting(&$query) { | |
if (!isset($query->query['orderby'])) { | |
$query->set('orderby', 'menu_order'); | |
} | |
} | |
function post_order_type_list_view() { | |
add_action('pre_get_posts', 'post_order_type_default_sorting', 1, 1); |
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 | |
abstract class My_AdminList { | |
public static $taxonomies = array("menu_category"); | |
public static $post_types = array("owns_restaurant_item"); | |
/** | |
* Admin init hook | |
*/ |
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
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Select test</title> | |
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
function Hae(kohde_id, porras_id, kerros_id, fill_name) { | |
$.getJSON("hae_data2.php",{kohde_id: kohde_id, porras_id: porras_id, kerros_id: kerros_id}, function(j){ | |
console.log(j); |
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
/* | |
Edit User StyleSheet of Chrome: | |
Windows: | |
C:\Users\YOURUSERNAME\AppData\Local\Google\Chrome\User Data\Default\User StyleSheets\Custom.css | |
Create the file if it does not exist. Similar file is in Firefox too. | |
*/ |
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
/** | |
* http://plugins.jquery.com/project/query-object | |
* jQuery.query - Query String Modification and Creation for jQuery | |
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com) | |
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/). | |
* Date: 2009/8/13 | |
* | |
* @author Blair Mitchelmore | |
* @version 2.1.8 (fork) | |
* |