<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:series="http://organizeseries.com/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Mike McLin</title>
	
	<link>http://mikemclin.net</link>
	<description>Professional Blog</description>
	<lastBuildDate>Mon, 13 May 2013 13:00:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/mikemclin/net" /><feedburner:info uri="mikemclin/net" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>mikemclin/net</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Configuring the package.json and Gruntfile.js files</title>
		<link>http://feedproxy.google.com/~r/mikemclin/net/~3/2Tn-FmYT90c/</link>
		<comments>http://mikemclin.net/configuring-package-json-and-gruntfile-js/#comments</comments>
		<pubDate>Mon, 13 May 2013 13:00:21 +0000</pubDate>
		<dc:creator>Mike McLin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[grunt]]></category>
		<category><![CDATA[npm]]></category>

		<guid isPermaLink="false">http://mikemclin.net/?p=111</guid>
		<description><![CDATA[<p>In this video we create and configure both the required package.json and Gruntfile.js files.  Both of these files are required in order for Grunt to work.</p><p>The post <a href="http://mikemclin.net/configuring-package-json-and-gruntfile-js/">Configuring the package.json and Gruntfile.js files</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p>]]></description>
				<content:encoded><![CDATA[<div class="series">
    <h4 class="series-meta">This post is part <strong>2</strong> of <strong>2</strong> in the series <em><a href="http://mikemclin.net/series/grunt-js-video-tutorials/" class="series-22" title="Goin Hog Wild with Grunt">Goin Hog Wild with Grunt</a></em></h4>
    <div class="fitvids"><iframe src="http://player.vimeo.com/video/66057352" width="640" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
<div class="transcript"><h3 class="transcript-title">Video Transcript</h3><div class="transcript-body">Hi, my name is Mike McLin and in this video I am going to talk about the 2 files that are required for Grunt Task Runner to function.  The first is the package.json file which we’ll use to describe metadata about our project, like the name, version number, etc.  We will also use this file to load the necessary plugins required by Grunt.  From there I’ll discuss the second file required for Grunt to function, which is the Gruntfile.js.  This is your main configuration file, and where we’ll spend most of the time in this video.  The Gruntfile.js is where everything really happens.  So, let’s get started by creating our package.json file.</p>
<h3>Creating a <code>package.json</code> file</h3>
<p>There are a couple of ways you can create your package.json file.  You can run the ‘npm init’ command in your command line tool of choice, or you can use a tool called grunt-init, which is a handy project scaffolding tool that can build your whole project structure for you based on a project template.  While, this is an awesome tool, we aren’t quite ready for that yet, so we are going to go with the easiest most straightforward way, which is copy and paste.  I’ll head over to the Getting Started page on the Grunt website, and copy their package.json example.  Now, I’ll paste it into a new document and save it as package.json in my project’s directory.</p>
<p>Now, let’s configure the file.  First off, I want to point out that the file uses 2-space indents, and camelCasing.  Personally, I prefer tabs, but it is always a good practice to use the coding standards established by the project.  Since this is a Node Package Manager file, I will adopt their coding style. Both the name and version fields are required for Node Package Manager, and for Grunt to run, we will need to install the Grunt plugin along with any other dependencies by using the devDependencies field.  Let’s change the name of our project to ‘hog-wild’.  Notice the naming convention.  You are not allowed to use non-url-safe characters, and your name can’t begin with a period or underscore character.  The version value is a 3-number value that follows the Semantic Versioning Standard, which can be found at semver.org.  The first number is the major version, the second number is the minor version, and the final number is the patch version. Right now, we have a major version of 0, which is what is used for initial development. Since, we don’t have a working app yet, this is a good version value to start off with.</p>
<p>You’ll notice that the devDependencies value is an object, which has it’s own key:value pairs.  The keys are the names of the Grunt plugins we need to install, and the values are the plugin versions we need to install.  Notice there is a tilde character in front of the versions.  This means, that Node Package Manager should install the newest version of the plugin, all the way up to the next major revision range. So, for example, Node Package Manager will install the newest version of Grunt 0.4.  So, if version 0.4.8 is the newest version, then it will download that.  However, it will not jump to the next revision range.  In other words, it will not install Grunt 0.5.0, because that might not be completely backwards compatible with your project and could break functionality.</p>
<p>For now, don’t worry about the devDependencies section.  I will show you how to create your own devDependencies object later on as we work with Grunt.  I do want to point out that this is a bare minimum example of a package.json file.  If you take a look at the package.json file for my MikeMcLin.net website, you’ll see several other values.  You can learn more about the various options you can add, by heading to the Node Package Manager package.json webpage.  For now, let’s move on to the Gruntfile.js.</p>
<h3>Creating a Gruntfile.js</h3>
<p>Similar to the package.json file, the Gruntfile can be created in a few different ways.  Since we are just starting out, I’ll copy the sample Gruntfile that is on the Grunt website.  Now, I’ll paste it into a new file and save it as Gruntfile.js, in my project’s root directory, right next to my package.json file.  Also, notice that it shares a similar coding style with Node Package Manager, like 2-space indents and so on, so we’ll continue to build this file using those same coding styles.</p>
<h3>The Gruntfile wrapper function</h3>
<p>First thing you’ll notice is the wrapper function.  All the code goes inside of this function.  This is boilerplate markup that never changes.  You don’t really need to understand what is going on here to use Grunt.</p>
<p>Inside of the wrapper function there are 3 main sections.  The first is your configuration, which is the meat and potatoes of your Grunt file.  The next section is where you load the plugins that are required for your Grunt tasks, and the final section is for your task lists.</p>
<h3>Setting up the Gruntfile.js config</h3>
<p>OK, let’s jump into the config, to see what is going on.  I’m going to remove a lot of these task configurations, so the config doesn’t look so overwhelming.  The first thing you’ll see is a pkg property which is storing the contents of our package.json file.  Once again, this is pretty much boilerplate stuff, you will probably never change this, and therefore all you need to know is that it is loading in the contents of your package.json file, and storing the data into the pkg parameter.</p>
<p>Now, we get to our first task, which is the concat task, which takes multiple files and joins them into one file.  Inside the task, we have an optional options property, that can override some of the defaults for that task. Beneath that we have what is called a target.  This task only has one target configured, but you can create multiple targets.  We can name our target whatever we want as long as it’s a valid JavaScript identifier.  Just stick with camel case target names, and you should be alright.</p>
<p>Target’s can also have their own options parameter, which will override the task’s options parameter.  Inside of the target we are declaring some files.  Since most of Grunt’s tasks are file related, understanding how to configure your files is very important.  There are several ways you can tell Grunt which files you want to use.  This method is called the Compact Format. It is best suited for read-only tasks that don’t have a destination file, like linting.  This particular concat task is setup to grab all of the JavaScript files within the src directory and any of it’s subdirectories. In other words, it grabs what is set in the src parameter, and then performs it’s operation, which in this case is to concatenate all of the files.  After concatenation, it needs a place to store the new file, which is set in the dest parameter, which is short for destination. In this case, the dest value is using a template to help name the file.  We’ll go over templates in a bit.  So, the issue is, what if we want to grab a different group of files and concatenate them as well?  Well, you could create another target, however targets are usually used to divide tasks so that they can be run individually in different circumstances.  Now we are seeing the limitations of the Compact Format.  Let’s upgrade this to what is called the Files Object Format.<br />
Now, we use the dest as the key, and the src as the value.  We can easily add more file mappings while separating them with a comma.</p>
<p>While this works well, there is also another format called the Files Array Format, which seems to be more popular and flexible. This is the format I choose for the majority of my file-based tasks.</p>
<h3>Using globbing patterns to specify files in your Gruntfile.js</h3>
<p>Now that we know how to format our src and dest parameters, let’s take a look at how we can use globbing patterns to specify the files we want to use.</p>
<p>The first example is the most basic.  You can simply type out the relative path to the file.  Note that all paths are relative to the Grunt file.</p>
<p>The second example is an array of files.  It will include those three files.</p>
<p>The third uses an asterisk wildcard which means any character except the slash character.  So this would include the three files mentioned in the previous example, plus any other JavaScript file that is in the foo directory that begins with ‘th’.</p>
<p>Now, what if the foo directory has subdirectories in it?  Well, those files will not be included.  So, how do we include those?  Well, we can use a double-asterisk, which will now look for JavaScript files in all of foo’s subdirectories, and their subdirectories and so on.</p>
<p>We also have a single node-glob pattern which I rarely use, but it’s there if you need it. You basically can create a comma-separated list of values inside of curly braces, and it will go through each entry as if it were it’s own.</p>
<p>It is important to note that the order that you place your files into an array matters. In the second example, the concatenated file would have this.js, followed by that.js and then the-other.js.  This is really important when certain files require others to be loaded before they are.  A good example would be a jQuery plugin needs to be loaded after jQuery has loaded.  Whenever you use an asterisk, it loads the files in alphabetical order. If a file needs to be loaded prior to the other files, you can do so by putting it before the wildcard files in the array.</p>
<p>One of the most powerful tools is removing files from an array.  You do that by prepending an exclamation point to the front of the filepath. This example will load in all JavaScript files in the foo directory, except for the bar.js file.  This is also a handy way to load a file last.  You can add all of the files using the asterisk, then remove the file, and now re-add the file and it will be added to the end.</p>
<h3>Using templates in your Gruntfile.js</h3>
<p>Finally, the last thing I want to talk about when discussing file paths is templates.  Nearly everything in the Grunt config can be used as a template, which feels very similar to a variable. Templates follow the following format using less than and greater than characters and percent characters as delimiters.  We’ve already seen a template earlier in our Grunt file.  The dest for our concat task is using a template to set the destination file name.  In this case, it is going to assign the value of the name parameter in the pkg object.  Well, we are reading the contents of the package.json file, and storing it into the pkg object.  So, essentially the pkg object contains the same data as the package.json object.  So, the pkg.name value is ‘hog-wild’, since that’s the value we gave the name property in our package.json file.</p>
<p>Alternatively, we could use the separator property as a template if we wanted.  If we changed this to concat.options.separator, the filename would now be semi-colon.  Of course, this example isn’t realistic, but I just wanted to point out that nearly everything in the config can be used as a template.  Templates will eventually be one of your best friends, and we’ll be using them a lot throughout this video series.</p>
<h3>Gruntfile.js Plugins Configuration </h3>
<p>OK, that’s it for the config object.  I’m going to wrap the remaining parts of the Gruntfile up pretty quickly. As mentioned earlier, these are the Grunt plugins that we require to run our tasks.  Since, we’ve deleted a good amount of our config section, we now are only left with the concat task.  Therefore, this is the only task that we will need to load. So, how do we know what plugins are available to us?  Well, you would head to the Grunt website and browse their plugins section.  I will be picking out various plugins and installing them throughout this course, so don’t worry if none of this makes much sense to you right now, or seems overwhelming.  It is actually very easy.</p>
<h3>Creating Task Lists in your Gruntfile</h3>
<p>Finally, the task lists&#8230;  These tell Grunt which tasks to run, and in which order.  This Grunt file has 2 task lists.  The first one is named ‘test’.  The test class will run the jshint task, followed by the qunit task.  Obviously we’ve removed those tasks from our config, so this task would no longer work.  The second task list is called default, and it is&#8230;well, the default task list.</p>
<p>So, how do we run these tasks lists.  Well we run them using the command line.  I would navigate to my project’s folder.  Then, if we type the grunt command, like I did in the first video, the default task will run.  If I want to run a specific task, I will type the grunt command plus a space, and then the name of the task list I want to run.  For example, in this file, I might want to run the test task list, so I would type the command ‘grunt test’.</p>
<p>OK, that’s it for this video.  If you are somewhat confused, don’t worry. The hard part is definitely behind you. This was a lot to take in, and it’ll all start making sense when we begin building real-life examples.  Speaking of which, that’s what we’ll do in the next video, where we’ll look at how to concatenate and minify our JavaScript files.<br /></div><a href="#" class="transcript-view-link btn btn-inverse btn-block">View Transcript</a></div>
<h3>Related Links</h3>
<dl>
<dt>Grunt Task Runner</dt>
<dd><a href="http://gruntjs.com/" target="_blank">http://gruntjs.com</a></dd>
<dt>Semantic Versioning Specification</dt>
<dd><a href="http://semver.org/" target="_blank">http://semver.org</a></dd>
<dt>NPM | package.json</dt>
<dd><a href="https://npmjs.org/doc/json.html" target="_blank">https://npmjs.org/doc/json.html</a></dd>
</dl>
<p>The post <a href="http://mikemclin.net/configuring-package-json-and-gruntfile-js/">Configuring the package.json and Gruntfile.js files</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p><img src="http://feeds.feedburner.com/~r/mikemclin/net/~4/2Tn-FmYT90c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mikemclin.net/configuring-package-json-and-gruntfile-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<series:name><![CDATA[Goin Hog Wild with Grunt]]></series:name>
<enclosure url="http://mikemclin.net/mmwp/wp-content/uploads/2013/05/configuring-package-json-and-gruntfile-js-300x200.png" length="16651" type="image/jpg" /><media:content url="http://mikemclin.net/mmwp/wp-content/uploads/2013/05/configuring-package-json-and-gruntfile-js-300x200.png" width="300" height="200" medium="image" type="image/png" />	<feedburner:origLink>http://mikemclin.net/configuring-package-json-and-gruntfile-js/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=configuring-package-json-and-gruntfile-js</feedburner:origLink></item>
		<item>
		<title>Introducing and Installing Grunt Task Runner</title>
		<link>http://feedproxy.google.com/~r/mikemclin/net/~3/65_AkZwzpg0/</link>
		<comments>http://mikemclin.net/install-grunt-js-task-runner/#comments</comments>
		<pubDate>Mon, 29 Apr 2013 13:00:39 +0000</pubDate>
		<dc:creator>Mike McLin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[grunt]]></category>

		<guid isPermaLink="false">http://mikemclin.net/?p=97</guid>
		<description><![CDATA[<p>In this video we introduce Grunt Task Runner and show how it automates tasks like minify, testing, linting etc for you.  We finish off by installing Grunt.</p><p>The post <a href="http://mikemclin.net/install-grunt-js-task-runner/">Introducing and Installing Grunt Task Runner</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p>]]></description>
				<content:encoded><![CDATA[<div class="series">
    <h4 class="series-meta">This post is part <strong>1</strong> of <strong>2</strong> in the series <em><a href="http://mikemclin.net/series/grunt-js-video-tutorials/" class="series-22" title="Goin Hog Wild with Grunt">Goin Hog Wild with Grunt</a></em></h4>
    <div class="fitvids"><iframe src="http://player.vimeo.com/video/65014958" width="640" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
<div class="transcript"><h3 class="transcript-title">Video Transcript</h3><div class="transcript-body"><p>Hi, my name is Mike McLin and in this video series we are going to be talking about Grunt. Grunt is a JavaScript Task Runner. So, what does that mean exactly? Well, the tool is built with JavaScript, and runs on Node.js. You do not need to know any JavaScript or know anything about Node.js to use the tool however. OK, so what is a task runner? A task runner performs automated tasks like compilation, linting, unit testing, concatenation, minification and so on. Let’s take a look at this tool in action.</p>
<h3>Grunt Task Runner Example</h3>
<p>I am currently in my project’s directory using my command line tool. All, I need to do is type the word “grunt”, and the default task runner begins. After just a few seconds, it has completed. So, what has Grunt done for us?</p>
<h3>What did Grunt.js do for me?</h3>
<p>It ran my JavaScript files against JSHint to make sure they are lint-free, executed all of my JavaScript unit tests, cleaned up my production JavaScript directory, concatenated all of my jQuery plugins and 3rd party JavaScripts into one file, minified all of my JavaScript files and saved them in my production directory, cleaned up my production image directory, crunched all my source PNG and JPEG images and saved them to the production image directory, copied my gifs to the production directory, compiled all of my SASS files into a single CSS file, added the necessary WordPress comment block to the top of my style.css file and saved it to the production directory, and finally cleaned up some image sprites that were no longer needed. It basically completed tasks that would have totaled a couple minutes of work on my end, in only a few seconds. Also, please note that I have only setup about 6 or 7 tasks compared to the hundreds of tasks that Grunt can perform.</p>
<p>The beauty of this tool is not only the speed, but the ease of use. Now, anybody that works on your project will not need to know how all of your tools work. Instead, they just have to type the word “grunt”, and the task runner will perform the tasks for them which will lead to more consistent, higher-quality content.</p>
<h3>How to Install Grunt.js Task Runner</h3>
<p>We will end this video by installing the Grunt, which is extremely easy. First you need to make sure that your computer has Node.js installed. To install Node.js, simply head to the Node.js website and download the installer. Now install the program just like you would any other Mac or Windows program. Once installation is complete, you might need to restart your computer before installing Grunt.</p>
<p>To install Grunt, open up the command line tool of your choice. Now type in the command “npm install -g grunt-cli”. If the install fails, you most likely need to run the command as a superuser on Mac or an Administrator on Windows. This is very easy. On Mac, just type in the word “sudo” plus a space before the command. It will prompt you for your password. On Windows, open your command line by right clicking it and choosing “Run as Administrator”. Now type in the command, and everything should work appropriately.</p>
<p>So now that we have Grunt installed onto our computers, and we have a basic idea of what Grunt does, We’ll get started building our first Gruntfile in the next video&#8230;</div><a href="#" class="transcript-view-link btn btn-inverse btn-block">View Transcript</a></div>
<h3>Related Links</h3>
<dl>
<dt>Grunt Task Runner</dt>
<dd><a href="http://gruntjs.com/" target="_blank">http://gruntjs.com</a></dd>
<dt>Node.js</dt>
<dd><a href="http://nodejs.org/" target="_blank">http://nodejs.org</a></dd>
</dl>
<p>The post <a href="http://mikemclin.net/install-grunt-js-task-runner/">Introducing and Installing Grunt Task Runner</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p><img src="http://feeds.feedburner.com/~r/mikemclin/net/~4/65_AkZwzpg0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mikemclin.net/install-grunt-js-task-runner/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<series:name><![CDATA[Goin Hog Wild with Grunt]]></series:name>
<enclosure url="http://mikemclin.net/mmwp/wp-content/uploads/2013/04/grunt-task-runner-300x200.png" length="18382" type="image/jpg" /><media:content url="http://mikemclin.net/mmwp/wp-content/uploads/2013/04/grunt-task-runner-300x200.png" width="300" height="200" medium="image" type="image/png" />	<feedburner:origLink>http://mikemclin.net/install-grunt-js-task-runner/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=install-grunt-js-task-runner</feedburner:origLink></item>
		<item>
		<title>The Current State of Truncating Text with an Ellipsis</title>
		<link>http://feedproxy.google.com/~r/mikemclin/net/~3/PE_uwgsAy3o/</link>
		<comments>http://mikemclin.net/text-overflow-ellipsis/#comments</comments>
		<pubDate>Mon, 22 Apr 2013 13:00:23 +0000</pubDate>
		<dc:creator>Mike McLin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://mikemclin.net/?p=35</guid>
		<description><![CDATA[<p>In this video, I’ll show how to truncate text with CSS text-overflow ellipsis. Then view some experimental features and how to do a multiline truncate.</p><p>The post <a href="http://mikemclin.net/text-overflow-ellipsis/">The Current State of Truncating Text with an Ellipsis</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>In this video I am going to talk about truncating text.  First, I’ll demonstrate how to truncate text using the CSS <code>text-overflow</code> property. From there we’ll take a look at cross browser support.  Finally, we will view some experimental features of the property and how to accomplish a multi-line truncate.</p>
<div class="fitvids"><iframe src="http://player.vimeo.com/video/64545603" width="640" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
<div class="transcript"><h3 class="transcript-title">Video Transcript</h3><div class="transcript-body">Hi, my name is Mike McLin, and in this video I am going to talk about truncating text.  First I’ll demonstrate how to truncate text using the CSS text-overflow property.  From there we’ll take a look at cross browser support.  Finally, we will view some experimental features of the property and how to accomplish a multi-line truncate.</p>
<p>To demonstrate the basics of how to truncate text with CSS, I’ll use this quick demo.  For the HTML markup, we have a simple paragraph of Lorem Ipsum text.  I’ve also added both width and border declarations to the paragraph element.</p>
<h3>Setting up text-overflow: ellipsis</h3>
<p>Eventually, we will want to use the text-overflow CSS property to add three dots after our text, which is also known as an ellipsis, but before we can do that, we must make the text overflow.  We can prevent the paragraph from wrapping into multiple lines by assigning the white-space property a value of “nowrap”. This will cause the text to appear on a single line, and overflow outside of the paragraphs box.</p>
<p>Now, to prevent the text from overflowing outside of the box, we will add an overflow value of “hidden”.  The only thing left is to add the final declaration, which is assigning the text-overflow property a value of “ellipsis”.</p>
<p>Now, we have the truncating effect we desire.  There is a bit of a gotcha here, however.  The text overflow property will only work on block-level elements.  So, If I change the paragraph tags to emphasis tags, we will see the effect go away.  We can simply restore the effect by manually changing the display property of the element to a block.</p>
<h3>Text-overflow Browser Support</h3>
<p>It is that simple to create this effect using on CSS.  I we view the property on the “caniuse” website, we see that browser support is very strong. Older versions of Opera and Opera Mobile, plus all versions of Opera Mini will require a vendor-specific declaration to render the effect appropriately.  That is as simple as rewriting the text-overflow property and prepending a “-o-” in front of it.</p>
<p>When looking at Mozilla Developer Network page for the text-overflow property, you will see that there are some other implementations, most notably a 2-value syntax that allows you to place an ellipsis before and after the body of text.  These extra features appear to only currently work in Firefox, and therefore are pretty much useless to most developers at this time.  It should be noted that the text-overflow property has been reduced down to working draft level, so the property could see some changes in the future.</p>
<h3>Text-overflow Multiline Truncate</h3>
<p>Usually the first question that somebody asks when seeing text being truncated with an ellipsis by the text-overflow property is if it will allow you to truncate values that overflow height-wise from a box.  In other words, can we have a multiline truncate?  The answer is no.  Text-overflow only calculates text that overflows on the horizontal sides of the box. However, there are some workarounds.</p>
<h3>Setting Up -webkit-line-clamp Multiline Truncate</h3>
<p>As pointed out by David Desandro, there is a property for webkit browsers called “-webkit-line-clamp” that will allow you to do multiline truncates when used in conjunction with a few other experimental webkit-only properties. </p>
<p>First, we need to set the display property to a value of “-webkit-box”.  Next, we will set the -webkit-box-orient property to a value of “vertical”.  Finally, we use the -webkit-line-clamp property to set the number of lines we want to display.</p>
<p>This would seem to be a perfect answer to our multiline truncating woes, but obviously it will only work in webkit browsers, plus these properties are considered experimental, and unsupported.</p>
<h3>Truncate text with an Ellipsis using jQuery</h3>
<p>To be honest, the best way to achieve multi-line truncation is to use JavaScript.  There are many different plugins and scripts that can give you this feature.  I found a jQuery plugin called “dotdotdot” that appears to solve the problem, plus enhance the functionality by adding additional features like adding hyperlinks after the truncated text ellipsis.</p>
<h3>Final thoughts about text-overflow ellipsis</h3>
<p>So, that’s it.  As you can see truncating text isn’t quite an exact science.  However, the majority of the browsers today are up to the task of truncating single-line text using only CSS or performing more complex truncations by falling back to JavaScript.</div><a href="#" class="transcript-view-link btn btn-inverse btn-block">View Transcript</a></div>
<h3>Related Links</h3>
<dl>
<dt>Can I Use | CSS3 text-overflow</dt>
<dd><a href="http://caniuse.com/text-overflow" target="_blank">http://caniuse.com/text-overflow</a></dd>
<dt>MDN | text-overflow &#8211; CSS</dt>
<dd><a href="https://developer.mozilla.org/en-US/docs/CSS/text-overflow" target="_blank">https://developer.mozilla.org/en-US/docs/CSS/text-overflow</a></dd>
<dt>dropshado.ws | -webkit-line-clamp</dt>
<dd><a href="http://dropshado.ws/post/1015351370/webkit-line-clamp" target="_blank">http://dropshado.ws/post/1015351370/webkit-line-clamp</a></dd>
<dt>dotdotdot | jQuery Plugin</dt>
<dd><a href="http://dotdotdot.frebsite.nl" target="_blank">http://dotdotdot.frebsite.nl</a></dd>
</dl>
<p>The post <a href="http://mikemclin.net/text-overflow-ellipsis/">The Current State of Truncating Text with an Ellipsis</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p><img src="http://feeds.feedburner.com/~r/mikemclin/net/~4/PE_uwgsAy3o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mikemclin.net/text-overflow-ellipsis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://mikemclin.net/mmwp/wp-content/uploads/2013/04/text-overflow-ellipsis-300x200.png" length="1961" type="image/jpg" /><media:content url="http://mikemclin.net/mmwp/wp-content/uploads/2013/04/text-overflow-ellipsis-300x200.png" width="300" height="200" medium="image" type="image/png" />	<feedburner:origLink>http://mikemclin.net/text-overflow-ellipsis/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=text-overflow-ellipsis</feedburner:origLink></item>
		<item>
		<title>Why WordPress’ wp_kses() is better than PHP’s strip_tags() for security</title>
		<link>http://feedproxy.google.com/~r/mikemclin/net/~3/_UMdf54RcPw/</link>
		<comments>http://mikemclin.net/wp_kses-better-php-strip_tags/#comments</comments>
		<pubDate>Thu, 04 Apr 2013 13:00:56 +0000</pubDate>
		<dc:creator>Mike McLin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[strip_tags]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp_kses]]></category>

		<guid isPermaLink="false">http://mikemclin.net/?p=33</guid>
		<description><![CDATA[<p>In this video tutorial, I discuss why WordPress' wp_kses() function is more powerful, flexible, smarter and more secure than PHP's strip_tags() function.</p><p>The post <a href="http://mikemclin.net/wp_kses-better-php-strip_tags/">Why WordPress&#8217; wp_kses() is better than PHP&#8217;s strip_tags() for security</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>In this video, I discuss why WordPress&#8217; <code>wp_kses()</code> function is more powerful, flexible, smarter and more secure than PHP&#8217;s <code>strip_tags()</code> function.</p>
<div class="fitvids">
<iframe src="http://player.vimeo.com/video/63275992" width="640" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</div>
<div class="transcript"><h3 class="transcript-title">Video Transcript</h3><div class="transcript-body">Hi, my name is Mike McLin and in this video I am going to explain why WordPress’s wp_kses() function (if that’s how you pronounce it) is better than PHP&#8217;s strip_tags() function when it comes to sanitizing data for security.  The purpose of both of these functions is to filter data by only allowing certain HTML tags, while removing all other tags.  We usually will run one of these functions (or a similar function) whenever we are accepting user input, for example comments on a blog, to prevent any type of unexpected or malicious behavior.  OK, Let’s get started.</p>
<h4>Setting up</h4>
<p>First off I’ll create a snippet of HTML, and assign it to the $string variable.  This HTML consists of 2 paragraphs, the first one also containing an anchor link.  If we echo out the string, we can see that it renders properly.</p>
<h4>PHP string_tag() function</h4>
<p>Now, let’s place the $string variable inside of PHP&#8217;s strip_tags() function and echo the result.  We can see that the text is still there however, all of the HTML tags have been removed. The PHP strip_tags() function accepts 2 parameters.  The first is the string that is to be filtered, and the second optional parameter is a string of all of the allowed tags.  Let’s go ahead and allow paragraph tag.</p>
<p>We can now see that the 2 paragraphs have been restored.  Let’s also allow the anchor tag.  Now, we can see that the anchor link has been restored.</p>
<h4>WordPress&#8217; wp_kses() function</h4>
<p>Now let’s go through the same steps using WordPress&#8217; wp_kses() function.  Just like strip_tags(), we’ll pass the string as the first parameter.  However, unlike strip_tags, the second parameter is not optional.  It is required, and it needs to be an array value, not a string.  So, let’s just pass an empty array to strip out all tags.</p>
<p>Now, let’s go ahead and allow paragraphs and anchors.  Let’s break the array out so it is easier to read.  You’ll notice that the $allowed_tags variable is an array of tags, and each tag is a nested array.  We store the allowed HTML attributes for each tag in the nested arrays.  I’ll just leave them empty for now and see what we get.</p>
<p>Now it looks like everything rendered properly.  We can see both of our paragraphs and our link.  However, when I inspect the link, you can see that the href attribute is missing.  That is because we didn’t add it to our anchor tag’s attribute array in the wp_kses() function.  You can see that the strip_tags() renders out the whole anchor tag as expected.  While this might make wp_kses() a bit more cumbersome to initially setup, it also adds another level of control when filtering your data.</p>
<p>Let’s go ahead and allow the href attribute for anchors, along with the title attribute.  You’ll notice that these have a value type of an array too.  Basically everything in the wp_kses() $allowed_tags variable equals an array.  Now, we can see that the anchor is outputting the href attribute as expected.</p>
<p>When comparing these 2 functions, many people stop here and miss out on 2 other important advantages that wp_kses() has over strip_tags().  The first is it is just a smarter function.  Let’s go ahead and add this little arrow, pointing to the link and see what happens.</p>
<h4>wp_kses is smarter than strip_tags</h4>
<p>You can see that this completely broke the expected result from PHP’s strip_tags() function.  The less-than symbol appeared to be an opening character for a potential HTML tag, a tag that wasn’t passed into the second parameter of the strip_tags() function, and therefore wasn’t rendered.  The wp_kses() function rendered the HTML properly.</p>
<h4>wp_kses is more secure than strip_tags</h4>
<p>The other advantage wp_kses() has is probably it’s biggest advantage of all.  It helps prevent JavaScript attacks.  Many times, the purpose of these functions is to help prevent such attacks, and when somebody does something like this&#8230;  The JavaScript is denied successfully.  Instead of executing the JavaScript alert, it has just output the value as harmless plain-text.</p>
<p>Now, let’s see what happens when we try something a little more clever.  We’ll sneak our JavaScript code into our anchor href attribute and see what happens.  When I click on the strip_tags() link, the JavaScript is executed.  When I click on the wp_kses() link, the JavaScript is not executed, and we are sent to whatever URL the link has sent us to.</p>
<p>If I go back and inspect the anchors, you can see that the javascript is still present in the strip_tags() anchor href, while it has been removed from the wp_kses() anchor.</p>
<h4>About the $allowed_protocols parameter in wp_kses</h4>
<p>This occurs because wp_kses() actually has a 3rd parameter that can be passed to it, which is an array of allowed protocols.  Nearly all popular protocols are accepted by default like http, https, mailto and so on, but JavaScript isn’t.  You’ll probably never want to overwrite these default protocols, but if you do, you can always read more about them on the wp_kses() page in the WordPress codex.</p>
<p>So, that&#8217;s the end of this tutorial.  My name is Mike McLin, and I hope you have seen why wp_kses() is more powerful, flexible, smarter and more secure than PHP&#8217;s strip_tags() function.</div><a href="#" class="transcript-view-link btn btn-inverse btn-block">View Transcript</a></div>
<h3>Related Links</h3>
<dl>
<dt>WordPress Codex: wp_kses</dt>
<dd><a href="http://codex.wordpress.org/Function_Reference/wp_kses" target="_blank">http://codex.wordpress.org/Function_Reference/wp_kses</a></dd>
<dt>PHP.net Manual: strip_tags</dt>
<dd><a href="http://php.net/manual/en/function.strip-tags.php" target="_blank">http://php.net/manual/en/function.strip-tags.php</a></dd>
</dl>
<p>The post <a href="http://mikemclin.net/wp_kses-better-php-strip_tags/">Why WordPress&#8217; wp_kses() is better than PHP&#8217;s strip_tags() for security</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p><img src="http://feeds.feedburner.com/~r/mikemclin/net/~4/_UMdf54RcPw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mikemclin.net/wp_kses-better-php-strip_tags/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://mikemclin.net/mmwp/wp-content/uploads/2013/04/wp_kses-vs-strip_tags-300x200.png" length="115271" type="image/jpg" /><media:content url="http://mikemclin.net/mmwp/wp-content/uploads/2013/04/wp_kses-vs-strip_tags-300x200.png" width="300" height="200" medium="image" type="image/png" />	<feedburner:origLink>http://mikemclin.net/wp_kses-better-php-strip_tags/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=wp_kses-better-php-strip_tags</feedburner:origLink></item>
		<item>
		<title>I finally “get” Markdown language, and now I love it!</title>
		<link>http://feedproxy.google.com/~r/mikemclin/net/~3/-xGKmqDsrMM/</link>
		<comments>http://mikemclin.net/markdown-syntax-language/#comments</comments>
		<pubDate>Mon, 25 Mar 2013 13:18:12 +0000</pubDate>
		<dc:creator>Mike McLin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[markdown]]></category>

		<guid isPermaLink="false">http://mikemclin.net/?p=34</guid>
		<description><![CDATA[<p>Markdown looks like just another text-to-HTML tool, but eventually, you'll notice that the beauty of Markdown is the syntax itself, not the HTML output.</p><p>The post <a href="http://mikemclin.net/markdown-syntax-language/">I finally &#8220;get&#8221; Markdown language, and now I love it!</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Markdown syntax has been around for several years, but with the explosion of Github (which uses Markdown syntax for it&#8217;s README files), many developers/designers are seeing it for the first time. On the surface, Markdown looks like just another text-to-HTML tool, however, under further inspection, you&#8217;ll notice that the beauty of Markdown is the syntax itself, not the HTML output.</p>
<p>In this Markdown tutorial video screencast, I&#8217;ll walk you through some Markdown basics, plus my experiences with the Markdown language.</p>
<div class="fitvids">
<iframe src="http://player.vimeo.com/video/62604492" width="640" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</div>
<div class="transcript"><h3 class="transcript-title">Video Transcript</h3><div class="transcript-body">Hi, my name is Mike McLin, and in this video I am going to talk about Markdown, what it is, why I use to despise it, and why I now love it.  I’ll walk through some basic Markdown examples, but more importantly, I’ll explain what Markdown really is, and why you should embrace it.  So let’s get started.</p>
<h4>Starting out with Markdown Syntax</h4>
<p>My first experience with Markdown was probably similar to most other web developers out there.  I decided to get on the Github bandwagon (pun intended) and noticed that one of their first recommended steps when creating a repository, was to create a README file, and the README file was suppose to be in Markdown syntax.</p>
<p>So, I immediately entered Markdown into my Google machine, and found the Daring Fireball site that has all the information about Markdown.  Right off the bat, I see the first sentence “Markdown is a text-to-HTML conversion tool for web writers” and I began to frown.  I mean really?  Do we really need another text to HTML tool out there?  I already had to learn wikitext, textile, bbcode and so on&#8230; Now, I have to learn another one?  I was thinking, isn’t HTML a simple enough language where anybody that has the skillset to use GitHub should be able to learn a little bit of HTML syntax?</p>
<p>Regardless, I proceeded, because  the cool kids were using GitHub, and I wanted to be invited to their parties, if only for the cake. So, I jump straight over to the syntax section to begin my reluctant journey. I notice they have an overview section that includes the philosophy for the project. I roll my eyes as I skip over to the Block Elements section, so I can actually start writing code, because the clock is ticking, and I don’t have time for this.</p>
<h4>Learning the Markdown Syntax Language</h4>
<p>I see that paragraphs are just blocks of text with a blank line separating them, what a shocker.  OK, now I see there are 2 different ways to create headings.  We can use this first method which is called setext (or however you pronounce it).  It uses either either equal signs or dashes on the line below the text to turn it into a heading.  What a waste of time and characters I thought.  OK, I also see that we can use pound symbols before the text to declare a heading which is apparently called the atx style.  Even better, I can place pound symbols after the heading too, so it almost feels like HTML.  Perfect!</p>
<p>I move on and see that I can create a blockquotes, but I have to put these greater symbols in front of the text on each line of text&#8230;what a pain.  Then I realize I only actually need to place it on the first line, and I’m thinking, ok I can handle that.  List items work as I expected, I can use either an asterisk, plus symbol, or a dash, and decide I’ll use the dash because it doesn’t require the use of the shift key.</p>
<p>Now, I see ordered lists actually have the number preceding them, and I immediately think how unintuitive.  Now, if I need to insert a list item somewhere in the middle of the list, I have to retype all the following numbers.  Luckily, I scroll down and notice that any number will work.  Perfect, I’ll just use all 1’s, like this example.</p>
<p>Eventually, I find my way down to the span elements.  Emphasized or italic items have a single asterisk wrapping them, while strong or bold-faced items have a double asterisk surrounding them.  Pretty common stuff.</p>
<p>Finally I come to the links, and see that I need to place the link text in brackets, and then place the url in parenthesis behind it.  I scroll down and see something about reference-style links, where you  actually place the url of the links somewhere else on the page, and I chuckle to myself as I think, why are they making something as simple as links so trivial.  Did I mention I hate that I am having to learn this right now.</p>
<p>So, I create my README file, and it looks something like this.  I download a plugin for my text editor that shows me the HTML preview of the Markdown, and I am satisfied with the HTML result, but still loathe Markdown.</p>
<h4>I finally come full circle about Markdown</h4>
<p>So, a few months go by, and I see someone ask what Markdown is on a forum or something, and I see someone respond saying that the purpose of Markdown is to make your text files easier to read&#8230;and that’s when it hit me.  I had been using Markdown completely wrong, and misunderstood the whole project. I hurry back to the website that introduced me to Markdown and this time read the philosophy&#8230;and there it was in plain text&#8230; “Readability, however, is emphasized above all else.”  </p>
<p>This completely change my outlook on Markdown.  I mean, I love to document stuff.  I get all nerdy with my CSS comments, and I’m not the only one.  Take a look at any popular framework, like HTML5 Boilerplate or Twitter Bootstrap  and you’ll see that they are meticulously commented.  It makes us feel warm and fuzzy to create these beautifully spaced and formatted comments.  Unfortunately, not everyone creates comments in the same fashion, so it gets hard to decide how to format your comments.  Well, Markdown has solved that problem, at least for our documentation and README files.  </p>
<p>So, I reread the Markdown syntax and realize that it usually gave me 2 options on how to format something, and almost every time I picked the wrong option.  Maybe not syntactically, but spiritually, based on the motives of the Markdown project, I picked the wrong choices.  </p>
<p>So, I decided to use the setext style headings, and not skimp out on those greater-than characters for my blockquotes.  I began to use real numbers for my ordered lists, use those reference-style links that I previously thought were unnecessarily complex, when I wanted to use anchors in a paragraph.</p>
<p>Now, I look at this simple text file, and it is beautiful, and easy to read.  If I compare the same document written in HTML, there is no comparison when it comes to readability.  So, now I embrace markdown, and understand the need for it.</p>
<p>So, thats the end of my Markdown journey.  My name is Mike McLin, and I hope this helped you understand Markdown language a little better, and hopefully you’ll agree with me, that it is a great tool in our development community.</div><a href="#" class="transcript-view-link btn btn-inverse btn-block">View Transcript</a></div>
<h3>Related Links</h3>
<dl>
<dt>Daring Fireball: Markdown</dt>
<dd><a href="http://daringfireball.net/projects/markdown/" target="_blank">http://daringfireball.net/projects/markdown/</a></dd>
<dt>GitHub</dt>
<dd><a href="https://github.com/" target="_blank">https://github.com/</a></dd>
</dl>
<p>The post <a href="http://mikemclin.net/markdown-syntax-language/">I finally &#8220;get&#8221; Markdown language, and now I love it!</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p><img src="http://feeds.feedburner.com/~r/mikemclin/net/~4/-xGKmqDsrMM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mikemclin.net/markdown-syntax-language/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<enclosure url="http://mikemclin.net/mmwp/wp-content/uploads/2013/03/markdown-syntax-language-300x200.png" length="14065" type="image/jpg" /><media:content url="http://mikemclin.net/mmwp/wp-content/uploads/2013/03/markdown-syntax-language-300x200.png" width="300" height="200" medium="image" type="image/png" />	<feedburner:origLink>http://mikemclin.net/markdown-syntax-language/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=markdown-syntax-language</feedburner:origLink></item>
		<item>
		<title>Use a single Users table for multiple WordPress sites</title>
		<link>http://feedproxy.google.com/~r/mikemclin/net/~3/GnnBb4wU7C4/</link>
		<comments>http://mikemclin.net/single-users-table-multiple-wordpress-sites/#comments</comments>
		<pubDate>Mon, 18 Mar 2013 08:00:15 +0000</pubDate>
		<dc:creator>Mike McLin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://mikemclin.net/?p=3</guid>
		<description><![CDATA[<p>Using a single users table for WordPress seems easy at first glance. Then you realize that roles also need to be managed, and it becomes a larger task.</p><p>The post <a href="http://mikemclin.net/single-users-table-multiple-wordpress-sites/">Use a single Users table for multiple WordPress sites</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Using a single users table for WordPress seems like an easy task at first. You add the <code>CUSTOM_USER_TABLE</code> and <code>CUSTOM_USER_META_TABLE</code> constants to your <code>wp-config.php</code> file and you are apparently off to the races; or are you?  What seems like a simple task becomes more involved when we realize that WordPress doesn&#8217;t handle creating user roles (and permissions) in a graceful way, when we use custom user tables.  So, if you&#8217;re one of the many that are left wondering why you are getting an error message that says:</p>
<pre class="prettyprint lang-html">You do not have sufficient permissions to access this page</pre>
<p>this video is for you.  By the end of the video, you should have a better understanding of how WordPress deciphers roles and permissions, and what we need to do to help make sure we are getting the final experience that we expect.</p>
<div class="fitvids"><iframe src="http://player.vimeo.com/video/62042591" width="640" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
<h3>Related Links</h3>
<dl>
<dt>WordPress Codex: Editing wp-config.php</dt>
<dd><a href="http://codex.wordpress.org/Editing_wp-config.php" target="_blank">http://codex.wordpress.org/Editing_wp-config.php</a></dd>
<dt>WordPress Plugin: WP-Orphanage Extended</dt>
<dd><a href="http://wordpress.org/extend/plugins/wp-orphanage-extended" target="_blank">http://wordpress.org/extend/plugins/wp-orphanage-extended</a></dd>
</dl>
<p>The post <a href="http://mikemclin.net/single-users-table-multiple-wordpress-sites/">Use a single Users table for multiple WordPress sites</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p><img src="http://feeds.feedburner.com/~r/mikemclin/net/~4/GnnBb4wU7C4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mikemclin.net/single-users-table-multiple-wordpress-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://mikemclin.net/mmwp/wp-content/uploads/2013/03/single-users-table-multiple-wordpress-sites-300x200.png" length="41533" type="image/jpg" /><media:content url="http://mikemclin.net/mmwp/wp-content/uploads/2013/03/single-users-table-multiple-wordpress-sites-300x200.png" width="300" height="200" medium="image" type="image/png" />	<feedburner:origLink>http://mikemclin.net/single-users-table-multiple-wordpress-sites/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=single-users-table-multiple-wordpress-sites</feedburner:origLink></item>
		<item>
		<title>Using the same Mustache templates for PHP and JavaScript</title>
		<link>http://feedproxy.google.com/~r/mikemclin/net/~3/7Q8IwgLtgsU/</link>
		<comments>http://mikemclin.net/mustache-templates-for-php-and-javascript/#comments</comments>
		<pubDate>Wed, 06 Mar 2013 13:07:52 +0000</pubDate>
		<dc:creator>Mike McLin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mustache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[twitter bootstrap]]></category>

		<guid isPermaLink="false">http://mikemclin.net/?p=6</guid>
		<description><![CDATA[<p>In this video, I'll use Mustache templates to create a template for Twitter Bootstrap's alert component and implement the template via PHP and JavaScript.</p><p>The post <a href="http://mikemclin.net/mustache-templates-for-php-and-javascript/">Using the same Mustache templates for PHP and JavaScript</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Mustache templates are great for creating reusable modular HTML templates. In this video, I&#8217;ll create a Mustache template for Twitter Bootstrap&#8217;s alert component. I&#8217;ll go over all of the basics of Mustache, and implement our new template via PHP and JavaScript.</p>
<div class="fitvids"><iframe src="http://player.vimeo.com/video/61172962" width="640" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
<h3>Related Links</h3>
<dl>
<dt>Mustache GitHub Page</dt>
<dd><a href="http://mustache.github.com" target="_blank">http://mustache.github.com</a></dd>
<dt>Twitter Bootstrap</dt>
<dd><a href="http://twitter.github.com/bootstrap" target="_blank">http://twitter.github.com/bootstrap</a></dd>
<dt>Composer</dt>
<dd><a href="http://getcomposer.org" target="_blank">http://getcomposer.org</a></dd>
</dl>
<p>The post <a href="http://mikemclin.net/mustache-templates-for-php-and-javascript/">Using the same Mustache templates for PHP and JavaScript</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p><img src="http://feeds.feedburner.com/~r/mikemclin/net/~4/7Q8IwgLtgsU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mikemclin.net/mustache-templates-for-php-and-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://mikemclin.net/mmwp/wp-content/uploads/2013/03/mustache-templates-for-php-and-javascript1-300x200.png" length="54558" type="image/jpg" /><media:content url="http://mikemclin.net/mmwp/wp-content/uploads/2013/03/mustache-templates-for-php-and-javascript1-300x200.png" width="300" height="200" medium="image" type="image/png" />	<feedburner:origLink>http://mikemclin.net/mustache-templates-for-php-and-javascript/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=mustache-templates-for-php-and-javascript</feedburner:origLink></item>
		<item>
		<title>Fixing error – SCRIPT1028: Expected identifier, string or number</title>
		<link>http://feedproxy.google.com/~r/mikemclin/net/~3/S2JDZ1v6pPU/</link>
		<comments>http://mikemclin.net/fixing-error-script1028-expected-identifier-string-or-number/#comments</comments>
		<pubDate>Sat, 23 Feb 2013 03:54:27 +0000</pubDate>
		<dc:creator>Mike McLin</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://mikemclin.net/?p=4</guid>
		<description><![CDATA[<p>How to fix: SCRIPT1028: Expected identifier, string or number JavaScript error in earlier versions of Internet Explorer.</p><p>The post <a href="http://mikemclin.net/fixing-error-script1028-expected-identifier-string-or-number/">Fixing error &#8211; SCRIPT1028: Expected identifier, string or number</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>There are 2 common ways to trigger the <strong>SCRIPT1028: Expected identifier, string or number</strong> JavaScript error in earlier versions of Internet Explorer. The first way is to include a trailing comma after your last property in a JavaScript object. The other common trigger is using a JavaScript reserved word as a property name. I&#8217;ll show you examples of both, and how to work around some of these limitations.</p>
<div class="fitvids"><iframe src="http://player.vimeo.com/video/60302830" width="640" height="360" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
<h3>Example #1: Trailing Comma</h3>
<p>You&#8217;ll notice in this example, we leave a comma after the <code>'Login Successful'</code> value.  This will trigger the <code>SCRIPT1028: Expected identifier, string or number</code> error in Internet Explorer 7 and below.</p>
<pre class="prettyprint">
var message = {
    title: &#39;Login Unsuccessful&#39;,
};
</pre>
<h3>Example #2: Using a JavaScript Reserved Word</h3>
<p>In this example, we assign a property named <code>class</code> to our JavaScript object.  Class is a reserved word, and cannot be used as an identifier.</p>
<pre class="prettyprint">
var message = {
    class: &#39;error&#39;
};
</pre>
<h3>The Solution</h3>
<p>The solution is to pass the <code>class</code> property value as a string. You will need to use bracket notation, however, to call the property in your script.</p>
<pre class="prettyprint">
var message = {
    title: &#39;Login Unsuccessful&#39;,
    text: &#39;Please check your username or password&#39;,
    &#39;class&#39;: &#39;error&#39;
};

console.log(message.title);
console.log(message&#91;&#39;class&#39;&#93;);
</pre>
<h3>Related Links</h3>
<dl>
<dt>MDN | Reserved Words &#8211; JavaScript</dt>
<dd><a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Reserved_Words" title="MDN | Reserved Words - JavaScript" target="_blank">https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Reserved_Words</a></dd>
</dl>
<p>The post <a href="http://mikemclin.net/fixing-error-script1028-expected-identifier-string-or-number/">Fixing error &#8211; SCRIPT1028: Expected identifier, string or number</a> appeared first on <a href="http://mikemclin.net">Mike McLin</a>.</p><img src="http://feeds.feedburner.com/~r/mikemclin/net/~4/S2JDZ1v6pPU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://mikemclin.net/fixing-error-script1028-expected-identifier-string-or-number/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<enclosure url="http://mikemclin.net/mmwp/wp-content/uploads/2013/02/script1028-expected-identifier-300x200.png" length="36141" type="image/jpg" /><media:content url="http://mikemclin.net/mmwp/wp-content/uploads/2013/02/script1028-expected-identifier-300x200.png" width="300" height="200" medium="image" type="image/png" />	<feedburner:origLink>http://mikemclin.net/fixing-error-script1028-expected-identifier-string-or-number/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=fixing-error-script1028-expected-identifier-string-or-number</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 2.931 seconds. --><!-- Cached page generated by WP-Super-Cache on 2013-05-14 06:48:40 -->
