我正在创建一个传单地图组件,这是一个关于plunker的例子
http://plnkr.co/edit/LkghwOcby49XESdGb782?p=preview
这是代码
leaflet.jsx
/** @jsx React.DOM */
/*jshint indent: 2, node: true, nomen: true, browser: true*/
/*global React */
'use strict';
module.exports = React.createClass({
getInitialState: function () {
return {
map: {}
};
},
componentDidMount: function() {
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
this.setState({map: map});
},
modifyMap: function (method, options) {
this.setState({
map : this.state.map[method](options.latLong, options.zoom, options.zoom_options)
});
},
render: function () {
return (
/* jshint ignore:start */
<div id="map"></div> …Run Code Online (Sandbox Code Playgroud) 我试图用go来解析一个yaml文件.问题是yaml文件中的键可能并不总是相同.这是为了进行API版本控制,因此用户可以定义它们支持的版本.例如V1,V2,V3等.它们不需要按顺序排列,可以省略不支持IE V0,V2,V5等的版本.
package main
import (
"fmt"
"gopkg.in/yaml.v2"
)
var data = `
---
development:
skip-header-validation: true
V1:
current: "1.0.0"
mime_types:
- application/vnd.company.jk.identity+json;
- application/vnd.company.jk.user+json;
- application/vnd.company.jk.role+json;
- application/vnd.company.jk.scope+json;
- application/vnd.company.jk.test+json;
skip-mime-type-validation: true
skip-version-validation: true
V2:
current: "2.0.0"
mime_types:
- application/vnd.company.jk.identity+json;
- application/vnd.company.jk.user+json;
- application/vnd.company.jk.role+json;
- application/vnd.company.jk.scope+json;
- application/vnd.company.jk.test+json;
`
type MajorVersion struct {
Current string `yaml:"current"`
MimeTypes []string `yaml:"mime_types"`
SkipVersionValidation bool `yaml:"skip-version-validation"`
SkipMimeTypeValidation bool `yaml:"skip-mime-type-validation"`
}
type Environment struct {
SkipHeaderValidation bool `yaml:"skip-header-validation"`
Version map[string]MajorVersion
}
func main() { …Run Code Online (Sandbox Code Playgroud) 关于nodejs的Timers的文档说setTimeout将返回timeoutId http://nodejs.org/api/timers.html#timers_cleartimeout_timeoutid
当我在web broswer中使用javascript时,我得到一个整数作为返回值.
var b = setTimeout(function(){console.log("Taco Bell")})
// b = 20088
Run Code Online (Sandbox Code Playgroud)
当我使用节点并做同样的事情时,返回是
var b = setTimeout(function(){console.log("Taco Bell")})
// { _idleTimeout: 60000,
// _idlePrev:
// { _idleNext: [Circular],
// _idlePrev: [Circular],
// ontimeout: [Function] },
// _idleNext:
// { _idleNext: [Circular],
// _idlePrev: [Circular],
// ontimeout: [Function] },
// _onTimeout: [Function],
// _idleStart: Wed Jan 30 2013 08:23:39 GMT-0800 (PST) }
Run Code Online (Sandbox Code Playgroud)
我想要做的是将setTimeout整数存储到redis中,然后再将其清除.所以我尝试做这样的事情
var redis = require('redis');
var redisClient = redis.createClient();
var delay = setTimeout(function(){console.log("hey")}, 20000);
var envelope = { …Run Code Online (Sandbox Code Playgroud) 在java中你可以做这样的事情,包括java命名空间下的所有包.
import java.*;
Run Code Online (Sandbox Code Playgroud)
在https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby
他们建议使用include_package或import.我也试过java_package和java_import.有没有办法像这样导入,或者你只需要你需要的pacakges.