Skip to content

Instantly share code, notes, and snippets.

View asathoor's full-sized avatar
:octocat:
Words! Words! Words! (Shakespeare)

Per Thykjaer Jensen (PETJ) asathoor

:octocat:
Words! Words! Words! (Shakespeare)
View GitHub Profile
@asathoor
asathoor / charset.php
Created December 22, 2015 08:19
Danske tegn mysqli
<?php
/* danske tegn */
$mysqli = new mysqli("HOST", "USER", "PASSWORD","DATABASE");
$mysqli->query("Set names 'utf8'") or die("Kunne ikke sætte danske tegn");
// ... etc ...
?>
@asathoor
asathoor / gist:7863313
Created December 8, 2013 20:18
Add the current year to a post or page in WordPress by the shortcode [anno]
<?php
/**
* Plugin Name: Write the year by the shortcode 'anno'
* Plugin URI: http://www.multimusen.dk
* Description: IAITS.
* Version: 1.0
* Author: Per Thykjaer Jensen (inspired by the link below)
* Author URI: http://www.multimusen.dk
* License: (c) 2013 GPLv3
@asathoor
asathoor / foundation4-topbar-menu.php
Created February 2, 2016 20:19 — forked from awshout/foundation4-topbar-menu.php
WordPress Menu & Walker for ZURB's Foundation 4 Top Bar
<?php
add_theme_support('menus');
/**
* Register Menus
* http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'
@asathoor
asathoor / wp_navwalker.php
Created May 26, 2016 21:41
Ye wp_navwalker secret
They do not tell you this:
<script>
$( document ).ready(function() {
// MENU
// wp_navwalker.php does not tell this:
$(".dropdown-toggle").click(function(){
$(".dropdown-menu").toggle(); // yes, it is that simple ...
@asathoor
asathoor / gulp_pandoc_pdf_exclude_unwanted
Created June 19, 2016 22:04
Gulping .md to .pdf and exclude an unwanted dir
/* Wiseflow: .markdown comments to .pdf */
var gulp = require('gulp');
/* the gulp-pandoc-pdf module */
var pdf = require('gulp-pandoc-pdf');
/* Select .md, !**.. = 'not Unwanted/' */
var sti = ['src/**/*.md','!**/Unwanted/**'];
// piping .pdf to build/pdf
@asathoor
asathoor / cv.php
Created November 4, 2016 07:40
PHP Array Sample
<?php
/* ***********************
Every time you have a list
an array can help you.
Let PHP loop out your
HTML markup.
*********************** */
include_once "head.php";

Pandoc eBook Create

I have used this bash script as an eBook (*.epub) compiler. The script depends on:

  • pandoc
  • cowsay

And a eBook reader.

Sources

<?php
/*
Plugin Name: PETJ_OGM
Plugin URI: https://github.com/asathoor/ogm
Description: OGP developed by Facebook ads a tile to a SoMe link. The plugin was developed for the research WordPress project.
Version: 1.0
Author: Per Thykjaer Jensen
Author URI: https://github.com/asathoor/
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
@asathoor
asathoor / formFeedBack.htm
Last active February 21, 2017 06:05
Form for a JavaScript Workshop
<!DOCTYPE html>
<html>
<body>
<input id="btn1" type="radio" name="colors" value="100" id="myRadio">Red color<br>
<input id="btn2" type="radio" name="colors" value="0" id="myRadio">Blue color
<button id="button">Try it</button>
<!-- onclick="myFunction()" -->