That's one way to do this, on Spring side
@PostMapping("api/user")
public Response theAction(@RequestBody List<User> users)on the javascript side,
That's one way to do this, on Spring side
@PostMapping("api/user")
public Response theAction(@RequestBody List<User> users)on the javascript side,
| // ==UserScript== | |
| // @name New Userscript | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://app.meiqia.com/chat/* | |
| // @grant none | |
| // ==/UserScript== | |
| /* jshint -W097 */ |
| 1. overflow: hidden only works on positioned elements. | |
| 2. display: inline-block; hack: | |
| display: inline-block; | |
| *display: inline; | |
| *zoom: 1; | |
| 3. IE 7 float: right; drop to new line: | |
| Try to small change markup: place items with a float before items without it (from the same row). It should help. |
| function render(template, vars) | |
| { | |
| for (var v in vars) | |
| { | |
| var pattern = '{{' + v + '}}'; | |
| template = template.replace(new RegExp(pattern, 'gi'), vars[v]); | |
| } | |
| return template; | |
| }; |
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
});| @echo off | |
| pushd . | |
| cd %~dp0 | |
| cd "app" | |
| set BIN_TARGET=%CD%\console | |
| popd | |
| php "%BIN_TARGET%" %* |
| source :rubygems | |
| # We are not loading Active Record, nor Active Resources etc. | |
| # We can do this in any app by simply replacing the rails gem | |
| # by the parts we want to use. | |
| gem "actionpack", "~> 3.2" | |
| gem "railties", "~> 3.2" | |
| gem "tzinfo" | |
| # Let's use thin |
| The data returned from an API should have a similar structure like the following: | |
| Success: | |
| {status: 1, data: [A collection of data]} | |
| Error: | |
| {status: 0, error: { code: 1, message: 'critical error' }} | |
| And the data returned must always have a consistent structure, for example, an image API | |
| should always return a data structure like this: {title: A fancy image, link: http://www.example.com}, |
| javascript: | |
| (function (window, document) | |
| { | |
| var rLeftTrim = /^\s+/; | |
| var rRightTrim = /\s+$/; | |
| var prom = prompt('Please input order number'); | |
| var cleaned = prom.replace(rLeftTrim, '').replace(rRightTrim, ''); | |
| function getElementPosition(element) | |
| { | |
| var x = element.offsetLeft; | |
| var y = element.offsetTop; | |
| var parent = element; | |
| while (parent = parent.offsetParent) | |
| { | |
| x += parent.offsetLeft; |