Tutorial by Examples: cs

CSS body { counter-reset: item-counter; /* create the counter */ } .item { counter-increment: item-counter; /* increment the counter every time an element with class "item" is encountered */ } .item-header:before { content: counter(item-counter) ". "; /* print the v...
A basic User Schema: var mongoose = require('mongoose'); var userSchema = new mongoose.Schema({ name: String, password: String, age: Number, created: {type: Date, default: Date.now} }); var User = mongoose.model('User', userSchema); Schema Types.
CSS ul { list-style: none; counter-reset: list-item-number; /* self nesting counter as name is same for all levels */ } li { counter-increment: list-item-number; } li:before { content: counters(list-item-number, ".") " "; /* usage of counters() function means val...
Thread synchronization can be accomplished using mutexes, among other synchronization primitives. There are several mutex types provided by the standard library, but the simplest is std::mutex. To lock a mutex, you construct a lock on it. The simplest lock type is std::lock_guard: std::mutex m; vo...
Prerequisites The Windows version of Elasticsearch can be obtained from this link: https://www.elastic.co/downloads/elasticsearch. The latest stable release is always at the top. As we are installing on Windows, we need the .ZIP archive. Click the link in the Downloads: section and save the file t...
import os import glob import pandas as pd def get_merged_csv(flist, **kwargs): return pd.concat([pd.read_csv(f, **kwargs) for f in flist], ignore_index=True) path = 'C:/Users/csvfiles' fmask = os.path.join(path, '*mask*.csv') df = get_merged_csv(glob.glob(fmask), index_col=None, use...
Setting only one style: $('#target-element').css('color', '#000000'); Setting multiple styles at the same time: $('#target-element').css({ 'color': '#000000', 'font-size': '12pt', 'float': 'left', });
To get an element's CSS property you can use the .css(propertyName) method: var color = $('#element').css('color'); var fontSize = $('#element').css('font-size');
Unlike other middleware functions error-handling middleware functions have four arguments instead of three: (err, req, res, next). Sample: app.use(function(err, req, res, next) { console.error(err.stack); res.status(500).send('Error found!'); });
A Closure is a function taken together with an environment. The function is typically an anonymous function defined inside another function. The environment is the lexical scope of the enclosing function (very basic idea of a lexical scope of a function would be the scope that exists between the fun...
Symbol is a new primitive type in ES6. Symbols are used mainly as property keys, and one of its main characteristics is that they are unique, even if they have the same description. This means they will never have a name clash with any other property key that is a symbol or string. const MY_PROP_KE...
CSS styles for the credits label. Defaults to: credits: { style: { cursor: 'pointer', color: '#909090', fontSize: '10px' } },
A defer statement in Go is simply a function call marked to be executed at a later time. Defer statement is an ordinary function call prefixed by the keyword defer. defer someFunction() A deferred function is executed once the function that contains the defer statement returns. Actual call to th...
final TextView mTextView = (TextView) findViewById(R.id.text); ... // Instantiate the RequestQueue. RequestQueue queue = Volley.newRequestQueue(this); String url ="http://www.google.com"; // Request a string response from the provided URL. StringRequest stringRequest = new String...
This function casts a ray from point origin in direction direction of length maxDistance against all colliders in the scene. The function takes in the origin direction maxDistance and calculate if there is a collider in front of the GameObject. Physics.Raycast(origin, direction, maxDistance); F...
rvest is a package for web scraping and parsing by Hadley Wickham inspired by Python's Beautiful Soup. It leverages Hadley's xml2 package's libxml2 bindings for HTML parsing. As part of the tidyverse, rvest is piped. It uses xml2::read_html to scrape the HTML of a webpage, which can then be sub...
Panels can have sections, sections can have settings, and settings can have controls. Settings are saved in the database, while the controls for particular settings are only used to display their corresponding setting to the user. This code creates a basic section in the panel from above. Inside a...
Pure JavaScript It's possible to add, remove or change CSS property values with JavaScript through an element's style property. var el = document.getElementById("element"); el.style.opacity = 0.5; el.style.fontFamily = 'sans-serif'; Note that style properties are named in lower came...
Placeholders allow you to feed values into a tensorflow graph. Aditionally They allow you to specify constraints regarding the dimensions and data type of the values being fed in. As such they are useful when creating a neural network to feed new training examples. The following example declares a ...
You can use raycasts to check if an ai can walk without falling off the edge of a level. using UnityEngine; public class Physics2dRaycast: MonoBehaviour { public LayerMask LineOfSightMask; void FixedUpdate() { RaycastHit2D hit = Physics2D.Raycas...

Page 7 of 24