This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| // External closure declaration | |
| // Closure with arguments | |
| let sampleClosure :(String) -> (String) = { value in | |
| print(value) | |
| return "sample closure return value" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| StringBuilder errorMessages = new StringBuilder(); | |
| catch (SqlException ex) | |
| { | |
| for (int i = 0; i < ex.Errors.Count; i++) | |
| { | |
| errorMessages.Append("Index #" + i + "\n" + | |
| "Message: " + ex.Errors[i].Message + "\n" + | |
| "LineNumber: " + ex.Errors[i].LineNumber + "\n" + | |
| "Source: " + ex.Errors[i].Source + "\n" + | |
| "Procedure: " + ex.Errors[i].Procedure + "\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT o.OrderID, | |
| o.CustomerID, | |
| o.ProductID, | |
| o.Status, | |
| c.Name as CName, | |
| p.Name as PName, | |
| p.PRICE | |
| FROM Orders o | |
| INNER JOIN Customers c | |
| on o.CustomerID = c.CustomerID |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --CREATE SCHEMA AllYouNeed; | |
| --CREATE TABLE Customers( | |
| -- CustomerID INT IDENTITY(1,1), | |
| -- Name VARCHAR(50) NOT NULL, | |
| -- Email VARCHAR(50) NOT NULL, | |
| -- CONSTRAINT PK_Customer PRIMARY KEY (CustomerID) | |
| -- ); | |
| --CREATE TABLE Products( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <table id="dsTable"> | |
| <tbody> | |
| <tr> | |
| <td>Relationship Type</td> | |
| <td>Date of Birth</td> | |
| <td>Gender</td> | |
| </tr> | |
| <tr> | |
| <td>Spouse</td> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| It is a syntax sugar for faster query writing. Its implementation in pseudocode: | |
| def filter_by(self, **kwargs): | |
| return self.filter(sql.and_(**kwargs)) | |
| For AND you can simply write: | |
| Users.query.filter_by(name='Joe', surname='Dodson') | |
| btw | |
| db.users.filter(or_(db.users.name=='Ryan', db.users.country=='England')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask, abort, request, jsonify | |
| from models import Event | |
| app = Flask(__name__) | |
| @app.route('/api/v2/events/page') | |
| def view(): | |
| return jsonify(get_paginated_list( | |
| Event, | |
| '/api/v2/events/page', |