SELECT
concat('<a target="_new" href=%%WWWROOT%%/course/view.php?id=',c.id,'">',c.fullname,'</a>') AS Course
,c.shortname,r.name
,(SELECT CONCAT(u.firstname,' ', u.lastname) AS Teacher
FROM prefix_role_assignments AS ra
JOIN prefix_context AS ctx ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid
WHERE ra.roleid = 3 AND ctx.instanceid = c.id LIMIT 1) AS Teacher
,concat('<a target="_new" href="%%WWWROOT%%/mod/resource/view.php?id=',r.id,'">',r.name,'</a>') AS Resource
FROM prefix_resource AS r
JOIN prefix_course AS c ON r.course = c.id
WHERE r.reference LIKE 'https://stackoverflow.com/%'
<h2>Example 1</h2>
<h3>block-div-margin</h3>
<div class="container">
<div class="box">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas, nobis.</div>
<div class="block-div-margin"></div>
<div class="box">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque, delectus!</div>
<div class="block-div-margin"></div>
<div class="box">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, quasi.</div>
<div class="block-div-margin"></div>
<div class="box">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro, id!</div>
</div>
<h3>inline-block-div-margin</h3>
<div class="container">
<div class="box">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas, nobis.</div>
<div class="inline-block-div-margin"></div>
<div class="box">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Doloremque, delectus!</div>
<div class="inline-block-div-margin"></div>
<div class="box">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur, quasi.</div>
<div class="inline-block-div-margin"></div>
<div class="box">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro, id!</div>
</div>
<h2>Example 2</h2>
<h3>This is more common issue that I see ever</h3>
<div class="my-div">
This is my-div content
</div>
<div class="my-other-div">
<div class="my-other-div-content">
This is my-other-div-content
</div>
</div>
<h3>With div inline-block</h3>
<div class="my-div">
This is my-div content
</div>
<div class="my-other-div my-div-inline-block">
<div class="my-other-div-content">
This is my-other-div-content
</div>
</div>
Run code snippet
window.onload = function(){
//We use window.onload to check the window has loaded so we can target DOM elements
var namesArray = ["lars", "bo", "ib", "peter", "jan", "frederik"];
var list = namesArray.map(name=>"<li>"+name+"</li>");
var listAsStr ="<ul>" + list.join("") + "<ul>";
document.getElementById("list").innerHTML = listAsStr;
}
<div index="0" aria-busy="false" aria-checked="false" aria-disabled="false" data-head="true" aria-label="09251561001.09251561001.1.31873860875, folder" aria-selected="false" class="option grid-row" role="option" id=":DOMLT_ELISYS:export:09251561001.09251561001.1.31873860875"><div class="name-data icon folder" id="id1027"><div class="progressbar" role="progressbar" aria-hidden="true" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"><div class="fill" role="presentation" style="width: 0%;"></div><div class="fill" role="presentation" style="width: 0%;"></div></div><a class="name-text" href="#"><span>09251561001.09251561001.1.31873860875</span></a></div><div id="cellId1028" class="date-data"></div><div id="cellId1029" class="size-data"></div></div>
.box {
border: 1px solid #500;
}
.block-div-margin {
margin: 10px 0;
display: block;
/*default div state*/
}
.inline-block-div-margin {
display: inline-block;
margin: 10px 0;
}
.my-div {
padding: 20px;
background: #EAEAEA;
border-bottom: 1px solid #999;
}
.my-other-div {
background: #D3E1E1;
padding: 0 20px 20px 20px;
}
.my-other-div-content {
margin-top: 20px;
}
.my-div-inline-block {
display: inline-block;
width: 100%;
box-sizing: border-box;
}
void Main()
{
var s = new StringBuilder();
s.Append("Id,Name\r\n");
s.Append("1,one\r\n");
var config = new CsvConfiguration(CultureInfo.InvariantCulture)
{
};
using (var reader = new StringReader(s.ToString()))
using (var csv = new CsvReader(reader, config))
{
csv.Context.RegisterClassMap<FooMap>();
csv.GetRecords<Foo>().ToList().Dump();
}
}
private class Foo
{
public int Id { get; set; }
public string Name { get; set; }
public string RawRow { get; set; }
}
private class FooMap : ClassMap<Foo>
{
public FooMap()
{
Map(m => m.Id);
Map(m => m.Name);
Map(m => m.RawRow).Convert(args => args.Row.Parser.RawRecord);
}
}
class App extends React.Component {
constructor (props) {
super(props);
this.state = {
limits: {
min: 1,
max: 100,
},
value: 50,
};
}
componentDidMount() {
this.setPositionRunner();
this.input.value = this.cutValue(this.input.value);
}
getPositionCenterRunnerX () {
let positionEvent = this.event.pageX - this.rangeElem.offsetLeft;
let newPositionEvent = positionEvent < 0 ? 0 : positionEvent;
return positionEvent > this.rangeElem.offsetWidth ? this.rangeElem.offsetWidth : newPositionEvent;
}
getLeft () {
let halfRunner = this.runner.offsetWidth / 2;
let left = this.event.pageX - this.rangeElem.offsetLeft - halfRunner;
let max = this.rangeElem.offsetWidth - halfRunner;
let newLeft = left < -halfRunner ? -halfRunner : left;
return left > max ? max : newLeft;
}
getValue() {
return Math.round(this.getPositionCenterRunnerX() / this.rangeElem.offsetWidth * (this.state.limits.max - this.state.limits.min) + this.state.limits.min);
}
setPositionRunner () {
let halfRunner = this.runner.offsetWidth / 2;
let positionCenter = Math.round((this.cutValue(this.state.value) - this.state.limits.min) / (this.state.limits.max - this.state.limits.min) * this.rangeElem.offsetWidth);
let left = positionCenter - halfRunner;
this.runner.style.left = `${left}px`;
}
moveRunner (event) {
this.event = event;
this.runner.style.left = `${this.getLeft()}px`;
let value = this.getValue();
this.setState({value});
}
onClick (event) {
this.moveRunner(event);
document.onmousemove = (event) => {
this.moveRunner(event);
};
document.onmouseup = () => {document.onmousemove = null;}
}
cutValue(value) {
value = value > this.state.limits.max ? this.state.limits.max : value;
value = value < this.state.limits.min ? this.state.limits.min : value;
return value;
}
onChangeInput (event) {
let value = event.currentTarget.value.match(/\d*/g).join('');
this.setState({value});
clearTimeout(this.timeOut);
this.timeOut = setTimeout(() => {
value = this.cutValue(value);
this.setState({value});
this.setPositionRunner();
}, 1000);
}
render () {
return (
<div className="slider">
<div
ref={element => this.rangeElem = element}
onClick={event => {this.onClick (event)}}
className="slider__range"
>
<div className="slider__runner" ref={element => this.runner = element} />
</div>
<div className="slider__view">
<p className="slider__limit">от {this.state.limits.min}</p>
<input
ref={element => this.input = element}
onChange={this.onChangeInput.bind(this)}
type="text"
className="slider__value"
value={this.state.value}
/>
<p className="slider__limit">до {this.state.limits.max}</p>
</div>
</div>
);
}
}
ReactDOM.render(
<App/>,
document.getElementById('root')
);