View gist:6377400
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
AddDefaultCharset utf-8
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
View preventscroll.js
window.scrollStopper = (function () {
var obj = {}
obj.keys = [
37, 38, 39, 40
];
obj.preventDefault = function (e) {
e = e || window.event;
if (e.preventDefault) {
e.preventDefault();
}
View frontend.js
//Your frontend javascript
var data = {
action: 'sign_in',
username:"<username>",
pass:"<password>"
};
jQuery.post('/wordpress/wp-admin/admin-ajax.php', data,
function(response) {
alert("signed in successfully");
View functions.php
/*if($post has condition) {
redirect_first_child($post->ID);
}*/
function redirect_first_child($post_id) {
$pagekids = get_pages("child_of=".$post_id."&sort_column=menu_order");
if ($pagekids) {
$firstchild = $pagekids[0];
wp_redirect(get_permalink($firstchild->ID));
exit;
View functions.php
function get_page_depth($post) {
$parent_id = $post->post_parent;
$depth = 0;
while ($parent_id > 0) {
$page = get_page($parent_id);
$parent_id = $page->post_parent;
$depth++;
}
return $depth;
View Email Validation
var isEmail = function(a){return (/^[\w\.%\+\-]+@(?:[A-Z0-9\-]+\.)+(?:[A-Z]{2,6})$/i).test(a);};
View jsprinthtml.js
function printcontent(content)
{
var mywindow = window.open('', '', '');
mywindow.document.write('<html><title>Print</title><body>');
mywindow.document.write(content);
mywindow.document.write('</body></html>');
mywindow.document.close();
mywindow.print();
return true;
}
View gethashvalue.js
var hashval = location.hash.replace('#', '').substring(0, location.hash.indexOf('?')-1);
View hascanvas.js
function hasCanvas()
{
return !!document.createElement('canvas').getContext;
}
View umbraco404httpmodule.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using umbraco.BusinessLogic;
using umbraco.NodeFactory;
namespace Web.Modules
{