Tutorial by Examples: at

It's possible to extent native elements, but their descendants don't get to have their own tag names. Instead, the is attribute is used to specify which subclass an element is supposed to use. For example, here's an extension of the <img> element which logs a message to the console when it's l...
The most basic use of a float is having text wrap around an image. The below code will produce two paragraphs and an image, with the second paragraph flowing around the image. Notice that it is always content after the floated element that flows around the floated element. HTML: <p>Lorem ips...
Adapted from the tutorial, this uses the SwiftyDropbox library to download a file, with a progress callback on the download method to get progress information: // Download a file let destination : (NSURL, NSHTTPURLResponse) -> NSURL = { temporaryURL, response in let fileManager = NSFileMan...
This uses the SwiftyDropbox library to upload a file from a NSData to the Dropbox account, using upload sessions for larger files, handling every error case: import UIKit import SwiftyDropbox class ViewController: UIViewController { // replace this made up data with the real data le...
curl -X POST https://api.dropboxapi.com/2/users/get_current_account \ --header "Authorization: Bearer <ACCESS_TOKEN>" <ACCESS_TOKEN> should be replaced with your access token.
#include <stdio.h> #include <curl/curl.h> int main (int argc, char *argv[]) { CURL *curl; CURLcode res; /* In windows, this will init the winsock stuff */ curl_global_init(CURL_GLOBAL_ALL); /* get a curl handle */ curl = curl_ea...
This uses the Dropbox Python SDK to get the user's account information from the Dropbox API. import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") dbx.users_get_current_account() <ACCESS_TOKEN> should be replaced with the access token.
<?php $headers = array("Authorization: Bearer <ACCESS_TOKEN>", "Content-Type: application/json"); $ch = curl_init('https://api.dropboxapi.com/2/users/get_space_usage'); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POS...
// List folder Dropbox.authorizedClient!.files.listFolder(path: "/nonexistantpath").response { response, error in print("*** List folder ***") if let result = response { print("Folder contents:") for entry in result.entries { pr...
Dropbox.authorizedClient!.files.getMetadata(path: "/test.jpg", includeMediaInfo: true).response { response, error in if let result = response as? Files.FileMetadata { print(result.name) if result.mediaInfo != nil { switch result.mediaInfo! as Files.Med...
curl -X POST https://api.dropboxapi.com/2/files/get_metadata \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"path\": \"/test.jpg\",\"include_media_info\": true}&quot...
This uses the Dropbox Python SDK to create a shared link for a folder: import dropbox dbx = dropbox.Dropbox("<ACCESS_TOKEN>") shared_link_metadata = dbx.sharing_create_shared_link_with_settings("/Testing") print shared_link_metadata.url <ACCESS_TOKEN> should be...
Dropbox.authorizedClient!.sharing.createSharedLink(path: "/test.txt").response({ response, error in if let link = response { print(link.url) } else { print(error!) } })
curl -X POST https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings \ --header "Authorization: Bearer <ACCESS_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"path\": \"/Prime_Numbers.txt\",\"settin...
DataViews provide methods to read and write individual values from an ArrayBuffer, instead of viewing the entire thing as an array of a single type. Here we set two bytes individually then interpret them together as a 16-bit unsigned integer, first big-endian then little-endian. var buffer = new Ar...
var data = 'iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACN' + 'byblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHx' + 'gljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='; var characters = atob(data); var array = new Uint8Array(characters.length); for (var i = 0; i < characters.length; i++) { array[i] ...
Template literals are a special type of string literal that can be used instead of the standard '...' or "...". They are declared by quoting the string with backticks instead of the standard single or double quotes: `...`. Template literals can contain line breaks and arbitrary expression...
The idea of bound and unbound methods was removed in Python 3. In Python 3 when you declare a method within a class, you are using a def keyword, thus creating a function object. This is a regular function, and the surrounding class works as its namespace. In the following example we declare method ...
if [[ $1 -eq 1 ]]; then echo "1 was passed in the first parameter" elif [[ $1 -gt 2 ]]; then echo "2 was not passed in the first parameter" else echo "The first parameter was not 1 and is not more than 2." fi The closing fi is necessary, but the eli...
#! /bin/bash for i in {1..10}; do # {1..10} expands to "1 2 3 4 5 6 7 8 9 10" echo $i done This outputs the following: 1 2 3 4 5 6 7 8 8 10

Page 13 of 442