Tutorial by Examples

JavaScript has four different equality comparison operations. SameValue It returns true if both operands belong to the same Type and are the same value. Note: the value of an object is a reference. You can use this comparison algorithm via Object.is (ECMAScript 6). Examples: Object.is(1, 1); ...
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...
Server side: import socket serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) serversocket.bind(('localhost', 8089)) serversocket.listen(5) # become a server socket, maximum 5 connections while True: connection, address = serversocket.accept() buf = connection.recv(6...
You can validate request data using the validate method (available in the base Controller, provided by the ValidatesRequests trait). If the rules pass, your code will keep executing normally; however, if validation fails, an error response containing the validation errors will automatically be se...
In the Web App blade of the Azure Portal, click All settings > WebJobs to show the WebJobs blade: Click Add. The Add WebJob dialog appears. Under Name, provide a name for the WebJob. The name must start with a letter or a number and cannot contain any special characters other than...
composer require laravel/socialite This installation assumes you're using Composer for managing your dependencies with Laravel, which is a great way to deal with it.
In your config\services.php you can add the following code 'facebook' => [ 'client_id' => 'your-facebook-app-id', 'client_secret' => 'your-facebook-app-secret', 'redirect' => 'http://your-callback-url', ], You'll also need to add the Provider to your config\app.php L...
return Socialite::driver('facebook')->redirect(); This will redirect an incoming request to the appropriate URL to be authenticated. A basic example would be in a controller <?php namespace App\Http\Controllers\Auth; use Socialite; class AuthenticationController extends Controller...
/** * LoginController constructor. * @param Socialite $socialite */ public function __construct(Socialite $socialite) { $this->socialite = $socialite; } Within the constructor of your Controller, you're now able to inject the Socialite class that will help you handle login with so...
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.
Usually we want to separate the creation of the dialog from its appearance. Then three steps are needed. Create base element <div id="dialog" title="Basic dialog"> <p>This is the default dialog which is useful for displaying information. The dialog window can...
Creating a Trait trait Speak { fn speak(&self) -> String; } Implementing a Trait struct Person; struct Dog; impl Speak for Person { fn speak(&self) -> String { String::from("Hello.") } } impl Speak for Dog { fn speak(&self) ->...
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...
EXPOSE <port> [<port>...] From Docker's documentation: The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime. EXPOSE does not make the ports of the container accessible to the host. To do that, you must use either the -p flag to ...
Quote is a special operator that prevents evaluation of its argument. It returns its argument, unevaluated. CL-USER> (quote a) A CL-USER> (let ((a 3)) (quote a)) A
The notation 'thing is equal to (quote thing). The reader will do the expansion: > (read-from-string "'a") (QUOTE A) Quoting is used to prevent further evaluation. The quoted object evaluates to itself. > 'a A > (eval '+ 1 2) 3
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...
docker exec -it <container id> /bin/bash It is common to log in an already running container to make some quick tests or see what the application is doing. Often it denotes bad container use practices due to logs and changed files should be placed in volumes. This example allows us log in the...
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 ...

Page 162 of 1336