Skip to content

Instantly share code, notes, and snippets.

@mazell
mazell / ServiceCoreCommunication.cs
Last active September 24, 2015 12:31
HttpWebRequest base class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace EPiServer.Web.Business
{
namespace ServiceCoreWrapper
{
public class ServiceCoreCommunication
@mazell
mazell / meta.php
Created April 21, 2015 08:13
Custom Meta
add_action('save_post', 'save_postdata_dynamic_reviews_metabox' );
add_meta_box("film-reviews", "Reviews", "print_dynamic_reviews_metabox", "film", "normal", "low");
add_action('save_post', 'save_postdata_dynamic_screenings_metabox' );
add_meta_box("film-screenings", "Reviews", "print_dynamic_screenings_metabox", "film", "normal", "low");
/* Prints the box content */
function print_dynamic_reviews_metabox() {
global $post;
// Use nonce for verification
@mazell
mazell / compare.cmd
Last active August 29, 2015 14:18
vs2013 compare tool
Tools.DiffFiles C:\www\repos\bjerking\dev_zellout\HTML\sass\base.scss C:\www\backup\base.scss
@mazell
mazell / wait-for-final-event.js
Created February 11, 2015 13:30
WaitForFinalEvent
* Wrap your actions in this function to throttle the frequency of firing them off, for better performance, esp. on mobile.
* ( source: http://stackoverflow.com/questions/2854407/javascript-jquery-window-resize-how-to-fire-after-the-resize-is-completed )
var waitForFinalEvent = (function () {
var timers = {};
return function (callback, ms, uniqueId) {
if (!uniqueId) { uniqueId = "Don't call this twice without a uniqueId"; }
if (timers[uniqueId]) { clearTimeout (timers[uniqueId]); }
timers[uniqueId] = setTimeout(callback, ms);
};
@mazell
mazell / GA.js
Created January 28, 2015 13:29
GA.JS
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'INSERT KEY HERE', 'auto');
ga('send', 'pageview');
@mazell
mazell / taxanomies.php
Created June 12, 2014 12:50
WP:Taxanomies support pages
function myplugin_settings() {
// Add tag metabox to page
register_taxonomy_for_object_type('post_tag', 'page');
// Add category metabox to page
register_taxonomy_for_object_type('category', 'page');
}
// Add to the admin_init hook of your theme functions.php file
add_action( 'admin_init', 'myplugin_settings' );
@mazell
mazell / wp-post-loop.php
Created May 14, 2014 07:12
WP:for-loop over the_loop
<?php for ($currentPost=0; $currentPost < count($the_posts); $currentPost++) {
setup_postdata( $GLOBALS['post'] =& $the_posts[$currentPost] );
?>
<article class="bit-3 box-<?php echo $box_matrix[$currentPost] ?>">
<header>
<h2><?php the_title(); ?></h2>
</header>
<p><?php the_content();?></p>
</article>
<?php
@mazell
mazell / commands.txt
Created May 13, 2014 09:49
command: npm access rights
sudo chown -R `whoami` ~/.npm
@mazell
mazell / wp-path.php
Created April 20, 2014 17:55
WP: Paths
// Sökvägar
define('WP_SITEURL', 'http://' . DOMAIN . '/wordpress');
define('WP_HOME', 'http://' . DOMAIN);
define('WP_CONTENT_DIR', dirname( __FILE__ ) . '/content');
define('WP_CONTENT_URL', 'http://' . DOMAIN . '/content');
define('WP_DEBUG',false);
@mazell
mazell / insetshadow.css
Created April 9, 2014 11:11
CSS: Inset shadow
.some-element{
position: relative;
letter-spacing: 0px;
text-shadow: -1.5px -1px 0px #3a3a3a;
text-decoration: none;
}
.btn-send:before, .btn-send:after {
content: attr(title);
color: rgba(255,255,255,1);