The @import CSS at-rule is used to import style rules from other style sheets. These rules must precede all other types of rules, except @charset rules; as it is not a nested statement, @import cannot be used inside conditional group at-rules.
@import.
How to use @import
You can use @import rule ...
To generate a controller (for example Posts), navigate to your project directory from a command line or terminal, and run:
$ rails generate controller Posts
You can shorten this code by replacing generate with g, for example:
$ rails g controller Posts
If you open up the newly generated app/...
Python uses indentation to define control and loop constructs. This contributes to Python's readability, however, it requires the programmer to pay close attention to the use of whitespace. Thus, editor miscalibration could result in code that behaves in unexpected ways.
Python uses the colon symbo...
docker rm can be used to remove a specific containers like this:
docker rm <container name or id>
To remove all containers you can use this expression:
docker rm $(docker ps -qa)
By default docker will not delete a container that is running. Any container that is running will produce a...
Browsers have a default set of CSS styles they use for rendering elements. Some of these styles can even be customised using the browser's settings to change default font face and size definitions, for example. The styles contain the definition of which elements are supposed to be block-level or inl...
execute the following command to insert the text into a view with a focus (if it supports text input)
6.0
Send text on SDK 23+
adb shell "input keyboard text 'Paste text on Android Device'"
If already connected to your device via adb:
input text 'Paste text on Android Device'
6...
Prints all packages, optionally only those whose package name contains the text in <FILTER>.
adb shell pm list packages [options] <FILTER>
All <FILTER>
adb shell pm list packages
Attributes:
-f to see their associated file.
-i See the installer for the packages.
-u to ...
Declaring a variable const only prevents its value from being replaced by a new value. const does not put any restrictions on the internal state of an object. The following example shows that a value of a property of a const object can be changed, and even new properties can be added, because the ob...
You can initialize a constant by using the const keyword.
const foo = 100;
const bar = false;
const person = { name: "John" };
const fun = function () = { /* ... */ };
const arrowFun = () => /* ... */ ;
Important
You must declare and initialize a constant in the same statement....
General syntax
git push <remotename> <object>:<remotebranchname>
Example
git push origin master:wip-yourname
Will push your master branch to the wip-yourname branch of origin (most of the time, the repository you cloned from).
Delete remote branch
Deleting the remote br...
This command print all relevant application data:
version code
version name
granted permissions (Android API 23+)
etc..
adb shell dumpsys package <your.package.id>
It is common to want two views to be side by side, centered in their superview. The common answer given on Stack Overflow is to embed these two views in a UIView and center the UIView. This is not necessary or recommended. From the UILayoutGuide docs:
There are a number of costs associated with...
In all versions of Python, we can represent infinity and NaN ("not a number") as follows:
pos_inf = float('inf') # positive infinity
neg_inf = float('-inf') # negative infinity
not_a_num = float('nan') # NaN ("not a number")
In Python 3.5 and higher, we can also us...
Python supports using a for loop directly on a list:
my_list = ['foo', 'bar', 'baz']
for item in my_list:
print(item)
# Output: foo
# Output: bar
# Output: baz
You can also get the position of each item at the same time:
for (index, item) in enumerate(my_list):
print('The item i...
This code can be added to any event like a listener, button, etc. A blocking JDialog will appear and will remain until the process is complete.
final JDialog loading = new JDialog(parentComponent);
JPanel p1 = new JPanel(new BorderLayout());
p1.add(new JLabel("Please wait..."), BorderLa...
Mustaches can also be used inside HTML attributes:
<div id="item-{{ id }}"></div>
Note that attribute interpolations are disallowed in Vue.js directives and special attributes. Don’t worry, Vue.js will raise warnings for you when mustaches are used in wrong places.
Vue.js allows you to append optional “filters” to the end of an expression, denoted by the “pipe” symbol:
{{ message | capitalize }}
Here we are “piping” the value of the message expression through the built-in capitalize filter, which is in fact just a JavaScript function that returns the capit...