This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.
I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.
Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.
<?php | |
function add_opengraph_markup() { | |
if (is_single()) { | |
global $post; | |
if(get_the_post_thumbnail($post->ID, 'thumbnail')) { | |
$thumbnail_id = get_post_thumbnail_id($post->ID); | |
$thumbnail_object = get_post($thumbnail_id); | |
$image = $thumbnail_object->guid; | |
} else { | |
// set default image |
<!-- | |
Example 1: Using IF ELSE logic | |
Works with Outlook (Desktop)?: Yes | |
Works with Outlook.com?: No | |
When using IF ELSE logic, Outlook.com will remove content in both conditionals, which is problematic. | |
--> | |
<!--[if mso]> | |
<table border="0" cellpadding="0" cellspacing="0" width="100%"> |
Below are a small collection of React examples to get anyone started using React. They progress from simpler to more complex/full featured.
They will hopefully get you over the initial learning curve of the hard parts of React (JSX, props vs. state, lifecycle events, etc).
You will want to create an index.html
file and copy/paste the contents of 1-base.html
and then create a scripts.js
file and copy/paste the contents of one of the examples into it.
<?php | |
/* For Themes */ | |
wp_enqueue_style('slug', get_template_directory_uri().'/css/slug.css', array(), filemtime(get_template_directory().'/css/slug.css')); | |
wp_enqueue_script('slug', get_template_directory_uri().'/js/slug.js', array(), filemtime(get_template_directory().'/js/slug.js')); | |
/* For Plugins */ | |
wp_enqueue_style('slug', plugin_dir_url(__FILE__).'css/slug.css', array(), filemtime(plugin_dir_path(__FILE__).'css/slug.css')); | |
wp_enqueue_script('slug', plugin_dir_url(__FILE__).'js/slug.js', array(), filemtime(plugin_dir_path(__FILE__).'js/slug.js')); |
{% comment %} | |
Input | |
{% endcomment %}{% capture _content %}{{ content }}{% endcapture %}{% comment %} | |
Remove redundant closing tags | |
{% endcomment %}{% assign _endings = "html head body li dt dd p rt rp optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% for _element in _endings %} | |
{% capture _end %}</{{ _element }}>{% endcapture %} |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import time | |
import json | |
import urllib | |
import urllib2 | |
from dateutil.parser import parse |
This tutorial explains how to host your static website on Amazon Web Service S3 with your custom domain name on gandi (or on any other registrar).
The name of the bucket should be your domain name:
example.com
Go to bucket properties, then Static website hosting and select enable website hosting
. Index document should be index.html.
Click save
/** | |
* Convert an image | |
* to a base64 url | |
* @param {String} url | |
* @param {Function} callback | |
* @param {String} [outputFormat=image/png] | |
*/ | |
function convertImgToBase64URL(url, callback, outputFormat){ | |
var img = new Image(); | |
img.crossOrigin = 'Anonymous'; |