Skip to content

Instantly share code, notes, and snippets.

@pascalmaddin
pascalmaddin / calculator.html
Created January 4, 2021 20:44
calculator html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script type="text/javascript" src="script.js"></script>
<style>
#calculator{
width: 100%;
@pascalmaddin
pascalmaddin / basics.js
Created January 4, 2021 20:43
basics.js
let Variable;
const Variable2;
var Variable;
/*
A semicolon at the end of a line indicates where a statement ends.
A JavaScript identifier must start with a letter, underscore (_), or dollar sign ($). Subsequent characters can also be digits (0–9).
Because JavaScript is case sensitive, letters include the characters "A" through "Z" (uppercase) as well as "a" through "z" (lowercase).
@pascalmaddin
pascalmaddin / include-cpt-into.php
Last active March 2, 2016 15:10
I wanted the custom post type to show up on the regular author/search results page. Here's what I came up with in case anyone else is looking:
/*
* I wanted the custom post type to show up on the regular author page. Here's what I came up with in case anyone else is looking:
*/
add_filter('posts_where', 'include_for_author');
function include_for_author($where){
if(is_author())
$where = str_replace(".post_type = 'post'", ".post_type in ('post', 'custom_post_type')", $where);
return $where;
}
{
"Seti_tabs_small": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Predawn/predawn.tmTheme",
"findreplace_small": true,
"font_face": "Hack",
"font_size": 14.0,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
@pascalmaddin
pascalmaddin / wp-is-mobile.php
Created November 20, 2015 13:19 — forked from walterebert/functions.php
WordPress snippet: Add mobile CSS class
<?php
function my_body_class( $classes ) {
if ( wp_is_mobile() ) {
$classes[] = 'is-mobile';
}
return $classes;
}
add_filter( 'body_class', 'my_body_class' );
@pascalmaddin
pascalmaddin / wordpress-as-cms-not-blog.php
Last active November 11, 2015 09:03 — forked from mourique/use wordpress as cms (not blog)
use wordpress as cms (not blog)
/* Kill attachment, search, author, daily archive pages */
add_action('template_redirect', 'custom_template_redirect');
function custom_template_redirect(){
global $wp_query, $post;
if (is_author() || is_attachment() || is_day() || is_search() || is_category())
{
$wp_query->set_404();
}
$.fn.serializeObject = function() {
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
@pascalmaddin
pascalmaddin / countTo.js
Last active August 29, 2015 14:09
jQuery Plugin für das hochzählen einer Zahl bis zu einem numerischen Ziel
(function($) {
$.fn.countTo = function(options) {
// merge the default plugin settings with the custom options
options = $.extend({}, $.fn.countTo.defaults, options || {});
// how many times to update the value, and how much to increment the value on each update
var loops = Math.ceil(options.speed / options.refreshInterval),
increment = (options.to - options.from) / loops;
return $(this).each(function() {
<img src="small.jpg" srcset="small.jpg [smallwidth]w, large.jpg [largewidth]w" alt="Alt Text" />
@pascalmaddin
pascalmaddin / sharing.html
Created October 16, 2014 14:49
Simple Social Media Sharing Links without Third Party Javascript in WordPress
<!-- Twitter -->
<a href="https://twitter.com/home?status=Your%20custom%20tweet%20with%20blanks.">Share on Twitter</a>
<a href="https://twitter.com/home?status=Check%20out%20this%20article%20by%20@ikalli:%20<?php the_title(); ?> <?php the_permalink(); ?>">Share on Twitter</a>
<!-- Facebook -->
<a href="https://www.facebook.com/sharer/sharer.php?u=http://mydomain.com/articletitle">Share on Facebook</a>
<a href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>">Share on Facebook</a>