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 / 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 / gist:8620557
Last active May 1, 2019 00:47
Git terminal gist
Do thus
git init
git add *
git config --global user.name "yourUserName"
git config --global user.email "your@email.web"
git add *
git commit -m 'First upload'
git push origin master
SQL - my collection
===================
## CREATE TABLE
CREATE TABLE my_table
(
first_name VARCHAR(50),
last_name VARCHAR(50),
email VARCHAR(50),
@asathoor
asathoor / gist:c0fa01d8ae7a9ead9e87
Last active August 29, 2015 14:17
Images in a WordPress theme or child theme - several methods
<!-- in case of problems with displaying the images chmod 777 and chown daemon:daemon -->
<!-- link to media files -->
<p>
<img src="http://localhost/test/wordpress/wp-content/uploads/2015/03/cropped-download-1.jpg" width="200" height="*">
<p>
<!-- image in the template folder -->
<p>
<img src="<?php bloginfo('stylesheet_directory');?>/images/car.jpg"/ >
</p>
@asathoor
asathoor / pandocslidy
Created May 21, 2015 10:26
Pandoc slidy slideshow
pandoc -t slidy -s -H _css fowd-laerermoede.md -o index.html
@asathoor
asathoor / gist:e7a517281f30097320bc
Created May 21, 2015 16:07
Pandoc markdown with bibliography
### Pandoc terminal command
pandoc template.md --bibliography=books.bib -o test.html
### How to quote
Write something like this: [@bruceLee] or [-@bruceLee] (the last if you don't want to see the author name).
@asathoor
asathoor / gist:75a2df2a7bc61b693f13
Created May 22, 2015 14:03
Write to the beginning of a textfile in php
<?php
// add to top op a file
$file_data = "Lorem ipsum sit dolor...\n";
$file_data .= file_get_contents('text.txt');
file_put_contents('text.txt', $file_data);
?>
@asathoor
asathoor / gist:58f41f8e6a3f17f65ff3
Created May 24, 2015 04:28
Read a textfile, explode to array ...
<?php
class AQCreader {
function AQCPostsNumberOf() {
$laes = file_get_contents('AQC-Index-2010.txt');
$AQCarray = explode("\n", $laes);
echo (count( $AQCarray ) + 1); // number of lines in file
}
}
?>
<?php
/* Count: 001 002 003 */
$invID = 11; // sample
$invID = str_pad($invID, 3, '0', STR_PAD_LEFT); // str_pad(counter,numberlentth,addNumber,whereToAdd)
echo $invID; // 011
?>
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = ""
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):