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
using System; | |
using System.Configuration; | |
namespace Custom.Helpers.Common | |
{ | |
public static class Cache | |
{ | |
private const string CacheSetting = "Cache.Duration"; | |
private static System.Web.Caching.Cache _cache { get { return System.Web.HttpContext.Current.Cache; } } | |
private static int _cacheDuration { get; set; } |
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
using System; | |
using System.Configuration; | |
using System.Web; | |
namespace Custom.Helpers.Common | |
{ | |
public static class Cookie | |
{ | |
private const string CookieSetting = "Cookie.Duration"; | |
private const string CookieIsHttp = "Cookie.IsHttp"; |
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
/********************************************************************************* | |
Cross domain ajax call | |
IMPORTANT: | |
---------- | |
If the webservice you are calling uses http, then the page you are calling the | |
function below should be http | |
If the webservice you are calling uses https, then the page you are calling the |
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
/* | |
How do I inject HTML? | |
The simplest and the most flexible way is to create a filter. | |
*/ | |
angular.module('mfgapp') | |
.filter('to_trusted', ['$sce', function($sce){ | |
return function(text) { | |
return $sce.trustAsHtml(text); | |
}; |
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
source map files basically turn minified code into its unminified version for debugging. | |
You can find the .map files here (https://code.angularjs.org/1.2.12/). Just add them into the same directory as the minified js files and it'll stop complaining. The reason they get fetched is the | |
/* | |
//@ sourceMappingURL=angular.min.js.map | |
*/ | |
at the end of angular.min.js. If you don't want to add the .map files you can remove those lines and it'll stop the fetch attempt, but if you plan on debugging it's always good to keep the source maps linked. |
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
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl'); | |
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl'); | |
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl'); |
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
/********************************************* | |
Breadcrumbs for wordpress without any | |
plugin. This also works for custom post | |
types. | |
You can refactor to make it more efficient. :) | |
Note: For your custom post types look at | |
line 47 | |
**********************************************/ |
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
/* ========================================================================== | |
If you are a big fan of keeping your code base clean, you can place | |
the code below in the functions.php for custom posts single template | |
========================================================================== */ | |
function get_story_post_type_template($single_template) { | |
global $post; | |
if ($post->post_type == 'story') { | |
$single_template = dirname( __FILE__ ) . '/page-templates/single-post-templates/single-story.php'; | |
} | |
return $single_template; |
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
/* ========================================================================== | |
If you want to utilize post types for blog and want blog to be | |
under a parent page about Ex: "/about/blog/". | |
Place the code below in your functions.php and change the paths | |
accordingly | |
========================================================================== */ | |
function filter_post_link($permalink, $post) { | |
if ($post->post_type != 'post') |
NewerOlder