Tutorial by Examples: el

Introduction In this minimalist example, using pytest we're going to test that indeed our Hello World app does return "Hello, World!" with an HTTP OK status code of 200, when hit with a GET request on the URL / First let's install pytest into our virtualenv pip install pytest And jus...
Create a .gitattributes file in the project root containing: * -text This is equivalent to setting core.autocrlf = false.
<!doctype html> <html> <head> <title>Example Page</title> </head> <body> <% 'This is where the ASP code begins 'ASP will generate the HTML that is passed to the browser 'A single quote denotes a comment, so these lines are not exe...
Lists in Elixir are linked lists. This means that each item in a list consists of a value, followed by a pointer to the next item in the list. This is implemented in Elixir using cons cells. Cons cells are simple data structures with a "left" and a "right" value, or a "he...
If you want to develop and contribute to the Flask project, clone the repository and install the code in development mode. git clone ssh://github.com/pallets/flask cd flask python3 -m venv env source env/bin/activate pip install -e . There are some extra dependencies and tools to be aware ...
The empty-cells property determines if cells with no content should be displayed or not. This has no effect unless border-collapse is set to separate. Below an example with two tables with different values set to the empty-cells property: The table on the left has empty-cells: show while the one...
Dim array = New Integer() {1, 2, 3, 4} or Dim array As Int32() = {1, 2, 3, 4}
A model can provide a lot more information than just the data about an object. Let's see an example and break it down into what it is useful for: from django.db import models from django.urls import reverse from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compati...
Create an application heroku create your-app-name Deploy to Heroku git push heroku master Open your application in a browser heroku open your-app-name List Heroku commands heroku commands General help heroku help Help for a specific command heroku help <command>
Each time you use a selector in jQuery the DOM is searched for elements that match your query. Doing this too often or repeatedly will decrease performance. If you refer to a specific selector more than once you should add it to the cache by assigning it to a variable: var nav = $('#navigation'); ...
use std::fs::File; use std::io::{BufRead, BufReader}; fn main() { let filename = "src/main.rs"; // Open the file in read-only mode (ignoring errors). let file = File::open(filename).unwrap(); let reader = BufReader::new(file); // Read the file line by line us...
Channels can be used to send data from one thread to another. Below is an example of a simple producer-consumer system, where the main thread produces the values 0, 1, ..., 9, and the spawned thread prints them: use std::thread; use std::sync::mpsc::channel; fn main() { // Create a channel...
git fetch git reset --hard origin/master Beware: While commits discarded using reset --hard can be recovered using reflog and reset, uncommitted changes are deleted forever. Change origin and master to the remote and branch you want to forcibly pull to, respectively, if they are named different...
public function facebook() { return $this->socialite->driver('facebook')->stateless()->redirect()->getTargetUrl(); } This will return the URL that the consumer of the API must provide to the end user to get authorization from Facebook.
Model creation Model classes must extend Illuminate\Database\Eloquent\Model. The default location for models is the /app directory. A model class can be easily generated by the Artisan command: php artisan make:model [ModelName] This will create a new PHP file in app/ by default, which is name...
Avoid destructive operations on quoted objects. Quoted objects are literal objects. They are possibly embedded in the code in some way. How this works and the effects of modifications are unspecified in the Common Lisp standard, but it can have unwanted consequences like modifying shared data, tryin...
function getContentTypes(site_url,name_of_the_library){ var ctx = new SP.ClientContext(site_url); var web = ctx.get_web(); list = web.get_lists().getByTitle(name_of_the_library); // You can include any property of the SP.ContentType object (sp.js), for this example we are just ...
Eloquent also lets you query on defined relationships, as show below: User::whereHas('articles', function (Builder $query) { $query->where('published', '!=', true); })->get(); This requires that your relationship method name is articles in this case. The argument passed into the clos...
It is possible to mount a host directory to a specific path in your container using the -v or --volume command line option. The following example will mount /etc on the host to /mnt/etc in the container: (on linux) docker run -v "/etc:/mnt/etc" alpine cat /mnt/etc/passwd (on windows) do...
Before Python 3.5+ was released, the asyncio module used generators to mimic asynchronous calls and thus had a different syntax than the current Python 3.5 release. Python 3.x3.5 Python 3.5 introduced the async and await keywords. Note the lack of parentheses around the await func() call. import ...

Page 17 of 145