django-knockout

django-knockout makes it super easy to use knockout.js with your Django models. It’s great for project with objects that have lots of different models, or models with lots of different fields, or both. It can be used in both prototyping complex applications and directly in the templates of simple ones. Supports forms and formsets via Knockout pre-rendered. Supports Django Rest Framework and jQuery by default, but these can be disabled.

Unit Test Your JavaScript Using Mocha and Chai

Have you ever made some changes to your code, and later found it caused something else to break?

I’m sure most of us have. This is almost inevitable, especially when you have a larger amount of code. One thing depends on another, and then changing it breaks something else as a result.

.. But what if that didn’t happen? What if you had a way of knowing when something breaks as a result of some change? That would be pretty great. You could modify your code without having to worry about breaking anything, you’d have fewer bugs and you’d spend less time debugging.

That’s where unit tests shine. They will automatically detect any problems in the code for you. Make a change, run your tests and if anything breaks, you’ll immediately know what happened, where the problem is and what the correct behavior should be. This completely eliminates any guesswork!

Vue.js

At the core of Vue.js is a system that enables us to declaratively render data to the DOM using straightforward template syntax:

<div id=“app”>
{{ message }}
</div>
var app = new Vue({
el: ‘#app’,
data: {
message: ‘Hello Vue!’
}
})
Hello Vue!

Quick Tip: Accessing The Clipboard With JavaScript

In this article we’re going to show you how to use simple vanilla JavaScript snippets to:

  1. Add text to the clipboard on user action, such as the press of a button.
  2. Modify the content of the clipboard when a user copies something.

The APIs we will be using don’t require any external libraries, and have almost perfect browser compatibility!

.. To make this happen we will need to use a cool JavaScript method called <a href="https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand" target="_blank">execCommand()</a>. It allows us to invoke a number of different events that manipulate editable content such as making text bold/italic, doing undo/redo, and also copy/cut/paste.

<span class="hljs-built_in">document</span>.execCommand(<span class="hljs-string">'copy'</span>);