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
| var async = require('async'); | |
| var y = async.map([1,2,3], | |
| function(x, fn) { | |
| fn(null, x * 10); | |
| }, | |
| function(err, y) { | |
| console.log(y); | |
| }); |
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
| <!-- doesn't work --> | |
| <script type="text/javascript" src="/angular/angular.js"></script> | |
| <script type="text/javascript" src="/jquery/jquery.js"></script> | |
| <script type="text/javascript" src="/ngUpload/ng-upload.js"></script> | |
| <!-- work --> | |
| <script type="text/javascript" src="/jquery/jquery.js"></script> | |
| <script type="text/javascript" src="/angular/angular.js"></script> | |
| <script type="text/javascript" src="/ngUpload/ng-upload.js"></script> |
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
| fucntion createDog(name, owner) { | |
| var dog = { | |
| name: name, | |
| owner: owner, | |
| init: function() { | |
| var me = $('<button>').addClass('dog').append(this.name).click(this.bark); | |
| $('#animals').append(me); | |
| }, | |
| bark: function() { | |
| alert(this.name + ': Bark bark. I love you, ' + this.owner + '. Bark!'); |
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
| 'use scrict'; | |
| angular.module('mod1') | |
| .controller('LoginCtrl', function($scope, $http, authService) { | |
| $http.defaults.withCredentials = true; | |
| $scope.submit = function() { | |
| $scope.login_status = "Logging in"; | |
| loginInfo = {username: $scope.username, password: $scope.password} | |
| $http({ignoreAuthModule: true, method: "POST", url: "/user/login", data:loginInfo}) | |
| .success(function(data, status, header) { |
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
| post "/textunit/save" do | |
| JSON.parse(request.body.read, :max_nesting => 200) | |
| ... | |
| end |
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
| var audio = document.createElement('audio'); | |
| audio.setAttribute("controls", true); | |
| audio.setAttribute("autoplay", true); | |
| var url = "http://..........ogg"; | |
| if(url === "" || audio.canPlayType("audio/ogg").replace(/^no$/, "") === "") { | |
| url = "http://..........mp3"; | |
| } | |
| audio.setAttribute("src", url); |
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
| "use strict"; | |
| describe('BangbutHttp', function(){ | |
| var http; | |
| var requests; | |
| var xhr; | |
| var realFormData; | |
| before(function () { | |
| xhr = sinon.useFakeXMLHttpRequest(); | |
| requests = []; | |
| xhr.onCreate = function (req) { |
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 ( | |
| "encoding/json" | |
| "fmt" | |
| "github.com/hoisie/web" | |
| "github.com/mattn/go-session-manager" | |
| "log" | |
| "os" | |
| "labix.org/v2/mgo" |
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 ( | |
| "crypto/rand" | |
| "crypto/sha1" | |
| "code.google.com/p/go.crypto/pbkdf2" | |
| "bytes" | |
| "labix.org/v2/mgo" | |
| "labix.org/v2/mgo/bson" | |
| ) |
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
| if (!services.paramKeys.all(function(k) { | |
| return params[k] !== undefined; | |
| })) { | |
| res.writeHead(500, {"Content-Type": "text/plain"}); | |
| res.end("Invalid parameter"); | |
| return; | |
| } |