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
struct Person { | |
let firstName: String | |
let middleName: String? | |
let lastName: String | |
func getFullName() -> String { | |
if middleName == nil { | |
return firstName + " " + lastName | |
} else { | |
return firstName + " " + middleName! + " " + lastName |
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
let week = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] | |
func weekdayOrWeekend(day: String) -> String { | |
switch day { | |
case "Saturday", "Sunday": return "Weekend" | |
case "Monday", "Tuesday", "Wednesday", "Thursday", "Friday": return "Weekday" | |
default: return "This isn't a valid day in the Western calendar" | |
} | |
} |
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
struct User { | |
var fullName: String | |
var email: String | |
var age: Int | |
} | |
var someUser = User(fullName: "Thanh Luu", email: "[email protected]", age: 27) | |
var anotherUser = someUser |
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
class Point { | |
var x: Int | |
var y: Int | |
init(x: Int, y: Int){ | |
self.x = x | |
self.y = y | |
} | |
} |
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
let x1 = 0 | |
let y1 = 0 | |
let coordinate1: (x: Int, y: Int) = (0,0) | |
coordinate1.x | |
struct Point { | |
let x: Int | |
let y: Int | |
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
// Swift Functions | |
func calculateArea(length: Int, width: Int) -> Int { | |
let area = length * width | |
return area | |
} | |
// Room 1 | |
let areaOfRoom1 = calculateArea(10, width: 8) |
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
let favoriteProgramingLanguage = "Swift" | |
let year = 2014 // Int | |
var version = 2.0 // Double | |
var isAwesome = true // Bool | |
var someString = "" |
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
[mysqld] | |
datadir=/var/lib/mysql | |
socket=/var/lib/mysql/mysql.sock | |
# Disabling symbolic-links is recommended to prevent assorted security risks | |
symbolic-links=0 | |
# Settings user and group are ignored when systemd is used (fedora >= 15). | |
# If you need to run mysqld under a different user or group, | |
# customize your systemd unit file for mysqld according to the |
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 url('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'); | |
.dwqa-questions-list .dwqa-question-item { | |
padding-left: 70px; | |
} | |
.dwqa-questions-list .dwqa-question-item .avatar { | |
position: static; | |
width: 12px; | |
height: 12px; |
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
// Search "$dir_iterator" then insert those codes below this line: | |
// $dir_iterator = new RecursiveDirectoryIterator( $dir ); | |
$filter = array( 'framework', 'tools', 'vendor', 'lib', 'installer', 'updater' ); | |
$dir_iterator = new \RecursiveCallbackFilterIterator( | |
$dir_iterator, | |
function( $item ) use ( $filter ) { | |
return ! in_array( $item->getBaseName(), $filter ); | |
} | |
); |