Tag: javascript

Npm Scripts vs Task Runners

Static image January 5, 2016 There were some posts a while back that talked about using npm scripts to handle most of your mundane tasks over using a task manager. I only recently got around to diving into this concept and wanted to share some of my discoveries.Why use task runners at all?This is an easy one. In development, there are things that have to get run and rerun constantly. Make a change to your javascript? Recompile (if you’re using webpack, browserify, babel, etc.). Make a change to your sass/less? Recompile. Want to release your code? Bundle, minify, copy assets, distribute. Lint your code? Run eslint or jshint or jscs.For example, to compile some code via webpack for development could look like webpack -d --progress --colors. Granted, it could be just webpack -d but I like the extra niceties. More realistically, you might have multiple…

Unit Testing a JavaScript app

March 30, 2015 Our Dovetail Agent and Dovetail SelfService products are both very JavaScript-heavy applications. And we have quite a suite of automated tests we run as part of our development process. Barrett Sonntag (one of our developers here at Dovetail) has written a nice post that details Unit Testing a JavaScript app using RequireJS with Mocha, PhantomJS, Chai & SinonJS. Unit testing is something every developer agrees should be done, but often doesn’t do. Setting it up isn’t hard after reading and evaluating what feels like a 7 course meal of modules that need to come together hand in hand to allow you to write some tests. It is fairly easy after you’ve learned more than you ever wanted to know about unit testing. Not easy at all, so I’m going to distill a stack down here for you. This is just…

Markdown parser extensions

March 3, 2015 I’ve written recently about how we’re using Markdown for rich text on our solutions.  Under the hood, we’re using the Remarkable library. Barrett Sonntag, one of our developers here at Dovetail, has written an excellent post on writing custom extensions for the Remarkable JavaScript Markdown parser. He includes details on extending the parser to add images to a lightbox – which we use in Dovetail Agent and in Dovetail SelfService. As he says: There were no clear examples on how to create new plugins or extensions for Remarkable though. So having worked on creating some and having a measure of success it is time to share the knowledge. I love seeing our knowledge being shared – through blogs, solutions, code samples, etc. Great stuff Barrett!

Using the URL Rewrite module to set your cookies to HttpOnly

January 20, 2011 A question recently arose about how to set a cookie to be HttpOnly. An HttpOnly cookie is one that cannot be accessed through client-side script. Any information contained in an HTTP-only cookie is less likely to be disclosed to a hacker or a malicious Web site. The use of HTTP-only cookies is one of several techniques that, when used together, can mitigate the risk of cross-site scripting. Setting a cookie to be HttpOnly One way to set a cookie to be HttpOnly is to change how you define it. Rather than something like this: Response.Cookies("mycookie") = “foo”; We can do this: Response.AddHeader "Set-Cookie", "mycookie=foo; HttpOnly" Pretty simple. What about cookies you don’t create yourself? This works great for cookies that you create yourself. But what about those that are created by IIS and ASP, such as the ASPSESSION cookie? One…

jQuery Rocks! – Selecting all of the text from a table column

January 11, 2011 On occasion it is nice to be able to select and copy the contents of a column from a table element. Using jQuery, this is a simple task that takes advantage of the following jQuery features:   Event Handling - for the double-click of the column header Selectors - to determine which DOM elements to process Traversing - start from a TH that is double-clicked and find which column of the table it represents, then find all of the column TDs Iteration - process each of the TDs in a column Attributes - get the text for each TD, and change the TD's Class   With a standard-format table, it is easy to add an event handler to the header TH element. Click here to view a simple example of a such a table. It has a header and a body, and has…

Advanced Business Rules (Part 2) webinar follow-up

July 29, 2010 Big thanks to those that attended today’s webinar on Rulemanager and Advanced Business Rules We had a good turnout, and some really good participation from attendees. Slides The slides from today’s presentation are available on Slideshare.   Links Rulemanager Wiki: Send SMS message from Rulemanager using Twilio: Ideas for Future Webinars? Have an idea for a future webinar? Something you’d like to see or learn more about? Leave a comment here or drop me an email: gary [at] dovetailsoftware [dot] com

I love jQuery like this:

August 5, 2009 I love jQuery like this: $(".question").click(function(){ $(this).next(".answer").toggle(); }); When you click on a question, show the next answer. When you click on the question again, hide the answer. And my markup stays clean: <p class="question">Does this cost anything?</p> <p class="answer">No, bodybuggTweet is absolutely free.</p> That pleases me.

Hiding Empty Queues in Dovetail Agent

August 3, 2009 I was recently at a customer site, and while sitting down with one of their agents, noticed that this agent belonged to over 100 queues. Because of this, the left column of the console within DovetailAgent, which shows all of the queues, had a scrollbar that seemed to scroll forever. One of the features I like about Dovetail Mobile is that it only shows the queues that have stuff in them. I immediately said: why don't we do a similar thing within DovetailAgent? And because we have more screen real estate to work with on a desktop (as opposed to the limited screen real estate on a mobile device), I thought about allowing the empty queues to be toggled on and off. Easy enough to do. Here's what I ended up with. (I'm showing the end result with pictures first,…

SMS notifications and alerts

April 6, 2009 Notifications and escalations generated by Rulemanager are an integral component of the Clarify/Dovetail system. Traditionally, email and in-application notifications are the most common notification delivery mechanisms. Digital pagers were popular years ago, but are pretty much non-existent today.   With mobile devices (iPhones, Windows Mobile, BlackBerrys, etc.) becoming almost ubiquitous, we can look to using these devices for notification delivery. And they all share a common communication platform - SMS. SMS (Short Message Service) is commonly referred to as text messaging.   So let's look at how we can use SMS as a delivery mechanism.   A while back, I detailed how to use Twitter as a notification channel, and then use Twitter to send SMS messages.   If we don't want to be coupled to a service like Twitter (which doesn't have guaranteed delivery, SLAs, etc.), we can use a very similar process, but instead…

45+ New jQuery Techniques For Good User Experience

January 19, 2009 Smashing Magazine has a list of 45+ New jQuery Techniques For Good User Experience There's some cool ideas in there. The sortable lists technique would be useful for Drop-Down list management in DovetailAdmin. I also like the Scrollable HTML table plugin - which keeps the header row visible when scrolling through a long table.
    class='wp-pagenavi' role='navigation'>
  • 1
  • 2
  • 3