Instantly share code, notes, and snippets.

View VisionTranslateLanguageAPI.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View xdevapi4.js
/**
* Responds to any HTTP request that can provide a "message" field in the body.
*
* @param {!Object} req Cloud Function request context.
* @param {!Object} res Cloud Function response context.
*/
const options = {
host: "your ip address",
port: 33060,
password: "your password",
View xdevapi3.js
const mysqlx = require('@mysql/xdevapi');
const options = require('./config')
mysqlx.getSession(options)
.then((session) => {
const db = session.getSchema("worldcup");
let teamsCollection = db.getCollection("teams_2018");
return teamsCollection.find("name = :country1 OR name = :country2")
.bind("country1", "Brazil")
.bind("country2", "England")
View xdevapi2.js
[
4,
"Brazil ",
{
"players": [{
"id": 70,
"dob": "05.03.1993",
"club": "FC Shakhtar Donetsk (UKR)",
"name": "FRED",
"height": 169,
View xdevapi1.js
const mysqlx = require('@mysql/xdevapi');
const options = require('./config')
mysqlx.getSession(options)
.then((session) => {
const db = session.getSchema("worldcup");
const tableTeams = db.getTable("teams");
return tableTeams;
})
View xdevapi_1.sql
DESCRIBE `users`;
-- +-------------+--------------+------+-----+-------------------+-----------------------------+
-- | Field | Type | Null | Key | Default | Extra |
-- +-------------+--------------+------+-----+-------------------+-----------------------------+
-- | id | int(11) | NO | PRI | NULL | auto_increment |
-- | id_str | varchar(255) | NO | UNI | NULL | |
-- | screen_name | varchar(255) | NO | MUL | NULL | |
-- | response | json | NO | | NULL | |
-- | created_at | datetime | NO | | CURRENT_TIMESTAMP | |
View machine-learning.md

Machine Learning APIs by example: an API call to rule them all

Think your business could make use of Google's machine learning expertise when it comes to powering and improving your business applications, but do you get stuck on building and training your own custom model? While a few cloud providers offer pre-trained models, Google Cloud Platform (GCP) offers five APIs: Google Cloud Vision API, Cloud Speech API, Cloud Natural Language API, Cloud Translation API and Cloud Video API. In this session you will see how with a single API call you can enrich your application through code and live demo.

View add_speed_to_laps_table.sql
-- Virtual Column
ALTER TABLE `laps`
ADD COLUMN speed DOUBLE
GENERATED ALWAYS
AS (`distance` / `time`);
-- Stored Column
ALTER TABLE `laps`
ADD COLUMN speed DOUBLE
GENERATED ALWAYS
View laps_table.sql
CREATE TABLE `laps` (
`id` INT(10) NOT NULL AUTO_INCREMENT,
`athlete` VARCHAR(255) NOT NULL,
`distance` INT(10) NOT NULL,
`time` INT(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
View migration_n_plus_one.rb
class CreateUsers < ActiveRecord::Migration[5.1]
def change
create_table :users do |t|
t.string :name
t.timestamps
end
end
end