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...
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....
This command print all relevant application data:
version code
version name
granted permissions (Android API 23+)
etc..
adb shell dumpsys package <your.package.id>
GitHub is a huge collection of Git repositories. In other words, you can think of GitHub as a collection of many projects!
Creating An Account
Visit GitHub's main page Here
Pick a username, enter in your email address, and pick a secure password and you're ready to go!
Useful Tools
For Git/...
Sometimes, your template need a bit more of information. For example, we would like to have the user in the header of the page, with a link to their profile next to the logout link. In these cases, use the get_context_data method.
views.py
class BookView(DetailView):
template_name = "boo...
Writing a view to create object can be quite boring. You have to display a form, you have to validate it, you have to save the item or return the form with an error. Unless you use one of the generic editing views.
app/views.py
from django.core.urlresolvers import reverse_lazy
from django.views.g...
You can create a tuple and use a switch like so:
var str: String? = "hi"
var x: Int? = 5
switch (str, x) {
case (.Some,.Some):
print("Both have values")
case (.Some, nil):
print("String has a value")
case (nil, .Some):
print("Int has a value&...
Assuming you have a model called Post defined in your models.py file that contains blog posts, and has a date_published field.
Step 1: Write the context processor
Create (or add to) a file in your app directory called context_processors.py:
from myapp.models import Post
def recent_blog_posts...
Many-to-One Relationship
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=50)
#Book has a foreignkey (many to one) relationship with author
class Book(models.Model):
author = models.ForeignKey(Author, on_delete=models.CASCADE)
publish_...
While the math.sqrt function is provided for the specific case of square roots, it's often convenient to use the exponentiation operator (**) with fractional exponents to perform nth-root operations, like cube roots.
The inverse of an exponentiation is exponentiation by the exponent's reciprocal. S...
The background-position property is used to specify the starting position for a background image or gradient
.myClass {
background-image: url('path/to/image.jpg');
background-position: 50% 50%;
}
The position is set using an X and Y co-ordinate and be set using any of the units used withi...
Getting the Constructor Object
You can obtain Constructor class from the Class object like this:
Class myClass = ... // get a class object
Constructor[] constructors = myClass.getConstructors();
Where the constructors variable will have one Constructor instance for each public constructor decl...