Code Editor - Code Mirror

Code Editor - Basic example

CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with a number of language modes and addons that implement more advanced editing functionality.

x
 
1
<script>
2
    // Code goes here
3
4
    // For demo purpose - animation css script
5
    function animationHover(element, animation) {
6
        element = $(element);
7
        element.hover(
8
            function () {
9
                element.addClass('animated ' + animation);
10
            },
11
            function () {
12
                //wait for animation to finish before removing classes
13
                window.setTimeout(function () {
14
                    element.removeClass('animated ' + animation);
15
                }, 2000);
16
            });
17
    }
18
</script>
19
                    
Code Editor - Theme Example

A rich programming API and a CSS theming system are available for customizing CodeMirror to fit your application, and extending it with new functionality. For mor info go to http://codemirror.net/

28
 
1
<script>
2
    var SpeechApp = angular.module('SpeechApp', []);
3
4
    function VoiceCtrl($scope) {
5
6
        $scope.said = '...';
7
8
        $scope.helloWorld = function () {
9
            $scope.said = "Hello world!";
10
        }
11
12
        $scope.commands = {
13
            'hello (world)': function () {
14
                if (typeof console !== "undefined") console.log('hello world!')
15
                $scope.$apply($scope.helloWorld);
16
            },
17
            'hey': function () {
18
                if (typeof console !== "undefined") console.log('hey!')
19
                $scope.$apply($scope.helloWorld);
20
            }
21
        };
22
23
        annyang.debug();
24
        annyang.init($scope.commands);
25
        annyang.start();
26
    }
27
</script>
28