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 os | |
| import json | |
| import xml.etree.ElementTree as ET | |
| def xml_to_json(xml_file): | |
| tree = ET.parse(xml_file) | |
| root = tree.getroot() | |
| strings = {} | |
| for child in root: |
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
| name: Build and Test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| buildAndTest: | |
| runs-on: macos-latest | |
| steps: |
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 SwiftUI | |
| import Combine | |
| struct ContentView: View { | |
| @State var showFab = true | |
| @State var scrollOffset: CGFloat = 0.00 | |
| var body: some View { | |
| ScrollView { | |
| VStack (alignment: .leading) { |
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 'package:calendarflutter/style/custom_app_theme_data.dart'; | |
| import 'package:flutter/material.dart'; | |
| class CustomAppTheme extends InheritedWidget { | |
| CustomAppTheme({ | |
| Key key, | |
| @required Widget child, | |
| this.customAppTheme, | |
| }) : super(key: key, child: child); |
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 cardsPublicKey = 9033205 | |
| let doorsPublicKey = 9281649 | |
| let subjectNumber = 7 | |
| let cardLoopSize = findLoopSizeFor(publicKey: cardsPublicKey, subjectNumber: subjectNumber) | |
| let doorLoopSize = findLoopSizeFor(publicKey: doorsPublicKey, subjectNumber: subjectNumber) | |
| print(cardLoopSize, doorLoopSize) |
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 occurences = coordinates.reduce(into: [:]) { counts, coordinate in counts[coordinate, default: 0] += 1 } | |
| print(occurences.filter { $0.value % 2 == 1 }.count) |
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
| var currentCup = cups.first! | |
| for _ in 1...100 { | |
| (currentCup,cups) = runMove(currentCup, cups) | |
| } | |
| let parts = cups.split(separator: 1) | |
| var result = [Int]() | |
| if parts.count > 1 { | |
| result = Array(parts[1] + parts[0]) | |
| } else { |
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
| while player1Cards.count != 0 && player2Cards.count != 0 { | |
| let card1 = player1Cards.removeFirst() | |
| let card2 = player2Cards.removeFirst() | |
| if card1 > card2 { | |
| player1Cards.append(contentsOf: [card1, card2]) | |
| } else { | |
| player2Cards.append(contentsOf: [card2, card1]) | |
| } | |
| } |
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 allPotIngredients = allergiesToIngredients.map{ $0.value }.reduce(Set<String>()) { (all, set) -> Set<String> in | |
| all.union(set) | |
| } | |
| let result = foods.map { $0.0.subtracting(allPotIngredients).count }.reduce(0, +) | |
| print(result) |
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 Foundation | |
| struct Tile { | |
| let id: Int | |
| let imageData: [String] | |
| var borders: [String] { | |
| var list = [String]() | |
| list.append(imageData.first!) | |
| list.append(String(imageData.last!)) | |
| list.append(String(imageData.map { $0.first! })) |
NewerOlder