Skip to content

Instantly share code, notes, and snippets.

View Reedyn's full-sized avatar
🗺️

Gustav Lindqvist Reedyn

🗺️
View GitHub Profile
@Reedyn
Reedyn / analytics.js
Last active January 3, 2016 23:49
JavaScript for opening Google Analytics with the last 7 days selected (not including today)
javascript: (function () {
var pages = {
dashboard: "#dashboard/eChzdEEBTFKu_c0u-nsdTg",
visitors: "#report/visitors-overview",
location: "#report/visitors-geo/",
};
var googleAnalytics = "a28736903w54575155p55522219";
var theDate = new Date();
var theYear = new String(theDate.getFullYear());
var theMonth = new String(theDate.getMonth() + 1);
@Reedyn
Reedyn / kravspec.md
Created February 5, 2014 10:54
Kravspecifikation

Betyg 3:

  • Inloggningsfunktion skall finnas.
  • Man skall kunna bläddra mellan produkter som ligger i olika kategorier. Kategorierna kan vara statiska (admin behöver inte kunna redigera)
  • Konton skall ha olika accessnivå beroende på om man är admin eller kund.
  • Konton skall kunna skapas och tas bort av administratör, men nya kunder ska kunna skapa sina egna konton via hemsidan.
  • Produkter skall kunna läggas till och tas bort av administratör. Egenskaper som skall finnas är Namn, beskrivning, pris, kategori.
for (student in students) {
// Loop through available students.
if (typeof student.question !== “undefined”) {
// If student has question, ask question.
student.askQuestion();
}
}
<?php
/* =BEGIN: Add Class to first Paragraph in WordPress the_content();
Source: http://webdevbits.com/wordpress/add-class-to-first-paragraph-in-wordpress-the_content/
---------------------------------------------------------------------------------------------------- */
function first_paragraph($content){
// Testing to see if the content is a Page or Custom Post Type of school, if so, display the text normally (without the class = intro).
if ('course' == get_post_type()) {
return preg_replace('/<p([^>]+)?>/', '<p$1>', $content, 1);
} else {
return preg_replace('/<p([^>]+)?>/', '<p$1 class="introduction">', $content, 1);
@Reedyn
Reedyn / gist:7c639380227fd75bc87a
Created July 20, 2014 19:32
WordPress Nav Menu
// Navigation Menus
register_nav_menus( array(
'main-menu-left' => 'Main Navigation - Left'
) );
<img-slider>
<img src="./sunset.jpg" alt="a dramatic sunset">
<img src="./arch.jpg" alt="a rock arch">
<img src="./grooves.jpg" alt="some neat grooves">
<img src="./rock.jpg" alt="an interesting rock">
</img-slider>
javascript:(function(){var el=document.createElement('script');el.type='text/javascript';el.src='//zeman.github.io/perfmap/perfmap.js';document.getElementsByTagName('body')[0].appendChild(el);})();
@Reedyn
Reedyn / default.hbs
Created March 28, 2015 08:16
Replace blog-title with blog logo for Saga
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{meta_title}}</title>
<meta name="description" content="{{meta_description}}" />
@Reedyn
Reedyn / unvisit.html
Created April 21, 2015 09:51
Unvisit bookmarklet
<a href="javascript:(function() {window.location="http://unvis.it/"+window.location.toString();})()">Unvisit</a>
@Reedyn
Reedyn / author.hbs
Created June 21, 2015 07:27
Fix for posts not displaying properly in Author's feed
{{!< default}}
<header id="header" class="animated fadeIn"{{#if author.cover}} style="background-image: url({{author.cover}})"{{/if}}>
<div class="header-background">
<section class="blog-content">
<a class="blog-title" id="site-url" href="{{@blog.url}}">{{@blog.title}}</a>
<span class="blog-description">{{@blog.description}}</span>
{{> links}}
</section>
<section class="header-content">
<h1 class="post-title animated fadeInUp">{{author.name}}</h1>