American Road Trip – Brooklyn, New York
$1,000 in awards. Deadline: December 16, 2015
Site:Brooklyn invites artists to submit work that imagines or documents the American road trip. Open to all artists working in North America, 18 years of age or older. This is a juried exhibition for all two dimensional media, painting, photography, printmaking and mixed media.
Antoine Lefeuvre on The Web, Worldwide: Singapore, a Hub for Designers?
One of this column’s objectives is to take you traveling. Our destination today is the city-state of Singapore. During my voyages, I kept coming back to this small Asian nation, because Singapore is a hub for world travelers. But is it a hub for designers too? Here’s the answer from three Singapore designers—two expats and one local.
The Lion City
I first traveled to Singapore in 2010, my mind full of stereotypes: I expected to find a postage stamp-sized country—think Vatican—so aseptic that even chewing gum is illegal. But I quickly realized how wrong I was. Singapore is actually a 30-mile-wide island blessed with lush vegetation and home to a thriving city of 5 million inhabitants. Only 60 percent are Singaporean citizens, including Amalina Zakaria, a web designer “born and raised in Singapore” who represented her country at WorldSkills 2009.
The Lion City—Singapura in Malay—is also a hotspot for expatriates. Game designer Antoine Henry left the banks of the Seine for the shores of Malacca Strait in August 2014. In the growing expat community he met Perrine Lefeuvre, a creative director who has been working in Singapore since 2012 for luxury brands such as Guerlain and Hermés.
One of the notions I had about the city turned out to be true. Singapore is “Asia for dummies”—an easy city for first-time travelers to Asia: orderly, English-speaking, clean, well-connected. Easy doesn’t mean boring, though. The whole of Asia meets in the city-state.
A unique blend
“The cultural diversity here is one of my main sources of wonder. For a European like me, it is amazing to find yourself at the crossroads of Asian cultures like Chinese, Indian, Malay, and the whole diversity of South-East Asia in general,” says Antoine Henry. Perrine Lefeuvre also finds that the city-state is an exciting place to be a designer. “If you have experience, you will have access here to projects you will never work on in Europe.”
Even for those who are not new to this melting pot, like Amalina Zakaria, the diversity is mind-opening. “The different styles of each culture and how it is fused and integrated into modern design has always been an inspiration for me as a designer.”
With 75 percent of Singaporeans being ethnic Chinese, you might be tempted to imagine the Lion City as a microcosm of China, a tropical Hong Kong. “Don’t,” reply my three interlocutors as one. “Despite our large Chinese population,” says Amalina Zakaria, “we are ultimately a Singaporean audience, rather than a Chinese, Malay, or Indian audience.” Perrine Lefeuvre adds, “Singapore only feels like China during Chinese New Year, when everything is gold and red—the traditional colors.” She even believes there’s a Singaporean style of design: “Very preppy, gentle, clean—and a bit hipster.”
The right environment for creatives?
Many web, game, and design companies have chosen the city-state for their Asian headquarters, Perrine Lefeuvre told me. And startups are following suit. “With a growing entrepreneurial spirit among locals, this creates opportunities for creative professionals to work with startups on exciting new projects. There is a lot of financial support and backing in the form of grants if creative professionals want to start something,” says Amalina Zakaria. “Singapore is a booming industry for creatives,” she adds.
Singapore, a paradise for startups and web companies? Although Amalina Zakaria has found bureaucratic procedures stifling, Harvard Business Review calls Singapore “one of the easiest countries in the world in which to do business.”
But when it comes to recruiting creatives, most of the expats I met told me the process of fostering creative thinking needs more time. A tradition of putting the group in front of the individual has historically made local workers less comfortable displaying initiative and creativity. “After a few frustrating experiences, I had to hire a designer from the Philippines because I couldn’t find one from Singapore,” explains Perrine Lefeuvre. Antoine Henry, who leads a team of designers, also experienced the culture gap. “I was used to challenge and be challenged quite openly regardless of who’s managing who. This is happening a lot less here, and I had to change my work process to actively seek that kind of honest feedback.”
A genuine world city
Listening to Antoine Henry, I have the feeling Singapore is actually Asia’s biggest Western city. “From my colleagues’ gaming habits and the test sessions we conduct with Singaporeans, I tend to think that their video games consumption is closer to Western than Chinese.”
Singaporeans are “exposed to a lot of influences from the West right from the start,” explains Amalina Zakaria. “We may be struggling to inject more Eastern influences into our work!” she adds. Which means designers choosing the city-state for a deep dive into Asian cultures might be in for a disappointment. “It doesn’t have the hints of Asian tradition that you find elsewhere in South-East Asia, nor the eccentricity found in South Korea or Japan,” acknowledges Antoine Henry.
But Singapore is actively shaping its own culture. This could well be its best argument to attract foreign clients as well as creative workers. As Amalina Zakaria says, “designers in Singapore are so well-versed in Western media, culture and customs, that we’re able to communicate effectively with our global clients.”
Because it concentrates so much diversity, Singapore has always struck me as an “East meets West” kind of place. “It’s a more complex situation than just ‘East meets West’,” retorts Amalina Zakaria. “We do not have a long history that is unique to ourselves,” she says. “However, we are globally exposed with a lot of influences coming from outside, rather than inside—and that’s what makes us globally competitive.”
Originally published in February 2014, now updated/corrected/expanded.
So you’ve installed WordPress and want to blog about code. Yay! You’re a hero and I thank on behalf of myself an coders everywhere. Here’s what you’ll need to do and think about to actually get publishing blocks of code.
The HTML for a “code block”
There is an element specifically for code: <code>. I’d say it’s semantically correct to wrap any and all code in it. Browser’s default stylesheets leave it as inline element, and I’d recommend you leave it that way so you can use it within sentences like I did in the last sentence.
But you’ll want to use a block-level element to wrap a block of code. <pre> is the perfect element for that, as it naturally retains whitespace. “Pre” as in “Preformatted text”. Multiple spaces will render as multiple spaces instead of collapsing into a single space as normally happens in HTML. That’s perfect for code, because you’ll likely want to use indentation in a block of code and you don’t want to resort to any shenanigans.
Turn off the “Visual” editor
By default, WordPress lets you switch between Visual and Text tabs in the editor.
For you, the Visual editor has to go. You will never use it. You want full control of the text you are writing and want it to stay just how you write it when you save it.
Turn it off under Users > Your Profile
Are you going to blog in Markdown or not?
Here on CSS-Tricks I do not, but if I could go back in time to the beginning I probably would. On most subsequent blogs I’ve done, I do use Markdown and prefer it. If you are going to, I’d suggest using Jetpack’s Markdown feature.
To post a block of code in Markdown, one ways is to indent that code four spaces on every single line, like this:
Yadda yadda yadda. I'm a *paragraph* in Markdown. Here's a [link to Google](http://google.com). Here's a block of code:
<p>I'm some code.</p>
Another paragraph here.
Manually doing that is going to get old very fast. So you’ll want to replace your editor buttons with Markdown buttons. It looks like the plugin Markdown Quicktags can do that.
What’s cool about using Markdown is that you don’t have to worry about escaping the code. So those angle brackets are no rendering threat, Markdown will escape them for you. In other words, all those angle brackets (<) in the HTML example above will be turned into < and thus display on the screen as an angle bracket rather than confuse the browser into thinking an HTML tag is coming up.
That Markdown example above will be turned into this before it hits the browser:
<p>Yadda yadda yadda. I'm a <em>paragraph</em> in Markdown. Here's a <a href="http://google.com">link to Google</a>. Here's a block of code:</p>
<p>I'm some code.</p>
<p>Another paragraph here.</p>
If you’re interested in blogging in Markdown, you have some options. Jetpack, the Automattic-created and maintained plugin, now offers it as part of it’s mega-pack of offerings. At the time being I use WP-Markdown here on CSS-Tricks (I know I said I don’t use Markdown, but I do for the Forums and comments, just not blogging).
There is a fairly major limitation here though. Notice that the four-spacing indentation converts into a <pre><code> block, but there was no opportunity there to add attributes to those tags. Attributes (like classes and data-* attributes) are a common need. You might want to use a syntax highlighter (we’ll talk about those later) that requires some attributes to do it’s thing. Or you might want to identify the code block somehow by language.
More convenient than indenting, many “flavors” of Markdown (including the Jetpack version) support code fencing, which is putting blocks of code within triple backticks:
<p>I'm some code.</p>
I’d call this straight up better. It’s easier to jump into a code block while writing without having to worry about the indentation thing. Plus code has it’s own indentation going on so it’s nice to start flush-left with that.
You can also specify the language right in the Markdown syntax. So our example could be:
<p>I'm some code.</p>
<p>I'm some code.</p>
If you DON’T use Markdown, you’ll need to escape the code.
You could do it manually by converting all <‘s into <’s, but you’ll go nutty doing that. You could use a tool like Postable to copy-and-paste blocks to be escaped, but that’s slow and tedious too.
I prefer using a plugin called Code Markup for this. It just auto-escapes anything it finds within <code> tags so you just never have to think about it.
Because I use that plugin on this site, I can do stuff like:
<pre data-lang="HTML"><code class="language-markup"><div>
<p>I'm some code.</p>
And it works great. No escaping. Full attribute control.
Handling Syntax Highlighting
Remember that one option for syntax highlighting blocks of code is not syntax highlighting. Certainly that would be the fastest and easiest way. But you might want it. Personally I like it. I like the way it looks. Here’s a few options.
What essentially happens with any syntax highlighter is bits of code end up getting wrapped in <span>s with class names that you colorize with CSS. Choosing is a matter of features.
Here on CSS-Tricks, I use (and recommend) Prism by Lea Verou as it works with those right out of the box. It’s small, fast, and (my favorite) as rational class names for styling. You choose which languages you want it to support as you download it.
I also use that escaping plugin, meaning I don’t need to escape HTML inside code tags, so again that looks like this:
<pre><code markup="tt" class="language-markup"><div>
<p>I'm some code.</p>
That class="language-markup" on the code tag is what Prism picks up on to syntax highlight. It works automatically on all code it finds with that class name pattern by default, but you can use the API instead if you want to do your own thing.
An extremely popular one is google-code-prettify. To syntax highlight a block, you put class="prettyprint" on either the code or pre tag.
It’s a larger file size than Prism, but one advantage is that it auto-detects language (and supports a ton of languages), so it should work on just about anything without you having to specify it.
To decide amongst these, you might think about these things:
What languages do I mostly need to support?
Do I want to show line numbers?
Do I need to put links within the code?
Do I want to be able to highlight parts of the code or lines?
Do I have legacy code blocks I need to support? What format are they in?
Is the code easy to copy and paste? Do I want features to help with that?
Is client-side syntax highlighting OK or do I want it to happen server-side?
Visually Identifying Code Blocks
I think it’s a nice touch to be able to see at a glance what kind of code a block of code is. On this site, I do that through an attribute on the block itself, then style the value of that attribute as part of the display. You can see it in action in most of the code blocks shown here (assuming you are looking at the site itself, not reading it syndicated elsewhere).
Here’s how you can visually show a particular attribute on the code block (the styling is totally up to you!):
If you have a bunch of code blocks on a site already, I’d still recommend choosing a syntax highlighter that you like the features of for current and future use. Then finding a way to make it work for the older blocks.
For instance, let’s say I have a legacy code block that is marked up like this:
var thing = document.getElementById("thing");
That’s not the right class name for Prism. So I might use jQuery to do something like:
I mean this just as an example. The overall point is: you can manipulate the legacy code blocks as needed to fit the new format.
Using a Plugin
There are many, many plugins for this. This post is mainly geared toward handling this on your own, as that’s generally the kind of control I like. But I’m sure there are plenty of well done plugins for this. I’m afraid I can’t recommend one, but this is what I’d look for:
Good reviews / ratings / looks like it’s updated
Doesn’t make you do anything weird/proprietary with code blocks. For example, use a [shortcode]. This will make you tied to that plugin forever.
Supports the languages and features you need (and just the things you need, doesn’t load everything under the sun.)
Third Party Help
When creating the Embedded Pens feature on CodePen, we knew that displaying demos and code in blog posts is kind of a pain in the butt, so we set out to make that easier.
Here’s an example of an embedded Pen, defaulting to the CSS code:
I don’t need to worry about syntax highlighting, escaping, or anything, and get the benefit of showing the rendered demo as well.
Many of the other code editor sites offer embedded code as well like JSFiddle and JSBin. GitHub Gists can be useful for this too. Perhaps my favorite reason for using third-party tools for this is that you can go update the demo there and the blog post automatically has the new code. You don’t have to update stuff in two places.
Do you have your own way of handling code blocks on a WordPress site? Do share.
Ever wonder what’s running under the hood here at CSS-Tricks? Well, it’s been a while since we last shared the WordPress plugins used here on the site, and even longer since the time before that. We figure it’s high time to pop the hood once again and see what’s new here in 2015.
There are 40-plus plugins currently installed on this site. We won’t cover all of them since we’ve written a few of them ourselves, but I’ve grouped the rest by functionality for the sake of organization:
RSS and email are still an important way many readers receive the content and alerts that are published here. These are the plugins we use to optimize how those feeds and notifications are displayed and delivered.
FD Feedburner Plugin: Setting the native WordPress RSS feeds to integrate with Feedburner isn’t tricky in itself, but more advanced configurations require template changes, redirects and such. This plugin removes the need for all that in one fell swoop. The big idea used to be that forcing everyone to redirect (and thus subscribe) to the FeedBurner feed meant accurate tracking. But now that FeedBurner is essentially dead, that matters less. Still, having all subscribers in one place means, hopefully, moving them will be easier.
Clean Notifications: This is an oldie-but-goodie we’ve been using since before the last roundup. Although it hasn’t been updated in years, it continues to make default WordPress notifications much easier to read by removing a bunch of the extra clutter those emails typically include, by making real HTML links rather than URL strings.
Search Engine Optimization
Google is a primary source of traffic, and getting all the Google juice we can get out of our posts is helpful for keeping our numbers up. No one on staff can claim to be an SEO expert/guru/ninja/whatever, so we rely on a couple of plugins to help with the heavy lifting.
Yoast SEO: I’d have a tougher time finding a site that doesn’t have this plugin installed than one that does. It takes care of all the SEO best practices we might not otherwise think of, like proper page meta titles, canonical links, and even ways to customize the appearance of our content on search engine results pages.
Better WordPress Google XML Sitemaps: Search engines care about XML sitemaps because they supposedly help their crawlers scour website pages. While the benefits are a bit intangible, evidence points to them being a good idea, and not having to do any work to keep them up to date is great. Yoast SEO has sitemap building capability too, but it was causing site slowness for us as it was having trouble with the massive amount of URL’s the forums generate.
Maintenance & Security
This is a biggie around here. I flinched the first time I saw how big the database for this site is. While there are other ways we protect and back this stuff up besides plugins, these are a couple we use to help.
SiteLock: This is a WAF (Web Application Firewall) service we use to monitor the IP addresses of incoming connections to the site. In other words, it passes all IP addresses through SiteLock’s servers prior to hitting the site so the originating IP address is always known. This is super handy for attempted hacks where the IP address might be obscured by clever redirects.
VaultPress: This backs up everything up—templates, data and all. Plus, it does it in real time on a separate server to help with redundancy. Set it, forget it, recover it. Oh yeah, and it’s made by Automattic (the company behind WordPress) so it comes with a high level of trust.
Advanced Post Caching: Even though this is rather old, it’s created by Matt Mullenweg himself. It was actually recommended and installed by Erick Hitter from Automatic for us when he was helping us with some performance work.
MinQueue: This plugin minifies and concatenates the site’s styles and scripts, and provides a list of which ones are enqueued. This is particularly useful for all the assets that plugins need. Concatenating, minifiying, and caching those into single requests in an upgrade-friendly way is kinda awesome.
W3 Total Cache: Caches all the things for faster page loads, especially on repeat visits. It also handles our CDN integration, which is a bonus. There are so many settings in here filled with technical jargon that it can be tough to wrap your mind around it all. Thankfully, there are helpful guides like this to help get things off the ground.
Design & Editing
We like to handle this stuff directly in the code as much as possible, but there are instances where a plugin can extend the functionality of WordPress to help make design decisions on the fly and posts much easier to write and edit.
AddQuicktag: A simple, clean way to add custom tags to the WordPress text editor. We use a lot of code snippets in our posts, and this gives us a little shortcut to wrap those with the proper markup faster than writing it out by hand.
Advanced Custom Fields: The easiest way to add additional fields to the page and post editor without having to write crazy functions. For example, we have a Custom Post Type of “Shifts” that we use to manage upcoming Office Hours sessions. All the custom data (like date, time, URL’s, session topic, etc) are created from ACF.
Advanced Excerpt: We’ve had this one around for a while, and it continues to do the trick of allowing markup tags in post excerpts. It also lets us create custom one-off excerpts on the fly using a simple function, rather than having to code a new one for each instance.
Better Art Direction: This is a fork of the Art Direction that our pal Dave Rupert put together. The underlying concept is still the same as the original: injecting CSS and JS on a per-post and per-page basis. This lets us make one-off tweaks or customizations to a post without having to mess with the site’s global CSS and JS files.
Code Markup: Still the same solution we’ve been using to escape HTML markup in posts for years now. It searches for text wrapped in <code> tags and escapes it (e.g turns < into <) for us before output, so we don’t have to worry as much about escaping code ourselves.
Public Post Preview: This lets us share a link to a post draft with anyone, which they can read without logging in. The majority of the time we use it to share a preview of a guest post so that the author can provide feedback or changes.
WP-Polls: We publish polls on the site every month or so. In fact, there’s one in the sidebar of this post, and you should take it! It’s a neat way to get a (non-scientific) pulse on what the CSS-Tricks community thinks about certain topics and issues. This plugin is the engine behind that.
Permissions & Moderation
You may have noticed that post comments and forums threads are a big deal on this site. Building a solid, safe, and fun place for everyone to participate in the community is a tough job, but these plugins make it manageable.
Akismet: This has blocked 1,331,013 spam comments on the site since the day it was installed. That’s more than 1.1 million comments since the last time we did a roundup like this in 2012. Praise be!
Anti-spam Pro: Catching spam in comments often requires something like a CAPTCHA. That works, but makes it harder to leave a comment. This plugin provides the same effect without the extra layer of effort for our readers.
Avatar Manager: Yes, Gravatar is excellent and great and everything nice. At the same time, we like the idea of allowing people who register on the site to manage their avatar images directly on the site. This plugin makes that possible.
bbPress: This is the thing that powers everything related to our forums. Several of the plugins we use are extensions of it to help moderate the activity of the forums, such as featured replies, reporting abuse, and email notifications.
Featured Comments: This is another long-time citizen of our plugin community. It allows us to feature good comments and bury ones that we feel are not valuable to the discussion. I wouldn’t say we have to use this often, but it does come in handy for keeping a good vibe around here. Chris talked about discovering this plugin in his post Curating Comment Threads.
oEmbed in Comments: A handy plugin that recognizes media links and converts them to embedded media, a la YouTube videos. WordPress has been doing this in the post editor for a while now, and this extends it to comments. Particularly useful for [embedding Pens](http://blog.codepen.io/documentation/api/oembed/).
QA Captcha: We use CAPTCHA for logging into the site. This plugin turns it into a question and answer format, rather than one of those scrambled images that are tough to read.
User Switching: This one allows staff to log in as anyone else with a registered account. It’s excellent for trying to replicate reported issues with accounts and for testing new features.
Username Changer: WordPress does not allow registered users to change a username right out of the box. This plugin makes it possible. It actually came in handy for me when I needed to modify my username after joining the team.
CSS-Tricks is far from being an eCommerce site, but we do sell things, from t-shirts (sometimes) to Lodge memberships (always). We have a couple of plugins to make that happen.
Restrict Content Pro: This is the magic behind The Lodge; it lets us make certain pages and posts available exclusively to current Lodge members.
WordPress comes with a few plugins by default, and promotes a few right out of the box. We have those, too.
JetPack: This is less of a plugin than it is a series of plugins that bring some of the functionality of WordPress.com into a WordPress.org site. The modules we use are related to the forums or to backing up the site, and we have a couple of other custom extensions beyond that. Mostly we use it for its standardized support of Markdown, it’s enhanced malicious login blocking, and offering the ability to subscribe to posts and comment threads.
WordPress Importer: Imports posts into WordPress via XML. Comes with every WordPress installation.
Hello Dolly: Just kidding. We took that one out long ago.
Phew, that’s quite a list! While we do have a few other plugins installed, they are functionality plugins we wrote because we like to keep functions as plugins as often as possible.
Do you use similar plugins on your WordPress site? Are there any alternatives we should check out? Let us know in the comments.
PhotoSpiva 2016 photography exhibition – Joplin, Missouri
$3,000 in cash awards. Deadline: January 3, 2016
Open to all U.S. photographers, amateur and professional. Any photographic process is eligible as long as the work is original and has not been previously shown at Spiva Center for the Arts. No three-dimensional entries accepted.