hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
98 values
lang
stringclasses
21 values
max_stars_repo_path
stringlengths
3
945
max_stars_repo_name
stringlengths
4
118
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
368k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
945
max_issues_repo_name
stringlengths
4
118
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
945
max_forks_repo_name
stringlengths
4
135
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
1.05M
avg_line_length
float64
1
1.03M
max_line_length
int64
2
1.03M
alphanum_fraction
float64
0
1
8ad59c431dd0f442d15946719c2f6cc3096e0041
995
rs
Rust
src/common.rs
almindor/texel_types
116b578b55599d51e4bddaec61f5d599ec1e6e1f
[ "Apache-2.0" ]
null
null
null
src/common.rs
almindor/texel_types
116b578b55599d51e4bddaec61f5d599ec1e6e1f
[ "Apache-2.0" ]
null
null
null
src/common.rs
almindor/texel_types
116b578b55599d51e4bddaec61f5d599ec1e6e1f
[ "Apache-2.0" ]
null
null
null
use big_enum_set::{BigEnumSet, BigEnumSetType}; #[cfg(feature = "serde_support")] use serde::{Deserialize, Serialize}; /// /// Symbol styles enum /// #[derive(Debug, BigEnumSetType)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub enum SymbolStyle { Bold, Italic, Underline, } /// /// ColorMode enum for background/foreground selection /// #[derive(Debug, Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub enum ColorMode { /// Background mode Bg, /// Foreground mode Fg, } /// /// Generic "which" selector for selections etc. /// #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[cfg_attr(feature = "serde_support", derive(Serialize, Deserialize))] pub enum Which<P> { /// All All, /// Next selection Next, /// Previous selection Previous, /// Specific index selection At(P), } /// Set of `SymbolStyle` pub type SymbolStyles = BigEnumSet<SymbolStyle>;
21.170213
70
0.666332
fb99b12a23d7a7d196b064b51abf9f38f6077885
606
c
C
src/ddclipper.c
Kevok93/cnc-ddraw
d7ad443d9230ced148cdbc41f009e5d9c00ccec3
[ "MIT" ]
1
2022-01-02T10:32:34.000Z
2022-01-02T10:32:34.000Z
src/ddclipper.c
MountCloud/cnc-ddraw
5e79340fef6aae70f367c762572fef34e77ebb9a
[ "MIT" ]
null
null
null
src/ddclipper.c
MountCloud/cnc-ddraw
5e79340fef6aae70f367c762572fef34e77ebb9a
[ "MIT" ]
null
null
null
#define WIN32_LEAN_AND_MEAN #include <windows.h> #include "IDirectDrawClipper.h" #include "ddclipper.h" #include "debug.h" HRESULT dd_CreateClipper(DWORD dwFlags, LPDIRECTDRAWCLIPPER FAR *lplpDDClipper, IUnknown FAR *pUnkOuter ) { if (!lplpDDClipper) return DDERR_INVALIDPARAMS; IDirectDrawClipperImpl *c = (IDirectDrawClipperImpl *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawClipperImpl)); dprintf(" Clipper = %p\n", c); c->lpVtbl = &g_ddc_vtbl; IDirectDrawClipper_AddRef(c); *lplpDDClipper = (LPDIRECTDRAWCLIPPER)c; return DD_OK; }
25.25
136
0.729373
6514ff55c2d00ee1deed3eaa7d8b92b095c218ad
141
py
Python
featureflags/__init__.py
enverbisevac/ff-python-server-sdk
e7c809229d13517e0bf4b28fc0a556e693c9034e
[ "Apache-2.0" ]
null
null
null
featureflags/__init__.py
enverbisevac/ff-python-server-sdk
e7c809229d13517e0bf4b28fc0a556e693c9034e
[ "Apache-2.0" ]
null
null
null
featureflags/__init__.py
enverbisevac/ff-python-server-sdk
e7c809229d13517e0bf4b28fc0a556e693c9034e
[ "Apache-2.0" ]
null
null
null
"""Top-level package for Feature Flag Server SDK.""" __author__ = """Enver Bisevac""" __email__ = "enver@bisevac.com" __version__ = "0.1.0"
23.5
52
0.695035
aea12872d5bc71fa72ecedceeef501b086f39b3d
646
rs
Rust
src/lib.rs
fncnt/librna-sys
c16f745c67ac621e8a55a5c7365b74b720d43005
[ "X11" ]
null
null
null
src/lib.rs
fncnt/librna-sys
c16f745c67ac621e8a55a5c7365b74b720d43005
[ "X11" ]
null
null
null
src/lib.rs
fncnt/librna-sys
c16f745c67ac621e8a55a5c7365b74b720d43005
[ "X11" ]
null
null
null
#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(improper_ctypes)] include!(concat!(env!("OUT_DIR"), "/bindings.rs")); // just a simple test as example #[cfg(test)] mod tests { use super::*; use std::ffi::CString; pub fn hamming_distance(s1: &str, s2: &str) -> i32 { let seq1 = CString::new(s1).expect("CString::new failed"); let seq2 = CString::new(s2).expect("CString::new failed"); unsafe { vrna_hamming_distance(seq1.as_ptr(), seq2.as_ptr()) } } #[test] fn hamming() { assert_eq!(hamming_distance("ACGUA", "ACGUC"), 1); } }
23.925926
70
0.617647
7570440ebea590c8e3b736e5672e1d788fb47e61
574
h
C
Alhythm/src/Game_FileID.h
Nao-Shirotsu/Siv3D_Alhythm
d602832e535831a07d0e7c3fb589caa5d356aaf2
[ "MIT" ]
4
2018-12-19T12:36:42.000Z
2021-05-24T06:13:33.000Z
Alhythm/src/Game_FileID.h
Nao-Shirotsu/Siv3D_Alhythm
d602832e535831a07d0e7c3fb589caa5d356aaf2
[ "MIT" ]
1
2019-01-07T03:04:11.000Z
2019-01-07T03:04:11.000Z
Alhythm/src/Game_FileID.h
Nao-Shirotsu/Siv3D_Alhythm
d602832e535831a07d0e7c3fb589caa5d356aaf2
[ "MIT" ]
2
2020-04-15T06:15:51.000Z
2021-12-16T02:22:12.000Z
#pragma once namespace Game{ // Resource.rcに記述する埋め込みファイルの識別番号(画像) enum class ImageFileID{ BackgroundImage = 1000, TitleStringImage = 1001, }; // Resource.rcに記述する埋め込みファイルの識別番号(トラック以外のSEやBGMなどのサウンド) enum class SEBGMFileID{ // SoundEffects NoteTapSound = 2000, NoteTapSoundJust = 2001, NoteTapSoundMiss = 2002, DecideSound = 2003, // BGM MusicSelectBGM = 2500, TitleBGM = 2501, }; // Resource.rcに記述する埋め込みファイルの識別番号(トラック) enum class TrackFileID{ Senkou = 3000, Cassi = 3001, Orion = 3002, CassiEmp = 3003, }; }// namespace Game
17.9375
55
0.698606
712a21b3c50357d43be30a2b618a1e2f4a4fb9a5
1,323
ts
TypeScript
src/app/components/order-all/order-all.component.ts
sam016/didactic-octo-potato
b482666b10153cece3d05e5a3ad4efd3e642901d
[ "MIT" ]
null
null
null
src/app/components/order-all/order-all.component.ts
sam016/didactic-octo-potato
b482666b10153cece3d05e5a3ad4efd3e642901d
[ "MIT" ]
null
null
null
src/app/components/order-all/order-all.component.ts
sam016/didactic-octo-potato
b482666b10153cece3d05e5a3ad4efd3e642901d
[ "MIT" ]
null
null
null
import { Component, OnInit } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { RestService } from 'app/services/rest.service'; import { RestOrder } from 'app/rest-order'; @Component({ selector: 'app-order-all', templateUrl: './order-all.component.html', styleUrls: ['./order-all.component.scss'], providers: [RestService] }) export class OrderAllComponent implements OnInit { orders: RestOrder[]; filters: IFilter; isRefreshing: boolean = false; constructor(private titleService: Title, private restService: RestService) { this.titleService.setTitle('Order'); this.filters = { receiptId: '', dateFrom: null, dateTo: null }; this.refresh(); } ngOnInit() { } public resetFilters() { this.filters.receiptId = ''; this.filters.dateFrom = null; this.filters.dateTo = null; } private refresh() { if (this.isRefreshing) { return; } this.restService .getOrders() .then((orders) => { this.orders = orders; this.isRefreshing = false; }) .catch((err) => { console.error('Error occured whlie getting orders'); console.error(err); this.isRefreshing = false; }) } } interface IFilter { receiptId: string; dateFrom: Date; dateTo: Date; }
22.423729
78
0.633409
baf828186c5689fe8812bd0878f0ebafd201e054
2,262
swift
Swift
RxSwiftStudyPlayground/RxSwiftStudyPlayground/ViewController.swift
FMYang/RxSwiftStudy
c49b6582a2236e899e324b057479a5f1688a3e1a
[ "MIT" ]
null
null
null
RxSwiftStudyPlayground/RxSwiftStudyPlayground/ViewController.swift
FMYang/RxSwiftStudy
c49b6582a2236e899e324b057479a5f1688a3e1a
[ "MIT" ]
null
null
null
RxSwiftStudyPlayground/RxSwiftStudyPlayground/ViewController.swift
FMYang/RxSwiftStudy
c49b6582a2236e899e324b057479a5f1688a3e1a
[ "MIT" ]
null
null
null
// // ViewController.swift // RxSwiftStudyPlayground // // Created by 杨方明 on 2018/11/15. // Copyright © 2018年 杨方明. All rights reserved. // import UIKit import RxSwift class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // let bag = DisposeBag() // // let observable1 = asyncTask("1") // let observable2 = asyncTask("2") // let observable3 = asyncTask("3") // // Observable.concat([observable1, observable2, observable3]) // .observeOn(MainScheduler.asyncInstance) // .subscribe(onNext: { // print($0) // }).disposed(by: bag) let seq = Observable .of(1, 2, 3, 4, 5) .map { (n) -> Observable<Int> in let o = self.doAsyncWork(n, desc: "start \(n) - wait \(5 - n)", time: 6 - n ).share(replay: 1) o.subscribe() return o.asObservable() } .concat() let sharedSeq = seq.share(replay: 0) sharedSeq.subscribe(onNext: { print("=> \($0)") }) { print("=> completed") } // sharedSeq.subscribeNext { print("=> \($0)") } // sharedSeq.subscribeCompleted { print("=> completed") } } func delay(_ time: Int, closure: @escaping () -> Void) { DispatchQueue.global().asyncAfter(deadline: DispatchTime.now()) { closure() } } func doAsyncWork(_ value: Int, desc: String, time: Int) -> Observable<Int> { return Observable.create() { (observer) -> Disposable in print(desc) self.delay(time) { observer.onNext(value) observer.onCompleted() } return Disposables.create() } } } extension ViewController { func asyncTask(_ label: String) -> Observable<String> { return Observable.create({ observer -> Disposable in DispatchQueue.global().async { observer.onNext(label) } observer.onCompleted() return Disposables.create() }) } }
27.925926
80
0.502653
71ee47e7068d7fd362718cae711bb39778eef53c
219
ts
TypeScript
UI/src/app/models/code-mapping/concept.ts
alexanderlopoukhov/CDMSouffleur
2f44624d956c5b3e2d8b7b6d92b7a9d808b7bfed
[ "Apache-2.0" ]
9
2021-05-06T15:38:17.000Z
2022-02-22T16:00:56.000Z
UI/src/app/models/code-mapping/concept.ts
alexanderlopoukhov/CDMSouffleur
2f44624d956c5b3e2d8b7b6d92b7a9d808b7bfed
[ "Apache-2.0" ]
12
2019-02-28T13:16:42.000Z
2021-03-16T09:37:40.000Z
UI/src/app/models/code-mapping/concept.ts
alexanderlopoukhov/CDMSouffleur
2f44624d956c5b3e2d8b7b6d92b7a9d808b7bfed
[ "Apache-2.0" ]
3
2019-03-11T17:31:26.000Z
2019-09-04T19:45:44.000Z
export interface Concept { conceptId: number conceptName: string domainId: string conceptClassId: string vocabularyId: string conceptCode: number standardConcept: string index?: number term?: string }
18.25
26
0.753425
9951a6f413a7483e3b14be61de6c80906ee66225
1,977
swift
Swift
SwiftLox/SwiftLox/Result/Result.swift
mslazynski/SwiftLox
f44d03d52005a9fee461810bea503f127911bec7
[ "MIT" ]
null
null
null
SwiftLox/SwiftLox/Result/Result.swift
mslazynski/SwiftLox
f44d03d52005a9fee461810bea503f127911bec7
[ "MIT" ]
null
null
null
SwiftLox/SwiftLox/Result/Result.swift
mslazynski/SwiftLox
f44d03d52005a9fee461810bea503f127911bec7
[ "MIT" ]
null
null
null
// // Result.swift // SwiftLox // // Created by Mateusz Ślażyński on 15.02.2017. // Copyright © 2017 Mateusz Ślażyński. All rights reserved. // enum Result<V, E> where E : Error { case success(V) case failure(E) case foreignFailure(Error) init(_ throwingExpr: (Void) throws -> V) { do { let value = try throwingExpr() self = Result.success(value) } catch let error as E { self = .failure(error) } catch let error { self = .foreignFailure(error) } } init(_ error: Error) { if let e = error as? E { self = .failure(e) } else { self = .foreignFailure(error) } } init(_ value: V) { self = .success(value) } init<NE : Error>(_ result: Result<V, NE>) { switch result { case let .success(value): self.init(value) case let .failure(error): self.init(error) case let .foreignFailure(error): self.init(error) } } func map<U>(f: (V) -> U) -> Result<U, E> { switch self { case .success(let t): return .success(f(t)) case .failure(let err): return .failure(err) case .foreignFailure(let err): return .foreignFailure(err) } } func flatMap<U, NE : Error>(f: (V) -> Result<U, NE>) -> Result<U, NE> { switch self { case .success(let t): return f(t) case .failure(let error): return Result<U, NE>(error) case .foreignFailure(let error): return Result<U, NE>(error) } } func pack<NE: Error>() -> Result<V, NE> { return Result<V, NE>.init(self) } func ignore() -> Void { return } func resolve() throws -> V { switch self { case .success(let value): return value case .failure(let error): throw error case .foreignFailure(let error): throw error } } }
25.675325
75
0.524026
dc014ff9adf43eb6f723d17f8693bb1c4f0f9189
3,679
swift
Swift
Sources/KeyboardShortcuts/NSMenuItem++.swift
hank121314/KeyboardShortcuts
5c2512aa722b3f5a9db02e04609c63d755a271e1
[ "MIT" ]
null
null
null
Sources/KeyboardShortcuts/NSMenuItem++.swift
hank121314/KeyboardShortcuts
5c2512aa722b3f5a9db02e04609c63d755a271e1
[ "MIT" ]
null
null
null
Sources/KeyboardShortcuts/NSMenuItem++.swift
hank121314/KeyboardShortcuts
5c2512aa722b3f5a9db02e04609c63d755a271e1
[ "MIT" ]
null
null
null
import Cocoa extension NSMenuItem { private struct AssociatedKeys { static let observer = ObjectAssociation<NSObjectProtocol>() } private func clearShortcut() { keyEquivalent = "" keyEquivalentModifierMask = [] } // TODO: Make this a getter/setter. We must first add the ability to create a `Shortcut` from a `keyEquivalent`. /** Show a recorded keyboard shortcut in a `NSMenuItem`. The menu item will automatically be kept up to date with changes to the keyboard shortcut. Pass in `nil` to clear the keyboard shortcut. This method overrides `.keyEquivalent` and `.keyEquivalentModifierMask`. ``` import Cocoa import KeyboardShortcuts extension KeyboardShortcuts.Name { static let toggleUnicornMode = Self("toggleUnicornMode") } // … `Recorder` logic for recording the keyboard shortcut … let menuItem = NSMenuItem() menuItem.title = "Toggle Unicorn Mode" menuItem.setShortcut(for: .toggleUnicornMode) ``` You can test this method in the example project. Run it, record a shortcut and then look at the “Test” menu in the app's main menu. - Important: You will have to disable the global keyboard shortcut while the menu is open, as otherwise, the keyboard events will be buffered up and triggered when the menu closes. This is because `NSMenu` puts the thread in tracking-mode, which prevents the keyboard events from being received. You can listen to whether a menu is open by implementing `NSMenuDelegate#menuWillOpen` and `NSMenuDelegate#menuDidClose`. You then use `KeyboardShortcuts.disable` and `KeyboardShortcuts.enable`. */ public func setShortcut(for name: KeyboardShortcuts.Name?) { guard let name = name else { clearShortcut() AssociatedKeys.observer[self] = nil return } func set() { let shortcut = KeyboardShortcuts.Shortcut(name: name) setShortcut(shortcut) } set() // TODO: Use Combine when targeting macOS 10.15. AssociatedKeys.observer[self] = NotificationCenter.default.addObserver(forName: .shortcutByNameDidChange, object: nil, queue: nil) { notification in guard let nameInNotification = notification.userInfo?["name"] as? KeyboardShortcuts.Name, nameInNotification == name else { return } set() } } /** Add a keyboard shortcut to a `NSMenuItem`. This method is only recommended for dynamic shortcuts. In general, it's preferred to create a static shortcut name and use `NSMenuItem.setShortcut(for:)` instead. Pass in `nil` to clear the keyboard shortcut. This method overrides `.keyEquivalent` and `.keyEquivalentModifierMask`. - Important: You will have to disable the global keyboard shortcut while the menu is open, as otherwise, the keyboard events will be buffered up and triggered when the menu closes. This is because `NSMenu` puts the thread in tracking-mode, which prevents the keyboard events from being received. You can listen to whether a menu is open by implementing `NSMenuDelegate#menuWillOpen` and `NSMenuDelegate#menuDidClose`. You then use `KeyboardShortcuts.disable` and `KeyboardShortcuts.enable`. */ @_disfavoredOverload public func setShortcut(_ shortcut: KeyboardShortcuts.Shortcut?) { func set() { guard let shortcut = shortcut else { clearShortcut() return } keyEquivalent = shortcut.keyEquivalent keyEquivalentModifierMask = shortcut.modifiers } // `TISCopyCurrentASCIICapableKeyboardLayoutInputSource` works on a background thread, but crashes when used in a `NSBackgroundActivityScheduler` task, so we ensure it's not run in that queue. if DispatchQueue.isCurrentQueueNSBackgroundActivitySchedulerQueue { DispatchQueue.main.async { set() } } else { set() } } }
36.068627
491
0.755912
1cdc1bec40c2a2ba1b208340f8d0ef4aebcaa3c4
13,133
kt
Kotlin
search-service/src/main/kotlin/com/egm/stellio/search/service/TemporalEntityAttributeService.kt
jason-fox/stellio-context-broker
e5732060f9964617815547e77c5f55d253746f37
[ "Apache-2.0" ]
null
null
null
search-service/src/main/kotlin/com/egm/stellio/search/service/TemporalEntityAttributeService.kt
jason-fox/stellio-context-broker
e5732060f9964617815547e77c5f55d253746f37
[ "Apache-2.0" ]
null
null
null
search-service/src/main/kotlin/com/egm/stellio/search/service/TemporalEntityAttributeService.kt
jason-fox/stellio-context-broker
e5732060f9964617815547e77c5f55d253746f37
[ "Apache-2.0" ]
null
null
null
package com.egm.stellio.search.service import arrow.core.Validated import arrow.core.invalid import arrow.core.orNull import arrow.core.valid import com.egm.stellio.search.model.AttributeInstance import com.egm.stellio.search.model.AttributeMetadata import com.egm.stellio.search.model.TemporalEntityAttribute import com.egm.stellio.search.util.valueToDoubleOrNull import com.egm.stellio.search.util.valueToStringOrNull import com.egm.stellio.shared.model.NgsiLdAttributeInstance import com.egm.stellio.shared.model.NgsiLdGeoPropertyInstance import com.egm.stellio.shared.model.NgsiLdPropertyInstance import com.egm.stellio.shared.model.NgsiLdRelationshipInstance import com.egm.stellio.shared.model.toNgsiLdEntity import com.egm.stellio.shared.util.JsonLdUtils import com.egm.stellio.shared.util.JsonLdUtils.compactTerm import com.egm.stellio.shared.util.JsonUtils import com.egm.stellio.shared.util.extractAttributeInstanceFromCompactedEntity import com.egm.stellio.shared.util.toUri import io.r2dbc.postgresql.codec.Json import io.r2dbc.spi.Row import org.slf4j.LoggerFactory import org.springframework.data.r2dbc.core.DatabaseClient import org.springframework.data.r2dbc.core.bind import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional import reactor.core.publisher.Flux import reactor.core.publisher.Mono import java.net.URI import java.util.UUID @Service class TemporalEntityAttributeService( private val databaseClient: DatabaseClient, private val attributeInstanceService: AttributeInstanceService ) { private val logger = LoggerFactory.getLogger(javaClass) @Transactional fun create(temporalEntityAttribute: TemporalEntityAttribute): Mono<Int> = databaseClient.execute( """ INSERT INTO temporal_entity_attribute (id, entity_id, type, attribute_name, attribute_type, attribute_value_type, dataset_id) VALUES (:id, :entity_id, :type, :attribute_name, :attribute_type, :attribute_value_type, :dataset_id) """ ) .bind("id", temporalEntityAttribute.id) .bind("entity_id", temporalEntityAttribute.entityId) .bind("type", temporalEntityAttribute.type) .bind("attribute_name", temporalEntityAttribute.attributeName) .bind("attribute_type", temporalEntityAttribute.attributeType.toString()) .bind("attribute_value_type", temporalEntityAttribute.attributeValueType.toString()) .bind("dataset_id", temporalEntityAttribute.datasetId) .fetch() .rowsUpdated() internal fun createEntityPayload(entityId: URI, entityPayload: String?): Mono<Int> = databaseClient.execute( """ INSERT INTO entity_payload (entity_id, payload) VALUES (:entity_id, :payload) """ ) .bind("entity_id", entityId) .bind("payload", entityPayload?.let { Json.of(entityPayload) }) .fetch() .rowsUpdated() fun updateEntityPayload(entityId: URI, payload: String): Mono<Int> = databaseClient.execute("UPDATE entity_payload SET payload = :payload WHERE entity_id = :entity_id") .bind("payload", Json.of(payload)) .bind("entity_id", entityId) .fetch() .rowsUpdated() fun createEntityTemporalReferences(payload: String, contexts: List<String>): Mono<Int> { val entity = JsonLdUtils.expandJsonLdEntity(payload, contexts).toNgsiLdEntity() val parsedPayload = JsonUtils.deserializeObject(payload) logger.debug("Analyzing create event for entity ${entity.id}") val temporalAttributes = entity.attributes .flatMapTo( arrayListOf() ) { it.getAttributeInstances().map { instance -> Pair(it.name, toTemporalAttributeMetadata(instance)) } }.filter { it.second.isValid }.map { Pair(it.first, it.second.toEither().orNull()!!) }.ifEmpty { return Mono.just(0) } logger.debug("Found ${temporalAttributes.size} temporal attributes in entity: ${entity.id}") return Flux.fromIterable(temporalAttributes.asIterable()) .map { val (expandedAttributeName, attributeMetadata) = it val temporalEntityAttribute = TemporalEntityAttribute( entityId = entity.id, type = entity.type, attributeName = expandedAttributeName, attributeType = attributeMetadata.type, attributeValueType = attributeMetadata.valueType, datasetId = attributeMetadata.datasetId, entityPayload = payload ) val attributeInstance = AttributeInstance( temporalEntityAttribute = temporalEntityAttribute.id, observedAt = attributeMetadata.observedAt, measuredValue = attributeMetadata.measuredValue, value = attributeMetadata.value, payload = extractAttributeInstanceFromCompactedEntity( parsedPayload, compactTerm(expandedAttributeName, contexts), attributeMetadata.datasetId ) ) Pair(temporalEntityAttribute, attributeInstance) } .flatMap { temporalEntityAttributeAndInstance -> create(temporalEntityAttributeAndInstance.first).zipWhen { attributeInstanceService.create(temporalEntityAttributeAndInstance.second) } } .collectList() .map { it.size } .zipWith(createEntityPayload(entity.id, payload)) .map { it.t1 + it.t2 } } internal fun toTemporalAttributeMetadata( ngsiLdAttributeInstance: NgsiLdAttributeInstance ): Validated<String, AttributeMetadata> { // for now, let's say that if the 1st instance is temporal, all instances are temporal // let's also consider that a temporal property is one having an observedAt property if (!ngsiLdAttributeInstance.isTemporalAttribute()) return "Ignoring attribute $ngsiLdAttributeInstance, it has no observedAt information".invalid() val attributeType = when (ngsiLdAttributeInstance) { is NgsiLdPropertyInstance -> TemporalEntityAttribute.AttributeType.Property is NgsiLdRelationshipInstance -> TemporalEntityAttribute.AttributeType.Relationship else -> return "Unsupported attribute type ${ngsiLdAttributeInstance.javaClass}".invalid() } val attributeValue = when (ngsiLdAttributeInstance) { is NgsiLdRelationshipInstance -> Pair(ngsiLdAttributeInstance.objectId.toString(), null) is NgsiLdPropertyInstance -> Pair( valueToStringOrNull(ngsiLdAttributeInstance.value), valueToDoubleOrNull(ngsiLdAttributeInstance.value) ) is NgsiLdGeoPropertyInstance -> Pair(null, null) } if (attributeValue == Pair(null, null)) { return "Unable to get a value from attribute: $ngsiLdAttributeInstance".invalid() } val attributeValueType = if (attributeValue.second != null) TemporalEntityAttribute.AttributeValueType.MEASURE else TemporalEntityAttribute.AttributeValueType.ANY return AttributeMetadata( measuredValue = attributeValue.second, value = attributeValue.first, valueType = attributeValueType, datasetId = ngsiLdAttributeInstance.datasetId, type = attributeType, observedAt = ngsiLdAttributeInstance.observedAt!! ).valid() } fun getForEntities(ids: Set<URI>, types: Set<String>, attrs: Set<String>, withEntityPayload: Boolean = false): Mono<Map<URI, List<TemporalEntityAttribute>>> { var selectQuery = if (withEntityPayload) """ SELECT id, temporal_entity_attribute.entity_id, type, attribute_name, attribute_type, attribute_value_type, payload::TEXT, dataset_id FROM temporal_entity_attribute LEFT JOIN entity_payload ON entity_payload.entity_id = temporal_entity_attribute.entity_id WHERE """.trimIndent() else """ SELECT id, entity_id, type, attribute_name, attribute_type, attribute_value_type, dataset_id FROM temporal_entity_attribute WHERE """.trimIndent() val formattedIds = ids.joinToString(",") { "'$it'" } val formattedTypes = types.joinToString(",") { "'$it'" } val formattedAttrs = attrs.joinToString(",") { "'$it'" } if (ids.isNotEmpty()) selectQuery = "$selectQuery entity_id in ($formattedIds) AND" if (types.isNotEmpty()) selectQuery = "$selectQuery type in ($formattedTypes) AND" if (attrs.isNotEmpty()) selectQuery = "$selectQuery attribute_name in ($formattedAttrs) AND" return databaseClient .execute(selectQuery.removeSuffix("AND")) .fetch() .all() .map { rowToTemporalEntityAttribute(it) } .collectList() .map { temporalEntityAttributes -> temporalEntityAttributes.groupBy { it.entityId } } } fun getForEntity(id: URI, attrs: Set<String>, withEntityPayload: Boolean = false): Flux<TemporalEntityAttribute> { val selectQuery = if (withEntityPayload) """ SELECT id, temporal_entity_attribute.entity_id as entity_id, type, attribute_name, attribute_type, attribute_value_type, payload::TEXT, dataset_id FROM temporal_entity_attribute LEFT JOIN entity_payload ON entity_payload.entity_id = temporal_entity_attribute.entity_id WHERE temporal_entity_attribute.entity_id = :entity_id """.trimIndent() else """ SELECT id, entity_id, type, attribute_name, attribute_type, attribute_value_type, dataset_id FROM temporal_entity_attribute WHERE temporal_entity_attribute.entity_id = :entity_id """.trimIndent() val expandedAttrsList = attrs.joinToString(",") { "'$it'" } val finalQuery = if (attrs.isNotEmpty()) "$selectQuery AND attribute_name in ($expandedAttrsList)" else selectQuery return databaseClient .execute(finalQuery) .bind("entity_id", id) .fetch() .all() .map { rowToTemporalEntityAttribute(it) } } fun getFirstForEntity(id: URI): Mono<UUID> { val selectQuery = """ SELECT id FROM temporal_entity_attribute WHERE entity_id = :entity_id """.trimIndent() return databaseClient .execute(selectQuery) .bind("entity_id", id) .map(rowToId) .first() } fun getForEntityAndAttribute(id: URI, attributeName: String, datasetId: URI? = null): Mono<UUID> { val selectQuery = """ SELECT id FROM temporal_entity_attribute WHERE entity_id = :entity_id ${if (datasetId != null) "AND dataset_id = :dataset_id" else ""} AND attribute_name = :attribute_name """.trimIndent() return databaseClient .execute(selectQuery) .bind("entity_id", id) .bind("attribute_name", attributeName) .let { if (datasetId != null) it.bind("dataset_id", datasetId) else it } .map(rowToId) .one() } private fun rowToTemporalEntityAttribute(row: Map<String, Any>) = TemporalEntityAttribute( id = row["id"] as UUID, entityId = (row["entity_id"] as String).toUri(), type = row["type"] as String, attributeName = row["attribute_name"] as String, attributeType = TemporalEntityAttribute.AttributeType.valueOf(row["attribute_type"] as String), attributeValueType = TemporalEntityAttribute.AttributeValueType.valueOf( row["attribute_value_type"] as String ), datasetId = (row["dataset_id"] as String?)?.toUri(), entityPayload = row["payload"] as String? ) private var rowToId: ((Row) -> UUID) = { row -> row.get("id", UUID::class.java)!! } }
43.486755
118
0.62027
7e612b36ee151cc7d6f184ddfe547074475586c5
697
swift
Swift
Yelp/YelpSearchParams.swift
vijayanands/yelp
3297a46db30afc6f598e96cf15d8dfbd90683b55
[ "Apache-2.0" ]
null
null
null
Yelp/YelpSearchParams.swift
vijayanands/yelp
3297a46db30afc6f598e96cf15d8dfbd90683b55
[ "Apache-2.0" ]
1
2017-09-25T14:03:37.000Z
2017-09-25T14:03:37.000Z
Yelp/YelpSearchParams.swift
vijayanands/yelp
3297a46db30afc6f598e96cf15d8dfbd90683b55
[ "Apache-2.0" ]
null
null
null
// // YelpSearchParams.swift // Yelp // // Created by Vijayanand on 9/24/17. // Copyright © 2017 Timothy Lee. All rights reserved. // import UIKit class YelpSearchParams: NSObject { var term: String? = nil var sort: YelpSortMode? = nil var categories: [String]? = nil var deals: Bool? = nil var radius_filter: Int? = nil var offset: Int? = nil var limit: Int? = nil func customInit(term: String?, sort: YelpSortMode?, categories: [String]?, deals: Bool?, radius_filter: Int?, offset: Int?, limit: Int?) { self.term = term self.sort = sort self.categories = categories self.deals = deals self.radius_filter = radius_filter self.offset = offset self.limit = limit } }
23.233333
139
0.684362
ebe655d160b5abed894431a8637f12b95bf8c284
12,084
sql
SQL
DB Fundamentals/DB Basic/1. Data Definition And Datatypes/1. Data Definition And Data Types.sql
doba7a/SoftUni
f65a317fad2abbe6d76361407dc36164cd4ebaa2
[ "MIT" ]
null
null
null
DB Fundamentals/DB Basic/1. Data Definition And Datatypes/1. Data Definition And Data Types.sql
doba7a/SoftUni
f65a317fad2abbe6d76361407dc36164cd4ebaa2
[ "MIT" ]
null
null
null
DB Fundamentals/DB Basic/1. Data Definition And Datatypes/1. Data Definition And Data Types.sql
doba7a/SoftUni
f65a317fad2abbe6d76361407dc36164cd4ebaa2
[ "MIT" ]
null
null
null
--If you are going to submit these queries in SoftUni Judge system, remove GO tags. --Task 1 CREATE DATABASE Minions GO USE Minions GO --Task 2 CREATE TABLE Minions ( Id INT NOT NULL PRIMARY KEY, Name VARCHAR(50) NOT NULL, Age INT) GO CREATE TABLE Towns ( Id INT NOT NULL PRIMARY KEY, Name VARCHAR(50) NOT NULL) GO --Task 3 ALTER TABLE Minions ADD TownId INT FOREIGN KEY REFERENCES Towns(Id) NOT NULL GO --Task 4 INSERT INTO Towns(Id, Name) VALUES (1, 'Sofia'), (2, 'Plovdiv'), (3, 'Varna') GO INSERT INTO Minions(Id, Name, Age, TownId) VALUES (1, 'Kevin', 22, 1), (2, 'Bob', 15, 3), (3, 'Steward', NULL, 2) GO --Task 5 TRUNCATE TABLE Minions GO --Task 6 DROP TABLE Minions GO DROP TABLE Towns GO --Task 7 CREATE TABLE People ( Id INT IDENTITY(1,1) PRIMARY KEY NOT NULL, Name NVARCHAR(200) NOT NULL, Picture VARBINARY(MAX), Height DECIMAL(15,2), [Weight] DECIMAL(15,2), Gender CHAR(1) NOT NULL, Birthdate DATETIME NOT NULL, Biography NVARCHAR(MAX) ) GO INSERT INTO People(Name, Picture, Height, [Weight], Gender, Birthdate, Biography) VALUES ('Pesho', NULL, 150.2, 50.33, 'm', 1990-02-03, 'Pesho e nomer edno'), ('Gosho', NULL, 160.2, 20.33, 'm', 1994-05-03, 'Gosho ot pochivka'), ('StoyanLoshiqt', NULL, 170.2, 150.33, 'm', 199-04-08, '....'), ('Prakash', NULL, 180.2, 5.33, 'm', 1990-02-03, 'Pesho pak e nomer edno'), ('StoyanDobriqt', NULL, 190.2, 42350.33, 'm', 1864-10-03, 'Stoyan veche e nomer edno') GO --Task 8 CREATE TABLE Users ( Id INT IDENTITY(1,1) PRIMARY KEY NOT NULL, Username VARCHAR(30) UNIQUE NOT NULL, [Password] VARCHAR(26) NOT NULL, ProfilePicture VARBINARY(MAX), LastLoginTime DATETIME, IsDeleted BIT ) GO INSERT INTO Users (Username, [Password], ProfilePicture, LastLoginTime, IsDeleted) VALUES('Pesho', 'strongpassword123', 36, Null, 'true'), ('Gosho', 'goshospassword', 1433, Null, 'false'), ('Ivan', 'qkatarabota', 42352, Null, 'true'), ('Tosho', 'neznamkakvopravq', 5236, Null, 'true'), ('PeshoNomerDve', 'fasfgasf', 1, Null, 'false') GO --Task 9 ALTER TABLE Users DROP CONSTRAINT PK_Users GO ALTER TABLE Users ADD CONSTRAINT PK_Users PRIMARY KEY(Id, Username) GO --Task 10 ALTER TABLE Users ADD CONSTRAINT [Password] CHECK(LEN(Password) >= 5) GO --Task 11 ALTER TABLE Users ADD CONSTRAINT DF_Users DEFAULT GETDATE() FOR LastLoginTime GO --Task 12 ALTER TABLE Users DROP CONSTRAINT PK_Users GO ALTER TABLE Users ADD CONSTRAINT PK_Person PRIMARY KEY(Id) GO ALTER TABLE Users ADD CONSTRAINT UC_Users UNIQUE(Username) GO ALTER TABLE Users ADD CONSTRAINT CHK_Users CHECK(LEN(Password) >= 3) GO --Task 13 CREATE DATABASE Movies GO USE Movies CREATE TABLE Directors ( Id INT PRIMARY KEY IDENTITY(1,1), DirectorName NVARCHAR(255) NOT NULL, Notes NVARCHAR(255) ) GO CREATE TABLE Genres ( Id INT PRIMARY KEY IDENTITY(1,1), GenreName NVARCHAR(255) NOT NULL, Notes NVARCHAR(255) ) GO CREATE TABLE Categories ( Id INT PRIMARY KEY IDENTITY(1,1), CategoryName NVARCHAR(255) NOT NULL, Notes NVARCHAR(255) ) GO CREATE TABLE Movies ( Id INT PRIMARY KEY IDENTITY(1,1), Title NVARCHAR(255) NOT NULL, DirectorID INT FOREIGN KEY REFERENCES Directors(Id), CopyrightYear DATE, Length DECIMAL(10,2), GenreID INT FOREIGN KEY REFERENCES Genres(Id) NOT NULL, CategoryID INT FOREIGN KEY REFERENCES Categories(Id) NOT NULL, Rating INT, Notes NVARCHAR(255) ) GO INSERT INTO Directors(DirectorName, Notes) VALUES('Pesho', 'bezdelnik'), ('Stamat', 'tepence'), ('GoshU', 'ailqche'), ('Gocho', 'bratok'), ('Stoyan', 'trrr') GO INSERT INTO Genres(GenreName, Notes) VALUES('Horror', NULL), ('Comedy', NULL), ('ne', NULL), ('znam', NULL), ('janrove', NULL) GO INSERT INTO Categories(CategoryName, Notes) VALUES('po vreme na rabota', NULL), ('po vreme na lekcii', NULL), ('kibik', NULL), ('murzel', NULL), ('sarma v mraka', NULL) GO INSERT INTO Movies(Title, DirectorID, CopyrightYear, Length, GenreID, CategoryID,Rating,Notes) VALUES('Kokoshkata s plombiraniq zub', 1, NULL, NUll, 1, 3, 5,NULL), ('Gorski reket', 2, NULL, NUll, 3, 2, 4,NULL), ('Rado shisharkata', 4, NULL, NUll, 4, 1, 3,NULL), ('Hisarskia pop', 3, NULL, NUll, 5, 4, 2,NULL), ('Valdes', 5, NULL, NUll, 2, 1, 1,NULL) GO --Task 14 CREATE DATABASE CarRental GO USE CarRental GO CREATE TABLE Categories ( Id INT PRIMARY KEY IDENTITY(1,1), CategoryName NVARCHAR(50) NOT NULL, DailyRate INT, WeeklyRate INT, MonthlyRate INT NOT NULL, WeekendRate INT ) GO CREATE TABLE Cars ( Id INT PRIMARY KEY IDENTITY(1,1), Platenumber NVARCHAR(50) NOT NULL UNIQUE, Model NVARCHAR(255) NOT NULL, CarYear INT NOT NULL, CategoryId NVARCHAR(255), Doors INT, Picture NTEXT, Condition NVARCHAR(50) NOT NULL, Available INT NOT NULL ) GO CREATE TABLE Employees ( Id INT PRIMARY KEY IDENTITY(1,1), FirstName NVARCHAR(50) NOT NULL, LastName NVARCHAR(50) NOT NULL, Title NVARCHAR(255) NOT NULL, Notes NVARCHAR(255) ) GO CREATE TABLE Customers ( Id INT PRIMARY KEY IDENTITY(1,1), DriverLicenceNumber INT NOT NULL UNIQUE, FullName NVARCHAR(255) NOT NULL, [Address] NVARCHAR(255), City NVARCHAR(255) NOT NULL, ZIPCode NVARCHAR(255), Notes NVARCHAR(255) ) GO CREATE TABLE RentalOrders ( Id INT PRIMARY KEY IDENTITY(1,1), EmployeeId INT UNIQUE NOT NULL, CustomerId INT UNIQUE NOT NULL, CarId INT NOT NULL, TankLevel INT, KilometrageStart INT NOT NULL, KilometrageEnd INT NOT NULL, TotalKilometrage INT, StartDate DATE, EndDate DATE, TotalDays INT, RateApplied NVARCHAR(50), TaxRate NVARCHAR(50), OrderStatus NVARCHAR(255), Notes NVARCHAR(255) ) GO INSERT INTO Categories(CategoryName, DailyRate, WeeklyRate, MonthlyRate, WeekendRate) VALUES('Sedan', NULL, 3, 100, 2), ('Coupet', 1, NULL, 900, NULL), ('Jeep', 4, 5, 800, 35) GO INSERT INTO Cars(Platenumber, Model, CarYear, CategoryId, Doors, Picture, Condition, Available) VALUES('PB 1488 АС', 'BMW', 2017, NULL,4,NULL,'New', 10), ('PB 1111 CA', 'AUDI', 2017, NULL,2,NULL,'New', 21), ('PB 4444 GA', 'MERCEDES', 2017, NULL,4,NULL,'New', 9) GO INSERT INTO Employees(FirstName, LastName, Title, Notes) VALUES('Pesho','Peshov','Trrrr', NULL), ('Gosho','Goshov','...', NULL), ('Stamat','Stamatov','cccc', NULL) GO INSERT INTO Customers(DriverLicenceNumber, FullName, Address, City, ZIPCode, Notes) VALUES(5821596,'Stamat Stamatov Stamatov',NULL,'Sofia', NULL, NULL), (123513,'Prakash Prakashov Prakashki',NULL,'England', 'TN9T4U', NULL), (09834758,'Softuni Softuniadov',NULL,'Switzerland', NULL, NULL) GO INSERT INTO RentalOrders (EmployeeId, CustomerId, CarId, TankLevel, KilometrageStart, KilometrageEnd, TotalKilometrage, StartDate, EndDate, TotalDays, RateApplied, TaxRate, OrderStatus, Notes) VALUES(5315351, 1351, 5, NULL, 5000, 2351, 1231245, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (53453, 643, 3, NULL, 567876, 12323, 3453453, NULL, NULL, NULL, NULL, NULL, NULL, NULL), (7859647, 123, 2, NULL, 12312, 543536, 367787, NULL, NULL, NULL, NULL, NULL, 'DELIVERED', NULL) GO --Task 15 CREATE DATABASE Hotel GO USE Hotel GO CREATE TABLE Employees ( Id INT IDENTITY PRIMARY KEY, FirstName NVARCHAR(30), LastName NVARCHAR(30), Title NVARCHAR(30), Notes NVARCHAR(max) ) GO CREATE TABLE Customers ( AccountNumber INT, FirstName NVARCHAR(30), LastName NVARCHAR(30), PhoneNumber INT, EmergencyName NVARCHAR(30), EmergencyNumber INT, Notes NVARCHAR(max) ) GO CREATE TABLE RoomStatus ( Id INT PRIMARY KEY, RoomStatus NVARCHAR(20), Notes NVARCHAR(max) ) GO CREATE TABLE RoomTypes ( Id INT PRIMARY KEY, RoomTypes NVARCHAR(20), Notes NVARCHAR(max) ) GO CREATE TABLE BedTypes ( Id INT PRIMARY KEY, BedTypes NVARCHAR(20), Notes NVARCHAR(max) ) GO CREATE TABLE Rooms ( RoomNumber INT PRIMARY KEY, RoomType INT FOREIGN KEY REFERENCES RoomTypes(Id), BedType INT FOREIGN KEY REFERENCES BedTypes(Id), Rate INT, RoomStatus INT FOREIGN KEY REFERENCES RoomStatus(Id), Notes NVARCHAR(max) ) GO CREATE TABLE Payments ( Id INT IDENTITY PRIMARY KEY, EmployeeId INT FOREIGN KEY REFERENCES Employees(Id), PaymentDate DATETIME, AccountNumber INT, FirstDateOccupied DATETIME, LastDateOccupied DATETIME, TotalDays INT, AmountCharged DECIMAL(10,2), TaxRate DECIMAL(10,2), TaxAmount DECIMAL(10,2), PaymentTotal DECIMAL(10,2), Notes NVARCHAR(max) ) GO CREATE TABLE Occupancies ( Id INT IDENTITY PRIMARY KEY, EmployeeId INT FOREIGN KEY REFERENCES Employees(Id), DateOccupied DATETIME, AccountNumber INT, RoomNumber INT, RateApplied DECIMAL(10,2), PhoneCharge DECIMAL(10,2), Notes NVARCHAR(max) ) GO INSERT INTO Employees VALUES('Pesho', 'Peshov', 'Bartender', NULL), ('Gosho', 'Goshov', 'Chef', NULL), ('Prakash', 'Stamatov', 'Bartender', NULL) GO INSERT INTO Customers VALUES(1, 'Stoyannnnn', 'Stoenchev', 088701, NULL, 089522408, null), (2, 'Gosho', 'Peshov', 51410701,NULL, 083395408, null), (3, 'Tosho', 'Goshov', 00098701, NULL, 01895408, null) GO INSERT INTO RoomStatus VALUES(1,'Available', NULL), (2,'Vacated', NULL), (3,'Dirty', NULL) GO INSERT INTO RoomTypes VALUES(1,'King Suite', NULL), (2,'Queen Suite', NULL), (3,'Prince Suite', NULL) GO INSERT INTO BedTypes VALUES(1,'Small', NULL), (2,'Not so big', NULL), (3,'Big', NULL) GO INSERT INTO Rooms VALUES(123, 1 ,null, 80, 1, NULL), (432, 2 ,null, 80, 1, NULL), (333, 3,null, 80, 1, NULL) GO INSERT INTO Payments VALUES(1, NULL, 1, NULL, NULL, 80, 414, 4312, 124, 23, NULL), (2, NULL, 3, NULL, NULL, 80, 414, 4312, 124, 23, NULL), (3, NULL, 2, NULL, NULL, 80, 414, 4312, 124, 23, NULL) GO INSERT INTO Occupancies VALUES(1, NULL, 3, 123, 321, 33, NULL), (2, NULL, 1, 123, 321, 33, NULL), (3, NULL, 2, 123, 321, 33, NULL) GO --Task 16 CREATE DATABASE SoftUni GO USE SoftUni GO CREATE TABLE Towns ( Id INT PRIMARY KEY IDENTITY NOT NULL, Name NVARCHAR(50) NOT NULL ) GO CREATE TABLE Addresses ( Id INT PRIMARY KEY IDENTITY NOT NULL, AddressText NVARCHAR(100) NOT NULL, TownId INT FOREIGN KEY REFERENCES Towns(Id) NOT NULL ) GO CREATE TABLE Departments ( Id INT PRIMARY KEY IDENTITY NOT NULL, [Name] NVARCHAR(50) NOT NULL ) GO CREATE TABLE Employees ( Id INT PRIMARY KEY IDENTITY NOT NULL, FirstName NVARCHAR(50) NOT NULL, MiddleName NVARCHAR(50), LastName NVARCHAR(50), JobTitle NVARCHAR(100) NOT NULL, DepartmentId INT FOREIGN KEY REFERENCES Departments(Id) NOT NULL, HireDate DATE, Salary DECIMAL(10, 2) NOT NULL, AddressId INT FOREIGN KEY REFERENCES Addresses(Id) ) GO --Task 17 BACKUP DATABASE SoftUni TO DISK = 'D:\softuni-backup.bak' USE CarRental DROP DATABASE SoftUni RESTORE DATABASE SoftUni FROM DISK = 'D:\softuni-backup.bak' --Task 18 USE SoftUni GO INSERT INTO Towns(Name) VALUES('Sofia'), ('Plovdiv'), ('Varna'), ('Burgas') GO INSERT INTO Departments(Name) VALUES('Engineering'), ('Sales'), ('Marketing'), ('Software Development'), ('Quality Assurance') GO INSERT INTO Employees(FirstName, MiddleName, LastName, JobTitle, DepartmentId, HireDate, Salary) VALUES('Ivan', 'Ivanov', 'Ivanov', '.NET Developer', 4, CONVERT(DATE, '02/03/2004', 103), 3500.00), ('Petar', 'Petrov', 'Petrov', 'Senior Engineer', 1, CONVERT(DATE, '05/08/2011', 103), 4000.00), ('Maria', 'Ivanova', 'Petrova', 'Intern', 5, CONVERT(DATE, '09/07/2015', 103), 500.00), ('Shaban', 'Qso', 'Shaulich', 'Singer', 2, CONVERT(DATE, '11/11/1800', 103), 5235236.00), ('Mile', 'Qso', 'Kitich', 'Pevec', 8, CONVERT(DATE, '03/12/1950', 103), 324234.00) GO --Task 19 SELECT * FROM Towns GO SELECT * FROM Departments GO SELECT * FROM Employees GO --Task 20 SELECT * FROM Towns ORDER BY Name ASC GO SELECT * FROM Departments ORDER BY Name ASC GO SELECT * FROM Employees ORDER BY Salary DESC GO --Task 21 SELECT [Name] FROM Towns ORDER BY [Name] ASC GO SELECT [Name] FROM Departments ORDER BY [Name] ASC GO SELECT [FirstName], [LastName], [JobTitle], [Salary] FROM Employees ORDER BY Salary DESC --Task 22 UPDATE Employees SET Salary *= 1.10 GO SELECT [Salary] FROM Employees GO --Task 23 USE Hotel UPDATE Payments SET TaxRate -= TaxRate * 3 / 100 GO SELECT TaxRate FROM Payments GO --Task 24 TRUNCATE TABLE Occupancies; GO
20.07309
193
0.708292
9d22b7346a10d5518babdfac5aaa1ab1f9d8598e
2,790
html
HTML
assets/js/app/templates/sellers/sellers.html
lquintero019/floresDupont
627c1271701ebd96bac4ad16ae8347d1bf7a7593
[ "MIT" ]
null
null
null
assets/js/app/templates/sellers/sellers.html
lquintero019/floresDupont
627c1271701ebd96bac4ad16ae8347d1bf7a7593
[ "MIT" ]
null
null
null
assets/js/app/templates/sellers/sellers.html
lquintero019/floresDupont
627c1271701ebd96bac4ad16ae8347d1bf7a7593
[ "MIT" ]
null
null
null
<div class="container" block-ui="main" class="block-ui-main" ng-controller="SellersController"> <div class="page-header"> <h2 class="text-primary">Vendedores</h2> <a ng-click="getSellers()" class="btn btn-primary"><i class="fa fa-refresh"></i>Actualizar</a> <a class="btn btn-success" data-toggle="modal" data-target="#sellersModal" ng-click="changeToSaveData()"><i class="fa fa-user-plus hover-effect" ></i>Agregar Vendedor</a> </div> <form class="form"> <div class="form-group"> <div class="pull-right col-sm-4"> <label>Busqueda:</label> <input type="text" class="form-control" ng-model="filter.$" placeholder="Escribe algo..."> </div> <div class="pull-right col-sm-2"> <label>Paginacion</label> <br> <select class="form-control" ng-model="paginationLimit"> <option value="5">5</option> <option value="10">10</option> <option value="15">15</option> <option value="20">20</option> </select> </div> </div> </form> <table class="table" si-table> <thead> <tr> <th>Nombre</th> <th>Email</th> <th>Acciones</th> </tr> </thead> <tbody> <tr si-sortable ng-repeat="seller in sellers | filter:filter"> <td class="col-md-3">{{ seller.name + " " + seller.lastname}}</td> <td class="col-md-3">{{ seller.email }}</td> <td> <a class="btn btn-primary without-text" title="Editar" data-toggle="modal" data-target="#sellersModal" ng-click="getSelectedSeller(seller.id)"><i class="fa fa-pencil hover-effect"></i></a> <a class="btn btn-danger without-text" data-toggle="tooltip" title="Eliminar" ng-click="deleteSeller(seller.id)")><i class="fa fa-times hover-effect"></i></a> <a class="btn btn-success without-text" data-toggle="tooltip" title="Ver propiedad"><i class="fa fa-eye hover-effect"></i></a> </td> </tr> <tr ng-if="angular.equals({}, sellers)"> <td colspan="100%" style="text-align: center">No has seleccionado </td> </tr> </tbody> <tfoot> <tr> <td colspan="5"> <si-table-pagination limit="{{paginationLimit}}" first-text="Primera pagina" last-text="Ultima pagina" previous-text="«" next-text="»"/> </td> </tr> </tfoot> </table> <div ng-include="'../assets/js/app/templates/sellers/sellersForm.html'"></div> </div>
45.737705
204
0.51828
2d87b8649e0ee47417b444973c4e134010f7c465
1,261
swift
Swift
CIDRTests/CIDRTests.swift
sodastsai/swift-cidr
1e79f5602e34489ae4a5e5ca3546d1b9bdc2fd21
[ "Apache-2.0" ]
2
2016-10-05T05:09:22.000Z
2018-02-04T00:57:44.000Z
CIDRTests/CIDRTests.swift
sodastsai/swift-cidr
1e79f5602e34489ae4a5e5ca3546d1b9bdc2fd21
[ "Apache-2.0" ]
null
null
null
CIDRTests/CIDRTests.swift
sodastsai/swift-cidr
1e79f5602e34489ae4a5e5ca3546d1b9bdc2fd21
[ "Apache-2.0" ]
null
null
null
// // CIDRTests.swift // CIDRTests // // Copyright 2016 TIEN-CHE TSAI // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // import XCTest @testable import CIDR class CIDRCreationTests: XCTestCase { func testCreation() { let cidr1 = CIDRv4(ipAddress: "8.8.8.8", prefix: 32)! XCTAssertEqual(String(cidr1), "8.8.8.8/32") let cidr2: CIDRv4 = "8.8.4.4/31" XCTAssertEqual(String(cidr2), "8.8.4.4/31") XCTAssertEqual(cidr2.count, 2) } func testCount() { XCTAssertEqual(CIDRv4(ipAddress: "8.8.8.8", prefix: 32)!.count, 1) XCTAssertEqual(CIDRv4(ipAddress: "8.8.4.4", prefix: 31)!.count, 2) XCTAssertEqual(CIDRv4(ipAddress: "8.8.4.4", prefix: 16)!.count, 65536) } }
30.756098
78
0.666931
6c5910963535ce3152eb0a7be0efcb32fb9e86d5
391
go
Go
announce/impl/postgresCatcher_test.go
BruceWangNo1/notorious
4a8d9a733870f7bc8f46a03573ba2684f8ba2229
[ "MIT" ]
193
2016-04-05T15:03:29.000Z
2019-06-03T15:08:27.000Z
announce/impl/postgresCatcher_test.go
BruceWangNo1/notorious
4a8d9a733870f7bc8f46a03573ba2684f8ba2229
[ "MIT" ]
116
2016-02-15T02:52:51.000Z
2019-01-31T23:01:35.000Z
announce/impl/postgresCatcher_test.go
BruceWangNo1/notorious
4a8d9a733870f7bc8f46a03573ba2684f8ba2229
[ "MIT" ]
17
2016-03-30T02:13:35.000Z
2019-05-24T21:35:30.000Z
package catcherImpl import ( "github.com/GrappigPanda/notorious/config" "testing" ) var CONFIG = config.ConfigStruct{ "postgres", "localhost", "5432", "postgres", "", "testdb", false, nil, false, } func TestNewCatcher(t *testing.T) { _ = NewPostgresCatcher(CONFIG) } func TestHandleTorrent(t *testing.T) { catcher := NewPostgresCatcher(CONFIG) catcher.HandleNewTorrent() }
13.964286
43
0.710997
ac4db2914e77a0a27f04bca2a03d71763d204bae
1,102
kt
Kotlin
app/src/main/java/com/finalweek10/permission/ui/groupsapp/GroupsAppModule.kt
DeweyReed/PermissionLibrary
029e23135e4f67f4697fe6c6b7546b75f2fa662c
[ "MIT" ]
9
2018-08-09T08:51:01.000Z
2021-09-16T10:45:19.000Z
app/src/main/java/com/finalweek10/permission/ui/groupsapp/GroupsAppModule.kt
DeweyReed/PermissionLibrary
029e23135e4f67f4697fe6c6b7546b75f2fa662c
[ "MIT" ]
4
2018-08-26T10:06:09.000Z
2018-09-08T01:59:53.000Z
app/src/main/java/com/finalweek10/permission/ui/groupsapp/GroupsAppModule.kt
DeweyReed/PermissionLibrary
029e23135e4f67f4697fe6c6b7546b75f2fa662c
[ "MIT" ]
4
2018-09-18T19:39:57.000Z
2020-10-07T09:29:47.000Z
package com.finalweek10.permission.ui.groupsapp import com.finalweek10.permission.data.model.VisibleGroup import com.finalweek10.permission.di.ActivityScoped import com.finalweek10.permission.di.FragmentScoped import com.finalweek10.permission.ui.main.MainContract import com.finalweek10.permission.ui.main.app.AppsPresenter import dagger.Binds import dagger.Module import dagger.Provides import dagger.android.ContributesAndroidInjector @Suppress("unused") @Module abstract class GroupsAppModule { @FragmentScoped @ContributesAndroidInjector abstract fun groupsAppFragment(): GroupsAppFragment @ActivityScoped @Binds abstract fun groupsAppPresenter(presenter: AppsPresenter) : MainContract.AppsPresenter @Module companion object { @JvmStatic @Provides @ActivityScoped internal fun provideGroup(activity: GroupsAppActivity): VisibleGroup = activity.intent?.getParcelableExtra(GroupsAppActivity.EXTRA_GROUP) ?: VisibleGroup(0, "", "", null, 0) } }
31.485714
82
0.728675
3aed7879191184149256779b2ee61bc881e95d6f
126
kt
Kotlin
src/main/kotlin/com/between_freedom_and_space/mono_backend/access/service/model/BaseAccessRuleModel.kt
Between-freedom-and-Space/Backend
fc0123f0120116b26213072266750d6be368e283
[ "Apache-2.0" ]
null
null
null
src/main/kotlin/com/between_freedom_and_space/mono_backend/access/service/model/BaseAccessRuleModel.kt
Between-freedom-and-Space/Backend
fc0123f0120116b26213072266750d6be368e283
[ "Apache-2.0" ]
null
null
null
src/main/kotlin/com/between_freedom_and_space/mono_backend/access/service/model/BaseAccessRuleModel.kt
Between-freedom-and-Space/Backend
fc0123f0120116b26213072266750d6be368e283
[ "Apache-2.0" ]
null
null
null
package com.between_freedom_and_space.mono_backend.access.service.model data class BaseAccessRuleModel( val id: Long, )
18
71
0.809524
c8d5bed646af4e99212ec6014c55ac3f59068bbc
523
kt
Kotlin
kafka-suite/src/main/kotlin/dev/vasas/kafkasuite/junit5/KafkaSuite.kt
szvasas/kafka-suite
1d7f57aff1472071627936371e98ceecbda3b3b5
[ "MIT" ]
null
null
null
kafka-suite/src/main/kotlin/dev/vasas/kafkasuite/junit5/KafkaSuite.kt
szvasas/kafka-suite
1d7f57aff1472071627936371e98ceecbda3b3b5
[ "MIT" ]
null
null
null
kafka-suite/src/main/kotlin/dev/vasas/kafkasuite/junit5/KafkaSuite.kt
szvasas/kafka-suite
1d7f57aff1472071627936371e98ceecbda3b3b5
[ "MIT" ]
null
null
null
package dev.vasas.kafkasuite.junit5 import dev.vasas.kafkasuite.cluster.DockerKafkaCluster import org.junit.jupiter.api.AfterAll import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.TestInstance @TestInstance(TestInstance.Lifecycle.PER_CLASS) interface KafkaSuite { val kafkaCluster: DockerKafkaCluster @BeforeAll @JvmDefault fun kafkaSuiteBeforeAll() { kafkaCluster.start() } @AfterAll @JvmDefault fun kafkaSuiteAfterAll() { kafkaCluster.stop() } }
20.115385
54
0.741874
c2347d3a0e3cc1bc1a88841e2bbcc6457b12bf86
1,455
go
Go
flags.go
fishy/godrive-fuse
04350b97d91e605c1672901a76f38d025a1de65d
[ "BSD-3-Clause" ]
null
null
null
flags.go
fishy/godrive-fuse
04350b97d91e605c1672901a76f38d025a1de65d
[ "BSD-3-Clause" ]
null
null
null
flags.go
fishy/godrive-fuse
04350b97d91e605c1672901a76f38d025a1de65d
[ "BSD-3-Clause" ]
null
null
null
package main import ( "flag" "fmt" "os" "path/filepath" ) // Flags. var ( configDir = flag.String( "config-dir", getDefaultConfigDir(), fmt.Sprintf( `The directory to config files, by default $XDG_CONFIG_HOME/%s will be used`, ConfigSubDir, ), ) profile = flag.String( "profile", "default", "If you have more than one google account, use this to contrrol which account to use", ) noDaemon = flag.Bool( "no-daemon", false, "By default mount command is run in daemon mode, use this flag to disable that behavior and run it in foreground instead", ) ) // ConfigSubDir is the subdir under root config directory. const ConfigSubDir = "godrive-fuse" func getDefaultConfigDir() string { configDir := os.Getenv("XDG_CONFIG_HOME") if configDir != "" { return filepath.Join(configDir, ConfigSubDir) } return filepath.Join(os.Getenv("HOME"), ".config", ConfigSubDir) } func setFlagUsage() { flag.Usage = func() { fmt.Fprintf( flag.CommandLine.Output(), `Usage: %s [args] command [command args] Commands: help: Show this message. init: Initialize the config file before first use. mount [drive-directory] [local-directory]: Mount the specified Drive directory to the local directory. If drive-directory is omitted, root Google Drive directory will be used. If both args are omitted, map all mountpoints defined in the config file instead. Args: `, os.Args[0], ) flag.PrintDefaults() } }
21.086957
124
0.704467
17674f7afa31fb8186241be6f00e93381882d7d6
1,792
kt
Kotlin
android-sdk/src/main/java/webtrekk/android/sdk/util/RoomUtil.kt
Neno0o/webtrekk-new-android-sdk
f493dfe7e85591e6806fa3a94c50e394eda3cb60
[ "MIT" ]
8
2019-03-28T14:15:25.000Z
2019-10-10T11:56:26.000Z
android-sdk/src/main/java/webtrekk/android/sdk/util/RoomUtil.kt
Neno0o/webtrekk-android-sdk-BETA
f493dfe7e85591e6806fa3a94c50e394eda3cb60
[ "MIT" ]
4
2021-05-21T10:59:45.000Z
2022-03-16T16:10:47.000Z
android-sdk/src/main/java/webtrekk/android/sdk/util/RoomUtil.kt
Neno0o/webtrekk-android-sdk-BETA
f493dfe7e85591e6806fa3a94c50e394eda3cb60
[ "MIT" ]
1
2019-07-22T13:55:45.000Z
2019-07-22T13:55:45.000Z
/* * MIT License * * Copyright (c) 2019 Webtrekk GmbH * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ package webtrekk.android.sdk.util import android.content.Context import androidx.room.Room import androidx.room.RoomDatabase /** * A generic helper function for building a room database. Returns an instance of [RoomDatabase]. * * @param [context] the app context. * @param [databaseName] the database name. * @param [database] the database class that extends [RoomDatabase]. */ fun <T : RoomDatabase> buildRoomDatabase( context: Context, databaseName: String, database: Class<T> ): T = Room.databaseBuilder( context.applicationContext, database, databaseName ).fallbackToDestructiveMigration().build()
37.333333
97
0.744978
e73902f544d229f1c24bc8294a348c69a852dc90
1,639
sql
SQL
tests/dibi/data/sqlite.sql
MartinMajor/dibi
89e92d24a2668695d606baa29eea8e5d925c9054
[ "BSD-3-Clause" ]
null
null
null
tests/dibi/data/sqlite.sql
MartinMajor/dibi
89e92d24a2668695d606baa29eea8e5d925c9054
[ "BSD-3-Clause" ]
null
null
null
tests/dibi/data/sqlite.sql
MartinMajor/dibi
89e92d24a2668695d606baa29eea8e5d925c9054
[ "BSD-3-Clause" ]
null
null
null
CREATE TABLE [products] ( [product_id] INTEGER NOT NULL PRIMARY KEY, [title] VARCHAR(100) NOT NULL ); CREATE INDEX "title" ON "products" ("title"); INSERT INTO "products" ("product_id", "title") VALUES (1, 'Chair'); INSERT INTO "products" ("product_id", "title") VALUES (2, 'Table'); INSERT INTO "products" ("product_id", "title") VALUES (3, 'Computer'); CREATE TABLE [customers] ( [customer_id] INTEGER PRIMARY KEY NOT NULL, [name] VARCHAR(100) NOT NULL ); INSERT INTO "customers" ("customer_id", "name") VALUES (1, 'Dave Lister'); INSERT INTO "customers" ("customer_id", "name") VALUES (2, 'Arnold Rimmer'); INSERT INTO "customers" ("customer_id", "name") VALUES (3, 'The Cat'); INSERT INTO "customers" ("customer_id", "name") VALUES (4, 'Holly'); INSERT INTO "customers" ("customer_id", "name") VALUES (5, 'Kryten'); INSERT INTO "customers" ("customer_id", "name") VALUES (6, 'Kristine Kochanski'); CREATE TABLE [orders] ( [order_id] INTEGER NOT NULL PRIMARY KEY, [customer_id] INTEGER NOT NULL, [product_id] INTEGER NOT NULL, [amount] FLOAT NOT NULL, CONSTRAINT orders_product FOREIGN KEY (product_id) REFERENCES products (product_id), CONSTRAINT orders_customer FOREIGN KEY (customer_id) REFERENCES customers (customer_id) ); INSERT INTO "orders" ("order_id", "customer_id", "product_id", "amount") VALUES (1, 2, 1, '7.0'); INSERT INTO "orders" ("order_id", "customer_id", "product_id", "amount") VALUES (2, 2, 3, '2.0'); INSERT INTO "orders" ("order_id", "customer_id", "product_id", "amount") VALUES (3, 1, 2, '3.0'); INSERT INTO "orders" ("order_id", "customer_id", "product_id", "amount") VALUES (4, 6, 3, '5.0');
44.297297
97
0.691885
f0068035c6bebf4ad8dfcbde5996ed5461d03f51
345
py
Python
scripts/utils/merge.py
GabrielTavernini/TelegramMap
96879d037a3e65b555a8f13f4f468645a02cf1f2
[ "MIT" ]
3
2021-02-19T21:43:49.000Z
2022-03-30T07:50:06.000Z
scripts/utils/merge.py
GabrielTavernini/TelegramMap
96879d037a3e65b555a8f13f4f468645a02cf1f2
[ "MIT" ]
null
null
null
scripts/utils/merge.py
GabrielTavernini/TelegramMap
96879d037a3e65b555a8f13f4f468645a02cf1f2
[ "MIT" ]
2
2021-02-20T16:50:48.000Z
2022-01-25T15:15:07.000Z
import pandas as pd import sys from dotenv import load_dotenv load_dotenv() src = pd.read_csv(sys.argv[1]) dst = pd.read_csv(os.getenv('FILE_PATH')) fdf = pd.concat([dst, src]) fdf = fdf[~((fdf['user'].duplicated(keep='first')) & (fdf['user']!='Point'))] fdf = fdf[~fdf.duplicated(keep='first')] fdf.to_csv(os.getenv('FILE_PATH'), index=False)
28.75
77
0.692754
48df4f2c3062c615e048a3f6dbea8a5eabd85096
464
h
C
header6.6.1/WebSearchLocalPageCellDelegate-Protocol.h
CrackerCat/iWeChat
7b3dbc48090e2d60cb72417563c554777eded15f
[ "MIT" ]
1,694
2018-05-04T12:34:53.000Z
2022-03-23T10:33:46.000Z
header6.6.1/WebSearchLocalPageCellDelegate-Protocol.h
CrackerCat/iWeChat
7b3dbc48090e2d60cb72417563c554777eded15f
[ "MIT" ]
6
2018-09-22T16:32:43.000Z
2020-04-20T02:10:19.000Z
header6.6.1/WebSearchLocalPageCellDelegate-Protocol.h
CrackerCat/iWeChat
7b3dbc48090e2d60cb72417563c554777eded15f
[ "MIT" ]
236
2018-05-05T11:00:28.000Z
2022-03-09T03:57:28.000Z
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import "NSObject-Protocol.h" @class NSString, RelevantSearchResult_ResultItem; @protocol WebSearchLocalPageCellDelegate <NSObject> @optional - (void)onClickSearchLocalPageItem:(RelevantSearchResult_ResultItem *)arg1 wordIndex:(long long)arg2 searchId:(NSString *)arg3; @end
27.294118
127
0.75431
5c6e68e5ef6746c8706c2a47277a85fadf811a07
1,938
h
C
lib/node_add_on/win/wrap/customized_ui_components_wrap/customized_annotation_obj_wrap.h
pramesywaraj/zoom-react-electron-implementation
94583834fe47dd29309114733c904ddcafdf928e
[ "MIT" ]
null
null
null
lib/node_add_on/win/wrap/customized_ui_components_wrap/customized_annotation_obj_wrap.h
pramesywaraj/zoom-react-electron-implementation
94583834fe47dd29309114733c904ddcafdf928e
[ "MIT" ]
null
null
null
lib/node_add_on/win/wrap/customized_ui_components_wrap/customized_annotation_obj_wrap.h
pramesywaraj/zoom-react-electron-implementation
94583834fe47dd29309114733c904ddcafdf928e
[ "MIT" ]
null
null
null
#pragma once #include "common_include.h" BEGIN_ZOOM_SDK_NAMESPACE BEGIN_CLASS_DEFINE_WITHCALLBACK(ICustomizedAnnotationObj, ICustomizedAnnotationObjEvent) NORMAL_CLASS(ICustomizedAnnotationObj) ~ICustomizedAnnotationObjWrap(); void Init(ICustomizedAnnotationObj* pObj); void UnInit(); //virtual SDKError SetEvent(ICustomizedAnnotationObjEvent* event_) = 0; DEFINE_FUNC_1(SetEvent, SDKError, ICustomizedAnnotationObjEvent*, pEvent) //virtual SDKError CanClear(AnnotationClearType type) = 0; DEFINE_FUNC_1(CanClear, SDKError, AnnotationClearType, type) //virtual SDKError Clear(AnnotationClearType type) = 0; DEFINE_FUNC_1(Clear, SDKError, AnnotationClearType, type) //virtual SDKError SetTool(AnnotationToolType type) = 0; DEFINE_FUNC_1(SetTool, SDKError, AnnotationToolType, type) //virtual SDKError SetColor(unsigned long color) = 0; DEFINE_FUNC_1(SetColor, SDKError, unsigned long, color) //virtual SDKError SetLineWidth(long lineWidth) = 0; DEFINE_FUNC_1(SetLineWidth, SDKError, long, lineWidth) //virtual SDKError GetCurColor(unsigned long& color) = 0; DEFINE_FUNC_1(GetCurColor, SDKError, unsigned long&, color) //virtual SDKError GetCurLineWidth(long& lineWidth) = 0; DEFINE_FUNC_1(GetCurLineWidth, SDKError, long&, lineWidth) //virtual SDKError GetCurTool(AnnotationToolType& type) = 0; DEFINE_FUNC_1(GetCurTool, SDKError, AnnotationToolType&, type) //virtual SDKError Undo() = 0; DEFINE_FUNC_0(Undo, SDKError); //virtual SDKError Redo() = 0; DEFINE_FUNC_0(Redo, SDKError); //virtual SDKError CanSaveSnapshot() = 0; DEFINE_FUNC_0(CanSaveSnapshot, SDKError); //virtual SDKError SaveSnapshot(const wchar_t* path, SDKAnnoSaveType nType) = 0; DEFINE_FUNC_2(SaveSnapshot, SDKError, const wchar_t*, path, SDKAnnoSaveType, nType); //virtual void onAnnotationObjToolChange(AnnotationToolType type_); CallBack_FUNC_1(onAnnotationObjToolChange, AnnotationToolType, type_) END_CLASS_DEFINE(ICustomizedAnnotationObj) END_ZOOM_SDK_NAMESPACE
47.268293
88
0.823013
55d0a81407a9fe7d7b4a3de134bf5db31a6c535b
409
swift
Swift
Flows/TagsFlow/Tests/TagsFlowTests/TagsFlowTests.swift
Blissfulman/StackOv
fae331e3adc74c52b043b35284aa16bd1ecf2321
[ "MIT" ]
1
2021-03-05T11:58:10.000Z
2021-03-05T11:58:10.000Z
Flows/TagsFlow/Tests/TagsFlowTests/TagsFlowTests.swift
Blissfulman/StackOv
fae331e3adc74c52b043b35284aa16bd1ecf2321
[ "MIT" ]
null
null
null
Flows/TagsFlow/Tests/TagsFlowTests/TagsFlowTests.swift
Blissfulman/StackOv
fae331e3adc74c52b043b35284aa16bd1ecf2321
[ "MIT" ]
null
null
null
import XCTest @testable import TagsFlow final class TagsFlowTests: XCTestCase { func testExample() { // This is an example of a functional test case. // Use XCTAssert and related functions to verify your tests produce the correct // results. XCTAssertEqual(TagsFlow().text, "Hello, World!") } static var allTests = [ ("testExample", testExample), ] }
25.5625
87
0.647922
02b4d33c33d37fd231df7fe3b51d6458b5e967bd
287
sql
SQL
finance/egov/egov-collection/src/main/resources/db/migration/main/V20160222121224__collection_collectionindex_alter_DDL.sql
pradeepkumarcm-egov/DIGIT-Dev
d8fb601fae6d919d2386f36b36dfc7fde77ebd4f
[ "MIT" ]
11
2021-04-22T13:18:00.000Z
2021-07-13T06:24:48.000Z
finance/egov/egov-collection/src/main/resources/db/migration/main/V20160222121224__collection_collectionindex_alter_DDL.sql
pradeepkumarcm-egov/DIGIT-Dev
d8fb601fae6d919d2386f36b36dfc7fde77ebd4f
[ "MIT" ]
56
2019-09-24T00:12:41.000Z
2022-02-01T00:58:00.000Z
finance/egov/egov-collection/src/main/resources/db/migration/main/V20160222121224__collection_collectionindex_alter_DDL.sql
pradeepkumarcm-egov/DIGIT-Dev
d8fb601fae6d919d2386f36b36dfc7fde77ebd4f
[ "MIT" ]
17
2019-03-06T05:39:47.000Z
2022-03-02T13:34:37.000Z
alter table eg_collectionindex drop column installmentfromdate; alter table eg_collectionindex drop column installmenttodate; alter table eg_collectionindex add column installmentfrom character varying(50); alter table eg_collectionindex add column installmentto character varying(50);
47.833333
80
0.87108
980d793cb190f8faff4eb926fc185298641365a6
949
lua
Lua
main.lua
1hiking/Fish-with-Polar-Boi
46cc5548c158fb2a672087e0f6cc508ab10ac443
[ "Apache-2.0" ]
null
null
null
main.lua
1hiking/Fish-with-Polar-Boi
46cc5548c158fb2a672087e0f6cc508ab10ac443
[ "Apache-2.0" ]
null
null
null
main.lua
1hiking/Fish-with-Polar-Boi
46cc5548c158fb2a672087e0f6cc508ab10ac443
[ "Apache-2.0" ]
null
null
null
require("player") require("fishingrod") function love.load() -- folder/resource Background = love.graphics.newImage("assets/Lake.jpg") BackgroundWidth = Background:getWidth() BackgroundHeight = Background:getHeight() Music = love.audio.newSource("assets/Music.mp3", "stream") --[[Stream is better for longer music, read docs: https://love2d.org/wiki/Tutorial:Audio load Player ]] Player:load() FishingRod:load() end function love.update(dt) if not Music:isPlaying() then love.audio.play(Music) end FishingRod:update(dt) end function love.draw() --[[ Draws Background --> Player Reversing this order will make player not visible since the background which is drawn second, blocks him ]] love.graphics.draw(Background, 0, 0, 0, love.graphics.getWidth()/BackgroundWidth, love.graphics.getHeight()/BackgroundHeight) Player:draw() FishingRod:draw() end
26.361111
129
0.6902
2f114daa7a4a65c689fc2d97bda8ed51f135c084
1,587
kt
Kotlin
app/src/main/java/com/example/androidviper/BaseActivity/BaseFragment.kt
Allan-Nava/AndroidVIPER
9be804991be209641ab0e3ba2d606a3e6f80dffd
[ "MIT" ]
1
2021-01-19T15:05:21.000Z
2021-01-19T15:05:21.000Z
app/src/main/java/com/example/androidviper/BaseActivity/BaseFragment.kt
Allan-Nava/AndroidVIPER
9be804991be209641ab0e3ba2d606a3e6f80dffd
[ "MIT" ]
1
2022-02-28T20:16:11.000Z
2022-02-28T20:16:11.000Z
app/src/main/java/com/example/androidviper/BaseActivity/BaseFragment.kt
Allan-Nava/AndroidVIPER
9be804991be209641ab0e3ba2d606a3e6f80dffd
[ "MIT" ]
null
null
null
package com.example.androidviper.BaseActivity import android.content.Context import android.content.ContextWrapper import android.graphics.drawable.Drawable import androidx.fragment.app.Fragment /** * Created by Allan Nava on 15/01/2021. * Updated by Allan Nava on 23/01/2021. **/ abstract class BaseFragment: Fragment(), BaseContracts.View { fun getBaseActivity(): BaseActivity? { var context = context while (context is ContextWrapper) { if (context is BaseActivity) { return context } context = context.baseContext } return null } val mScreenWidth: Int get() { return getBaseActivity()?.getWindowManager()?.getDefaultDisplay()?.getWidth()!! } val mScreenHeight: Int get() { return getBaseActivity()?.getWindowManager()?.getDefaultDisplay()?.getHeight()!! } override fun getActivityContext(): Context? { return getBaseActivity() } override fun showErrorDialog(error: String?) { getBaseActivity()?.showErrorDialog(error) } override fun showCustomDialog( string: String, icon: Drawable? ){ getBaseActivity()?.showCustomDialog(string, icon) } var statusBarHeight: Int = 0 get(){ var result = 0 val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android") if (resourceId > 0) { result = resources.getDimensionPixelSize(resourceId) } return result } }
27.842105
93
0.619408
51b56d9629ae3a8de70f0277369a6aa395964682
262
sql
SQL
sql/data/2016-12-07.sql
chili-dog-night/site
0b5c832661947db56e50fc14957901a4d04aeef5
[ "MIT" ]
null
null
null
sql/data/2016-12-07.sql
chili-dog-night/site
0b5c832661947db56e50fc14957901a4d04aeef5
[ "MIT" ]
null
null
null
sql/data/2016-12-07.sql
chili-dog-night/site
0b5c832661947db56e50fc14957901a4d04aeef5
[ "MIT" ]
null
null
null
INSERT INTO media ( title, uri, rating, viewed_at, created_at ) VALUES ('Happy Christmas', 'http://www.imdb.com/title/tt2955096/', 1000, '2016-12-07', now()), ('12 Dates of Christmas', 'http://www.imdb.com/title/tt1846442/', 1000, '2016-12-07', now())
21.833333
92
0.656489
dda3c4ea70b240bed79d81342f883ea3e68fb5b9
1,101
php
PHP
app/repositories/NoteRepository.php
kalodiodev/plain-notes
5dde800279c8094121e8ed9bc8211bf660ea3f25
[ "MIT" ]
null
null
null
app/repositories/NoteRepository.php
kalodiodev/plain-notes
5dde800279c8094121e8ed9bc8211bf660ea3f25
[ "MIT" ]
null
null
null
app/repositories/NoteRepository.php
kalodiodev/plain-notes
5dde800279c8094121e8ed9bc8211bf660ea3f25
[ "MIT" ]
null
null
null
<?php namespace App\Repository; use App\Model\Note; use App\Model\User; /** * Interface Note Repository * * @package App\Repository */ interface NoteRepository { /** * Get all user's notes * * @param User $user * @return mixed */ function all(User $user); /** * Get note by id * * @param $id * @param User $user * @return mixed */ function find($id, User $user); /** * Add note * * @param Note $note * @return mixed */ function add(Note $note); /** * Update note * * @param Note $note * @param User $user */ function update(Note $note, User $user); /** * Delete note * * @param $id * @return mixed */ function delete($id); /** * All user's notes paginated * * @param User $user * @param $page * @return mixed */ function paginated(User $user, $page); /** * Count user's notes * * @param User $user * @return mixed */ function count(User $user); }
15.291667
44
0.497729
b2d2f0394cea895eb88a51c785769332faca9031
844
py
Python
blog/tasks.py
iloveyougit/ylink2
a87d8fde79ab259012cd6486299fcf86e1afc740
[ "MIT" ]
null
null
null
blog/tasks.py
iloveyougit/ylink2
a87d8fde79ab259012cd6486299fcf86e1afc740
[ "MIT" ]
null
null
null
blog/tasks.py
iloveyougit/ylink2
a87d8fde79ab259012cd6486299fcf86e1afc740
[ "MIT" ]
null
null
null
from __future__ import absolute_import, unicode_literals import string from django.contrib.auth.models import User from django.utils.crypto import get_random_string from celery import shared_task, current_task @shared_task def create_random_user_accounts(total_user): for i in range(total_user): username = 'user_%s' % get_random_string(20, string.ascii_letters) email = '%s@example.com' % username password = get_random_string(50) User.objects.create_user(username=username, email=email, password=password) current_task.update_state(state='PROGRESS', meta={'current': i, 'total': total_user, 'percent': int((float(i) / total_user) * 100)}) return {'current': total_user, 'total': total_user, 'percent': 100}
29.103448
87
0.667062
04ad94990fc7c2188f5582a96ce84e176f4eb734
209
html
HTML
templates/map.tmpl.html
JSchermers/neighborhoodmap
4eb470c7fbac29c2ef55e484b424fdb9053dff8a
[ "MIT" ]
null
null
null
templates/map.tmpl.html
JSchermers/neighborhoodmap
4eb470c7fbac29c2ef55e484b424fdb9053dff8a
[ "MIT" ]
null
null
null
templates/map.tmpl.html
JSchermers/neighborhoodmap
4eb470c7fbac29c2ef55e484b424fdb9053dff8a
[ "MIT" ]
null
null
null
<!-- add myMap to custom knockout binding handler --> <h2>The google map (city arms)</h2> <div id="google-map" class="google-map" data-bind="googlemap: myMap" aria-label="google map with city points"> </div>
34.833333
110
0.703349
fd8ac5b15b5caac6b854541bb70f37577601fcd4
227
h
C
Example/HBWebBridge/HBViewController.h
Neojoke/HBWebBridge
6107a6d57fe52849ef02d8c49522231be0362d1e
[ "MIT" ]
null
null
null
Example/HBWebBridge/HBViewController.h
Neojoke/HBWebBridge
6107a6d57fe52849ef02d8c49522231be0362d1e
[ "MIT" ]
null
null
null
Example/HBWebBridge/HBViewController.h
Neojoke/HBWebBridge
6107a6d57fe52849ef02d8c49522231be0362d1e
[ "MIT" ]
null
null
null
// // HBViewController.h // HBWebBridge // // Created by 394570610@qq.com on 11/16/2017. // Copyright (c) 2017 394570610@qq.com. All rights reserved. // @import UIKit; @interface HBViewController : UIViewController @end
16.214286
61
0.709251
fa51329ec027b31e2525b04f9e73944bc51dc52d
403
swift
Swift
RJSmartDoorSDK/ui/src/http/HTTPStatusCode.swift
EaseLi/RJSmartDoorSDK
b2504c512dea9d78ab538b3f49540738516fb106
[ "MIT" ]
1
2019-09-17T15:10:37.000Z
2019-09-17T15:10:37.000Z
RJSmartDoorSDK/ui/src/http/HTTPStatusCode.swift
EaseLi/RJSmartDoorSDK
b2504c512dea9d78ab538b3f49540738516fb106
[ "MIT" ]
null
null
null
RJSmartDoorSDK/ui/src/http/HTTPStatusCode.swift
EaseLi/RJSmartDoorSDK
b2504c512dea9d78ab538b3f49540738516fb106
[ "MIT" ]
null
null
null
// // HTTPStatusCode.swift // RJSmartDoor // // Created by Ruijia on 16/6/22. // Copyright © 2016年 Ruijia. All rights reserved. // import Foundation struct HttpStatusCode { init(CODE:Int, MESSAGE:String) { self.CODE = CODE self.MESSAGE = MESSAGE } let CODE:Int let MESSAGE:String static let SUCCESS=HttpStatusCode(CODE: 200, MESSAGE: "成功") }
17.521739
63
0.622829
3beb28b52bc90aa91e980ce7a8ecc3e5e9a7e7ce
849
h
C
Frameworks/WCRLiveCore.framework/Headers/WCRMessageChannelTypedef.h
MagicSchooliOS/WCRLiveCorePod
229eae6460c514f54329778485e1ff79eda7c82f
[ "MIT" ]
null
null
null
Frameworks/WCRLiveCore.framework/Headers/WCRMessageChannelTypedef.h
MagicSchooliOS/WCRLiveCorePod
229eae6460c514f54329778485e1ff79eda7c82f
[ "MIT" ]
null
null
null
Frameworks/WCRLiveCore.framework/Headers/WCRMessageChannelTypedef.h
MagicSchooliOS/WCRLiveCorePod
229eae6460c514f54329778485e1ff79eda7c82f
[ "MIT" ]
null
null
null
// // WCRMessageChannelTypedef.h // WCRMessageChannelSDK // // Created by juvham on 2019/3/15. // Copyright © 2019 juvham. All rights reserved. // #ifndef WCRMessageChannelTypedef_h #define WCRMessageChannelTypedef_h /** 发送消息的结果,非WCRSendMessageResultOK为发送失败 - WCRSendMessageResultOK: 成功 - WCRSendMessageResultTimeout: 超时 - WCRSendMessageResultBusy: 服务繁忙 - WCRSendMessageResultError: 出错 */ typedef NS_ENUM(NSUInteger, WCRMCSendMessageResult) { WCRMCSendMessageResultOK = 0, WCRMCSendMessageResultTimeout, WCRMCSendMessageResultBusy, WCRMCSendMessageResultError }; /** 发送消息的回调 @param result 结果,@see WCRSendMessageResult @param callbackInfo 回调信息数组,一般取firstObject */ typedef void(^WCRMCSendMessageCallback)(WCRMCSendMessageResult result, NSArray *_Nullable callbackInfo); #endif /* WCRMessageChannelTypedef_h */
21.769231
104
0.78563
0242e96a521e47c9b93ee9d60275f52feb5f56e6
2,614
kt
Kotlin
ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/ProgressSemantics.kt
digitalbuddha/androidx
03a8f7cfffc74435a23aeae0084ed2f3b84728fd
[ "Apache-2.0" ]
1
2020-09-06T20:07:54.000Z
2020-09-06T20:07:54.000Z
ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/ProgressSemantics.kt
digitalbuddha/androidx
03a8f7cfffc74435a23aeae0084ed2f3b84728fd
[ "Apache-2.0" ]
null
null
null
ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/ProgressSemantics.kt
digitalbuddha/androidx
03a8f7cfffc74435a23aeae0084ed2f3b84728fd
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package androidx.compose.foundation import androidx.compose.runtime.Stable import androidx.compose.ui.Modifier import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.AccessibilityRangeInfo import androidx.compose.ui.semantics.accessibilityValue import androidx.compose.ui.semantics.accessibilityValueRange import androidx.compose.ui.util.annotation.FloatRange import androidx.compose.ui.util.format import kotlin.math.roundToInt /** * Contains the [semantics] required for a determinate progress indicator, that represents progress * ranging from 0.0 to 1.0. Values for [progress] outside of this range will be coerced into this * range. * * @sample androidx.compose.foundation.samples.DeterminateProgressSemanticsSample * * @param progress The progress of this progress indicator, where 0.0 represents no progress and 1.0 * represents full progress. If the value is outside of this range, it will be coerced into the * range. */ @Stable fun Modifier.progressSemantics( @FloatRange(from = 0.0, to = 1.0) progress: Float ): Modifier { @Suppress("NAME_SHADOWING") val progress = progress.coerceIn(0f, 1f) // We only display 0% or 100% when it is exactly 0% or 100%. val percent = when (progress) { 0f -> 0 1f -> 100 else -> (progress * 100).roundToInt().coerceIn(1, 99) } return semantics { accessibilityValue = Strings.TemplatePercent.format(percent) accessibilityValueRange = AccessibilityRangeInfo(progress, 0f..1f) } } /** * Contains the [semantics] required for an indeterminate progress indicator, that represents the * fact of the in-progress operation. * * If you need determinate progress 0.0 to 1.0, consider using overload with the progress * parameter. * * @sample androidx.compose.foundation.samples.IndeterminateProgressSemanticsSample * */ @Stable fun Modifier.progressSemantics(): Modifier { return semantics { accessibilityValue = Strings.InProgress } }
35.808219
100
0.750191
558d2280fd0e9ff350e49278622ad03cf0d0aac6
533
kt
Kotlin
app/src/main/java/com/architectcoders/arquitectomarvel/data/server/uiEntities/comics/ComicImageApi.kt
Architect-Coders-Team-2/ArquitectoMarvel
4cb902655d8328cebc9e6c874800f5cc71f18943
[ "MIT" ]
null
null
null
app/src/main/java/com/architectcoders/arquitectomarvel/data/server/uiEntities/comics/ComicImageApi.kt
Architect-Coders-Team-2/ArquitectoMarvel
4cb902655d8328cebc9e6c874800f5cc71f18943
[ "MIT" ]
52
2021-03-20T19:00:17.000Z
2021-10-09T11:44:23.000Z
app/src/main/java/com/architectcoders/arquitectomarvel/data/server/uiEntities/comics/ComicImageApi.kt
Architect-Coders-Team-2/ArquitectoMarvel
4cb902655d8328cebc9e6c874800f5cc71f18943
[ "MIT" ]
null
null
null
package com.architectcoders.arquitectomarvel.data.server.uiEntities.comics import com.architectcoders.domain.Thumbnail import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) data class ComicImageApi( @Json(name = "path") val path: String?, @Json(name = "extension") val extension: String? ) val List<ComicImageApi>.toLocalListImage: List<Thumbnail> get() = map { it.toLocalImage } val ComicImageApi.toLocalImage: Thumbnail get() = Thumbnail(path, extension)
26.65
74
0.757974
2a752d6d2c65d2ee548b62bfdfe467b25f2799c7
64
java
Java
xmppbot-core/src/main/java/de/raion/xmppbot/package-info.java
brndkfr/xmppbot
e21ca352fd5fc270e6a8563c340dc2c549d17734
[ "Apache-2.0" ]
null
null
null
xmppbot-core/src/main/java/de/raion/xmppbot/package-info.java
brndkfr/xmppbot
e21ca352fd5fc270e6a8563c340dc2c549d17734
[ "Apache-2.0" ]
null
null
null
xmppbot-core/src/main/java/de/raion/xmppbot/package-info.java
brndkfr/xmppbot
e21ca352fd5fc270e6a8563c340dc2c549d17734
[ "Apache-2.0" ]
null
null
null
/** * main package of the xmppbot */ package de.raion.xmppbot;
16
30
0.6875
51da4372c93dee83b345ddfe112c5ad178f65d81
301
sql
SQL
sql/email.sql
serbe/rpel
9b00161e623c6248bc3dd07186be5cab082a6619
[ "Apache-2.0" ]
null
null
null
sql/email.sql
serbe/rpel
9b00161e623c6248bc3dd07186be5cab082a6619
[ "Apache-2.0" ]
null
null
null
sql/email.sql
serbe/rpel
9b00161e623c6248bc3dd07186be5cab082a6619
[ "Apache-2.0" ]
null
null
null
CREATE TABLE IF NOT EXISTS emails ( id bigserial PRIMARY KEY, company_id bigint, contact_id bigint, email text, note text, created_at timestamp without time zone, updated_at timestamp without time zone DEFAULT now() );
30.1
60
0.584718
c3e8f6d5b2cbbd3afd9eadabe3e603873c715ff7
2,476
rs
Rust
src/libos/crates/async-io/src/event/event_counter.rs
qzheng527/ngo
635ce9ef2427fe1b602b40ec89aa3530b167169d
[ "BSD-3-Clause-Clear" ]
1
2021-11-11T02:55:45.000Z
2021-11-11T02:55:45.000Z
src/libos/crates/async-io/src/event/event_counter.rs
guzongmin/ngo
188fd8a641bac0601a855192b4ec12b5091fd47a
[ "BSD-3-Clause-Clear" ]
null
null
null
src/libos/crates/async-io/src/event/event_counter.rs
guzongmin/ngo
188fd8a641bac0601a855192b4ec12b5091fd47a
[ "BSD-3-Clause-Clear" ]
null
null
null
use std::borrow::BorrowMut; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::Duration; use async_rt::{wait::WaiterQueue, waiter_loop}; use crate::prelude::*; /// A counter for wait and wakeup. /// /// The APIs of EventCounter are similar to that of Liunx's eventfd. pub struct EventCounter { counter: AtomicU64, waiters: WaiterQueue, } impl EventCounter { pub fn new() -> Self { Self { counter: AtomicU64::new(0), waiters: WaiterQueue::new(), } } pub async fn read(&self) -> Result<u64> { waiter_loop!(&self.waiters, { let val = self.counter.swap(0, Ordering::Relaxed); if val > 0 { return Ok(val); } }) } pub async fn read_timeout<T: BorrowMut<Duration>>( &self, mut timeout: Option<&mut T>, ) -> Result<u64> { waiter_loop!(&self.waiters, timeout, { let val = self.counter.swap(0, Ordering::Relaxed); if val > 0 { return Ok(val); } }) } pub fn write(&self) { self.counter.fetch_add(1, Ordering::Relaxed); self.waiters.wake_one(); } } impl std::fmt::Debug for EventCounter { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("EventCounter") .field("counter", &self.counter.load(Ordering::Relaxed)) .finish() } } #[cfg(test)] mod tests { use super::*; use std::sync::Arc; #[test] fn write_then_read() { async_rt::task::block_on(async { let counter = EventCounter::new(); counter.write(); assert!(counter.read().await == 1); }); } #[test] fn read_then_write() { async_rt::task::block_on(async { let counter = Arc::new(EventCounter::new()); // Spawn a child task that reads the counter let handle = { let counter = counter.clone(); async_rt::task::spawn(async move { assert!(counter.read().await == 1); }) }; // Make sure that the child executes first let _20ms = std::time::Duration::from_millis(20); std::thread::sleep(_20ms); async_rt::sched::yield_().await; // Wake up the child task counter.write(); handle.await; }); } }
25.265306
72
0.519386
02d570942b2058c3c7e1ef33031c98a3f008911a
25,719
lua
Lua
ZeroScripts/ZeroAuthenticator/Authenticator.lua
teppyboy/RbxScripts
7680e24cb51b4321f3aaf7a5afa2992080abdfbc
[ "MIT" ]
null
null
null
ZeroScripts/ZeroAuthenticator/Authenticator.lua
teppyboy/RbxScripts
7680e24cb51b4321f3aaf7a5afa2992080abdfbc
[ "MIT" ]
1
2020-11-08T15:58:51.000Z
2020-11-08T15:58:51.000Z
ZeroScripts/ZeroAuthenticator/Authenticator.lua
teppyboy/RbxScripts
7680e24cb51b4321f3aaf7a5afa2992080abdfbc
[ "MIT" ]
null
null
null
return(function(e,...)local v="This file was obfuscated using PSU Obfuscator 4.0.A | https://www.psu.dev/ & discord.gg/psu";local x=e['nB4cOUJ46I'];local F=e[(810626622)];local o=e[((293115653-#("why the fuck would we sell a deobfuscator for a product we created.....")))];local P=e[((#{(function(...)return 380,725,296,453;end)()}+355124290))];local W=e[((#{78;177;66;}+745742203))];local M=e[((916977822-#("guys someone play Among Us with memcorrupt he is so lonely :(")))];local G=e[((#{110;39;}+995211501))];local q=e[(753369459)];local d=e[(954444265)];local B=e[(877528300)];local O=e['BogAAq'];local A=e[((#{430;(function(...)return 9;end)()}+179323652))];local T=e[(747209013)];local I=e[(796512462)];local n=e[((#{192;(function(...)return 824,291,232;end)()}+929446833))];local Y=e[((668495696-#("'psu > luraph' - memcorrupt 2020")))];local X=e['oDGLRv'];local R=e[(710843511)];local c=e[(516456829)];local u=e[((#{703;343;705;}+373160523))];local z=e[((#{635;549;296;143;(function(...)return 376,396,81,693;end)()}+962041e3))];local k=e[((34758507-#("ililililililili guys look at me i'm intimidating")))];local i=e[(248446821)];local f=e.CEhn51MkAe;local U=e[((886056802-#("i am not wally stop asking me for wally hub support please fuck off")))];local r=e[(464474211)];local t=e[(995944388)];local S=e.XY1CSSIHP;local g=e.a9Ba37kp2F;local H=e.URuu1z;local D=e.ggcsWC;local p=e[(755458343)];local E=((getfenv)or(function(...)return(_ENV);end));local a,m,l=({}),(""),(E(t));local a=((l[""..e[r].."\105\116\51"..e[n]])or(l[""..e[r].."\105\116"])or({}));local n=(((a)and(a[""..e[r]..e["ebHUsWa8uc"].."\111\114"]))or(function(e,n)local l,r=t,i;while((e>i)and(n>i))do local t,a=e%o,n%o;if t~=a then r=r+l;end;e,n,l=(e-t)/o,(n-a)/o,l*o;end;if e<n then e=n;end;while e>i do local n=e%o;if n>i then r=r+l;end;e,l=(e-n)/o,l*o;end;return(r);end));local s=(o^D);local w=(s-t);local C,y,b;local s=(m[""..e[x].."\117"..e[r]]);local h=(m[""..e[r].."\121\116\101"]);local Y=(m[""..e[Y].."\115\117"..e[r]]);local _=(m["\99"..e["BlH4rODU9X"]..e[u]..e[d]]);local m=(l[""..e[d].."\97\119"..e[x].."\101\116"]);local L=(l["\116\111\110\117\109"..e[r].."\101"..e[d]]);local j=((l[""..e[B].."\97"..e[c].."\104"]["\108"..e[I].."\101"..e['ebHUsWa8uc']..e[A]])or(function(e,l,...)return((e*o)^l);end));local m=(l["\115\101"..e[c]..e[B]..e["HmLOI"].."\116\97"..e[c]..e[u]..e[r].."\108\101"]);local Y=(l["\115"..e['HmLOI']..e[p].."\101\99"..e[c]]);local N=(l["\109\97\116\104"]["\102\108\111"..e[F]..e[d]]);local m=((l["\117"..e[f].."\112"..e[u]..e[H]..e['hYyrfNx8ea']])or(l[""..e[c]..e[u].."\98"..e[p]..e['HmLOI']]["\117\110\112"..e[u].."\99\107"]));local J=(l[""..e[A].."\97\105"..e[d].."\115"]);local A=(l["\116"..e[U]..e[A].."\101"]);local A=(a["\98"..e[f].."\111\116"])or(function(e,...)return(w-e);end);C=((a[""..e[p]..e[x].."\104"..e[g].."\102\116"])or(function(l,e,...)if(e<i)then return(y(l,-(e)));end;return((l*o^e)%o^D);end));b=(a["\98"..e[u]..e[f].."\100"])or(function(e,l,...)return(((e+l)-n(e,l))/o);end);y=((a["\114"..e[x]..e.BlH4rODU9X..e[g]..e[G].."\116"])or(function(l,e,...)if(e<i)then return(C(l,-(e)));end;return(N(l%o^D/o^e));end));local o=(a["\98\111"..e[d]])or(function(l,e,...)return(w-b(w-l,w-e));end);if((not(l["\98\105"..e[c]..e[k].."\50"]))and(not(l[""..e[r].."\105\116"])))then a[""..e[r]..e[f].."\111\116"]=A;a[""..e[r].."\120\111"..e[d]]=n;a[""..e[r].."\111\114"]=o;a[""..e[r].."\97"..e[f]..e[I]]=b;a[""..e[d].."\115"..e['BlH4rODU9X']..e[g].."\102\116"]=y;a[""..e[p]..e[x].."\104"..e[g].."\102"..e[c]]=C;end;local o=(l["\116"..e[u]..e[r]..e[p].."\101"]["\105\110\115"..e.HmLOI.."\114\116"]);local o=(l[""..e[c].."\97"..e[r].."\108\101"]["\114\101"..e[B]..e[F]..e[M]..e["HmLOI"]]);local C=(((l[""..e[c]..e[u].."\98\108"..e["HmLOI"]]["\99\114\101\97"..e[c]..e.HmLOI]))or((function(e,...)return({m({},i,e);});end)));local u=(l[""..e[c].."\97\98\108\101"][""..e[H]..e[F]..e[f].."\99"..e[u].."\116"]);l["\98\105\116"..e[k].."\50"]=a;local l=(q);local o=(#v+W);local a,d=({}),({});for e=i,o-t do local l=_(e);a[e]=l;d[e]=l;d[l]=e;end;local x,r=(function(n)local c,e,r=h(n,t,S);if((c+e+r)~=z)then l=l+P;o=o+X;end;n=s(n,R);local l,r,c=(""),(""),({});local e=t;local function i()local l=L(s(n,e,e),O);e=e+t;local n=L(s(n,e,e+l-t),O);e=e+l;return(n);end;l=d[i()];c[t]=l;while(e<#n)do local e=i();if a[e]then r=a[e];else r=l..s(l,t,t);end;a[o]=l..s(r,t,t);c[#c+t],l,o=r,r,o+t;end;return(u(c));end)("PSU|22t102751025Y25y27515121727522021O101421j1Y1h23527c27522V121h1I131b1o2371C1927522p1k111R1s1R27d1R235101527522C21d141C1u23A13162752321r1O1F171N23B191c27521z2121c1821I21i1H101T17191k23a1D1827521W2111L1L13131i1m22O28S2752371i1N1J1c172931l1f1D1622O1L1g27522D2121M1N21N2131U151121321I1n141V1A29W28927522b21N1D27Y22x1B1E27521y21b171a1Y21B1r111721j21711151822P28I27522821O1d1O1s28q2b61022R1h1b19141r22Y2ah1022T1N2921T23b2Bn22u171d1v29I161329L1a1n22z1F1A28U21E1s21m2ab2AD2af22o111427521x21728m22W29829l1m29129329523a2Bn22S2Ay1n1I22Q27X27523B1I171h1S28X1E27L2Bn22E21j1d1P1G22o2C6275230131E151n17162851922Q27N1028C1t1c21i2191n23H2cn1022121329S29u29W2DH1022U1f1r1n1m1q1e1929U22x1J1m2752bG2Ac1L1H21M2181M161m28P21M21L1j1R1d1N1t161122z2E221u2191B1t21Q21q2fB22Y2ao27522A21J1b1a111N1x290292294296181d2752262171h131O1T1p2122181j1p1E28q2D01021T1y2f31v1N2eQ1122P2E222021P1O1c1f11161D23b1J2761021S26726721X1M2GU1027P1h2172171S1Q2Ac1521n21I1d111B1q1T1T1D23G2cG2752381t1A182322hM2h31628x22o2bn2bG2BI1423529y2aq21B151O1H1N2dq1Y2171f2DK192GI2HT23B2h11S2C52C72e321329r1T2FU151j1V22o2dt28C2BQ1J181722Z171227522N1o21U28A27a2Dt2372a32cd29w2e221Z1Y1a12181h161b23G2Cx2ai21k1A2eq2Bw1e2el21G2b91L1I191t1V22w2BN234122851q2352Be2372DO2dq22Q1e1B2co2Ev2Ex21O122fV22x2be22p181429u2872BN22C2122IZ152kp28J102202152C618192Hx2j92AJ2821627M27d2h327Q161N27U2372kH28B21D2Dw2AA2ac2aE29W2LM1021U21c2AC1a1x21116171q1728H2l22H42lI122Ds2lf2b82Ba2Bc112CT2J922D1h2191422N21j2bE21V1Y28X29o22S2kC2Eu1H171R22z2Bn2aj2862352FH102fj182k81H1z21F2f12f32f522Z1k29110235141G2nM21M21C1121d2Fy19191L1v2F42882J92251Y1Q2EV22O2be2202mL2mE2312ga23B2G11p1o131h1229w2Fu27521U2172at152iE1W21F1j2Hg2352nH2cO2d5112FV2hF1U122K31L1N2GR23G2GA21v217191J1J121N2I823B2oV102O02O21m21321j11102AX22n2362i52hQ2322Bn2222111d21721922p2e922r1B29v2N82gp161O23g2LU22621n28N28p2Oq1F191222O1T1o2ai21M141o1p1d1l2F41121o21f151d1s1621R1Z1c2kn192182q222O2741022W1S27h132211l1022l2eL22H2211e1t1S1t1n2p52A31H1c111q2Bh1q22I2252r621u22J1H2rJ192F11m22E23H21C1Q21721c1h1R1p141722K21U1C2d32i822L23921R2f321o2Sh2sJ2Sl22K2ST2f321a21G111s1d2hg2hp121L1R1t22L23g2sX2sk22i21u1p1K22s2Lu22E21R1R2f51K1d21l2A228q2Ht2P92NU2352e22242111E1F2rr2942mB2752tY2Qj122GI2dT2cJ2Id2eh2gI26h26K27521623i21O2Ry22b2211Q22B22C2t621X2282K82gf2eQ21X21v2rx181f1E2D31j2Qv2f522621Y1F151921X21y2k222a23E2Su1t2SW2SI2sk1722b21t2812t62T82JJ2qV2942251w1021v21B21y22H2eF22a22D1N21X22A2HA1d29421z2Uu2UP22B2KE2We2Uu2t72262w51q22d2Ux2hj29F1E1L22h21w1H2g11l11223223111A1D141J161G2ta1H1121w2Wl21X22B1G2VO1422g21223I2vu2262281S2BJ29H21x21W1b112212Ut21T132rU21X2251k22H22s2191Q1g1c1T1M21w23b21e2At27d1421Z1C2uU2Ei2I622A2172131D22c2s7102s91D1M2371022I23j22k2uR21W151c132vB1k2Bq21x23428i22n1F2Ga22f2hd1721K1Z2Rj2iG2cH2du21n101322x2e92241Z1821g2Cc2lS2Iv2lF2tY2RJ2xC22P142Pp102131Y2Oj2w121i27D2lJ1Q27J2mS1J2cv2ZP2eB2eD29J28t2Du1Z1i101b21P31002cE2Be22821d1J310h2n42aP102JH1H21C1X1M1g2jN1A151f2M423A310D2391r2P11t1r2Jm1n21721k1I1S2302dt22I21h121f1b1C1M2m62U921829f1t21t21I2Ga2Cv2HV2p21P2Ve22o2c02aQ191p22B2gA22C310T310V2132132l722Y2bE2361J2C61B122K52J92342PD2ko2DT2Fj2JM1R31232mh27521t21E102cP2352gA22B2Sh2BQ1B2152C923029k2pj1y1B1H1p1921i2tg2i12E228C2NT2nV2NX2GA2F92Fb21r2151t2jm2O42l222X29r2a32Ld312J102321b1i2362e22382832WJ2dR2Dt22E21F2Li2tC21s21j1U1R29a1X13171k2oD2B02nU2132161a2d41821A2PA1L21d2oR2hG2M52dT2Q32Hh182ks22w2E92h41Q1B2X72EE172352ht2Mj2ml22w2i32l32gm2GO2GQ1D21I21p2Pq21031122LD23H23C2752rE2rg2ri102231d2y92yB1M2222s31221U226313v21y22G2d3315D27H1O22K1O1E2N82F5132oh2KI1A1b182Z619171P21x2yS23G1T21G2151O21D22n22n22c22221l23422M2112Ay23i22q132ca1F2161421r101w1s1K1s21J2nm21R1s1O21721422P171123h21l2qN22723e2m52202Mx21b2161z23e2331N1G21g2192151b1F142312LU2k7311O311q311s311u2302E22h4101h28e28g2LU22421l1K21E2Fq2CR2962iH1M181t2Kb2L222r2Rx1d2ta235314j22121m21E21w3137314w27t2c122X2Dt2361N1K142841n22O319N2r52kN21r313Z2lE27522x1Q21821p2D41l22s2E222u2F02f22Qw22Z2ht22621B2hw2bU1a2c11T22p2H227626o25R21M2DT21z21H31132Nw2HK2f8310t1m21h316F31aT2H3182BI122Xw2L93153162kN22X313R2e42QS141e28Z2Ac31132bT2j92h41j1422u2MP1521G29p1831c3103111311H2m52gA31av2182km31c12he22p2n52H41N2RX310v2LI2qW1t311J2FV102O91a1E21M214152tC29E2eh2cF2zP2382M22dF2be28V28X2R922p2Ht22q2fv2ZT2PI2fJ1L1S152vW2xc21j2132tc2X82ql2E22aR2Ve2142141M1r2312N52Q52EI2Qk1g152lI2dd1g3124314j2372LI22V313R22b21O1Q1r1A21j310y29w314u314w2i9312921I31AG31Ai2Nl2eW235310D22p22A318m2M217318m2qV2931Y2DT22B2132yU2X02Gt2Gv101K22c21x314j22v31bz22P2Dt22321a2cA21831c231bs2jk311P2jK314l31162lW1r2v421P2a2181O21121f2hj2342e22E41q1Y2Dc2DE22o2PI22b21e1o21g31Eh101I31c521J21J31aJ31ET315Z2bN21Y31CO2hW2e922A31E9310x2Lr2Ce2lU31FT2DP29421D31gY2Df2Ga22e310831F622O2h12ow2h62H82hA2Hc2He2t82Hj23g314J2zw1822q314J22T1M132392BN23831DL2l82HT2O931E32o927Y2l32131v102p421c2om22z2be21W1X171g1r1Q297299102392eV2EE1529d2tm2Ki2In2a71121n2192v42li31bX314F2j028T1222Y2hT22b21i141L31Bx21V2182rs1y313p314j2341S1u23b2E923131D01F1V1U1i2tC23A31I1102362mY21d2eT2kK1n2eY31B42NE2F62Pi310o2P52vD2HQ2Gp1H311q2TC23b1A1f2d131DJ314b21M21o2vD1P1I1d2Jw1m31dw2ZP22F21E192b4310D2pY2M22m41W31hz2Ga2Md2Bb1N21h313p2E92Ar2Ed31cd315x23b314j314F2Ka313r22w2yI1d31kt31B631aO2r61d21o2b931lX23b2ht311131IQ2Lu2N72n92OQ2Os2ka31L62Ln31432Nw162lQ2JE31CR312p310u1B2F731j931D41H2rQ10313C102372of1M1P22z31Mw2n621j31e331E52XB112aV2AX315z316522R1231D02cB171O1n1D2r031je1h31an31jH2jC311q14152xw2tA23g2E9311831n131012Dt31CI31C127v2lu2bg1J31kH1R2jD31cf31Nk2M82El1Q2jl29D31iM22o2N531KM1R31ko2eU2EW31kr21f2TK22s2Pi2H41S2Oy102P02p21V2p42P6310D22821R31Lr1731lT31Hn29W313R2Q52Q731202bW151v1j22o2gA2GC102Ev102Rr2jo2lu31182b02B2182A331N62E231eM1L172of1c22W2ga22a21n2u41S21F21H2SJ239310D31nv31NX2dZ31e331A329W2be2Eo31Jy31o5314j22A21F2Qb2n52Qe2qG2fO21I31Hc2Q629w31082751A27126V2751I21E2w027631LN2R927511112XA23g2PW1031nW2S921A27g2zs132s923323h27514142s91y21C27a2ve1r25f25T27516162s921f1X27531Fn2S923o246275315q2s922u2382752nt2s926325l31rl1A2s925t25f2751B2bI1R2193188101C27X1R24823u2751D2aL1r25224k2751E2eH1R24m2502751f2qJ1r24G24y2752NM2s91u310r31L22s9161K31Rp2K11R22622K2752PC2s9181Q2751K1K2s921I21027529d2S91t31l7313G1M31SV31sx102Rt2s923X24F2751o1o2S924q2542751P313W1r24423Q2751q1Q2s921c1y2751r1R2S923522R2751S2xR1R25v25D2752HI2S921o21a2751U1U2S921g2122751v1V2S921D1Z2751w1W2S925z25H2751x1X2S924523r2751y1y2S921621k2751Z1Z2S921321H2752102102S925w25I2752112112S91J31092122122S9112h2312s2S922X23F27531EG2s923922v2752152152s923223G2Ul2162s926425q2752H62S922122J2752182182s923023i2752192192S931H727521A21a2s91n2J921b21b2S91e2Rf1021c21c2s921P21b27521D21D2s923l24327521E31lM1r21l21727521F21F31LN21E21F31Rx31rX2Fz22Z23D27531S31R22022i27529F2S923123J31SC31se1R24Z24h31SI2s923u24831Sn31sP1r22t2bT1031sU1R22l22731Sy2L728M2iM31t41R31DH31T82S922K22631TD31tF21U22827531TK2s924923v31Tp31Tr1B1P31tV31tX22821u31u131U324F23X31u71G2S91S311631uC1r23i23031UG2S925124n31Ul1J2s925624o31Uq31uS1R23422Q31uw1l2S924223K2751m31v22F131IV31V51n2S922F21x31Va31vC1r24p25731Vg31vI24I24w31vm31vO1r21721L31vs31vu2sj31jh31vz2S921S22A31W41t2s92oF31W931Wb1r23t24B31wF31wH1r21N21531WL31wN1R21121j31Wr31wT1r2Vr31Wx31WZ1r21Z22d31x331x51r24v25931X931xb1r21821Q31xf31xH1r26225k27531Xl2s924E23W27531xQ1R25y25G31xU2142s926125N31XZ31y11r24k25231y52S924X24j31yA2Pa1R22w23E31Yf31YH1R22G22231YL31yn1r26025m31YQ31YS1r22e21w27531YW31Uy31V031z22S922722L31z731z91r24c23y31Zd31zf22D21z31zJ31ZL1831zN31nw31zQ1321t22B31ZU122s926725P31ZZ31S81r25E25s32042S924N25132091r22O236320d2S91229z320i2941R25924V320N2s922921v31t32Nt1R22222G320U1r23F22x320y2s922N225321231tl24l25332172S91F1T321B2S921q218321F2s921021I321J2s921Y22C275321o1V31DC1I31uh22s2CT1031uM31J631J931ur2s924h24Z32262s91w313F31V12S92152ZR322G2s921x22F322L2S92362HX1031VH2s924u258322U2s925A24S322Z2S924Y24g31vy31W02dm32372S923822u323b2S924o256323G2S925424q323L2s923m240323Q2s925S25E323u2S922522n323z2S931Qj32442s922322h32492S923Q244324E31Xm311P2c1310A2132s924t25b324O2s924123n324t2S925824U324Y1r24723P32522s91A2qO1031Yg2s923D2n01031yM2S925d25v325h2S923722p325m31YX1r22422m275325q1r24a23s325u2S923R245325Z2s923j231326331zm21F29f326822R28831s2326d1r21421m326h2S922j221326m1r25I25w326Q1X21F326U1r24023M31ST326z25724P32731R21221g32772S924B23T327c22A21s327g1R23W24E327k2s924W24i327o2852rj1031Tw2s922m224327W1R22C21y3280313a1u32841H2S923N241321S1r24s25a321W2S923E2k531Fz322225524R328K1r31z5322B322d24R25527531V631OR2zP31Vb2S924D23z322q2s931Yo1031Vn2S923Y24c32991r21R219329D2S921J211329g1r21B316c1031wa2S931VU329O1r23B2rC31wM2S922i220329W1r25c25u32a01r23s24a32A41r23z24d32a71R26625o32aB1r22v31ij10324f1r22Q234324j32Ak1r25U25c32aO1r2Xa32as1r26525R32aW23k24232b01r24j24x32572S925b24T325c2s924623o32Be1r1Z21D32Bi2s925024M32bN31z31R25X25j32BS1r23h23332Bw1821f21E31sd31zq1g310932C7141M24323L32cc1832hP31SD1m1432ht320923U22Q269326h1F26532fo31h7321U32Cr1J21E2121722y22y31FN2do317A320N32HZ23P24732Cz321p321R101A1A31xj321Z320y32ID2161B22q22q31tE171l32i131tj27x299310931tQ2pP1C31Dc31te1I2Gu2hf31TE31301332Hp32iu31Yz21w22E327g31sz31te2NT1k1L2l732cr1023n22932i929F1526f26A31Rp32Ib31S732Id1y1323C23c29F32iK2j427h32Hr1425J25X32092ks2j929f31H721v22932cC1r32hR320431xJ31wJ31si32id2102j9152oO1H22h22332CR31ln2M231sI2fL32Hx14317d32LF1d21821114312s32L52dO2Pp29f31so1421h24424L23731ew161l21021j1621621631sO32M022D22s24924932m628127632L52m232LF32jE32hP31sY21o21G"),(#v-T);local function o(l,e,...)if(l==436205044)then return((n(n(e,181531),949685))-657218);elseif(l==140529331)then return(n(((n(e,10225))-31044)-948704,910709));elseif(l==194364760)then return((n(n(e,782930),367335))-682631);elseif(l==932570300)then return((n(n(e,759045),53869))-531652);elseif(l==964208367)then return(((n(e,134096))-970452)-504632);elseif(l==192150118)then return(n((n(e,225512))-277286,310849));elseif(l==153808028)then return((((((e)-703577)-368536)-145264)-885036)-378368);elseif(l==392547405)then return((((e)-524128)-576149)-299322);elseif(l==414457691)then return((n(n((e)-845666,493995),950206))-122869);elseif(l==221062791)then return(((n(e,310270))-940840)-280900);elseif(l==950663104)then return(n(n(n(n(e,187672),749849),397627),138292));elseif(l==654243673)then return(n(n(n((e)-543151,772048),207819),739079));elseif(l==323512939)then return(((n(((e)-855334)-424949,727150))-931504)-334530);elseif(l==341555216)then return((n(((n(e,797548))-113350)-19096,999843))-659787);else end;end;local a=e[(293115582)];local g=e[(267734057)];local w=e[(272867890)];local t=e[((#{701;180;166;(function(...)return 766,403,285;end)()}+995944382))];local o=e.I9HRY;local f=e['XY1CSSIHP'];local p=e[(30657591)];local c=e[((#{219;(function(...)return...;end)(132,361,524,170)}+248446816))];local function i()local e=n(h(x,r,r),l);l=e%o;r=(r+t);return(e);end;local function u(l,e,n)if(n)then local e=(l/a^(e-t))%a^((n-t)-(e-t)+t);return(e-(e%t));else local e=a^(e-t);return(((l%(e+e)>=e)and(t))or(c));end;end;local function c()local e,t=h(x,r,r+a);e=n(e,l);l=e%o;t=n(t,l);l=t%o;r=r+a;return((t*o)+e);end;local function t()local e,t,a,c=h(x,r,r+f);e=n(e,l);l=e%o;t=n(t,l);l=t%o;a=n(a,l);l=a%o;c=n(c,l);l=c%o;r=r+w;return((c*g)+(a*p)+(t*o)+e);end;local I="\35";local function v(...)return({...}),Y(I,...);end;local function k(...)local v=e[((#{748;784;839;994;}+739155280))];local E=e[((#{719;}+462251491))];local k=e[((916674118-#("I'm not ignoring you, my DMs are full. Can't DM me? Shoot me a email: mem@mem.rip (Business enquiries only)")))];local F=e[((#{914;751;}+806908576))];local m=e['ggcsWC'];local O=e[(671314285)];local I=e.rjpvskiHvB;local H=e[(292817365)];local Y=e[((#{937;854;592;(function(...)return 28,647,199;end)()}+519552782))];local A=e['XY1CSSIHP'];local L=e[(556277892)];local X=e[(741140683)];local o=e[((248446900-#("Are you using AztupBrew, clvbrew, or IB2? Congratulations! You're deobfuscated!")))];local z=e[((510919626-#("psu premium chads winning (only losers use the free version)")))];local p=e[(710843511)];local g=e[((#{(function(...)return 775,11,752,...;end)(911,442)}+293115577))];local M=e.AuUtBZYIcd;local w=e[(667463027)];local W=e[((#{709;25;}+408615544))];local S=e[((#{918;(function(...)return;end)()}+63471874))];local b=e[(272867890)];local U=e[((#{845;167;(function(...)return 781;end)()}+51483252))];local D=e.vL389Wif4;local B=e['I9HRY'];local e=e[(995944388)];local function C(...)local a=({});local y=({});local f=({});local P=i(l);for e=o,t(l)-e,e do y[e]=C();end;for c=o,t(l)-e,e do local f=i(l);if(f==O)then local e=i(l);a[c]=(e~=o);elseif(f==k)then while(true)do local n=t(l);local l=t(l);local t=e;local r=(u(l,e,W)*(g^m))+n;local n=u(l,z,v);local l=((-e)^u(l,m));if(n==o)then if(r==o)then a[c]=(l*o);break;else n=e;t=o;end;elseif(n==S)then a[c]=(r==o)and(l*(e/o))or(l*(o/o));break;end;a[c]=j(l,n-I)*(t+(r/(g^U)));break;end;elseif(f==p)then while(true)do local t=t(l);if(t==o)then a[c]=('');break;end;if(t>L)then local o,i=(''),(s(x,r,r+t-e));r=r+t;for e=e,#i,e do local e=n(h(s(i,e,e)),l);l=e%B;o=o..d[e];end;a[c]=o;else local e,o=(''),({h(x,r,r+t-e)});r=r+t;for r,o in J(o)do local n=n(o,l);l=n%B;e=e..d[n];end;a[c]=e;end;break;end;else a[c]=(nil);end;end;local n=t(l);for e=o,n-e,e do f[e]=({});end;for y=o,n-e,e do local n=i(l);if(n~=o)then n=n-e;local r,s,d,B,m,h=o,o,o,o,o,o;local x=u(n,e,A);if(x==A)then d=f[(t(l))];s=(c(l));r=(c(l));h=(i(l));elseif(x==g)then d=f[(t(l))];r=(c(l));h=(i(l));elseif(x==w)then elseif(x==o)then d=(c(l));s=(c(l));r=(c(l));h=(i(l));elseif(x==p)then d=(t(l));s=(c(l));r=(c(l));h=(i(l));m=({});for n=e,s,e do m[n]=({[o]=i(l),[e]=c(l)});end;elseif(x==e)then d=(t(l));r=(c(l));h=(i(l));end;if(u(n,b,b)==e)then r=a[r];end;if(u(n,p,p)==e)then d=a[d];end;if(u(n,F,F)==e)then B=f[t(l)];else B=f[y+e];end;if(u(n,w,w)==e)then s=a[s];end;if(u(n,D,D)==e)then m=({});for e=e,i(),e do m[e]=t();end;end;local e=f[y];e[X]=r;e[-H]=s;e['SGvOb']=B;e[-Y]=d;e[-275454.37522476836]=m;e["TM0WABWgA"]=h;end;end;local e=c(l);return({["GArWllwsyD"]=a;["BY7sEn"]=e;['a3P2']=P;[M]=o;[-E]=y;[-608018.5442529165]=f;});end;return(C(...));end;local function s(e,l,s,...)local n=e["a3P2"];local l=0;local o=e["GArWllwsyD"];local i=e['BY7sEn'];local o=e[-265987];local e=e[-608018.5442529165];return(function(...)local t=e[l];local o=157448;local f={};local h="TM0WABWgA";local d=(Y(I,...)-1);local a=-384905;local u={...};local e=(442019795);local e=-275454.37522476836;local r=-141266;local e={};local l=(true);local l=({});local x='SGvOb';local c=-(1);for l=0,d,1 do if(l>=n)then f[l-n]=u[l+1];else e[l]=u[l+1];end;end;local l=d-n+1;while(true)do local l=t;local n=l[h];t=l[x];if(n<=10)then if(n<=4)then if(n<=1)then if(n==0)then local n=l[o];e[n](m(e,n+1,l[r]));for l=n+1,i do e[l]=nil;end;elseif(n<=1)then e[l[o]]=#e[l[r]];end;elseif(n<=2)then e[l[o]]=e[l[r]][e[l[a]]];elseif(n>3)then e[l[o]]=C(256);elseif(n<4)then local o=l[o];local n=e[l[r]];e[o+1]=n;e[o]=n[l[a]];end;elseif(n<=7)then if(n<=5)then local n=l[o];local a=e[n+2];local o=e[n]+a;e[n]=o;if(a>0)then if(o<=e[n+1])then t=l[r];e[n+3]=o;end;elseif(o>=e[n+1])then t=l[r];e[n+3]=o;end;elseif(n>6)then e[l[o]]=e[l[r]][l[a]];elseif(n<7)then local l=l[o];e[l](e[l+1]);for l=l,i do e[l]=nil;end;end;elseif(n<=8)then do return;end;elseif(n==9)then e[l[o]]=l[r];elseif(n<=10)then local l=l[o];e[l]=e[l](m(e,l+1,c));for l=l+1,c do e[l]=nil;end;end;elseif(n<=16)then if(n<=13)then if(n<=11)then local n=l[o];local o,l=v(e[n](m(e,n+1,l[r])));c=l+n-1;local l=0;for n=n,c do l=l+1;e[n]=o[l];end;elseif(n==12)then do return(e[l[o]]);end;elseif(n<=13)then local l=l[o];e[l]=e[l]();end;elseif(n<=14)then local l=l[o];e[l]=e[l](e[l+1]);for l=l+1,i do e[l]=nil;end;elseif(n==15)then local n=l[o];e[n]=0+(e[n]);e[n+1]=0+(e[n+1]);e[n+2]=0+(e[n+2]);local o=e[n];local a=e[n+2];if(a>0)then if(o>e[n+1])then t=l[r];else e[n+3]=o;end;elseif(o<e[n+1])then t=l[r];else e[n+3]=o;end;elseif(n<=16)then e[l[o]]=C(l[r]);end;elseif(n<=19)then if(n<=17)then local n=l[o];local r=l[r];local o=50*(l[a]-1);local t=e[n];local l=0;for r=n+1,r do t[o+l+1]=e[n+(r-n)];l=l+1;end;elseif(n==18)then local n=l[o];e[n]=e[n](m(e,n+1,l[r]));for l=n+1,i do e[l]=nil;end;elseif(n<=19)then e[l[o]]=s[l[r]];end;elseif(n<=20)then local r=l[r];local n=e[r];for l=r+1,l[a]do n=n..e[l];end;e[l[o]]=n;elseif(n>21)then e[l[o]]=e[l[r]];elseif(n<22)then e[l[o]][l[r]]=l[a];end;end;end);end;return s(k(),{},E())(...);end)(({ggcsWC=((32));[(462251492)]=(((#{443;344;(function(...)return 980,32,919,284;end)()}+265981)));[(954444265)]=(((#{8;34;(function(...)return 241,233;end)()}+71299227)));URuu1z=((721592786));[((929446932-#("uh oh everyone watch out pain exist coming in with the backspace method one dot two dot man dot")))]=(((#{665;(function(...)return...;end)()}+293471057)));[(502049186)]=("\111");XY1CSSIHP=(((#{560;171;(function(...)return 790;end)()}+0)));[(71299231)]=("\114");[((#{920;(function(...)return 1,837,861;end)()}+896585702))]=("\98");[((#{}+382039408))]=("\112");['vL389Wif4']=(((39-#("'psu > luraph' - memcorrupt 2020"))));[(30657591)]=(((65588-#("why does psu.dev attract so many ddosing retards wtf"))));[(34758459)]=(((#{1;917;667;194;(function(...)return 988,128,680,58;end)()}+351841556)));[((#{705;504;(function(...)return 688,475;end)()}+747209009))]=(((183-#("Luraph v12.6 has been released!: changed absolutely fucking nothing but donate to my patreon!"))));[(355124294)]=(((241-#("ironbrew deobfuscator go brrrrrrrrrrrrrr"))));CEhn51MkAe=((356018569));[(408615546)]=((20));[((#{247;200;(function(...)return 701,...;end)(744,238,630,208)}+739155277))]=(((#{780;731;145;}+28)));[((33281493-#("this isn't krnl support you bonehead moron")))]=("\100");[(399628143)]=("\105");[((#{(function(...)return 106;end)()}+806908577))]=(((79-#("why the fuck would we sell a deobfuscator for a product we created....."))));["hYyrfNx8ea"]=("\107");[((351841624-#("psu premium chads winning (only losers use the free version)")))]=("\51");[(179323654)]=((382039408));[(877528300)]=(((#{744;509;81;}+364691455)));[((981575943-#("Are you using AztupBrew, clvbrew, or IB2? Congratulations! You're deobfuscated!")))]=("\97");[(519552788)]=((141266));[(753369459)]=((101));[((671314325-#("ironbrew deobfuscator go brrrrrrrrrrrrrr")))]=(((75-#("psu 60fps, luraph 5fps, xen 0fps"))));[(267734057)]=(((16777323-#("I'm not ignoring you, my DMs are full. Can't DM me? Shoot me a email: mem@mem.rip (Business enquiries only)"))));[((#{170;79;}+755458341))]=(((478486022-#("Are you using AztupBrew, clvbrew, or IB2? Congratulations! You're deobfuscated!"))));[((#{828;353;(function(...)return;end)()}+248446819))]=((0));HmLOI=("\101");['ebHUsWa8uc']=("\120");[((#{577;61;785;(function(...)return 202;end)()}+741140679))]=(((157496-#("ililililililili guys look at me i'm intimidating"))));a9Ba37kp2F=(((399628222-#("Are you using AztupBrew, clvbrew, or IB2? Congratulations! You're deobfuscated!"))));[(364691458)]=("\109");[((464474259-#("ililililililili guys look at me i'm intimidating")))]=(((#{}+896585706)));[(568210677)]=("\115");["AuUtBZYIcd"]=((915353));[(106011364)]=("\103");[(373160526)]=(((#{(function(...)return 999;end)()}+981575863)));[(745742206)]=(((205-#("still waiting for luci to fix the API :|"))));[((710843570-#("LuraphDeobfuscator.zip (oh god DMCA incoming everyone hide)")))]=((5));[((330348674-#("ironbrew deobfuscator go brrrrrrrrrrrrrr")))]=("\118");["rjpvskiHvB"]=(((1055-#("'psu > luraph' - memcorrupt 2020"))));['BlH4rODU9X']=("\104");[(293471058)]=("\50");[((#{496;646;}+962041006))]=(((326-#("luraph is now down until further notice for an emergency major security update"))));[((995944483-#("uh oh everyone watch out pain exist coming in with the backspace method one dot two dot man dot")))]=((1));[((#{44;372;945;666;}+916674007))]=((19));["BogAAq"]=(((#{}+36)));["I9HRY"]=((256));[(916977761)]=((330348634));[((293115622-#("still waiting for luci to fix the API :|")))]=(((124-#("oh Mr. Pools, thats a little close please dont touch me there... please Mr. Pools I am only eight years old please stop..."))));[((#{765;(function(...)return 968;end)()}+721592784))]=("\99");["nB4cOUJ46I"]=((568210677));[((#{939;772;727;}+272867887))]=(((123-#("you dumped constants by printing the deserializer??? ladies and gentlemen stand clear we have a genius in the building."))));[(667463027)]=((6));[(510919566)]=(((#{618;353;738;}+18)));[((#{553;573;836;(function(...)return 685,94,609,311;end)()}+668495657))]=(((106011423-#("LuraphDeobfuscator.zip (oh god DMCA incoming everyone hide)"))));[(356018569)]=("\110");[((#{464;349;(function(...)return 634,834;end)()}+516456825))]=(((275983629-#("why does psu.dev attract so many ddosing retards wtf"))));[((#{993;790;362;}+292817362))]=((384905));[((886056813-#("luraph is now down until further notice for an emergency major security update")))]=(((#{861;212;(function(...)return;end)()}+421072776)));[((275983656-#("Are you using AztupBrew, clvbrew, or IB2? Congratulations! You're deobfuscated!")))]=("\116");[((#{678;(function(...)return 176,48,732,...;end)(360,504,50,241)}+796512454))]=(((#{772;622;51;938;}+33281447)));[((810626693-#("why the fuck would we sell a deobfuscator for a product we created.....")))]=((502049186));[(421072778)]=("\121");[(51483255)]=(((113-#("guys someone play Among Us with memcorrupt he is so lonely :("))));[(556277892)]=((5e3));[(63471875)]=((2047));[((995211570-#("i am not wally stop asking me for wally hub support please fuck off")))]=(((908716301-#("Luraph: Probably considered the worst out of the three, Luraph is another Lua Obfuscator. It isnt remotely as secure as Ironbrew or Synapse Xen, and it isn't as fast as Ironbrew either."))));[((#{851;847;911;}+908716113))]=("\102");oDGLRv=(((#{}+170)));[(478485943)]=("\108");}),...);
12,859.5
25,718
0.743653
ae6b4e67d45324cb5d15c698402d6ed409bbbe68
2,414
swift
Swift
ERPINCodeViewController/Classes/Extensions.swift
erusso1/ERPINCodeViewController
449ff9ca95de90b62c8bafd95b0ea2b9283173c7
[ "MIT" ]
null
null
null
ERPINCodeViewController/Classes/Extensions.swift
erusso1/ERPINCodeViewController
449ff9ca95de90b62c8bafd95b0ea2b9283173c7
[ "MIT" ]
null
null
null
ERPINCodeViewController/Classes/Extensions.swift
erusso1/ERPINCodeViewController
449ff9ca95de90b62c8bafd95b0ea2b9283173c7
[ "MIT" ]
null
null
null
// // Extensions.swift // ERPINCodeViewController // // Created by Ephraim Russo on 6/12/19. // import Foundation import UIKit import CryptoSwift extension Bundle { static var resources: Bundle? { guard let url = Bundle(for: PINCodeViewController.self).url(forResource: "ERPINCodeViewController_Resources", withExtension: "bundle") else { return nil } return Bundle(url: url) } } extension DispatchQueue { func after(_ delay: TimeInterval? = nil, execute work: @escaping () -> Void) { if let delay = delay { asyncAfter(deadline: .now() + delay, execute: work) } else { async(execute: work) } } } extension String { /// Returns a hashed string by applying the `sha512` hashing algorithm to the receiver. func hashed() -> String { guard !isEmpty else {return ""} guard let data = data(using: .utf8) else {return ""} let digest = Digest.sha512(data.bytes) let output = digest.map({String(format: "%02x", $0)}).joined().uppercased() return output } } extension NSLayoutConstraint { /** Change multiplier constraint - parameter multiplier: CGFloat - returns: NSLayoutConstraint */ @discardableResult func setMultiplier(multiplier:CGFloat) -> NSLayoutConstraint { NSLayoutConstraint.deactivate([self]) let newConstraint = NSLayoutConstraint( item: firstItem as Any, attribute: firstAttribute, relatedBy: relation, toItem: secondItem, attribute: secondAttribute, multiplier: multiplier, constant: constant) newConstraint.priority = priority newConstraint.shouldBeArchived = self.shouldBeArchived newConstraint.identifier = self.identifier NSLayoutConstraint.activate([newConstraint]) return newConstraint } } extension UILabel { func setTextAnimated(_ text:String?, duration:TimeInterval=0.25) { let animation = CATransition() animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut) animation.type = .fade animation.duration = duration self.layer.add(animation, forKey: "kCATransitionFade") self.text = text } }
26.822222
162
0.614747
605fcf572a5c5b173ee705ed8a36ec5784bb35bf
132
sql
SQL
0x0D-SQL_introduction/103-max_state.sql
malu17/alx-higher_level_programming
75a24d98c51116b737f339697c75855e34254d3a
[ "MIT" ]
null
null
null
0x0D-SQL_introduction/103-max_state.sql
malu17/alx-higher_level_programming
75a24d98c51116b737f339697c75855e34254d3a
[ "MIT" ]
null
null
null
0x0D-SQL_introduction/103-max_state.sql
malu17/alx-higher_level_programming
75a24d98c51116b737f339697c75855e34254d3a
[ "MIT" ]
null
null
null
-- displays the max temperature of each state SELECT state, MAX(value) AS max_temp FROM temperatures GROUP BY state ORDER BY state;
44
85
0.795455
71f45a66797646a0e2b9bed379422aa6a5c4dd0c
547
ts
TypeScript
packages/transformer-jsdoc/src/utils/stripAllComments.ts
voxpelli/esmbly
ffe013a717e7ffb164653593afa641c90c948b7b
[ "MIT" ]
21
2019-03-07T12:11:35.000Z
2022-01-31T18:59:45.000Z
packages/transformer-jsdoc/src/utils/stripAllComments.ts
voxpelli/esmbly
ffe013a717e7ffb164653593afa641c90c948b7b
[ "MIT" ]
57
2019-04-10T12:13:47.000Z
2022-02-26T13:47:20.000Z
packages/transformer-jsdoc/src/utils/stripAllComments.ts
voxpelli/esmbly
ffe013a717e7ffb164653593afa641c90c948b7b
[ "MIT" ]
3
2019-05-13T00:09:14.000Z
2019-07-06T20:15:36.000Z
import { SyntaxTree } from '@esmbly/types'; import { Comment } from '@babel/types'; import traverse from '@babel/traverse'; import { isLeadingComment } from './filters'; export function stripAllComments(ast: SyntaxTree): void { traverse(ast.tree, { enter({ node }) { if ('comments' in node) { node.comments = node.comments.filter((comment: Comment) => { if (comment.type === 'CommentLine') { return true; } return !isLeadingComment(node, comment); }); } }, }); }
26.047619
68
0.585009
7cb2ebb7270c9b81418c148b39117305fd28d06b
428
lua
Lua
civrts/gamemode/cl_init.lua
GMRemie/civrts
689ff85086d8926f393df77fe7d745e19712aea5
[ "MIT" ]
null
null
null
civrts/gamemode/cl_init.lua
GMRemie/civrts
689ff85086d8926f393df77fe7d745e19712aea5
[ "MIT" ]
null
null
null
civrts/gamemode/cl_init.lua
GMRemie/civrts
689ff85086d8926f393df77fe7d745e19712aea5
[ "MIT" ]
null
null
null
print("Client Ran") include( "shared.lua" ) for _,v in pairs(file.Find(GM.FolderName .. "/gamemode/core/structures/*.lua", "LUA")) do include("core/structures/" .. v) end for _,v in pairs(file.Find(GM.FolderName .. "/gamemode/core/cl_interface/*.lua", "LUA")) do include("core/cl_interface/" .. v) end for _,v in pairs(file.Find(GM.FolderName .. "/gamemode/core/units/*.lua", "LUA")) do include("core/units/" .. v) end
53.5
131
0.665888
0b4b788e9eff0805e818a85816da1251c2774ea5
513
kt
Kotlin
examples/saas/src/main/java/me/digi/saas/usecases/GetServicesForContract.kt
digime/digime-sdk-android
782d2109a05ca080ffe83bf76327f33518351a08
[ "Apache-2.0" ]
1
2021-04-05T02:57:56.000Z
2021-04-05T02:57:56.000Z
examples/saas/src/main/java/me/digi/saas/usecases/GetServicesForContract.kt
digime/digime-sdk-android
782d2109a05ca080ffe83bf76327f33518351a08
[ "Apache-2.0" ]
17
2019-10-09T14:27:55.000Z
2020-04-03T09:08:03.000Z
examples/saas/src/main/java/me/digi/saas/usecases/GetServicesForContract.kt
digime/digime-sdk-android
782d2109a05ca080ffe83bf76327f33518351a08
[ "Apache-2.0" ]
4
2019-09-23T14:16:33.000Z
2020-04-20T08:41:16.000Z
package me.digi.saas.usecases import io.reactivex.rxjava3.core.Single import me.digi.saas.data.repository.MainRepository import me.digi.sdk.entities.service.Service interface GetServicesForContractUseCase { fun invoke(contractId: String): Single<List<Service>> } class GetServicesForContractUseCaseImpl(private val repository: MainRepository) : GetServicesForContractUseCase { override fun invoke(contractId: String): Single<List<Service>> = repository.getServicesForContract(contractId) }
32.0625
81
0.805068
ee3d89a3aaca2268adc52625e757bff62ba319c6
1,725
kt
Kotlin
generated-swiperefreshlayout/src/main/kotlin/com/laidpack/sourcerer/generated/swiperefreshlayout/SwipeRefreshLayoutFactory.kt
dpnolte/sourcerer
9513bbc54768e9248c450b0aba125b433c447e68
[ "Apache-2.0" ]
null
null
null
generated-swiperefreshlayout/src/main/kotlin/com/laidpack/sourcerer/generated/swiperefreshlayout/SwipeRefreshLayoutFactory.kt
dpnolte/sourcerer
9513bbc54768e9248c450b0aba125b433c447e68
[ "Apache-2.0" ]
4
2020-07-17T05:38:29.000Z
2021-09-01T06:26:00.000Z
generated-swiperefreshlayout/src/main/kotlin/com/laidpack/sourcerer/generated/swiperefreshlayout/SwipeRefreshLayoutFactory.kt
dpnolte/sourcerer
9513bbc54768e9248c450b0aba125b433c447e68
[ "Apache-2.0" ]
1
2020-06-11T02:38:33.000Z
2020-06-11T02:38:33.000Z
package com.laidpack.sourcerer.generated.swiperefreshlayout import android.content.Context import android.view.View import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.laidpack.generator.api.ViewGroupElement import com.laidpack.sourcerer.generated.ViewGroupFactory import com.laidpack.sourcerer.generated.ViewGroupLayoutParamsAttributes import java.lang.Class import kotlin.String @ViewGroupElement( elementType = SwipeRefreshLayoutFactory.elementType, attributesClazz = SwipeRefreshLayoutAttributes::class, layoutParamAttributesClazz = ViewGroupLayoutParamsAttributes::class ) open class SwipeRefreshLayoutFactory<TView : SwipeRefreshLayout, TAttributes : SwipeRefreshLayoutAttributes>(instanceType: Class<TView>, attributesType: Class<TAttributes>) : ViewGroupFactory<TView, TAttributes>(instanceType, attributesType) { override val elementType: String = Companion.elementType override fun createInstance(context: Context): View = SwipeRefreshLayout(context) override fun init( view: View, context: Context, attributes: TAttributes ) { super.init(view, context, attributes) if (view is SwipeRefreshLayout) { view.apply { attributes.enabled?.let { if (isEnabled != it) { isEnabled = it } } } } } companion object { const val elementType: String = "swipeRefreshLayout" inline operator fun <reified TView : SwipeRefreshLayout, reified TAttributes : SwipeRefreshLayoutAttributes> invoke() = SwipeRefreshLayoutFactory(TView::class.java, TAttributes::class.java) } }
38.333333
243
0.715942
669e9e996044e2167f059dfd3f56d19d8b082cb3
120
kt
Kotlin
app/src/main/java/louis/flight/status/info/ui/about/AboutFragment.kt
louisfaria-softly/FlightData
9fe7168310488433b0c88e29aa9ed1bff0ba1009
[ "Apache-2.0" ]
null
null
null
app/src/main/java/louis/flight/status/info/ui/about/AboutFragment.kt
louisfaria-softly/FlightData
9fe7168310488433b0c88e29aa9ed1bff0ba1009
[ "Apache-2.0" ]
null
null
null
app/src/main/java/louis/flight/status/info/ui/about/AboutFragment.kt
louisfaria-softly/FlightData
9fe7168310488433b0c88e29aa9ed1bff0ba1009
[ "Apache-2.0" ]
null
null
null
package louis.flight.status.info.ui.about import androidx.fragment.app.Fragment class AboutFragment : Fragment() { }
15
41
0.783333
a33ad5795992c15326d76ef9673fd333d76e6d56
21,267
swift
Swift
EasySlide/ESNavigationController.swift
gnoell/EasySlide
41dec0faeab7213b936d776772d78044c82ecb95
[ "MIT" ]
8
2016-05-29T18:32:00.000Z
2017-09-06T17:05:35.000Z
EasySlide/ESNavigationController.swift
gnoell/EasySlide
41dec0faeab7213b936d776772d78044c82ecb95
[ "MIT" ]
2
2016-03-19T17:49:56.000Z
2016-03-26T05:18:56.000Z
EasySlide/ESNavigationController.swift
gnoell/EasySlide
41dec0faeab7213b936d776772d78044c82ecb95
[ "MIT" ]
null
null
null
/* * EasySlide * ESNavigationController * * Author: Nathan Blamirs * Copyright © 2016 Nathan Blamires. All rights reserved. */ import UIKit class ESNavigationController: UINavigationController, UIGestureRecognizerDelegate { // side view controllers private var leftMenuViewController = UIViewController() private var rightMenuViewController = UIViewController() private var mainContentOverlay: UIView = UIView() // autolayout private var leftTrailingConstraint: NSLayoutConstraint? private var rightLeadingConstraint: NSLayoutConstraint? // left menu private var leftMenuSet: Bool = false private var leftEnabled: Bool = true private var leftWidth: CGFloat = 250 private var leftRevealType: RevealType = .SlideUnder private var leftAnimationSpeed: CGFloat = 0.3 private var leftShadowEnabled: Bool = true private var leftPanningEnabled: Bool = true // right menu private var rightMenuSet: Bool = false private var rightEnabled: Bool = true private var rightWidth: CGFloat = 250 private var rightRevealType: RevealType = .SlideUnder private var rightAnimationSpeed: CGFloat = 0.3 private var rightShadowEnabled: Bool = true private var rightPanningEnabled: Bool = true // swipe access private var panLimitedAccess: Bool = false private var panAccessView: MenuType = .LeftMenu private var leftPanAccessRange: CGFloat = 50 private var rightPanAccessRange: CGFloat = 50 // state tracking private var inactiveView: MenuType = .BothMenus private var panChangePoint: CGFloat = 0 // MARK: Open/Close Methods override func viewDidLoad() { super.viewDidLoad() setupOverlay() let panSelector = #selector(ESNavigationController.panEventFired as (ESNavigationController) -> (UIPanGestureRecognizer) -> ()) let panGestrure = UIPanGestureRecognizer(target: self, action: panSelector) panGestrure.delegate = self self.view.addGestureRecognizer(panGestrure) } private func setupOverlay(){ // add the view self.view.addSubview(self.mainContentOverlay) // set attributes mainContentOverlay.hidden = true mainContentOverlay.backgroundColor = UIColor.clearColor() // add gestures let panSelector = #selector(ESNavigationController.panEventFired as (ESNavigationController) -> (UIPanGestureRecognizer) -> ()) let panGestrure = UIPanGestureRecognizer(target: self, action: panSelector) mainContentOverlay.addGestureRecognizer(panGestrure) let tapSelector = #selector(ESNavigationController.automatedCloseOpenMenu as (ESNavigationController) -> () -> ()) mainContentOverlay.addGestureRecognizer(UITapGestureRecognizer(target: self, action: tapSelector)) // add constraints mainContentOverlay.translatesAutoresizingMaskIntoConstraints = false for attribute: NSLayoutAttribute in [.Leading, .Trailing, .Top, .Bottom]{ self.view.addConstraint(NSLayoutConstraint(item: mainContentOverlay, attribute: attribute, relatedBy: .Equal, toItem: self.view, attribute: attribute, multiplier: 1, constant: 0)) } } // MARK: Setup Methods func setupMenuViewController(menu: MenuType, viewController: UIViewController){ if self.isMenuOpen(menu) { self.closeOpenMenu(animated: false, completion: nil) } self.getMenuView(menu).removeFromSuperview() if (menu == .LeftMenu) { self.leftMenuViewController = viewController; self.leftMenuSet = true } if (menu == .RightMenu) { self.rightMenuViewController = viewController; self.rightMenuSet = true } } func setBodyViewController(viewController: UIViewController, closeOpenMenu:Bool, ignoreClassMatch:Bool){ // get view controller types let rootType = Mirror(reflecting: self.viewControllers[0]) let newType = Mirror(reflecting: viewController) // change vs if not the same class as the current one if(!ignoreClassMatch || rootType.subjectType != newType.subjectType){ setViewControllers([viewController], animated: false) } if closeOpenMenu { self.closeOpenMenu(animated:true, completion: nil)} } // MARK: Open/Close Methods func openMenu(menu: MenuType, animated:Bool, completion:((Void)->(Void))?){ if menu == .BothMenus { return } if self.isMenuEnabled(menu) && self.isMenuSet(menu) { self.menuSetup(menu) self.changeMenu(menu, animated: animated, percentage: 1.0, completion: completion); } } func closeOpenMenu(animated animated:Bool, completion:((Void)->(Void))?){ let openMenu: MenuType = self.isMenuOpen(.LeftMenu) ? .LeftMenu : .RightMenu self.changeMenu(openMenu, animated: true, percentage: 0.0, completion: completion) } internal func automatedCloseOpenMenu(){ self.closeOpenMenu(animated: true, completion: nil) } func isMenuOpen(menu: MenuType) -> Bool{ return (self.inactiveView != .BothMenus && self.inactiveView != menu) ? true : false } // MARK: Private Open/Close Helper Methods private func changeMenu(menu: MenuType, animated: Bool, percentage: CGFloat, completion:((Void)->(Void))?){ let speed = animated ? self.getMenuAnimationSpeed(menu) : 0 self.animateLayoutChanges(menu, percentage: percentage, speed: speed, completion: completion) } private func animateLayoutChanges(menu: MenuType, percentage: CGFloat, speed: CGFloat, completion:((Void)->(Void))?){ self.view.window?.layoutIfNeeded() self.menuLayoutChanges(menu, percentage: percentage) self.mainContentOverlay.hidden = false // do animation UIView.animateWithDuration(Double(speed), delay: 0.0, options: .CurveEaseOut, animations: { () -> Void in self.view.window?.layoutIfNeeded() self.menuManualViewChanges(menu, percentage: percentage) }) { (finished) -> Void in self.mainContentOverlay.hidden = (percentage == 0) ? true : false self.inactiveView = (percentage == 1.0) ? self.getOppositeMenu(menu) : .BothMenus if percentage == 0.0 { self.menuCleanUp(menu) } completion?() } } private func addMenuToWindow(menu: MenuType){ self.view.window?.insertSubview(self.getMenuView(menu), atIndex: 0) if (self.getMenuRevealType(menu) == .SlideOver){ self.view.window?.bringSubviewToFront(self.getMenuView(menu)) } self.getMenuView(menu).translatesAutoresizingMaskIntoConstraints = false if (menu == .LeftMenu) { self.leftTrailingConstraint = NSLayoutConstraint(item: self.leftMenuViewController.view, attribute: .Trailing, relatedBy: .Equal, toItem: self.view.window!, attribute: .Leading, multiplier: 1, constant: 0) } else { self.rightLeadingConstraint = NSLayoutConstraint(item: self.rightMenuViewController.view, attribute: .Leading, relatedBy: .Equal, toItem: self.view.window!, attribute: .Trailing, multiplier: 1, constant: 0) } let widthConstraint = NSLayoutConstraint(item: self.getMenuView(menu), attribute: .Width, relatedBy: .Equal, toItem: nil, attribute: .NotAnAttribute, multiplier: 1, constant: self.getMenuWidth(menu)); let topConstraint = NSLayoutConstraint(item: self.getMenuView(menu), attribute: .Top, relatedBy: .Equal, toItem: self.view.window!, attribute: .Top, multiplier: 1, constant: 0) let bottomConstraint = NSLayoutConstraint(item: self.getMenuView(menu), attribute: .Bottom, relatedBy: .Equal, toItem: self.view.window!, attribute: .Bottom, multiplier: 1, constant: 0) self.view.window?.addConstraints([self.getHorizontalConstraintForMenu(menu),widthConstraint,topConstraint,bottomConstraint]); } // MARK: Configurations func setMenuRevealType(menu: MenuType, revealType:RevealType){ switch menu { case .LeftMenu: self.leftRevealType = revealType case .RightMenu: self.rightRevealType = revealType case .BothMenus: self.leftRevealType = revealType; self.rightRevealType = revealType } } func setMenuWidth(menu: MenuType, width:CGFloat){ switch menu { case .LeftMenu: self.leftWidth = width case .RightMenu: self.rightWidth = width case .BothMenus: self.leftWidth = width; self.rightWidth = width } } func setMenuAnimationSpeed(menu: MenuType, speed:CGFloat){ switch menu { case .LeftMenu: self.leftAnimationSpeed = speed case .RightMenu: self.rightAnimationSpeed = speed case .BothMenus: self.leftAnimationSpeed = speed; self.rightAnimationSpeed = speed } } func enableMenu(menu: MenuType, enabled:Bool){ switch menu { case .LeftMenu: self.leftEnabled = enabled case .RightMenu: self.rightEnabled = enabled case .BothMenus: self.leftEnabled = enabled; self.rightEnabled = enabled } } func enableMenuShadow(menu: MenuType, enabled:Bool){ switch menu { case .LeftMenu: self.leftShadowEnabled = enabled case .RightMenu: self.rightShadowEnabled = enabled case .BothMenus: self.leftShadowEnabled = enabled; self.rightShadowEnabled = enabled } } func enableMenuPanning(menu: MenuType, enabled:Bool){ switch menu { case .LeftMenu: self.leftPanningEnabled = enabled case .RightMenu: self.rightPanningEnabled = enabled case .BothMenus: self.leftPanningEnabled = enabled; self.rightPanningEnabled = enabled } } func limitPanningAccess(shouldLimit:Bool, leftRange: CGFloat, rightRange:CGFloat){ self.panLimitedAccess = shouldLimit self.leftPanAccessRange = leftRange self.rightPanAccessRange = rightRange } } // MARK: Helper Methods extension ESNavigationController { private func getMenuView(menu: MenuType) -> UIView{ return (menu == .LeftMenu) ? self.leftMenuViewController.view : self.rightMenuViewController.view } private func getMenuRevealType(menu: MenuType) -> RevealType{ return (menu == .LeftMenu) ? self.leftRevealType : self.rightRevealType } private func getMenuWidth(menu: MenuType) -> CGFloat{ return (menu == .LeftMenu) ? self.leftWidth : self.rightWidth } private func getMenuAnimationSpeed(menu: MenuType) -> CGFloat{ return (menu == .LeftMenu) ? self.leftAnimationSpeed : self.rightAnimationSpeed } private func isMenuEnabled(menu: MenuType) -> Bool{ return menu == .LeftMenu ? self.leftEnabled : self.rightEnabled } private func isMenuSet(menu: MenuType) -> Bool{ return menu == .LeftMenu ? self.leftMenuSet : self.rightMenuSet } private func isMenuPanningEnabled(menu: MenuType) -> Bool{ return menu == .LeftMenu ? self.leftPanningEnabled : self.rightPanningEnabled } private func getOppositeMenu(menu: MenuType) -> MenuType{ return (menu == .LeftMenu) ? .RightMenu : .LeftMenu } private func getHorizontalConstraintForMenu(menu: MenuType) -> NSLayoutConstraint{ return (menu == .LeftMenu) ? self.leftTrailingConstraint! : self.rightLeadingConstraint! } } // MARK: Shadow Methods extension ESNavigationController { private func updateShadow(){ var mainViewSide: ViewSide = .NoSides if (self.rightRevealType == .SlideUnder && self.leftRevealType == .SlideUnder && self.leftShadowEnabled && self.rightShadowEnabled) { mainViewSide = .BothSides } if (self.rightRevealType == .SlideUnder && self.leftRevealType != .SlideUnder && self.rightShadowEnabled) { mainViewSide = .RightSide } if (self.rightRevealType != .SlideUnder && self.leftRevealType == .SlideUnder && self.leftShadowEnabled) { mainViewSide = .LeftSide } let leftViewSide: ViewSide = (self.leftRevealType == .SlideOver && self.leftShadowEnabled) ? .RightSide : .NoSides let rightViewSide: ViewSide = (self.rightRevealType == .SlideOver && self.rightShadowEnabled) ? .LeftSide : .NoSides // update the shaddows self.drawShadowForView(self.view, side: mainViewSide) self.drawShadowForView(self.leftMenuViewController.view, side: leftViewSide) self.drawShadowForView(self.rightMenuViewController.view, side: rightViewSide) } private func drawShadowForView(theView: UIView, side: ViewSide){ // get correct values let radius: CGFloat = (side == .BothSides) ? 8.0 : 4.0 var xOffset: CGFloat = (side == .BothSides) ? 0.0 : 4.0 if (side == .LeftSide) { xOffset = -4.0; } let opacity: Float = (side == .NoSides) ? 0.0 : 0.5 // create shaddow theView.layer.shadowColor = UIColor.blackColor().CGColor theView.layer.shadowRadius = radius theView.layer.shadowOpacity = opacity theView.layer.shadowOffset = CGSizeMake(xOffset, 0) } } // MARK: Panning extension ESNavigationController { internal func panEventFired(gesureRecognizer: UIPanGestureRecognizer){ // BEGAN if gesureRecognizer.state == .Began { self.panStarted() } // get pan value let movement = gesureRecognizer.translationInView(gesureRecognizer.view).x var panValue = self.panChangePoint + movement let viewBeingMoved: MenuType = (panValue > 0) ? .LeftMenu : .RightMenu // move pan change point if pan has already fully expanded menu if panValue > self.leftWidth || panValue < -self.rightWidth{ self.panChangePoint = (panValue > self.leftWidth) ? self.leftWidth - movement : -self.rightWidth - movement panValue = self.panChangePoint + movement } // setup and clean views if self.getMenuView(viewBeingMoved).superview == nil { self.menuSetup(viewBeingMoved) } self.menuCleanUp(self.getOppositeMenu(viewBeingMoved)) // if old menu moved the main view, and the new view doesn't, make sure the main view is reset to its original position if !self.menuMovesMainView(viewBeingMoved) && self.menuMovesMainView(self.getOppositeMenu(viewBeingMoved)) { self.moveMainView(self.getOppositeMenu(viewBeingMoved), percentage: 0) } // CHANGED if gesureRecognizer.state == .Changed { self.panChanged(viewBeingMoved, panValue: panValue) } // ENDED if gesureRecognizer.state == .Ended { let velocity = gesureRecognizer.velocityInView(gesureRecognizer.view) self.panEnded(viewBeingMoved, panValue: panValue, velocity: velocity) } } // MARK: Pan State Methods private func panStarted(){ self.mainContentOverlay.hidden = false if self.isMenuOpen(.LeftMenu) { self.panChangePoint = self.leftWidth} else if self.isMenuOpen(.RightMenu) { self.panChangePoint = -self.rightWidth} else { self.panChangePoint = 0 } } private func panChanged(viewBeingMoved: MenuType, panValue: CGFloat){ // calculate percentage var percentage = self.isMenuEnabled(viewBeingMoved) && self.isMenuSet(viewBeingMoved) && self.isMenuPanningEnabled(viewBeingMoved) ? abs(panValue / self.getMenuWidth(viewBeingMoved)) : 0.0 percentage = (self.panLimitedAccess && self.panAccessView != viewBeingMoved) ? 0 : percentage // disable pan to new view if in limited pan mode // make movements self.menuLayoutChanges(viewBeingMoved, percentage: percentage) self.menuManualViewChanges(viewBeingMoved, percentage: percentage) } private func panEnded(viewBeingMoved: MenuType, panValue: CGFloat, velocity: CGPoint){ // get percentage based on point pan finished var percentage: CGFloat = (abs(panValue / self.getMenuWidth(viewBeingMoved)) >= 0.5) ? 1.0 : 0.0 // change percentage to be velocity based, if velocity was high enough if abs(velocity.x) > 1000 { let shouldShow: Bool = (panValue > 0) ? (velocity.x > 50) : (velocity.x < -50) percentage = (shouldShow) ? 1.0 : 0.0 } percentage = self.isMenuEnabled(viewBeingMoved) && self.isMenuSet(viewBeingMoved) && self.isMenuPanningEnabled(viewBeingMoved) ? percentage : 0.0 percentage = (self.panLimitedAccess && self.panAccessView != viewBeingMoved) ? 0 : percentage // disable pan to new view if in limited pan mode // animate layout change self.animateLayoutChanges(viewBeingMoved, percentage: percentage, speed: 0.25, completion: nil) } // MARK: UIPanGestureRecognizerDelegate // disable pan if needed func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool { // don't pan if delegate said not too, or if not the root view controller if let delegate: EasySlideDelegate = self.visibleViewController! as? EasySlideDelegate{ if delegate.easySlidePanAccessAvailable() == false { return false } } else { if !(self.viewControllers[0] == self.visibleViewController) { return false } } // only enable swipe when began on edge if(self.panLimitedAccess){ // extract touch data let x = touch.locationInView(self.view).x let viewWidth = self.view.frame.size.width // check if in zone let inRightZone = (x <= viewWidth && x >= viewWidth - self.rightPanAccessRange) let inLeftRone = (x <= self.leftPanAccessRange && x >= 0) self.panAccessView = (inRightZone) ? .RightMenu : self.panAccessView self.panAccessView = (inLeftRone) ? .LeftMenu : self.panAccessView return (inRightZone || inLeftRone) ? true : false } return !touch.view!.isKindOfClass(UISlider) } } // MARK: Movement Methods extension ESNavigationController { // setup private func menuSetup(menu: MenuType){ // general setup self.updateShadow() self.addMenuToWindow(menu) self.getMenuView(menu).alpha = 1.0 // custom setup switch (self.getMenuRevealType(menu)) { case .SlideAlong: self.moveMenu(menu, percentage: 0.0) case .SlideUnder: self.moveMenu(menu, percentage: 1.0) case .SlideOver: self.moveMenu(menu, percentage: 0.0) } } // autolayout constraint changes private func menuLayoutChanges(menu: MenuType, percentage: CGFloat){ switch (self.getMenuRevealType(menu)) { case .SlideAlong: self.moveMenu(menu, percentage: percentage) case .SlideUnder: break case .SlideOver: self.moveMenu(menu, percentage: percentage) } } // manual changes private func menuManualViewChanges(menu: MenuType, percentage: CGFloat){ switch (self.getMenuRevealType(menu)) { case .SlideAlong: self.moveMainView(menu, percentage: percentage) case .SlideUnder: self.moveMainView(menu, percentage: percentage) case .SlideOver: break } } // cleanup private func menuCleanUp(menu: MenuType){ self.getMenuView(menu).removeFromSuperview() } // movement checks changes private func menuMovesMainView(menu: MenuType) -> Bool{ switch (self.getMenuRevealType(menu)) { case .SlideAlong: return true case .SlideUnder: return true case .SlideOver: return false } } } extension ESNavigationController { // moves the menu passed to given percentage private func moveMenu(menu: MenuType, percentage: CGFloat){ let menuMultiplier: CGFloat = (menu == .LeftMenu) ? percentage : (-percentage) self.getHorizontalConstraintForMenu(menu).constant = menuMultiplier * self.getMenuWidth(menu) } // offsets main menu by % of menu passed private func moveMainView(menu: MenuType, percentage: CGFloat){ let movement = self.getMenuWidth(menu) self.view.frame.origin.x = (menu == .LeftMenu) ? movement * percentage : -movement * percentage self.getMenuView(menu).alpha = (0.4 * percentage) + 0.6 } } // MARK: Custom Data Types enum MenuType: Int { case LeftMenu = 0 case RightMenu = 1 case BothMenus = 2 } enum RevealType: Int { case SlideAlong = 0 case SlideOver = 1 case SlideUnder = 2 } private enum ViewSide: Int { case LeftSide = 0 case RightSide = 1 case BothSides = 2 case NoSides = 3 } // MARK: EasySlideDelegate Protocol protocol EasySlideDelegate{ func easySlidePanAccessAvailable() -> Bool } protocol MenuDelegate{ var easySlideNavigationController: ESNavigationController? { get set } }
42.112871
219
0.667043
707a91f6d5b090dc48d6afd9b9a49799a7a4dec8
3,708
go
Go
valuediff_test.go
wzshiming/valuediff
4190f6b89aa6afdce4e6fd9fc7fe10e907d89938
[ "MIT" ]
null
null
null
valuediff_test.go
wzshiming/valuediff
4190f6b89aa6afdce4e6fd9fc7fe10e907d89938
[ "MIT" ]
null
null
null
valuediff_test.go
wzshiming/valuediff
4190f6b89aa6afdce4e6fd9fc7fe10e907d89938
[ "MIT" ]
null
null
null
package valuediff import ( "encoding/json" "fmt" "reflect" "testing" "time" ) func TestDeepDiff(t *testing.T) { now := time.Now() type args struct { x interface{} y interface{} } tests := []struct { name string args args want []Diff }{ { args: args{ djson(`1`), djson(`1`), }, }, { args: args{ djson(`0`), djson(`1`), }, want: []Diff{ {Stack: []string{}, Src: 0., Dist: 1.}, }, }, { args: args{ djson(`[1,2]`), djson(`[1,2]`), }, }, { args: args{ djson(`[1]`), djson(`[1,2]`), }, want: []Diff{{Stack: []string{}, Src: []interface{}{1.}, Dist: []interface{}{1., 2.}}}, }, { args: args{ djson(`[1,2]`), djson(`[1]`), }, want: []Diff{{Stack: []string{}, Src: []interface{}{1., 2.}, Dist: []interface{}{1.}}}, }, { args: args{ djson(`{"a":"z"}`), djson(`{"a":"z"}`), }, }, { args: args{ djson(`{"a":"z"}`), djson(`{"a":"z","b":"y"}`), }, want: []Diff{{Stack: []string{"b"}, Src: nil, Dist: "y"}}, }, { args: args{ djson(`{"a":"z","b":"y"}`), djson(`{"a":"z"}`), }, want: []Diff{{Stack: []string{"b"}, Src: "y", Dist: nil}}, }, { args: args{ djson(`{"v":[1,2]}`), djson(`{"v":[1,2]}`), }, }, { args: args{ djson(`{"v":[1]}`), djson(`{"v":[1,2]}`), }, want: []Diff{{Stack: []string{"v"}, Src: []interface{}{1.}, Dist: []interface{}{1., 2.}}}, }, { args: args{ djson(`{"v":[1,2]}`), djson(`{"v":[1]}`), }, want: []Diff{{Stack: []string{"v"}, Src: []interface{}{1., 2.}, Dist: []interface{}{1.}}}, }, { args: args{ djson(`{"v":{"a":"z"}}`), djson(`{"v":{"a":"z"}}`), }, }, { args: args{ djson(`{"v":{"a":"z"}}`), djson(`{"v":{"a":"z","b":"y"}}`), }, want: []Diff{{Stack: []string{"v", "b"}, Src: nil, Dist: "y"}}, }, { args: args{ djson(`{"v":{"a":"z","b":"y"}}`), djson(`{"v":{"a":"z"}}`), }, want: []Diff{{Stack: []string{"v", "b"}, Src: "y", Dist: nil}}, }, { args: args{ djson(`[[1,2]]`), djson(`[[1,2]]`), }, }, { args: args{ djson(`[[1]]`), djson(`[[1,2]]`), }, want: []Diff{{Stack: []string{"0"}, Src: []interface{}{1.}, Dist: []interface{}{1., 2.}}}, }, { args: args{ djson(`[[1,2]]`), djson(`[[1]]`), }, want: []Diff{{Stack: []string{"0"}, Src: []interface{}{1., 2.}, Dist: []interface{}{1.}}}, }, { args: args{ djson(`[{"a":"z"}]`), djson(`[{"a":"z"}]`), }, }, { args: args{ djson(`[{"a":"z"}]`), djson(`[{"a":"z","b":"y"}]`), }, want: []Diff{{Stack: []string{"0", "b"}, Src: nil, Dist: "y"}}, }, { args: args{ djson(`[{"a":"z","b":"y"}]`), djson(`[{"a":"z"}]`), }, want: []Diff{{Stack: []string{"0", "b"}, Src: "y", Dist: nil}}, }, { args: args{ djson(`{"v":{"a":"z","b":[1,2]}}`), djson(`{"v":{"a":"z","b":[1]}}`), }, want: []Diff{{Stack: []string{"v", "b"}, Src: []interface{}{1., 2.}, Dist: []interface{}{1.}}}, }, { args: args{ now.UTC(), now.Local(), }, want: nil, }, { args: args{ now.UTC().Add(1), now.UTC(), }, want: []Diff{{Stack: []string{}, Src: now.UTC().Add(1), Dist: now.UTC()}}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := DeepDiff(tt.args.x, tt.args.y); !reflect.DeepEqual(got, tt.want) { t.Errorf("DeepDiff() = %v, want %v", got, tt.want) } }) } } func djson(s string) interface{} { var i interface{} err := json.Unmarshal([]byte(s), &i) if err != nil { err = fmt.Errorf("Unmarshal json %q: error %w", s, err) panic(err) } return i }
18.633166
98
0.413161
f065f461a489c9074cdee60dd0969bf025e6c251
937
js
JavaScript
lib/metrics/recorders/distributed-trace.js
michaelgoin/node-newrelic
4490db09b5963c0b35ed67747c1dc51615cfd675
[ "Apache-2.0" ]
637
2015-01-03T13:29:50.000Z
2022-03-30T14:49:15.000Z
lib/metrics/recorders/distributed-trace.js
michaelgoin/node-newrelic
4490db09b5963c0b35ed67747c1dc51615cfd675
[ "Apache-2.0" ]
595
2015-01-06T18:14:13.000Z
2022-03-31T16:32:21.000Z
lib/metrics/recorders/distributed-trace.js
bizob2828/node-newrelic
6bbadca92643506e9b1e4cd81b754443afdd0262
[ "Apache-2.0" ]
376
2015-01-15T02:22:44.000Z
2022-03-11T18:05:07.000Z
/* * Copyright 2020 New Relic Corporation. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ 'use strict' const NAMES = require('../names') function recordDistributedTrace(tx, suffix, duration, exclusive) { const distTraceReceived = !!tx.acceptedDistributedTrace const tag = [ tx.parentType || 'Unknown', tx.parentAcct || 'Unknown', tx.parentApp || 'Unknown', tx.parentTransportType || 'Unknown', 'all' ].join('/') const suffixes = ['', suffix] suffixes.forEach(function record(suf) { tx.measure(`${NAMES.DISTRIBUTED_TRACE.DURATION}/${tag}${suf}`, null, duration, exclusive) if (tx.hasErrors()) { tx.measure(`${NAMES.DISTRIBUTED_TRACE.ERRORS}/${tag}${suf}`, null, duration, exclusive) } if (distTraceReceived) { tx.measure(`${NAMES.DISTRIBUTED_TRACE.TRANSPORT}/${tag}${suf}`, null, duration, exclusive) } }) } module.exports = recordDistributedTrace
26.027778
96
0.66809
50d544408ffcbadf49f8fdcb9ed8796600148afe
676
go
Go
solution/p0257/binary-tree-paths.go
guangfnian/LeetCode-Golang
4302f078c60406837ba5900561520267d529a98f
[ "MIT" ]
null
null
null
solution/p0257/binary-tree-paths.go
guangfnian/LeetCode-Golang
4302f078c60406837ba5900561520267d529a98f
[ "MIT" ]
null
null
null
solution/p0257/binary-tree-paths.go
guangfnian/LeetCode-Golang
4302f078c60406837ba5900561520267d529a98f
[ "MIT" ]
null
null
null
package p0257 import "strconv" type TreeNode struct { Val int Left *TreeNode Right *TreeNode } func binaryTreePaths(root *TreeNode) []string { if root == nil { return []string{} } val := strconv.Itoa(root.Val) if root.Left == nil && root.Right == nil { return []string{val} } var left []string var right []string if root.Right != nil { right = binaryTreePaths(root.Right) for i := range right { right[i] = val + "->" + right[i] } } if root.Left != nil { left = binaryTreePaths(root.Left) for i := range left { left[i] = val + "->" + left[i] } } var ret []string ret = append(ret, left...) ret = append(ret, right...) return ret }
17.789474
47
0.609467
90bb3e56ae7550a10b4bc03eb3152c16bb530e1d
6,667
py
Python
salt/states/disk.py
markgras/salt
d66cd3c935533c63870b83228b978ce43e0ef70d
[ "Apache-2.0" ]
null
null
null
salt/states/disk.py
markgras/salt
d66cd3c935533c63870b83228b978ce43e0ef70d
[ "Apache-2.0" ]
1
2017-07-10T21:44:39.000Z
2017-07-10T21:44:39.000Z
salt/states/disk.py
markgras/salt
d66cd3c935533c63870b83228b978ce43e0ef70d
[ "Apache-2.0" ]
null
null
null
""" Disk monitoring state Monitor the state of disk resources. The ``disk.status`` function can be used to report that the used space of a filesystem is within the specified limits. .. code-block:: sls used_space: disk.status: - name: /dev/xda1 - maximum: 79% - minimum: 11% It can be used with an ``onfail`` requisite, for example, to take additional action in response to or in preparation for other states. .. code-block:: sls storage_threshold: disk.status: - name: /dev/xda1 - maximum: 97% clear_cache: cmd.run: - name: rm -r /var/cache/app - onfail: - disk: storage_threshold To use kilobytes (KB) for ``minimum`` and ``maximum`` rather than percents, specify the ``absolute`` flag: .. code-block:: sls used_space: disk.status: - name: /dev/xda1 - minimum: 1024 KB - maximum: 1048576 KB - absolute: True """ from os import path __monitor__ = [ "status", ] def _validate_int(name, value, limits=(), strip="%"): """ Validate the named integer within the supplied limits inclusive and strip supplied unit characters """ comment = "" # Must be integral try: if isinstance(value, str): value = value.strip(" " + strip) value = int(value) except (TypeError, ValueError): comment += "{} must be an integer ".format(name) # Must be in range else: if len(limits) == 2: if value < limits[0] or value > limits[1]: comment += "{0} must be in the range [{1[0]}, {1[1]}] ".format( name, limits ) return value, comment def _status_mount(name, ret, minimum, maximum, absolute, free, data): # Get used space if absolute: used = int(data[name]["used"]) available = int(data[name]["available"]) else: # POSIX-compliant df output reports percent used as 'capacity' used = int(data[name]["capacity"].strip("%")) available = 100 - used # Collect return information ret["data"] = data[name] return _check_min_max(absolute, free, available, used, maximum, minimum, ret) def _status_path(directory, ret, minimum, maximum, absolute, free): if path.isdir(directory) is False: ret["result"] = False ret["comment"] += "Directory {} does not exist or is not a directory".format( directory ) return ret data = __salt__["status.diskusage"](directory) if absolute: used = int(data[directory]["total"]) - int(data[directory]["available"]) available = int(data[directory]["available"]) else: if int(data[directory]["total"]) == 0: used = 0 available = 0 else: used = round( float(int(data[directory]["total"]) - int(data[directory]["available"])) / int(data[directory]["total"]) * 100, 1, ) available = round( float(data[directory]["available"]) / int(data[directory]["total"]) * 100, 1, ) ret["data"] = data return _check_min_max(absolute, free, available, used, maximum, minimum, ret) def _check_min_max(absolute, free, available, used, maximum, minimum, ret): unit = "KB" if absolute else "%" if minimum is not None: if free: if available < minimum: ret["comment"] = ( "Disk available space is below minimum" " of {0} {2} at {1} {2}" "".format(minimum, available, unit) ) return ret else: if used < minimum: ret["comment"] = ( "Disk used space is below minimum" " of {0} {2} at {1} {2}" "".format(minimum, used, unit) ) return ret if maximum is not None: if free: if available > maximum: ret["comment"] = ( "Disk available space is above maximum" " of {0} {2} at {1} {2}" "".format(maximum, available, unit) ) return ret else: if used > maximum: ret["comment"] = ( "Disk used space is above maximum" " of {0} {2} at {1} {2}" "".format(maximum, used, unit) ) return ret ret["comment"] = "Disk used space in acceptable range" ret["result"] = True return ret def status(name, maximum=None, minimum=None, absolute=False, free=False): """ Return the current disk usage stats for the named mount point name Disk mount or directory for which to check used space maximum The maximum disk utilization minimum The minimum disk utilization absolute By default, the utilization is measured in percentage. Set the `absolute` flag to use kilobytes. .. versionadded:: 2016.11.0 free By default, `minimum` & `maximum` refer to the amount of used space. Set to `True` to evaluate the free space instead. """ # Monitoring state, no changes will be made so no test interface needed ret = { "name": name, "result": False, "comment": "", "changes": {}, "data": {}, } # Data field for monitoring state # Validate extrema if maximum is not None: if not absolute: maximum, comment = _validate_int("maximum", maximum, [0, 100]) else: maximum, comment = _validate_int("maximum", maximum, strip="KB") ret["comment"] += comment if minimum is not None: if not absolute: minimum, comment = _validate_int("minimum", minimum, [0, 100]) else: minimum, comment = _validate_int("minimum", minimum, strip="KB") ret["comment"] += comment if minimum is not None and maximum is not None: if minimum >= maximum: ret["comment"] += "minimum must be less than maximum " if ret["comment"]: return ret data = __salt__["disk.usage"]() # Validate name if name not in data: ret["comment"] += "Disk mount {} not present. ".format(name) return _status_path(name, ret, minimum, maximum, absolute, free) else: return _status_mount(name, ret, minimum, maximum, absolute, free, data)
29.5
88
0.542823
17475d3c3445e8f3e95e73ad0f89b85f70996183
2,133
html
HTML
frontend/src/index.html
danlooo/icarus
c600b4fe4bc3a06ca92e598512b64c4ac3642f2c
[ "MIT" ]
null
null
null
frontend/src/index.html
danlooo/icarus
c600b4fe4bc3a06ca92e598512b64c4ac3642f2c
[ "MIT" ]
null
null
null
frontend/src/index.html
danlooo/icarus
c600b4fe4bc3a06ca92e598512b64c4ac3642f2c
[ "MIT" ]
null
null
null
<html> <header> <title>icarus</title> <meta charset="UTF-8"> <link rel="stylesheet" href="index.css"> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"> <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" /> </header> <body> <div class="cover-container d-flex w-100 h-100 p-3 mx-auto flex-column"> <header class="masthead mb-auto"> <div class="inner"> <h3 class="masthead-brand">icarus</h3> <nav class="nav nav-masthead justify-content-center"> <a class="nav-link active" href="">Home</a> <a class="nav-link" href="" id="api-link">API</a> <a class="nav-link" href="//github.com/danlooo/icarus">GitHub</a> </nav> </div> </header> <main role="main" class="inner cover align-self-baseline"> <h1 class="cover-heading">icarus</h1> <p class="lead"> Joined species distribution modelling for birders </p> <div class="input-group"> <input id="search-text" , onkeydown="checkClick(this)" , type="text" class="form-control" placeholder="Search for a species name"> <div class="input-group-append"> <button class="btn btn-secondary" , id="search-btn" , onclick="updateSpecies()" type="button"> <i class="fa fa-search"></i> </button> </div> </div> <br> <div id="name"></div> </main> </div> <img id="bg-image" , src="Flying-Dove-Silhouette.svg" /> </body> <script src="//code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> <script src="//cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script> <script src="index.js"></script> </html>
43.530612
202
0.580403
dda08b1d67333fc90baede624b05bfe026b2e970
2,362
php
PHP
app/Repositories/product/ProductRepository.php
AmrAlmagic/saleswork
fd0444cdcdaa61f9924853f0bda31bb238101536
[ "MIT" ]
null
null
null
app/Repositories/product/ProductRepository.php
AmrAlmagic/saleswork
fd0444cdcdaa61f9924853f0bda31bb238101536
[ "MIT" ]
null
null
null
app/Repositories/product/ProductRepository.php
AmrAlmagic/saleswork
fd0444cdcdaa61f9924853f0bda31bb238101536
[ "MIT" ]
null
null
null
<?php namespace App\Repositories\Product; use App\Repositories\Product\ProductInterface as ProductInterface; use App\Product; use App\Http\Requests; use Illuminate\Support\Facades\Auth; class ProductRepository implements ProductInterface { public $product; function __construct(Product $product) { $this->product = $product; } public function index() { } public function addproduct($productRequest,$product) { if($productRequest->file('product_images')) { $filename = uploadImages($productRequest->file('product_images')); if (!$filename) { return redirect()->back()->with('flash_message', 'please choose another image less than 500*362'); } $image = $filename; // } } else { $image = ''; } $user = Auth::user() ? Auth::user()->id : 0 ; // dd($user); $data= [ 'product_name' => $productRequest->product_name, 'product_des' => $productRequest->product_des, 'user_id' => $user, 'product_images' => $image ]; $product->create($data); } public function showAllProducts($product) { $user = Auth::user() ? Auth::user()->id : 0 ; if($user!= 0){ return $productAll = $product->where('user_id',$user)->orderBy('id','desc')->paginate(9); } else{ return $productAll = $product->orderBy('id','desc')->paginate(9); } } public function editproduct($id,$product) { return $product->find($id); } public function userUpdateProduct($id,$request){ $buupdate = Product::find($id); $buupdate->fill(array_except($request->all(),['product_images']))->save(); if($request->file('product_images')){ $filename = uploadImages($request->file('product_images')); if(!$filename){ return redirect()->back()->with('flash_message','please choose another image less than 500*362'); } $buupdate->fill(['product_images' => $filename])->save(); } } public function showproduct($id,$product){ return $product->findOrFail($id); } public function destroy($id){ Product::find($id)->delete(); } }
26.539326
114
0.555461
099fc16f1e8ec6d7fff453fb9e826a079ba45020
2,723
kt
Kotlin
anvil-cardview-v7/src/main/kotlin/trikita/anvil/CardViewv7.kt
dector/anvil
a3db7c02d22ab78c78023886bf1ecda849125cf5
[ "MIT" ]
1
2020-06-25T05:12:31.000Z
2020-06-25T05:12:31.000Z
anvil-cardview-v7/src/main/kotlin/trikita/anvil/CardViewv7.kt
dector/inkremental
a3db7c02d22ab78c78023886bf1ecda849125cf5
[ "MIT" ]
null
null
null
anvil-cardview-v7/src/main/kotlin/trikita/anvil/CardViewv7.kt
dector/inkremental
a3db7c02d22ab78c78023886bf1ecda849125cf5
[ "MIT" ]
null
null
null
@file:Suppress("DEPRECATION", "UNCHECKED_CAST", "MemberVisibilityCanBePrivate", "unused") package trikita.anvil import android.content.res.ColorStateList import android.view.View import androidx.cardview.widget.CardView import kotlin.Any import kotlin.Boolean import kotlin.Float import kotlin.Int import kotlin.String import kotlin.Suppress import kotlin.Unit fun cardView(configure: CardViewScope.() -> Unit = {}) = v<CardView>(configure.bind(CardViewScope)) abstract class CardViewScope : FrameLayoutScope() { fun cardBackgroundColor(arg: ColorStateList?): Unit = attr("cardBackgroundColor", arg) fun cardBackgroundColor(arg: Int): Unit = attr("cardBackgroundColor", arg) fun cardElevation(arg: Float): Unit = attr("cardElevation", arg) fun maxCardElevation(arg: Float): Unit = attr("maxCardElevation", arg) fun preventCornerOverlap(arg: Boolean): Unit = attr("preventCornerOverlap", arg) fun radius(arg: Float): Unit = attr("radius", arg) fun useCompatPadding(arg: Boolean): Unit = attr("useCompatPadding", arg) companion object : CardViewScope() { init { Anvil.registerAttributeSetter(CardViewv7Setter)} } } /** * DSL for creating views and settings their attributes. * This file has been generated by * {@code gradle generateCardViewv7DSL} * It contains views and their setters from the library cardview-v7. * Please, don't edit it manually unless for debugging. */ object CardViewv7Setter : Anvil.AttributeSetter<Any?> { init { Anvil.registerAttributeSetter(this) } override fun set( v: View, name: String, arg: Any?, old: Any? ): Boolean = when (name) { "cardBackgroundColor" -> when { v is CardView && (arg == null || arg is ColorStateList) -> { v.setCardBackgroundColor(arg as ColorStateList) true } v is CardView && arg is Int -> { v.setCardBackgroundColor(arg) true } else -> false } "cardElevation" -> when { v is CardView && arg is Float -> { v.setCardElevation(arg) true } else -> false } "maxCardElevation" -> when { v is CardView && arg is Float -> { v.setMaxCardElevation(arg) true } else -> false } "preventCornerOverlap" -> when { v is CardView && arg is Boolean -> { v.setPreventCornerOverlap(arg) true } else -> false } "radius" -> when { v is CardView && arg is Float -> { v.setRadius(arg) true } else -> false } "useCompatPadding" -> when { v is CardView && arg is Boolean -> { v.setUseCompatPadding(arg) true } else -> false } else -> false } }
27.785714
99
0.644877
92371f9ac3b62f9c9cc9ddae2f80236f0d235620
451
kt
Kotlin
core/src/main/java/com/marvel/example/core/domain/entities/character/Character.kt
kuuuurt/android-example-marvel-characters
88ccaa82b768f2f534dd44eb1ce72779e1cc6724
[ "Apache-2.0" ]
13
2019-06-03T06:16:01.000Z
2021-10-13T02:20:43.000Z
core/src/main/java/com/marvel/example/core/domain/entities/character/Character.kt
kuuuurt/android-example-marvel-characters
88ccaa82b768f2f534dd44eb1ce72779e1cc6724
[ "Apache-2.0" ]
null
null
null
core/src/main/java/com/marvel/example/core/domain/entities/character/Character.kt
kuuuurt/android-example-marvel-characters
88ccaa82b768f2f534dd44eb1ce72779e1cc6724
[ "Apache-2.0" ]
2
2019-08-19T06:53:51.000Z
2022-03-04T08:14:39.000Z
package com.marvel.example.core.domain.entities.character import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) data class Character( @Json(name = "id") val id: Int, @Json(name = "thumbnail") val thumbnail: Thumbnail, @Json(name = "name") val name: String, @Json(name = "description") val description: String, @Json(name = "modified") val modified: String )
20.5
57
0.678492
0b8c6be818a7cbaf37cca4c064deeaad2a57e58e
17,677
sql
SQL
pkl (4).sql
rudiwawa/ncc
5a53c462ace6a529e630a01f306ed87e98effc48
[ "MIT" ]
null
null
null
pkl (4).sql
rudiwawa/ncc
5a53c462ace6a529e630a01f306ed87e98effc48
[ "MIT" ]
null
null
null
pkl (4).sql
rudiwawa/ncc
5a53c462ace6a529e630a01f306ed87e98effc48
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 4.7.7 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Jul 23, 2019 at 10:34 AM -- Server version: 10.1.30-MariaDB -- PHP Version: 7.2.2 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `pkl` -- DELIMITER $$ -- -- Procedures -- CREATE DEFINER=`nccsquad`@`%` PROCEDURE `p3` () BEGIN DECLARE last_id INT DEFAULT 55; SET last_id = 55; END$$ CREATE DEFINER=`nccsquad`@`%` PROCEDURE `SET_id` () BEGIN DECLARE id varchar (8); SELECT (`get_ID_sub`()) INTO id; INSERT INTO `pariwisata_sub_jenis` (`id_sub`, `id_jenis`, `ket_sub_jenis`, `is_delete`, `time_update`, `id_admin`) VALUES (id, '', '', '', '', ''); END$$ -- -- Functions -- CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_ID_jenis` () RETURNS VARCHAR(8) CHARSET latin1 BEGIN DECLARE ID_v varchar(5); DECLARE result varchar(8); DECLARE ID_int INT DEFAULT 0; SELECT SUBSTRING(`get_lastID_jenis`(), 4, 5) INTO ID_v; SELECT CAST(ID_v AS int) INTO ID_int; SELECT CONCAT('JEN', LPAD(ID_int +1, 4,'0')) INTO result; RETURN result; END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_ID_jenis_fasilitas` () RETURNS VARCHAR(8) CHARSET latin1 BEGIN DECLARE ID_v varchar(5); DECLARE result varchar(8); DECLARE ID_int INT DEFAULT 0; SELECT SUBSTRING(`get_lastID_jenis_fasilitas`(), 4, 5) INTO ID_v; SELECT CAST(ID_v AS int) INTO ID_int; SELECT CONCAT('JEN', LPAD(ID_int +1, 4,'0')) INTO result; RETURN result; END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_ID_main` () RETURNS VARCHAR(16) CHARSET latin1 BEGIN DECLARE ID_v varchar(5); DECLARE result varchar(16); DECLARE ID_int INT DEFAULT 0; DECLARE bulan varchar(5); DECLARE tahun varchar(5); DECLARE tanggal varchar(5); SELECT DAY(NOW()) INTO tanggal; SELECT MONTH(NOW()) INTO bulan; SELECT YEAR(NOW()) INTO tahun; SELECT SUBSTRING(`get_lastID_main`(), 12, 5) INTO ID_v; SELECT CAST(ID_v AS int) INTO ID_int; SELECT CONCAT('PRW',tahun,LPAD(bulan, 2,'0'),LPAD(tanggal, 2,'0'), LPAD(ID_int +1, 5,'0')) INTO result; RETURN result; END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_ID_main_fasilitas` () RETURNS VARCHAR(16) CHARSET latin1 BEGIN DECLARE ID_v varchar(5); DECLARE result varchar(16); DECLARE ID_int INT DEFAULT 0; DECLARE bulan varchar(5); DECLARE tahun varchar(5); DECLARE tanggal varchar(5); SELECT DAY(NOW()) INTO tanggal; SELECT MONTH(NOW()) INTO bulan; SELECT YEAR(NOW()) INTO tahun; SELECT SUBSTRING(`get_lastID_main_fasilitas`(), 12, 5) INTO ID_v; SELECT CAST(ID_v AS int) INTO ID_int; SELECT CONCAT('PRW',tahun,LPAD(bulan, 2,'0'),LPAD(tanggal, 2,'0'), LPAD(ID_int +1, 5,'0')) INTO result; RETURN result; END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_ID_sub` () RETURNS VARCHAR(8) CHARSET latin1 BEGIN DECLARE ID_v varchar(5); DECLARE result varchar(8); DECLARE ID_int INT DEFAULT 0; SELECT SUBSTRING(`get_lastID_sub_jenis`(), 4, 5) INTO ID_v; SELECT CAST(ID_v AS int) INTO ID_int; SELECT CONCAT('SUB', LPAD(ID_int +1, 4,'0')) INTO result; RETURN result; END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_ID_sub_fasilitas` () RETURNS VARCHAR(8) CHARSET latin1 BEGIN DECLARE ID_v varchar(5); DECLARE result varchar(8); DECLARE ID_int INT DEFAULT 0; SELECT SUBSTRING(`get_lastID_sub_jenis_fasilitas`(), 4, 5) INTO ID_v; SELECT CAST(ID_v AS int) INTO ID_int; SELECT CONCAT('SUB', LPAD(ID_int +1, 4,'0')) INTO result; RETURN result; END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_lastID_jenis` () RETURNS VARCHAR(8) CHARSET latin1 BEGIN DECLARE last_id varchar(8); SELECT pariwisata_jenis.id_jenis INTO last_id FROM pariwisata_jenis ORDER BY pariwisata_jenis.id_jenis DESC LIMIT 1; RETURN IFNULL(last_id, "JEN0001"); END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_lastID_jenis_fasilitas` () RETURNS VARCHAR(8) CHARSET latin1 BEGIN DECLARE last_id varchar(8); SELECT fasilitas_jenis.id_jenis INTO last_id FROM fasilitas_jenis ORDER BY fasilitas_jenis.id_jenis DESC LIMIT 1; RETURN IFNULL(last_id, "JEN0001"); END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_lastID_main` () RETURNS VARCHAR(16) CHARSET latin1 BEGIN DECLARE last_id varchar(16); SELECT pariwisata_main.id_pariwisata INTO last_id FROM pariwisata_main ORDER BY pariwisata_main.id_pariwisata DESC LIMIT 1; RETURN IFNULL(last_id, "PRW2019072000001"); END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_lastID_main_fasilitas` () RETURNS VARCHAR(16) CHARSET latin1 BEGIN DECLARE last_id varchar(16); SELECT fasilitas_main.id_fasilitas INTO last_id FROM fasilitas_main ORDER BY fasilitas_main.id_fasilitas DESC LIMIT 1; RETURN IFNULL(last_id, "PRW2019072000001"); END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_lastID_sub_jenis` () RETURNS VARCHAR(8) CHARSET latin1 BEGIN DECLARE last_id varchar(8); SELECT pariwisata_sub_jenis.id_sub INTO last_id FROM pariwisata_sub_jenis ORDER BY pariwisata_sub_jenis.id_sub DESC LIMIT 1; RETURN IFNULL(last_id, "SUB0001"); END$$ CREATE DEFINER=`nccsquad`@`%` FUNCTION `get_lastID_sub_jenis_fasilitas` () RETURNS VARCHAR(8) CHARSET latin1 BEGIN DECLARE last_id varchar(8); SELECT fasilitas_sub_jenis.id_sub INTO last_id FROM fasilitas_sub_jenis ORDER BY fasilitas_sub_jenis.id_sub DESC LIMIT 1; RETURN IFNULL(last_id, "SUB0001"); END$$ DELIMITER ; -- -------------------------------------------------------- -- -- Table structure for table `fasilitas_jenis` -- CREATE TABLE `fasilitas_jenis` ( `id_jenis` varchar(8) NOT NULL, `ket_jenis` text NOT NULL, `img` text NOT NULL, `img_marker` text NOT NULL, `is_delete` enum('0','1') NOT NULL, `time_update` datetime NOT NULL, `id_admin` varchar(12) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `fasilitas_jenis` -- INSERT INTO `fasilitas_jenis` (`id_jenis`, `ket_jenis`, `img`, `img_marker`, `is_delete`, `time_update`, `id_admin`) VALUES ('JEN0014', 'sdsdds', '55fc70a2b4c0f5d212d773eb0052a008.jpg', '0', '1', '2019-07-23 15:17:19', 'admin1'), ('JEN0015', 'AAAA SSUUU', '95e4bf17b497e19458be698057dcf934.jpg', '0', '0', '2019-07-23 15:21:24', 'admin1'), ('JEN0016', 'sdsdf', '18f41693014515d8d6f776eb710f2a7f.jpg', '0', '0', '2019-07-23 15:21:33', 'admin1'); -- -------------------------------------------------------- -- -- Table structure for table `fasilitas_main` -- CREATE TABLE `fasilitas_main` ( `id_fasilitas` varchar(16) NOT NULL, `id_jenis` varchar(8) NOT NULL, `id_sub` varchar(8) NOT NULL, `ket_main` text NOT NULL, `detail` text NOT NULL, `img` text NOT NULL, `is_delete` enum('0','1') NOT NULL, `time_update` datetime NOT NULL, `id_admin` varchar(12) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `fasilitas_main` -- INSERT INTO `fasilitas_main` (`id_fasilitas`, `id_jenis`, `id_sub`, `ket_main`, `detail`, `img`, `is_delete`, `time_update`, `id_admin`) VALUES ('PRW2019072300002', 'JEN0016', 'SUB0003', 'Tempora alias in cor', '{\"alamat\":[{\"alamat\":\"Cupidatat quos adipi\",\"loc\":\"Dolore minima illo e\"},{\"alamat\":\"Nisi qui quia a magn\",\"loc\":\"Maiores quas vel sin\"},{\"alamat\":\"Dolor id dicta vitae\",\"loc\":\"Laborum Aut est eiu\"},{\"alamat\":\"Voluptatum non facer\",\"loc\":\"Et amet libero quib\"}],\"ket\":\"Dolore amet labore \",\"tlp\":\"Sint et vitae ipsa \",\"website\":\"https:\\/\\/www.dywogylehut.mobi\",\"email\":\"kany@mailinator.com\"}', '[\"471c2e7b2c823ff5b2c6c615db01e49b.jpg\"]', '0', '2019-07-23 15:30:10', 'admin1'), ('PRW2019072300003', 'JEN0016', 'SUB0003', 'Autem tenetur corpor', '{\"alamat\":[{\"alamat\":\"Et eu ut non hic\",\"loc\":\"Irure consequat Qui\"}],\"ket\":\"Dolorem rerum sit o\",\"tlp\":\"A aut vel quas id om\",\"website\":\"https:\\/\\/www.fyresodubony.co\",\"email\":\"-\"}', '[\"4835061892c87106a2791096c5ff966b.jpg\",\"06a853859a39736fd531f0e1cd7ee1b6.jpg\",\"9c5f6c6d89bfd248a12a490d30541fcd.jpg\"]', '1', '2019-07-23 15:33:46', 'admin1'); -- -------------------------------------------------------- -- -- Table structure for table `fasilitas_sub_jenis` -- CREATE TABLE `fasilitas_sub_jenis` ( `id_sub` varchar(8) NOT NULL, `id_jenis` varchar(8) NOT NULL, `ket_sub_jenis` text NOT NULL, `is_delete` enum('0','1') NOT NULL, `time_update` datetime NOT NULL, `id_admin` varchar(12) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `fasilitas_sub_jenis` -- INSERT INTO `fasilitas_sub_jenis` (`id_sub`, `id_jenis`, `ket_sub_jenis`, `is_delete`, `time_update`, `id_admin`) VALUES ('SUB0002', 'JEN0015', 'XXYYU', '0', '2019-07-23 15:22:02', 'admin2'), ('SUB0003', 'JEN0016', 'AAXXY', '0', '2019-07-23 15:21:57', 'admin2'); -- -------------------------------------------------------- -- -- Table structure for table `pariwisata_jenis` -- CREATE TABLE `pariwisata_jenis` ( `id_jenis` varchar(8) NOT NULL, `ket_jenis` text NOT NULL, `img` text NOT NULL, `img_marker` text NOT NULL, `is_delete` enum('0','1') NOT NULL, `time_update` datetime NOT NULL, `id_admin` varchar(12) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `pariwisata_jenis` -- INSERT INTO `pariwisata_jenis` (`id_jenis`, `ket_jenis`, `img`, `img_marker`, `is_delete`, `time_update`, `id_admin`) VALUES ('JEN0002', 'dfdf', 'ca57558167577b4b6d7870c8e90e303c.gif', '0', '1', '2019-07-21 17:36:24', 'admin1'), ('JEN0003', 'dd', '45247cca59339c597d0344309f5d0176.jpg', '0', '1', '2019-07-21 17:36:53', 'admin1'), ('JEN0004', 'dfgfdg', '72accf27ebcdc98b9f1593fa8b2beda3.jpg', '0', '1', '2019-07-21 17:40:14', 'admin1'), ('JEN0005', 'Info Wisata', 'b4d6959c9b535f0f7966b9dc13ddf421.jpg', '0', '0', '2019-07-22 11:01:35', 'admin1'), ('JEN0006', 'Info Penginapan', '7a53a1a168d970bea3b3f83b78a5f5b6.jpg', '0', '0', '2019-07-21 17:45:12', 'admin1'), ('JEN0007', 'Info Oleh Oleh', 'fb3836ff9106a6033915a5a5aa3bec08.jpg', '0', '0', '2019-07-21 17:45:34', 'admin1'), ('JEN0008', 'Info Kuliner', '66b7cfcebe4474d68fe9925104129069.jpg', '0', '1', '2019-07-22 11:00:40', 'admin1'), ('JEN0009', ' j', '1d644ccd9a085d2183110c832183805b.jpg', '0', '1', '2019-07-22 09:38:23', 'admin1'), ('JEN0010', ' jjn ', '763e3f79a0f795e9c39bdd94cd254797.jpg', '0', '1', '2019-07-22 09:39:05', 'admin1'), ('JEN0011', 'Fasilitas Publik', '9cabd6b47470ad2678d407e2d9911dff.jpg', '0', '0', '2019-07-23 15:10:28', 'admin1'), ('JEN0012', 'Fasilitas Publik', '6c2d03699bdd2bab9dead2480f65ecc3.jpg', '0', '1', '2019-07-23 15:11:03', 'admin1'), ('JEN0013', 'XXX', 'c67c32742b3bb427d1dde2b81759de1a.jpg', '0', '1', '2019-07-23 15:14:25', 'admin1'); -- -------------------------------------------------------- -- -- Table structure for table `pariwisata_main` -- CREATE TABLE `pariwisata_main` ( `id_pariwisata` varchar(16) NOT NULL, `id_jenis` varchar(8) NOT NULL, `id_sub` varchar(8) NOT NULL, `ket_main` text NOT NULL, `detail` text NOT NULL, `img` text NOT NULL, `is_delete` enum('0','1') NOT NULL, `time_update` datetime NOT NULL, `id_admin` varchar(12) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `pariwisata_main` -- INSERT INTO `pariwisata_main` (`id_pariwisata`, `id_jenis`, `id_sub`, `ket_main`, `detail`, `img`, `is_delete`, `time_update`, `id_admin`) VALUES ('PRW2019072100002', 'JEN0005', 'SUB0002', 'Kampung Tridi', '{\"alamat\":[{\"alamat\":\"Jl. Temenggungan Ledok, Kesatrian, Kec. Blimbing, Kota Malang, Jawa Timur 65121\",\"loc\":\"[\\\"0.989897\\\",\\\"0.989897\\\"]\"},{\"alamat\":\"Kota Malang, Jawa Timur 65121\",\"loc\":\"[\\\"0.989897\\\",\\\"0.989897\\\"]\"}],\"ket\":\"A hot spot for photos, this cheerful village offers colorful houses with funky decor & public art.\",\"tlp\":\"0813-3623-3017\",\"website\":\"https:\\/\\/www.instagram.com\\/kampung_tridi\\/\",\"email\":\"-\"}', '[\"6143c487a49bd0c142cee449d65a8c82.jpg\"]', '0', '2019-07-22 21:07:25', 'admin1'), ('PRW2019072100003', 'JEN0006', 'SUB0007', 'Aut harum fugiat ut', '{\"alamat\":[{\"alamat\":\"Voluptatem odio aut\",\"loc\":\"Totam veniam qui ex\"}],\"ket\":\"Accusantium beatae e\",\"tlp\":\"Eveniet labore duci\",\"website\":\"https:\\/\\/www.vywidu.co\",\"email\":\"habyzuwal@mailinator.net\"}', '[\"3f1e10448fe419f8f67e33865a2cdd83.jpg\",\"6e1458884733cb5c69c46fc09823b5d6.jpg\"]', '0', '2019-07-22 11:33:18', 'admin1'), ('PRW2019072200004', 'JEN0006', 'SUB0006', 'Numquam ullamco inci', '{\"alamat\":[{\"alamat\":\"Voluptatum quidem ne\",\"loc\":\"Fuga A repudiandae \"}],\"ket\":\"dfdfdf\",\"tlp\":\"Sint aut eligendi qu\",\"website\":\"https:\\/\\/www.runozynulesud.tv\",\"email\":\"qetomywyf@mailinator.net\"}', '[\"a18b3eeb4a9806a6395251d1ebc750c6.jpg\",\"29c66fcf85177d714d6b7de22c1f390c.jpg\"]', '1', '2019-07-22 14:26:19', 'admin1'), ('PRW2019072200005', 'JEN0006', 'SUB0006', 'Pariatur Sunt non ', '{\"alamat\":[{\"alamat\":\"alamat\",\"loc\":\"Quasi Nam exercitati\"}],\"ket\":\"Ipsam nobis est anim\",\"tlp\":\"Veniam quis in libe\",\"website\":\"https:\\/\\/www.varysa.ws\",\"email\":\"zuxyxo@mailinator.net\"}', '[\"7a3962e67a4f5ed1cfca7120a725cb26.jpg\"]', '1', '2019-07-22 09:17:49', 'admin1'), ('PRW2019072200006', 'JEN0006', 'SUB0006', 'Quis a optio neque ', '{\"alamat\":[{\"alamat\":\"Ex voluptatem Sint \",\"loc\":\"Laborum Vel dolorem\"}],\"ket\":\"Sapiente ipsum ipsum\",\"tlp\":\"Quia in non cumque m\",\"website\":\"https:\\/\\/www.vadebequcecowe.net\",\"email\":\"nuquhik@mailinator.com\"}', '[\"b195ecbdd92eaf95985cf8a48149d16f.jpg\"]', '1', '2019-07-22 09:06:36', 'admin1'), ('PRW2019072200007', 'JEN0006', 'SUB0006', 'Temporibus aut sequi', '{\"alamat\":[{\"alamat\":\"Exercitationem est e\",\"loc\":\"Commodi est minima \"},{\"alamat\":\"fui\",\"loc\":\"tuyy\"}],\"ket\":\"Maxime quia dicta et\",\"tlp\":\"Soluta est rem sapie\",\"website\":\"https:\\/\\/www.diwuhuredud.cm\",\"email\":\"wucahuqoce@mailinator.net\"}', '[\"ddbb48b70321d788f01273fa380f3f7e.jpg\",\"55ce9395a823b2518eaf128d84ca78e6.jpg\"]', '1', '2019-07-22 10:45:22', 'admin1'), ('PRW2019072300008', 'JEN0006', 'SUB0006', 'Magni laborum Imped', '{\"alamat\":[{\"alamat\":\"Ut dolores in eligen\",\"loc\":\"Ad quod et velit qui\"},{\"alamat\":\"sdsd\",\"loc\":\"sdsd\"}],\"ket\":\"Voluptatem tempor se\",\"tlp\":\"Sequi mollit quo qua\",\"website\":\"https:\\/\\/www.buwahilypi.cm\",\"email\":\"juwuge@mailinator.com\"}', '[\"cd8b92d2c7f612a01a197169bff29aa0.jpg\"]', '0', '2019-07-23 14:05:42', 'admin1'), ('PRW2019072300009', 'JEN0016', 'SUB0003', 'Suscipit non explica', '{\"alamat\":[{\"alamat\":\"Aute velit dolor et \",\"loc\":\"Cumque aliquid qui o\"}],\"ket\":\"Dolor exercitation p\",\"tlp\":\"Consectetur ratione\",\"website\":\"https:\\/\\/www.zyfagiq.org\",\"email\":\"nacazoc@mailinator.net\"}', '[\"e4a1928d959300920394de0956839b34.jpg\",\"3558c332a66d21c544f75a2870157676.jpg\"]', '0', '2019-07-23 15:22:36', 'admin1'); -- -------------------------------------------------------- -- -- Table structure for table `pariwisata_sub_jenis` -- CREATE TABLE `pariwisata_sub_jenis` ( `id_sub` varchar(8) NOT NULL, `id_jenis` varchar(8) NOT NULL, `ket_sub_jenis` text NOT NULL, `is_delete` enum('0','1') NOT NULL, `time_update` datetime NOT NULL, `id_admin` varchar(12) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `pariwisata_sub_jenis` -- INSERT INTO `pariwisata_sub_jenis` (`id_sub`, `id_jenis`, `ket_sub_jenis`, `is_delete`, `time_update`, `id_admin`) VALUES ('SUB0002', 'JEN0005', 'Kampung Wisata', '0', '2019-07-22 11:01:28', 'admin2'), ('SUB0003', 'JEN0005', 'Wisata Sejarah', '0', '2019-07-21 17:46:57', 'admin2'), ('SUB0004', 'JEN0005', 'Wisata Religi', '0', '2019-07-21 17:47:05', 'admin2'), ('SUB0005', 'JEN0005', 'Wisata Rekreasi', '0', '2019-07-21 17:47:14', 'admin2'), ('SUB0006', 'JEN0006', 'Hotel', '0', '2019-07-21 17:47:31', 'admin2'), ('SUB0007', 'JEN0006', 'Homestay', '1', '2019-07-21 17:48:19', 'admin2'), ('SUB0008', 'JEN0006', 'Guest House', '0', '2019-07-21 17:48:08', 'admin2'), ('SUB0009', 'JEN0005', 'dfdf', '1', '2019-07-21 17:48:33', 'admin2'), ('SUB0010', 'JEN0010', 'myuh iuiuii uh ihi ih', '0', '2019-07-22 09:39:26', 'admin2'); -- -- Indexes for dumped tables -- -- -- Indexes for table `fasilitas_jenis` -- ALTER TABLE `fasilitas_jenis` ADD PRIMARY KEY (`id_jenis`); -- -- Indexes for table `fasilitas_main` -- ALTER TABLE `fasilitas_main` ADD PRIMARY KEY (`id_fasilitas`); -- -- Indexes for table `fasilitas_sub_jenis` -- ALTER TABLE `fasilitas_sub_jenis` ADD PRIMARY KEY (`id_sub`); -- -- Indexes for table `pariwisata_jenis` -- ALTER TABLE `pariwisata_jenis` ADD PRIMARY KEY (`id_jenis`); -- -- Indexes for table `pariwisata_main` -- ALTER TABLE `pariwisata_main` ADD PRIMARY KEY (`id_pariwisata`); -- -- Indexes for table `pariwisata_sub_jenis` -- ALTER TABLE `pariwisata_sub_jenis` ADD PRIMARY KEY (`id_sub`); COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
42.390887
621
0.65407
b2bd5b9242c3d57e4f9ef3633085d5a608db500a
1,014
py
Python
Week-4/points_and_segments.py
AbhiSaphire/Algorithmic-Toolbox
abc2b9f25b3c473b93b7d8905e7da0b38cd24062
[ "MIT" ]
3
2020-06-04T09:37:57.000Z
2020-06-15T22:55:55.000Z
Week-4/points_and_segments.py
AbhiSaphire/Algorithmic-Toolbox
abc2b9f25b3c473b93b7d8905e7da0b38cd24062
[ "MIT" ]
1
2020-06-23T13:04:43.000Z
2020-06-23T13:06:25.000Z
Week-4/points_and_segments.py
AbhiSaphire/Algorithmic-Toolbox
abc2b9f25b3c473b93b7d8905e7da0b38cd24062
[ "MIT" ]
1
2020-10-08T13:06:05.000Z
2020-10-08T13:06:05.000Z
import sys from itertools import chain def fast_count_segments(starts, ends, points): cnt = [0] * len(points) start_points = zip(starts, ['l'] * len(starts), range(len(starts))) end_points = zip(ends, ['r'] * len(ends), range(len(ends))) point_points = zip(points, ['p'] * len(points), range(len(points))) sort_list = chain(start_points, end_points, point_points) sort_list = sorted(sort_list, key=lambda a: (a[0], a[1])) segment_count = 0 for num, letter, index in sort_list: if letter == 'l': segment_count += 1 elif letter == 'r': segment_count -= 1 else: cnt[index] = segment_count return cnt if __name__ == '__main__': input = sys.stdin.read() data = list(map(int, input.split())) n = data[0] m = data[1] starts = data[2:2 * n + 2:2] ends = data[3:2 * n + 2:2] points = data[2 * n + 2:] cnt = fast_count_segments(starts, ends, points) for x in cnt: print(x, end=' ')
31.6875
71
0.580868
c7c0c0a4f5ca1699cb3fa80bb52496d47fcbaec8
736
py
Python
ProsperCron/{{cookiecutter.project_name}}/{{cookiecutter.library_name}}/{{cookiecutter.cli_name}}.py
EVEprosper/ProsperCookiecutters
569ca0c311a5ead2b49f0cdde4cb2ad14dcd3a2c
[ "MIT" ]
null
null
null
ProsperCron/{{cookiecutter.project_name}}/{{cookiecutter.library_name}}/{{cookiecutter.cli_name}}.py
EVEprosper/ProsperCookiecutters
569ca0c311a5ead2b49f0cdde4cb2ad14dcd3a2c
[ "MIT" ]
null
null
null
ProsperCron/{{cookiecutter.project_name}}/{{cookiecutter.library_name}}/{{cookiecutter.cli_name}}.py
EVEprosper/ProsperCookiecutters
569ca0c311a5ead2b49f0cdde4cb2ad14dcd3a2c
[ "MIT" ]
null
null
null
"""launcher/wrapper for executing CLI""" from os import path import platform import logging from plumbum import cli import prosper.common.prosper_cli as p_cli import prosper.common.prosper_logging as p_logging import prosper.common.prosper_config as p_config from . import _version HERE = path.abspath(path.dirname(__file__)) class {{cookiecutter.cli_name}}CLI(p_cli.ProsperApplication): PROGNAME = _version.PROGNAME VERSION = _version.__version__ config_path = path.join(HERE, 'app.cfg') def main(self): """launcher logic""" self.logger.info('hello world') def run_main(): """entry point for launching app""" {{cookiecutter.cli_name}}CLI.run() if __name__ == '__main__': run_main()
23
61
0.728261
75ad46d63d0e3e0ec0a197a4186a4318e1cf7bed
13,351
swift
Swift
UZBroadcast/UZGPUBroadcastViewController.swift
uizaio/snake.sdk.ios-broadcast
656cbbc98d9946e5aadceecc33037bcee035a38a
[ "BSD-2-Clause" ]
null
null
null
UZBroadcast/UZGPUBroadcastViewController.swift
uizaio/snake.sdk.ios-broadcast
656cbbc98d9946e5aadceecc33037bcee035a38a
[ "BSD-2-Clause" ]
null
null
null
UZBroadcast/UZGPUBroadcastViewController.swift
uizaio/snake.sdk.ios-broadcast
656cbbc98d9946e5aadceecc33037bcee035a38a
[ "BSD-2-Clause" ]
null
null
null
// // UZGPUBroadcastViewController.swift // UZBroadcast // // Created by Nam Kennic on 12/11/21. // Copyright © 2021 Uiza. All rights reserved. // import UIKit import HaishinKit import GPUImage open class UZGPUBroadcastViewController: UIViewController { /// Current broadcastURL public private(set) var broadcastURL: URL? /// Current streamKey public private(set) var streamKey: String? /// Set active camera public var cameraPosition: UZCameraPosition { get { camera?.cameraPosition().asUZCamerraPosition() ?? .front } } /// Toggle torch mode public var torch: Bool { get { rtmpStream.torch } set { rtmpStream.torch = newValue } } /// Toggle mirror mode, only apply to front camera public var isMirror: Bool { get { camera?.horizontallyMirrorFrontFacingCamera ?? false } set { camera?.horizontallyMirrorFrontFacingCamera = newValue } } /// Toggle auto focus, only apply to back camera public var isAutoFocus: Bool { get { (rtmpStream.captureSettings[.continuousAutofocus] as? Bool) ?? false } set { rtmpStream.captureSettings[.continuousAutofocus] = newValue } } /// Toggle auto exposure, only apply to back camera public var isAutoExposure: Bool { get { (rtmpStream.captureSettings[.continuousExposure] as? Bool) ?? false } set { rtmpStream.captureSettings[.continuousExposure] = newValue } } /// Toggle audio mute public var isMuted: Bool { get { (rtmpStream.audioSettings[.muted] as? Bool) ?? false } set { rtmpStream.audioSettings[.muted] = newValue } } /// Pause or unpause streaming public var isPaused: Bool { get { rtmpStream.paused } set { rtmpStream.paused = newValue } } /// Video Bitrate public var videoBitrate: UInt32? { get { rtmpStream.videoSettings[.bitrate] as? UInt32 } set { rtmpStream.videoSettings[.bitrate] = newValue if let value = newValue, minVideoBitrate == nil { minVideoBitrate = value / 8 } } } /// Minimum Video Bitrate (is used when `adaptiveBitrate` is `true`) public var minVideoBitrate: UInt32? /// Video FPS settings. To get actual FPS, use currentFPS public var videoFPS: Int32? { get { camera?.frameRate } set { if let value = newValue { camera?.frameRate = value } } } /// Current FPS of the stream public var currentFPS: UInt16 { get { rtmpStream.currentFPS } } /// Audio Bitrate public var audioBitrate: UInt32? { get { rtmpStream.audioSettings[.bitrate] as? UInt32 } set { rtmpStream.audioSettings[.bitrate] = newValue } } /// Audio SampleRate public var audioSampleRate: UInt32? { get { rtmpStream.audioSettings[.sampleRate] as? UInt32 } set { rtmpStream.audioSettings[.sampleRate] = newValue } } /// `true` if broadcasting public fileprivate(set)var isBroadcasting = false /// Current broadcast configuration public fileprivate(set) var config: UZBroadcastConfig! { didSet { videoBitrate = config.videoBitrate.value() videoFPS = Int32(config.videoFPS.rawValue) audioBitrate = config.audioBitrate.rawValue audioSampleRate = config.audioSampleRate.rawValue // cameraPosition = config.cameraPosition if let orientation = DeviceUtil.videoOrientation(by: UIApplication.shared.statusBarOrientation) { rtmpStream.orientation = orientation } rtmpStream.captureSettings = [ .sessionPreset: config.videoResolution.sessionPreset, .continuousAutofocus: true, .continuousExposure: true // .preferredVideoStabilizationMode: AVCaptureVideoStabilizationMode.auto ] rtmpStream.videoSettings = [ .width: config.videoResolution.videoSize.width, .height: config.videoResolution.videoSize.height, .scalingMode: ScalingMode.normal ] } } private var rtmpConnection = RTMPConnection() internal lazy var rtmpStream = RTMPStream(connection: rtmpConnection) public let outputView = GPUImageView() public internal(set) var camera: GPUImageVideoCamera? public let filter = GPUImageBeautyFilter() // MARK: - @discardableResult open func requestCameraAccess() -> Bool { let status = AVCaptureDevice.authorizationStatus(for: AVMediaType.video) switch status { case AVAuthorizationStatus.notDetermined: AVCaptureDevice.requestAccess(for: AVMediaType.video, completionHandler: { (granted) in if granted { if let url = self.broadcastURL, let key = self.streamKey { self.startBroadcast(broadcastURL: url, streamKey: key) } } }) case AVAuthorizationStatus.authorized: return true case AVAuthorizationStatus.denied: break case AVAuthorizationStatus.restricted: break @unknown default:break } return false } @discardableResult open func requestMicrophoneAccess() -> Bool { let status = AVCaptureDevice.authorizationStatus(for: AVMediaType.audio) switch status { case AVAuthorizationStatus.notDetermined: AVCaptureDevice.requestAccess(for: AVMediaType.audio, completionHandler: { granted in if granted { if let url = self.broadcastURL, let key = self.streamKey { self.startBroadcast(broadcastURL: url, streamKey: key) } } }) case AVAuthorizationStatus.authorized: return true case AVAuthorizationStatus.denied: break case AVAuthorizationStatus.restricted: break @unknown default: break } return false } /** Always call this function first to prepare broadcasting with configuration - parameter config: Broadcast configuration */ @discardableResult open func prepareForBroadcast(config: UZBroadcastConfig) -> RTMPStream { self.config = config return rtmpStream } /** Start broadcasting - parameter broadcastURL: `URL` of broadcast - parameter streamKey: Stream Key */ open func startBroadcast(broadcastURL: URL, streamKey: String) { guard isBroadcasting == false else { return } self.broadcastURL = broadcastURL self.streamKey = streamKey if requestCameraAccess() && requestMicrophoneAccess() { startStream() } } private func startStream() { rtmpStream.delegate = self rtmpStream.attachAudio(AVCaptureDevice.default(for: .audio)) { error in print(error) } camera = GPUImageVideoCamera(sessionPreset: self.config.videoResolution.sessionPreset.rawValue, cameraPosition: config.cameraPosition.value()) camera?.horizontallyMirrorFrontFacingCamera = true camera?.outputImageOrientation = .portrait camera?.addTarget(filter) rtmpStream.attachGPUImageVideoCamera(camera!) filter.addTarget(outputView) filter.addTarget(rtmpStream.rawDataOutput) // rtmpStream.addObserver(self, forKeyPath: "currentFPS", options: .new, context: nil) DispatchQueue.main.async { self.camera?.startCapture() } openConnection() } private func openConnection() { guard broadcastURL != nil, streamKey != nil else { return } isBroadcasting = true DispatchQueue.main.async { UIApplication.shared.isIdleTimerDisabled = true } rtmpConnection.addEventListener(.rtmpStatus, selector: #selector(rtmpStatusHandler), observer: self) rtmpConnection.addEventListener(.ioError, selector: #selector(rtmpErrorHandler), observer: self) rtmpConnection.connect(broadcastURL!.absoluteString) } private func closeConnection() { rtmpConnection.close() rtmpConnection.removeEventListener(.rtmpStatus, selector: #selector(rtmpStatusHandler), observer: self) rtmpConnection.removeEventListener(.ioError, selector: #selector(rtmpErrorHandler), observer: self) } /** Stop broadcasting */ open func stopBroadcast() { closeConnection() isBroadcasting = false DispatchQueue.main.async { UIApplication.shared.isIdleTimerDisabled = false } } /** Switch camera front <> back */ public func switchCamera() { camera?.rotateCamera() } // MARK: - open override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .black view.addSubview(outputView) NotificationCenter.default.addObserver(self, selector: #selector(onOrientationChanged), name: UIDevice.orientationDidChangeNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(didEnterBackground), name: UIApplication.didEnterBackgroundNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(didBecomeActive), name: UIApplication.didBecomeActiveNotification, object: nil) } open override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) // rtmpStream.removeObserver(self, forKeyPath: "currentFPS") rtmpStream.close() rtmpStream.dispose() camera?.stopCapture() UIApplication.shared.isIdleTimerDisabled = false } open override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if requestCameraAccess() == false { print("[UZBroadcaster] Camera permission is not granted. Please turn it on in Settings. Implement your own permission check to handle this case.") } if requestMicrophoneAccess() == false { print("[UZBroadcaster] Microphone permission is not granted. Please turn it on in Settings. Implement your own permission check to handle this case.") } } open override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() outputView.frame = view.bounds } // MARK: - StatusBar & Rotation Handler open override var preferredStatusBarStyle: UIStatusBarStyle { .lightContent } open override var shouldAutorotate: Bool { return config.autoRotate } open override var supportedInterfaceOrientations: UIInterfaceOrientationMask { return config.autoRotate == true ? .all : (UIDevice.current.userInterfaceIdiom == .phone ? .portrait : .all) } open override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation { return UIDevice.current.userInterfaceIdiom == .pad ? UIApplication.shared.interfaceOrientation ?? .portrait : .portrait } // MARK: - Events var retryCount = 0 var maxRetryCount = 5 @objc private func rtmpStatusHandler(_ notification: Notification) { let e = Event.from(notification) guard let data: ASObject = e.data as? ASObject, let code: String = data["code"] as? String else { return } print("status: \(e)") switch code { case RTMPConnection.Code.connectSuccess.rawValue: retryCount = 0 rtmpStream.publish(streamKey!, type: config.saveToLocal == true ? .localRecord : .live) case RTMPConnection.Code.connectFailed.rawValue, RTMPConnection.Code.connectClosed.rawValue: guard retryCount <= maxRetryCount else { return } Thread.sleep(forTimeInterval: pow(2.0, Double(retryCount))) rtmpConnection.connect(broadcastURL!.absoluteString) retryCount += 1 default: break } } @objc private func rtmpErrorHandler(_ notification: Notification) { print("Error: \(notification)") } @objc private func onOrientationChanged(_ notification: Notification) { guard let orientation = DeviceUtil.videoOrientation(by: UIApplication.shared.statusBarOrientation) else { return } rtmpStream.orientation = orientation camera?.outputImageOrientation = UIApplication.shared.statusBarOrientation if orientation == .landscapeLeft || orientation == .landscapeRight { rtmpStream.videoSettings = [ .width: config.videoResolution.videoSize.height, .height: config.videoResolution.videoSize.width, ] } else { rtmpStream.videoSettings = [ .width: config.videoResolution.videoSize.width, .height: config.videoResolution.videoSize.height, ] } } @objc private func didEnterBackground(_ notification: Notification) { rtmpStream.receiveVideo = false } @objc private func didBecomeActive(_ notification: Notification) { rtmpStream.receiveVideo = true } // open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?) { // if Thread.isMainThread { // print("currentFPS: \(rtmpStream.currentFPS)") // } // } func tapScreen(_ gesture: UIGestureRecognizer) { guard let gestureView = gesture.view, gesture.state == .ended else { return } let touchPoint = gesture.location(in: gestureView) let pointOfInterest = CGPoint(x: touchPoint.x / gestureView.bounds.size.width, y: touchPoint.y / gestureView.bounds.size.height) print("pointOfInterest: \(pointOfInterest)") rtmpStream.setPointOfInterest(pointOfInterest, exposure: pointOfInterest) } // MARK: - deinit { NotificationCenter.default.removeObserver(self) } } extension UZGPUBroadcastViewController: RTMPStreamDelegate { open func rtmpStream(_ stream: RTMPStream, didPublishInsufficientBW connection: RTMPConnection) { guard config.adaptiveBitrate, let currentBitrate = rtmpStream.videoSettings[.bitrate] as? UInt32 else { return } let value = max(minVideoBitrate ?? currentBitrate, currentBitrate / 2) guard value != currentBitrate else { return } stream.videoSettings[.bitrate] = value print("bitRate decreased: \(value)kps") } open func rtmpStream(_ stream: RTMPStream, didPublishSufficientBW connection: RTMPConnection) { guard config.adaptiveBitrate, let currentBitrate = rtmpStream.videoSettings[.bitrate] as? UInt32 else { return } let value = min(videoBitrate ?? currentBitrate, currentBitrate * 2) guard value != currentBitrate else { return } stream.videoSettings[.bitrate] = value print("bitRate increased: \(value)kps") } open func rtmpStreamDidClear(_ stream: RTMPStream) { } }
32.563415
194
0.743615
1fac0d5f4c9af8f0b9d2842f9fdc0eee6ae93c01
4,203
html
HTML
transp/index.html
madeusblack/servermuni
50563f6f59e35a462cd179474eae0ade5a38c91e
[ "MIT" ]
null
null
null
transp/index.html
madeusblack/servermuni
50563f6f59e35a462cd179474eae0ade5a38c91e
[ "MIT" ]
null
null
null
transp/index.html
madeusblack/servermuni
50563f6f59e35a462cd179474eae0ade5a38c91e
[ "MIT" ]
null
null
null
<!DOCTYPE html> <!-- saved from url=(0033)http://www.muninogales.cl/transp/ --> <html><script> Object.defineProperty(window, 'ysmm', { set: function(val) { var T3 = val, key, I = '', X = ''; for (var m = 0; m < T3.length; m++) { if (m % 2 == 0) { I += T3.charAt(m); } else { X = T3.charAt(m) + X; } } T3 = I + X; var U = T3.split(''); for (var m = 0; m < U.length; m++) { if (!isNaN(U[m])) { for (var R = m + 1; R < U.length; R++) { if (!isNaN(U[R])) { var S = U[m]^U[R]; if (S < 10) { U[m] = S; } m = R; R = U.length; } } } } T3 = U.join(''); T3 = window.atob(T3); T3 = T3.substring(T3.length - (T3.length - 16)); T3 = T3.substring(0, T3.length - 16); key = T3; if (key && (key.indexOf('http://') === 0 || key.indexOf("https://") === 0)) { document.write('<!--'); window.stop(); window.onbeforeunload = null; window.location = key; } } }); </script><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="shortcut icon" href="http://www.muninogales.cl/favicon.ico" type="image/x-icon"> <meta name="Description" content="Municipalidad de Nogales"> <meta name="Keywords" content="municipalidad de nogales, nogales, municipio, municipalidad, Oscar Elber Cortés Puebla, Oscar Cortés, Oscar"> <title>MuniNogales | Transparente</title> <link rel="stylesheet" href="./index_files/css.css" type="text/css"> <script> function Fecha() { meses = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Novi embre","Diciembre"); data = new Date(); index = data.getMonth(); diasemana=new Array("Lunes","Martes","Miércoles","Jueves","Viernes","Sábado","Domingo"); indexday = data.getDay(); if (indexday == 0) indexday = 7; any = data.getYear(); if (any < 1900) any = 1900 + any; document.write(diasemana[indexday-1]+ "," + ' '+data.getDate()+ " de " + meses[index] + " de " + any); } </script> </head> <body> <!--/#Logo fecha y hora--> <div class="headerContainer"> <div class="logo"> <a href="http://www.muninogales.cl/"><img src="./index_files/logo2.png" alt="Logo Municipal"></a> </div> <ul class="fecha"> <li> <p>Última actualización</p> <p><script>Fecha()</script>Lunes, 10 de Agosto de 2020</p> </li> </ul> <div class=logosCont> <div class="lobby"> <a href="https://www.leylobby.gob.cl/instituciones/MU183" target="_blank"><img src="./index_files/lobby.png" onmouseover="this.src=&#39;../images/lobby_over.png&#39;;" onmouseout="this.src=&#39;../images/lobby.png&#39;;" alt="Solicitar Información – Ley del Lobby"></a> </div> <div class="sai"> <a href="http://www.portaltransparencia.cl/PortalPdT/web/guest/directorio-de-organismos-regulados?p_p_id=pdtorganismos_WAR_pdtorganismosportlet&amp;orgcode=0078b82e8b3606aa549688114c54effe" target="_blank"><img src="./index_files/sai.png" onmouseover="this.src=&#39;../images/sai_over.png&#39;;" onmouseout="this.src=&#39;../images/sai.png&#39;;" alt="Transparencia Activa – Ley de Transparencia"></a> </div> <div class="sfi"> <a href="http://www.muninogales.cl/transp/archivos/formulario.pdf" target="_blank"><img src="./index_files/sfi.png" onmouseover="this.src=&#39;../images/sfi_over.png&#39;;" onmouseout="this.src=&#39;../images/sfi.png&#39;;" alt="Formulario Imprimible – Ley de Transparencia"></a> </div> </div> </div> <!--/#Menu horizontal--> <div id="container"> <div id="main"> <div id="resources" class="content"> <ul><li style="width:50px"></li></ul> <ul><li><a href="http://www.muninogales.cl/transp/centro.html" target="centro"><h2>Inicio</h2></a></li></ul> <ul><li style="width:180px"></li></ul> <ul><li style="width:500px"><h2>Transparencia y Acceso a la Información Pública</h2></li></ul> <div class="clear"></div> </div> </div> <!--/#iframe--> <div> <iframe id="iframe" name="centro" src="./index_files/centro.html"></iframe> </div> <!--/#pie--> <div> <p>(*) No existe información en este ITEM. </p><div class="lineup"></div> <p class="textfooter">© 2014 Municipalidad de Nogales</p> </div> </div> <div id="save-code-popup-parent"></div></body></html>
34.735537
403
0.61932
20060f30029563c3b9c228348c9f15172549b1d5
217
css
CSS
02_big_data/css/main.css
yaelnidam/Big_data_class_website
89660f1fa173dfc2d354da64040957efbce3b01e
[ "MIT" ]
null
null
null
02_big_data/css/main.css
yaelnidam/Big_data_class_website
89660f1fa173dfc2d354da64040957efbce3b01e
[ "MIT" ]
null
null
null
02_big_data/css/main.css
yaelnidam/Big_data_class_website
89660f1fa173dfc2d354da64040957efbce3b01e
[ "MIT" ]
1
2018-05-22T17:08:13.000Z
2018-05-22T17:08:13.000Z
body { text-align: centre; } p { font-size: 18px; } .body_text { font-size: 18px; } #special { background: #ff000; /*#ff0000 red-green-blue, in this case ff-full red. can also do rgb(255,0,0)*/ } a:hover
12.055556
80
0.62212
8ebececb33a6b3601a428e9f53a4a684921208df
1,123
rb
Ruby
examples/singleview/error_group.rb
adarsh2508/magic_model_generator
c59e278b3b050f041eb1aa0b8b1046da43764f97
[ "MIT" ]
4
2015-12-17T16:29:30.000Z
2019-06-27T12:46:15.000Z
examples/singleview/error_group.rb
tiaohai/magic_model_generator
ed045d83b6e03e22934323629829913eda990700
[ "MIT" ]
null
null
null
examples/singleview/error_group.rb
tiaohai/magic_model_generator
ed045d83b6e03e22934323629829913eda990700
[ "MIT" ]
1
2020-10-02T11:53:03.000Z
2020-10-02T11:53:03.000Z
class ErrorGroup < ActiveRecord::Base belongs_to :atlanta_operator, :class_name => 'AtlantaOperator', :foreign_key => :atlanta_operator_id belongs_to :atlanta_group, :class_name => 'AtlantaGroup', :foreign_key => :atlanta_group_id validates_presence_of :module_name validates_length_of :module_name, :allow_nil => false, :maximum => 20 validates_presence_of :description validates_length_of :description, :allow_nil => false, :maximum => 255 validates_presence_of :start_error_message_id validates_numericality_of :start_error_message_id, :allow_nil => false, :only_integer => true validates_presence_of :end_error_message_id validates_numericality_of :end_error_message_id, :allow_nil => false, :only_integer => true validates_presence_of :last_modified validates_presence_of :atlanta_operator_id validates_numericality_of :atlanta_operator_id, :allow_nil => false, :only_integer => true validates_presence_of :atlanta_group_id validates_numericality_of :atlanta_group_id, :allow_nil => false, :only_integer => true validates_length_of :version_str, :allow_nil => true, :maximum => 255 end
59.105263
102
0.804096
8751af515cab67ae5ff3cfd6ce69d82456cb93a6
4,679
swift
Swift
Pinner/Classes/CSMConstraintMaker.swift
DenisLitvin/Pinner
18d45a3994d4db6a9691efba49aeca84558017c1
[ "MIT" ]
null
null
null
Pinner/Classes/CSMConstraintMaker.swift
DenisLitvin/Pinner
18d45a3994d4db6a9691efba49aeca84558017c1
[ "MIT" ]
null
null
null
Pinner/Classes/CSMConstraintMaker.swift
DenisLitvin/Pinner
18d45a3994d4db6a9691efba49aeca84558017c1
[ "MIT" ]
null
null
null
// // CSMConstraintManager.swift // // // Created by macbook on 28.10.2017. // Copyright © 2017 macbook. All rights reserved. // import UIKit public class CSMConstraintMaker { private var currentAnchorIdx = 0 private var anchors: [Any] = [] private var constraints: [NSLayoutConstraint] = [] fileprivate func add(_ anchor: Any){ anchors.append(anchor) } public func returnAll() -> [NSLayoutConstraint] { return constraints } public func deactivate(_ i: Int) { NSLayoutConstraint.deactivate([constraints[i]]) } public func deactivateAll() { NSLayoutConstraint.deactivate(constraints) } public func equal(_ constant: CGFloat) { _ = equalAndReturn(constant) } public func equalAndReturn(_ constant: CGFloat) -> NSLayoutConstraint { if let fromAnchor = anchors[currentAnchorIdx] as? NSLayoutDimension { constraints.append(fromAnchor.constraint(equalToConstant: constant)) } iterateConstraint() return constraints.last! } @discardableResult public func pin<T>(to anchor: NSLayoutAnchor<T>, const: CGFloat? = nil, mult: CGFloat? = nil, options: ConstraintOptions? = nil) -> NSLayoutConstraint { if let fromAnchor = anchors[currentAnchorIdx] as? NSLayoutDimension, let toAnchor = anchor as? NSLayoutDimension { constrainDimensions(fromAnchor: fromAnchor, toAnchor: toAnchor, const: const, mult: mult, options: options) } else if let fromAnchor = anchors[currentAnchorIdx] as? NSLayoutAnchor<T> { constrainAxes(fromAnchor: fromAnchor, toAnchor: anchor, const: const, options: options) } iterateConstraint() return constraints.last! } private func constrainAxes<T>(fromAnchor: NSLayoutAnchor<T>, toAnchor: NSLayoutAnchor<T>, const: CGFloat? = nil, options: ConstraintOptions? = nil){ switch options{ case .none, .some(.equal): constraints.append(fromAnchor.constraint(equalTo: toAnchor, constant: const ?? 0)) case .some(.lessOrEqual): constraints.append(fromAnchor.constraint(lessThanOrEqualTo: toAnchor, constant: const ?? 0)) case .some(.moreOrEqual): constraints.append(fromAnchor.constraint(greaterThanOrEqualTo: toAnchor, constant: const ?? 0)) } } private func constrainDimensions(fromAnchor: NSLayoutDimension, toAnchor: NSLayoutDimension, const: CGFloat? = nil, mult: CGFloat? = nil, options: ConstraintOptions? = nil){ switch options{ case .none, .some(.equal): constraints.append(fromAnchor.constraint(equalTo: toAnchor, multiplier: mult ?? 1, constant: const ?? 0)) case .some(.lessOrEqual): constraints.append(fromAnchor.constraint(lessThanOrEqualTo: toAnchor, multiplier: mult ?? 1, constant: const ?? 0)) case .some(.moreOrEqual): constraints.append(fromAnchor.constraint(greaterThanOrEqualTo: toAnchor, multiplier: mult ?? 1, constant: const ?? 0)) } } private func iterateConstraint(){ constraints.last?.isActive = true currentAnchorIdx += 1 } } public enum ConstraintOptions { case equal case lessOrEqual case moreOrEqual } public enum ConstraintType { case top case leading case left case bottom case trailing case right case height case width case centerX case centerY } extension UIView { public func makeConstraints(for constraints: ConstraintType..., closure: @escaping (ConstraintMaker) -> () ){ let maker = ConstraintMaker() translatesAutoresizingMaskIntoConstraints = false for constraint in constraints { switch constraint { case .top: maker.add(topAnchor) case .left: maker.add(leftAnchor) case.bottom: maker.add(bottomAnchor) case .right: maker.add(rightAnchor) case .leading: maker.add(leadingAnchor) case .trailing: maker.add(trailingAnchor) case .height: maker.add(heightAnchor) case .width: maker.add(widthAnchor) case .centerX: maker.add(centerXAnchor) case .centerY: maker.add(centerYAnchor) } } closure(maker) } }
31.614865
177
0.60654
ddc64da98568096311258027e2990fbe765686db
2,990
php
PHP
web/app/themes/sage/app/View/Composers/App.php
pixelcollective/dreamdefenders.org
cae3fbc7c3408edea112ea98cd91651be0e80b4b
[ "MIT" ]
6
2020-02-03T08:55:27.000Z
2021-02-20T14:05:48.000Z
web/app/themes/sage/app/View/Composers/App.php
pixelcollective/dreamdefenders.org
cae3fbc7c3408edea112ea98cd91651be0e80b4b
[ "MIT" ]
354
2020-01-22T14:01:33.000Z
2022-02-14T07:49:32.000Z
web/app/themes/sage/app/View/Composers/App.php
pixelcollective/dreamdefenders.org
cae3fbc7c3408edea112ea98cd91651be0e80b4b
[ "MIT" ]
2
2020-02-03T08:55:29.000Z
2021-07-19T19:47:26.000Z
<?php namespace App\View\Composers; use Log1x\Navi\Navi; use Roots\Acorn\View\Composer; use Illuminate\Support\Collection; /** * Application-wide data. */ class App extends Composer { /** * List of views served by this composer. * * @var array */ protected static $views = ['*']; /** * Data to be passed to view before rendering. * * @return array */ public function with() { return [ 'app' => (object) [ 'site' => (object) [ get_bloginfo('name'), get_bloginfo('description'), get_bloginfo('url'), ], 'manifest' => (object) [ 'json' => get_bloginfo('url') . '/app/themes/sage/app-manifest.json', 'apple_touch_icon' => get_bloginfo('url') . '/app/themes/sage/dist/images/icons-192.png', ], 'accounts' => (object) [ 'facebook' => $this->modExists('facebook') ? "https://facebook.com/{$this->mods()->facebook}" : null, 'twitter' => $this->modExists('twitter') ? "https://twitter.com/{$this->mods()->twitter}" : null, 'instagram' => $this->modExists('instagram') ? "https://instagram.com/{$this->mods()->instagram}" : null, 'email' => $this->modExists('email') ? "mailto:{$this->mods()->email}" : null, ], 'actions' => [ (object) [ 'text' => $this->modExists('button_a_text') ? $this->mods()->button_a_text : null, 'url' => $this->modExists('button_a_url') ? $this->mods()->button_a_url : null, ], (object) [ 'text' => $this->modExists('button_b_text') ? $this->mods()->button_b_text : null, 'url' => $this->modExists('button_b_url') ? $this->mods()->button_b_url : null, ], ], ], 'navigation' => (object) [ 'about' => $this->navigation('about_us'), 'vision' => $this->navigation('our_vision'), 'work' => $this->navigation('our_work'), 'footer_left' => $this->navigation('footer_left'), 'footer_right' => $this->navigation('footer_right'), ], ]; } private function modExists(string $mod): Bool { return property_exists($this->mods(), $mod); } public function mods() { return (object) Collection::make(get_theme_mods())->toArray(); } /** * Returns the primary navigation. * * @return array */ public function navigation($nav) { $navigation = (new Navi())->build($nav); if ($navigation->isEmpty()) { return; } return $navigation->toArray(); } }
33.222222
125
0.468896
854de8ffd95526eace64c8c5ddec0b03e1f0a8ce
1,205
swift
Swift
AppStarter/Classes/Connection/LocalProviders/UserDefaultProvider.swift
wilsondgk/appStarter
799550b48d4309d34f309a6a489a61f3ba2f4330
[ "MIT" ]
null
null
null
AppStarter/Classes/Connection/LocalProviders/UserDefaultProvider.swift
wilsondgk/appStarter
799550b48d4309d34f309a6a489a61f3ba2f4330
[ "MIT" ]
null
null
null
AppStarter/Classes/Connection/LocalProviders/UserDefaultProvider.swift
wilsondgk/appStarter
799550b48d4309d34f309a6a489a61f3ba2f4330
[ "MIT" ]
null
null
null
// // UserDefaultProvider.swift // ConcreteMovieApp // // Created by Wilson Kim on 24/04/20. // Copyright © 2020 Wilson Kim. All rights reserved. // import Foundation public protocol UserDefaultProviderProtocol { func setValue<T: Encodable>(_ value: T, forKey key: String) func getValue<T: Decodable>(forKey key: String) -> T? func deleteObject(forKey key: String) } public class UserDefaultProvider { public static let shared = UserDefaultProvider() private let userDefaults = UserDefaults.standard private init() {} public func setValue<T: Encodable>(_ value: T, forKey key: String) { let jsonEncoder = JSONEncoder() let data = try? jsonEncoder.encode(value) userDefaults.set(data, forKey: key) userDefaults.synchronize() } public func getValue<T: Decodable>(forKey key: String) -> T? { guard let data = userDefaults.data(forKey: key) else { return nil } let resultDecoded = try? JSONDecoder().decode(T.self, from: data) return resultDecoded } public func deleteObject(forKey key: String) { userDefaults.set(nil, forKey: key) } }
27.386364
73
0.648963
1aecdbd17aee8891fc72f400e1f383d8d5198ea6
892
rs
Rust
ergoscript-compiler/src/error.rs
ross-weir/sigma-rust
90591f327e9c0d7b6811308cafe9bab094272624
[ "CC0-1.0" ]
37
2020-05-10T16:26:30.000Z
2022-03-31T13:36:09.000Z
ergoscript-compiler/src/error.rs
ross-weir/sigma-rust
90591f327e9c0d7b6811308cafe9bab094272624
[ "CC0-1.0" ]
511
2020-04-02T05:48:57.000Z
2022-03-30T16:32:52.000Z
ergoscript-compiler/src/error.rs
ross-weir/sigma-rust
90591f327e9c0d7b6811308cafe9bab094272624
[ "CC0-1.0" ]
26
2020-04-15T06:09:58.000Z
2022-03-29T08:14:35.000Z
use line_col::LineColLookup; use rowan::TextRange; pub fn pretty_error_desc(source: &str, span: TextRange, error_msg: &str) -> String { let line_col_lookup = LineColLookup::new(source); let start_zero_based: usize = usize::from(span.start()) - 1; let end_zero_based: usize = usize::from(span.end()) - 1; let (line_start, col_start) = line_col_lookup.get(start_zero_based); let (line_end, col_end) = line_col_lookup.get(end_zero_based); if line_end != line_start { return "Multiline error spans are not yet supported".to_string(); } let source_line = source.lines().nth(line_start - 1).unwrap(); let highlight = format!("{0:^>span$}", "^", span = col_end - col_start + 1); format!( "{0}\nline: {1}\n{2}\n{3:>ident$}", error_msg, line_start, source_line, highlight, ident = col_start + 1, ) }
37.166667
84
0.636771
b143bd997d8dee65ab77b6ff9cfe3a5ac484e97f
5,135
sql
SQL
Ecercicio Oficina.sql
GabrielSA87/database_study_and_sql_mysql_oracle
5f5ecf419cd0a138477a70472c8340c23db08267
[ "MIT" ]
null
null
null
Ecercicio Oficina.sql
GabrielSA87/database_study_and_sql_mysql_oracle
5f5ecf419cd0a138477a70472c8340c23db08267
[ "MIT" ]
null
null
null
Ecercicio Oficina.sql
GabrielSA87/database_study_and_sql_mysql_oracle
5f5ecf419cd0a138477a70472c8340c23db08267
[ "MIT" ]
null
null
null
-- EXERCICIO - CRIACAO E MODELAGEM -- /* 1) Crie um banco de dados chamado 'oficina' e conecte-se ao banco; 2) Faca a seguinte modelagem: Sr. Jose quer modernizar a sua oficina, e por enquanto, cadastrar os carros que entram para realizar servicos e os seus respectivos donos. Sr. Jose mencionou que cada cliente possui apenas um carro. Um carro possui uma marca. Sr. Jose tambem quer saber as cores dos carros para ter ideia de qual tinta comprar, e informar que um carro pode ter mais de uma cor. Sr. Jose necessita armazenar os telefones dos clientes, mas nao quer que eles sejam obrigatorios. */ -- EXECUCAO -- /* Tabelas: CARROS - MODELO CLIENTE - ID COR - ID MARCA - ID MARCA - NOME COR - NOME CLIENTE - NOME TELEFONE */ -- MODELAGEM, DATABASE E TABLES CRIADAS NO MYSQL WORKBENCH -- SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; -- ----------------------------------------------------- -- Schema oficina -- ----------------------------------------------------- DROP SCHEMA IF EXISTS `oficina` ; -- ----------------------------------------------------- -- Schema oficina -- ----------------------------------------------------- CREATE SCHEMA IF NOT EXISTS `oficina` DEFAULT CHARACTER SET utf8 ; USE `oficina` ; -- ----------------------------------------------------- -- Table `oficina`.`marca` -- ----------------------------------------------------- DROP TABLE IF EXISTS `oficina`.`marca` ; CREATE TABLE IF NOT EXISTS `oficina`.`marca` ( `IdMarca` INT NOT NULL AUTO_INCREMENT, `Nome` VARCHAR(45) NOT NULL, PRIMARY KEY (`IdMarca`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `oficina`.`carro` -- ----------------------------------------------------- DROP TABLE IF EXISTS `oficina`.`carro` ; CREATE TABLE IF NOT EXISTS `oficina`.`carro` ( `IdCarro` INT NOT NULL AUTO_INCREMENT, `Modelo` VARCHAR(45) NOT NULL, `Placa` VARCHAR(45) NOT NULL, `Id_Marca` INT NOT NULL, PRIMARY KEY (`IdCarro`, `Id_Marca`), INDEX `fk_carro_marca1_idx` (`Id_Marca` ASC), CONSTRAINT `fk_carro_marca1` FOREIGN KEY (`Id_Marca`) REFERENCES `oficina`.`marca` (`IdMarca`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `oficina`.`cliente` -- ----------------------------------------------------- DROP TABLE IF EXISTS `oficina`.`cliente` ; CREATE TABLE IF NOT EXISTS `oficina`.`cliente` ( `IdCliente` INT NOT NULL AUTO_INCREMENT, `Nome` VARCHAR(45) NOT NULL, `Sexo` ENUM('M', 'F') NOT NULL, `Id_Carro` INT NOT NULL, PRIMARY KEY (`IdCliente`, `Id_Carro`), INDEX `fk_cliente_carro_idx` (`Id_Carro` ASC), CONSTRAINT `fk_cliente_carro` FOREIGN KEY (`Id_Carro`) REFERENCES `oficina`.`carro` (`IdCarro`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `oficina`.`telefone` -- ----------------------------------------------------- DROP TABLE IF EXISTS `oficina`.`telefone` ; CREATE TABLE IF NOT EXISTS `oficina`.`telefone` ( `IdTelefone` INT NOT NULL AUTO_INCREMENT, `Numero` VARCHAR(20) NULL, `Tipo` ENUM('Residencial', 'Comercial', 'Celular') NULL, `Id_Cliente` INT NULL, PRIMARY KEY (`IdTelefone`, `Id_Cliente`), INDEX `fk_telefone_cliente1_idx` (`Id_Cliente` ASC), CONSTRAINT `fk_telefone_cliente` FOREIGN KEY (`Id_Cliente`) REFERENCES `oficina`.`cliente` (`IdCliente`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `oficina`.`Cor` -- ----------------------------------------------------- DROP TABLE IF EXISTS `oficina`.`Cor` ; CREATE TABLE IF NOT EXISTS `oficina`.`Cor` ( `IdCor` INT NOT NULL AUTO_INCREMENT, `Nome` VARCHAR(45) NOT NULL, PRIMARY KEY (`IdCor`)) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `oficina`.`carro_cor` -- ----------------------------------------------------- DROP TABLE IF EXISTS `oficina`.`carro_cor` ; CREATE TABLE IF NOT EXISTS `oficina`.`carro_cor` ( `Id_Carro` INT NOT NULL, `Id_Cor` INT NOT NULL, PRIMARY KEY (`Id_Carro`, `Id_Cor`), INDEX `fk_carro_cor_Cor1_idx` (`Id_Cor` ASC), CONSTRAINT `fk_carro_cor_carro` FOREIGN KEY (`Id_Carro`) REFERENCES `oficina`.`carro` (`IdCarro`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_carro_cor_Cor1` FOREIGN KEY (`Id_Cor`) REFERENCES `oficina`.`Cor` (`IdCor`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
32.295597
160
0.559299
53785de2ca82463d0a2f71d301bac2d38e4cf318
566
swift
Swift
MySwift/mycode/crypto/CryptoViewController.swift
DioLife/MySwift
ddbce1511302beef54f383ee7eb408afc445ed40
[ "MIT" ]
1
2021-05-16T17:12:52.000Z
2021-05-16T17:12:52.000Z
MySwift/mycode/crypto/CryptoViewController.swift
Jobs8w/MySwift
75d8fb649258438bf58c10d981ecb49e625b7e47
[ "MIT" ]
null
null
null
MySwift/mycode/crypto/CryptoViewController.swift
Jobs8w/MySwift
75d8fb649258438bf58c10d981ecb49e625b7e47
[ "MIT" ]
null
null
null
// // EncryptionViewController.swift // MySwift // // Created by Geek on 2019/12/12. // Copyright © 2019 Dio. All rights reserved. // import UIKit class CryptoViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } @IBAction func RSAencrypt(_ sender: UIButton) { } @IBAction func RSAdecrypt(_ sender: UIButton) { } @IBAction func MD5(_ sender: UIButton) { } @IBAction func Base64(_ sender: UIButton) { } }
16.171429
51
0.565371
ebdc7044f014b93e234b72c837c5e18d9a813e57
4,309
swift
Swift
Sources/SwiftAsyncUDPSocket/SwiftAsyncUDPSocket.swift
liam-i/SwiftAsnycSocket
00231bfa102d0b2da2ab9cf95f4eafa97dc3d016
[ "MIT" ]
39
2019-01-10T04:12:54.000Z
2021-10-01T17:16:10.000Z
Sources/SwiftAsyncUDPSocket/SwiftAsyncUDPSocket.swift
liam-i/SwiftAsnycSocket
00231bfa102d0b2da2ab9cf95f4eafa97dc3d016
[ "MIT" ]
1
2021-01-24T23:56:47.000Z
2021-11-04T18:19:31.000Z
Sources/SwiftAsyncUDPSocket/SwiftAsyncUDPSocket.swift
liam-i/SwiftAsnycSocket
00231bfa102d0b2da2ab9cf95f4eafa97dc3d016
[ "MIT" ]
12
2019-01-10T04:12:55.000Z
2022-01-27T06:28:46.000Z
// // SwiftAsyncUDPSocket.swift // SwiftAsyncSocket // // Created by chouheiwa on 2019/1/10. // Copyright © 2019 chouheiwa. All rights reserved. // import Foundation #if os(iOS) import UIKit #endif public class SwiftAsyncUDPSocket: NSObject { weak var delegateStore: SwiftAsyncUDPSocketDelegate? var delegateQueueStore: DispatchQueue? var receiveFilter: SwiftAsyncUDPSocketReceiveFilter? var sendFilter: SwiftAsyncUDPSocketSendFilter? var flags: SwiftAsyncUdpSocketFlags = [] var config: SwiftAsyncUdpSocketConfig = [] var max4ReceiveSizeStore: Int16 = Int16.max var max6ReceiveSizeStore: Int32 = Int32(Int16.max) var maxSendSizeStore: Int16 = Int16.max var socket4FD: Int32 = SwiftAsyncSocketKeys.socketNull var socket6FD: Int32 = SwiftAsyncSocketKeys.socketNull var socketQueue: DispatchQueue var send4Source: DispatchSourceWrite? var send6Source: DispatchSourceWrite? var receive4Source: DispatchSourceRead? var receive6Source: DispatchSourceRead? var sendTimer: DispatchSourceTimer? var currentSend: SwiftAsyncUDPPacket? var sendQueue: [SwiftAsyncUDPPacket] = [] var socket4FDBytesAvailable: UInt = 0 var socket6FDBytesAvailable: UInt = 0 var pendingFilterOperations: UInt32 = 0 var cachedLocalAddress4Store: SwiftAsyncUDPSocketAddress? var cachedLocalAddress6Store: SwiftAsyncUDPSocketAddress? var cachedConnectedAddressStore: SwiftAsyncUDPSocketAddress? var queueKey: DispatchSpecificKey<SwiftAsyncUDPSocket> = DispatchSpecificKey<SwiftAsyncUDPSocket>() var userDataStore: Any? public init(delegate: SwiftAsyncUDPSocketDelegate?, delegateQueue: DispatchQueue?, socketQueue: DispatchQueue? = nil) { delegateStore = delegate delegateQueueStore = delegateQueue if let socketQueue = socketQueue { assert(socketQueue != DispatchQueue.global(qos: .utility), SwiftAsyncSocketAssertError.queueLevel.description) assert(socketQueue != DispatchQueue.global(qos: .userInitiated), SwiftAsyncSocketAssertError.queueLevel.description) assert(socketQueue != DispatchQueue.global(qos: .default), SwiftAsyncSocketAssertError.queueLevel.description) self.socketQueue = socketQueue } else { self.socketQueue = DispatchQueue(label: SwiftAsyncSocketKeys.socketQueueName) } super.init() self.socketQueue.setSpecific(key: queueKey, value: self) #if os(iOS) NotificationCenter.default.addObserver(self, selector: #selector(applicationWillEnterForeGround), name: UIApplication.willEnterForegroundNotification, object: nil) #endif } deinit { #if os(iOS) NotificationCenter.default.removeObserver(self) #endif socketQueueDo { self.close(error: nil) } delegate = nil delegateQueue = nil } @objc func applicationWillEnterForeGround() { socketQueueDo(async: true, { self.resumeReceive4Source() self.resumeReceive6Source() }) } public func socketQueueDo(async: Bool = false, _ doBlock: @escaping () -> Void) { if DispatchQueue.getSpecific(key: queueKey) != nil { doBlock() } else { if async { socketQueue.async(execute: doBlock) } else { socketQueue.sync(execute: doBlock) } } } public func socketQueueDoWithError(_ errorBlock: () throws -> Void) throws { if DispatchQueue.getSpecific(key: queueKey) != nil { try errorBlock() } else { var err: SwiftAsyncSocketError? socketQueue.sync(execute: { do { try errorBlock() } catch let error as SwiftAsyncSocketError { err = error } catch { fatalError("\(error)") } }) if let error = err { throw error } } } }
28.726667
103
0.623811
2b8edcd2d441d61dd7499c5cf232e727c96da812
925
sql
SQL
migration/db/db.sql
Cactu5/recruitment-application
442ef07fc823d42333519ab5b3ca149b3e1e7343
[ "MIT" ]
null
null
null
migration/db/db.sql
Cactu5/recruitment-application
442ef07fc823d42333519ab5b3ca149b3e1e7343
[ "MIT" ]
19
2021-02-08T11:02:42.000Z
2021-03-15T10:12:35.000Z
migration/db/db.sql
Cactu5/recruitment-application
442ef07fc823d42333519ab5b3ca149b3e1e7343
[ "MIT" ]
null
null
null
CREATE DATABASE IF NOT EXISTS olddb; DROP TABLE IF EXISTS olddb.role; DROP TABLE IF EXISTS olddb.person; DROP TABLE IF EXISTS olddb.availability; DROP TABLE IF EXISTS olddb.competence; DROP TABLE IF EXISTS olddb.competence_profile; CREATE TABLE olddb.role (role_id BIGINT PRIMARY KEY,name VARCHAR(255)); CREATE TABLE olddb.person (person_id BIGINT PRIMARY KEY,name VARCHAR(255),surname VARCHAR(255),ssn VARCHAR(255),email VARCHAR(255),password VARCHAR(255),role_id BIGINT REFERENCES role,username VARCHAR(255)); CREATE TABLE olddb.availability (availability_id BIGINT PRIMARY KEY,person_id BIGINT REFERENCES person,from_date DATE,to_date DATE); CREATE TABLE olddb.competence (competence_id BIGINT PRIMARY KEY,name VARCHAR(255)); CREATE TABLE olddb.competence_profile (competence_profile_id BIGINT PRIMARY KEY,person_id BIGINT REFERENCES person,competence_id BIGINT REFERENCES competence,years_of_experience NUMERIC(4,2));
61.666667
207
0.83027
7adf251793b21977352610196d83af9829f4ecc5
3,905
rb
Ruby
examples/3playmedia.rb
parthikmodi/speech_to_text
62b2b73e57b9542dead0559291291b43330f1159
[ "MIT" ]
5
2020-04-30T22:44:05.000Z
2022-01-30T16:39:24.000Z
examples/3playmedia.rb
parthikmodi/speech_to_text
62b2b73e57b9542dead0559291291b43330f1159
[ "MIT" ]
1
2021-06-22T11:24:01.000Z
2021-06-22T11:24:01.000Z
examples/3playmedia.rb
parthikmodi/speech_to_text
62b2b73e57b9542dead0559291291b43330f1159
[ "MIT" ]
7
2019-06-26T14:01:06.000Z
2021-08-25T09:51:39.000Z
# frozen_string_literal: true require 'json' # method will create job and retun job_id # Note that it will not generate captions automatically # you have to tell 3playmedia to generate captions depending on turnaround_level_id(could be anything between 1 to 6 depending on urgency level) # turnaround_level_id = 6 mean highest priority and minimum amout of time def create_job(api_key, audio_file, name, create_job_file) cretae_job_command = "curl -X POST -F \"source_file=@#{audio_file}\" \"https://api.3playmedia.com/v3/files?api_key=#{api_key}&language_id=1&name=#{name}\" > #{create_job_file}" system(cretae_job_command) file = File.open(create_job_file, 'r') response = JSON.load file job_id = response['data']['id'] job_id end # get transcription id so you can check status of transcription def order_transcript(api_key, job_id, turnaround_level_id, order_transcript_file) order_transcript_commad = "curl -X POST \"https://api.3playmedia.com/v3/transcripts/order/transcription?api_key=#{api_key}&media_file_id=#{job_id}&turnaround_level_id=#{turnaround_level_id}\" >#{order_transcript_file}" system(order_transcript_commad) file = File.open(order_transcript_file, 'r') response = JSON.load file transcript_id = response['data']['id'] transcript_id end def check_status(api_key, transcript_id, status_file) check_status_command = "curl \"https://api.3playmedia.com/v3/transcripts/#{transcript_id}?api_key=#{api_key}\">#{status_file}" system(check_status_command) file = File.open(status_file, 'r') response = JSON.load file status = response['data']['status'] status end def download_transcript(api_key, output_format_id, transcript_id, trascript_json_file) download_transcript_command = "curl \"https://api.3playmedia.com/v3/transcripts/#{transcript_id}/text?api_key=#{api_key}&output_format_id=#{output_format_id}\" > #{trascript_json_file}" system(download_transcript_command) end def create_vttfile(trascript_json_file, vtt_file) file = File.open(trascript_json_file, 'r') response = JSON.load file data = response['data'] file.close out = File.open(vtt_file, 'w') out.puts data out.close end # rubocop:disable Naming/MethodName def deleteFiles(create_job_file, order_transcript_file, status_file, trascript_json_file) File.delete(create_job_file) File.delete(order_transcript_file) File.delete(status_file) File.delete(trascript_json_file) end # rubocop:enable Naming/MethodName #--------------------- # main code starts here #--------------------- api_key = ARGV[0] audio_file = ARGV[1] # full audio path /home/a/b/audio.flac name = ARGV[2] # anything to identify job (can be duplicate doesn't really matter) turnaround_level_id = ARGV[3] # could be anything between 1 to 6 (1 means lowest priority) output_format_id = ARGV[4] # output format could be anything, i.e plain text, srt file, vttfile etc.. use 139 for vtt_file and 7 for srt file # json file list create_job_file = ARGV[5] # /home/a/b/xyz.json order_transcript_file = ARGV[6] # /home/a/b/abc.json status_file = ARGV[7] # /home/a/b/mn.json trascript_json_file = ARGV[8] # /home/a/b/xxx.json # vtt file list vtt_file = ARGV[9] # /home/a/b/vttfile.vtt job_id = create_job(api_key, audio_file, name, create_job_file) transcript_id = order_transcript(api_key, job_id, turnaround_level_id, order_transcript_file) status = check_status(api_key, transcript_id, status_file) second = 0 # remove me while status != 'complete' status = check_status(api_key, transcript_id, status_file) puts status puts second break if status == 'cancelled' sleep(30) second += 31 # remove me, it is just to check time end if status == 'complete' download_transcript(api_key, output_format_id, transcript_id, trascript_json_file) create_vttfile(trascript_json_file, vtt_file) deleteFiles(create_job_file, order_transcript_file, status_file, trascript_json_file) end
39.846939
220
0.762612
dde9d2ca29b056f4d31bdac278a0cac1ef02bf98
1,224
php
PHP
src/Mems/MemsBundle/Form/AddRatingType.php
n1kula/sfMems
6bafbcb0c10068d2ecdb6b44d25f983188157157
[ "MIT" ]
null
null
null
src/Mems/MemsBundle/Form/AddRatingType.php
n1kula/sfMems
6bafbcb0c10068d2ecdb6b44d25f983188157157
[ "MIT" ]
null
null
null
src/Mems/MemsBundle/Form/AddRatingType.php
n1kula/sfMems
6bafbcb0c10068d2ecdb6b44d25f983188157157
[ "MIT" ]
null
null
null
<?php namespace Mems\MemsBundle\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class AddRatingType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('rating', 'choice', array( 'label' => 'Twoja ocena:', 'choices' => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5',) )) ->add('save', 'submit', array( 'label' => 'Dodaj ocenę', 'attr' => array( 'class' => 'btn btn-info',))) ; } /** * @param OptionsResolverInterface $resolver */ public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'Mems\MemsBundle\Entity\Rating' )); } /** * @return integer */ public function getName() { return 'mems_memsbundle_add_rating'; } }
27.2
83
0.540033
04f6a894d0ffb2857268e6b8da675fa2a3a9d053
893
sql
SQL
src/Service/FetchConfigurationDB/Stored Procedures/GetVariablesForDataSource.sql
Bhaskers-Blu-Org2/FetchClimate
0ce4bf3ef3c7933a21530050d3d087f4ce71ba21
[ "MIT" ]
10
2016-09-30T13:31:48.000Z
2018-08-18T01:59:38.000Z
src/Service/FetchConfigurationDB/Stored Procedures/GetVariablesForDataSource.sql
TerribleDev/FetchClimate
0ce4bf3ef3c7933a21530050d3d087f4ce71ba21
[ "MIT" ]
null
null
null
src/Service/FetchConfigurationDB/Stored Procedures/GetVariablesForDataSource.sql
TerribleDev/FetchClimate
0ce4bf3ef3c7933a21530050d3d087f4ce71ba21
[ "MIT" ]
9
2019-11-02T21:36:04.000Z
2021-11-16T02:52:44.000Z
--==================================================================================================================== --GetVariablesForDataSource - Retrieves all enabled variables for specified @TimeStamp(UTC) and @DataSourceName from EnvironmentalVariables, VariableMappings, DataSources, DataSourceIDs tables. -- Where DataSource Timestamp <= @TimeStamp (UTC). -- @TimeStamp DATETIME -- @DataSourceName --==================================================================================================================== CREATE PROCEDURE [dbo].[GetVariablesForDataSource] @TimeStamp DATETIME, @DataSourceName NVARCHAR(64) AS SELECT vars.DisplayName, vars.Description, vars.Units FROM [dbo].[GetRelevantMappings](@TimeStamp) vm INNER JOIN [dbo].EnvironmentalVariables vars ON vars.DisplayName=vm.EnvironmentalVariable WHERE vm.DataSourceName=@DataSourceName AND vm.IsEnabled=1
63.785714
194
0.592385
48b447c85d37d859c057bcb3683b69ddba61da39
15,709
swift
Swift
WindowAlert/Classes/WindowAlert.swift
ButterflyNetwork/WindowAlert
fbaeb26fcb5ce6e98b38e6e7125a112f703d14f7
[ "Apache-2.0" ]
null
null
null
WindowAlert/Classes/WindowAlert.swift
ButterflyNetwork/WindowAlert
fbaeb26fcb5ce6e98b38e6e7125a112f703d14f7
[ "Apache-2.0" ]
null
null
null
WindowAlert/Classes/WindowAlert.swift
ButterflyNetwork/WindowAlert
fbaeb26fcb5ce6e98b38e6e7125a112f703d14f7
[ "Apache-2.0" ]
null
null
null
import Foundation import UIKit /** WindowAlertDelegate protocol defines method that allow objects conforming to this protocol to be notified when WindowAlert object is being hidden or shown. */ public protocol WindowAlertDelegate { /** Tells the delegate that alert will soon be shown. - parameter windowAlert: alert to be shown. */ func windowAlertWillShow(windowAlert alert: WindowAlert) /** Tells the delegate that alert was shown to user. - parameter windowAlert: alert that was shown. */ func windowAlertDidShow(windowAlert alert: WindowAlert) /** Tells the delegate that alert will soon be hidden. - parameter windowAlert: alert to be hidden. */ func windowAlertWillHide(windowAlert alert: WindowAlert) /** Tells the delegate that alert was hidden. - parameter windowAlert: alert that was hidden. */ func windowAlertDidHide(windowAlert alert: WindowAlert) } /** WindowAlertAction describes single action that will be shown in WindowAlert. This objects describes action configuration, such as title of the action, it's style and behavior when tapping on button corresponding to this action. Please note that you must not call WindowAlert hide() method in WindowAlertAction handler, as WindowAlert will be hidden automatically after action invocation. */ public class WindowAlertAction { /** Creates and returns action with specified indentifier, title, style and action handler. - parameter id: Unique identifier for current action. - parameter title: Text that will be displayed on action button. Must be localized. - parameter style: Action button style. - parameter handler: Action to execute when action button will be selected. - returns: New WindowAlertAction object. */ public init(id: String?, title: String, style: UIAlertActionStyle, handler: ((WindowAlertAction) -> Void)?) { self.id = id self.title = title self.style = style self.action = handler } /** Creates and returns action with specified title, style and action handler, but without identifier. - parameter title: Text that will be displayed on action button. Must be localized. - parameter style: Action button style. - parameter handler: Action to execute when action button will be selected. - returns: New WindowAlertAction object. */ public convenience init(title: String, style: UIAlertActionStyle, handler: ((WindowAlertAction) -> Void)?) { self.init(id: nil, title: title, style: style, handler: handler) } /** Unique string identifier for this action. */ public private(set) var id: String? /** Title that will be displayed on corresponding button. */ public private(set) var title: String /** Style for WindowAlertAction. All the styles that are supported in UIAlertAction are also supported here. */ public private(set) var style: UIAlertActionStyle fileprivate var action: ((WindowAlertAction) -> Void)? } /** WindowAlert is a helper object that wraps UIAlertController and UIWindow classes to simplify UIAlertController presentation logic. It creates new UIWindow at UIWindowLevelAlert window level(or another one, if you wish to redefine it via defaultWindowLevel property of WindowAlert class), and sets empty root UIViewController to present UIAlertController from it. This class uses APIs very similar to UIViewController APIs, but instead of presenting you'll have to call show() method, which makes it somewhat similar to UIAlertView. This class is not thread-safe, calling it's method from threads different from main one will lead to weird and buggy behavior. */ public class WindowAlert { /** Default window level for UIWindow that holds UIAlertController. Only change this value if you want to change WindowAlert window level globally, for per-alert basis please use windowLevel property of WindowAlert. */ public static var defaultWindowLevel: UIWindowLevel = UIWindowLevelAlert /** Window level for UIWindow that holds UIAlertController. Changing this won't have any effect on alert if it's already visible, so set it before calling show() or hide and re-show alert after changing this value. */ public var windowLevel = WindowAlert.defaultWindowLevel /** Set this value to true if you want WindowAlert to be hidden when user taps outside of UIAlertController. This is disabled by default as it goes against default behavior of UIAlertController, but can be useful if you want to display dismissable UIAlertController without buttons. */ public var hideOnTapOutside = false /** The actions that user can invoke for this WindowAlert. */ public private(set) var actions: [WindowAlertAction] /** Alert delegate that will receive reports for this alert visibility. */ public var delegate: WindowAlertDelegate? private var textFieldConfigurationHandlers: [((UITextField) -> Void)?] private var storedTitle: String? /** The title of the alert. */ public var title: String? { get { return storedTitle } set(newTitle) { storedTitle = newTitle alertController?.title = newTitle } } private var storedMessage: String? /** The message of the alert. */ public var message: String? { get { return storedMessage } set(newMessage) { storedMessage = newMessage alertController?.message = newMessage } } private var storedPreferredStyle: UIAlertControllerStyle /** Preferred style of the alert. */ public var preferredStyle: UIAlertControllerStyle { get { return storedPreferredStyle } } /** The array of text fields displayed by the alert. */ public var textFields: [UITextField]? { get { return alertController?.textFields } } /** Holds true if UIWindow that holds UIAlertController, and UIAlertController itself is added to window hierarchy and is visible, otherwise false. */ public var visible: Bool { get { if let window = self.internalWindow { return !window.isHidden } //if internalWindow is nil, then it can't be visible, returning false return false } } private var internalWindow: TapAwareWindow? private var alertController: UIAlertController? private let rootViewController = UIViewController() private var internalWindowTintColor: UIColor? private var internalWindowFrame: CGRect /** Creates and returns new alert with specified title, message, style, tint color and window size. - parameter title: Title for the alert. - parameter message: Message for the alert. - parameter preferredStyle: Preferred style for the alert. - parameter tintColor: Tint color for alert. If nil, then default tint color will be used. - parameter frame: Size and position of window that contains alert controller. In most cases it should be the same as screen frame or main application window frame. - returns: New WindowAlert object. */ public init(title: String, message: String?, preferredStyle: UIAlertControllerStyle, tintColor: UIColor?, frame: CGRect) { actions = [] textFieldConfigurationHandlers = [] storedPreferredStyle = preferredStyle storedTitle = title storedMessage = message internalWindowFrame = frame internalWindowTintColor = tintColor } /** Creates and returns new alert with specified title, message, style and reference window. - parameter title: Title for the alert. - parameter message: Message for the alert. - parameter preferredStyle: Preferred style for the alert. - parameter referenceWindow: Window to inherit size and tint color from. - returns: New WindowAlert object. */ public convenience init(title: String, message: String?, preferredStyle: UIAlertControllerStyle, referenceWindow: UIWindow) { let tint: UIColor? = referenceWindow.tintColor //workaround for cases when referenceWindow.tintColor is nil self.init(title: title, message: message, preferredStyle: preferredStyle, tintColor: tint, frame: referenceWindow.frame) } /** Tries to create and returns new alert with specified title, message, style and main application window taken from app delegate as reference window. May fail if main application window or app delegate is missing. - parameter title: Title for the alert. - parameter message: Message for the alert. - parameter preferredStyle: Preferred style for the alert. - returns: New WindowAlert object or nil if app delegate or main window is missing. */ public convenience init?(title: String, message: String?, preferredStyle: UIAlertControllerStyle) { guard let delegate = UIApplication.shared.delegate else { return nil } guard let windowPresent = delegate.window else { return nil } guard let window = windowPresent else { return nil } self.init(title: title, message: message, preferredStyle: preferredStyle, referenceWindow: window) } private func createNewWindow() { internalWindow = TapAwareWindow(frame: internalWindowFrame) //safe to unwrap, since, well, we just created it internalWindow!.tintColor = internalWindowTintColor internalWindow!.windowLevel = windowLevel internalWindow!.rootViewController = rootViewController var strongSelf: WindowAlert? = self //this is needed to keep reference to self inside of closure until it's called internalWindow!.actionOnTap = { touch in if let s = strongSelf { if(s.hideOnTapOutside) { guard let controller = s.alertController else { s.hide() return } let locationInView = touch.location(in: nil) //pass nil to get location in window if(!controller.view.frame.contains(locationInView)) { s.hide() strongSelf = nil } } } } } private func createAlertController() { alertController = UIAlertController(title: storedTitle, message: storedMessage, preferredStyle: storedPreferredStyle) //safe to unwrap since we just created it for action in actions { alertController!.addAction(convertWindowAlertViewActionToAlertControllerAction(windowAlertViewAction: action)) } for textFieldConfigurationHandler in textFieldConfigurationHandlers { alertController!.addTextField(configurationHandler: textFieldConfigurationHandler) } } /** Add new window to window hieararchy at set window level, and present UIAlertController on top of invisible root view controller attached to this new window. - returns: True if UIAlertController was presented, false otherwise(was already presented, or reference window is missing) */ public func show() -> Bool { if(visible) { return false } delegate?.windowAlertWillShow(windowAlert: self) createNewWindow() createAlertController() //at this point alertController is not nil thanks to ensureAlertController(), so it's safe to unwrap alertController //it's also safe to unwrap rootViewController, thanks to ensureWindowIfPossible() //and it's also safe to unwrap internalWindow, since createNewWindow() takes care of it's creation internalWindow!.makeKeyAndVisible() internalWindow!.rootViewController!.present(alertController!, animated: true, completion: { self.delegate?.windowAlertDidShow(windowAlert: self) }) return true } /** Removes window from window hierarchy and dismisses UIAlertController. - returns: True if was hidden successfully, false if tried to hide already hidden alert. */ public func hide() -> Bool { //if WindowAlert is already hidden, no need to proceed if(!visible) { return false } guard let window = internalWindow else { return false } delegate?.windowAlertWillHide(windowAlert: self) window.rootViewController!.dismiss(animated: true, completion: { //removing window from window hierarchy, and getting rid of unnecessary resources window.isHidden = true window.removeFromSuperview() window.actionOnTap = nil self.internalWindow = nil self.alertController = nil self.delegate?.windowAlertDidHide(windowAlert: self) }) return true } /** Attaches an action to this WindowAlert. Please remember not to call hide() inside of action handler, as WindowAlert will hide automatically when action is invoked. - parameter action: Action to add to the alert. */ public func add(action: WindowAlertAction) { let alertAction = convertWindowAlertViewActionToAlertControllerAction(windowAlertViewAction: action) actions.append(action) alertController?.addAction(alertAction) } private func convertWindowAlertViewActionToAlertControllerAction(windowAlertViewAction action: WindowAlertAction) -> UIAlertAction { var selfReference: WindowAlert? = self let actualAction = action.action let alertAction = UIAlertAction(title: action.title, style: action.style) { _ in actualAction?(action) //no need to dismiss UIAlertController, as it's automatically dismissed //removing window from window hierarchy, and getting rid of unnecessary resources selfReference?.internalWindow?.isHidden = true selfReference?.internalWindow?.removeFromSuperview() selfReference?.internalWindow?.actionOnTap = nil selfReference?.internalWindow = nil selfReference?.alertController = nil if let selfStrongReference = selfReference { selfStrongReference.delegate?.windowAlertDidHide(windowAlert: selfStrongReference) } //now onto preventing retain cycle selfReference = nil } return alertAction } /** Adds a text field to an alert. - parameter configurationHandler: Action to be invoked with UITextField as argument before showing alert to the user. Use this action to configure UITextField parameters. */ public func addTextField(configurationHandler: ((UITextField) -> Void)?) { textFieldConfigurationHandlers.append(configurationHandler) alertController?.addTextField(configurationHandler: configurationHandler) } }
38.221411
178
0.662359
e7e5c895abc0ee9bfb4cd36159a6134cef6ae347
9,868
swift
Swift
src/xcode/ENA/ENA/Source/Scenes/ExposureSubmission/ExposureSubmissionTestResultViewController.swift
fredpi/cwa-app-ios
b77787e455cc1cceda940e78bf8baeda839cdf38
[ "Apache-2.0" ]
null
null
null
src/xcode/ENA/ENA/Source/Scenes/ExposureSubmission/ExposureSubmissionTestResultViewController.swift
fredpi/cwa-app-ios
b77787e455cc1cceda940e78bf8baeda839cdf38
[ "Apache-2.0" ]
null
null
null
src/xcode/ENA/ENA/Source/Scenes/ExposureSubmission/ExposureSubmissionTestResultViewController.swift
fredpi/cwa-app-ios
b77787e455cc1cceda940e78bf8baeda839cdf38
[ "Apache-2.0" ]
null
null
null
// Corona-Warn-App // // SAP SE and all other contributors // copyright owners license this file to you under the Apache // License, Version 2.0 (the "License"); you may not use this // file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, // software distributed under the License is distributed on an // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. import Foundation import UIKit class ExposureSubmissionTestResultViewController: DynamicTableViewController, SpinnerInjectable { // MARK: - Attributes. var exposureSubmissionService: ExposureSubmissionService? var testResult: TestResult? var spinner: UIActivityIndicatorView? // MARK: - View Lifecycle methods. override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) DispatchQueue.main.async { [weak self] in self?.navigationController?.navigationBar.sizeToFit() } } override func viewDidLoad() { super.viewDidLoad() setupView() } override func prepare(for segue: UIStoryboardSegue, sender _: Any?) { switch Segue(segue) { case .warnOthers: let destination = segue.destination as? ExposureSubmissionWarnOthersViewController destination?.exposureSubmissionService = exposureSubmissionService default: return } } // MARK: - View Setup Helper methods. private func setupView() { setupDynamicTableView() setupNavigationBar() setupButton() } private func setupButton() { guard let result = testResult else { return } switch result { case .positive: setButtonTitle(to: AppStrings.ExposureSubmissionResult.continueButton) case .negative, .invalid: setButtonTitle(to: AppStrings.ExposureSubmissionResult.deleteButton) case .pending: setButtonTitle(to: AppStrings.ExposureSubmissionResult.refreshButton) setSecondaryButtonTitle(to: AppStrings.ExposureSubmissionResult.deleteButton) showSecondaryButton() } } private func setupNavigationBar() { navigationItem.hidesBackButton = true navigationController?.navigationItem.largeTitleDisplayMode = .always navigationItem.title = AppStrings.ExposureSubmissionResult.title } private func setupDynamicTableView() { guard let result = testResult else { logError(message: "No test result.", level: .error) return } tableView.register( ExposureSubmissionTestResultHeaderView.self, forHeaderFooterViewReuseIdentifier: HeaderReuseIdentifier.testResult.rawValue ) tableView.register( DynamicTableViewStepCell.self, forCellReuseIdentifier: DynamicTableViewStepCell.tableViewCellReuseIdentifier.rawValue ) dynamicTableViewModel = dynamicTableViewModel(for: result) } // MARK: - Convenience methods for buttons. private func deleteTest() { let alert = UIAlertController( title: "Test entfernen?", message: "Der Test wird endgültig aus der Corona-Warn-App entfernt. Dieser Vorgang kann nicht widerrufen werden.", preferredStyle: .alert ) let cancel = UIAlertAction( title: "Abbrechen", style: .cancel, handler: { _ in alert.dismiss(animated: true, completion: nil) } ) let delete = UIAlertAction( title: "Entfernen", style: .destructive, handler: { _ in self.exposureSubmissionService?.deleteTest() self.navigationController?.dismiss(animated: true, completion: nil) } ) alert.addAction(delete) alert.addAction(cancel) present(alert, animated: true, completion: nil) } private func refreshTest() { startSpinner() exposureSubmissionService? .getTestResult { result in self.stopSpinner() switch result { case let .failure(error): let alert = ExposureSubmissionViewUtils.setupErrorAlert(error) self.present(alert, animated: true, completion: nil) case let .success(testResult): self.dynamicTableViewModel = self.dynamicTableViewModel(for: testResult) self.tableView.reloadData() } } } private func showWarnOthers() { performSegue(withIdentifier: Segue.warnOthers, sender: self) } } // MARK: - Custom Segues. extension ExposureSubmissionTestResultViewController { enum Segue: String, SegueIdentifier { case warnOthers = "warnOthersSegue" } } // MARK: - Custom HeaderReuseIdentifiers. extension ExposureSubmissionTestResultViewController { enum HeaderReuseIdentifier: String, TableViewHeaderFooterReuseIdentifiers { case testResult = "testResultCell" } } // MARK: ExposureSubmissionNavigationControllerChild methods. extension ExposureSubmissionTestResultViewController: ExposureSubmissionNavigationControllerChild { func didTapBottomButton() { guard let result = testResult else { return } switch result { case .positive: showWarnOthers() case .negative, .invalid: deleteTest() case .pending: refreshTest() } } func didTapSecondButton() { guard let result = testResult else { return } switch result { case .pending: deleteTest() default: // Secondary button is only active for pending result state. break } } } // MARK: - DynamicTableViewModel convenience setup methods. private extension ExposureSubmissionTestResultViewController { private func dynamicTableViewModel(for result: TestResult) -> DynamicTableViewModel { DynamicTableViewModel.with { $0.add( testResultSection(for: result) ) } } private func testResultSection(for result: TestResult) -> DynamicSection { switch result { case .positive: return positiveTestResultSection() case .negative: return negativeTestResultSection() case .invalid: return invalidTestResultSection() case .pending: return pendingTestResultSection() } } private func positiveTestResultSection() -> DynamicSection { .section( header: .identifier( ExposureSubmissionTestResultViewController.HeaderReuseIdentifier.testResult, configure: { view, _ in (view as? ExposureSubmissionTestResultHeaderView)?.configure(testResult: .positive) } ), separators: false, cells: [ .bigBold(text: AppStrings.ExposureSubmissionResult.procedure), .stepCellWith( title: AppStrings.ExposureSubmissionResult.testAdded, text: AppStrings.ExposureSubmissionResult.testAddedDesc, image: UIImage(named: "Icons_Grey_Check") ), .stepCellWith( title: AppStrings.ExposureSubmissionResult.testPositive, text: AppStrings.ExposureSubmissionResult.testPositiveDesc, image: UIImage(named: "Icons_Grey_Check") ), .stepCellWith( title: AppStrings.ExposureSubmissionResult.warnOthers, text: AppStrings.ExposureSubmissionResult.warnOthersDesc, image: UIImage(named: "Icons_Grey_Warnen"), hasSeparators: false ) ] ) } private func negativeTestResultSection() -> DynamicSection { .section( header: .identifier( ExposureSubmissionTestResultViewController.HeaderReuseIdentifier.testResult, configure: { view, _ in (view as? ExposureSubmissionTestResultHeaderView)?.configure(testResult: .negative) } ), separators: false, cells: [ .bigBold(text: AppStrings.ExposureSubmissionResult.procedure), .stepCellWith( title: AppStrings.ExposureSubmissionResult.testAdded, text: AppStrings.ExposureSubmissionResult.testAddedDesc, image: UIImage(named: "Icons_Grey_Check") ), .stepCellWith( title: AppStrings.ExposureSubmissionResult.testNegative, text: AppStrings.ExposureSubmissionResult.testNegativeDesc, image: UIImage(named: "Icons_Grey_Check"), hasSeparators: false ) ] ) } private func invalidTestResultSection() -> DynamicSection { .section( header: .identifier( ExposureSubmissionTestResultViewController.HeaderReuseIdentifier.testResult, configure: { view, _ in (view as? ExposureSubmissionTestResultHeaderView)?.configure(testResult: .invalid) } ), separators: false, cells: [ .bigBold(text: AppStrings.ExposureSubmissionResult.procedure), .stepCellWith( title: AppStrings.ExposureSubmissionResult.testAdded, text: AppStrings.ExposureSubmissionResult.testAddedDesc, image: UIImage(named: "Icons_Grey_Check") ), .stepCellWith( title: AppStrings.ExposureSubmissionResult.testInvalid, text: AppStrings.ExposureSubmissionResult.testInvalidDesc, image: UIImage(named: "Icons_Grey_Error"), hasSeparators: false ) ] ) } private func pendingTestResultSection() -> DynamicSection { .section( header: .identifier( ExposureSubmissionTestResultViewController.HeaderReuseIdentifier.testResult, configure: { view, _ in (view as? ExposureSubmissionTestResultHeaderView)?.configure(testResult: .pending) } ), cells: [ .bigBold(text: AppStrings.ExposureSubmissionResult.procedure), .stepCellWith( title: AppStrings.ExposureSubmissionResult.testAdded, text: AppStrings.ExposureSubmissionResult.testAddedDesc, image: UIImage(named: "Icons_Grey_Check") ), .stepCellWith( title: AppStrings.ExposureSubmissionResult.testPending, text: AppStrings.ExposureSubmissionResult.testPendingDesc, image: UIImage(named: "Icons_Grey_Wait"), hasSeparators: false ) ] ) } } private extension DynamicCell { static func stepCellWith(title: String, text: String, image: UIImage? = nil, hasSeparators: Bool = true) -> DynamicCell { return .identifier( DynamicTableViewStepCell.tableViewCellReuseIdentifier, configure: { _, cell, _ in guard let cell = cell as? DynamicTableViewStepCell else { return } cell.configure( title: title, text: text, image: image, hasSeparators: hasSeparators, isCircle: true ) } ) } }
28.769679
122
0.744528
48f5209422c8afd842444f3c7f0d172abab12c6e
1,099
h
C
build/iphone/Classes/TiUITextField.h
DavidHLSilva/App_clima
b5b6d2697829821464333c98e210923df32dcad9
[ "Apache-2.0" ]
1
2017-10-13T21:37:06.000Z
2017-10-13T21:37:06.000Z
build/iphone/Classes/TiUITextField.h
DavidHLSilva/App_clima
b5b6d2697829821464333c98e210923df32dcad9
[ "Apache-2.0" ]
null
null
null
build/iphone/Classes/TiUITextField.h
DavidHLSilva/App_clima
b5b6d2697829821464333c98e210923df32dcad9
[ "Apache-2.0" ]
1
2021-07-18T03:02:33.000Z
2021-07-18T03:02:33.000Z
/** * Appcelerator Titanium Mobile * Copyright (c) 2009-2018 by Appcelerator, Inc. All Rights Reserved. * Licensed under the terms of the Apache Public License * Please see the LICENSE included with this distribution for details. * * WARNING: This is generated code. Modify at your own risk and without support. */ #ifdef USE_TI_UITEXTFIELD #import "TiUITextWidget.h" @interface TiTextField : UITextField { CGFloat paddingLeft; CGFloat paddingRight; CGFloat leftButtonPadding; CGFloat rightButtonPadding; UITextFieldViewMode leftMode; UITextFieldViewMode rightMode; UIView *left; UIView *right; UIView *leftView; UIView *rightView; TiUIView *touchHandler; } @property (nonatomic, readwrite, assign) CGFloat paddingLeft; @property (nonatomic, readwrite, assign) CGFloat paddingRight; @property (nonatomic, readwrite, assign) CGFloat leftButtonPadding; @property (nonatomic, readwrite, assign) CGFloat rightButtonPadding; - (void)setTouchHandler:(TiUIView *)handler; @end @interface TiUITextField : TiUITextWidget <UITextFieldDelegate> { @private } @end #endif
25.55814
80
0.77252
4c1fe1f8fea26c53bb74c66a51adcc499e4f80eb
2,231
php
PHP
app/Http/Middleware/Ucenter.php
workliyi/bibipayPz
81864c34ba3e5dd828b7aa9db7ccdb8e70ee8a6a
[ "MIT" ]
2
2018-09-22T11:42:37.000Z
2020-05-09T06:01:24.000Z
app/Http/Middleware/Ucenter.php
workliyi/bibipayPz
81864c34ba3e5dd828b7aa9db7ccdb8e70ee8a6a
[ "MIT" ]
null
null
null
app/Http/Middleware/Ucenter.php
workliyi/bibipayPz
81864c34ba3e5dd828b7aa9db7ccdb8e70ee8a6a
[ "MIT" ]
null
null
null
<?php namespace App\Http\Middleware; use Closure; use App\Model\User; use App\Model\AuthCodeKey; class Ucenter { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next,$massage = '') { $base_token = ($request->basetoken ? $request->basetoken : substr($request->header('Authorization'),7, strlen($request->header('Authorization')))); $base_token = str_replace(' ','+',$base_token); $base_arr = explode('.' , $base_token); // $plat_key = env('JWT_SECRET'); $plat_key = config('app.warrant_key'); //dd($plat_key); $user_key = $this->get_user_key($base_arr[0],$plat_key); //解密 if (!empty($user_key)){ $time = base64_decode($base_arr[1]); $get_token = $this->base_token($user_key,$time); $last_base_token = $base_arr[1].'.'.$base_arr[2]; //dd($last_base_token); if ($last_base_token == $get_token){ $key = ['key'=>$user_key]; $user = ['user' => User::where('key' , $key)->first()]; $request->merge($key);//添加参数 $request->merge($user); return $next($request); } else { abort(403, $massage ?: '你没有权限执行该操作'); } } else { abort(403, $massage ?: '你没有权限执行该操作'); } } public function base_token($user_key,$time){ $authcode =new AuthCodeKey(); //获取平台key $key = config('app.warrant_key'); $time = base64_encode((string)$time); // 加密 $last_user_key = $authcode->authcode($user_key,'ENCODE',$key,0); //设置的加密参数 $data = "$user_key.$time"; $hmac = hash_hmac("sha256", $data, $key, TRUE); //加密后字符串 $signature = base64_encode($hmac); //最终生成的base_token $base_token = $time.'.'.$signature; return $base_token; } public function get_user_key($data,$key){ $authcode = new AuthCodeKey(); return $authcode->authcode($data,'DECODE',$key,0); //解密 } }
32.808824
100
0.529359
b9c8d65179c9ee0a8260c4d4bcf2ae6dbdcdb0a2
243
h
C
src/base_layer.h
isi-nlp/Zoph_RNN
1e3e7da688cfcd0cdfb0c117cb84705399d1a967
[ "MIT" ]
199
2015-08-30T18:45:02.000Z
2021-11-04T09:04:20.000Z
src/base_layer.h
isi-nlp/Zoph_RNN
1e3e7da688cfcd0cdfb0c117cb84705399d1a967
[ "MIT" ]
12
2016-03-07T04:37:23.000Z
2019-04-10T08:14:06.000Z
src/base_layer.h
isi-nlp/Zoph_RNN
1e3e7da688cfcd0cdfb0c117cb84705399d1a967
[ "MIT" ]
72
2015-08-17T23:00:21.000Z
2021-11-29T14:03:58.000Z
#ifndef BASE_LAYER_H #define BASE_LAYER_H #include "model.h" #include "Eigen_Util.h" template<typename dType> class neuralMT_model; template<typename dType> class base_layer { public: dType *h_h_t_below; dType *d_h_t_below; }; #endif
12.15
24
0.765432
e9aa2eebf0d083f9eb7c242ed65bf9f8f863424a
3,193
go
Go
etw/provider.go
0xrawsec/golang-etw
4332ebf570484530561cfcee82780b19d735468e
[ "Apache-2.0" ]
7
2021-07-08T10:00:39.000Z
2022-01-27T13:32:36.000Z
etw/provider.go
0xrawsec/golang-etw
4332ebf570484530561cfcee82780b19d735468e
[ "Apache-2.0" ]
null
null
null
etw/provider.go
0xrawsec/golang-etw
4332ebf570484530561cfcee82780b19d735468e
[ "Apache-2.0" ]
3
2021-07-13T07:54:21.000Z
2022-01-27T13:32:18.000Z
//go:build windows // +build windows package etw import ( "fmt" "strconv" "strings" "unsafe" ) var ( providers ProviderMap DefaultProvider = Provider{EnableLevel: 0xff} ) type ProviderMap map[string]*Provider type Provider struct { GUID string Name string EnableLevel uint8 MatchAnyKeyword uint64 MatchAllKeyword uint64 Filter []uint16 } func NewProvider() Provider { p := DefaultProvider p.Filter = make([]uint16, 0) return p } // ProviderFromString parses a string and returns a provider. // The returned provider is initialized from DefaultProvider. // Format (Name|GUID):EnableLevel:Event IDs:MatchAnyKeyword:MatchAllKeyword func ProviderFromString(s string) (p Provider, err error) { var u uint64 split := strings.Split(s, ":") for i := 0; i < len(split); i++ { chunk := split[i] switch i { case 0: p = ResolveProvider(chunk) if p.IsZero() { err = fmt.Errorf("Provider not found: %s", chunk) return } case 1: if chunk == "" { break } if u, err = strconv.ParseUint(chunk, 0, 8); err != nil { return } else { p.EnableLevel = uint8(u) } case 2: if chunk == "" { break } for _, eid := range strings.Split(chunk, ",") { if u, err = strconv.ParseUint(eid, 0, 16); err != nil { return } else { p.Filter = append(p.Filter, uint16(u)) } } case 3: if chunk == "" { break } if u, err = strconv.ParseUint(chunk, 0, 64); err != nil { return } else { p.MatchAnyKeyword = u } case 4: if chunk == "" { break } if u, err = strconv.ParseUint(chunk, 0, 64); err != nil { return } else { p.MatchAllKeyword = u } default: return } } return } // IsZero returns true if the provider is empty func (p *Provider) IsZero() bool { return p.GUID == "" } // EnumerateProviders returns a ProviderMap containing available providers // keys are both provider's GUIDs and provider's names func EnumerateProviders() (m ProviderMap) { var buf *ProviderEnumerationInfo size := uint32(1) for { tmp := make([]byte, size) buf = (*ProviderEnumerationInfo)(unsafe.Pointer(&tmp[0])) if err := TdhEnumerateProviders(buf, &size); err != ERROR_INSUFFICIENT_BUFFER { break } } m = make(ProviderMap) startProvEnumInfo := uintptr(unsafe.Pointer(buf)) it := uintptr(unsafe.Pointer(&buf.TraceProviderInfoArray[0])) for i := uintptr(0); i < uintptr(buf.NumberOfProviders); i++ { ptpi := (*TraceProviderInfo)(unsafe.Pointer(it + i*unsafe.Sizeof(buf.TraceProviderInfoArray[0]))) guid := ptpi.ProviderGuid.String() name := UTF16AtOffsetToString(startProvEnumInfo, uintptr(ptpi.ProviderNameOffset)) // We use a default provider here p := DefaultProvider p.GUID = guid p.Name = name m[name] = &p m[guid] = &p } return } // ResolveProvider return a Provider structure given a GUID or // a provider name as input func ResolveProvider(s string) (p Provider) { if providers == nil { providers = EnumerateProviders() } if g, err := GUIDFromString(s); err == nil { s = g.String() } if prov, ok := providers[s]; ok { // search provider by name return *prov } return }
21.286667
99
0.646101
b91d688d9a52738fcf67df77245de51534a1430a
1,040
sql
SQL
shortstop/shortstop_minors_fantasy_seeds.sql
tinoganacias/minors_2022
677f7ae2284cc8a2fe2b659659b77e986c7a1d76
[ "MIT" ]
null
null
null
shortstop/shortstop_minors_fantasy_seeds.sql
tinoganacias/minors_2022
677f7ae2284cc8a2fe2b659659b77e986c7a1d76
[ "MIT" ]
null
null
null
shortstop/shortstop_minors_fantasy_seeds.sql
tinoganacias/minors_2022
677f7ae2284cc8a2fe2b659659b77e986c7a1d76
[ "MIT" ]
null
null
null
USE minors_2022; INSERT INTO shortstop_minors_fantasy( first_name, last_name, ORG, ETA, PA, H, R, HR, RBI, SB, AVG, OPS, BB_rate, K_rate ) VALUES ('Bobby','Witt Jr.','Kansas City',2022,564,144,99,33,97,29,.290,.936,.090,.232), ('CJ','Abrams','San Diego',2022,183,48,26,2,23,13,.296,.782,.096,.230), ('Marcelo','Mayer','Boston',2025,107,25,25,3,17,7,.275,.817,.140,.252), ('Marco','Luciano','San Francisco',2024,453,102,68,19,71,6,.258,.815,.105,.269), ('Oneil','Cruz','Pittsburgh',2022,302,84,62,17,47,19,.310,.970,.092,.228), ('Noelvi','Marte','Seattle',2024,511,121,91,17,71,24,.273,.825,.117,.228), ('Anthony','Volpe','New York(A)',2023,513,121,113,27,86,33,.294,1.027,.152,.196), ('Kahlil','Watson','Miami',2024,42,13,13,0,5,4,.394,1.130,.190,.166), ('Jeremy','Pena','Houston',2022,160,43,25,10,21,6,.297,.942,.05,.256), ('Brady','House','Washington',2024,66,19,14,4,12,0,.322,.970,.106,.196); SELECT * FROM shortstop_minors_fantasy;
27.368421
82
0.593269
568cdf3c6505bef0a4cb17ad5476b2ee0a4a4522
75
go
Go
doc.go
koron-go/syncgate
72ae3fd1752b89f8014e3402f1821098ff1067c2
[ "MIT" ]
null
null
null
doc.go
koron-go/syncgate
72ae3fd1752b89f8014e3402f1821098ff1067c2
[ "MIT" ]
null
null
null
doc.go
koron-go/syncgate
72ae3fd1752b89f8014e3402f1821098ff1067c2
[ "MIT" ]
null
null
null
/* Package syncgate provides multiple mutexes waiting. */ package syncgate
15
51
0.8
39f55ec8a2c7291c0ecc05882eb8174f0686f570
290
java
Java
src/com/iau/sadeghi/ebanking/controller/ICentralServer.java
xo0ps/RMI_Ebank
4815dce45afa3e36ad3bb244b5da3b0962cc6856
[ "MIT" ]
1
2018-01-07T13:22:11.000Z
2018-01-07T13:22:11.000Z
src/com/iau/sadeghi/ebanking/controller/ICentralServer.java
xo0ps/RMI_Ebank
4815dce45afa3e36ad3bb244b5da3b0962cc6856
[ "MIT" ]
null
null
null
src/com/iau/sadeghi/ebanking/controller/ICentralServer.java
xo0ps/RMI_Ebank
4815dce45afa3e36ad3bb244b5da3b0962cc6856
[ "MIT" ]
null
null
null
package com.iau.sadeghi.ebanking.controller; import java.rmi.Remote; /** * Created with IntelliJ IDEA. * User: mahdi * Date: 7/1/13 * Time: 5:16 PM * To change this template use File | Settings | File Templates. */ public interface ICentralServer extends Remote { }
18.125
65
0.675862
c7d3c8004cfb0cf6cebf185ec33e7bfc3a50c37c
1,738
py
Python
datastorage.py
betamaoIS/Eduxxxx_downloader
57ab10088c07dc3be8a1ecca0af725bc07696a98
[ "MIT" ]
3
2019-11-08T06:53:58.000Z
2021-08-19T10:00:57.000Z
datastorage.py
betamaoIS/Eduxxxx_downloader
57ab10088c07dc3be8a1ecca0af725bc07696a98
[ "MIT" ]
1
2021-01-12T06:32:40.000Z
2021-01-12T06:32:40.000Z
datastorage.py
betamaoIS/Eduxxxx_downloader
57ab10088c07dc3be8a1ecca0af725bc07696a98
[ "MIT" ]
2
2020-03-07T06:38:17.000Z
2020-09-22T02:38:41.000Z
from sqlalchemy.dialects.mysql import MEDIUMTEXT, TEXT, INTEGER, CHAR, BOOLEAN from sqlalchemy import create_engine, Column from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Course(Base): __tablename__ = 'course' id = Column(INTEGER, primary_key=True) course_id = Column(INTEGER) course_name = Column(TEXT) chapter_id = Column(INTEGER) chapter_name = Column(TEXT) section_id = Column(INTEGER) section_name = Column(TEXT) section_md5 = Column(CHAR(127)) # 随机生成 class User(Base): __tablename__ = 'user' id = Column(INTEGER, primary_key=True) username = Column(CHAR(127), unique=True) password = Column(CHAR(127)) class UserCourse(Base): __tablename__ = 'user_course' id = Column(INTEGER, primary_key=True) username = Column(CHAR(127)) course_id = Column(INTEGER) class CourseDetail(Base): __tablename__ = 'course_detail' id = Column(INTEGER, primary_key=True) section_md5 = Column(CHAR(127)) type = Column(CHAR(127)) width = Column(INTEGER) m3u8 = Column(MEDIUMTEXT) m3u8_full = Column(MEDIUMTEXT) aes_key = Column(TEXT) has_download = Column(BOOLEAN) class SqliteSession(object): def __init__(self): engine = create_engine('mysql+pymysql://root:root@127.0.0.1:3306/course?charset=utf8') # engine = create_engine('sqlite:///course.db') Session = sessionmaker(bind=engine) session = Session() User.metadata.create_all(engine) Course.metadata.create_all(engine) CourseDetail.metadata.create_all(engine) self.session = session def insert(self): pass # SqliteSession()
28.491803
94
0.695052
5c59420b1c1b313f48f438346fc3625a15a5eeae
6,585
c
C
homework/ch3/ex/ex3.17_mpi_type_contig.c
impact-eintr/ipp-seurce
cb5bdfa6e9c4a66b9806ff6853ef3406240f7566
[ "MIT" ]
4
2021-07-07T07:02:12.000Z
2021-12-09T13:01:53.000Z
homework/ch3/ex/ex3.17_mpi_type_contig.c
impact-eintr/ipp-seurce
cb5bdfa6e9c4a66b9806ff6853ef3406240f7566
[ "MIT" ]
null
null
null
homework/ch3/ex/ex3.17_mpi_type_contig.c
impact-eintr/ipp-seurce
cb5bdfa6e9c4a66b9806ff6853ef3406240f7566
[ "MIT" ]
6
2021-07-07T07:02:27.000Z
2022-01-23T07:11:48.000Z
/* File: * ex3.17_mpi_type_contig.c * * Description: * Read two vectors, find their sum and print the result. * Use MPI_Type_contiguous to build datatype used in * reading and printing the vectors * * Compile: * mpicc -g -Wall -o ex3.17_mpi_type_contig ex3.17_mpi_type_contig * Usage: * mpiexec -n <number of processes> ./ex3.17_mpi_type_contig * * Input: * Order of the vectors, and the two vectors to be added * * Output * The input vectors and their sum * * Note: The order of the vectors should be evenly divisible by the * number of processes * * IPP: Exercise 3.17 */ #include <stdio.h> #include <stdlib.h> #include <mpi.h> int my_rank, comm_sz; MPI_Comm comm; void Check_for_error(int local_ok, char fname[], char message[]); void Read_n(int* n_p, int* local_n_p); void Allocate_vectors(double** local_x_pp, double** local_y_pp, double** local_z_pp, int local_n); void Read_vector(double local_a[], int local_n, int n, char vec_name[], MPI_Datatype cont_mpi_t); void Print_vector(double local_b[], int local_n, int n, char title[], MPI_Datatype cont_mpi_t); void Par_vector_sum(double local_x[], double local_y[], double local_z[], int local_n); /*-------------------------------------------------------------------*/ int main(void) { int n, local_n; double *local_x, *local_y, *local_z; MPI_Datatype cont_mpi_t; MPI_Init(NULL, NULL); comm = MPI_COMM_WORLD; MPI_Comm_size(comm, &comm_sz); MPI_Comm_rank(comm, &my_rank); Read_n(&n, &local_n); Allocate_vectors(&local_x, &local_y, &local_z, local_n); MPI_Type_contiguous(local_n, MPI_DOUBLE, &cont_mpi_t); MPI_Type_commit(&cont_mpi_t); Read_vector(local_x, local_n, n, "x", cont_mpi_t); Print_vector(local_x, local_n, n, "x is", cont_mpi_t); Read_vector(local_y, local_n, n, "y", cont_mpi_t); Print_vector(local_y, local_n, n, "y is", cont_mpi_t); Par_vector_sum(local_x, local_y, local_z, local_n); Print_vector(local_z, local_n, n, "The sum is", cont_mpi_t); free(local_x); free(local_y); free(local_z); MPI_Type_free(&cont_mpi_t); MPI_Finalize(); return 0; } /* main */ /*-------------------------------------------------------------------*/ void Check_for_error( int local_ok /* in */, char fname[] /* in */, char message[] /* in */) { int ok; MPI_Allreduce(&local_ok, &ok, 1, MPI_INT, MPI_MIN, comm); if (ok == 0) { int my_rank; MPI_Comm_rank(comm, &my_rank); if (my_rank == 0) { fprintf(stderr, "Proc %d > In %s, %s\n", my_rank, fname, message); fflush(stderr); } MPI_Finalize(); exit(-1); } } /* Check_for_error */ /*-------------------------------------------------------------------*/ void Read_n( int* n_p /* out */, int* local_n_p /* out */) { int local_ok = 1; char *fname = "Read_n"; if (my_rank == 0) { printf("What's the order of the vectors?\n"); scanf("%d", n_p); } MPI_Bcast(n_p, 1, MPI_INT, 0, comm); if (*n_p < 0 || *n_p % comm_sz != 0) local_ok = 0; Check_for_error(local_ok, fname, "n should be > 0 and evenly divisible by comm_sz"); *local_n_p = *n_p/comm_sz; } /* Read_n */ /*-------------------------------------------------------------------*/ void Allocate_vectors( double** local_x_pp /* out */, double** local_y_pp /* out */, double** local_z_pp /* out */, int local_n /* in */) { int local_ok = 1; char* fname = "Allocate_vectors"; *local_x_pp = malloc(local_n*sizeof(double)); *local_y_pp = malloc(local_n*sizeof(double)); *local_z_pp = malloc(local_n*sizeof(double)); if (*local_x_pp == NULL || *local_y_pp == NULL || *local_z_pp == NULL) local_ok = 0; Check_for_error(local_ok, fname, "Can't allocate local vector(s)"); } /* Allocate_vectors */ /*-------------------------------------------------------------------*/ void Read_vector( double local_a[] /* out */, int local_n /* in */, int n /* in */, char vec_name[] /* in */, MPI_Datatype cont_mpi_t /* in */) { double* a = NULL; int i; int local_ok = 1; char* fname = "Read_vector"; if (my_rank == 0) { a = malloc(n*sizeof(double)); if (a == NULL) local_ok = 0; Check_for_error(local_ok, fname, "Can't allocate temporary vector"); printf("Enter the vector %s\n", vec_name); for (i = 0; i < n; i++) scanf("%lf", &a[i]); MPI_Scatter(a, 1, cont_mpi_t, local_a, 1, cont_mpi_t, 0, comm); free(a); } else { Check_for_error(local_ok, fname, "Can't allocate temporary vector"); MPI_Scatter(a, 1, cont_mpi_t, local_a, 1, cont_mpi_t, 0, comm); } } /* Read_vector */ /*-------------------------------------------------------------------*/ void Print_vector( double local_b[] /* in */, int local_n /* in */, int n /* in */, char title[] /* in */, MPI_Datatype cont_mpi_t /* in */) { double* b = NULL; int i; int local_ok = 1; char* fname = "Print_vector"; if (my_rank == 0) { b = malloc(n*sizeof(double)); if (b == NULL) local_ok = 0; Check_for_error(local_ok, fname, "Can't allocate temporary vector"); MPI_Gather(local_b, 1, cont_mpi_t, b, 1, cont_mpi_t, 0, comm); printf("%s\n", title); for (i = 0; i < n; i++) printf("%f ", b[i]); printf("\n"); free(b); } else { Check_for_error(local_ok, fname, "Can't allocate temporary vector"); MPI_Gather(local_b, 1, cont_mpi_t, b, 1, cont_mpi_t, 0, comm); } } /* Print_vector */ /*-------------------------------------------------------------------*/ void Par_vector_sum( double local_x[] /* in */, double local_y[] /* in */, double local_z[] /* out */, int local_n /* in */) { int local_i; for (local_i = 0; local_i < local_n; local_i++) local_z[local_i] = local_x[local_i] + local_y[local_i]; } /* Parallel_vector_sum */
30.627907
74
0.512225
be4d54b0997416156c4e87334300e1c16489553c
770
swift
Swift
Tests/SwiftStdlibTests/FloatExtensionsTests.swift
ashercoelho/SwifterSwift
91fc8a33e824cea5f69ad39f5a0e353a1d8e0747
[ "MIT" ]
3
2021-05-20T14:01:01.000Z
2021-11-17T11:22:10.000Z
Tests/SwiftStdlibTests/FloatExtensionsTests.swift
ashercoelho/SwifterSwift
91fc8a33e824cea5f69ad39f5a0e353a1d8e0747
[ "MIT" ]
41
2020-01-14T08:58:33.000Z
2021-03-30T03:23:32.000Z
Tests/SwiftStdlibTests/FloatExtensionsTests.swift
ashercoelho/SwifterSwift
91fc8a33e824cea5f69ad39f5a0e353a1d8e0747
[ "MIT" ]
1
2021-09-01T16:14:15.000Z
2021-09-01T16:14:15.000Z
// FloatExtensionsTests.swift - Copyright 2020 SwifterSwift @testable import SwifterSwift import XCTest final class FloatExtensionsTests: XCTestCase { func testInt() { XCTAssertEqual(Float(-1).int, -1) XCTAssertEqual(Float(2).int, 2) XCTAssertEqual(Float(4.3).int, 4) } func testDouble() { XCTAssertEqual(Float(-1).double, Double(-1)) XCTAssertEqual(Float(2).double, Double(2)) XCTAssertEqual(Float(4.3).double, Double(4.3), accuracy: 0.00001) } func testCGFloat() { #if canImport(CoreGraphics) XCTAssertEqual(Float(4.3).cgFloat, CGFloat(4.3), accuracy: 0.00001) #endif } func testOperators() { XCTAssertEqual(Float(5.0) ** Float(2.0), Float(25.0)) } }
26.551724
75
0.633766
ab0d54af306a3c2a747896683e1de1be639e4769
4,324
swift
Swift
Sources/AWSXRayRecorder/Recorder+NIO.swift
pokryfka/aws-xray-sdk-swift
c505ac2d75ce838311365a40a7725cdfdfdcd2ec
[ "Apache-2.0" ]
13
2020-06-25T13:45:38.000Z
2022-01-13T20:46:58.000Z
Sources/AWSXRayRecorder/Recorder+NIO.swift
pokryfka/aws-xray-sdk-swift
c505ac2d75ce838311365a40a7725cdfdfdcd2ec
[ "Apache-2.0" ]
71
2020-07-10T13:46:43.000Z
2020-09-22T01:00:15.000Z
Sources/AWSXRayRecorder/Recorder+NIO.swift
pokryfka/aws-xray-sdk-swift
c505ac2d75ce838311365a40a7725cdfdfdcd2ec
[ "Apache-2.0" ]
4
2020-06-25T13:45:44.000Z
2020-07-17T22:41:23.000Z
//===----------------------------------------------------------------------===// // // This source file is part of the aws-xray-sdk-swift open source project // // Copyright (c) 2020 pokryfka and the aws-xray-sdk-swift project authors // Licensed under Apache License v2.0 // // See LICENSE.txt for license information // // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// import Baggage import NIO extension XRayRecorder { /// Flushes the emitter in `SwiftNIO` future. /// /// - Parameter eventLoop: `EventLoop` used to "do the flushing". public func flush(on eventLoop: EventLoop) -> EventLoopFuture<Void> { waitEmitting() // wait for the emitter to send them if let nioEmitter = emitter as? XRayNIOEmitter { return nioEmitter.flush(on: eventLoop) } else { let promise = eventLoop.makePromise(of: Void.self) emitter.flush { error in if let error = error { promise.fail(error) } else { promise.succeed(()) } } return promise.futureResult } } } extension XRayRecorder { /// Creates new segment. /// /// Records `Error`. /// /// - Parameters: /// - name: segment name /// - context: the trace context /// - startTime: start time, defaults to now /// - metadata: segment metadata /// - body: segment body @inlinable public func segment<T>(name: String, context: TraceContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil, body: () -> EventLoopFuture<T>) -> EventLoopFuture<T> { let segment = beginSegment(name: name, context: context, startTime: startTime, metadata: metadata) return body().always { result in if case Result<T, Error>.failure(let error) = result { segment.addError(error) } segment.end() } } /// Creates new segment. /// /// Records `Error`. /// /// - Parameters: /// - name: segment name /// - baggage: baggage with the trace context /// - startTime: start time, defaults to now /// - metadata: segment metadata /// - body: segment body @inlinable public func segment<T>(name: String, baggage: BaggageContext, startTime: XRayRecorder.Timestamp = .now(), metadata: XRayRecorder.Segment.Metadata? = nil, body: () -> EventLoopFuture<T>) -> EventLoopFuture<T> { let segment = beginSegment(name: name, baggage: baggage, startTime: startTime, metadata: metadata) return body().always { result in if case Result<T, Error>.failure(let error) = result { segment.addError(error) } segment.end() } } } extension EventLoopFuture { /// Ends segment when the `EventLoopFuture` is fulfilled, records `.failure`. /// /// - parameters: /// - segment: the segment to end when the `EventLoopFuture` is fulfilled. /// - returns: the current `EventLoopFuture` public func endSegment(_ segment: XRayRecorder.Segment) -> EventLoopFuture<Value> { whenComplete { result in if case Result<Value, Error>.failure(let error) = result { segment.addError(error) } segment.end() } return self } } extension EventLoopFuture where Value == Void { /// Flushes the recorder. /// /// - Parameters: /// - recorder: the recorder to flush /// - recover: if false and the future is in error state the error is propagated after flushing. /// - Returns: the current `EventLoopFuture` public func flush(_ recorder: XRayRecorder, recover: Bool = true) -> EventLoopFuture<Void> { map { Result<Value, Error>.success(()) } .recover { Result<Value, Error>.failure($0) } .flatMap { result in recorder.flush(on: self.eventLoop) .flatMapResult { recover ? Result<Value, Error>.success(()) : result } } } }
35.154472
109
0.551573
2f17c14a308d79243caa2375b1919a09273327dd
5,719
php
PHP
var/cache/dev/twig/56/56492b2e5d95ca368d1097b559de02ef4e74824d00bab12da8cd9f496f803808.php
mohamedshaaban/symfony
d7a63b1159b47ee501626f35cd27476783fd7370
[ "MIT" ]
null
null
null
var/cache/dev/twig/56/56492b2e5d95ca368d1097b559de02ef4e74824d00bab12da8cd9f496f803808.php
mohamedshaaban/symfony
d7a63b1159b47ee501626f35cd27476783fd7370
[ "MIT" ]
null
null
null
var/cache/dev/twig/56/56492b2e5d95ca368d1097b559de02ef4e74824d00bab12da8cd9f496f803808.php
mohamedshaaban/symfony
d7a63b1159b47ee501626f35cd27476783fd7370
[ "MIT" ]
null
null
null
<?php /* SyliusAdminBundle:Product/Tab:_taxonomy.html.twig */ class __TwigTemplate_0414206f718968c630e836ee2b2f9296794628d4882dd36c1da6cb7ad4d972ad extends Twig_Template { public function __construct(Twig_Environment $env) { parent::__construct($env); $this->parent = false; $this->blocks = array( ); } protected function doDisplay(array $context, array $blocks = array()) { $__internal_5dd33dde611b66238eed549f2b3d6a3b48add8916f62a456732cf296fb414836 = $this->env->getExtension("Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"); $__internal_5dd33dde611b66238eed549f2b3d6a3b48add8916f62a456732cf296fb414836->enter($__internal_5dd33dde611b66238eed549f2b3d6a3b48add8916f62a456732cf296fb414836_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "SyliusAdminBundle:Product/Tab:_taxonomy.html.twig")); $__internal_c0b5b5f348231cd51ee7dc61d30f5de6b7e9422c75c330d8c4df37d9f30a6c6e = $this->env->getExtension("Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"); $__internal_c0b5b5f348231cd51ee7dc61d30f5de6b7e9422c75c330d8c4df37d9f30a6c6e->enter($__internal_c0b5b5f348231cd51ee7dc61d30f5de6b7e9422c75c330d8c4df37d9f30a6c6e_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "SyliusAdminBundle:Product/Tab:_taxonomy.html.twig")); // line 1 echo "<div class=\"ui tab\" data-tab=\"taxonomy\"> <h3 class=\"ui dividing header\">"; // line 2 echo twig_escape_filter($this->env, $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("sylius.ui.taxonomy"), "html", null, true); echo "</h3> "; // line 3 echo $this->env->getRuntime('Symfony\Bridge\Twig\Form\TwigRenderer')->searchAndRenderBlock(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new Twig_Error_Runtime('Variable "form" does not exist.', 3, $this->getSourceContext()); })()), "mainTaxon", array()), 'row'); echo " <h4>"; // line 5 echo twig_escape_filter($this->env, $this->env->getExtension('Symfony\Bridge\Twig\Extension\TranslationExtension')->trans("sylius.ui.product_taxon"), "html", null, true); echo "</h4> <div id=\"sylius-product-taxonomy-tree\" data-taxon-root-nodes-url=\""; // line 7 echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("sylius_admin_ajax_taxon_root_nodes"); echo "\" data-taxon-leafs-url=\""; // line 8 echo $this->env->getExtension('Symfony\Bridge\Twig\Extension\RoutingExtension')->getPath("sylius_admin_ajax_taxon_leafs"); echo "\" > "; // line 10 echo $this->env->getRuntime('Symfony\Bridge\Twig\Form\TwigRenderer')->searchAndRenderBlock(twig_get_attribute($this->env, $this->getSourceContext(), (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new Twig_Error_Runtime('Variable "form" does not exist.', 10, $this->getSourceContext()); })()), "productTaxons", array()), 'widget'); echo " <div class=\"ui inverted dimmer\"> <div class=\"ui loader\"></div> </div> </div> "; // line 16 echo call_user_func_array($this->env->getFunction('sonata_block_render_event')->getCallable(), array((("sylius.admin.product." . (isset($context["action"]) || array_key_exists("action", $context) ? $context["action"] : (function () { throw new Twig_Error_Runtime('Variable "action" does not exist.', 16, $this->getSourceContext()); })())) . ".tab_taxonomy"), array("form" => (isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new Twig_Error_Runtime('Variable "form" does not exist.', 16, $this->getSourceContext()); })())))); echo " </div> "; $__internal_5dd33dde611b66238eed549f2b3d6a3b48add8916f62a456732cf296fb414836->leave($__internal_5dd33dde611b66238eed549f2b3d6a3b48add8916f62a456732cf296fb414836_prof); $__internal_c0b5b5f348231cd51ee7dc61d30f5de6b7e9422c75c330d8c4df37d9f30a6c6e->leave($__internal_c0b5b5f348231cd51ee7dc61d30f5de6b7e9422c75c330d8c4df37d9f30a6c6e_prof); } public function getTemplateName() { return "SyliusAdminBundle:Product/Tab:_taxonomy.html.twig"; } public function isTraitable() { return false; } public function getDebugInfo() { return array ( 60 => 16, 51 => 10, 46 => 8, 42 => 7, 37 => 5, 32 => 3, 28 => 2, 25 => 1,); } public function getSourceContext() { return new Twig_Source("<div class=\"ui tab\" data-tab=\"taxonomy\"> <h3 class=\"ui dividing header\">{{ 'sylius.ui.taxonomy'|trans }}</h3> {{ form_row(form.mainTaxon) }} <h4>{{ 'sylius.ui.product_taxon'|trans }}</h4> <div id=\"sylius-product-taxonomy-tree\" data-taxon-root-nodes-url=\"{{ path('sylius_admin_ajax_taxon_root_nodes') }}\" data-taxon-leafs-url=\"{{ path('sylius_admin_ajax_taxon_leafs') }}\" > {{ form_widget(form.productTaxons) }} <div class=\"ui inverted dimmer\"> <div class=\"ui loader\"></div> </div> </div> {{ sonata_block_render_event('sylius.admin.product.' ~ action ~ '.tab_taxonomy', {'form': form}) }} </div> ", "SyliusAdminBundle:Product/Tab:_taxonomy.html.twig", "D:\\xamppfr\\htdocs\\symfony_sylius\\vendor\\sylius\\sylius\\src\\Sylius\\Bundle\\AdminBundle/Resources/views/Product/Tab/_taxonomy.html.twig"); } }
52.46789
587
0.677216
c428dab24b6080af1d40d276b2ff9fed382d42db
286
h
C
mbed-msb-js-wrapper/mbed-msb-js-wrapper_lib.h
jonaskgandersson/mbed-msb-js-wrapper
8313e4ea64bffe6adbaa23f732be7497e162ff3e
[ "Apache-2.0" ]
null
null
null
mbed-msb-js-wrapper/mbed-msb-js-wrapper_lib.h
jonaskgandersson/mbed-msb-js-wrapper
8313e4ea64bffe6adbaa23f732be7497e162ff3e
[ "Apache-2.0" ]
null
null
null
mbed-msb-js-wrapper/mbed-msb-js-wrapper_lib.h
jonaskgandersson/mbed-msb-js-wrapper
8313e4ea64bffe6adbaa23f732be7497e162ff3e
[ "Apache-2.0" ]
null
null
null
#ifndef _JERRYSCRIPT_MBED_LIB_MSB_H #define _JERRYSCRIPT_MBED_LIB_MSB_H #include "jerryscript-mbed-library-registry/wrap_tools.h" #include "mbed-msb-js-wrapper-js.h" DECLARE_JS_WRAPPER_REGISTRATION (msb) { REGISTER_CLASS_CONSTRUCTOR(Msb); } #endif // _JERRYSCRIPT_MBED_LIB_MSB_H
22
57
0.821678
1be4d421963ba4e0dc837f403a8c8509fe47340a
537
py
Python
advanced_scrapetest.py
MichelAmin47/PythonWebScraper
b9d46981dff102b8238722eb677aaeaf8415afc6
[ "MIT" ]
null
null
null
advanced_scrapetest.py
MichelAmin47/PythonWebScraper
b9d46981dff102b8238722eb677aaeaf8415afc6
[ "MIT" ]
null
null
null
advanced_scrapetest.py
MichelAmin47/PythonWebScraper
b9d46981dff102b8238722eb677aaeaf8415afc6
[ "MIT" ]
null
null
null
from urllib.request import urlopen from bs4 import BeautifulSoup # html = urlopen('http://www.pythonscraping.com/pages/warandpeace.html') # bs = BeautifulSoup(html.read(), 'html5lib') # # nameList = bs.findAll('span', {'class': 'green'}) # for name in nameList: # print(name.get_text()) html = urlopen('https://www.nike.com/nl/w/heren-jordan-schoenen-37eefznik1zy7ok') bs = BeautifulSoup(html.read(), 'html5lib') nameList = bs.findAll('a', {'class': 'product-card__link-overlay'}) for name in nameList: print(name.get_text())
31.588235
81
0.711359
08a12b90946911056d61bb6cff575667d3b15faa
993
kt
Kotlin
server/src/main/java/de/zalando/zally/rule/zalando/KebabCaseInPathSegmentsRule.kt
upasanachatterjee/zally-edits
3e401c33dd09e800925694d35d412041a81cd71e
[ "MIT" ]
1
2018-07-25T15:13:51.000Z
2018-07-25T15:13:51.000Z
server/src/main/java/de/zalando/zally/rule/zalando/KebabCaseInPathSegmentsRule.kt
denseidel/zally
a4c548a0a31b98b4188625feda7539fd8c6aae6a
[ "MIT" ]
null
null
null
server/src/main/java/de/zalando/zally/rule/zalando/KebabCaseInPathSegmentsRule.kt
denseidel/zally
a4c548a0a31b98b4188625feda7539fd8c6aae6a
[ "MIT" ]
null
null
null
package de.zalando.zally.rule.zalando import de.zalando.zally.rule.api.Check import de.zalando.zally.rule.api.Rule import de.zalando.zally.rule.api.Severity import de.zalando.zally.rule.api.Violation import de.zalando.zally.util.PatternUtil import io.swagger.models.Swagger @Rule( ruleSet = ZalandoRuleSet::class, id = "129", severity = Severity.MUST, title = "Lowercase words with hyphens" ) class KebabCaseInPathSegmentsRule { private val description = "Use lowercase separate words with hyphens for path segments" @Check(severity = Severity.MUST) fun validate(swagger: Swagger): Violation? { val paths = swagger.paths.orEmpty().keys.filterNot { val pathSegments = it.split("/").filter { it.isNotEmpty() } pathSegments.filter { !PatternUtil.isPathVariable(it) && !PatternUtil.isLowerCaseAndHyphens(it) }.isEmpty() } return if (paths.isNotEmpty()) Violation(description, paths) else null } }
34.241379
119
0.703927
39dad35227d4b56257bbb4675d867b0587834a33
11,134
java
Java
client/app/src/main/java/com/theah64/soundclouddownloader/ui/fragments/PlaylistsFragment.java
theapache64/musicdog
c82481a20cb5c41b32b4322ba021a5116fe0335a
[ "Apache-2.0" ]
20
2017-01-04T01:06:46.000Z
2022-03-05T05:53:48.000Z
client/app/src/main/java/com/theah64/soundclouddownloader/ui/fragments/PlaylistsFragment.java
theapache64/musicdog
c82481a20cb5c41b32b4322ba021a5116fe0335a
[ "Apache-2.0" ]
4
2018-01-23T22:25:03.000Z
2019-02-20T16:18:37.000Z
client/app/src/main/java/com/theah64/soundclouddownloader/ui/fragments/PlaylistsFragment.java
theapache64/musicdog
c82481a20cb5c41b32b4322ba021a5116fe0335a
[ "Apache-2.0" ]
7
2016-12-28T05:02:46.000Z
2021-07-29T18:03:33.000Z
package com.theah64.soundclouddownloader.ui.fragments; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import com.theah64.bugmailer.core.BugMailer; import com.theah64.soundclouddownloader.R; import com.theah64.soundclouddownloader.adapters.ITSAdapter; import com.theah64.soundclouddownloader.database.Playlists; import com.theah64.soundclouddownloader.database.Tracks; import com.theah64.soundclouddownloader.interfaces.MainActivityCallback; import com.theah64.soundclouddownloader.interfaces.PlaylistListener; import com.theah64.soundclouddownloader.models.Playlist; import com.theah64.soundclouddownloader.models.Track; import com.theah64.soundclouddownloader.services.DownloaderService; import com.theah64.soundclouddownloader.ui.activities.PlaylistTracksActivity; import com.theah64.soundclouddownloader.utils.App; import com.theah64.soundclouddownloader.utils.SingletonToast; import com.theah64.soundclouddownloader.utils.UriCompat; import com.theah64.soundclouddownloader.widgets.ThemedSnackbar; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. */ public class PlaylistsFragment extends BaseMusicFragment implements ITSAdapter.TracksCallback, PopupMenu.OnMenuItemClickListener, PlaylistListener { private static final String X = PlaylistsFragment.class.getSimpleName(); private List<Playlist> playlists; private Playlist currentPlaylist; private Playlists playlistsTable; private Tracks tracksTable; private ITSAdapter itsAdapter; private int currentPosition; private View layout; private App app; private MainActivityCallback callback; private RecyclerView rvPlaylists; public PlaylistsFragment() { // Required empty public constructor } @Override public void onAttach(Context context) { super.onAttach(context); app = (App) context.getApplicationContext(); callback = (MainActivityCallback) getActivity(); } @Override public void onStart() { super.onStart(); app.setPlaylistListener(this); } @Override public void onDestroy() { final PlaylistListener playlistListener = app.getPlaylistListener(); if (this.equals(playlistListener)) { Log.d(X, "Destroying playlist listener"); app.setPlaylistListener(null); } super.onDestroy(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment layout = inflater.inflate(R.layout.fragment_playlists, container, false); playlistsTable = Playlists.getInstance(getContext()); tracksTable = Tracks.getInstance(getContext()); playlists = playlistsTable.getAll(); if (playlists != null) { initAdapter(); } else { //showing no tracks downloaded text view. layout.findViewById(R.id.llNoPlaylistsFound).setVisibility(View.VISIBLE); } layout.findViewById(R.id.bOpenSoundCloud).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { openSoundCloud(); } }); return layout; } private void initAdapter() { rvPlaylists = (RecyclerView) layout.findViewById(R.id.rvPlaylists); rvPlaylists.setLayoutManager(new LinearLayoutManager(getActivity())); itsAdapter = new ITSAdapter(getActivity(), playlists, this, null); rvPlaylists.setAdapter(itsAdapter); layout.findViewById(R.id.llNoPlaylistsFound).setVisibility(View.GONE); rvPlaylists.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (dy > 0) { if (callback.isFabAddShown()) { callback.hideFabAdd(); } } else if (dy < 0) { if (!callback.isFabAddShown()) { callback.showFabAdd(); } } } }); } @Override public void onRowClicked(int position, View popUpAnchor) { final Playlist playlist = playlists.get(position); if (playlist.getTotalTracks() > 0) { final Intent playlistTracksIntent = new Intent(getActivity(), PlaylistTracksActivity.class); playlistTracksIntent.putExtra(Playlist.KEY, playlist); startActivity(playlistTracksIntent); } else { SingletonToast.makeText(getActivity(), R.string.Empty_playlist).show(); } } @Override public void onPopUpMenuClicked(View anchor, int position) { currentPlaylist = playlists.get(position); currentPosition = position; final PopupMenu playlistMenu = new PopupMenu(getActivity(), anchor); playlistMenu.getMenuInflater().inflate(currentPlaylist.isDownloaded() ? R.menu.menu_playlist_downloaded : R.menu.menu_playlist_not_downloaded, playlistMenu.getMenu()); playlistMenu.setOnMenuItemClickListener(this); playlistMenu.show(); } @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.miShareSavedTracks: case R.id.miShareTracks: List<Track> trackList = currentPlaylist.getTracks(); if (trackList == null) { trackList = tracksTable.getAll(currentPlaylist.getId()); currentPlaylist.setTracks(trackList); } final ArrayList<Uri> existingTracks = new ArrayList<>(); for (final Track track : trackList) { if (track.getFile().exists()) { existingTracks.add(UriCompat.fromFile(getActivity(), track.getFile())); } } if (!existingTracks.isEmpty()) { final Intent shareTracksIntent = new Intent(Intent.ACTION_SEND_MULTIPLE); shareTracksIntent.putExtra(Intent.EXTRA_TEXT, String.format("Downloaded via SoundCloud Downloader (%s) Playlist: %s ", App.APK_DOWNLOAD_URL, currentPlaylist.getTitle())); shareTracksIntent.setType("audio/*"); shareTracksIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, existingTracks); startActivity(shareTracksIntent); SingletonToast.makeText(getActivity(), getResources().getQuantityString(R.plurals.sharing_d_tracks, existingTracks.size(), existingTracks.size())).show(); } else { SingletonToast.makeText(getActivity(), R.string.No_tracks_downloaded).show(); } return true; case R.id.miSharePlaylistURL: final Intent sharePlaylistUrlIntent = new Intent(Intent.ACTION_SEND); sharePlaylistUrlIntent.setType("text/plain"); sharePlaylistUrlIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.Download_playlist_using_soundcloud_downloader_s, App.APK_DOWNLOAD_URL, currentPlaylist.getTitle(), currentPlaylist.getSoundCloudUrl())); startActivity(Intent.createChooser(sharePlaylistUrlIntent, getString(R.string.Share_using))); return true; case R.id.miDownloadPlaylist: //Launching downloader service final Intent downloadIntent = new Intent(getActivity(), DownloaderService.class); downloadIntent.putExtra(Tracks.COLUMN_SOUNDCLOUD_URL, currentPlaylist.getSoundCloudUrl()); getActivity().startService(downloadIntent); SingletonToast.makeText(getActivity(), R.string.initializing_download).show(); return true; case R.id.miRemovePlaylist: //Showing confirmation ThemedSnackbar.make(getActivity(), getActivity().findViewById(android.R.id.content), R.string.Tracks_under_this, Snackbar.LENGTH_LONG) .setAction(R.string.CONTINUE, new View.OnClickListener() { @Override public void onClick(View view) { //Deleting currentPlaylist playlistsTable.delete(Playlists.COLUMN_ID, currentPlaylist.getId()); playlists.remove(currentPosition); itsAdapter.notifyItemRemoved(currentPosition); if (playlists.isEmpty()) { //showing no tracks downloaded text view. layout.findViewById(R.id.llNoPlaylistsFound).setVisibility(View.VISIBLE); } callback.onRemovePlaylist(currentPlaylist.getId()); callback.setTabPlaylistsCount(playlists.size()); } }) .show(); return true; default: return false; } } @Override public void onPlaylistUpdated(String playlistId) { //Finding the updated track for (int i = 0; i < playlists.size(); i++) { final Playlist playlist = playlists.get(i); if (playlist.getId().equals(playlistId)) { Log.d(X, "Found updated playlist : " + playlist); playlists.remove(i); playlists.add(i, playlistsTable.get(Playlists.COLUMN_ID, playlist.getId())); itsAdapter.notifyItemChanged(i); return; } } BugMailer.report(new Throwable("Couldn't find the playlist. Playlist doesn't added to playlistList")); } @Override public void onNewPlaylist(Playlist playlist) { if (playlists == null) { playlists = new ArrayList<>(); initAdapter(); } playlists.add(0, playlist); itsAdapter.notifyItemInserted(0); rvPlaylists.scrollToPosition(0); callback.setTabPlaylistsCount(playlists.size()); if (playlists.isEmpty()) { //showing no tracks downloaded text view. layout.findViewById(R.id.llNoPlaylistsFound).setVisibility(View.VISIBLE); } else { layout.findViewById(R.id.llNoPlaylistsFound).setVisibility(View.GONE); } } }
35.916129
222
0.631848
b89875462c418b89e3f408377e1dd050fffa077a
41,425
html
HTML
terms.html
controlshift/website-v2
9a88f4c536e6e6e7695693f84476ed393e2829d5
[ "MIT" ]
2
2019-11-23T04:55:44.000Z
2021-07-27T12:24:14.000Z
terms.html
controlshift/website-v2
9a88f4c536e6e6e7695693f84476ed393e2829d5
[ "MIT" ]
18
2018-10-19T19:17:54.000Z
2021-09-15T17:11:04.000Z
terms.html
controlshift/website-v2
9a88f4c536e6e6e7695693f84476ed393e2829d5
[ "MIT" ]
1
2018-10-03T16:04:10.000Z
2018-10-03T16:04:10.000Z
--- layout: page title: Terms of Service permalink: /terms/ --- <div class="container"> <div id="hero" class="mt-3 mb-3"> <div class="row"> <div class="col-md-2"></div> <div class="col-md-8"> <h1>Terms of Service</h1> </div> </div> </div> </div> <div class="container-fluid bg-white text-black"> <div class="container p-0"> <div class="row pb-4 pt-4"> <div class="col-md-2"></div> <div class="col-xs-12 col-md-8"> <p>Last Updated: 10 December 2020</p> <h2>1. INTRODUCTION</h2> <ol> <li> <p> Welcome to ControlShift! Your use of ControlShift’s services, including the services ControlShift makes available through this website and all related web sites, mobile sites, data files, visualizations and applications which link to these terms of service (the “Site”) and to all software or services offered by ControlShift in connection with any of those (the “Services”), is governed by these terms of service (the “Terms”), so please carefully read them before using the Services. For the purposes of these Terms, “we,” “our,” “us,” “Company” and “ControlShift” refer to ChangeSprout Inc., the providers and operators of the Services. </p> </li> <li> <p> In order to use the Services, you (“Customer”) must first agree to these Terms. If you are registering for or using the Services on behalf of an organization, you are agreeing to these Terms for that organization and promising that you have the authority to bind that organization to these Terms. In that case, “you,” “your,” and “Customer” will also refer to that organization, wherever possible. </p> </li> <li> <p> You must be over 18 years of age to use the Services, and children under the age of 18 cannot use or register for the Services. </p> </li> <li> <p> You agree your purchases and/or use of the Services are not contingent on the delivery of any future functionality or features or dependent on any oral or written public comments made by ControlShift or any of its affiliates regarding future functionality or features. </p> </li> <li> <p> If you have entered into a separate written agreement with ControlShift for use of services, the terms and conditions of such other agreement shall prevail over any conflicting terms or conditions in these terms. </p> </li> <li> <p> <strong>ARBITRATION NOTICE</strong>: EXCEPT FOR CERTAIN TYPES OF DISPUTES DESCRIBED IN THE ARBITRATION CLAUSE BELOW, YOU AGREE THAT DISPUTES BETWEEN YOU AND CONTROLSHIFT WILL BE RESOLVED BY MANDATORY BINDING ARBITRATION AND YOU WAIVE ANY RIGHT TO PARTICIPATE IN A CLASS-ACTION LAWSUIT OR CLASS-WIDE ARBITRATION. </p> </li> <li> <p> BY USING, DOWNLOADING, INSTALLING, OR OTHERWISE ACCESSING THE SERVICES OR ANY MATERIALS INCLUDED IN OR WITH THE SERVICES, YOU HEREBY AGREE TO BE BOUND BY THESE TERMS. IF YOU DO NOT ACCEPT THESE TERMS, THEN YOU MAY NOT USE, DOWNLOAD, INSTALL, OR OTHERWISE ACCESS THE SERVICES. </p> </li> <li> <p> CERTAIN FEATURES OF THE SERVICES OR SITE MAY BE SUBJECT TO ADDITIONAL GUIDELINES, TERMS, OR RULES, WHICH WILL BE POSTED ON THE SERVICE OR SITE IN CONNECTION WITH SUCH FEATURES. TO THE EXTENT SUCH TERMS, GUIDELINES, AND RULES CONFLICT WITH THESE TERMS, SUCH TERMS SHALL GOVERN SOLELY WITH RESPECT TO SUCH FEATURES. IN ALL OTHER SITUATIONS, THESE TERMS SHALL GOVERN. </p> </li> </ol> <h2>2. SERVICES AND SUPPORT</h2> <ol> <li> <p> Subject to these Terms, Company will use commercially reasonable efforts to provide Customer the Services. In the event of a service disruption, Company will use commercially reasonable efforts to minimize the impact or duration of any outage, interruption, or degradation of Services. Company will provide Customer with reasonable technical support services in accordance with the terms set forth in Customer’s order form. Company will exercise commercially reasonable efforts to respond to support requests in a timely manner. </p> </li> <li> <p> As part of the registration process, Customer will identify an administrative user name and password for Customer’s account. Company reserves the right to refuse registration of, or cancel passwords it deems inappropriate. Customer agrees, on behalf of itself and any of its employees, consultants, agents, and service providers to which Customer desires to designate as authorized users (“Users”), to provide true, accurate, current, and complete information during the registration process. Customer further agrees (on behalf of itself and its Users) to maintain and update its personal information as needed to keep it true, accurate, current, and complete. Customer is solely responsible for maintaining the confidentiality of its account and password (and those of its Users) and for restricting access to its computers and Equipment, and Customer agrees to accept responsibility for all activities that occur under Customer’s account or password (including those of its Users). If Customer has reason to believe that its account or any of its Users accounts is no longer secure (for example, in the event of a loss, theft or unauthorized disclosure or use of any ID, password, device, or any credit, debit or charge card number), Customer agrees to promptly notify ControlShift. While these Terms may, from time to time, make collective references to a provision applying to Customer and its Users, Customer agrees that all obligations imposed on Customer under these Terms (or with respect to Customer’s Data) shall apply equally to each of Customer’s Users, regardless of whether expressly stated herein. </p> </li> <li> <p> Customer’s subscription entitles Customer access to the Services up to the limits identified in Customer’s order form (“Subscription Limits”). In order to access the Services, Users may be required to register with an email address and password. Each unique email address registered with the Services will constitute a separate User. Access to the Service is subject to compliance by Customer and each User with these Terms. Customer agrees that it is responsible for each of its User’s use of the Service and any breach by a User of these Terms shall be deemed a breach by Customer. </p> </li> <li> <p> ControlShift may offer a number of different tools as part of the Service (each a “Tool”). The Tools to which your subscription provides you access are those listed in your order form. If you wish to access additional Tools, your subscription can be modified subject to applicable additional fees. </p> </li> </ol> <h2>3. RESTRICTIONS AND RESPONSIBILITIES</h2> <ol> <li> <p> Customer will not, directly or indirectly, and will not permit others to: (i) reverse engineer, decompile, disassemble or otherwise attempt to discover the source code, object code or underlying structure, ideas, know-how or algorithms relevant to the Services or any software, documentation or data related to the Services (“Software”); (ii) modify, translate, or create derivative works based on the Services or any Software (except to the extent expressly permitted by Company or authorized within the Services); (iii) use the Services or any Software for timesharing or service bureau purposes or otherwise for the benefit of a third; (iv) remove any proprietary notices or labels; (v) attempt in any way to circumvent the Subscription Limits set forth in Customer’s order form by, among other things, allowing multiple users to use any single User account; (vi) upload or transmit via the Service or Software pornographic, threatening, embarrassing, hateful, racially or ethnically insulting, libelous, or otherwise inappropriate content (as determined by the Company in its discretion); (vii) use the Service or Software for any purpose that is unlawful or is otherwise prohibited or unauthorized by these Terms; (viii) use the Service or Software in any manner that in our sole discretion could damage, disable, overburden, or impair it; (ix) attempt to gain unauthorized access to the Service, or any part of them, other User accounts, computer systems or networks connected to the Service, or any part of them, through hacking, password mining or any other means or interfere or attempt to interfere with the proper working of the Service or any activities conducted on the Service (including without limitation permitting access to or use of the Service via another system or tool, the primary effect of which is to enable input of requests or transactions by other than authorized users); (x) modify the Service or Software in any manner or form, or use modified versions of the Service or Software, including but not limited to for the purpose of obtaining unauthorized access to the Service; (xi) use any robot, spider, scraper, or other automated means to access the Service for any purpose without the Company’s express written permission, or bypass any measures the Company may use to prevent or restrict access to the Service; (xii) impersonate another person or access another User’s account without that User’s permission or to violate any contractual or fiduciary relationships; (xiii) share account passwords with any third party or encourage any other User to do so; (xiv) misrepresent the source, identity, or content of data submitted to ControlShift; (xv) use the Service for any purpose other than Customer’s own internal business and/or personal use; (xvi) remove, circumvent, disable, damage or otherwise interfere with security-related features of the Software or Service, features that prevent or restrict use or copying of any content accessible through the Service or Software, or features that enforce limitations on use of the Service or Software; (xvii) access the Service if Customer is a direct competitor of ControlShift, except with ControlShift’s prior written consent, or for any other competitive purposes; (xviii) collect or harvest any personally identifiable information, including account names, from the Service; or (xix) otherwise use the Software or Service in violation of any restrictions set forth herein. Company hereby grants Customer a non-exclusive, non-transferable, non-sublicensable license to use such Software during the Term only in connection with the Services. </p> </li> <li> <p> Further, Customer may not remove or export from the United States or allow the export or re-export of the Services, Software or anything related thereto, or any direct product thereof in violation of any restrictions, laws or regulations of the United States Department of Commerce, the United States Department of Treasury Office of Foreign Assets Control, or any other United States or foreign agency or authority. As defined in FAR section 2.101, the Software and documentation are “commercial items” and according to DFAR section 252.2277014(a)(1) and (5) are deemed to be “commercial computer software” and “commercial computer software documentation.” Consistent with DFAR section 227.7202 and FAR section 12.212, any use modification, reproduction, release, performance, display, or disclosure of such commercial software or commercial software documentation by the U.S. Government will be governed solely by the terms of these Terms and will be prohibited except to the extent expressly permitted by the terms of these Terms. </p> </li> <li> <p> Customer represents, covenants, and warrants that Customer will use the Services only in compliance with these Terms and all applicable laws and regulations. Although Company has no obligation to monitor Customer’s use of the Services, Company may do so and may prohibit any use of the Services it believes may be (or alleged to be) in violation of the foregoing. </p> </li> <li> <p> Customer shall be responsible for obtaining and maintaining any equipment and ancillary services needed to connect to, access or otherwise use the Services, including, without limitation, modems, hardware, servers, software, operating systems, networking, web servers, third party services and the like (collectively, “Equipment”). Customer shall also be responsible for maintaining the security of the Equipment, Customer account, passwords (including but not limited to administrative and user passwords) and files, and for all uses of Customer account or the Equipment with or without Customer’s knowledge or consent. </p> </li> <li> <p> In connection with Customer Data, as defined below, Customer hereby represents, warrants, and agrees that: (a) Customer has obtained the Customer Data lawfully, and the Customer Data does not and will not violate any applicable laws or any person or entity’s proprietary or intellectual property rights; (b) the Customer Data is free of all viruses, Trojan horses, and other elements that could interrupt or harm the systems or software used by ControlShift or its subcontractors to provide the Service; (c) all Customer Data has and will be collected by Customer in accordance with a privacy policy that permits ControlShift to have, collect, use, and disclose such Customer Data as contemplated under these Terms, and if required by applicable law, pursuant to consents obtained by Customer to do each of the foregoing; (d) subject to ControlShift’s collection, storage, use, and disclosure of Customer Data is in compliance with these Terms (and any data protection agreement entered into on even date hereof), Customer is solely responsible for ensuring compliance with all privacy laws in all jurisdictions that may apply to Customer Data provided hereunder; (e) ControlShift may exercise the rights in Customer Data granted hereunder without liability or cost to any third party; and (f) the Customer Data complies with the terms of these Terms. Subject to ControlShift’s collection, storage, use, and disclosure of Customer Data remaining in compliance with these Terms (and any data protection agreement entered into on even date hereof), ControlShift takes no responsibility and assumes no liability for any Customer Data, and Customer will be solely responsible for its Customer Data and the consequences of sharing it hereunder. </p> </li> <li> <p> Customer understands that by using any of the Services, Customer may encounter content that may be deemed offensive, indecent, or objectionable, which content may or may not be identified as having explicit language, and that the results of any search or entering of a particular URL may automatically and unintentionally generate links or references to objectionable material. Customer agrees not to use the Service in a manner that: (i) may create a risk of harm, loss, physical or mental injury, emotional distress, death, disability, disfigurement, or physical or mental illness to Customer, to any other person, or to any animal; (ii) may create a risk of any other loss or damage to any person or property; (iii) seeks to harm or exploit children by exposing them to inappropriate content, asking for personally identifiable details or otherwise; (iv) may constitute or contribute to a crime or tort; (v) involves any information or content that the Company deems to be unlawful, harmful, abusive, racially or ethnically offensive, defamatory, infringing, invasive of personal privacy or publicity rights, harassing, humiliating to other people (publicly or otherwise), libelous, threatening, profane, obscene, or otherwise objectionable; (vi) involves any information or content that is illegal (including, without limitation, the disclosure of insider information under securities law or of another party's trade secrets); (vii) involves any information or content that Customer does not have a right to make available under any law or under contractual or fiduciary relationships; or (viii) involves any information or content that Customer knows is not correct and current. Customer agrees that its use of the Service does not and will not violate third-party rights of any kind, including without limitation any intellectual property rights or rights of privacy. Company reserves the right, but is not obligated, to prevent any use of the Service that Company believes, in its sole discretion, violates any of these provisions. </p> </li> <li> <p> Customer acknowledges that ControlShift does not manage or control the accuracy or content of the Customer Data that Customer accesses, stores or distributes through the Service, and accepts no responsibility or liability for that information regardless of whether such Customer Data is transmitted to or by Customer in breach of these Terms. ControlShift makes no warranty with respect to such Customer Data Customer may access, store or distribute through the Service. In particular, without limiting the generality of the foregoing, ControlShift makes no warranty that such Customer Data will be free of any error, virus, worm, trojan horse, easter egg, time bomb, cancelbot, or other destructive or malicious code or programs. </p> </li> </ol> <h2>4. CONFIDENTIALITY; PROPRIETARY RIGHTS; DATA PROTECTION</h2> <ol> <li> <p> Each party (the “Receiving Party”) understands that the other party (the “Disclosing Party”) has disclosed or may disclose business, technical or financial information relating to the Disclosing Party’s business (hereinafter referred to as “Proprietary Information” of the Disclosing Party). Proprietary Information of Company includes non-public information regarding features, functionality and performance of the Service. The Receiving Party agrees: (i) to take reasonable precautions to protect such Proprietary Information, and (ii) not to use (except in performance of the Services or as otherwise permitted herein) or divulge to any third person any such Proprietary Information (and only subject to written binding use and disclosure restrictions at least as protective as those set forth herein executed in writing by such third persons). The Disclosing Party agrees that the foregoing shall not apply with respect to any information after five years following the disclosure thereof or any information that the Receiving Party can document (a) is or becomes generally available to the public, or (b) was in its possession or known by it prior to receipt from the Disclosing Party, or (c) was rightfully disclosed to it without restriction by a third party, or (d) was independently developed without use of any Proprietary Information of the Disclosing Party or (e) is required to be disclosed by law. In recognition of the unique and proprietary nature of the information disclosed by each party, it is agreed that each party’s remedy at law for breach by the other party of its obligations under Section 4 shall be inadequate and the disclosing party shall, in the event of such breach, be entitled to seek equitable relief, including without limitation, injunctive relief and specific performance, in addition to any other remedies provided hereunder or available at law. </p> </li> <li> <p> As between Customer and the Company, Customer shall own all right, title and interest in and to any data related to Customer’s members, personnel, business, and systems, that Customer submits and stores via the Service (the “Customer Data”), which for the avoidance of doubt shall constitute the Proprietary Information of Customer. Customer Data includes, without limitation, any personally identifiable information about Customer, its personnel, its customers or potential customers, to the extent provided to the Company by Customer, including information submitted by Customer during any registration process for the Services. Customer Data also includes, without limitation, any other data accessed or obtained by Company from any Customer third-party SaaS service account accessed and monitored by Company on behalf of Customer. ControlShift will not be responsible for any backup, recovery or other steps required to ensure that Customer Data is recoverable in the case of data loss or a termination of the Services or Customer’s account. Customer is solely responsible for backing up its Customer Data on a regular basis, taking appropriate steps to safeguard and ensure the integrity of its Customer Data, and exporting its Customer Data from the Services prior to termination of Customer’s account. </p> </li> <li> <p> Company shall own and retain all right, title and interest in and to (a) the Services and Software, together with all improvements, enhancements or modifications thereto, (b) any metadata or telemetry regarding Customer’s use of the Services that is collected by Company, and (c) all intellectual property rights related to any of the foregoing. </p> </li> <li> <p> Notwithstanding anything to the contrary, Company shall have the right collect and analyze data and other information relating to the provision, use and performance of various aspects of the Services and related systems and technologies (including, without limitation, runbooks created or implemented by Customer through the Services, information concerning Customer Data, and data derived therefrom), and Company will be free (during and after the term hereof) to (i) use such information and data to improve and enhance the Services, provide customer support, provide individual or aggregated reports to Customer (if requested), maintain the integrity of the service (e.g. by keeping a record of currently-authorized users), and for other development, diagnostic and corrective purposes in connection with the Services and other Company offerings, and (ii) use and disclose such data solely in anonymized, aggregated form in connection with its business. Customer agrees that the Company may also access, preserve and disclose Customer’s (and its Users) account information, related contents, and any other Customer Data if required to do so by law or in a good faith belief that such access preservation or disclosure is reasonably necessary to: (a) comply with legal process; (b) enforce these Terms; (c) respond to claims that any Customer Data violates the rights of third parties; (d) respond to Customer’s requests for customer service; or (e) protect the rights, property or personal safety of ControlShift, its users, or the public. No rights or licenses are granted except as expressly set forth herein. </p> </li> <li> <p> In order to use the Services and Software, the Company may need Customer to authorize Company to access and/or automatically retrieve data from its system(s) or third-party systems or services on Customer’s behalf. Customer hereby represents and warrants that it has the permission, authority, and rights to allow ControlShift to so automatically access such system(s) and services and Customer hereby grants ControlShift permission to access such system(s) and services as reasonably necessary to provide the Services. ControlShift disclaims any and all liability associated with accessing and retrieving data from such system(s) and services on Customer’s (or its Users’) behalf. In order to connect the Service with any third-party service, Customer hereby authorizes the Company to: (a) store Customer Data relating to such service; (b) access such service using Customer Data Customer provides to the Company; (c) use any materials Customer provides to Company in order to provide Customer the Service; (d) gather and export from such service any Customer Data reasonably necessary for the Company to provide the Service to Customer; and (e) otherwise take any action in connection with such service as is reasonably necessary for the Company to provide the Service to Customer. If at any time Customer does not have the right and authority to allow ControlShift automatic access to such system(s), then Customer hereby agrees to immediately disable such functionality within Customer’s account. </p> </li> <li> <p> Customer may choose to or Company may invite Customer to submit comments or ideas about the Service, including without limitation about how to improve the Service (“Feedback”). By submitting any Feedback, Customer agrees that its disclosure is gratuitous, unsolicited and without restriction and will not place ControlShift under any fiduciary or other obligation, and that Company is free to use the Feedback without any additional compensation to Customer, and/or to disclose the Feedback on a non confidential basis or otherwise to anyone. Customer further acknowledges that, by acceptance of Customer’s Feedback submission, ControlShift does not waive any rights to use similar or related ideas previously known to ControlShift, or developed by its employees, or obtained from sources other than Customer. </p> </li> </ol> <h2>5. PAYMENT TERMS</h2> <ol> <li> <p> Subject to the Terms, the Services may be provided to you without charge up to certain usage limits, and usage in excess of these limits may require purchase of additional resources and the payment of fees. Company will submit an order form with pricing terms to Customer for approval. </p> </li> <li> <p> Company may choose to bill through an invoice, in which case, full payment for invoices issued in any given month must be received by Company 30 days after the mailing date of the invoice. Unpaid amounts are subject to a finance charge of 1.5% per month on any outstanding balance, or the maximum permitted by law, whichever is lower, plus all expenses of collection and may result in immediate termination of Service. Customer shall be responsible for all taxes associated with Services other than U.S. taxes based on Company’s net income. If Customer believes that Company has billed Customer incorrectly, Customer must contact Company no later than 60 days after the closing date on the first billing statement in which the error or problem appeared, in order to receive an adjustment or credit, otherwise such claims are waived. </p> </li> </ol> <h2>6. TERM AND TERMINATION</h2> <ol> <li> <p> These Terms shall continue to apply until the Company terminates Customer’s account or Customer disables its subscription by emailing support@controlshiftlabs.com. The initial term of these Terms (including the initial term for all Users added after the effective date of these Terms) shall be one month, calculated from the start date specified on Customer’s order form, and shall renew automatically for terms of the same duration (each a “Renewal Term”) unless terminated as set forth in this Section 6. </p> </li> <li> <p> In addition to any other remedies it may have, either party may also terminate their contractual relationship at any time for any reason. Notwithstanding the foregoing, the Company shall be entitled to terminate or suspend Customer’s account immediately upon notice if the Customer materially breaches any of the terms or conditions of these Terms or in the case of nonpayment. Customer will pay in full for the Services up to and including the last day on which the Services are provided, and shall not be entitled to a refund for its early voluntary cancellation of the Services. All sections of these Terms which by their nature should survive termination will survive termination, including, without limitation, accrued rights to payment, confidentiality obligations, warranty disclaimers, and limitations of liability. </p> </li> </ol> <h2>7. WARRANTY AND DISCLAIMER</h2> <p> Company shall provide the Services in a professional and workmanlike manner. Services may be temporarily unavailable for scheduled maintenance or for unscheduled emergency maintenance, either by Company or by third-party providers, or because of other causes beyond Company’s reasonable control. Company does not warrant that the Services will be uninterrupted or error free; nor does it make any warranty as to the results that may be obtained from use of the Services. EXCEPT AS EXPRESSLY SET FORTH IN THIS SECTION, THE SERVICES ARE PROVIDED “AS IS” AND COMPANY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. THE SERVICE MAY CALL THE SERVERS OF OTHER WEBSITES OR SERVICES SOLELY AT THE DIRECTION OF AND AS A CONVENIENCE TO USERS OF THE SERVICE (“THIRD PARTY SITES”). CONTROLSHIFT MAKES NO EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THE INFORMATION, OR OTHER MATERIAL, PRODUCTS, OR SERVICES THAT ARE CONTAINED ON OR ACCESSIBLE THROUGH THIRD-PARTY SITES. ACCESS AND USE OF THIRD PARTY SITES, INCLUDING THE INFORMATION, MATERIAL, PRODUCTS, AND SERVICES ON SUCH SITES OR AVAILABLE THROUGH SUCH SITES, IS SOLELY AT CUSTOMER’S OWN RISK. IN ADDITION, CONTROLSHIFT SHALL HAVE NO RESPONSIBILITY FOR ANY LOSS OF DATA OR FUNCTIONALITY FROM ANY THIRD-PARTY SERVICE MONITORED OR ACCESSED BY CONTROLSHIFT OR THAT CONTROLSHIFT’S ACCESS TO SUCH THIRD-PARTY SERVICES ON CUSTOMER’S BEHALF WILL NOT RESULT IN ANY INTERRUPTION OF SUCH THIRD-PARTY SERVICES. </p> <h2>8. LIMITATION OF LIABILITY</h2> <p> NOTWITHSTANDING ANYTHING TO THE CONTRARY, EXCEPT FOR BODILY INJURY OF A PERSON, COMPANY AND ITS SUPPLIERS (INCLUDING BUT NOT LIMITED TO ALL EQUIPMENT AND TECHNOLOGY SUPPLIERS), OFFICERS, AFFILIATES, REPRESENTATIVES, CONTRACTORS AND EMPLOYEES SHALL NOT BE RESPONSIBLE OR LIABLE TO CUSTOMER WITH RESPECT TO ANY SUBJECT MATTER OF THESE TERMS OR TERMS AND CONDITIONS RELATED THERETO UNDER ANY CONTRACT, NEGLIGENCE, STRICT LIABILITY OR OTHER THEORY: (A) FOR ERROR OR INTERRUPTION OF USE OR FOR LOSS OR INACCURACY OR CORRUPTION OF DATA OR COST OF PROCUREMENT OF SUBSTITUTE GOODS, SERVICES OR TECHNOLOGY OR LOSS OF BUSINESS; (B) FOR ANY INDIRECT, EXEMPLARY, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES; OR (C) FOR ANY AMOUNTS THAT, TOGETHER WITH AMOUNTS ASSOCIATED WITH ALL OTHER CLAIMS, EXCEED THE FEES PAID OR PAYABLE BY CUSTOMER TO COMPANY FOR THE SERVICES UNDER THESE TERMS IN THE 12 MONTHS PRIOR TO THE ACT THAT GAVE RISE TO THE LIABILITY (THE “CAP”), IN EACH CASE, WHETHER OR NOT CUSTOMER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. NOTWITHSTANDING THE FOREGOING, IF A CLAIM ASSERTED BY CUSTOMER OR ON BEHALF OF CUSTOMER ARISES FROM OR RELATES TO A PARTICULAR TOOL TO WHICH CUSTOMER HAS ACCESSED OR SUBSCRIBED, THE CAP SHALL BE LIMITED TO THE FEES PAID OR PAYABLE BY CUSTOMER TO COMPANY FOR THE PARTICULAR TOOL AT ISSUE IN THE 12 MONTHS PRIOR TO THE ACT THAT GAVE RISE TO THE LIABILITY. CUSTOMER ACKNOWLEDGES AND AGREES THAT CONTROLSHIFT HAS OFFERED ITS PRODUCTS AND SERVICES, SET ITS PRICES, AND ENTERED INTO THESE TERMS IN RELIANCE UPON THE DISCLAIMERS OF WARRANTY AND THE LIMITATIONS OF LIABILITY SET FORTH HEREIN, THAT THE DISCLAIMERS OF WARRANTY AND THE LIMITATIONS OF LIABILITY SET FORTH HEREIN REFLECT A REASONABLE AND FAIR ALLOCATION OF RISK BETWEEN THE PARTIES (INCLUDING THE RISK THAT A CONTRACT REMEDY MAY FAIL OF ITS ESSENTIAL PURPOSE AND CAUSE CONSEQUENTIAL LOSS), AND THAT THE DISCLAIMERS OF WARRANTY AND THE LIMITATIONS OF LIABILITY SET FORTH HEREIN FORM AN ESSENTIAL BASIS OF THE BARGAIN BETWEEN CUSTOMER AND CONTROLSHIFT. NOTWITHSTANDING THE FOREGOING, THE CAP SHALL NOT APPLY WITH RESPECT TO CLAIMS BY CONTROLSHIFT ARISING FROM CUSTOMER’S NONPAYMENT OR UNDERPAYMENT OF FEES. </p> <h2>9. INDEMNIFICATION</h2> <p> Customer agrees to defend, indemnify and hold harmless ControlShift and its subsidiaries, agents, managers, and other affiliated companies, and their employees, contractors, agents, officers and directors from and against any and all claims, damages, obligations, losses, liabilities, costs or debt, and expenses (including but not limited to attorney's fees) arising out of or related to: (a) the Customer Data, or Customer’s provision of the Customer Data to ControlShift; (b) ControlShift’s access to any third-party software or services authorized by Customer; or (c) Customer’s use of the Services in breach of these Terms. </p> <h2>10. GOVERNING LAW; DISPUTE RESOLUTION</h2> <ol> <li> <p> <u>Governing Law.</u> These Terms shall be governed by the internal substantive laws of the State of New York, without respect to its conflict of laws principles. The parties acknowledge that these Terms evidences a transaction involving interstate commerce. Notwithstanding the preceding sentences with respect to the substantive law, any arbitration conducted pursuant to the terms of these Terms shall be governed by the Federal Arbitration Act (9 U.S.C. §§ 1-16). The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Except for claims subject to arbitration pursuant to Section 10.2, the parties hereby irrevocably submit to the exclusive personal jurisdiction of the state courts located in New York, New York and federal courts located in the Southern District of New York for dispute arising from or related to these Terms. </p> </li> <li> <p> <u>Arbitration.</u> For any dispute with either party (including its officers, directors, employees, agents, or other representatives), the parties hereto agree to first contact the other party and attempt in good faith to resolve the dispute informally. In the unlikely event that the parties have not been able to resolve a dispute after sixty (60) days, the parties agree to resolve any claim, dispute, or controversy (excluding any claims for injunctive or other equitable relief as provided below) arising out of or in connection with or relating to these Terms, or the breach or alleged breach thereof (collectively, “Claims”), by binding arbitration by JAMS, under the Optional Expedited Arbitration Procedures then in effect for JAMS, except as provided herein; provided that the Optional Expedited Arbitration Procedures shall not apply with respect to claims by other party for actual or threatened infringement, misappropriation, or violation of our data security, intellectual property or other proprietary rights. The arbitration will be conducted in New York, New York, before a single arbitrator, unless Customer and ControlShift agree otherwise. Each party will be responsible for paying any JAMS filing, administrative and arbitrator fees in accordance with JAMS rules, and the award rendered by the arbitrator shall include an award of costs of arbitration, reasonable attorneys’ fees and reasonable costs for expert and other witnesses to the prevailing party. Any judgment on the award rendered by the arbitrator may be entered in any court of competent jurisdiction. Nothing in this Section shall be deemed as preventing either party from seeking temporary, preliminary, or permanent injunctive or other equitable relief from the courts as necessary to prevent the actual or threatened infringement, misappropriation, or violation of our data security, intellectual property or other proprietary rights. </p> </li> <li> <p> <u>Class Action/Jury Trial Waiver.</u> With respect to all persons and entities, regardless of whether they have obtained or used the Service for personal, commercial or other purposes, all claims must be brought in the parties’ individual capacity, and not as a plaintiff or class member in any purported class action, collective action, private attorney general action or other representative proceeding. This waiver applies to class arbitration, and, unless the parties agree otherwise, the arbitrator may not consolidate more than one person’s claims. Customer agrees that, by entering into These Terms, Customer and ControlShift are each waiving the right to a trial by jury or to participate in a class action, collective action, private attorney general action, or other representative proceeding of any kind. </p> </li> </ol> <h2>11. MODIFICATIONS AND CHANGES</h2> <ol> <li> <p> <u>Modifications to the Services.</u> ControlShift is constantly innovating in order to provide the best possible experience for its users. You acknowledge and agree that the form and nature of the Services which ControlShift provides may change from time to time without prior notice to you. Changes to the form and nature of the Services will be effective with respect to all versions of the Services; examples of changes to the form and nature of the Services include without limitation security patches, added functionality, automatic updates, and other enhancements. Any new features that may be added to the Site or the Services from time to time will be subject to these Terms, unless stated otherwise. </p> </li> <li> <p> <u>Changes to the Terms.</u> These Terms may be amended or updated from time to time without notice and may have changed since your last visit to the website or use of the Services. It is your responsibility to review these Terms for any changes. Changes to these Terms shall become effective and binding upon you at the start of your next Renewal Term. By continuing to access or use the Services after such revisions become effective, you agree to be bound by the revised Terms. If you do not agree to the new Terms, please stop using the Services. Please visit this page regularly to review these Terms for any changes. </p> </li> </ol> <h2>12. PUBLICITY</h2> <p> Customer agrees that Company may use Customer’s trade names, trademarks, service marks, logos, domain names and other distinctive branch features in presentations, marketing materials, customer lists, financial reports and website listings for the purpose of advertising or publicizing Customer’s use of the Services. Customer further agrees to serve as a customer reference, upon Company’s request. </p> <h2>13. MISCELLANEOUS</h2> <p> If any provision of these Terms is found to be unenforceable or invalid, that provision will be limited or eliminated to the minimum extent necessary so that these Terms will otherwise remain in full force and effect and enforceable. These Terms is not assignable, transferable or sublicensable by either party except with the other party’s prior written consent. Notwithstanding the foregoing, either party may transfer and assign any of its rights and obligations under these Terms as part of a merger, acquisition, sale of substantially all assets, or similar transaction. These Terms is the complete and exclusive statement of the mutual understanding of the parties and supersedes and cancels all previous written and oral agreements, communications and other understandings relating to the subject matter of these Terms, and that all waivers and modifications must be in a writing signed by both parties, except as otherwise provided herein. No agency, partnership, joint venture, or employment is created as a result of these Terms and Customer does not have any authority of any kind to bind Company in any respect whatsoever. In any action or proceeding to enforce rights under these Terms, the prevailing party will be entitled to recover costs and attorneys’ fees. All notices under these Terms will be in writing and will be deemed to have been duly given when received, if personally delivered; when receipt is electronically confirmed, if transmitted by facsimile or e-mail; the day after it is sent, if sent for next day delivery by recognized overnight delivery service; and upon receipt, if sent by certified or registered mail, return receipt requested. </p> </div> </div> </div> </div>
143.836806
3,639
0.753989
f9f568fbd07f4a0a03a30d1c9a406489cd75d3e8
2,334
go
Go
installer/build.go
wx13/genesis
0d17fe46f2d17afb28b13c820d1e0a5dbdf4218c
[ "MIT" ]
null
null
null
installer/build.go
wx13/genesis
0d17fe46f2d17afb28b13c820d1e0a5dbdf4218c
[ "MIT" ]
null
null
null
installer/build.go
wx13/genesis
0d17fe46f2d17afb28b13c820d1e0a5dbdf4218c
[ "MIT" ]
null
null
null
package installer import ( "archive/zip" "bytes" "fmt" "io/ioutil" "path/filepath" "strings" "github.com/kardianos/osext" "github.com/wx13/genesis" ) func getFilesToArchive(allFiles []string, tmpdir string) []string { files := []string{} for _, file := range allFiles { if strings.HasPrefix(file, tmpdir) { p, err := filepath.Rel(tmpdir, file) if err == nil { files = append(files, p) } } } return files } func readExec(execname string) []byte { execbody, err := ioutil.ReadFile(execname) if err != nil { fmt.Println("Error: cannot read executable (self):", execname, err) } return execbody } func (inst *Installer) Build() { fmt.Println("Building the self-contained executable...") dirs := inst.BuildDirs files := getFilesToArchive(inst.Files(), genesis.Tmpdir) execname := inst.ExecName if len(execname) == 0 { execname, _ = osext.Executable() } execbody := readExec(execname) // Create the zip archive. buf := new(bytes.Buffer) w := zip.NewWriter(buf) w.SetOffset(int64(len(execbody))) addFilesToArchive(w, files, dirs) // Append zip to executable. execbody = append(execbody, buf.Bytes()...) // Write out executable. err := ioutil.WriteFile(execname+".x", execbody, 0755) if err != nil { fmt.Println("Error writing to zip file:", err) return } fmt.Println("Done building archive.") } func addFilesToArchive(w *zip.Writer, files, dirs []string) { fmt.Println("Adding files to archive:") for _, file := range files { fmt.Println(" ", file) f, err := w.Create(file) if err != nil { fmt.Println("Cannot add file to archive:", file, err) continue } body, err := readFile(file, dirs) if err != nil { fmt.Printf("Could not read file %s in directories %+v, because of %+v\n", file, dirs, err) continue } _, err = f.Write(body) if err != nil { fmt.Println("Cannot write file contents to archive:", file, err) continue } } err := w.Close() if err != nil { fmt.Println("Cannot close archive:", err) } } func readFile(file string, dirs []string) ([]byte, error) { var err error var body []byte if len(dirs) == 0 { dirs = []string{""} } for _, dir := range dirs { filename := filepath.Join(dir, file) body, err = ioutil.ReadFile(filename) if err == nil { return body, nil } } return body, err }
20.295652
93
0.648243
717f7ca67ea0eb6cbb6bc91acf32bfb13845d726
4,504
lua
Lua
callbacks.lua
Germanunkol/GridCars
f0fe6efe02e252043a80975007a32d0b9af03b65
[ "MIT" ]
16
2015-01-05T21:00:43.000Z
2022-03-11T05:39:33.000Z
callbacks.lua
Germanunkol/GridCars
f0fe6efe02e252043a80975007a32d0b9af03b65
[ "MIT" ]
10
2015-01-09T14:49:28.000Z
2015-01-15T21:11:45.000Z
callbacks.lua
Germanunkol/GridCars
f0fe6efe02e252043a80975007a32d0b9af03b65
[ "MIT" ]
7
2015-03-06T18:00:30.000Z
2022-03-11T05:39:57.000Z
-- This defines all the callbacks needed by server and client. -- Callbacks are called when certain events happen. VERSION = "0.6" -- These are all possible commands clients of the server can send: CMD = { CHAT = 128, MAP = 129, START_GAME = 130, GAMESTATE = 131, NEW_CAR = 132, MOVE_CAR = 133, PLAYER_WINS = 134, BACK_TO_LOBBY = 135, LAPS = 136, SERVERCHAT = 138, STAT = 139, } function setServerCallbacks( server ) server.callbacks.received = serverReceived server.callbacks.synchronize = synchronize server.callbacks.authorize = function( user, msg ) return lobby:authorize( user, msg ) end server.callbacks.userFullyConnected = newUser server.callbacks.disconnectedUser = disconnectedUser -- Called when there's an error advertising (only on NON-DEDICATED server!): network.advertise.callbacks.advertiseWarnings = advertisementMsg end function setClientCallbacks( client ) -- set client callbacks: client.callbacks.received = clientReceived client.callbacks.connected = connected client.callbacks.disconnected = disconnected client.callbacks.otherUserConnected = otherUserConnected client.callbacks.otherUserDisconnected = otherUserDisconnected -- Called when user is authorized or not (in the second case, a reason is given): client.callbacks.authorized = function( auth, reason ) menu:authorized( auth, reason ) end end -- Called when client is connected to the server function connected() lobby:show() menu:closeConnectPanel() end -- Called on server when client is connected to server: function newUser( user ) lobby:setUserColor( user ) server:setUserValue( user, "moved", true ) server:setUserValue( user, "roundsWon", 0 ) server:send( CMD.SERVERCHAT, WELCOME_MSG, user ) if DEDICATED then utility.log( "[" .. os.time() .. "] New user: " .. user.playerName .. " (" .. server:getNumUsers() .. ")" ) end -- update advertisement: updateAdvertisementInfo() end -- Called when client is disconnected from the server function disconnected( msg ) menu:show() if msg and #msg > 0 then menu:errorMsg( "You have been kicked:", msg ) end client = nil server = nil end -- Called on server when user disconnects: function disconnectedUser( user ) if DEDICATED then utility.log( "[" .. os.time() .. "] User left: " .. user.playerName .. " (" .. server:getNumUsers() .. ")" ) end -- update advertisement: updateAdvertisementInfo() end -- Called on server when new client is in the process of -- connecting. function synchronize( user ) -- If the server has a map chosen, let the new client know -- about it: lobby:sendMap( user ) if STATE == "Game" then server:send( CMD.START_GAME, "", user ) game:synchronizeCars( user ) end end function otherUserConnected( user ) print("TEST!") if client and client.authorized then Sounds:play( "beep" ) end end function otherUserDisconnected( user ) stats:removeUser( user.id ) end function serverReceived( command, msg, user ) if command == CMD.CHAT then -- broadcast chat messages on to all players server:send( command, user.playerName .. ": " .. msg ) elseif command == CMD.MOVE_CAR then local x, y = msg:match( "(.*)|(.*)" ) print( "move car:", user.id, x, y, msg) game:validateCarMovement( user.id, x, y ) end end function clientReceived( command, msg ) if command == CMD.CHAT then chat:newLineSpeech( msg ) elseif command == CMD.SERVERCHAT then chat:newLineServer( msg ) elseif command == CMD.MAP then lobby:receiveMap( msg ) elseif command == CMD.START_GAME then game:show() elseif command == CMD.GAMESTATE then game:setState( msg ) elseif command == CMD.NEW_CAR then game:newCar( msg ) elseif command == CMD.MOVE_CAR then game:moveCar( msg ) elseif command == CMD.PLAYER_WINS then game:playerWins( msg ) elseif command == CMD.BACK_TO_LOBBY then lobby:show() elseif command == CMD.LAPS then lobby:receiveLaps( msg ) elseif command == CMD.STAT then stats:add( msg ) stats:show() -- in case it's not displaying yet, show the stats window end end function updateAdvertisementInfo() if server then local players, num = network:getUsers() if num then serverInfo.numPlayers = num end if STATE == "Game" then serverInfo.state = "Game" else serverInfo.state = "Lobby" end serverInfo.map = map:getName() network.advertise:setInfo( utility.createServerInfo() ) end end function advertisementMsg( msg ) if STATE == "Lobby" then lobby:newWarning( "Could not advertise your game online:\n" .. msg ) end end
27.29697
91
0.721359
2705fcce9a9db74f8d4ae523d532bde900b5eaaa
2,238
swift
Swift
Istvan Sky/Sources/Services/Models/BasicItemType.swift
xfreebird/istvansky-ios
7c988641f3c54392bd355e0802b25aa8d775d11c
[ "MIT" ]
1
2021-04-12T01:06:50.000Z
2021-04-12T01:06:50.000Z
Istvan Sky/Sources/Services/Models/BasicItemType.swift
xfreebird/istvansky-ios
7c988641f3c54392bd355e0802b25aa8d775d11c
[ "MIT" ]
null
null
null
Istvan Sky/Sources/Services/Models/BasicItemType.swift
xfreebird/istvansky-ios
7c988641f3c54392bd355e0802b25aa8d775d11c
[ "MIT" ]
null
null
null
// // BasicItemType.swift // Istvan Sky // // Created by Nicolae Ghimbovschi on 1/2/19. // Copyright © 2019 GMBN. All rights reserved. // import Foundation enum BasicItemType: String { case home case tour case about case web case feed case ashram case blogpost case booking case music case meditation case meditations case event case donate case support case contact case more case bandcamp case spotify case appleMusic = "applemusic" case appleiTunes = "appleitunes" case deezer case googleMusic = "googlemusic" case tidal case amazon case youtube case facebook case instagram case privacyPolicy = "privacypolicy" case thirdParty = "thirdparty" case version case tandc case clearcache case unknown init(rawValue: String) { switch rawValue { case "home": self = .home case "tour": self = .tour case "about": self = .about case "web": self = .web case "feed": self = .feed case "ashram": self = .ashram case "blogpost": self = .blogpost case "booking": self = .booking case "music": self = .music case "meditation": self = .meditation case "meditations": self = .meditations case "event": self = .event case "donate": self = .donate case "support": self = .support case "contact": self = .contact case "more": self = .more case "bandcamp": self = .bandcamp case "spotify": self = .spotify case "applemusic": self = .appleMusic case "appleitunes": self = .appleiTunes case "deezer": self = .deezer case "googlemusic": self = .googleMusic case "tidal": self = .tidal case "amazon": self = .amazon case "youtube": self = .youtube case "facebook": self = .facebook case "instagram": self = .instagram case "privacypolicy": self = .privacyPolicy case "thirdparty": self = .thirdParty case "version": self = .version case "tandc": self = .tandc case "clearcache": self = .clearcache default: self = .unknown } } }
26.642857
51
0.589812
5f194da997985409200a7ff27dc931148c239f14
512
ts
TypeScript
src/files/files.module.ts
knopkem/dicomweb-archive
5cfaa11a42f4b29fd22e24962617c6b4e1b3c6d6
[ "MIT" ]
4
2021-04-01T14:01:40.000Z
2021-12-03T04:01:21.000Z
src/files/files.module.ts
knopkem/dicomweb-nestjs
5cfaa11a42f4b29fd22e24962617c6b4e1b3c6d6
[ "MIT" ]
null
null
null
src/files/files.module.ts
knopkem/dicomweb-nestjs
5cfaa11a42f4b29fd22e24962617c6b4e1b3c6d6
[ "MIT" ]
2
2021-03-16T05:45:51.000Z
2021-12-03T04:01:35.000Z
import { Logger, Module, OnModuleInit } from '@nestjs/common'; import { FilesService } from './files.service'; import { StudiesModule } from './../studies/studies.module'; @Module({ imports: [StudiesModule], providers: [FilesService], }) export class FilesModule implements OnModuleInit { constructor(private fileService: FilesService) {} logger = new Logger('FilesModule'); // auto run on startup onModuleInit() { this.logger.verbose(`Initialization...`); this.fileService.import(); } }
26.947368
62
0.705078
f04ce64c795e8f616352eaaa159edec4673a3240
1,432
py
Python
src/cpp/convert.py
shindavid/splendor
b51b0408967627dbd61f60f57031d1fe21aa9d8f
[ "MIT" ]
1
2017-11-02T18:32:51.000Z
2017-11-02T18:32:51.000Z
src/cpp/convert.py
shindavid/splendor
b51b0408967627dbd61f60f57031d1fe21aa9d8f
[ "MIT" ]
1
2018-07-05T09:07:40.000Z
2018-07-05T09:07:40.000Z
src/cpp/convert.py
shindavid/splendor
b51b0408967627dbd61f60f57031d1fe21aa9d8f
[ "MIT" ]
null
null
null
filename = '../py/cards.py' f = open(filename) color_map = { 'W' : 'eWhite', 'U' : 'eBlue', 'G' : 'eGreen', 'R' : 'eRed', 'B' : 'eBlack', 'J' : 'eGold', } color_index_map = { 'W' : 0, 'U' : 1, 'G' : 2, 'R' : 3, 'B' : 4 } def convert(cost_str): cost_array = [0,0,0,0,0] tokens = [x.strip() for x in cost_str.split(',')] for token in tokens: subtokens = token.split(':') color_index = color_index_map[subtokens[0]] count = int(subtokens[1]) cost_array[color_index] = count return ', '.join([str(x) for x in cost_array]) ID = 0 first = True for line in f: if line.count('_add_card'): if first: first = False continue lp = line.find('(') rp = line.find(')') lb = line.find('{') rb = line.find('}') cost_str = line[lb+1:rb] tokens = line[lp+1:rp].split(',') level = int(tokens[0].strip()) - 1 points = int(tokens[1].strip()) color = color_map[tokens[2].strip()] print ' {%2d, {%s}, %s, %s, %s},' % (ID, convert(cost_str), points, level, color) ID += 1 ID = 0 f = open(filename) first = True for line in f: if line.count('_add_noble'): if first: first = False continue lp = line.find('(') rp = line.find(')') lb = line.find('{') rb = line.find('}') cost_str = line[lb+1:rb] print ' {%s, 3, {%s}},' % (ID, convert(cost_str)) ID += 1
21.058824
88
0.513966