Skip to content

Instantly share code, notes, and snippets.

View marteinn's full-sized avatar
✖️
🥕

Martin Sandström marteinn

✖️
🥕
View GitHub Profile
@marteinn
marteinn / Guardian JWT.md
Last active December 9, 2019 18:46 — forked from nikneroz/Guardian JWT.md
Elixir + Phoenix Framework + Guardian + JWT. This is tutorial and step by step installation guide.

Elixir + Phoenix Framework + Guardian + JWT + Comeonin

This is a updated guide aimed to support Phoenix 1.3 and Guardian 1.0

Preparing environment

We need to generate secret key for development environment.

mix phx.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf
@marteinn
marteinn / author_post_tag_cloud_tags.php
Last active December 12, 2015 03:08 — forked from anonymous/author_post_tag_cloud_tags.php
Show tag cloud in Wordpress with tags from a specific user (add in functions.php).
<?php
add_filter('widget_tag_cloud_args','author_post_tag_cloud_tags');
function author_post_tag_cloud_tags($args) {
# Show only on author section
if (is_author()) {
global $post;
$wp_query = new WP_Query("showposts=-1&author=".$post->post_author);
$author_tag_ids = array();
@marteinn
marteinn / jquery.parseparams.js
Created May 28, 2012 13:10 — forked from kares/jquery.parseparams.js
jQuery.parseParams - parse query string paramaters into an object (jshint compatible)
/**
* $.parseParams - parse query string paramaters into an object.
*/
/*jshint regexp: false */
(function($) {
var re = /([^&=]+)=?([^&]*)/g;
var decodeRE = /\+/g; // Regex for replacing addition symbol with a space
var decode = function (str) { return decodeURIComponent( str.replace(decodeRE, " ") ); };
$.parseParams = function(query) {
var params = {}, e;