Skip to content

Instantly share code, notes, and snippets.

View periscopesnippets's full-sized avatar

Andrew Barden periscopesnippets

View GitHub Profile
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is com.weareinstrument.nike.cpc.exc.CPCServiceException: invalid user id
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:948)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:444)
@periscopesnippets
periscopesnippets / gist:7866880
Created December 9, 2013 03:12
Hide shit from client
function remove_menus () {
global $menu;
$restricted = array( __('Posts'), __('Comments'));
end ($menu);
while (prev($menu)){
$value = explode(' ',$menu[key($menu)][0]);
if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
}
}
add_action('admin_menu', 'remove_menus');
@periscopesnippets
periscopesnippets / Smooth Scrolling To Internal Links With jQuery
Created October 8, 2013 02:37
Smooth Scrolling To Internal Links With jQuery
$posts = get_field('relationship');
if( $posts ): ?>
<ul>
<?php foreach( $posts as $post_object): ?>
<li>
<a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID); ?></a>
<span>Post Object Custom Field: <?php the_field('field_name', $post_object->ID); ?></span>
</li>
<?php endforeach; ?>
@periscopesnippets
periscopesnippets / Wordpress: Get Post Thumbnail Src
Created July 31, 2013 21:38
Wordpress: Get Post Thumbnail Src
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'property-thumb', false, '' );
@periscopesnippets
periscopesnippets / Wordpress: Cache buster function
Created July 30, 2013 23:11
Wordpress: Cache buster function
<link rel="stylesheet" type="text/css" href="<?php echo css_cache_buster() ?>" />
function css_cache_buster() {
$pieces = explode("wp-content", get_bloginfo('stylesheet_url'));
return get_bloginfo('stylesheet_url') . "?" . filemtime(ABSPATH . "/wp-content" . $pieces[1]);
}
@periscopesnippets
periscopesnippets / Wordpress: Set default content in editor
Created July 22, 2013 02:17
Wordpress: Set default content in editor
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "If you enjoyed this post, make sure to subscribe to my rss feed.";
return $content;
}
@periscopesnippets
periscopesnippets / Apache, Wordpress: Rewrite wp-login.php
Last active December 20, 2015 01:39
Apache, Wordpress: Rewrite wp-login.php
RewriteRule ^login$ http://yoursite.com/wp-login.php [NC,L]
@periscopesnippets
periscopesnippets / WordPress: Force specific pages to be SSL secure
Created July 22, 2013 00:38
WordPress: Force specific pages to be SSL secure
function wps_force_ssl( $force_ssl, $post_id = 0, $url = '' ) {
if ( $post_id == 25 ) {
return true
}
return $force_ssl;
}
add_filter('force_ssl' , 'wps_force_ssl', 10, 3);
@periscopesnippets
periscopesnippets / Wordpress: TinyMCE Styles Dropdown
Created March 16, 2013 19:42
Wordpress: TinyMCE Styles Dropdown
function themeit_mce_buttons_2( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
add_filter( 'mce_buttons_2', 'themeit_mce_buttons_2' );
function themeit_tiny_mce_before_init( $settings ) {
$settings['theme_advanced_blockformats'] = 'p,a,div,span,h1,h2,h3,h4,h5,h6,tr,';
$style_formats = array(
array( 'title' => 'Button', 'inline' => 'span', 'classes' => 'button' ),
array( 'title' => 'Green Button', 'inline' => 'span', 'classes' => 'button button-green' ),