Skip to content

Instantly share code, notes, and snippets.

View MichaelVanDenBerg's full-sized avatar
🏠
Working from home

Michael van den Berg MichaelVanDenBerg

🏠
Working from home
View GitHub Profile
@MichaelVanDenBerg
MichaelVanDenBerg / up-and-running-with-edeliver-on-do.md
Created March 16, 2021 17:34 — forked from davoclavo/up-and-running-with-edeliver-on-do.md
Getting Elixir / Phoenix running on Digital Ocean with edeliver

Build Server

  • Go to Digital Ocean
  • Create new ubuntu droplet

Setup Server

//Constructor
var Person = function (name, age){
//private properties
var priv = {};
//Public properties
this.name = name;
this.age = age;
//Public methods
@MichaelVanDenBerg
MichaelVanDenBerg / sublime-command-line.md
Created October 6, 2016 19:13 — forked from clauddiu/sublime-command-line.md
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@MichaelVanDenBerg
MichaelVanDenBerg / functions-content-width.php
Last active October 2, 2016 12:51
Set the content width in pixels and adjust the content width for full width pages.
<?php
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function bookmark_content_width() {
$GLOBALS['content_width'] = apply_filters( 'bookmark_content_width', 800 );
@MichaelVanDenBerg
MichaelVanDenBerg / combined-menu-with-search-toggle.php
Created August 14, 2016 19:56
Displays both the primary and social navigation menu and the search toggle.
<?php
/**
* Displays both the primary and social navigation menu and the search toggle.
*/
$search = '<li id="search-toggle" class="menu-item"><a href="#"><span class="screen-reader-text">Search Toggle</span></a></li>';
$social = wp_nav_menu(
array(
'theme_location' => 'social',
@MichaelVanDenBerg
MichaelVanDenBerg / big-image-paragraph-parent.js
Created July 2, 2016 18:21
Add .large class to the <p> parent of images wider than 680px. This used to break out large images in posts and pages in the Alpha Centauri WordPress theme.
// Add .large class to the <p> parent of images wider than 680px.
$( '.entry-content img' ).each( function() {
var $this = $( this );
if ( ( $this.attr( 'width' ) > 680 ) && ( $this.parent().is( 'p' ) ) ) {
$this.parent().addClass( 'large' );
}
});
@MichaelVanDenBerg
MichaelVanDenBerg / remove-empty-p.js
Created May 28, 2016 14:41
Remove empty <p> tags with jQuery.
/**
* Remove empty <p> tags.
*
* See: http://stackoverflow.com/questions/27781798/wordpress-retain-formatting-when-calling-extended-content#comment43990361_27782619
* This seems to be the easiest solution. Remove this function if this ever gets fixed.
* Credits: http://stackoverflow.com/questions/6092855/how-do-i-remove-empty-p-tags-with-jquery
*/
( function( $ ) {
$( 'p' ).each( function() {
/**
* Add featured image as background image to post navigation elements.
*
* @see wp_add_inline_style()
*/
function alpha_centauri_post_nav_background() {
if ( ! is_single() ) {
return;
}
@MichaelVanDenBerg
MichaelVanDenBerg / portfolio-page-url.php
Last active April 14, 2016 19:30
Get the url of the portfolio page if the number of items to be shown is lower than the total number of items.
if ( ! function_exists( 'genius_portfolio_url' ) ) :
/**
* Echo a read more url for the portfolio page if the total posts is higher dan the displayed posts.
*/
function genius_portfolio_url() {
// Return if the post limit is more than total posts.
$post_limit = get_theme_mod( 'genius_portfolio_limit', 9 );
$total_posts = wp_count_posts( 'jetpack-portfolio' )->publish;
if ( $post_limit > $total_posts ) {