This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ( | |
| "net/http" | |
| "net/http/httputil" | |
| "net/url" | |
| "fmt" | |
| ) | |
| func main() { | |
| // New functionality written in Go | |
| http.HandleFunc("/new", func(w http.ResponseWriter, r *http.Request) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "definitions": { | |
| "nameMixin": { | |
| "type": "object", | |
| "properties": { | |
| "nameFirst": {"type": "string"}, | |
| "nameLast": {"type": "string"} | |
| }, | |
| "required": ["nameFirst", "nameLast"] | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| For this schema, each object's relationships are defined as an object under | |
| a "links" property. | |
| Each property of that object is the name of the relationship, and the value | |
| is a single object with the "type" and "id" of the related object. | |
| For "to-many" relationships, the value can be an array of the same objects. | |
| */ | |
| var data = { | |
| "articles": [{ | |
| "id": "article1", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "github.com/gopherjs/gopherjs/js" | |
| "github.com/rolaveric/pet" | |
| ) | |
| func main() { | |
| js.Global.Set("pet", map[string]interface{}{ | |
| "New": pet.New, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ES6 Class | |
| class MyClass { | |
| constructor() { | |
| this.a = "b"; | |
| } | |
| getA() { | |
| return this.a; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div ng-app=""> | |
| <input type="text" ng-model="message"/> | |
| {{message}} | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('Attaches the scope to itself', inject(function ($controller) { | |
| var fakeScope = {}; | |
| var ctrl = $controller('MyCtrl', "$scope": fakeScope}); | |
| expect(ctrl.scope).toBe(fakeScope); | |
| })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <input type="text" id="messageInput"/> | |
| <span id="messageOutput"></span> | |
| <script type="text/javascript"> | |
| (function () { | |
| var input = document.getElementById('messageInput'); | |
| var output = document.getElementById('messageOutput'); | |
| input.addEventListener('change', function () { | |
| output.innerHTML = input.value; | |
| }); | |
| })(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('Capitalises strings', inject(function (capitaliseFilter) { | |
| expect(capitaliseFilter('abcd')).toEqual('Abcd'); | |
| })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it('Capitalises strings', inject(function ($filter) { | |
| expect($filter('capitalise')('abcd')).toEqual('Abcd'); | |
| })); |
NewerOlder