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
43f0bdc3c1f3737bf8a391098a7dda5112a1b175
7,519
kt
Kotlin
generator/stdlib/src/commonMain/kotlin/com/github/jcornaz/kwik/generator/stdlib/Collections.kt
giovanepadawan/kwik
9523cdd3bc6c199c8b85f085cb9686e5e43a4d37
[ "Apache-2.0" ]
null
null
null
generator/stdlib/src/commonMain/kotlin/com/github/jcornaz/kwik/generator/stdlib/Collections.kt
giovanepadawan/kwik
9523cdd3bc6c199c8b85f085cb9686e5e43a4d37
[ "Apache-2.0" ]
null
null
null
generator/stdlib/src/commonMain/kotlin/com/github/jcornaz/kwik/generator/stdlib/Collections.kt
giovanepadawan/kwik
9523cdd3bc6c199c8b85f085cb9686e5e43a4d37
[ "Apache-2.0" ]
null
null
null
package com.github.jcornaz.kwik.generator.stdlib import com.github.jcornaz.kwik.generator.api.Generator import com.github.jcornaz.kwik.generator.api.randomSequence import kotlin.random.Random private const val MAX_EXTRA_ADD_ATTEMPT = 1000 /** * Returns a generator of [List] where sizes are all between [minSize] and [maxSize] (inclusive) * * @param elementGen Generator to use for elements in the list */ fun <T> Generator.Companion.lists( elementGen: Generator<T>, minSize: Int = 0, maxSize: Int = maxOf(minSize, KWIK_DEFAULT_MAX_SIZE) ): Generator<List<T>> = ListGenerator(elementGen, minSize, maxSize) /** * Returns a generator of non-empty [List] where sizes are all between 1 and [maxSize] (inclusive) * * @param elementGen Generator to use for elements in the list */ fun <T> Generator.Companion.nonEmptyLists( elementGen: Generator<T>, maxSize: Int = KWIK_DEFAULT_MAX_SIZE ): Generator<List<T>> = lists(elementGen, 1, maxSize) /** * Returns a generator of [List] using a default generator for the elements */ inline fun <reified T> Generator.Companion.lists( minSize: Int = 0, maxSize: Int = KWIK_DEFAULT_MAX_SIZE ): Generator<List<T>> = lists(Generator.default(), minSize, maxSize) /** * Returns a generator of non-empty [List] using a default generator for the elements */ inline fun <reified T> Generator.Companion.nonEmptyLists(maxSize: Int = KWIK_DEFAULT_MAX_SIZE): Generator<List<T>> = lists(Generator.default(), 1, maxSize) private class ListGenerator<T>( private val elementGen: Generator<T>, private val minSize: Int, private val maxSize: Int ) : Generator<List<T>> { override val samples: Set<List<T>> = mutableSetOf<List<T>>().apply { if (minSize == 0) add(emptyList()) if (minSize <= 1 && maxSize >= 1) { elementGen.samples.forEach { add(listOf(it)) } } } init { requireValidSizes(minSize, maxSize) } override fun generate(random: Random): List<T> = List(random.nextInt(minSize, maxSize + 1)) { elementGen.generate(random) } } /** * Returns a generator of [Set] where sizes are all between [minSize] and [maxSize] (inclusive) * * If the domain of the elements is too small, this generator may fail after too many attempt to create a set of [minSize] * * @param elementGen Generator to use for elements in the set */ fun <T> Generator.Companion.sets( elementGen: Generator<T>, minSize: Int = 0, maxSize: Int = maxOf(minSize, KWIK_DEFAULT_MAX_SIZE) ): Generator<Set<T>> = SetGenerator(elementGen, minSize, maxSize) /** * Returns a generator of non-empty [Set] where sizes are all between 1 and [maxSize] (inclusive) * * @param elementGen Generator to use for elements in the set */ fun <T> Generator.Companion.nonEmptySets( elementGen: Generator<T>, maxSize: Int = KWIK_DEFAULT_MAX_SIZE ): Generator<Set<T>> = sets(elementGen, 1, maxSize) /** * Returns a generator of [Set] using a default generator for the elements */ inline fun <reified T> Generator.Companion.sets( minSize: Int = 0, maxSize: Int = KWIK_DEFAULT_MAX_SIZE ): Generator<Set<T>> = sets(Generator.default(), minSize, maxSize) /** * Returns a generator of non-empty [Set] using a default generator for the elements */ inline fun <reified T> Generator.Companion.nonEmptySets(maxSize: Int = KWIK_DEFAULT_MAX_SIZE): Generator<Set<T>> = sets(Generator.default(), 1, maxSize) private class SetGenerator<T>( private val elementGen: Generator<T>, private val minSize: Int, private val maxSize: Int ) : Generator<Set<T>> { override val samples: Set<Set<T>> = mutableSetOf<Set<T>>().apply { if (minSize == 0) add(emptySet()) if (minSize <= 1 && maxSize >= 1) { elementGen.samples.forEach { add(setOf(it)) } } } init { requireValidSizes(minSize, maxSize) } override fun generate(random: Random): Set<T> { val size = random.nextInt(minSize, maxSize + 1) val set = HashSet<T>(size) repeat(size) { set += elementGen.generate(random) } var extraAttempt = 0 while (set.size < size && extraAttempt < MAX_EXTRA_ADD_ATTEMPT) { set += elementGen.generate(random) ++extraAttempt } if (set.size < minSize) error("Failed to create a set with the requested minimum of element") return set } } /** * Returns a generator of [Map] where sizes are all between [minSize] and [maxSize] (inclusive) * * If the domain of the keys is too small, this generator may fail after too many attempt to create a set of [minSize] * * @param keyGen Generator to use for keys in the map * @param valueGen Generator to use for values in the map */ fun <K, V> Generator.Companion.maps( keyGen: Generator<K>, valueGen: Generator<V>, minSize: Int = 0, maxSize: Int = maxOf(minSize, KWIK_DEFAULT_MAX_SIZE) ): Generator<Map<K, V>> = MapGenerator(keyGen, valueGen, minSize, maxSize) /** * Returns a generator of non-empty [Map] where sizes are all between 1 and [maxSize] (inclusive) * * @param keyGen Generator to use for keys in the map * @param valueGen Generator to use for values in the map */ fun <K, V> Generator.Companion.nonEmptyMaps( keyGen: Generator<K>, valueGen: Generator<V>, maxSize: Int = KWIK_DEFAULT_MAX_SIZE ): Generator<Map<K, V>> = maps(keyGen, valueGen, 1, maxSize) /** * Returns a generator of [Map] using a default generator for the elements */ inline fun <reified K, reified V> Generator.Companion.maps( minSize: Int = 0, maxSize: Int = KWIK_DEFAULT_MAX_SIZE ): Generator<Map<K, V>> = maps(Generator.default(), Generator.default(), minSize, maxSize) /** * Returns a generator of non-empty [Map] using a default generator for the elements */ inline fun <reified K, reified V> Generator.Companion.nonEmptyMaps( maxSize: Int = KWIK_DEFAULT_MAX_SIZE ): Generator<Map<K, V>> = maps(Generator.default(), Generator.default(), 1, maxSize) private class MapGenerator<K, V>( private val keyGen: Generator<K>, private val valueGen: Generator<V>, private val minSize: Int, private val maxSize: Int ) : Generator<Map<K, V>> { override val samples: Set<Map<K, V>> = mutableSetOf<Map<K, V>>().apply { if (minSize == 0) add(emptyMap()) if (minSize <= 1 && maxSize >= 1) { val values = (valueGen.samples.asSequence() + valueGen.randomSequence(0)).iterator() keyGen.samples.forEach { add(mapOf(it to values.next())) } } } init { requireValidSizes(minSize, maxSize) } override fun generate(random: Random): Map<K, V> { val size = random.nextInt(minSize, maxSize + 1) val map = HashMap<K, V>(size) repeat(size) { map[keyGen.generate(random)] = valueGen.generate(random) } var extraAttempt = 0 while (map.size < size && extraAttempt < MAX_EXTRA_ADD_ATTEMPT) { map[keyGen.generate(random)] = valueGen.generate(random) ++extraAttempt } if (map.size < minSize) error("Failed to create a set with the requested minimum of element") return map } } internal fun requireValidSizes(minSize: Int, maxSize: Int) { require(minSize >= 0) { "Invalid min size: $minSize" } require(maxSize >= minSize) { "Invalid min-max sizes: min=$maxSize max=$minSize" } }
31.995745
122
0.664051
50ab56be455d3dbf826bb9985684efbff83fa565
3,921
swift
Swift
CotEditor/Sources/FindPanelTextView.swift
PirateRunscope3/cotEditorMac
fcdb37b62592f9baef0db293f1dbda3f2998d408
[ "Apache-2.0" ]
1
2020-09-30T07:14:05.000Z
2020-09-30T07:14:05.000Z
CotEditor/Sources/FindPanelTextView.swift
PirateRunscope3/cotEditorMac
fcdb37b62592f9baef0db293f1dbda3f2998d408
[ "Apache-2.0" ]
null
null
null
CotEditor/Sources/FindPanelTextView.swift
PirateRunscope3/cotEditorMac
fcdb37b62592f9baef0db293f1dbda3f2998d408
[ "Apache-2.0" ]
null
null
null
/* FindPanelTextView.swift CotEditor https://coteditor.com Created by 1024jp on 2015-03-04. ------------------------------------------------------------------------------ © 2015-2016 1024jp 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 https://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 Cocoa /// text view that behaves like a NSTextField final class FindPanelTextView: NSTextView { // MARK: Private Properties @IBInspectable var performsActionOnEnter: Bool = false // MARK: - // MARK: Lifecycle required init?(coder: NSCoder) { super.init(coder: coder) // set system font (standard NSTextField behavior) self.font = NSFont.systemFont(ofSize: 0) // set inset a bit like NSTextField (horizontal inset is added in FindPanelTextClipView) self.textContainerInset = NSSize(width: 0.0, height: 2.0) // avoid wrapping self.textContainer?.widthTracksTextView = false self.textContainer?.containerSize = NSSize.infinite self.isHorizontallyResizable = true // disable automatic text substitutions self.isAutomaticQuoteSubstitutionEnabled = false self.isAutomaticDashSubstitutionEnabled = false self.isAutomaticTextReplacementEnabled = false self.isAutomaticSpellingCorrectionEnabled = false self.smartInsertDeleteEnabled = false // set subclassed layout manager for invisible characters let layoutManager = FindPanelLayoutManager() self.textContainer?.replaceLayoutManager(layoutManager) } // MARK: TextView Methods /// view is on focus override func becomeFirstResponder() -> Bool { // select whole string on focus (standard NSTextField behavior) self.selectedRange = self.string?.nsRange ?? .notFound return super.becomeFirstResponder() } /// view dismiss focus override func resignFirstResponder() -> Bool { // clear current selection (standard NSTextField behavior) self.selectedRange = NSRange(location: 0, length: 0) return super.resignFirstResponder() } /// perform Find Next with return override func insertNewline(_ sender: Any?) { // perform Find Next in find string field (standard NSTextField behavior) if performsActionOnEnter { TextFinder.shared.findNext(self) } } /// jump to the next responder with tab key (standard NSTextField behavior) override func insertTab(_ sender: Any?) { self.window?.makeFirstResponder(self.nextKeyView) } /// swap '¥' with '\' if needed override func insertText(_ string: Any, replacementRange: NSRange) { // cast input to String var str: String = { if let string = string as? NSAttributedString { return string.string } return string as! String }() // swap '¥' with '\' if needed if UserDefaults.standard[.swapYenAndBackSlash] { switch str { case "\\": str = "¥" case "¥": str = "\\" default: break } } super.insertText(str, replacementRange: replacementRange) } }
28.830882
96
0.609028
af02449d4ea25c6ddc4ba0615fd94ebefee49825
1,096
kt
Kotlin
Source/GUI/Android/app/src/main/java/net/mediaarea/mediainfo/SettingsActivity.kt
buckmelanoma/MediaInfo
cf38b0e3d0e6ee2565f49276f423a5792ed62962
[ "BSD-2-Clause" ]
743
2015-01-13T23:16:53.000Z
2022-03-31T22:56:27.000Z
Source/GUI/Android/app/src/main/java/net/mediaarea/mediainfo/SettingsActivity.kt
buckmelanoma/MediaInfo
cf38b0e3d0e6ee2565f49276f423a5792ed62962
[ "BSD-2-Clause" ]
317
2015-07-28T17:50:14.000Z
2022-03-08T02:41:19.000Z
Source/GUI/Android/app/src/main/java/net/mediaarea/mediainfo/SettingsActivity.kt
buckmelanoma/MediaInfo
cf38b0e3d0e6ee2565f49276f423a5792ed62962
[ "BSD-2-Clause" ]
134
2015-01-30T05:33:51.000Z
2022-03-21T09:39:38.000Z
/* Copyright (c) MediaArea.net SARL. All Rights Reserved. * * Use of this source code is governed by a BSD-style license that can * be found in the License.html file in the root of the source tree. */ package net.mediaarea.mediainfo import android.content.Context import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import kotlinx.android.synthetic.main.activity_about.* class SettingsActivity : AppCompatActivity(), SettingsActivityListener { override fun getSubscriptionManager(): SubscriptionManager { return SubscriptionManager.getInstance(application) } override fun getContext(): Context { return this } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_settings) setSupportActionBar(toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) supportFragmentManager .beginTransaction() .replace(R.id.settings_container, SettingsFragment()) .commit() } }
28.842105
72
0.715328
bf17803dea117e5d3cecb61a003e915459545799
2,261
rs
Rust
disco/analysis/src/windows.rs
romnn/wasm-audio-effect-rack
3c1138a7188d6f23c0aa907102729e6ae278b81f
[ "MIT" ]
2
2021-07-31T17:45:05.000Z
2021-08-16T09:19:31.000Z
disco/analysis/src/windows.rs
romnn/wasm-audio-effect-rack
3c1138a7188d6f23c0aa907102729e6ae278b81f
[ "MIT" ]
null
null
null
disco/analysis/src/windows.rs
romnn/wasm-audio-effect-rack
3c1138a7188d6f23c0aa907102729e6ae278b81f
[ "MIT" ]
null
null
null
use ndarray::prelude::*; use num::{traits::FloatConst, Float}; use std::ops::Mul; #[derive(Debug)] pub struct Window<T> { pub length: usize, pub window: Array1<T>, } impl<T> Window<T> where T: Float, { pub fn apply(&self, samples: &mut Array1<T>) { *samples = samples.to_owned().mul(&self.window); } } pub trait HannWindow<T> { fn hann(length: usize) -> Self; } impl<T> HannWindow<T> for Window<T> where T: Float + FloatConst, { fn hann(length: usize) -> Self { let mut window = Array::zeros(length); for (idx, value) in window.indexed_iter_mut() { let two_pi_i = T::from(2.0).unwrap() * T::PI() * T::from(idx).unwrap(); let multiplier = (two_pi_i / T::from(length).unwrap()).cos(); let multiplier = T::one() - multiplier; let multiplier = T::from(0.5).unwrap() * multiplier; *value = multiplier; } // let samples_len_f32 = samples.len() as f32; // for i in 0..samples.len() { // let two_pi_i = 2.0 * PI * i as f32; // let idontknowthename = cosf(two_pi_i / samples_len_f32); // let multiplier = 0.5 * (1.0 - idontknowthename); // windowed_samples.push(multiplier * samples[i]) // } Self { length, window } } } pub trait HammingWindow<T> { fn hamming(length: usize) -> Self; } impl<T> HammingWindow<T> for Window<T> where T: Float + FloatConst, { fn hamming(length: usize) -> Self { let mut window = Array::zeros(length); for (idx, value) in window.indexed_iter_mut() { let two_pi_i = T::from(2.0).unwrap() * T::PI() * T::from(idx).unwrap(); let multiplier = (two_pi_i / (T::from(length - 1).unwrap())).cos(); let multiplier = T::from(0.46).unwrap() * multiplier; let multiplier = T::from(0.54).unwrap() - multiplier; *value = multiplier; } // let samples_len_f32 = samples.len() as f32; // for i in 0..samples.len() { // let multiplier = 0.54 - (0.46 * (2.0 * PI * i as f32 / cosf(samples_len_f32 - 1.0))); // windowed_samples.push(multiplier * samples[i]) // } Self { length, window } } }
30.972603
100
0.551084
75c2111572e751b3a07a4f98889768e0d9758f5e
128
sql
SQL
aws-test/tests/aws_rds_db_event_subscription/test-list-query.sql
blinkops/blink-aws-query
21b0d5eee6b0b5554c040867b9e25681e7ba6559
[ "Apache-2.0" ]
61
2021-01-21T19:06:48.000Z
2022-03-28T20:09:46.000Z
aws-test/tests/aws_rds_db_event_subscription/test-list-query.sql
blinkops/blink-aws-query
21b0d5eee6b0b5554c040867b9e25681e7ba6559
[ "Apache-2.0" ]
592
2021-01-23T05:27:12.000Z
2022-03-31T14:16:19.000Z
aws-test/tests/aws_rds_db_event_subscription/test-list-query.sql
blinkops/blink-aws-query
21b0d5eee6b0b5554c040867b9e25681e7ba6559
[ "Apache-2.0" ]
30
2021-01-21T18:43:25.000Z
2022-03-12T15:14:05.000Z
select cust_subscription_id, arn, enabled from aws.aws_rds_db_event_subscription where arn = '{{ output.resource_aka.value }}';
32
46
0.804688
4988ad8ab6b516d7ed6a075bdcec3196c888a924
342
htm
HTML
plugins/rainlab/builder/widgets/defaultcontroldesigntimeprovider/partials/_control-fileupload.htm
bsxproduction/edomedo-hero
23534a6bbb694f15a51619e3ce616d52c7200d3b
[ "MIT" ]
176
2016-02-10T06:02:09.000Z
2022-03-24T19:05:26.000Z
plugins/rainlab/builder/widgets/defaultcontroldesigntimeprovider/partials/_control-fileupload.htm
bsxproduction/edomedo-hero
23534a6bbb694f15a51619e3ce616d52c7200d3b
[ "MIT" ]
336
2016-02-10T15:39:51.000Z
2022-03-25T10:07:52.000Z
plugins/rainlab/builder/widgets/defaultcontroldesigntimeprovider/partials/_control-fileupload.htm
bsxproduction/edomedo-hero
23534a6bbb694f15a51619e3ce616d52c7200d3b
[ "MIT" ]
115
2016-02-10T14:43:41.000Z
2022-03-11T01:46:25.000Z
<div class="builder-blueprint-control-text fileupload <?= $this->getPropertyValue($properties, 'mode') == 'image' ? 'image' : null ?>"> <i class="icon-upload"></i> <?php if ($this->getPropertyValue($properties, 'mode') != 'image'): ?> <?= e(trans('rainlab.builder::lang.form.control_fileupload')) ?> <?php endif ?> </div>
57
135
0.616959
93b6442162902437c61ace3182ef10b2fed2d218
1,069
html
HTML
manuscript/page-34/body.html
marvindanig/discours-de-la-methode
f7213ab8a001014e7c9acd3709b02d3d6e755798
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
manuscript/page-34/body.html
marvindanig/discours-de-la-methode
f7213ab8a001014e7c9acd3709b02d3d6e755798
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
manuscript/page-34/body.html
marvindanig/discours-de-la-methode
f7213ab8a001014e7c9acd3709b02d3d6e755798
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
<div class="leaf "><div class="inner justify"><p class="no-indent stretch-last-line ">same I thought was true of any similar project for reforming the body of the sciences, or the order of teaching them established in the schools: but as for the opinions which up to that time I had embraced, I thought that I could not do better than resolve at once to sweep them wholly away, that I might afterwards be in a position to admit either others more correct, or even perhaps the same when they had undergone the scrutiny of reason. I firmly believed that in this way I should much better succeed in the conduct of my life, than if I built only upon old foundations, and leaned upon principles which, in my youth, I had taken upon trust. For although I recognized various difficulties in this undertaking, these were not, however, without remedy, nor once to be compared with such as attend the slightest reformation in public affairs. Large bodies, if once overthrown, are with great difficulty set up again, or even kept erect when once seriously shaken,</p></div> </div>
1,069
1,069
0.788587
46c90547d4348a2152b8a1bebec3663853039d2f
2,072
swift
Swift
Sources/SwiftTalkServerLib/Run.swift
objcio/swift-talk-backend
4c8a67e7fecaa15d8f4a303abfa7dae978ca4e30
[ "MIT" ]
297
2019-02-12T17:26:18.000Z
2021-11-15T18:09:19.000Z
Sources/SwiftTalkServerLib/Run.swift
objcio/swift-talk-backend
4c8a67e7fecaa15d8f4a303abfa7dae978ca4e30
[ "MIT" ]
26
2019-02-12T18:15:13.000Z
2020-12-14T08:13:00.000Z
Sources/SwiftTalkServerLib/Run.swift
objcio/swift-talk-backend
4c8a67e7fecaa15d8f4a303abfa7dae978ca4e30
[ "MIT" ]
18
2019-02-12T20:18:30.000Z
2021-10-10T18:27:15.000Z
import Foundation import NIOWrapper import Database import WebServer import Base public func run() throws { try runMigrations() refreshStaticData() let timer = scheduleTaskTimer() let currentDir = URL(fileURLWithPath: FileManager.default.currentDirectoryPath) let resourcePaths = [currentDir.appendingPathComponent(assetsPath), currentDir.appendingPathComponent("node_modules")] let server = Server(resourcePaths: resourcePaths) { request in guard let route = Route(request) else { return nil } let conn = postgres.lazyConnection() func buildSession() -> Session? { guard let sId = request.sessionId else { return nil } do { let user = try conn.get().execute(Row<UserData>.select(sessionId: sId)) return try user.map { u in if u.data.premiumAccess { return Session(sessionId: sId, user: u, teamManager: nil, gifter: nil) } else { let teamMember = try conn.get().execute(u.teamMember) let teamManager = try teamMember.flatMap { try conn.get().execute(Row<UserData>.select($0.data.userId)) } let gifter: Row<UserData>? = try conn.get().execute(u.gifter) return Session(sessionId: sId, user: u, teamManager: teamManager, gifter: gifter) } } } catch { return nil } } let env = STRequestEnvironment(route: route, hashedAssetName: assets.hashedName, buildSession: buildSession, connection: conn, resourcePaths: resourcePaths) let reader: Reader<STRequestEnvironment, NIOInterpreter> = try! route.interpret() return reader.run(env) } try server.listen(port: env.port ?? 8765) } extension Request { fileprivate var sessionId: UUID? { let sessionString = cookies.first { $0.0 == "sessionid" }?.1 return sessionString.flatMap { UUID(uuidString: $0) } } }
39.846154
164
0.608591
e9e15975d1e615a78d9d366de9226f562bc355bc
3,134
sql
SQL
spring-boot/spring-boot-intro/doc/sql/edu_account.sql
langyastudio/blog
09a748c8f7dd269872153349e56332a71ba3dbd5
[ "Apache-2.0" ]
null
null
null
spring-boot/spring-boot-intro/doc/sql/edu_account.sql
langyastudio/blog
09a748c8f7dd269872153349e56332a71ba3dbd5
[ "Apache-2.0" ]
null
null
null
spring-boot/spring-boot-intro/doc/sql/edu_account.sql
langyastudio/blog
09a748c8f7dd269872153349e56332a71ba3dbd5
[ "Apache-2.0" ]
2
2021-09-29T03:29:49.000Z
2022-03-24T08:43:01.000Z
/*==============================================================*/ /* Database: edu_account */ /*==============================================================*/ create database edu_account; use edu_account; /*==============================================================*/ /* Table: ums_user */ /*==============================================================*/ create table ums_user ( id int unsigned not null auto_increment, user_name varchar(20) not null comment '用户名', nick_name varchar(20) not null default '' comment '昵称', full_name varchar(20) not null default '' comment '姓名', sex tinyint not null default 0 comment '性别', avator varchar(255) not null default '' comment '用户头像', pcd_id int not null default 0 comment '行政区划代码', company varchar(128) not null default '' comment '联系地址', birthday date not null default '1970-01-01' comment '生日', description varchar(128) not null default '' comment '描述信息', reg_ip int unsigned not null default 0 comment '注册IP', user_type tinyint not null default 1 comment '用户类型(1 账户、2 设备账户)', update_time datetime not null comment '更新时间', delete_time datetime default NULL comment '删除时间', create_time datetime not null comment '创建时间', primary key (id) ) auto_increment = 1000 engine = InnoDB default charset = utf8 collate = utf8_general_ci; alter table ums_user comment '用户信息表'; /*==============================================================*/ /* Table: ums_user_auth */ /*==============================================================*/ create table ums_user_auth ( id int unsigned not null auto_increment, user_name varchar(20) not null comment '用户名', pwd varchar(64) not null comment '密码', phone char(15) not null default '' comment '手机号码', email varchar(32) not null default '' comment '邮箱', enabled tinyint not null default 1 comment '状态', locked tinyint not null default 2 comment '锁', update_time datetime not null comment '更新时间', delete_time datetime default NULL comment '删除时间', create_time datetime not null comment '创建时间', primary key (id) ) auto_increment = 1000 engine = InnoDB default charset = utf8 collate = utf8_general_ci; alter table ums_user_auth comment '本地授权信息表'; INSERT INTO `ums_user` VALUES ('1000', 'admin', '超级管理员', '超级管理员', '3', '', '0', '', '1970-01-01', '', '3232267108', '1', NOW(), NULL, NOW()); INSERT INTO `ums_user_auth` VALUES ('1000', 'admin', '$2a$10$HKtKiX/7zrX9kZvzqtBDL.Yc2HtILtNu11Pd3bQDKtdmcjWpnOIay', '', '', '1', '2', NOW(), NULL, NOW());
35.613636
79
0.479579
57d481fce24ba68ef233e8df3657661c71a7bb80
151
kt
Kotlin
app/src/main/java/com/jrk/mood4food/model/api/entity/Ingredient.kt
JanPfenning/Mood4Food
08864088d22b321defd659a2aed3511feff361e2
[ "MIT" ]
null
null
null
app/src/main/java/com/jrk/mood4food/model/api/entity/Ingredient.kt
JanPfenning/Mood4Food
08864088d22b321defd659a2aed3511feff361e2
[ "MIT" ]
15
2020-10-30T07:27:36.000Z
2021-06-11T17:14:42.000Z
app/src/main/java/com/jrk/mood4food/model/api/entity/Ingredient.kt
JanPfenning/Mood4Food
08864088d22b321defd659a2aed3511feff361e2
[ "MIT" ]
1
2021-05-22T18:29:35.000Z
2021-05-22T18:29:35.000Z
package com.jrk.mood4food.model.api.entity class Ingredient { var ingredientId = -1 var name = "" var recipeId = 0 var amount = "" }
15.1
42
0.629139
641f9581d4942110b6e2e46e172e772536cd77cb
3,511
rs
Rust
src/day18.rs
PowerSnail/aoc_2020
2d20ec5471bdd5be788a6ae1ab405b5d776fac43
[ "MIT" ]
null
null
null
src/day18.rs
PowerSnail/aoc_2020
2d20ec5471bdd5be788a6ae1ab405b5d776fac43
[ "MIT" ]
null
null
null
src/day18.rs
PowerSnail/aoc_2020
2d20ec5471bdd5be788a6ae1ab405b5d776fac43
[ "MIT" ]
null
null
null
// Copyright (c) 2020 PowerSnail // // This software is released under the MIT License. // https://opensource.org/licenses/MIT use crate::util::lines; #[derive(Debug, Clone, Copy, PartialEq)] enum Token { LeftBracket, RightBracket, Add, Multiply, Number(i64), } fn tokenize(line: &str) -> Vec<Token> { line.chars() .filter_map(|c| match c { ' ' => None, '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' => { Some(Token::Number((c as u8 - '0' as u8) as i64)) } '+' => Some(Token::Add), '*' => Some(Token::Multiply), '(' => Some(Token::LeftBracket), ')' => Some(Token::RightBracket), _ => unreachable!(), }) .collect() } fn eval_expr_easy(tokens: &[Token], i: usize) -> (usize, i64) { let (i, lhs) = match tokens[i] { Token::Number(n) => (i + 1, n), Token::LeftBracket => eval_expr_easy(tokens, i + 1), _ => panic!(format!("Malformed; got {:?} at left hand side", tokens[i])), }; if i == tokens.len() { return (i, lhs); } match tokens[i] { Token::Add => { let (i, rhs) = eval_expr_easy(tokens, i + 1); (i, lhs + rhs) } Token::Multiply => { let (i, rhs) = eval_expr_easy(tokens, i + 1); (i, lhs * rhs) } Token::RightBracket => (i + 1, lhs), _ => panic!(format!( "Malformed; got {:?} after left hand side", tokens[i] )), } } pub fn part1() -> Option<i64> { Some( lines() .iter() .map(|s| { // Reverse the string, because I'm too lazy to implement left associativity s.chars() .rev() .map(|c| match c { '(' => ')', ')' => '(', _ => c, }) .collect::<String>() }) .map(|s| tokenize(&s)) .map(|tokens| eval_expr_easy(&tokens, 0).1) .sum(), ) } // | -------------- Part 2 ---------------| // Expr := Expr2 (* Expr2)* // Expr2 := Element (+ Element)* // Element := Number | ( Expr ) fn eval_element(tokens: &[Token], i: usize) -> (usize, i64) { match tokens[i] { Token::Number(n) => (i + 1, n), Token::LeftBracket => { let (i, val) = eval_expr(tokens, i + 1); match tokens[i] { Token::RightBracket => (i + 1, val), _ => panic!("Parser Error"), } } _ => panic!("Parser Error"), } } fn eval_expr2(tokens: &[Token], i: usize) -> (usize, i64) { let (mut i, mut left) = eval_element(tokens, i); while i < tokens.len() && tokens[i] == Token::Add { let next_group = eval_element(tokens, i + 1); i = next_group.0; left += next_group.1; } (i, left) } fn eval_expr(tokens: &[Token], i: usize) -> (usize, i64) { let (mut i, mut left) = eval_expr2(tokens, i); while i < tokens.len() && tokens[i] == Token::Multiply { let next_group = eval_expr2(tokens, i + 1); i = next_group.0; left *= next_group.1; } (i, left) } pub fn part2() -> Option<i64> { Some( lines() .iter() .map(|s| tokenize(s)) .map(|tokens| eval_expr(&tokens, 0).1) .sum(), ) }
26.598485
91
0.438621
f73f87bdcbccc3a85673b7cf810569d7ba2b3142
684
h
C
PrivateFrameworks/VideoProcessing.framework/VCPVideoFCRFaceDetector.h
shaojiankui/iOS10-Runtime-Headers
6b0d842bed0c52c2a7c1464087b3081af7e10c43
[ "MIT" ]
36
2016-04-20T04:19:04.000Z
2018-10-08T04:12:25.000Z
PrivateFrameworks/VideoProcessing.framework/VCPVideoFCRFaceDetector.h
shaojiankui/iOS10-Runtime-Headers
6b0d842bed0c52c2a7c1464087b3081af7e10c43
[ "MIT" ]
null
null
null
PrivateFrameworks/VideoProcessing.framework/VCPVideoFCRFaceDetector.h
shaojiankui/iOS10-Runtime-Headers
6b0d842bed0c52c2a7c1464087b3081af7e10c43
[ "MIT" ]
10
2016-06-16T02:40:44.000Z
2019-01-15T03:31:45.000Z
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/VideoProcessing.framework/VideoProcessing */ @interface VCPVideoFCRFaceDetector : VCPVideoFaceDetector { FCRFaceDetector * _faceDetector; } + (struct CGAffineTransform { double x1; double x2; double x3; double x4; double x5; double x6; })flipTransform:(struct CGAffineTransform { double x1; double x2; double x3; double x4; double x5; double x6; })arg1; - (void).cxx_destruct; - (int)detectFaces:(struct __CVBuffer { }*)arg1 faces:(id)arg2; - (id)initWithTransform:(struct CGAffineTransform { double x1; double x2; double x3; double x4; double x5; double x6; })arg1 cancel:(id /* block */)arg2; @end
42.75
213
0.75
fba000efa9d40c38baca8ca92429500911f24027
4,508
h
C
include/Graphics/Camera.h
MrFrenik/Enjon
405733f1b8d05c65bc6b4f4c779d3c6845a8c12b
[ "BSD-3-Clause" ]
121
2019-05-02T01:22:17.000Z
2022-03-19T00:16:14.000Z
include/Graphics/Camera.h
MrFrenik/Enjon
405733f1b8d05c65bc6b4f4c779d3c6845a8c12b
[ "BSD-3-Clause" ]
42
2019-08-17T20:33:43.000Z
2019-09-25T14:28:50.000Z
include/Graphics/Camera.h
MrFrenik/Enjon
405733f1b8d05c65bc6b4f4c779d3c6845a8c12b
[ "BSD-3-Clause" ]
20
2019-05-02T01:22:20.000Z
2022-01-30T04:04:57.000Z
#ifndef ENJON_CAMERA_H #define ENJON_CAMERA_H #include <Base/Object.h> #include <Defines.h> #include <System/Types.h> #include <Math/Transform.h> #include <Math/Vec3.h> #include <Math/Vec2.h> #include <Math/Mat4.h> #include <Math/Ray.h> namespace Enjon { // TODO(): Move as many functions from this file to the source file class GraphicsScene; ENJON_ENUM( ) enum class ProjectionType { Perspective, Orthographic }; ENJON_CLASS( ) class Camera : public Enjon::Object { ENJON_CLASS_BODY( Camera ) public: /* * @brief Constructor */ virtual void ExplicitConstructor( ) override; /* * @brief Constructor */ Camera(const u32& width, const u32& height); /* * @brief Constructor */ Camera(const iVec2& dimensions); /* * @brief Copy Constructor */ Camera(const Camera& Other); /* * @brief */ void LookAt(const Vec3& Position, const Vec3& Up = Vec3(0, 1, 0)); /* * @brief */ void OffsetOrientation(const f32& Yaw, const f32& Pitch); /* * @brief */ Vec3 Forward() const; /* * @brief */ Vec3 Backward() const; /* * @brief */ Vec3 Right() const; /* * @brief */ Vec3 Left() const; /* * @brief */ Vec3 Up() const; /* * @brief */ Vec3 Down() const; /* * @brief */ Mat4x4 GetViewProjectionMatrix() const; /* * @brief */ Mat4x4 GetViewProjection() const; /* * @brief */ Mat4x4 GetProjection() const; /* * @brief */ Mat4x4 GetPerspectiveProjection( ) const; /* * @brief */ Mat4x4 GetView() const; /* * @brief */ inline Vec2 GetNearFar() const { return Vec2( mNearPlane, mFarPlane ); } /* * @brief */ inline f32 GetNear() const { return mNearPlane; } /* * @brief */ inline f32 GetFar() const { return mFarPlane; } /* * @brief */ const ProjectionType GetProjectionType( ) const { return mProjType; } /* * @brief */ f32 GetOrthographicScale( ) const { return mOrthographicScale; } /* * @brief */ f32 GetAspectRatio( ) const { return mViewPortAspectRatio; } /* * @brief */ inline void SetAspectRatio( const f32& aspectRatio ) { mViewPortAspectRatio = aspectRatio; } /* * @brief */ inline void SetNearFar(const f32& n, const f32& f) { mNearPlane = n; mFarPlane = f; } inline void SetFar( const f32& f ) { mFarPlane = f; } inline void SetNear( const f32& n ) { mNearPlane = n; } /* * @brief */ inline void SetProjection(ProjectionType type) { mProjType = type; } /* * @brief */ inline void SetOrthographicScale(const f32& scale) { mOrthographicScale = scale; } /* * @brief */ void SetProjectionType( ProjectionType type ) { mProjType = type; } Transform GetTransform() const { return mTransform; } /* * @brief */ Vec3 TransformPoint( const Vec3& point ) const; /* * @brief */ void SetTransform( const Transform& transform ); /* * @brief */ void SetPosition(const Vec3& position); /* * @brief */ Vec3 GetPosition() const { return mTransform.GetPosition(); } /* * @brief */ void SetRotation( const Vec3& eulerAngles ); /* * @brief */ void SetRotation( const Quaternion& q ); /* * @brief */ Quaternion GetRotation() const { return mTransform.GetRotation(); } /* * @brief */ Ray ScreenToWorldRay( const f32& x, const f32& y ); /* * @brief */ Ray ScreenToWorldRay( const Vec2& coords ); /* * @brief */ void SetGraphicsScene( GraphicsScene* scene ); /* * @brief */ GraphicsScene* GetGraphicsScene( ) const; /* * @brief */ Vec3 Unproject( const Vec3& screenCoords ); private: // Member variables ENJON_PROPERTY() Transform mTransform; ENJON_PROPERTY() f32 mFOV = 60.0f; ENJON_PROPERTY() f32 mNearPlane = 0.1f; ENJON_PROPERTY() f32 mFarPlane = 1000.0f; ENJON_PROPERTY() f32 mViewPortAspectRatio; ENJON_PROPERTY() f32 mOrthographicScale = 1.0f; ENJON_PROPERTY() ProjectionType mProjType = ProjectionType::Perspective; Vec2 mScreenDimensions; private: GraphicsScene* mGraphicsScene = nullptr; }; } #endif
14.0875
69
0.567657
c7b5f80555226993c8b9dc47d149c1f007b20e7f
689
py
Python
setup.py
moevm/gui-1h2018-34
c85d653fae407f13559bd2c06b5da44e5140a6a5
[ "MIT" ]
null
null
null
setup.py
moevm/gui-1h2018-34
c85d653fae407f13559bd2c06b5da44e5140a6a5
[ "MIT" ]
null
null
null
setup.py
moevm/gui-1h2018-34
c85d653fae407f13559bd2c06b5da44e5140a6a5
[ "MIT" ]
null
null
null
from setuptools import setup, find_packages setup( name='guess_the_movie', packages=find_packages('src'), package_dir={'': 'src'}, version='0.9', license='MIT', install_requires=[ 'pyqt5', ], description='Game guess the movie by screenshot', author='Alexey', author_email='bagar0x60@gmail.com', url='https://github.com/moevm/gui-1h2018-34', # use the URL to the github repo package_data={ # And include any *.msg files found in the 'hello' package, too: 'guess_the_movie': ['data/*'], }, entry_points={ 'console_scripts': [ 'guess-the-movie=guess_the_movie.main:main', ], }, )
27.56
82
0.606676
740d18951dcb7cceb8497f7ba998404bf7be237c
21,022
c
C
source/blender/editors/mesh/mesh_navmesh.c
1-MillionParanoidTterabytes/Blender-2.79b-blackened
e8d767324e69015aa66850d13bee7db1dc7d084b
[ "Unlicense" ]
2
2018-06-18T01:50:25.000Z
2018-06-18T01:50:32.000Z
source/blender/editors/mesh/mesh_navmesh.c
1-MillionParanoidTterabytes/Blender-2.79b-blackened
e8d767324e69015aa66850d13bee7db1dc7d084b
[ "Unlicense" ]
null
null
null
source/blender/editors/mesh/mesh_navmesh.c
1-MillionParanoidTterabytes/Blender-2.79b-blackened
e8d767324e69015aa66850d13bee7db1dc7d084b
[ "Unlicense" ]
null
null
null
/* * ***** BEGIN GPL LICENSE BLOCK ***** * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * The Original Code is Copyright (C) 2011 by Blender Foundation * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): Benoit Bolsee, * Nick Samarin * * ***** END GPL LICENSE BLOCK ***** */ /** \file blender/editors/mesh/mesh_navmesh.c * \ingroup edmesh */ #include "MEM_guardedalloc.h" #include "DNA_scene_types.h" #include "DNA_object_types.h" #include "DNA_mesh_types.h" #include "BLI_listbase.h" #include "BLI_math_vector.h" #include "BLI_linklist.h" #include "BKE_library.h" #include "BKE_depsgraph.h" #include "BKE_context.h" #include "BKE_mesh.h" #include "BKE_scene.h" #include "BKE_DerivedMesh.h" #include "BKE_report.h" #include "BKE_editmesh.h" #include "ED_object.h" #include "ED_mesh.h" #include "ED_screen.h" #include "WM_api.h" #include "WM_types.h" #include "recast-capi.h" #include "mesh_intern.h" /* own include */ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float **verts_r, int *ntris_r, int **tris_r, unsigned int *r_lay) { MVert *mvert; int nfaces = 0, *tri, i, curnverts, basenverts, curnfaces; MFace *mface; float co[3], wco[3]; Object *ob; LinkNode *oblink, *dmlink; DerivedMesh *dm; Scene *scene = CTX_data_scene(C); LinkNodePair dms_pair = {NULL,NULL}; int nverts, ntris, *tris; float *verts; nverts = 0; ntris = 0; /* calculate number of verts and tris */ for (oblink = obs; oblink; oblink = oblink->next) { ob = (Object *) oblink->link; dm = mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH); DM_ensure_tessface(dm); BLI_linklist_append(&dms_pair, dm); nverts += dm->getNumVerts(dm); nfaces = dm->getNumTessFaces(dm); ntris += nfaces; /* resolve quad faces */ mface = dm->getTessFaceArray(dm); for (i = 0; i < nfaces; i++) { MFace *mf = &mface[i]; if (mf->v4) ntris += 1; } *r_lay |= ob->lay; } LinkNode *dms = dms_pair.list; /* create data */ verts = MEM_mallocN(sizeof(float) * 3 * nverts, "createVertsTrisData verts"); tris = MEM_mallocN(sizeof(int) * 3 * ntris, "createVertsTrisData faces"); basenverts = 0; tri = tris; for (oblink = obs, dmlink = dms; oblink && dmlink; oblink = oblink->next, dmlink = dmlink->next) { ob = (Object *) oblink->link; dm = (DerivedMesh *) dmlink->link; curnverts = dm->getNumVerts(dm); mvert = dm->getVertArray(dm); /* copy verts */ for (i = 0; i < curnverts; i++) { MVert *v = &mvert[i]; copy_v3_v3(co, v->co); mul_v3_m4v3(wco, ob->obmat, co); verts[3 * (basenverts + i) + 0] = wco[0]; verts[3 * (basenverts + i) + 1] = wco[2]; verts[3 * (basenverts + i) + 2] = wco[1]; } /* create tris */ curnfaces = dm->getNumTessFaces(dm); mface = dm->getTessFaceArray(dm); for (i = 0; i < curnfaces; i++) { MFace *mf = &mface[i]; tri[0] = basenverts + mf->v1; tri[1] = basenverts + mf->v3; tri[2] = basenverts + mf->v2; tri += 3; if (mf->v4) { tri[0] = basenverts + mf->v1; tri[1] = basenverts + mf->v4; tri[2] = basenverts + mf->v3; tri += 3; } } basenverts += curnverts; } /* release derived mesh */ for (dmlink = dms; dmlink; dmlink = dmlink->next) { dm = (DerivedMesh *) dmlink->link; dm->release(dm); } BLI_linklist_free(dms, NULL); *nverts_r = nverts; *verts_r = verts; *ntris_r = ntris; *tris_r = tris; } static bool buildNavMesh(const RecastData *recastParams, int nverts, float *verts, int ntris, int *tris, struct recast_polyMesh **pmesh, struct recast_polyMeshDetail **dmesh, ReportList *reports) { float bmin[3], bmax[3]; struct recast_heightfield *solid; unsigned char *triflags; struct recast_compactHeightfield *chf; struct recast_contourSet *cset; int width, height, walkableHeight, walkableClimb, walkableRadius; int minRegionArea, mergeRegionArea, maxEdgeLen; float detailSampleDist, detailSampleMaxError; recast_calcBounds(verts, nverts, bmin, bmax); /* ** Step 1. Initialize build config ** */ walkableHeight = (int)ceilf(recastParams->agentheight / recastParams->cellheight); walkableClimb = (int)floorf(recastParams->agentmaxclimb / recastParams->cellheight); walkableRadius = (int)ceilf(recastParams->agentradius / recastParams->cellsize); minRegionArea = (int)(recastParams->regionminsize * recastParams->regionminsize); mergeRegionArea = (int)(recastParams->regionmergesize * recastParams->regionmergesize); maxEdgeLen = (int)(recastParams->edgemaxlen / recastParams->cellsize); detailSampleDist = recastParams->detailsampledist < 0.9f ? 0 : recastParams->cellsize * recastParams->detailsampledist; detailSampleMaxError = recastParams->cellheight * recastParams->detailsamplemaxerror; /* Set the area where the navigation will be build. */ recast_calcGridSize(bmin, bmax, recastParams->cellsize, &width, &height); /* zero dimensions cause zero alloc later on [#33758] */ if (width <= 0 || height <= 0) { BKE_report(reports, RPT_ERROR, "Object has a width or height of zero"); return false; } /* ** Step 2: Rasterize input polygon soup ** */ /* Allocate voxel heightfield where we rasterize our input data to */ solid = recast_newHeightfield(); if (!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) { recast_destroyHeightfield(solid); BKE_report(reports, RPT_ERROR, "Failed to create height field"); return false; } /* Allocate array that can hold triangle flags */ triflags = MEM_callocN(sizeof(unsigned char) * ntris, "buildNavMesh triflags"); /* Find triangles which are walkable based on their slope and rasterize them */ recast_markWalkableTriangles(RAD2DEGF(recastParams->agentmaxslope), verts, nverts, tris, ntris, triflags); recast_rasterizeTriangles(verts, nverts, tris, triflags, ntris, solid, 1); MEM_freeN(triflags); /* ** Step 3: Filter walkables surfaces ** */ recast_filterLowHangingWalkableObstacles(walkableClimb, solid); recast_filterLedgeSpans(walkableHeight, walkableClimb, solid); recast_filterWalkableLowHeightSpans(walkableHeight, solid); /* ** Step 4: Partition walkable surface to simple regions ** */ chf = recast_newCompactHeightfield(); if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) { recast_destroyHeightfield(solid); recast_destroyCompactHeightfield(chf); BKE_report(reports, RPT_ERROR, "Failed to create compact height field"); return false; } recast_destroyHeightfield(solid); solid = NULL; if (!recast_erodeWalkableArea(walkableRadius, chf)) { recast_destroyCompactHeightfield(chf); BKE_report(reports, RPT_ERROR, "Failed to erode walkable area"); return false; } if (recastParams->partitioning == RC_PARTITION_WATERSHED) { /* Prepare for region partitioning, by calculating distance field along the walkable surface */ if (!recast_buildDistanceField(chf)) { recast_destroyCompactHeightfield(chf); BKE_report(reports, RPT_ERROR, "Failed to build distance field"); return false; } /* Partition the walkable surface into simple regions without holes */ if (!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) { recast_destroyCompactHeightfield(chf); BKE_report(reports, RPT_ERROR, "Failed to build watershed regions"); return false; } } else if (recastParams->partitioning == RC_PARTITION_MONOTONE) { /* Partition the walkable surface into simple regions without holes */ /* Monotone partitioning does not need distancefield. */ if (!recast_buildRegionsMonotone(chf, 0, minRegionArea, mergeRegionArea)) { recast_destroyCompactHeightfield(chf); BKE_report(reports, RPT_ERROR, "Failed to build monotone regions"); return false; } } else { /* RC_PARTITION_LAYERS */ /* Partition the walkable surface into simple regions without holes */ if (!recast_buildLayerRegions(chf, 0, minRegionArea)) { recast_destroyCompactHeightfield(chf); BKE_report(reports, RPT_ERROR, "Failed to build layer regions"); return false; } } /* ** Step 5: Trace and simplify region contours ** */ /* Create contours */ cset = recast_newContourSet(); if (!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset, RECAST_CONTOUR_TESS_WALL_EDGES)) { recast_destroyCompactHeightfield(chf); recast_destroyContourSet(cset); BKE_report(reports, RPT_ERROR, "Failed to build contours"); return false; } /* ** Step 6: Build polygons mesh from contours ** */ *pmesh = recast_newPolyMesh(); if (!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) { recast_destroyCompactHeightfield(chf); recast_destroyContourSet(cset); recast_destroyPolyMesh(*pmesh); BKE_report(reports, RPT_ERROR, "Failed to build poly mesh"); return false; } /* ** Step 7: Create detail mesh which allows to access approximate height on each polygon ** */ *dmesh = recast_newPolyMeshDetail(); if (!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) { recast_destroyCompactHeightfield(chf); recast_destroyContourSet(cset); recast_destroyPolyMesh(*pmesh); recast_destroyPolyMeshDetail(*dmesh); BKE_report(reports, RPT_ERROR, "Failed to build poly mesh detail"); return false; } recast_destroyCompactHeightfield(chf); recast_destroyContourSet(cset); return true; } static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh, struct recast_polyMeshDetail *dmesh, Base *base, unsigned int lay) { float co[3], rot[3]; BMEditMesh *em; int i, j, k; unsigned short *v; int face[3]; Scene *scene = CTX_data_scene(C); Object *obedit; int createob = base == NULL; int nverts, nmeshes, nvp; unsigned short *verts, *polys; unsigned int *meshes; float bmin[3], cs, ch, *dverts; unsigned char *tris; zero_v3(co); zero_v3(rot); if (createob) { /* create new object */ obedit = ED_object_add_type(C, OB_MESH, "Navmesh", co, rot, false, lay); } else { obedit = base->object; BKE_scene_base_deselect_all(scene); BKE_scene_base_select(scene, base); copy_v3_v3(obedit->loc, co); copy_v3_v3(obedit->rot, rot); } ED_object_editmode_enter(C, EM_DO_UNDO | EM_IGNORE_LAYER); em = BKE_editmesh_from_object(obedit); if (!createob) { /* clear */ EDBM_mesh_clear(em); } /* create verts for polygon mesh */ verts = recast_polyMeshGetVerts(pmesh, &nverts); recast_polyMeshGetBoundbox(pmesh, bmin, NULL); recast_polyMeshGetCell(pmesh, &cs, &ch); for (i = 0; i < nverts; i++) { v = &verts[3 * i]; co[0] = bmin[0] + v[0] * cs; co[1] = bmin[1] + v[1] * ch; co[2] = bmin[2] + v[2] * cs; SWAP(float, co[1], co[2]); BM_vert_create(em->bm, co, NULL, BM_CREATE_NOP); } /* create custom data layer to save polygon idx */ CustomData_add_layer_named(&em->bm->pdata, CD_RECAST, CD_CALLOC, NULL, 0, "createRepresentation recastData"); CustomData_bmesh_init_pool(&em->bm->pdata, 0, BM_FACE); /* create verts and faces for detailed mesh */ meshes = recast_polyMeshDetailGetMeshes(dmesh, &nmeshes); polys = recast_polyMeshGetPolys(pmesh, NULL, &nvp); dverts = recast_polyMeshDetailGetVerts(dmesh, NULL); tris = recast_polyMeshDetailGetTris(dmesh, NULL); for (i = 0; i < nmeshes; i++) { int uniquevbase = em->bm->totvert; unsigned int vbase = meshes[4 * i + 0]; unsigned short ndv = meshes[4 * i + 1]; unsigned short tribase = meshes[4 * i + 2]; unsigned short trinum = meshes[4 * i + 3]; const unsigned short *p = &polys[i * nvp * 2]; int nv = 0; for (j = 0; j < nvp; ++j) { if (p[j] == 0xffff) break; nv++; } /* create unique verts */ for (j = nv; j < ndv; j++) { copy_v3_v3(co, &dverts[3 * (vbase + j)]); SWAP(float, co[1], co[2]); BM_vert_create(em->bm, co, NULL, BM_CREATE_NOP); } /* need to rebuild entirely because array size changes */ BM_mesh_elem_table_init(em->bm, BM_VERT); /* create faces */ for (j = 0; j < trinum; j++) { unsigned char *tri = &tris[4 * (tribase + j)]; BMFace *newFace; int *polygonIdx; for (k = 0; k < 3; k++) { if (tri[k] < nv) face[k] = p[tri[k]]; /* shared vertex */ else face[k] = uniquevbase + tri[k] - nv; /* unique vertex */ } newFace = BM_face_create_quad_tri(em->bm, BM_vert_at_index(em->bm, face[0]), BM_vert_at_index(em->bm, face[2]), BM_vert_at_index(em->bm, face[1]), NULL, NULL, BM_CREATE_NOP); /* set navigation polygon idx to the custom layer */ polygonIdx = (int *)CustomData_bmesh_get(&em->bm->pdata, newFace->head.data, CD_RECAST); *polygonIdx = i + 1; /* add 1 to avoid zero idx */ } } recast_destroyPolyMesh(pmesh); recast_destroyPolyMeshDetail(dmesh); DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); ED_object_editmode_exit(C, EM_FREEDATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obedit); if (createob) { obedit->gameflag &= ~OB_COLLISION; obedit->gameflag |= OB_NAVMESH; obedit->body_type = OB_BODY_TYPE_NAVMESH; } BKE_mesh_ensure_navmesh(obedit->data); return obedit; } static int navmesh_create_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); LinkNode *obs = NULL; Base *navmeshBase = NULL; CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases) { if (base->object->type == OB_MESH) { if (base->object->body_type == OB_BODY_TYPE_NAVMESH) { if (!navmeshBase || base == scene->basact) { navmeshBase = base; } } else { BLI_linklist_prepend(&obs, base->object); } } } CTX_DATA_END; if (obs) { struct recast_polyMesh *pmesh = NULL; struct recast_polyMeshDetail *dmesh = NULL; bool ok; unsigned int lay = 0; int nverts = 0, ntris = 0; int *tris = NULL; float *verts = NULL; createVertsTrisData(C, obs, &nverts, &verts, &ntris, &tris, &lay); BLI_linklist_free(obs, NULL); if ((ok = buildNavMesh(&scene->gm.recastData, nverts, verts, ntris, tris, &pmesh, &dmesh, op->reports))) { createRepresentation(C, pmesh, dmesh, navmeshBase, lay); } MEM_freeN(verts); MEM_freeN(tris); return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } else { BKE_report(op->reports, RPT_ERROR, "No mesh objects found"); return OPERATOR_CANCELLED; } } void MESH_OT_navmesh_make(wmOperatorType *ot) { /* identifiers */ ot->name = "Create Navigation Mesh"; ot->description = "Create navigation mesh for selected objects"; ot->idname = "MESH_OT_navmesh_make"; /* api callbacks */ ot->exec = navmesh_create_exec; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int navmesh_face_copy_exec(bContext *C, wmOperator *op) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); /* do work here */ BMFace *efa_act = BM_mesh_active_face_get(em->bm, false, false); if (efa_act) { if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) { BMFace *efa; BMIter iter; int targetPolyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, efa_act->head.data, CD_RECAST); targetPolyIdx = targetPolyIdx >= 0 ? targetPolyIdx : -targetPolyIdx; if (targetPolyIdx > 0) { /* set target poly idx to other selected faces */ BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) { int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_RECAST); *recastDataBlock = targetPolyIdx; } } } else { BKE_report(op->reports, RPT_ERROR, "Active face has no index set"); } } } DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); return OPERATOR_FINISHED; } void MESH_OT_navmesh_face_copy(struct wmOperatorType *ot) { /* identifiers */ ot->name = "NavMesh Copy Face Index"; ot->description = "Copy the index from the active face"; ot->idname = "MESH_OT_navmesh_face_copy"; /* api callbacks */ ot->poll = ED_operator_editmesh; ot->exec = navmesh_face_copy_exec; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int compare(const void *a, const void *b) { return (*(int *)a - *(int *)b); } static int findFreeNavPolyIndex(BMEditMesh *em) { /* construct vector of indices */ int numfaces = em->bm->totface; int *indices = MEM_callocN(sizeof(int) * numfaces, "findFreeNavPolyIndex(indices)"); BMFace *ef; BMIter iter; int i, idx = em->bm->totface - 1, freeIdx = 1; /*XXX this originally went last to first, but that isn't possible anymore*/ BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) { int polyIdx = *(int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST); indices[idx] = polyIdx; idx--; } qsort(indices, numfaces, sizeof(int), compare); /* search first free index */ freeIdx = 1; for (i = 0; i < numfaces; i++) { if (indices[i] == freeIdx) freeIdx++; else if (indices[i] > freeIdx) break; } MEM_freeN(indices); return freeIdx; } static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op)) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); BMFace *ef; BMIter iter; if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) { int targetPolyIdx = findFreeNavPolyIndex(em); if (targetPolyIdx > 0) { /* set target poly idx to selected faces */ /*XXX this originally went last to first, but that isn't possible anymore*/ BM_ITER_MESH (ef, &iter, em->bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(ef, BM_ELEM_SELECT)) { int *recastDataBlock = (int *)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST); *recastDataBlock = targetPolyIdx; } } } } DAG_id_tag_update((ID *)obedit->data, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); return OPERATOR_FINISHED; } void MESH_OT_navmesh_face_add(struct wmOperatorType *ot) { /* identifiers */ ot->name = "NavMesh New Face Index"; ot->description = "Add a new index and assign it to selected faces"; ot->idname = "MESH_OT_navmesh_face_add"; /* api callbacks */ ot->poll = ED_operator_editmesh; ot->exec = navmesh_face_add_exec; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int navmesh_obmode_data_poll(bContext *C) { Object *ob = ED_object_active_context(C); if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) { Mesh *me = ob->data; return CustomData_has_layer(&me->pdata, CD_RECAST); } return false; } static int navmesh_obmode_poll(bContext *C) { Object *ob = ED_object_active_context(C); if (ob && (ob->mode == OB_MODE_OBJECT) && (ob->type == OB_MESH)) { return true; } return false; } static int navmesh_reset_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_object_active_context(C); Mesh *me = ob->data; CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly); BKE_mesh_ensure_navmesh(me); DAG_id_tag_update(&me->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id); return OPERATOR_FINISHED; } void MESH_OT_navmesh_reset(struct wmOperatorType *ot) { /* identifiers */ ot->name = "NavMesh Reset Index Values"; ot->description = "Assign a new index to every face"; ot->idname = "MESH_OT_navmesh_reset"; /* api callbacks */ ot->poll = navmesh_obmode_poll; ot->exec = navmesh_reset_exec; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int navmesh_clear_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = ED_object_active_context(C); Mesh *me = ob->data; CustomData_free_layers(&me->pdata, CD_RECAST, me->totpoly); DAG_id_tag_update(&me->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_GEOM | ND_DATA, &me->id); return OPERATOR_FINISHED; } void MESH_OT_navmesh_clear(struct wmOperatorType *ot) { /* identifiers */ ot->name = "NavMesh Clear Data"; ot->description = "Remove navmesh data from this mesh"; ot->idname = "MESH_OT_navmesh_clear"; /* api callbacks */ ot->poll = navmesh_obmode_data_poll; ot->exec = navmesh_clear_exec; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; }
28.6794
117
0.689754
7d2506fe790b8f961dcc6bec48e8df383748672d
495
swift
Swift
MVVMRxswift/MVVMRxswift/Classes/MVVM/Model/HotKeyListModel.swift
cellgit/MVVM-Rxswift
49d538fb7db1fbc24df5c585b22de821a67959b7
[ "MIT" ]
null
null
null
MVVMRxswift/MVVMRxswift/Classes/MVVM/Model/HotKeyListModel.swift
cellgit/MVVM-Rxswift
49d538fb7db1fbc24df5c585b22de821a67959b7
[ "MIT" ]
null
null
null
MVVMRxswift/MVVMRxswift/Classes/MVVM/Model/HotKeyListModel.swift
cellgit/MVVM-Rxswift
49d538fb7db1fbc24df5c585b22de821a67959b7
[ "MIT" ]
null
null
null
// // HotKeyListModel.swift // MVVMRxswift // // Created by 刘宏立 on 2020/7/29. // Copyright © 2020 刘宏立. All rights reserved. // import Foundation import ObjectMapper struct HotKeyListModel: Mappable { /// id var id: Int? /// 快捷键 var hotkey: String? /// 功能描述 var function: String? mutating func mapping(map: Map) { id <- map["id"] hotkey <- map["hotkey"] function <- map["function"] } init?(map: Map) {} init() {} }
16.5
46
0.559596
3f6cc8766dbe2202f4e8a7bcd1c3f7ccfbf15f9d
3,686
asm
Assembly
srcs/os/win32.asm
gamozolabs/falkervisor_beta
48e83a56badcf53dba94a5ab224eb37775a2f37d
[ "MIT" ]
69
2018-09-09T01:30:53.000Z
2021-07-27T18:56:39.000Z
srcs/os/win32.asm
gamozolabs/falkervisor_beta
48e83a56badcf53dba94a5ab224eb37775a2f37d
[ "MIT" ]
null
null
null
srcs/os/win32.asm
gamozolabs/falkervisor_beta
48e83a56badcf53dba94a5ab224eb37775a2f37d
[ "MIT" ]
15
2018-09-09T05:46:41.000Z
2022-02-16T01:46:38.000Z
[bits 64] struc modlist ; module is loaded at [base, end] .base: resq 1 .end: resq 1 .hash: resq 1 .namelen: resq 1 ; Name length in bytes .name: resb 512 ; utf16 name of module endstruc win32_construct_modlist: push rax push rbx push rcx push rdx push rdi push rsi push rbp ; If we have already initialized the modlist, do nothing cmp qword [gs:thread_local.modlist_count], 0 jne .end ; Deref teb->ProcessEnvironmentBlock mov rdx, [rax + VMCB.gs_base] add rdx, 0x60 call mm_read_guest_qword ; Deref peb->Ldr (struct _PEB_LDR_DATA) add rdx, 0x18 call mm_read_guest_qword ; Deref ldr->InLoadOrderLinks (struct _LDR_DATA_TABLE_ENTRY) add rdx, 0x10 ; Fetch the blink and store it, we stop iterating when we hit this push rdx add rdx, 8 call mm_read_guest_qword mov rbp, rdx pop rdx .for_each_module: ; Deref the _LDR_DATA_TABLE_ENTRY to move to the next entry. call mm_read_guest_qword ; Test if it's the end of the list test rdx, rdx jz .end cmp rdx, rbp je .end ; Allocate a new modlist entry mov rbx, modlist_size bamp_alloc rbx ; Lookup the base address push rdx add rdx, 0x30 call mm_read_guest_qword test rdx, rdx jz .for_each_module mov [rbx + modlist.base], rdx mov [rbx + modlist.end], rdx pop rdx ; Look up the image size push rdx add rdx, 0x40 call mm_read_guest_qword test rdx, rdx jz .for_each_module add qword [rbx + modlist.end], rdx dec qword [rbx + modlist.end] pop rdx ; Look up the image dll name size push rdx add rdx, 0x58 call mm_read_guest_qword and edx, 0xffff cmp edx, 512 ja .for_each_module mov [rbx + modlist.namelen], rdx pop rdx ; Fetch the image dll name push rdx add rdx, 0x60 call mm_read_guest_qword mov rsi, rdx lea rdi, [rbx + modlist.name] mov rcx, [rbx + modlist.namelen] call mm_copy_from_guest_vm_vmcb pop rdx ; Fetch the BaseNameHashValue push rdx add rdx, 0x108 call mm_read_guest_qword ; Since this value is a dword, shift it left by 32. We then use the bottom ; 32-bit (which are now zero) to add our relative offset to calculate our ; relative hash. shl rdx, 32 mov [rbx + modlist.hash], rdx pop rdx ; Add this new DLL to the modlist mov rdi, qword [gs:thread_local.modlist_count] mov rsi, qword [gs:thread_local.gs_base] lea rsi, [rsi + thread_local.modlist + rdi*8] mov qword [rsi], rbx inc qword [gs:thread_local.modlist_count] jmp .for_each_module .end: pop rbp pop rsi pop rdi pop rdx pop rcx pop rbx pop rax ret ; rbx -> RIP to resolve ; xmm5 <- Symhash to use win32_symhash: push rdi push rsi push rbp call win32_resolve_symbol test rbp, rbp jz short .trash mov rbp, qword [rbp + modlist.hash] pinsrq xmm5, rbp, 0 pinsrq xmm5, rbx, 1 aesenc xmm5, xmm5 aesenc xmm5, xmm5 aesenc xmm5, xmm5 aesenc xmm5, xmm5 jmp short .end .trash: xorps xmm5, xmm5 .end: pop rbp pop rsi pop rdi ret ; rbx -> RIP to resolve ; rbx <- Module offset or original RIP ; rbp <- Pointer to modlist entry. If this is zero, symbol could not be ; resolved and thus rbx is left unchanged. win32_resolve_symbol: push rcx push rdx cmp qword [gs:thread_local.modlist_count], 0 je short .end xor rcx, rcx mov rdx, qword [gs:thread_local.gs_base] lea rdx, [rdx + thread_local.modlist] .lewp: mov rbp, qword [rdx + rcx*8] cmp rbx, qword [rbp + modlist.base] jb short .next cmp rbx, qword [rbp + modlist.end] ja short .next ; We resolved the symbol! sub rbx, qword [rbp + modlist.base] jmp short .end_found .next: inc rcx cmp rcx, qword [gs:thread_local.modlist_count] jb short .lewp .end: xor rbp, rbp .end_found: pop rdx pop rcx ret
18.43
75
0.707813
927ca8aa26790d5eb9463347e96a81bfa0775b6a
5,624
kt
Kotlin
auto-api-java/src/test/java/com/highmobility/autoapi/property/PropertyComponentUnitTest.kt
highmobility/hm-java-autoapi
20ff8211c55f253ca8482fa0eede238f37bda879
[ "MIT" ]
2
2018-01-23T14:41:36.000Z
2019-06-24T08:38:10.000Z
auto-api-java/src/test/java/com/highmobility/autoapi/property/PropertyComponentUnitTest.kt
highmobility/hm-java-autoapi
20ff8211c55f253ca8482fa0eede238f37bda879
[ "MIT" ]
null
null
null
auto-api-java/src/test/java/com/highmobility/autoapi/property/PropertyComponentUnitTest.kt
highmobility/hm-java-autoapi
20ff8211c55f253ca8482fa0eede238f37bda879
[ "MIT" ]
null
null
null
/* * The MIT License * * Copyright (c) 2014- High-Mobility GmbH (https://high-mobility.com) * * 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 NONINFRINGEMENT. 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 com.highmobility.autoapi.property; import com.highmobility.autoapi.BaseTest import com.highmobility.autoapi.HonkHornFlashLights import com.highmobility.autoapi.value.Light import com.highmobility.autoapi.value.measurement.* import com.highmobility.value.Bytes import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import java.lang.String.format import java.lang.reflect.Constructor class PropertyComponentUnitTest : BaseTest() { @Test fun parsing() { // unit parsing/building: // 1: from incoming bytes val angleProp = Property(Angle::class.java, 0) val updateProperty = Property<Angle>(Bytes("01000D" + "01000A02003FEBA5E353F7CED9").byteArray) angleProp.update(updateProperty) val angleInRadians = angleProp.getValue()?.inRadians() val mathToRadians = Math.toRadians(.864) assertTrue(format("%.02f", angleInRadians) == format("%.02f", mathToRadians)) assertTrue(angleProp.getValue()?.unit == Angle.Unit.DEGREES); // property without unit is the same // 2) builder val builtAngle = Property<Angle>(Angle(0.864, Angle.Unit.DEGREES)) assertTrue(builtAngle.toString() == "00000D01000A02003FEBA5E353F7CED9"); // 3: in control commands // HonkHornFlashLights.HonkFlash command = new HonkHornFlashLights.HonkFlash(0, 3d); val command = HonkHornFlashLights.HonkFlash(null, Duration(0.864, Duration.Unit.SECONDS)) assertTrue(command.honkTime.getValue()?.value == 0.864); assertTrue(command.honkTime.getValue()?.unit == Duration.Unit.SECONDS); val bytes = Bytes(COMMAND_HEADER + "002601" + "05000D01000A07003FEBA5E353F7CED9"); assertTrue(command == bytes); } @Test fun testConversionLinearWithConstant() { val bytes = Bytes("17024012000000000000") val temp = Temperature(4.5, Temperature.Unit.FAHRENHEIT) assertTrue(format("%.02f", temp.inCelsius()) == "-15.28") assertTrue(temp == bytes) val generated = Temperature(bytes) assertTrue(generated.unit == Temperature.Unit.FAHRENHEIT) assertTrue(generated.value == 4.5) val celsiusTemp = Temperature(-15.28, Temperature.Unit.CELSIUS) val fahrenheit = format("%.01f", celsiusTemp.inFahrenheit()) assertTrue(fahrenheit == "4.5") } @Test fun testConversionLinear() { /*- data_component: '0001013feba5e353f7ced9' values: direction: 'longitudinal' acceleration: gravity: 0.864*/ val bytes = Bytes("01013feba5e353f7ced9") val acceleration = AccelerationUnit(0.864, AccelerationUnit.Unit.GRAVITY) assertTrue(format("%.02f", acceleration.inMetersPerSecondSquared()) == "8.48") assertTrue(acceleration == bytes) val unit = AccelerationUnit(bytes) assertTrue(unit.unit == AccelerationUnit.Unit.GRAVITY) assertTrue(unit.value == 0.864) val accelerationMs2 = AccelerationUnit(8.48, AccelerationUnit.Unit.METERS_PER_SECOND_SQUARED) assertTrue(format("%.02f", accelerationMs2.inGravity()) == "0.86") } @Test fun testConversionInverse() { /* examples: - data_component: '0f00401a000000000000' value: liters_per_100_kilometers: 6.5 description: Average fuel consumption is 6.5L per 100km */ val bytes = Bytes("0f00401a000000000000") val fuelEfficiency = FuelEfficiency(6.5, FuelEfficiency.Unit.LITERS_PER_100_KILOMETERS) val mpg = String.format("%.02f", fuelEfficiency.inMilesPerGallon()) assertTrue(mpg == "36.19") assertTrue(fuelEfficiency == bytes) val unit = FuelEfficiency(bytes) assertTrue(unit.unit == FuelEfficiency.Unit.LITERS_PER_100_KILOMETERS) assertTrue(unit.value == 6.5) val fuelEfficiencyMpg = FuelEfficiency(36.19, FuelEfficiency.Unit.MILES_PER_GALLON) val mpgToLp100 = format("%.01f", fuelEfficiencyMpg.inLitersPer100Kilometers()) assertTrue(mpgToLp100 == "6.5") } @Test fun testBytesCtor() { val valueClass = Light::class.java val valueBytes = Bytes("0001") // front, inactive val constructor: Constructor<*> = valueClass.getConstructor(Bytes::class.java) val parsedValue = constructor.newInstance(valueBytes) assertTrue(parsedValue is Light) } }
40.171429
102
0.692923
8230f7947aab7c9add9739ea3db96c57172fbed1
276
sql
SQL
pgwatch2/sql/config_store/migrations/v1.3.7_stat_statements_calls.sql
pashagolub/pgwatch2
a0c54624cb0b9557bf253d129f1ab958675b501f
[ "BSD-3-Clause" ]
1,223
2017-01-31T09:22:42.000Z
2022-03-31T11:45:57.000Z
pgwatch2/sql/config_store/migrations/v1.3.7_stat_statements_calls.sql
pashagolub/pgwatch2
a0c54624cb0b9557bf253d129f1ab958675b501f
[ "BSD-3-Clause" ]
425
2017-01-30T14:59:46.000Z
2022-03-29T00:04:28.000Z
pgwatch2/sql/config_store/migrations/v1.3.7_stat_statements_calls.sql
pashagolub/pgwatch2
a0c54624cb0b9557bf253d129f1ab958675b501f
[ "BSD-3-Clause" ]
226
2017-01-30T14:30:38.000Z
2022-03-24T01:25:37.000Z
UPDATE pgwatch2.metric SET m_sql = $sql$ select (extract(epoch from now()) * 1e9)::int8 as epoch_ns, sum(calls) as calls, sum(total_time) as total_time from public.get_stat_statements(); $sql$ WHERE m_name = 'stat_statements_calls' AND m_pg_version_from = 9.2 ;
18.4
54
0.721014
3ee6dc547f1faf9df0eec83371c6c0ff497430d0
1,322
h
C
core/firmware/app_context.h
KameleonSec/Project-Cerberus
b71c6353803aa9062354140e6bc06f707fe9908f
[ "MIT" ]
27
2020-05-13T20:09:08.000Z
2022-03-11T00:14:45.000Z
core/firmware/app_context.h
KameleonSec/Project-Cerberus
b71c6353803aa9062354140e6bc06f707fe9908f
[ "MIT" ]
2
2020-11-19T18:56:30.000Z
2021-08-10T11:19:18.000Z
core/firmware/app_context.h
KameleonSec/Project-Cerberus
b71c6353803aa9062354140e6bc06f707fe9908f
[ "MIT" ]
8
2020-05-13T21:06:28.000Z
2022-01-12T13:52:09.000Z
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. #ifndef APP_CONTEXT_H_ #define APP_CONTEXT_H_ #include "status/rot_status.h" /** * A platform-independent API for storing the running context that will be restored on reboot. */ struct app_context { /** * Save the current context for the running application. A reboot after this context has been * saved will restore it and skip normal boot-time initializations and checks. * * @param context The application context instance. * * @return 0 if the application context has been saved or an error code. */ int (*save) (struct app_context *context); }; #define APP_CONTEXT_ERROR(code) ROT_ERROR (ROT_MODULE_APP_CONTEXT, code) /** * Error codes that can be generated by the application context. */ enum { APP_CONTEXT_INVALID_ARGUMENT = APP_CONTEXT_ERROR (0x00), /**< Input parameter is null or not valid. */ APP_CONTEXT_NO_MEMORY = APP_CONTEXT_ERROR (0x01), /**< Memory allocation failed. */ APP_CONTEXT_SAVE_FAILED = APP_CONTEXT_ERROR (0x02), /**< The running context has not been saved. */ APP_CONTEXT_NO_CONTEXT = APP_CONTEXT_ERROR (0x03), /**< No context is available. */ APP_CONTEXT_NO_DATA = APP_CONTEXT_ERROR (0x04), /**< No data is available. */ }; #endif /* APP_CONTEXT_H_ */
32.243902
103
0.733737
82af5490e03ecb8e156eeeb10e713e834ad590bc
14,572
kt
Kotlin
app/src/main/java/id/ghuniyu/sekitar/ui/activity/MainActivity.kt
iamnubs/sekitarkita-mobile
46134076f4dbce3a0d71d7a6aa5df136a9922182
[ "MIT" ]
10
2020-03-23T18:10:43.000Z
2021-07-20T15:51:35.000Z
app/src/main/java/id/ghuniyu/sekitar/ui/activity/MainActivity.kt
iamnubs/sekitarkita-mobile
46134076f4dbce3a0d71d7a6aa5df136a9922182
[ "MIT" ]
3
2020-03-23T19:42:31.000Z
2020-03-24T15:19:46.000Z
app/src/main/java/id/ghuniyu/sekitar/ui/activity/MainActivity.kt
iamnubs/sekitarkita-mobile
46134076f4dbce3a0d71d7a6aa5df136a9922182
[ "MIT" ]
7
2020-03-23T18:12:05.000Z
2020-03-26T03:06:30.000Z
package id.ghuniyu.sekitar.ui.activity import android.Manifest import android.app.Activity import android.bluetooth.BluetoothAdapter import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter import android.content.pm.PackageManager import android.net.Uri import android.os.Bundle import android.util.Log import android.view.View import android.widget.Button import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import com.google.android.gms.tasks.OnCompleteListener import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.textfield.TextInputEditText import com.google.firebase.iid.FirebaseInstanceId import com.orhanobut.hawk.Hawk import es.dmoral.toasty.Toasty import id.ghuniyu.sekitar.BuildConfig import id.ghuniyu.sekitar.R import id.ghuniyu.sekitar.service.MessagingService import id.ghuniyu.sekitar.service.ScanService import id.ghuniyu.sekitar.ui.dialog.LabelDialog import id.ghuniyu.sekitar.utils.CheckAutostartPermission import id.ghuniyu.sekitar.utils.Constant import id.ghuniyu.sekitar.utils.Formatter import id.ghuniyu.sekitar.utils.MacAddressRetriever import kotlinx.android.synthetic.main.activity_main.* import org.jetbrains.anko.find import org.jetbrains.anko.sdk27.coroutines.onClick import org.jetbrains.anko.startActivity import org.jetbrains.anko.startService import org.jetbrains.anko.stopService import kotlin.system.exitProcess class MainActivity : BaseActivity() { private var labelDialog: LabelDialog? = null private val autoStart = CheckAutostartPermission.getInstance() private val redacted = arrayOf(67, 111, 118, 105, 100, 45, 49, 57) private val selfCheck = arrayOf(99, 111, 118, 105, 100, 49, 57, 100, 105, 97, 103, 110, 111, 115, 101) override fun getLayout() = R.layout.activity_main companion object { private const val TAG = "MainActivityTag" private const val REQUEST_COARSE = 1 private const val REQUEST_BLUETOOTH = 2 private const val RESPONSE_BLUETOOTH_DENY = 0 private const val BLUETOOTH_DENY_MESSAGE = "Aplikasi tidak dapat dijalankan tanpa bluetooth" } private fun setStatus() { if (Hawk.contains(Constant.STORAGE_STATUS)) { val sts = Hawk.get<String>(Constant.STORAGE_STATUS) Log.d(TAG, sts) when (sts) { "pdp" -> { status.text = getString(R.string.status, "Pasien Dalam Pengawasan") status.setTextColor(ContextCompat.getColor(this, R.color.warning)) } "odp" -> { status.text = getString(R.string.status, "Orang Dalam Pengawasan") status.setTextColor(ContextCompat.getColor(this, R.color.yellow)) } "confirmed" -> { status.text = getString(R.string.status, "Confirmed Positif") status.setTextColor(ContextCompat.getColor(this, R.color.danger)) } else -> { status.text = getString(R.string.status, "Sehat") status.setTextColor(ContextCompat.getColor(this, R.color.success)) } } } } override fun onResume() { super.onResume() setStatus() } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) destroy.onClick { stopService<ScanService>() finish() exitProcess(0) } version.text = getString( R.string.version, BuildConfig.VERSION_NAME.toUpperCase(), BuildConfig.VERSION_CODE ) my_label.onClick { showLabelDialog() } checkLabel() val filter = IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED) registerReceiver(mReceiver, filter) if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED ) { // Permission Granted enableBluetooth() } else { forceLocationPermission() } setStatus() FirebaseInstanceId.getInstance().instanceId .addOnCompleteListener(OnCompleteListener { task -> if (!task.isSuccessful) { Log.w(TAG, "getInstanceId failed", task.exception) return@OnCompleteListener } task.result?.let { Hawk.put(Constant.STORAGE_FIREBASE_TOKEN, it.token) MessagingService.storeFirebaseToken(this@MainActivity) Log.d(TAG, "getInstanceId success ${it.token}") } }) } private fun checkLabel() { if (!Hawk.get(Constant.STORAGE_ANONYMOUS, false)) { if (Hawk.contains(Constant.STORAGE_LABEL)) { my_label.text = Hawk.get(Constant.STORAGE_LABEL) } else { showLabelDialog() } } else { my_label.text = getString(R.string.anonym) } } private fun showLabelDialog() { labelDialog = LabelDialog(this) labelDialog?.show() val save = labelDialog?.find<Button>(R.id.save_label) val label = labelDialog?.find<TextInputEditText>(R.id.label_input) val neverAsk = labelDialog?.find<Button>(R.id.never_ask) save?.onClick { label?.let { when { it.text.toString().isEmpty() -> { if (Hawk.contains(Constant.STORAGE_LABEL)) { Hawk.delete(Constant.STORAGE_LABEL) } labelDialog?.dismiss() Hawk.put(Constant.STORAGE_ANONYMOUS, true) checkLabel() Log.d(TAG, "StringEmpty Anonymous") Unit } it.text.toString().length > 10 -> { it.error = getString(R.string.max_char) } it.text.toString().length >= 5 -> { Hawk.put(Constant.STORAGE_ANONYMOUS, false) Hawk.put(Constant.STORAGE_LABEL, it.text.toString()) Toasty.success(this@MainActivity, getString(R.string.thankyou)) labelDialog?.dismiss() checkLabel() } else -> { it.error = getString(R.string.min_char) } } } } neverAsk?.onClick { Log.d(TAG, "Anonymous") Hawk.put(Constant.STORAGE_ANONYMOUS, true) if (Hawk.contains(Constant.STORAGE_LABEL)) { Hawk.delete(Constant.STORAGE_LABEL) } labelDialog?.dismiss() checkLabel() } } private fun retrieveMac() { val mac = MacAddressRetriever.getBluetoothAddress() if (mac == "") { startActivity<MacInputActivity>() finish() return } else { Hawk.put(Constant.STORAGE_MAC_ADDRESS, mac) bluetoothOn() } } private fun bluetoothOn() { if (Hawk.contains(Constant.STORAGE_MAC_ADDRESS)) { checkAutostart() Log.d(TAG, getString(R.string.bluetooth_active)) startService<ScanService>() } else { retrieveMac() } } private val mReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { val action = intent.action if (action == BluetoothAdapter.ACTION_STATE_CHANGED) { val bluetoothState = intent.getIntExtra( BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR ) when (bluetoothState) { BluetoothAdapter.STATE_ON -> { bluetoothOn() } BluetoothAdapter.STATE_OFF -> { enableBluetooth() } } } } } private fun enableBluetooth() { val btAdapter = BluetoothAdapter.getDefaultAdapter() if (btAdapter === null) { Toasty.error(this, getString(R.string.bluetooth_unavailable)).show() finish() return } if (!btAdapter.isEnabled) { val enableBluetoothIntent = Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE) startActivityForResult(enableBluetoothIntent, REQUEST_BLUETOOTH) } else { bluetoothOn() } } private fun forceLocationPermission() { if (ActivityCompat.shouldShowRequestPermissionRationale( this as Activity, Manifest.permission.ACCESS_COARSE_LOCATION ) ) { // Should Explain Permission MaterialAlertDialogBuilder(this) .setTitle(getString(R.string.location_permission)) .setMessage(getString(R.string.request_location_permission)) .setCancelable(false) .setPositiveButton(getString(R.string.understand)) { _, _ -> ActivityCompat.requestPermissions( this@MainActivity as Activity, arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION), REQUEST_COARSE ) } .setNegativeButton(getString(R.string.exit)) { _, _ -> finish() } .show() } else { // No Explanation Needed ActivityCompat.requestPermissions( (this as Activity?)!!, arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION), REQUEST_COARSE ) } } override fun onRequestPermissionsResult( requestCode: Int, permissions: Array<out String>, grantResults: IntArray ) { when (requestCode) { REQUEST_COARSE -> { when { grantResults[0] == PackageManager.PERMISSION_GRANTED -> { enableBluetooth() } ActivityCompat.shouldShowRequestPermissionRationale( this, Manifest.permission.ACCESS_COARSE_LOCATION ) -> { forceLocationPermission() } else -> { Toasty.error(this, "Aplikasi tidak dapat dijalankan tanpa izin Lokasi") .show() finish() } } } else -> super.onRequestPermissionsResult(requestCode, permissions, grantResults) } } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == REQUEST_BLUETOOTH && resultCode == RESPONSE_BLUETOOTH_DENY) { Toasty.error(this, BLUETOOTH_DENY_MESSAGE) .show() finish() } } fun share(view: View) { val sendIntent: Intent = Intent().apply { action = Intent.ACTION_SEND putExtra( Intent.EXTRA_TEXT, getString( R.string.share_content, Formatter.redacted(redacted), Formatter.redacted(redacted) ) ) type = "text/plain" } val shareIntent = Intent.createChooser(sendIntent, getString(R.string.share)) startActivity(shareIntent) } fun showHistory(view: View) { startActivity<InteractionHistoryActivity>() } fun report(view: View) { startActivity<ReportActivity>() } fun selfCheck(view: View) { val intent = Intent( Intent.ACTION_VIEW, Uri.parse(Formatter.redacted(BuildConfig.APP_SELFCHECK_URL)) ) startActivity(intent) } override fun onDestroy() { super.onDestroy() unregisterReceiver(mReceiver) labelDialog?.dismiss() } private fun checkAutostart() { if (autoStart.isAutoStartPermissionAvailable(this)) { if (Hawk.get(Constant.CHECK_AUTOSTART_PERMISSION, true)) { MaterialAlertDialogBuilder(this) .setTitle(getString(R.string.warning)) .setMessage(getString(R.string.autostart_request)) .setCancelable(false) .setPositiveButton(getString(R.string.understand)) { _, _ -> val success = autoStart.getAutoStartPermission(this@MainActivity) /*if (!success) { MaterialAlertDialogBuilder(this) .setTitle(getString(R.string.oops)) .setMessage(getString(R.string.autostart_manual)) .setCancelable(false) .setPositiveButton(getString(R.string.understand)) { _, _ -> startActivity( Intent( android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse( "package:$packageName" ) ) ) } .setNegativeButton(getString(R.string.ignore)) { dialog, _ -> dialog.dismiss() } .show() }*/ } .show() Hawk.put(Constant.CHECK_AUTOSTART_PERMISSION, false) } } } fun showStats(view: View) { startActivity<InformationActivity>() } }
35.454988
106
0.541655
757c83b9ae1e810ee625d2a3c546c2dc9d247e95
10,254
c
C
moai/3rdparty/fmod-4.44.08/fmoddesignerapi/examples/load_from_memory/main.c
jjimenezg93/ai-pathfinding
e32ae8be30d3df21c7e64be987134049b585f1e6
[ "MIT" ]
null
null
null
moai/3rdparty/fmod-4.44.08/fmoddesignerapi/examples/load_from_memory/main.c
jjimenezg93/ai-pathfinding
e32ae8be30d3df21c7e64be987134049b585f1e6
[ "MIT" ]
null
null
null
moai/3rdparty/fmod-4.44.08/fmoddesignerapi/examples/load_from_memory/main.c
jjimenezg93/ai-pathfinding
e32ae8be30d3df21c7e64be987134049b585f1e6
[ "MIT" ]
null
null
null
/*=============================================================================================== Load From Memory Example Copyright (c), Firelight Technologies Pty, Ltd 2004-2011. Demonstrates loading all resources from memory allocated and filled by the user. ===============================================================================================*/ #include "../../api/inc/fmod_event.h" #include "../../api/inc/fmod_errors.h" #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <conio.h> void ERRCHECK(FMOD_RESULT result) { if (result != FMOD_OK) { printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result)); exit(-1); } } void loadFileIntoMemory(const char *file_name, void **data, unsigned int *length) { FILE *file = 0; unsigned int len = 0; unsigned int read = 0; void *mem = 0; printf("loading file: %s\n", file_name); file = fopen(file_name, "rb"); if (!file) { printf("error opening file %s\n", file_name); exit(1); } fseek(file, 0, SEEK_END); len = ftell(file); mem = malloc(len); if (!mem) { printf("allocation failed\n"); exit(1); } rewind(file); read = fread(mem, sizeof(char), len, file); if (read != len) { printf("error reading file\n"); exit(1); } *data = mem; *length = len; } int main(int argc, char *argv[]) { FMOD_EVENTSYSTEM *eventsystem = 0; FMOD_SYSTEM *system = 0; void *project_mem = 0; unsigned int project_len = 0; FMOD_EVENT *sampleevent = 0; FMOD_SOUND *samplebank = 0; void *samplebank_mem = 0; unsigned int samplebank_len = 0; FMOD_EVENT *streamevent = 0; FMOD_SOUND *streambank = 0; FMOD_RESULT result = FMOD_OK; int key = 0; FMOD_EVENT_LOADINFO load_info; printf("======================================================================\n"); printf("Load Event Data Example. Copyright (c) Firelight Technologies 2004-2011.\n"); printf("==============================-------=================================\n"); printf("This Demonstrates loading all resources from memory allocated and filled\n"); printf("by the user.\n"); printf("======================================================================\n\n"); /* Load FEV file into memory */ loadFileIntoMemory("..\\media\\examples.fev", &project_mem, &project_len); ERRCHECK(result = FMOD_EventSystem_Create(&eventsystem)); ERRCHECK(result = FMOD_EventSystem_GetSystemObject(eventsystem, &system)); ERRCHECK(result = FMOD_EventSystem_Init(eventsystem, 64, FMOD_INIT_NORMAL, 0, FMOD_EVENT_INIT_NORMAL)); ERRCHECK(result = FMOD_EventSystem_SetMediaPath(eventsystem, "..\\media\\")); /* we require a loadinfo struct to tell FMOD how big the in memory FEV file is */ memset(&load_info, 0, sizeof(FMOD_EVENT_LOADINFO)); load_info.size = sizeof(FMOD_EVENT_LOADINFO); load_info.loadfrommemory_length = project_len; /* load the project from memory */ ERRCHECK(result = FMOD_EventSystem_Load(eventsystem, (char*)project_mem, &load_info, NULL)); printf("======================================================================\n"); printf("Press 'e' to load sample data\n"); printf("Press 'E' to unload sample data\n"); printf("Press 'd' to start sample event\n"); printf("Press 'w' to open stream\n"); printf("Press 'W' to close stream\n"); printf("Press 's' to start stream event\n"); printf("Press ESC to quit\n"); printf("======================================================================\n"); key = 0; do { if (_kbhit()) { key = _getch(); if (key == 'e') { /* Attempt to get the event without disk access */ result = FMOD_EventSystem_GetEvent(eventsystem, "examples/FeatureDemonstration/Basics/SimpleEvent", FMOD_EVENT_ERROR_ON_DISKACCESS, &sampleevent); if (result != FMOD_ERR_FILE_UNWANTED) { ERRCHECK(result); } else { /* file unwanted error tells us we haven't got the soundbank preloaded, so preload it now... */ FMOD_CREATESOUNDEXINFO info = {0}; printf("Loading event data\n"); loadFileIntoMemory("..\\media\\tutorial_bank.fsb", &samplebank_mem, &samplebank_len); /* We need to create a FMOD_SOUND object to use with preloadFSB */ info.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); info.length = samplebank_len; ERRCHECK(result = FMOD_System_CreateSound(system, (char*)samplebank_mem, FMOD_OPENMEMORY_POINT | FMOD_CREATECOMPRESSEDSAMPLE, &info, &samplebank)); /* Tell FMOD that we have loaded this FSB */ ERRCHECK(result = FMOD_EventSystem_PreloadFSB(eventsystem, "tutorial_bank.fsb", 0, samplebank)); /* Now we can get the event without diskaccess */ ERRCHECK(result = FMOD_EventSystem_GetEvent(eventsystem, "examples/FeatureDemonstration/Basics/SimpleEvent", FMOD_EVENT_ERROR_ON_DISKACCESS, &sampleevent)); } printf("Sample event ready\n"); } else if (key == 'E') { if (!samplebank) { printf("Nothing to unload\n"); } else { ERRCHECK(result = FMOD_Event_Stop(sampleevent, 0)); sampleevent = 0; /* Note: we *MUST* call unload before freeing data */ ERRCHECK(result = FMOD_EventSystem_UnloadFSB(eventsystem, "tutorial_bank.fsb", 0)); ERRCHECK(result = FMOD_Sound_Release(samplebank)); samplebank = 0; if (samplebank_mem) { free(samplebank_mem); samplebank_mem = 0; } printf("Event data unloaded\n"); } } else if (key == 'd') { if (!sampleevent) { printf("no event loaded!\n"); } else { ERRCHECK(result = FMOD_Event_Start(sampleevent)); } } else if (key == 'w') { /* Attempt to get the event without opening a new stream */ result = FMOD_EventSystem_GetEvent(eventsystem, "examples/AdvancedTechniques/MultiChannelMusic", FMOD_EVENT_ERROR_ON_DISKACCESS, &streamevent); if (result != FMOD_ERR_FILE_UNWANTED) { ERRCHECK(result); } else { /* file unwanted error tells us we haven't got the stream instance preloaded so preload it now */ printf("Opening stream\n"); /* If the 'Max Streams' property of the sound bank is greater than 1 then mutiple streams can be opened. This means we need to preload it multiple times if we want to prevent FMOD from creating streams internally. Each stream is uniquely identified using the 'streaminstance' parameter to preloadFSB which counts upwards from 0. */ ERRCHECK(result = FMOD_System_CreateSound(system, "..\\media\\streaming_bank.fsb", FMOD_CREATESTREAM, 0, &streambank)); ERRCHECK(result = FMOD_EventSystem_PreloadFSB(eventsystem, "streaming_bank.fsb", 0, streambank)); /* Now we can get the event without opening a new stream */ ERRCHECK(result = FMOD_EventSystem_GetEvent(eventsystem, "examples/AdvancedTechniques/MultiChannelMusic", FMOD_EVENT_ERROR_ON_DISKACCESS, &streamevent)); } printf("Stream event ready\n"); } else if (key == 'W') { if (!streambank) { printf("Nothing to unload\n"); } else { ERRCHECK(result = FMOD_Event_Stop(streamevent, 0)); streamevent = 0; /* Note: we *MUST* call unload before releasing stream */ ERRCHECK(result = FMOD_EventSystem_UnloadFSB(eventsystem, "streaming_bank.fsb", 0)); ERRCHECK(result = FMOD_Sound_Release(streambank)); streambank = 0; printf("Stream closed\n"); } } else if (key == 's') { if (!streamevent) { printf("no event loaded!\n"); } else { ERRCHECK(result = FMOD_Event_Start(streamevent)); } } } ERRCHECK(result = FMOD_EventSystem_Update(eventsystem)); Sleep(15); } while (key != 27); if (samplebank) { /* Note: we *MUST* call unload before freeing data */ ERRCHECK(result = FMOD_EventSystem_UnloadFSB(eventsystem, "tutorial_bank.fsb", 0)); ERRCHECK(result = FMOD_Sound_Release(samplebank)); if (samplebank_mem) { free(samplebank_mem); } } if (streambank) { /* Note: we *MUST* call unload before releasing stream */ ERRCHECK(result = FMOD_EventSystem_UnloadFSB(eventsystem, "streaming_bank.fsb", 0)); ERRCHECK(result = FMOD_Sound_Release(streambank)); } ERRCHECK(result = FMOD_EventSystem_Release(eventsystem)); /* Free the memory we have allocated */ free(project_mem); return 0; }
38.548872
176
0.510825
5d63f472922e626b517ec01b43800c51d687cf7e
6,017
go
Go
vendor/github.com/AlexStocks/goext/log/log4go_test.go
weizai118/sofa-mosn
3981833057c3a10288a0ae5f1cb4c0625c266f1d
[ "Apache-2.0" ]
1
2018-11-15T13:09:15.000Z
2018-11-15T13:09:15.000Z
vendor/github.com/AlexStocks/goext/log/log4go_test.go
apphuangweipeng137/sofa-mosn
f7c041c891233e50a33edbeefea6e860f60040a0
[ "Apache-2.0" ]
null
null
null
vendor/github.com/AlexStocks/goext/log/log4go_test.go
apphuangweipeng137/sofa-mosn
f7c041c891233e50a33edbeefea6e860f60040a0
[ "Apache-2.0" ]
1
2021-06-07T07:26:35.000Z
2021-06-07T07:26:35.000Z
/* log_test.go - test for log.go */ package gxlog import ( "encoding/json" "testing" ) // attention: 不管是同步还是一部情况下,json log文件性能都比print log文件性能差 func TestNewLogger(t *testing.T) { var conf = Conf{ Name: "test", Dir: "./log/", Level: "Info", Console: true, Daily: true, BackupNum: 2, Json: false, } var ( err error logger Logger ) if logger, err = NewLogger(conf); err != nil { t.Errorf("NewLogger(conf{%#v}) = error{%#v}", conf, err) } logger.Debug("Debug") logger.Info("Info") logger.Warn("Warn") logger.Error("Error") logger.Critic("Critic") logger.Close() } func TestJsonLogger(t *testing.T) { var conf = Conf{ Name: "test", Dir: "./log/", Level: "Info", Console: true, Daily: true, BackupNum: 2, Json: true, } var ( err error logBytes []byte logStr string logger Logger ) logBytes, err = json.Marshal( struct { Name string `json:"name,omitempty"` Age int `json:"age,omitempty"` }{Name: "Alex", Age: 35, }, ) if err != nil { t.Errorf("json marshal error:%s", err) } if logger, err = NewLogger(conf); err != nil { t.Errorf("NewLogger(conf{%#v}) = error{%#v}", conf, err) } logStr = string(logBytes) logger.Debug(json.Marshal(logStr)) logger.Info(logStr) logger.Warn(logStr) logger.Error(logStr) logger.Critic(logStr) logger.Close() } func TestAsyncLogger(t *testing.T) { var conf = Conf{ Name: "test", Dir: "./log/", Level: "Info", Console: true, Daily: true, BackupNum: 2, BufSize: 4096, Json: true, } var ( err error logger Logger ) if logger, err = NewLogger(conf); err != nil { t.Errorf("NewLogger(conf{%#v}) = error{%#v}", conf, err) } logger.Debug("Debug") logger.Info("Info") logger.Warn("Warn") logger.Error("Error") logger.Critic("Critic") logger.Close() } func TestNewLoggerWithConfFile(t *testing.T) { var ( conf string logger Logger ) conf = "log_test.xml" logger = NewLoggerWithConfFile(conf) // And now we're ready! logger.Finest("This will only go to those of you really cool UDP kids! If you change enabled=true.") logger.Debug("Oh no! %d + %d = %d!", 2, 2, 2+2) logger.Info("About that time, eh chaps?") logger.Warn("Warn") logger.Error("Error") logger.Critic("Critic") logger.Close() } func TestMultiLoggers(t *testing.T) { var conf = Conf{ Name: "test1", Dir: "./log/", Level: "Info", Console: false, Daily: true, BackupNum: 2, BufSize: 4096, Json: false, } var ( err error logger1 Logger logger2 Logger ) if logger1, err = NewLogger(conf); err != nil { t.Errorf("NewLogger(conf{%#v}) = error{%#v}", conf, err) } conf = Conf{ Name: "test2", Dir: "./log/", Level: "Info", Console: false, Daily: true, BackupNum: 2, BufSize: 4096, Json: false, } if logger2, err = NewLogger(conf); err != nil { t.Errorf("NewLogger(conf{%#v}) = error{%#v}", conf, err) } logger1.Debug("Debug") logger1.Info("Info") logger1.Warn("Warn") logger1.Error("Error") logger1.Critic("Critic") logger2.Debug("Debug") logger2.Info("Info") logger2.Warn("Warn") logger2.Error("Error") logger2.Critic("Critic") logger2.Close() logger1.Close() } // go test -v -bench BenchmarkSyncLogger -run=^a // BenchmarkSyncLogger-4 50000 23154 ns/op // BenchmarkSyncLogger-4 50000 22340 ns/op // BenchmarkSyncLogger-4 50000 23471 ns/op // Avg: 22988 ns/op // // if json is true: // BenchmarkSyncLogger-4 50000 27798 ns/op // BenchmarkSyncLogger-4 50000 25841 ns/op // BenchmarkSyncLogger-4 50000 24782 ns/op // Avg: 26140 ns/op func BenchmarkSyncLogger(b *testing.B) { var conf = Conf{ Name: "test", Dir: "./log/", Level: "DEBUG", Console: false, Daily: true, BackupNum: 2, Json: true, } var ( err error logger Logger ) b.StopTimer() if logger, err = NewLogger(conf); err != nil { b.Errorf("NewLogger(conf{%#v}) = error{%#v}", conf, err) } b.StartTimer() for i := 0; i < b.N; i++ { logger.Debug("Debug") logger.Info("Info") logger.Warn("Warn") logger.Error("Error") logger.Critic("Critic") } logger.Close() b.StopTimer() } // go test -v -bench BenchmarkAsyncLogger -run=^a // // bufsize: 1024 // BenchmarkAsyncLogger-4 100000 18486 ns/op // BenchmarkAsyncLogger-4 100000 18997 ns/op // BenchmarkAsyncLogger-4 100000 18173 ns/op // Avg: 18552 ns/op // // bufsize: 2048 // BenchmarkAsyncLogger-4 100000 16774 ns/op // BenchmarkAsyncLogger-4 100000 16416 ns/op // BenchmarkAsyncLogger-4 100000 18012 ns/op // Avg: 17067 ns/op // // bufsize: 4096 // BenchmarkAsyncLogger-4 100000 15004 ns/op // BenchmarkAsyncLogger-4 100000 14785 ns/op // BenchmarkAsyncLogger-4 100000 15883 ns/op // Avg: 15224 ns/op // // bufsize: 8192 // BenchmarkAsyncLogger-4 100000 18529 ns/op // BenchmarkAsyncLogger-4 100000 18035 ns/op // BenchmarkAsyncLogger-4 100000 18536 ns/op // Avg: 18366 ns/op // // if bufsize is 4k, json is true: // BenchmarkAsyncLogger-4 100000 16646 ns/op // BenchmarkAsyncLogger-4 100000 16494 ns/op // BenchmarkAsyncLogger-4 100000 16762 ns/op // Avg: 16644 ns/op func BenchmarkAsyncLogger(b *testing.B) { var conf = Conf{ Name: "test", Dir: "./log/", Level: "DEBUG", Console: false, Daily: true, BackupNum: 2, BufSize: 4096, Json: true, } var ( err error logger Logger ) b.StopTimer() if logger, err = NewLogger(conf); err != nil { b.Errorf("NewLogger(conf{%#v}) = error{%#v}", conf, err) } b.StartTimer() for i := 0; i < b.N; i++ { logger.Debug("Debug") logger.Info("Info") logger.Warn("Warn") logger.Error("Error") logger.Critic("Critic") } logger.Close() b.StopTimer() }
20.676976
102
0.603291
53c2cf3e8d017516fee53b3e53422e5899e39d6d
2,451
java
Java
src/main/java/com/seven/dust/controllers/ApiController.java
Blankll/dust
1703d4d78c70805d29f5ed9ecbf6b2da0f1998da
[ "Apache-2.0" ]
null
null
null
src/main/java/com/seven/dust/controllers/ApiController.java
Blankll/dust
1703d4d78c70805d29f5ed9ecbf6b2da0f1998da
[ "Apache-2.0" ]
null
null
null
src/main/java/com/seven/dust/controllers/ApiController.java
Blankll/dust
1703d4d78c70805d29f5ed9ecbf6b2da0f1998da
[ "Apache-2.0" ]
null
null
null
package com.seven.dust.controllers; import com.google.gson.Gson; import com.seven.dust.responses.RestRep; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; public class ApiController { protected HttpServletRequest req; protected HttpServletResponse rep; public void setReq(HttpServletRequest req) { this.req = req; } public void setRep(HttpServletResponse rep) { this.rep = rep; } public void initRequest(HttpServletRequest req, HttpServletResponse rep) { this.setReq(req); this.setRep(rep); } /** * 操作成功返回json格式 * @param message * @throws IOException */ public <T> void success(String message) { RestRep<T> data = this.<T>setData(2000, message); this.<T>sendData(data); return; } public <T> void success(String message, T data){ RestRep<T> one = this.setData(2000, message, data); this.<T>sendData(one); } public <T> void success(T data) { RestRep<T> one = this.setData(2000, "请求成功", data); this.<T> sendData(one); } /** * 400呀 */ public void youFucked() { this.rep.setStatus(400); } /** * 404呀 not find */ public void notFind() { this.rep.setStatus(404); } /** * 500 呀 */ public void iFucked() { this.rep.setStatus(500); } private <T> RestRep<T> setData(int code, String message) { RestRep<T> rep = new RestRep<>(code, message, null); return rep; } private <T> RestRep<T> setData(int code, String message, T data){ RestRep<T> rep = new RestRep<>(code, message, data); return rep; } private <T> void sendData(RestRep<T> data){ Gson gson = new Gson(); String json = gson.toJson(data); this.rep.setCharacterEncoding("UTF-8");//设置将字符以"UTF-8"编码输出到客户端浏览器 this.rep.setContentType("application/json;charset=UTF-8"); PrintWriter out; try { out = this.rep.getWriter(); out.write(json); out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); this.iFucked(); return; } } }
26.641304
79
0.558956
ef12f4b3cc73f80b78634c817a10f838c5eacdf4
5,744
swift
Swift
DataStructures Tests/SetTests.swift
designatednerd/CollectionDataStructuresInSwift-Wenderlich
d047c83586bda46fe8cd20d8efcc5d5b893c8e9c
[ "MIT" ]
null
null
null
DataStructures Tests/SetTests.swift
designatednerd/CollectionDataStructuresInSwift-Wenderlich
d047c83586bda46fe8cd20d8efcc5d5b893c8e9c
[ "MIT" ]
null
null
null
DataStructures Tests/SetTests.swift
designatednerd/CollectionDataStructuresInSwift-Wenderlich
d047c83586bda46fe8cd20d8efcc5d5b893c8e9c
[ "MIT" ]
null
null
null
// // SetTests.swift // DataStructures // // Created by Ellen Shapiro on 8/3/14. // Copyright (c) 2014 Ray Wenderlich Tutorial Team. All rights reserved. // import UIKit import XCTest class SetTests: PerformanceTestingCase { let count = 5000 //MARK: Creation private func createSet(manipulator: SetManipulator) { self.measureBlock { () -> Void in let time = manipulator.setupWithObjectCount(self.count) self.times.append(time) } } // func testCreatingNSSet() { // performFunctionInBackgroundThenLog("NSSet Create") { // self.createSet(NSSetManipulator()) // } // } // // func testCreatingSwiftSet() { // performFunctionInBackgroundThenLog("Swift Set Create") { // self.createSet(SwiftSetManipulator()) // } // } //MARK: Add one func addOneObject(manipulator: SetManipulator) { manipulator.setupWithObjectCount(count) self.measureBlock() { let time = manipulator.add1Object() self.times.append(time) } } func testAdding1ObjectToNSSet() { performFunctionInBackgroundThenLog("NSSet add one object") { self.addOneObject(NSSetManipulator()) } } func testAdding1ObjectToSwiftSet() { performFunctionInBackgroundThenLog("Swift Set add one object") { self.addOneObject(SwiftSetManipulator()) } } //MARK: Add 5 func addFiveObjects(manipulator: SetManipulator) { manipulator.setupWithObjectCount(count) self.measureBlock() { let time = manipulator.add5Objects() self.times.append(time) } } func testAdding5ObjectsToNSSet() { performFunctionInBackgroundThenLog("NSSet add five objects") { self.addFiveObjects(NSSetManipulator()) } } func testAdding5ObjectsToSwiftSet() { performFunctionInBackgroundThenLog("Swift Set add five objects") { self.addFiveObjects(SwiftSetManipulator()) } } //MARK: Add 10 func addTenObjects(manipulator: SetManipulator) { self.measureBlock() { let time = manipulator.add10Objects() self.times.append(time) } } func testAdding10ObjectsToNSSet() { performFunctionInBackgroundThenLog("NSSet add ten objects") { self.addTenObjects(NSSetManipulator()) } } func testAdding10ObjectsToSwiftSet() { performFunctionInBackgroundThenLog("Swift Set add ten objects") { self.addTenObjects(SwiftSetManipulator()) } } //MARK: Remove One func removeOneObject(manipulator: SetManipulator) { self.measureBlock() { let time = manipulator.remove1Object() self.times.append(time) } } func testRemoving1ObjectFromNSSet() { performFunctionInBackgroundThenLog("NSSet remove one object") { self.removeOneObject(NSSetManipulator()) } } func testRemoving1ObjectFromSwiftSet() { performFunctionInBackgroundThenLog("Swift Set remove one object") { self.removeOneObject(SwiftSetManipulator()) } } //MARK: Remove 5 func remove5Objects(manipulator: SetManipulator) { self.measureBlock() { let time = manipulator.remove5Objects() self.times.append(time) } } func testRemoving5ObjectsFromNSSet() { performFunctionInBackgroundThenLog("NSSet remove five objects") { self.remove5Objects(NSSetManipulator()) } } func testRemoving5ObjectsFromSwiftSet() { performFunctionInBackgroundThenLog("Swift Set remove five objects") { self.remove5Objects(SwiftSetManipulator()) } } //MARK: Remove 10 func remove10Objects(manipulator: SetManipulator) { self.measureBlock() { let time = manipulator.remove10Objects() self.times.append(time) } } func testRemoving10ObjectsFromNSSet() { performFunctionInBackgroundThenLog("NSSet remove ten objects") { self.remove10Objects(NSSetManipulator()) } } func testRemoving10ObjectsFromSwiftSSet() { performFunctionInBackgroundThenLog("Swift Set remove ten objects") { self.remove10Objects(SwiftSetManipulator()) } } //MARK: Lookup 1 func lookup1Object(manipulator: SetManipulator) { self.measureBlock() { let time = manipulator.lookup1Object() self.times.append(time) } } func testLookup1ObjectInNSSet() { performFunctionInBackgroundThenLog("NSSet lookup one object") { self.lookup1Object(NSSetManipulator()) } } func testLookup1ObjectInSwiftSet() { performFunctionInBackgroundThenLog("Swift set lookup one object") { self.lookup1Object(SwiftSetManipulator()) } } //MARK: Lookup 10 func lookup10Objects(manipulator: SetManipulator) { self.measureBlock() { let time = manipulator.lookup10Objects() self.times.append(time) } } func testLookup10ObjectsInNSSet() { performFunctionInBackgroundThenLog("NSSet lookup 10 objects") { self.lookup10Objects(NSSetManipulator()) } } func testLookup10ObjectsInSwiftSet() { performFunctionInBackgroundThenLog("Swift Set lookup 10 objects") { self.lookup10Objects(SwiftSetManipulator()) } } }
27.748792
77
0.611595
c434f6f786c0bec10745fd21240d76e88f19d49b
13,333
h
C
src/runloop.h
basharast/RetroArch-ARM
33208e97b7eebae35cfce7831cf3fefc9d783d79
[ "MIT" ]
4
2021-12-03T14:58:12.000Z
2022-03-05T11:17:16.000Z
src/runloop.h
basharast/RetroArch-ARM
33208e97b7eebae35cfce7831cf3fefc9d783d79
[ "MIT" ]
2
2022-03-16T06:13:34.000Z
2022-03-26T06:44:50.000Z
src/runloop.h
basharast/RetroArch-ARM
33208e97b7eebae35cfce7831cf3fefc9d783d79
[ "MIT" ]
null
null
null
/* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2021 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with RetroArch. * If not, see <http://www.gnu.org/licenses/>. */ #ifndef __RUNLOOP_H #define __RUNLOOP_H #include <stdint.h> #include <stddef.h> #include <stdlib.h> #include <boolean.h> #include <retro_inline.h> #include <retro_common_api.h> #include <libretro.h> #include <dynamic/dylib.h> #include <queues/message_queue.h> #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_THREADS #include <rthreads/rthreads.h> #endif #include "dynamic.h" #include "configuration.h" #include "core_option_manager.h" #include "performance_counters.h" #include "state_manager.h" #include "tasks/tasks_internal.h" /* Arbitrary twenty subsystems limit */ #define SUBSYSTEM_MAX_SUBSYSTEMS 20 /* Arbitrary 10 roms for each subsystem limit */ #define SUBSYSTEM_MAX_SUBSYSTEM_ROMS 10 #ifdef HAVE_THREADS #define RUNLOOP_MSG_QUEUE_LOCK(runloop_st) slock_lock((runloop_st)->msg_queue_lock) #define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) slock_unlock((runloop_st)->msg_queue_lock) #else #define RUNLOOP_MSG_QUEUE_LOCK(runloop_st) (void)(runloop_st) #define RUNLOOP_MSG_QUEUE_UNLOCK(runloop_st) (void)(runloop_st) #endif enum runloop_state_enum { RUNLOOP_STATE_ITERATE = 0, RUNLOOP_STATE_POLLED_AND_SLEEP, RUNLOOP_STATE_MENU_ITERATE, RUNLOOP_STATE_END, RUNLOOP_STATE_QUIT }; enum poll_type_override_t { POLL_TYPE_OVERRIDE_DONTCARE = 0, POLL_TYPE_OVERRIDE_EARLY, POLL_TYPE_OVERRIDE_NORMAL, POLL_TYPE_OVERRIDE_LATE }; typedef struct runloop_ctx_msg_info { const char *msg; unsigned prio; unsigned duration; bool flush; } runloop_ctx_msg_info_t; /* Contains the current retro_fastforwarding_override * parameters along with any pending updates triggered * by RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE */ typedef struct fastmotion_overrides { struct retro_fastforwarding_override current; struct retro_fastforwarding_override next; bool pending; } fastmotion_overrides_t; typedef struct { unsigned priority; float duration; char str[128]; bool set; } runloop_core_status_msg_t; /* Contains all callbacks associated with * core options. * > At present there is only a single * callback, 'update_display' - but we * may wish to add more in the future * (e.g. for directly informing a core of * core option value changes, or getting/ * setting extended/non-standard option * value data types) */ typedef struct core_options_callbacks { retro_core_options_update_display_callback_t update_display; } core_options_callbacks_t; #ifdef HAVE_RUNAHEAD typedef bool(*runahead_load_state_function)(const void*, size_t); typedef void *(*constructor_t)(void); typedef void (*destructor_t )(void*); typedef struct my_list_t { void **data; constructor_t constructor; destructor_t destructor; int capacity; int size; } my_list; #endif struct runloop { #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) rarch_timer_t shader_delay_timer; /* int64_t alignment */ #endif retro_time_t core_runtime_last; retro_time_t core_runtime_usec; retro_time_t frame_limit_minimum_time; retro_time_t frame_limit_last_time; retro_usec_t frame_time_last; /* int64_t alignment */ struct retro_core_t current_core; /* uint64_t alignment */ #if defined(HAVE_RUNAHEAD) uint64_t runahead_last_frame_count; /* uint64_t alignment */ #if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB) struct retro_core_t secondary_core; /* uint64_t alignment */ #endif retro_ctx_load_content_info_t *load_content_info; #if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB) char *secondary_library_path; #endif my_list *runahead_save_state_list; my_list *input_state_list; #endif #ifdef HAVE_REWIND struct state_manager_rewind_state rewind_st; #endif struct retro_perf_counter *perf_counters_libretro[MAX_COUNTERS]; bool *load_no_content_hook; struct string_list *subsystem_fullpaths; struct retro_subsystem_info subsystem_data[SUBSYSTEM_MAX_SUBSYSTEMS]; struct retro_callbacks retro_ctx; /* ptr alignment */ msg_queue_t msg_queue; /* ptr alignment */ retro_input_state_t input_state_callback_original; /* ptr alignment */ #ifdef HAVE_RUNAHEAD function_t retro_reset_callback_original; /* ptr alignment */ function_t original_retro_deinit; /* ptr alignment */ function_t original_retro_unload; /* ptr alignment */ runahead_load_state_function retro_unserialize_callback_original; /* ptr alignment */ #if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB) struct retro_callbacks secondary_callbacks; /* ptr alignment */ #endif #endif #ifdef HAVE_THREADS slock_t *msg_queue_lock; #endif content_state_t content_st; /* ptr alignment */ struct retro_subsystem_rom_info subsystem_data_roms[SUBSYSTEM_MAX_SUBSYSTEMS] [SUBSYSTEM_MAX_SUBSYSTEM_ROMS]; /* ptr alignment */ core_option_manager_t *core_options; core_options_callbacks_t core_options_callback;/* ptr alignment */ retro_keyboard_event_t key_event; /* ptr alignment */ retro_keyboard_event_t frontend_key_event; /* ptr alignment */ rarch_system_info_t system; /* ptr alignment */ struct retro_frame_time_callback frame_time; /* ptr alignment */ struct retro_audio_buffer_status_callback audio_buffer_status; /* ptr alignment */ #ifdef HAVE_DYNAMIC dylib_t lib_handle; /* ptr alignment */ #endif #if defined(HAVE_RUNAHEAD) #if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB) dylib_t secondary_lib_handle; /* ptr alignment */ #endif size_t runahead_save_state_size; #endif size_t msg_queue_size; #if defined(HAVE_RUNAHEAD) #if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB) int port_map[MAX_USERS]; #endif #endif runloop_core_status_msg_t core_status_msg; unsigned pending_windowed_scale; unsigned max_frames; unsigned audio_latency; unsigned fastforward_after_frames; unsigned perf_ptr_libretro; unsigned subsystem_current_count; unsigned entry_state_slot; fastmotion_overrides_t fastmotion_override; /* float alignment */ retro_bits_t has_set_libretro_device; /* uint32_t alignment */ enum rarch_core_type current_core_type; enum rarch_core_type explicit_current_core_type; enum poll_type_override_t core_poll_type_override; #if defined(HAVE_RUNAHEAD) enum rarch_core_type last_core_type; #endif char runtime_content_path_basename[8192]; char current_library_name[256]; char current_library_version[256]; char current_valid_extensions[256]; char subsystem_path[256]; #ifdef HAVE_SCREENSHOTS char max_frames_screenshot_path[PATH_MAX_LENGTH]; #endif #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_SLANG) || defined(HAVE_HLSL) char runtime_shader_preset_path[PATH_MAX_LENGTH]; #endif char runtime_content_path[PATH_MAX_LENGTH]; char runtime_core_path[PATH_MAX_LENGTH]; char savefile_dir[PATH_MAX_LENGTH]; char savestate_dir[PATH_MAX_LENGTH]; struct { char *remapfile; char savefile[8192]; char savestate[8192]; char cheatfile[8192]; char ups[8192]; char bps[8192]; char ips[8192]; char label[8192]; } name; bool is_inited; bool missing_bios; bool force_nonblock; bool paused; bool idle; bool focused; bool slowmotion; bool fastmotion; bool shutdown_initiated; bool core_shutdown_initiated; bool core_running; bool perfcnt_enable; bool game_options_active; bool folder_options_active; bool autosave; #ifdef HAVE_CONFIGFILE bool overrides_active; #endif bool remaps_core_active; bool remaps_game_active; bool remaps_content_dir_active; #ifdef HAVE_SCREENSHOTS bool max_frames_screenshot; #endif #ifdef HAVE_RUNAHEAD bool has_variable_update; bool input_is_dirty; bool runahead_save_state_size_known; bool request_fast_savestate; bool runahead_available; bool runahead_secondary_core_available; bool runahead_force_input_dirty; #endif #ifdef HAVE_PATCH bool patch_blocked; #endif bool is_sram_load_disabled; bool is_sram_save_disabled; bool use_sram; bool ignore_environment_cb; bool core_set_shared_context; bool has_set_core; }; typedef struct runloop runloop_state_t; #ifdef HAVE_BSV_MOVIE #define BSV_MOVIE_IS_EOF() || (input_st->bsv_movie_state.movie_end && \ input_st->bsv_movie_state.eof_exit) #else #define BSV_MOVIE_IS_EOF() #endif /* Time to exit out of the main loop? * Reasons for exiting: * a) Shutdown environment callback was invoked. * b) Quit key was pressed. * c) Frame count exceeds or equals maximum amount of frames to run. * d) Video driver no longer alive. * e) End of BSV movie and BSV EOF exit is true. (TODO/FIXME - explain better) */ #define RUNLOOP_TIME_TO_EXIT(quit_key_pressed) (runloop_state.shutdown_initiated || quit_key_pressed || !is_alive BSV_MOVIE_IS_EOF() || ((runloop_state.max_frames != 0) && (frame_count >= runloop_state.max_frames)) || runloop_exec) RETRO_BEGIN_DECLS void runloop_path_fill_names(void); /** * runloop_environment_cb: * @cmd : Identifier of command. * @data : Pointer to data. * * Environment callback function implementation. * * Returns: true (1) if environment callback command could * be performed, otherwise false (0). **/ bool runloop_environment_cb(unsigned cmd, void *data); void runloop_msg_queue_push(const char *msg, unsigned prio, unsigned duration, bool flush, char *title, enum message_queue_icon icon, enum message_queue_category category); void runloop_set_current_core_type( enum rarch_core_type type, bool explicitly_set); /** * runloop_iterate: * * Run Libretro core in RetroArch for one frame. * * Returns: 0 on successful run, * Returns 1 if we have to wait until button input in order * to wake up the loop. * Returns -1 if we forcibly quit out of the * RetroArch iteration loop. **/ int runloop_iterate(void); void runloop_perf_log(void); void runloop_system_info_free(void); bool runloop_path_init_subsystem(void); /** * libretro_get_system_info: * @path : Path to libretro library. * @info : Pointer to system info information. * @load_no_content : If true, core should be able to auto-start * without any content loaded. * * Gets system info from an arbitrary lib. * The struct returned must be freed as strings are allocated dynamically. * * Returns: true (1) if successful, otherwise false (0). **/ bool libretro_get_system_info( const char *path, struct retro_system_info *info, bool *load_no_content); void runloop_performance_counter_register( struct retro_perf_counter *perf); void runloop_runtime_log_deinit( runloop_state_t *runloop_st, bool content_runtime_log, bool content_runtime_log_aggregate, const char *dir_runtime_log, const char *dir_playlist); void runloop_event_deinit_core(void); #ifdef HAVE_RUNAHEAD void runloop_runahead_clear_variables(runloop_state_t *runloop_st); #endif bool runloop_event_init_core( settings_t *settings, void *input_data, enum rarch_core_type type); void runloop_pause_checks(void); float runloop_set_frame_limit( const struct retro_system_av_info *av_info, float fastforward_ratio); float runloop_get_fastforward_ratio( settings_t *settings, struct retro_fastforwarding_override *fastmotion_override); void runloop_task_msg_queue_push( retro_task_t *task, const char *msg, unsigned prio, unsigned duration, bool flush); void runloop_frame_time_free(void); void runloop_fastmotion_override_free(void); void runloop_audio_buffer_status_free(void); bool secondary_core_ensure_exists(settings_t *settings); void runloop_core_options_cb_free(void); void runloop_log_counters( struct retro_perf_counter **counters, unsigned num); void runloop_secondary_core_destroy(void); void runloop_msg_queue_deinit(void); void runloop_msg_queue_init(void); void runloop_path_init_savefile(void); void runloop_path_set_basename(const char *path); void runloop_path_init_savefile(void); void runloop_path_set_names(void); runloop_state_t *runloop_state_get_ptr(void); RETRO_END_DECLS #endif
29.303297
231
0.743119
0c8a7a498a0f1b713f01a2cb053d95a45b749576
3,071
py
Python
test_API/demo4.py
UppASD/aiida-uppasd
f3f26d523280cb7484ad24c826ad275a6d329c01
[ "MIT" ]
2
2020-12-03T13:29:33.000Z
2022-01-03T11:36:24.000Z
test_API/demo4.py
UppASD/aiida-uppasd
f3f26d523280cb7484ad24c826ad275a6d329c01
[ "MIT" ]
null
null
null
test_API/demo4.py
UppASD/aiida-uppasd
f3f26d523280cb7484ad24c826ad275a6d329c01
[ "MIT" ]
2
2021-04-22T07:19:21.000Z
2022-03-16T21:49:29.000Z
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 23 15:15:05 2021 @author: qichen """ from aiida.plugins import DataFactory, CalculationFactory from aiida.engine import run from aiida.orm import Code, SinglefileData, Int, Float, Str, Bool, List, Dict, ArrayData, XyData, SinglefileData, FolderData, RemoteData import numpy as np import aiida import os from aiida.engine import submit aiida.load_profile() code = Code.get_from_string('uppasd_dev@uppasd_local') aiida_uppasd = CalculationFactory('UppASD_core_calculations') builder = aiida_uppasd.get_builder() #pre-prepared files dmdata = SinglefileData( file=os.path.join(os.getcwd(), "input_files2", 'dmdata')) jij = SinglefileData( file=os.path.join(os.getcwd(), "input_files2", 'jij')) momfile = SinglefileData( file=os.path.join(os.getcwd(), "input_files2", 'momfile')) posfile = SinglefileData( file=os.path.join(os.getcwd(), "input_files2", 'posfile')) qfile = SinglefileData( file=os.path.join(os.getcwd(), "input_files2", 'qfile')) # inpsd.dat file selection inpsd_dict = { 'simid': Str('SCsurf_T'), 'ncell': Str('128 128 1'), 'BC': Str('P P 0 '), 'cell': Str('''1.00000 0.00000 0.00000 0.00000 1.00000 0.00000 0.00000 0.00000 1.00000'''), 'do_prnstruct': Int(2), 'maptype': Int(2), 'SDEalgh': Int(1), 'Initmag': Int(3), 'ip_mode': Str('Q'), 'qm_svec': Str('1 -1 0 '), 'qm_nvec': Str('0 0 1'), 'mode': Str('S'), 'temp': Float(0.000), 'damping': Float(0.500), 'Nstep': Int(5000), 'timestep': Str('1.000d-15'), 'qpoints': Str('F'), 'plotenergy': Int(1), 'do_avrg': Str('Y'), } r_l = List(list=['coord.{}.out'.format(inpsd_dict['simid'].value), 'qm_minima.{}.out'.format(inpsd_dict['simid'].value), 'qm_sweep.{}.out'.format(inpsd_dict['simid'].value), 'qpoints.{}.out'.format(inpsd_dict['simid'].value), 'totenergy.{}.out'.format(inpsd_dict['simid'].value), 'averages.{}.out'.format(inpsd_dict['simid'].value), 'inp.{}.out'.format(inpsd_dict['simid'].value), 'qm_restart.{}.out'.format(inpsd_dict['simid'].value), 'restart.{}.out'.format(inpsd_dict['simid'].value), 'qpoints.out', 'fort.2000']) # set up calculation inpsd = Dict(dict=inpsd_dict) builder.code = code builder.dmdata = dmdata builder.jij = jij builder.momfile = momfile builder.posfile = posfile builder.qfile = qfile builder.inpsd = inpsd builder.retrieve_list_name = r_l builder.inpsd_dat_exist = Int(0) builder.metadata.options.resources = {'num_machines': 1} builder.metadata.options.max_wallclock_seconds = 120 builder.metadata.options.input_filename = 'inpsd.dat' builder.metadata.options.parser_name = 'UppASD_core_parsers' builder.metadata.label = 'Demo4' builder.metadata.description = 'Test demo4 for UppASD-AiiDA' job_node = submit(builder) print('Job submitted, PK: {}'.format(job_node.pk))
32.670213
136
0.643113
abce8c2f7d7cf76baaaf29c0d1613a551314af82
3,303
go
Go
examples/extkalman_robotpositioning.go
go-hep/extkalman
171f71fcb4c7e92bb97fa38e59f86dbe703ac634
[ "BSD-2-Clause" ]
1
2015-05-21T21:26:00.000Z
2015-05-21T21:26:00.000Z
examples/extkalman_robotpositioning.go
go-hep/extkalman
171f71fcb4c7e92bb97fa38e59f86dbe703ac634
[ "BSD-2-Clause" ]
null
null
null
examples/extkalman_robotpositioning.go
go-hep/extkalman
171f71fcb4c7e92bb97fa38e59f86dbe703ac634
[ "BSD-2-Clause" ]
null
null
null
package main import ( "fmt" "math" "code.google.com/p/gomatrix/matrix" "eurobot/extkalman" ) type position struct { X float64 Y float64 } func newPos(X, Y float64) *position { return &position{X,Y} } func main() { // Beacon positions var beaconA = newPos( 0.0, 0.0) var beaconB = newPos( 0.0, 2000.0) var beaconC = newPos(3000.0, 1000.0) // First state var x0 matrix.Matrix = matrix.MakeDenseMatrix([]float64{200, 0, 200, 0}, 4, 1) var P0 matrix.Matrix = matrix.Diagonal([]float64{10000, 100, 10000, 100}) fmt.Printf(">init:\n") fmt.Printf("x0:\n%v\n\n", x0) fmt.Printf("P0:\n%v\n\n", P0) // x(k+1) = Ax + Bu + Ww var W matrix.Matrix = matrix.MakeDenseMatrix([]float64{ 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0}, 4, 2) fmt.Printf("> noise\n") fmt.Printf("W:\n%v\n\n", W) // Design var d = 0.01*0.01 var Q matrix.Matrix = matrix.Diagonal([]float64{d, d}) var R matrix.Matrix = matrix.Diagonal([]float64{d, d, d}) fmt.Printf(">Design\n") fmt.Printf("Q:\n%v\n\n", Q) fmt.Printf("R:\n%v\n\n", R) // Init filter var u matrix.Matrix = matrix.MakeDenseMatrix([]float64{0, 0}, 2, 1) var y matrix.Matrix = matrix.MakeDenseMatrix([]float64{1000, 1000, 3000}, 3, 1) // df(x,u)/dx dfdx := func(x, u matrix.Matrix) matrix.Matrix { // The process is independent of possition, df/dx = A T := 1.0 A := matrix.MakeDenseMatrix([]float64{ 1.0, T, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, T, 0.0, 0.0, 0.0, 1.0}, 4, 4) return A } // Estimated movement of robot given state x f := func(x, u matrix.Matrix) matrix.Matrix { // x(k+1) = Ax + Bu var A = dfdx(x, u) return matrix.Product(A, x) // Commented out: take motor gain in to account: /* var B matrix.Matrix = matrix.MakeDenseMatrix([]float64{ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}, 4, 2) return matrix.Sum( matrix.Product(A, x), matrix.Product(B, u)) */ } // dh(x,u)/dx dhdx := func(x matrix.Matrix) matrix.Matrix { // Linearisation of H around x(k) robot := newPos(x.Get(0, 0), x.Get(2, 0)) denA := math.Sqrt( math.Pow(robot.X-beaconA.X, 2.0) + math.Pow(robot.Y-beaconA.Y, 2.0) ) denB := math.Sqrt( math.Pow(robot.X-beaconB.X, 2.0) + math.Pow(robot.Y-beaconB.Y, 2.0) ) denC := math.Sqrt( math.Pow(robot.X-beaconC.X, 2.0) + math.Pow(robot.Y-beaconC.Y, 2.0) ) H := matrix.MakeDenseMatrix([]float64{ (robot.X-beaconA.X)/denA, 0.0, (robot.Y-beaconA.Y)/denA, 0.0, (robot.X-beaconB.X)/denB, 0.0, (robot.Y-beaconB.Y)/denB, 0.0, (robot.X-beaconC.X)/denC, 0.0, (robot.Y-beaconC.Y)/denC, 0.0}, 3, 4) return H } // Measure estimate given state x h:= func(x matrix.Matrix) matrix.Matrix { var robot = newPos(x.Get(0, 0), x.Get(2, 0)) var y matrix.Matrix = matrix.MakeDenseMatrix([]float64{ math.Sqrt( math.Pow(robot.X-beaconA.X, 2.0) + math.Pow(robot.Y-beaconA.Y, 2.0) ), math.Sqrt( math.Pow(robot.X-beaconB.X, 2.0) + math.Pow(robot.Y-beaconB.Y, 2.0) ), math.Sqrt( math.Pow(robot.X-beaconC.X, 2.0) + math.Pow(robot.Y-beaconC.Y, 2.0) )}, 3, 1) return y } // State variable var x matrix.Matrix // Initalize kalman filter var filter = extkalman.ExtendedKalman(W, R, Q, x0, P0, f, dfdx, h, dhdx) // Run filter fmt.Printf("Running:\n") for { x = filter.Step(y, u) fmt.Printf("x:\n%v\n\n", x) } }
25.604651
91
0.614593
9a37590d71c1ab378617d6e66388d57f8a6a99f6
247
css
CSS
src/components/blackjack/Table.css
codegard1/codegard1-gatsby
b28360e6124cbe75845b62ec4747712ca1895946
[ "MIT" ]
null
null
null
src/components/blackjack/Table.css
codegard1/codegard1-gatsby
b28360e6124cbe75845b62ec4747712ca1895946
[ "MIT" ]
2
2021-08-16T15:36:53.000Z
2021-08-17T14:44:21.000Z
src/components/blackjack/Table.css
codegard1/codegard1-gatsby
b28360e6124cbe75845b62ec4747712ca1895946
[ "MIT" ]
null
null
null
div#Table { background-color: ghostwhite; border-radius: 1.5em; box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4); box-sizing: content-box; height: 100%; margin: 0 auto; padding: 1em; min-height: 200px; min-width: 350px; width: 95%; }
19
44
0.639676
5f6671ecb2ae3420ca50ecd5107be2e4622c1f0d
826
ts
TypeScript
packages/orm-integration/src/test.ts
Rush/deepkit-framework
60a50d64d553fa2adc316481e1cfeda8873771de
[ "MIT" ]
467
2020-09-15T18:51:20.000Z
2022-03-31T23:29:15.000Z
packages/orm-integration/src/test.ts
Rush/deepkit-framework
60a50d64d553fa2adc316481e1cfeda8873771de
[ "MIT" ]
113
2020-09-14T21:03:36.000Z
2022-03-31T20:02:05.000Z
packages/orm-integration/src/test.ts
Rush/deepkit-framework
60a50d64d553fa2adc316481e1cfeda8873771de
[ "MIT" ]
32
2020-09-17T22:29:44.000Z
2022-03-31T14:06:22.000Z
import { ClassSchema } from '@deepkit/type'; import { Database, DatabaseAdapter } from '@deepkit/orm'; import { ClassType } from '@deepkit/core'; export type DatabaseFactory = (entities?: (ClassSchema | ClassType)[]) => Promise<Database>; export function executeTest(test: (factory: DatabaseFactory) => any, factory: DatabaseFactory): () => Promise<void> { let databases: Database<any>[] = []; async function collectedFactory(entities?: (ClassSchema | ClassType)[]): Promise<Database> { const database = await factory(entities); databases.push(database); return database; } return async () => { try { await test(collectedFactory); } finally { for (const db of databases) { db.disconnect(true); } } }; }
33.04
117
0.612591
dd851460d5244a56b8bfe46bf478ad62977e85d5
209
php
PHP
storage/framework/views/3f4e5854a60ffde93cb7e05ae1bd798c775dd502.php
Avetis90/shop-vendor-laravel
1eaee44dbd4ec50b4b561214c529d270ba3e6fa5
[ "MIT" ]
1
2021-03-14T21:57:12.000Z
2021-03-14T21:57:12.000Z
storage/framework/views/de51df0a48ea7a0f6a4839faee99b75d5ea34fbd.php
dangquocdung/sh0p1st
d7190a0db3415bda7e78a88cb09bf3a66d13e4cc
[ "MIT" ]
1
2018-10-19T19:32:19.000Z
2018-10-19T19:32:19.000Z
storage/framework/views/de51df0a48ea7a0f6a4839faee99b75d5ea34fbd.php
dangquocdung/sh0p1st
d7190a0db3415bda7e78a88cb09bf3a66d13e4cc
[ "MIT" ]
3
2018-10-22T13:17:47.000Z
2021-03-14T21:57:58.000Z
<footer id="footer" class="footer-wrapper"> <?php echo $__env->make( 'frontend-templates.footer.black-crazy.black-crazy' , array_except(get_defined_vars(), array('__data', '__path')))->render(); ?> </footer>
69.666667
155
0.708134
33156382baf687b9fd221a48d7bcf67c2edeac93
4,124
py
Python
src/attendance/card_reader.py
JakubBatel/Attendance-Recorder
18d7d019d0284b7fcccf5bbbfc450ba70c922fc2
[ "MIT" ]
null
null
null
src/attendance/card_reader.py
JakubBatel/Attendance-Recorder
18d7d019d0284b7fcccf5bbbfc450ba70c922fc2
[ "MIT" ]
null
null
null
src/attendance/card_reader.py
JakubBatel/Attendance-Recorder
18d7d019d0284b7fcccf5bbbfc450ba70c922fc2
[ "MIT" ]
null
null
null
from .resources.config import config from .utils import reverse_endianness from abc import ABC from abc import abstractmethod from logging import getLogger from logging import Logger from time import sleep from typing import Final import re import serial class ICardReader(ABC): """Class representation of card reader.""" @abstractmethod def read_card(self, raise_if_no_data: bool = False) -> str: """Read one card and returns the data as a hex string. Args: raise_if_no_data: If True the NoDataException is raised if no data are present. Returns: Hex string representation of the data. Raises: NoDataException: If raise_if_no_data is set to True and no data was read. """ pass class InvalidDataException(Exception): """Exception used when card data are not valid.""" def __init__(self, message): """Init exception with message. Args: message: Error message. """ super().__init__(message) class NoDataException(Exception): """Exception used when no card data was read.""" def __init__(self, message): """Init exception with message. Args: message: Error message. """ super().__init__(message) class CardReader(ICardReader): """Class representation of physical card reader. It reads data from physical card reader using serial communication. It is configured using config file (config.ini in resources folder). """ INIT_BYTE: Final = b'\x02' CARD_SIZE: Final = 10 PORT: Final = config['CardReader']['devPath'] BAUDRATE: Final = int(config['CardReader']['baudrate']) PARITY: Final = getattr(serial, config['CardReader']['parity']) STOPBITS: Final = getattr(serial, config['CardReader']['stopbits']) BYTESIZE: Final = getattr(serial, config['CardReader']['bytesize']) TIMEOUT: Final = float(config['CardReader']['timeout']) CARD_REGEX: Final = re.compile('^[0-9a-f]{10}$') def __init__(self): """Init logger and create new Serial object for serial communication based on configuration.""" self.logger: Logger = getLogger(__name__) self._port = serial.Serial( port=CardReader.PORT, baudrate=CardReader.BAUDRATE, parity=CardReader.PARITY, stopbits=CardReader.STOPBITS, bytesize=CardReader.BYTESIZE, timeout=CardReader.TIMEOUT ) def read_card(self, raise_if_no_data: bool = False) -> str: """Read one card using serial communication. This method ends only when some data are red or until times out. If no card data are present operation is retried 0.5 second later. Args: raise_if_no_data: If true the NoDataException is raised if no data are present. Returns: Hex string representation of card data. Raises: NoDataException: If raise_if_no_data is set to True and no data was read. InvalidDataException: If card data are corrupted. """ while True: byte = self._port.read() if byte == b'': self.logger.debug('No card data.') if raise_if_no_data: raise NoDataException('No card data was read.') else: sleep(0.5) continue if byte != CardReader.INIT_BYTE: self.logger.debug('Invalid initial sequence.') continue data = self._port.read(CardReader.CARD_SIZE) card: str = reverse_endianness(data.decode('ascii')) if not CardReader.CARD_REGEX.match(card): self.logger.debug('Incomplete or corrupted data.') raise InvalidDataException( 'Card data are invalid - incomplete or corrupted data.') self.logger.info(card + ' was read') while self._port.read() != b'': continue # consume all residual data return card
31.242424
103
0.617119
85bad1ce1ac00a5b033491ee01cc83f7a38f06cc
31
js
JavaScript
polyfill.js
poland20/Poland2.0
ac92bea31780f4c234621b959119cf3bf682bfb1
[ "MIT" ]
642
2015-01-20T08:07:08.000Z
2022-03-31T03:28:05.000Z
polyfill.js
poland20/Poland2.0
ac92bea31780f4c234621b959119cf3bf682bfb1
[ "MIT" ]
102
2015-03-27T13:21:01.000Z
2022-01-10T21:46:47.000Z
polyfill.js
poland20/Poland2.0
ac92bea31780f4c234621b959119cf3bf682bfb1
[ "MIT" ]
134
2015-01-11T01:02:06.000Z
2022-03-15T12:35:25.000Z
import 'intersection-observer';
31
31
0.83871
b2ee1fd8d6c226332f2055e2d1c443475db998ec
2,442
py
Python
omop_cdm/utility_programs/load_concept_files_into_db.py
jhajagos/CommonDataModelMapper
65d2251713e5581b76cb16e36424d61fb194c901
[ "Apache-2.0" ]
1
2019-06-14T02:26:35.000Z
2019-06-14T02:26:35.000Z
omop_cdm/utility_programs/load_concept_files_into_db.py
jhajagos/CommonDataModelMapper
65d2251713e5581b76cb16e36424d61fb194c901
[ "Apache-2.0" ]
null
null
null
omop_cdm/utility_programs/load_concept_files_into_db.py
jhajagos/CommonDataModelMapper
65d2251713e5581b76cb16e36424d61fb194c901
[ "Apache-2.0" ]
1
2019-08-12T20:19:28.000Z
2019-08-12T20:19:28.000Z
import argparse import json import sys import os try: from utility_functions import load_csv_files_into_db, generate_vocabulary_load except(ImportError): sys.path.insert(0, os.path.abspath(os.path.join(os.path.split(__file__)[0], os.path.pardir, os.path.pardir, "src"))) from utility_functions import load_csv_files_into_db, generate_vocabulary_load def main(vocab_directory, connection_string, schema, vocabularies=["CONCEPT"]): vocab_list = generate_vocabulary_load(vocab_directory, vocabularies) vocab_data_dict = {} for pair in vocab_list: vocab_data_dict[pair[1]] = pair[0] load_csv_files_into_db(connection_string, vocab_data_dict, schema_ddl=None, indices_ddl=None, i_print_update=1000, truncate=True, schema=schema, delimiter="\t") if __name__ == "__main__": arg_parse_obj = argparse.ArgumentParser(description="Load concept/vocabulary files into database") arg_parse_obj.add_argument("-c", "--config-file-name", dest="config_file_name", help="JSON config file", default="../hi_config.json") arg_parse_obj.add_argument("--connection-uri", dest="connection_uri", default=None) arg_parse_obj.add_argument("--schema", dest="schema", default=None) arg_parse_obj.add_argument("--load-concept_ancestor", default=False, action="store_true", dest="load_concept_ancestor") arg_parse_obj.add_argument("--full-concept-files", default=False, action="store_true", dest="load_full_concept_files") arg_obj = arg_parse_obj.parse_args() print("Reading config file '%s'" % arg_obj.config_file_name) with open(arg_obj.config_file_name) as f: config = json.load(f) if arg_obj.connection_uri is None: connection_uri = config["connection_uri"] else: connection_uri = arg_obj.connection_uri if arg_obj.schema is None: schema = config["schema"] else: schema = arg_obj.schema if arg_obj.load_full_concept_files: vocabularies_to_load = ["CONCEPT", "CONCEPT_ANCESTOR", "CONCEPT_CLASS", "CONCEPT_RELATIONSHIP", "CONCEPT_SYNONYM", "DOMAIN", "DRUG_STRENGTH", "RELATIONSHIP", "VOCABULARY"] elif arg_obj.load_concept_ancestor: vocabularies_to_load = ["CONCEPT", "CONCEPT_ANCESTOR"] else: vocabularies_to_load = ["CONCEPT"] main(config["json_map_directory"], connection_uri, schema, vocabularies=vocabularies_to_load)
37
137
0.72154
c371de5c38a5072dce0947d71a6a4dab5b525638
5,363
go
Go
service/open_api/order/give_order.go
studytogo/jcc_project
10721fbab0281ef381a6b0e36ecdf82a3b7d0816
[ "Apache-2.0" ]
1
2020-11-03T01:32:37.000Z
2020-11-03T01:32:37.000Z
service/open_api/order/give_order.go
studytogo/jcc_project
10721fbab0281ef381a6b0e36ecdf82a3b7d0816
[ "Apache-2.0" ]
null
null
null
service/open_api/order/give_order.go
studytogo/jcc_project
10721fbab0281ef381a6b0e36ecdf82a3b7d0816
[ "Apache-2.0" ]
null
null
null
package order import ( "errors" "fmt" "github.com/astaxie/beego/orm" "new_erp_agent_by_go/helper/util" "new_erp_agent_by_go/models/centerGoods" "new_erp_agent_by_go/models/childGoods" "new_erp_agent_by_go/models/goods" "new_erp_agent_by_go/models/jccBoss" "new_erp_agent_by_go/models/putOrder" "new_erp_agent_by_go/models/receiveOrder" "new_erp_agent_by_go/models/request" "strconv" "time" ) func UpdateGiveOrdersStatusById(params *request.GiveOrderStatus) error { //审批通过 if params.Status == 2 { db := orm.NewOrm() db.Begin() //查询代理进货单是否存在 //poExit := purchaseOrder.JccPurchaseOrder{Id:params.PurchaseOrderId} //err := purchaseOrder.CheckExistById(poExit) //if err != nil { // db.Rollback() // return errors.New("代理进货单不存在。。。") //} //查询代理进货单参数 //purchaseOrder_list,err := purchaseOrder.QueryPurchaseOrderById(params.PurchaseOrderId) //if err != nil { // db.Rollback() // return errors.New("获取代理进货单信息失败。。。") //} RDH := util.CreateGiveOrder() //生成赠送单 //根据ordersn查看获赠单是否已经添加 count, err := receiveOrder.QueryGiveOrderExsitByOrdersn(params.Fromorder) if err != nil { db.Rollback() return errors.New("赠送单查询失败。。。") } if count > 0 { db.Rollback() return errors.New("赠送单已存在。。。") } boss_companyid, err := jccBoss.QueryCompanyIdById(params.BossId) if err != nil { db.Rollback() return errors.New("查询失败。。。") } var giveOrderParams = new(receiveOrder.JccReceiveOrder) giveOrderParams.BossId = params.BossId giveOrderParams.Ordersn = params.Fromorder giveOrderParams.Status = 1 giveOrderParams.CompanyroomId = 0 giveOrderParams.SupplierId = 1 giveOrderParams.Type = 3 giveOrderParams.Kind = "online" giveOrderParams.AffCompany = boss_companyid giveOrderParams.CreatedAt = time.Now().Unix() giveOrderParams.Savetime = time.Now().Unix() giveOrderid, err := receiveOrder.AddGiveOrder(db, giveOrderParams) if err != nil { db.Rollback() return errors.New("赠送单生成失败。。。") } //生成入库单 var putOrderParams = new(putOrder.JccPutOrder) putOrderParams.RDh = RDH putOrderParams.Fromorder = params.Fromorder putOrderParams.Fromordertype = 4 putOrderParams.RStatus = 6 putOrderParams.OrderMoney = params.OrderMoney //putOrderParams.House1 = params.CompanyroomId putOrderParams.House = 0 putOrderParams.Shop = strconv.Itoa(boss_companyid) putOrderParams.Remark = params.Remark putOrderParams.CreatedAt = time.Now().Unix() putOrderParams.Auditor = params.BossId putOrderParams.CustomerId = params.BossId putOrderParams.RPeople = 1 putOrderParams.Operator, _ = strconv.Atoi(params.Approver) //查询是否已经添加 poExsit := putOrder.JccPutOrder{Fromorder: putOrderParams.Fromorder} exist := putOrder.QueryPutOrderExitByOrderId(poExsit) //报错,就是不存在,需要添加入库单,赠送单 if !exist { //入库单 _, err := putOrder.AddPutOrder(db, putOrderParams) if err != nil { db.Rollback() return errors.New("入库单生成失败。。。") } //赠品:代理商必须有,如果未进货或者删除,则报错 //加入判断中,否则会出现bug for id, num := range params.Gift { goodsid := id center_goods_list, err := centerGoods.QueryCenterGoodsById(goodsid) if err != nil { db.Rollback() return errors.New("查询商品中心失败。。。") } //fmt.Println(center_goods_list) //查询该公司是否存在该商品 goods_Exist := childGoods.JccGoods{Sku: center_goods_list.Sku, Companyid: boss_companyid, IsDel: 0} gid, err := goods.QueryExistBySkuAndCompany(goods_Exist) if err != nil { db.Rollback() fmt.Println(err) return errors.New("该公司不存在该商品或已删除。。。") } //查询商品信息 goods_list, err := goods.QuerygoodsById(gid) if err != nil { db.Rollback() return errors.New("查询商品失败。。。") } //构建赠送商品单 var giveGoodsParams = new(receiveOrder.JccReceiveGoods) giveGoodsParams.GoodsId = int(gid) giveGoodsParams.OrderId = int(giveOrderid) giveGoodsParams.BuyingPrice = goods_list.BuyingPrice giveGoodsParams.Num = float64(num) giveGoodsParams.UnitId = goods_list.UnitId giveGoodsParams.Money = 0 giveGoodsParams.CreatedAt = time.Now().Unix() giveGoodsParams.SupplierId = 1 //存入数据库 err = receiveOrder.AddGiveGoods(db, giveGoodsParams) if err != nil { db.Rollback() return errors.New("赠送商品单生成失败。。。") } //构建入库商品单 var putItemParams = new(putOrder.JccPutItem) putItemParams.UnitId = goods_list.UnitId putItemParams.GoodsId = int(gid) putItemParams.Number = float64(num) putItemParams.Rdh = RDH putItemParams.Price = goods_list.BuyingPrice putItemParams.Supplier = strconv.Itoa(1) putItemParams.Money = 0 //存入数据库 err = putOrder.AddPutItem(db, putItemParams) if err != nil { db.Rollback() return errors.New("出库商品单生成失败。。。") } ////增加或修改jcc_goods(防止事务套事务) //err = api.AddOnlineGoodsInfo(id,strconv.Itoa(boss_companyid)) //if err != nil { // db.Rollback() // return errors.New("新增商品失败。。。") //} } } db.Commit() return nil } //出库 if params.Status == 3 { db := orm.NewOrm() db.Begin() //更新赠送单状态 err := receiveOrder.CompletePurchaseOrderByOrdersn(db, params.Fromorder) if err != nil { db.Rollback() return errors.New("赠送单状态修改失败。。。") } //更新入库单状态 err = putOrder.UpdatePutOrder(db, params.Fromorder) if err != nil { db.Rollback() return errors.New("代理进货单状态修改失败。。。") } db.Commit() return nil } return nil }
27.932292
103
0.696625
90ed3d46ad50cbe9d7e77aafeb44f2ef308fd3b1
874
swift
Swift
VIPER/TS-VIPER.xctemplate/Inherited from Base/___FILEBASENAME___ViewController.swift
AntonPoltoratskyi/Xcode-Templates
25f11ad3cbfea078896a2e48a3f80f6f929048e5
[ "MIT" ]
1
2021-01-14T12:57:06.000Z
2021-01-14T12:57:06.000Z
VIPER/TS-VIPER.xctemplate/Inherited from Base/___FILEBASENAME___ViewController.swift
AntonPoltoratskyi/Xcode-Templates
25f11ad3cbfea078896a2e48a3f80f6f929048e5
[ "MIT" ]
1
2019-05-09T16:55:59.000Z
2019-05-09T16:59:14.000Z
VIPER/TS-VIPER.xctemplate/Inherited from Base/___FILEBASENAME___ViewController.swift
AntonPoltoratskyi/Xcode-Templates
25f11ad3cbfea078896a2e48a3f80f6f929048e5
[ "MIT" ]
null
null
null
//___FILEHEADER___ import UIKit import SnapKit final class ___VARIABLE_moduleName___ViewController: BaseVC, ___VARIABLE_moduleName___ViewInput { private let presenter: ___VARIABLE_moduleName___PresenterProtocol // MARK: - Views // MARK: - Init struct Dependencies { let presenter: ___VARIABLE_moduleName___PresenterProtocol } init(dependencies: Dependencies) { presenter = dependencies.presenter super.init(nibName: nil, bundle: nil) _presenter = presenter } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } // MARK: - Life Cycle override func initialize() { super.initialize() setupUI() } // MARK: - UI Setup private func setupUI() { } }
19.863636
97
0.620137
7d67675170ce625f0069bb8385bd5cb76e7c3c6d
2,953
html
HTML
index.html
abhisekhguptaa/mysite
1961822310c8c763d6ffd65714ab482c1b83b4cb
[ "MIT" ]
null
null
null
index.html
abhisekhguptaa/mysite
1961822310c8c763d6ffd65714ab482c1b83b4cb
[ "MIT" ]
null
null
null
index.html
abhisekhguptaa/mysite
1961822310c8c763d6ffd65714ab482c1b83b4cb
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Abhisekh's Portfolio</title> <link rel="stylesheet" href="styles.css"> <link rel="shortcut icon" href="images/favicon.ico"> <link href="https://fonts.googleapis.com/css?family=Merriweather|Montserrat|Sacramento" rel="stylesheet"> </head> <body> <div class="top-container"> <img class="top-cloud" src="images/cloud.png" alt="cloud-image"> <h1>I am Abhisekh</h1> <h2>A Software Developer Engineer</h2> <img class="bottom-cloud" src="images/cloud.png" alt="cloud-image"> <img src="images/mountain.png" alt="mountain-image"> </div> <div class="middle-container"> <div class="profile"> <img class="profile-pic" src="images/abhisekh.png" alt="My profile picture."> <h2>Hello.</h2> <p class="intro">A kid in his 20's creating websites like this one, fixing bugs, making pull requests. Aiming to impact the world one day through my code.</p> </div> <hr> <div class="skills"> <h2>My Skills.</h2> <div class="skill-row"> <img class="html5" src="images/html5.png" alt="html5 giphy"> <img class="css3" src="images/css3.png" alt="css3 giphy"> <h3>Front-End Development</h3> <p>Learned HTML & CSS way back in secondary school days because of exams ofcourse. Overtime gained wealth of experience. And planning to be a full stack developer.</p> </div> <div class="skill-row"> <img class="android" src="images/android.png" alt="android giphy"> <br> <h3>Android Development</h3> <p>After being inspired from a senior in our college doing freelancing and earning money, I too got inspired and thought to get my hands dirty in Android Development.</p> </div> <div class="skill-row"> <img class="coding" src="images/coding.png" alt="competitive coding gif"> <h3>Competitive Coding</h3> <p>I fell in love with C++ during my higher secondary days.Creating different functions, debugging the code, writing new snippets was a daily routine back then. Planning to start it again.</p> </div> </div> <hr> <div class="contact-me"> <h2>Get In Touch</h2> <h3>If you love Coffee as much as I do</h3> <p class="contact-message">Love Coffee as much as I do? Let's talk about how smoother they are! We can code while we enjoy Coffee.</p> <a class="btn" href="mailto:abhisekhgupta405@gmail.com">CONTACT ME</a> </div> </div> <div class="bottom-container"> <a class="footer-link" href="https://www.linkedin.com/in/abhisekhguptaa">LinkedIn</a> <a class="footer-link" href="https://instagram.com/abhisekhguptaa">Instagram</a> <a class="footer-link" href="https://facebook.com/abhisekh.gupta.9083">Facebook</a> <p class="copyright">© 2021 Abhisekh Gupta.</p> </div> </body> </html>
44.742424
201
0.644429
2e4351732c655ff2c28039ac04890a061761ca75
831
sql
SQL
egov/egov-bpa/src/main/resources/db/migration/main/V20190404152427__bpa_feeboundary_mappingtable.sql
eyrdworkspace/digit-bpa
3cb01dfb04fffd42a4931ddb104bc2f1dc47fd23
[ "OML" ]
2
2019-07-08T10:48:56.000Z
2020-06-15T20:26:28.000Z
egov/egov-bpa/src/main/resources/db/migration/main/V20190404152427__bpa_feeboundary_mappingtable.sql
mohbadar/digit-bpa
6b941a3a9472d7121c69a016fa2bb32d8a06c086
[ "MIT" ]
20
2019-09-24T03:25:02.000Z
2022-02-09T22:57:41.000Z
egov/egov-bpa/src/main/resources/db/migration/main/V20190404152427__bpa_feeboundary_mappingtable.sql
mohbadar/digit-bpa
6b941a3a9472d7121c69a016fa2bb32d8a06c086
[ "MIT" ]
17
2019-03-06T05:39:47.000Z
2022-03-02T13:34:37.000Z
create table EGBPA_FEEBOUNDARY_MAPPING( id bigint NOT NULL, boundary bigint NOT NULL, bpafeemapping bigint NOT NULL, amount bigint, createdby bigint NOT NULL, createddate timestamp without time zone NOT NULL, lastModifiedDate timestamp without time zone, lastModifiedBy bigint, version numeric NOT NULL, CONSTRAINT PK_FEEBOUNDARY_ID PRIMARY KEY (ID), CONSTRAINT FK_FEEBOUNDARY_BOUNDARY FOREIGN KEY (boundary) REFERENCES eg_boundary(ID), CONSTRAINT FK_FEEBOUNDARY_FEE FOREIGN KEY (bpafeemapping) REFERENCES egbpa_mstr_bpafeemapping(ID), CONSTRAINT FK_EGBPA_FEEBOUNDARY_MDFDBY FOREIGN KEY (lastModifiedBy) REFERENCES state.EG_USER (ID), CONSTRAINT FK_EGBPA_FEEBOUNDARY_CRTBY FOREIGN KEY (createdBy)REFERENCES state.EG_USER (ID) ); create sequence SEQ_EGBPA_FEEBOUNDARY_MAPPING;
46.166667
101
0.796631
d26159c68e402e62f1b7e0cec6db5cb1e6d6f71e
926
php
PHP
config/db.php
development2016/asiaebuy
68eb38186f4866c4de4740c48570ce1d2f400377
[ "BSD-3-Clause" ]
null
null
null
config/db.php
development2016/asiaebuy
68eb38186f4866c4de4740c48570ce1d2f400377
[ "BSD-3-Clause" ]
null
null
null
config/db.php
development2016/asiaebuy
68eb38186f4866c4de4740c48570ce1d2f400377
[ "BSD-3-Clause" ]
null
null
null
<?php //$cert = 'C:\xampp\htdocs\asiaebuy\compose.crt'; $cert = '/var/www/vhosts/asiaebuy.com/httpdocs/stage/compose.crt'; $ctx = stream_context_create(array( "ssl" => array( "cafile" => $cert, "allow_self_signed" => false, "verify_peer" => true, "verify_peer_name" => true, "verify_expiry" => true, ), )); return [ 'class' => '\yii\mongodb\Connection', 'dsn' => 'mongodb://asiaebuy:Amtujpino.2017@aws-ap-southeast-1-portal.2.dblayer.com:15429/asiaebuy' 'options' => [ 'ssl' => true ], 'driverOptions' => [ 'context' => $ctx ] ]; /* return [ 'class' => '\yii\mongodb\Connection', 'dsn' => 'mongodb://asia:Amtujpino.1@127.0.0.1:27017/asiaebuy', //'class' => '\yii\mongodb\Connection', //'dsn' => 'mongodb://asia:Amtujpino.1@localhost:27017/asiaebuy', // for tem use this connect gii for mongo ]; */
21.045455
103
0.570194
3e383d6688d67f979a0287bbe166888f615f9fbb
485
h
C
_programs/cpp/src/icp/icp.h
tatsy/cpp-python-beginners
66ee72571bda1f623f2032122fb9657d3776bce3
[ "MIT" ]
1
2020-07-23T12:35:56.000Z
2020-07-23T12:35:56.000Z
_programs/cpp/src/icp/icp.h
tatsy/cpp-python-beginners
66ee72571bda1f623f2032122fb9657d3776bce3
[ "MIT" ]
null
null
null
_programs/cpp/src/icp/icp.h
tatsy/cpp-python-beginners
66ee72571bda1f623f2032122fb9657d3776bce3
[ "MIT" ]
2
2020-07-10T10:20:53.000Z
2021-05-20T09:04:47.000Z
#pragma once #include <vector> #include <Eigen/Core> #include "common/vec3.h" enum class ICPMetric { Point2Point = 0x00, Point2Plane = 0x01, }; void rigidICP(const std::vector<Vec3> &target, const std::vector<Vec3> &targetNorm, std::vector<Vec3> &source, std::vector<Vec3> &sourceNorm, ICPMetric metric, int maxIters = 100, double tolerance = 1.0e-4, bool verbose = false);
22.045455
50
0.56701
7c6771f01b741184d9e2fc59a18d1051065aa2e8
1,198
kt
Kotlin
compose/src/main/java/androidx/compose/foundation/samples/DarkThemeSample.kt
arkivanov/Jetpack-Compose-Playground
46835551a488a4dba913d272d5f01bcd6c905f2a
[ "MIT" ]
null
null
null
compose/src/main/java/androidx/compose/foundation/samples/DarkThemeSample.kt
arkivanov/Jetpack-Compose-Playground
46835551a488a4dba913d272d5f01bcd6c905f2a
[ "MIT" ]
null
null
null
compose/src/main/java/androidx/compose/foundation/samples/DarkThemeSample.kt
arkivanov/Jetpack-Compose-Playground
46835551a488a4dba913d272d5f01bcd6c905f2a
[ "MIT" ]
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.samples import androidx.compose.Composable import androidx.ui.background import androidx.ui.core.Modifier import androidx.ui.foundation.Box import androidx.ui.foundation.isSystemInDarkTheme import androidx.ui.graphics.Color import androidx.ui.layout.Stack import androidx.ui.layout.preferredSize import androidx.ui.unit.dp @Composable fun DarkThemeSample() { val dark = isSystemInDarkTheme() val color = if (dark) Color.White else Color.Black Stack { Box(Modifier.preferredSize(50.dp).background(color = color)) } }
29.95
75
0.761269
716ca261ddbd8148e49828be3b3f9932150c150c
18,643
sql
SQL
sys_menu.sql
LBaaahahaha/aaa
6021245e437bb8ef2a6066c4066c3d2b6c4c47db
[ "MIT" ]
null
null
null
sys_menu.sql
LBaaahahaha/aaa
6021245e437bb8ef2a6066c4066c3d2b6c4c47db
[ "MIT" ]
null
null
null
sys_menu.sql
LBaaahahaha/aaa
6021245e437bb8ef2a6066c4066c3d2b6c4c47db
[ "MIT" ]
null
null
null
/* Navicat MySQL Data Transfer Source Server : DB Source Server Version : 50647 Source Host : localhost:3306 Source Database : ry Target Server Type : MYSQL Target Server Version : 50647 File Encoding : 65001 Date: 2020-05-11 13:52:40 */ SET FOREIGN_KEY_CHECKS=0; -- ---------------------------- -- Table structure for sys_menu -- ---------------------------- DROP TABLE IF EXISTS `sys_menu`; CREATE TABLE `sys_menu` ( `menu_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '菜单ID', `menu_name` varchar(50) NOT NULL COMMENT '菜单名称', `parent_id` bigint(20) DEFAULT '0' COMMENT '父菜单ID', `order_num` int(4) DEFAULT '0' COMMENT '显示顺序', `path` varchar(200) DEFAULT '' COMMENT '路由地址', `component` varchar(255) DEFAULT NULL COMMENT '组件路径', `is_frame` int(1) DEFAULT '1' COMMENT '是否为外链(0是 1否)', `menu_type` char(1) DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮)', `visible` char(1) DEFAULT '0' COMMENT '菜单状态(0显示 1隐藏)', `status` char(1) DEFAULT '0' COMMENT '菜单状态(0正常 1停用)', `perms` varchar(100) DEFAULT NULL COMMENT '权限标识', `icon` varchar(100) DEFAULT '#' COMMENT '菜单图标', `create_by` varchar(64) DEFAULT '' COMMENT '创建者', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_by` varchar(64) DEFAULT '' COMMENT '更新者', `update_time` datetime DEFAULT NULL COMMENT '更新时间', `remark` varchar(500) DEFAULT '' COMMENT '备注', PRIMARY KEY (`menu_id`) ) ENGINE=InnoDB AUTO_INCREMENT=2030 DEFAULT CHARSET=utf8 COMMENT='菜单权限表'; -- ---------------------------- -- Records of sys_menu -- ---------------------------- INSERT INTO `sys_menu` VALUES ('1', '系统管理', '0', '1', 'system', null, '1', 'M', '0', '0', '', 'system', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '系统管理目录'); INSERT INTO `sys_menu` VALUES ('2', '系统监控', '0', '2', 'monitor', null, '1', 'M', '0', '0', '', 'monitor', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '系统监控目录'); INSERT INTO `sys_menu` VALUES ('3', '系统工具', '0', '3', 'tool', null, '1', 'M', '0', '0', '', 'tool', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '系统工具目录'); INSERT INTO `sys_menu` VALUES ('4', '若依官网', '0', '4', 'http://ruoyi.vip', null, '0', 'M', '0', '0', '', 'guide', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '若依官网地址'); INSERT INTO `sys_menu` VALUES ('100', '用户管理', '1', '5', 'user', 'system/user/index', '1', 'C', '0', '0', 'system:user:list', 'user', 'admin', '2018-03-16 11:33:00', 'admin', '2020-05-06 23:26:34', '用户管理菜单'); INSERT INTO `sys_menu` VALUES ('101', '角色管理', '1', '4', 'role', 'system/role/index', '1', 'C', '0', '0', 'system:role:list', 'peoples', 'admin', '2018-03-16 11:33:00', 'admin', '2020-05-06 23:27:52', '角色管理菜单'); INSERT INTO `sys_menu` VALUES ('102', '菜单管理', '1', '11', 'menu', 'system/menu/index', '1', 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', '2018-03-16 11:33:00', 'admin', '2020-05-06 23:28:04', '菜单管理菜单'); INSERT INTO `sys_menu` VALUES ('103', '部门管理', '1', '2', 'dept', 'system/dept/index', '1', 'C', '0', '0', 'system:dept:list', 'tree', 'admin', '2018-03-16 11:33:00', 'admin', '2020-05-06 23:27:30', '部门管理菜单'); INSERT INTO `sys_menu` VALUES ('104', '岗位管理', '1', '8', 'post', 'system/post/index', '1', 'C', '0', '0', 'system:post:list', 'post', 'admin', '2018-03-16 11:33:00', 'admin', '2020-05-06 23:26:43', '岗位管理菜单'); INSERT INTO `sys_menu` VALUES ('105', '字典管理', '1', '10', 'dict', 'system/dict/index', '1', 'C', '0', '0', 'system:dict:list', 'dict', 'admin', '2018-03-16 11:33:00', 'admin', '2020-05-06 23:28:21', '字典管理菜单'); INSERT INTO `sys_menu` VALUES ('106', '参数设置', '1', '7', 'config', 'system/config/index', '1', 'C', '0', '0', 'system:config:list', 'edit', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '参数设置菜单'); INSERT INTO `sys_menu` VALUES ('107', '通知公告', '1', '8', 'notice', 'system/notice/index', '1', 'C', '0', '0', 'system:notice:list', 'message', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '通知公告菜单'); INSERT INTO `sys_menu` VALUES ('108', '日志管理', '1', '9', 'log', 'system/log/index', '1', 'M', '0', '0', '', 'log', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '日志管理菜单'); INSERT INTO `sys_menu` VALUES ('109', '在线用户', '2', '1', 'online', 'monitor/online/index', '1', 'C', '0', '0', 'monitor:online:list', 'online', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '在线用户菜单'); INSERT INTO `sys_menu` VALUES ('110', '定时任务', '2', '2', 'job', 'monitor/job/index', '1', 'C', '0', '0', 'monitor:job:list', 'job', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '定时任务菜单'); INSERT INTO `sys_menu` VALUES ('111', '数据监控', '2', '3', 'druid', 'monitor/druid/index', '1', 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '数据监控菜单'); INSERT INTO `sys_menu` VALUES ('112', '服务监控', '2', '4', 'server', 'monitor/server/index', '1', 'C', '0', '0', 'monitor:server:list', 'server', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '服务监控菜单'); INSERT INTO `sys_menu` VALUES ('113', '表单构建', '3', '1', 'build', 'tool/build/index', '1', 'C', '0', '0', 'tool:build:list', 'build', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '表单构建菜单'); INSERT INTO `sys_menu` VALUES ('114', '代码生成', '3', '2', 'gen', 'tool/gen/index', '1', 'C', '0', '0', 'tool:gen:list', 'code', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '代码生成菜单'); INSERT INTO `sys_menu` VALUES ('115', '系统接口', '3', '3', 'swagger', 'tool/swagger/index', '1', 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '系统接口菜单'); INSERT INTO `sys_menu` VALUES ('500', '操作日志', '108', '1', 'operlog', 'monitor/operlog/index', '1', 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '操作日志菜单'); INSERT INTO `sys_menu` VALUES ('501', '登录日志', '108', '2', 'logininfor', 'monitor/logininfor/index', '1', 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', '登录日志菜单'); INSERT INTO `sys_menu` VALUES ('1001', '用户查询', '100', '1', '', '', '1', 'F', '0', '0', 'system:user:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1002', '用户新增', '100', '2', '', '', '1', 'F', '0', '0', 'system:user:add', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1003', '用户修改', '100', '3', '', '', '1', 'F', '0', '0', 'system:user:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1004', '用户删除', '100', '4', '', '', '1', 'F', '0', '0', 'system:user:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1005', '用户导出', '100', '5', '', '', '1', 'F', '0', '0', 'system:user:export', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1006', '用户导入', '100', '6', '', '', '1', 'F', '0', '0', 'system:user:import', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1007', '重置密码', '100', '7', '', '', '1', 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1008', '角色查询', '101', '1', '', '', '1', 'F', '0', '0', 'system:role:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1009', '角色新增', '101', '2', '', '', '1', 'F', '0', '0', 'system:role:add', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1010', '角色修改', '101', '3', '', '', '1', 'F', '0', '0', 'system:role:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1011', '角色删除', '101', '4', '', '', '1', 'F', '0', '0', 'system:role:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1012', '角色导出', '101', '5', '', '', '1', 'F', '0', '0', 'system:role:export', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1013', '菜单查询', '102', '1', '', '', '1', 'F', '0', '0', 'system:menu:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1014', '菜单新增', '102', '2', '', '', '1', 'F', '0', '0', 'system:menu:add', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1015', '菜单修改', '102', '3', '', '', '1', 'F', '0', '0', 'system:menu:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1016', '菜单删除', '102', '4', '', '', '1', 'F', '0', '0', 'system:menu:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1017', '部门查询', '103', '1', '', '', '1', 'F', '0', '0', 'system:dept:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1018', '部门新增', '103', '2', '', '', '1', 'F', '0', '0', 'system:dept:add', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1019', '部门修改', '103', '3', '', '', '1', 'F', '0', '0', 'system:dept:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1020', '部门删除', '103', '4', '', '', '1', 'F', '0', '0', 'system:dept:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1021', '岗位查询', '104', '1', '', '', '1', 'F', '0', '0', 'system:post:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1022', '岗位新增', '104', '2', '', '', '1', 'F', '0', '0', 'system:post:add', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1023', '岗位修改', '104', '3', '', '', '1', 'F', '0', '0', 'system:post:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1024', '岗位删除', '104', '4', '', '', '1', 'F', '0', '0', 'system:post:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1025', '岗位导出', '104', '5', '', '', '1', 'F', '0', '0', 'system:post:export', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1026', '字典查询', '105', '1', '#', '', '1', 'F', '0', '0', 'system:dict:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1027', '字典新增', '105', '2', '#', '', '1', 'F', '0', '0', 'system:dict:add', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1028', '字典修改', '105', '3', '#', '', '1', 'F', '0', '0', 'system:dict:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1029', '字典删除', '105', '4', '#', '', '1', 'F', '0', '0', 'system:dict:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1030', '字典导出', '105', '5', '#', '', '1', 'F', '0', '0', 'system:dict:export', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1031', '参数查询', '106', '1', '#', '', '1', 'F', '0', '0', 'system:config:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1032', '参数新增', '106', '2', '#', '', '1', 'F', '0', '0', 'system:config:add', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1033', '参数修改', '106', '3', '#', '', '1', 'F', '0', '0', 'system:config:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1034', '参数删除', '106', '4', '#', '', '1', 'F', '0', '0', 'system:config:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1035', '参数导出', '106', '5', '#', '', '1', 'F', '0', '0', 'system:config:export', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1036', '公告查询', '107', '1', '#', '', '1', 'F', '0', '0', 'system:notice:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1037', '公告新增', '107', '2', '#', '', '1', 'F', '0', '0', 'system:notice:add', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1038', '公告修改', '107', '3', '#', '', '1', 'F', '0', '0', 'system:notice:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1039', '公告删除', '107', '4', '#', '', '1', 'F', '0', '0', 'system:notice:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1040', '操作查询', '500', '1', '#', '', '1', 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1041', '操作删除', '500', '2', '#', '', '1', 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1042', '日志导出', '500', '4', '#', '', '1', 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1043', '登录查询', '501', '1', '#', '', '1', 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1044', '登录删除', '501', '2', '#', '', '1', 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1045', '日志导出', '501', '3', '#', '', '1', 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1046', '在线查询', '109', '1', '#', '', '1', 'F', '0', '0', 'monitor:online:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1047', '批量强退', '109', '2', '#', '', '1', 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1048', '单条强退', '109', '3', '#', '', '1', 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1049', '任务查询', '110', '1', '#', '', '1', 'F', '0', '0', 'monitor:job:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1050', '任务新增', '110', '2', '#', '', '1', 'F', '0', '0', 'monitor:job:add', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1051', '任务修改', '110', '3', '#', '', '1', 'F', '0', '0', 'monitor:job:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1052', '任务删除', '110', '4', '#', '', '1', 'F', '0', '0', 'monitor:job:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1053', '状态修改', '110', '5', '#', '', '1', 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1054', '任务导出', '110', '7', '#', '', '1', 'F', '0', '0', 'monitor:job:export', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1055', '生成查询', '114', '1', '#', '', '1', 'F', '0', '0', 'tool:gen:query', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1056', '生成修改', '114', '2', '#', '', '1', 'F', '0', '0', 'tool:gen:edit', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1057', '生成删除', '114', '3', '#', '', '1', 'F', '0', '0', 'tool:gen:remove', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1058', '导入代码', '114', '2', '#', '', '1', 'F', '0', '0', 'tool:gen:import', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1059', '预览代码', '114', '4', '#', '', '1', 'F', '0', '0', 'tool:gen:preview', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('1060', '生成代码', '114', '5', '#', '', '1', 'F', '0', '0', 'tool:gen:code', '#', 'admin', '2018-03-16 11:33:00', 'ry', '2018-03-16 11:33:00', ''); INSERT INTO `sys_menu` VALUES ('2012', '组织属性', '1', '1', 'attribute', 'system/attribute/index', '1', 'C', '0', '0', 'system:attribute:list', 'table', 'admin', '2018-03-01 00:00:00', 'admin', '2020-05-06 22:17:35', '组织属性菜单'); INSERT INTO `sys_menu` VALUES ('2013', '组织属性查询', '2012', '1', '#', '', '1', 'F', '0', '0', 'system:attribute:query', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', ''); INSERT INTO `sys_menu` VALUES ('2014', '组织属性新增', '2012', '2', '#', '', '1', 'F', '0', '0', 'system:attribute:add', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', ''); INSERT INTO `sys_menu` VALUES ('2015', '组织属性修改', '2012', '3', '#', '', '1', 'F', '0', '0', 'system:attribute:edit', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', ''); INSERT INTO `sys_menu` VALUES ('2016', '组织属性删除', '2012', '4', '#', '', '1', 'F', '0', '0', 'system:attribute:remove', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', ''); INSERT INTO `sys_menu` VALUES ('2017', '组织属性导出', '2012', '5', '#', '', '1', 'F', '0', '0', 'system:attribute:export', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', ''); INSERT INTO `sys_menu` VALUES ('2024', '历史组织', '1', '3', 'olddept', 'system/olddept/index', '1', 'C', '0', '0', 'system:olddept:list', 'tab', 'admin', '2018-03-01 00:00:00', 'admin', '2020-05-06 23:26:25', '历史组织菜单'); INSERT INTO `sys_menu` VALUES ('2025', '历史组织查询', '2024', '1', '#', '', '1', 'F', '0', '0', 'system:olddept:query', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', ''); INSERT INTO `sys_menu` VALUES ('2029', '历史组织导出', '2024', '5', '#', '', '1', 'F', '0', '0', 'system:olddept:export', '#', 'admin', '2018-03-01 00:00:00', 'ry', '2018-03-01 00:00:00', '');
136.080292
232
0.53264
ffffe768d1404119299ae19cf4fa77c64ae6a8ff
2,932
html
HTML
com/radityalabs/Python/origin/movie/1167.html
radityagumay/BenchmarkSentimentAnalysis_2
e509a4e749271da701ce9da1d9f16cdd78dcdf40
[ "Apache-2.0" ]
3
2017-06-08T01:17:55.000Z
2019-06-02T10:52:36.000Z
com/radityalabs/Python/origin/movie/1167.html
radityagumay/BenchmarkSentimentAnalysis_2
e509a4e749271da701ce9da1d9f16cdd78dcdf40
[ "Apache-2.0" ]
null
null
null
com/radityalabs/Python/origin/movie/1167.html
radityagumay/BenchmarkSentimentAnalysis_2
e509a4e749271da701ce9da1d9f16cdd78dcdf40
[ "Apache-2.0" ]
null
null
null
<HTML><HEAD> <TITLE>Review for Ucieczka z kina 'Wolnosc' (1991)</TITLE> <LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css"> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0103150">Ucieczka z kina 'Wolnosc' (1991)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?Alan+Jay">Alan Jay</A></H3><HR WIDTH="40%" SIZE="4"> <PRE> ESCAPE FROM THE LIBERTY CINEMA A film review by Alan Jay Copyright 1991 Alan Jay</PRE> <PRE>Director: Wojciech Marczewski Leading Players: Janusz Gajos, Zbigniew Zamachowski Poland 1990 Shown at the 35th London Film Festival.</PRE> <P>Capsule: This film is about a censor and a film where the actors decide to take their life into their own hands. (+0.5)</P> <P> ESCAPE FROM THE LIBERTY CINEMA centres around a provincial Polish censor and the problems that happen when the actors in a film playing in the "Liberty" Cinema decide they can't take it any more and go on strike. The film plays homage to Woody Allen's PURPLE ROSE OF CAIRO and even includes an excerpt from it.</P> <P> The film is an odd mix a comedy about a serious subject that varies from being truly hilarious to very serious. This means that the film is, in my opinion, not quite walking the tightrope perfectly but making a good attempt.</P> <P> The film includes some scenes from THE PURPLE ROSE OF CAIRO which Woody Allen arranged to have provided royalty free after seeing the script. This segment where the senior Party officials are called in to sort out the problem is one of the best in the film as it shows how farcical the whole thing has become.</P> <P> I'm not sure that I would recommend this film to my friends but it makes its points sufficiently well that I do not feel that I wasted my time seeing it.</P> <PRE>-- Alan Jay - Editor Connectivity The IBM PC User Group, PO Box 360, Tel. 081-863 1191 Fax: 081-863 6095 Harrow HA1 4LQ, ENGLAND Email: <A HREF="mailto:alanj@ibmpcug.CO.UK">alanj@ibmpcug.CO.UK</A> Path: ..!ukc!ibmpcug!alanj . </PRE> <HR><P CLASS=flush><SMALL>The review above was posted to the <A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR> The Internet Movie Database accepts no responsibility for the contents of the review and has no editorial control. Unless stated otherwise, the copyright belongs to the author.<BR> Please direct comments/criticisms of the review to relevant newsgroups.<BR> Broken URLs inthe reviews are the responsibility of the author.<BR> The formatting of the review is likely to differ from the original due to ASCII to HTML conversion. </SMALL></P> <P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P> </P></BODY></HTML>
54.296296
203
0.72442
3edde17ee321893010b8b73f1365547641e0ef5a
4,550
c
C
ompi/request/grequestx.c
nuriallv/ompi
2443bbd42f9e1da385c68b7cc9dab169131cc03a
[ "BSD-3-Clause-Open-MPI" ]
2
2017-11-22T09:35:38.000Z
2017-11-22T10:02:17.000Z
ompi/request/grequestx.c
nuriallv/ompi
2443bbd42f9e1da385c68b7cc9dab169131cc03a
[ "BSD-3-Clause-Open-MPI" ]
1
2021-04-26T14:41:51.000Z
2021-04-27T00:14:24.000Z
ompi/request/grequestx.c
nuriallv/ompi
2443bbd42f9e1da385c68b7cc9dab169131cc03a
[ "BSD-3-Clause-Open-MPI" ]
2
2019-01-24T18:45:03.000Z
2019-09-28T14:36:16.000Z
/* * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. * Copyright (c) 2004-2016 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ #include "ompi_config.h" #include "ompi/communicator/communicator.h" #include "ompi/request/grequest.h" #include "ompi/mpi/fortran/base/fint_2_int.h" #include "ompi/request/grequestx.h" static bool requests_initialized = false; static opal_list_t requests; static opal_atomic_int32_t active_requests = 0; static bool in_progress = false; static opal_mutex_t lock; static int grequestx_progress(void) { ompi_grequest_t *request, *next; OPAL_THREAD_LOCK(&lock); if (!in_progress) { in_progress = true; OPAL_LIST_FOREACH_SAFE(request, next, &requests, ompi_grequest_t) { MPI_Status status; OPAL_THREAD_UNLOCK(&lock); request->greq_poll.c_poll(request->greq_state, &status); if (REQUEST_COMPLETE(&request->greq_base)) { OPAL_THREAD_LOCK(&lock); opal_list_remove_item(&requests, &request->greq_base.super.super); OPAL_THREAD_UNLOCK(&lock); } OPAL_THREAD_LOCK(&lock); } } OPAL_THREAD_UNLOCK(&lock); return OMPI_SUCCESS; } int ompi_grequestx_start( MPI_Grequest_query_function *gquery_fn, MPI_Grequest_free_function *gfree_fn, MPI_Grequest_cancel_function *gcancel_fn, ompi_grequestx_poll_function *gpoll_fn, void* extra_state, ompi_request_t** request) { int rc; rc = ompi_grequest_start(gquery_fn, gfree_fn, gcancel_fn, extra_state, request); if (OMPI_SUCCESS != rc) { return rc; } ((ompi_grequest_t *)*request)->greq_poll.c_poll = gpoll_fn; if (!requests_initialized) { OBJ_CONSTRUCT(&requests, opal_list_t); OBJ_CONSTRUCT(&lock, opal_mutex_t); requests_initialized = true; } OPAL_THREAD_LOCK(&lock); opal_list_append(&requests, &((*request)->super.super)); OPAL_THREAD_UNLOCK(&lock); int32_t tmp = OPAL_THREAD_ADD_FETCH32(&active_requests, 1); if (1 == tmp) { opal_progress_register(grequestx_progress); } return OMPI_SUCCESS; } struct grequestx_class { opal_object_t super; MPI_Grequest_query_function *gquery_fn; MPI_Grequest_free_function *gfree_fn; MPI_Grequest_cancel_function *gcancel_fn; ompi_grequestx_poll_function *gpoll_fn; ompi_grequestx_wait_function *gwait_fn; } ; typedef struct grequestx_class grequestx_class; static int next_class = 0; static OBJ_CLASS_INSTANCE(grequestx_class, opal_object_t, NULL, NULL); static opal_pointer_array_t classes; int ompi_grequestx_class_create( MPI_Grequest_query_function *gquery_fn, MPI_Grequest_free_function *gfree_fn, MPI_Grequest_cancel_function *gcancel_fn, ompi_grequestx_poll_function *gpoll_fn, ompi_grequestx_wait_function *gwait_fn, ompi_grequestx_class *greq_class) { grequestx_class * class = OBJ_NEW(grequestx_class); class->gquery_fn = gquery_fn; class->gfree_fn = gfree_fn; class->gcancel_fn = gcancel_fn; class->gpoll_fn = gpoll_fn; class->gwait_fn = gwait_fn; if (0 == next_class) { OBJ_CONSTRUCT(&classes, opal_pointer_array_t); } opal_pointer_array_add(&classes, class); next_class ++; return OMPI_SUCCESS; } int ompi_grequestx_class_allocate( ompi_grequestx_class greq_class, void *extra_state, ompi_request_t **request) { grequestx_class *class = opal_pointer_array_get_item(&classes, greq_class); ompi_grequestx_start(class->gquery_fn, class->gfree_fn, class->gcancel_fn, class->gpoll_fn, extra_state, request); return OMPI_SUCCESS; }
31.597222
118
0.692747
382cba6a3f8e400288d780a22300ff31bfe71b5f
800
kt
Kotlin
example/transfer/domain/src/main/kotlin/ru/adavliatov/atomy/example/transfer/domain/error/errors.kt
alexdavliatov/atomy
77ac4c1223afe35996a3ad453b78619504387425
[ "Apache-2.0" ]
null
null
null
example/transfer/domain/src/main/kotlin/ru/adavliatov/atomy/example/transfer/domain/error/errors.kt
alexdavliatov/atomy
77ac4c1223afe35996a3ad453b78619504387425
[ "Apache-2.0" ]
null
null
null
example/transfer/domain/src/main/kotlin/ru/adavliatov/atomy/example/transfer/domain/error/errors.kt
alexdavliatov/atomy
77ac4c1223afe35996a3ad453b78619504387425
[ "Apache-2.0" ]
null
null
null
package ru.adavliatov.atomy.example.transfer.domain.error import ru.adavliatov.atomy.common.type.error.HttpWrapperErrors.InvalidArgumentError import ru.adavliatov.atomy.common.type.error.HttpWrapperErrors.NotFoundError import ru.adavliatov.atomy.example.transfer.domain.* import ru.adavliatov.atomy.example.transfer.domain.error.code.TransactionErrorCodes.InvalidOperationName import ru.adavliatov.atomy.example.transfer.domain.error.code.TransactionErrorCodes.OperationNotFound @Suppress("unused") object TransactionErrors { class InvalidOperationNameError(name: String) : InvalidArgumentError(InvalidOperationName, "Invalid operation: [$name]") class InvalidOperationNotFoundError(operation: Operation) : NotFoundError(OperationNotFound, "[${operation.name}] operation not found") }
47.058824
104
0.83875
167d99ce09b72222a07824bdd5bbbcef94096061
1,855
ts
TypeScript
node_modules/html-pdf-chrome/lib/src/typings/chrome/Runtime/ExceptionDetails.d.ts
kevin-on-davis/L2K_Developer-Profile-Generator
6571c4498878334543302cf2916f8f2794a2b085
[ "MIT" ]
null
null
null
node_modules/html-pdf-chrome/lib/src/typings/chrome/Runtime/ExceptionDetails.d.ts
kevin-on-davis/L2K_Developer-Profile-Generator
6571c4498878334543302cf2916f8f2794a2b085
[ "MIT" ]
null
null
null
node_modules/html-pdf-chrome/lib/src/typings/chrome/Runtime/ExceptionDetails.d.ts
kevin-on-davis/L2K_Developer-Profile-Generator
6571c4498878334543302cf2916f8f2794a2b085
[ "MIT" ]
null
null
null
import { ExecutionContextId } from './ExecutionContextId'; import RemoteObject from './RemoteObject'; import { ScriptId } from './ScriptId'; import StackTrace from './StackTrace'; /** * Detailed information about exception (or error) that was thrown during script compilation or execution. * * @export * @interface ExceptionDetails */ export default interface ExceptionDetails { /** * Exception id. * * @type {number} * @memberof ExceptionDetails */ exceptionId: number; /** * Exception text, which should be used together with exception object when available. * * @type {string} * @memberof ExceptionDetails */ text: string; /** * Line number of the exception location (0-based). * * @type {number} * @memberof ExceptionDetails */ lineNumber: number; /** * Column number of the exception location (0-based). * * @type {number} * @memberof ExceptionDetails */ columnNumber: number; /** * Script ID of the exception location. * * @type {ScriptId} * @memberof ExceptionDetails */ scriptId?: ScriptId; /** * URL of the exception location, to be used when the script was not reported. * * @type {string} * @memberof ExceptionDetails */ url?: string; /** * JavaScript stack trace if available. * * @type {StackTrace} * @memberof ExceptionDetails */ stackTrace?: StackTrace; /** * Exception object if available. * * @type {RemoteObject} * @memberof ExceptionDetails */ exception?: RemoteObject; /** * Identifier of the context where exception happened. * * @type {ExecutionContextId} * @memberof ExceptionDetails */ executionContextId?: ExecutionContextId; }
24.407895
106
0.61186
f05664f755b3f673d926831f9475fb250a901f2c
792
py
Python
pytglib/api/types/rich_text_phone_number.py
iTeam-co/pytglib
e5e75e0a85f89b77762209b32a61b0a883c0ae61
[ "MIT" ]
6
2019-10-30T08:57:27.000Z
2021-02-08T14:17:43.000Z
pytglib/api/types/rich_text_phone_number.py
iTeam-co/python-telegram
e5e75e0a85f89b77762209b32a61b0a883c0ae61
[ "MIT" ]
1
2021-08-19T05:44:10.000Z
2021-08-19T07:14:56.000Z
pytglib/api/types/rich_text_phone_number.py
iTeam-co/python-telegram
e5e75e0a85f89b77762209b32a61b0a883c0ae61
[ "MIT" ]
5
2019-12-04T05:30:39.000Z
2021-05-21T18:23:32.000Z
from ..utils import Object class RichTextPhoneNumber(Object): """ A rich text phone number Attributes: ID (:obj:`str`): ``RichTextPhoneNumber`` Args: text (:class:`telegram.api.types.RichText`): Text phone_number (:obj:`str`): Phone number Returns: RichText Raises: :class:`telegram.Error` """ ID = "richTextPhoneNumber" def __init__(self, text, phone_number, **kwargs): self.text = text # RichText self.phone_number = phone_number # str @staticmethod def read(q: dict, *args) -> "RichTextPhoneNumber": text = Object.read(q.get('text')) phone_number = q.get('phone_number') return RichTextPhoneNumber(text, phone_number)
21.405405
54
0.585859
465918f5130fd8ee95a86a6168d8ce943f6031b2
328
swift
Swift
PDFLinks/Extensions/PDFAnnotation+Extensions.swift
eppz/macOS.Production.PDF_Links
86e9298abbfc7423f24010ea7a334292c036643d
[ "MIT" ]
1
2022-02-06T02:18:16.000Z
2022-02-06T02:18:16.000Z
PDFLinks/Extensions/PDFAnnotation+Extensions.swift
eppz/macOS.Production.PDF_Links
86e9298abbfc7423f24010ea7a334292c036643d
[ "MIT" ]
null
null
null
PDFLinks/Extensions/PDFAnnotation+Extensions.swift
eppz/macOS.Production.PDF_Links
86e9298abbfc7423f24010ea7a334292c036643d
[ "MIT" ]
null
null
null
// // PDFAnnotation+Extensions.swift // PDFLinks // // Created by Geri Borbás on 2020. 02. 11.. // Copyright © 2020. Geri Borbás. All rights reserved. // import Foundation import PDFKit extension PDFAnnotation { func with(url: URL?) -> PDFAnnotation { self.url = url return self } }
14.26087
55
0.615854
5f257ad7b985b460ea7dbd68292a31c0daebee33
508
swift
Swift
Sources/UIKit+CSExtension/CGPoint+CSExtension.swift
icetime17/CSSwiftExtension
ae440da923d4e8cdf0c5a91f8d39d0400367d48e
[ "MIT" ]
111
2016-07-03T14:55:00.000Z
2021-12-25T21:18:44.000Z
Sources/UIKit+CSExtension/CGPoint+CSExtension.swift
icetime17/CSSwiftExtension
ae440da923d4e8cdf0c5a91f8d39d0400367d48e
[ "MIT" ]
1
2017-09-21T02:40:46.000Z
2017-09-21T02:40:46.000Z
Sources/UIKit+CSExtension/CGPoint+CSExtension.swift
icetime17/CSSwiftExtension
ae440da923d4e8cdf0c5a91f8d39d0400367d48e
[ "MIT" ]
19
2016-07-07T01:50:24.000Z
2021-06-16T06:16:22.000Z
// // CGPoint+CSExtension.swift // CSSwiftExtension // // Created by Chris Hu on 17/1/3. // Copyright © 2017年 com.icetime17. All rights reserved. // import UIKit public extension CGPoint { static func cs_distance(fromPoint: CGPoint, toPoint: CGPoint) -> CGFloat { return sqrt(pow(toPoint.x - fromPoint.x, 2) + pow(toPoint.y - fromPoint.y, 2)) } func cs_distance(toPoint: CGPoint) -> CGFloat { return CGPoint.cs_distance(fromPoint: self, toPoint: toPoint) } }
23.090909
86
0.661417
754d3e661058e3340dbb0694f6b987b02e36b18a
5,387
h
C
src/add-ons/SxMurn.h
ashtonmv/sphinx_vdw
5896fee0d92c06e883b72725cb859d732b8b801f
[ "Apache-2.0" ]
1
2020-02-29T03:26:32.000Z
2020-02-29T03:26:32.000Z
src/add-ons/SxMurn.h
ashtonmv/sphinx_vdw
5896fee0d92c06e883b72725cb859d732b8b801f
[ "Apache-2.0" ]
null
null
null
src/add-ons/SxMurn.h
ashtonmv/sphinx_vdw
5896fee0d92c06e883b72725cb859d732b8b801f
[ "Apache-2.0" ]
null
null
null
// --------------------------------------------------------------------------- // // The ab-initio based multiscale library // // S / P H I / n X // // Copyright: Max-Planck-Institute for Iron Research // 40237 Duesseldorf, Germany // // Contact: https://sxlib.mpie.de // Authors: see sphinx/AUTHORS // License: see sphinx/LICENSE // // --------------------------------------------------------------------------- #ifndef _SX_MURN_H_ #define _SX_MURN_H_ #include <SxString.h> #include <SxVector.h> #include <SxList.h> #include <SxExt.h> /** \brief Murnaghan fit \b SxMurn = S/PHI/nX Murnaghan Fit The Murnaghan state equation resolved to energy reads \f[E = E_0 + \frac{B_0V}{B_0'(B_0' - 1)}\left[ B_0'\left(1 - \frac{V_0}{V}\right) + \left(\frac{V_0}{V}\right)^{B_0'} - 1 \right] \f] The add-on performs a fit of the parameters \f$B_0\f$, \f$B_0'\f$, \f$V_0\f$, and \f$E_0\f$ to a number of points (volume/energy). \par Fitting procedure In this add-on, the bulk modulus \f$B_0\f$ and the minimum energy \f$E_0\f$ are optimized analytically, while the derivative \f$B_0'\f$ and the minimum volume are obtained by two (very primitive) single line optimizations. \n The quadratic deviation is defined as \n \f[\Delta = \sum_n (E(V_n) - E_n)^2 \f] \n where \f$V_n\f$ / \f$E_n\f$ are the given points, and E(V) is the Murnaghan function. \n Putting all the complicated stuff into a function f, the thing looks easier \f[E(V) = E_0 + B_0\cdot f_{V_0,B_0'} (V) \f] \n If \f$E_0\f$ is the optimal parameter, the partial derivative of \f$\Delta\f$ with respect to \f$E_0\f$ must vanish. Thus \n \f[0 = \frac{\partial \Delta}{\partial E_0} = 2 \sum_n \left(E(V_n) - E_n\right) \cdot \sum_n \underbrace{\frac{\partial E(V_n)}{\partial E_0}}_1 = 2[\underbrace{\sum_n (E_0}_{n\cdot E_0} + B_0 \cdot f(V_n) - E_n)] \cdot n \f] \f[ \Rightarrow E_0 = \frac {\sum_n E_n - B_0 f(V_n)}{n} \f] \n If \f$B_0\f$ is the optimal parameter, the partial derivative of \f$\Delta\f$ with respect to \f$B_0\f$ must vanish. Thus \n \f[0 = \frac{\partial \Delta}{\partial B_0} = \frac{\partial (\sum_n (E(V_n) - E_n)^2)}{\partial B_0} = \frac{\partial \left(\sum_n (E_0 + B_0\cdot f(V_n) - E_n)^2\right)}{\partial B_0} = 2 \sum_n f(V_n) \cdot (E_0 + B_0\cdot f(V_n) - E_n) \f] Dividing by 2 and inserting the expression for \f$E_0\f$ we arrive at \f[ 0 = \sum_n f(V_n)\cdot \left(\frac {\sum_n E_n - B_0 f(V_n)}{n} + B_0\cdot f(V_n) - E_n\right) = \sum_n f(V_n)\cdot \left[\frac{\sum E_n}{n} - E_n - B_0 \cdot\left( \frac{\sum_n f(V_n)}{n} - f(V_n)\right)\right] = \sum_n f(V_n)\cdot \left[\frac{\sum E_n}{n} - E_n\right] - B_0 \sum_n f(V_n) \cdot\left[\frac{\sum_n f(V_n)}{n} - f(V_n)\right] \f] \f[ \Rightarrow B_0 = \frac {\sum_n f(V_n)\cdot \left(\frac{\sum E_n}{n} - E_n\right)} {\sum_n f(V_n) \cdot\left(\frac{\sum_n f(V_n)}{n} - f(V_n)\right)} \f] With this optimized \f$B_0\f$, the corresponding \f$E_0\f$ is calculated as derived above. f depends implicitly on both \f$B_0'\f$ and \f$V_0\f$. The line optimization works with the analytically optimized values for \f$E_0\f$ and \f$B_0\f$. \ingroup group_addons \author Christoph Freysoldt, mailto:freyso@fhi-berlin.mpg.de */ class SX_EXPORT_EXT SxMurn { public: /// Volume at minimum \f$V_0\f$ double minVolume; /// Bulk modulus \f$B_0\f$ double bulkModulus; /// Bulk modulus derivative wrt pressure \f$B_0'\f$ double bulkModulusDerivative; /// Minimum energy \f$E_0\f$ double minEnergy; /// Given volumes SxVector<Double> volumes; /// Given energies SxVector<Double> energies; /// Constructor SxMurn () : minVolume(0.), bulkModulus(0.), bulkModulusDerivative(0.), minEnergy (0.) { /* empty */ } /// Constructor SxMurn (const SxList<double> &, const SxList<double> &); /// Constructor SxMurn (const SxVector<Double> &, const SxVector<Double> &); /// Destructor ~SxMurn () {/* empty */} /// Fit E0, V0, B0, B0' to data void computeFit (); /// Print result (xmgrace-format) /** @param FileName output file @param nPoints number of points to sample */ void writeToFile (SxString FileName, int nPoints, bool pressurePrint); /// Get energy for volume according to Murn function double getEnergy (double); /// Get \f$\sum (E_{V_0,B_0'}(V_n) - E_n)^2 \f$ /** \f$E_0\f$ and \f$B_0\f$ are optimized analytically as described in the introduction. */ double getDeviation (); /// Returns bulk modulus in GPa double getBulkModulus (); /// Returns volume at minimum double getMinVolume (); /// Return minimum energy double getMinEnergy (); private: /// This is f from the introduction: the complicated part of the equation double innerFunction (double); protected: /// Internal initialization routine void init (); }; #endif /* _SX_MURN_H_ */
34.312102
89
0.57416
8cee2de710a0c5247ba6a54de68d705a92bd9e74
1,233
kt
Kotlin
app/src/main/java/com/alexzh/medicationreminder/settings/SettingsPresenter.kt
AlexZhukovich/MedicationReminder
fa71281518d20d0432ba96d3c301b1488cc6c1e8
[ "MIT" ]
1
2018-06-24T06:32:23.000Z
2018-06-24T06:32:23.000Z
app/src/main/java/com/alexzh/medicationreminder/settings/SettingsPresenter.kt
AlexZhukovich/MedicationReminder
fa71281518d20d0432ba96d3c301b1488cc6c1e8
[ "MIT" ]
null
null
null
app/src/main/java/com/alexzh/medicationreminder/settings/SettingsPresenter.kt
AlexZhukovich/MedicationReminder
fa71281518d20d0432ba96d3c301b1488cc6c1e8
[ "MIT" ]
null
null
null
package com.alexzh.medicationreminder.settings import com.alexzh.medicationreminder.data.AppInfoRepository import io.reactivex.Scheduler import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.Disposable import io.reactivex.schedulers.Schedulers import timber.log.Timber class SettingsPresenter(private val view: Settings.View, private val repository: AppInfoRepository, private val ioScheduler: Scheduler = Schedulers.io(), private val uiScheduler: Scheduler = AndroidSchedulers.mainThread()) : Settings.Presenter { private var mDisposable: Disposable? = null override fun loadAppVersion() { mDisposable = repository.getAppVersion() .subscribeOn(ioScheduler) .observeOn(uiScheduler) .subscribe(this::handleSuccess, this::handleError) } override fun onDestroy() { mDisposable?.dispose() } private fun handleSuccess(version: String) { view.showAppVersion(version) } private fun handleError(t: Throwable) { Timber.e(t, "There was an error loading the app version.") view.showUnknownAppVersion() } }
33.324324
115
0.68532
4f61954e007d3d363c23f2cffaae2ff44443ee8c
719
swift
Swift
Memorize/Screens/Repeat/RepeatAssembly.swift
VikaOlegova/Memorize
5608a57509523b2bfbaaa8c92a11ffecc60364f9
[ "MIT" ]
null
null
null
Memorize/Screens/Repeat/RepeatAssembly.swift
VikaOlegova/Memorize
5608a57509523b2bfbaaa8c92a11ffecc60364f9
[ "MIT" ]
null
null
null
Memorize/Screens/Repeat/RepeatAssembly.swift
VikaOlegova/Memorize
5608a57509523b2bfbaaa8c92a11ffecc60364f9
[ "MIT" ]
null
null
null
// // RepeatAssembly.swift // Memorize // // Created by Вика on 27/11/2019. // Copyright © 2019 Vika Olegova. All rights reserved. // import UIKit /// Собирает все зависимости для экрана повторения\исправления ошибок class RepeatAssembly { func create(isMistakes: Bool) -> UIViewController { let coreData = CoreDataService() let presenter = RepeatPresenter( coreData: coreData, repeatingSession: RepeatingSession.shared, router: Router.shared, isMistakes: isMistakes ) let viewController = RepeatViewController(presenter: presenter) presenter.view = viewController return viewController } }
25.678571
71
0.648122
d8075a988130cbe5845987ef56afc0f0347b5de1
605
swift
Swift
Sources/Cookies.swift
TokyoYoshida/SwiftLibuv
1b30412e7a79ed98b2e3975b45bea80a7bb413d9
[ "MIT" ]
4
2016-06-27T10:56:36.000Z
2016-10-15T15:37:05.000Z
Sources/Cookies.swift
TokyoYoshida/SwiftLibuv
1b30412e7a79ed98b2e3975b45bea80a7bb413d9
[ "MIT" ]
null
null
null
Sources/Cookies.swift
TokyoYoshida/SwiftLibuv
1b30412e7a79ed98b2e3975b45bea80a7bb413d9
[ "MIT" ]
null
null
null
import HTTP class Cookies { private var cookies = Dictionary<String, AttributedCookie>() subscript(name: String) -> AttributedCookie? { get { return cookies[name] } set(newValue){ guard var newValue = newValue else { return } newValue.name = name cookies[name] = newValue } } func toSet() -> Set<AttributedCookie>{ var retValue = Set<AttributedCookie>() cookies.forEach { retValue.insert($0.1) } return retValue } }
20.862069
64
0.509091
9c7250e75b947defc200ac3e47b2167b14f4ce84
5,484
js
JavaScript
src/foam/nanos/medusa/ClusterConfigNARegionReplayDAO.js
molurin1/foam3
820449f03b75b7382bfb1bec2fa9676627ef9359
[ "ECL-2.0", "Apache-2.0" ]
15
2021-04-06T19:37:37.000Z
2022-02-08T16:21:36.000Z
src/foam/nanos/medusa/ClusterConfigNARegionReplayDAO.js
molurin1/foam3
820449f03b75b7382bfb1bec2fa9676627ef9359
[ "ECL-2.0", "Apache-2.0" ]
188
2021-04-09T15:04:37.000Z
2022-03-30T16:54:37.000Z
src/foam/nanos/medusa/ClusterConfigNARegionReplayDAO.js
molurin1/foam3
820449f03b75b7382bfb1bec2fa9676627ef9359
[ "ECL-2.0", "Apache-2.0" ]
21
2021-03-23T17:46:26.000Z
2022-03-07T18:22:36.000Z
/** * @license * Copyright 2021 The FOAM Authors. All Rights Reserved. * http://www.apache.org/licenses/LICENSE-2.0 */ foam.CLASS({ package: 'foam.nanos.medusa', name: 'ClusterConfigNARegionReplayDAO', extends: 'foam.dao.ProxyDAO', documentation: `Non-Active Region Mediator request replay from Active Region Nodes.`, javaImports: [ 'foam.dao.ArraySink', 'foam.dao.DAO', 'foam.dao.Sink', 'static foam.mlang.MLang.AND', 'static foam.mlang.MLang.EQ', 'static foam.mlang.MLang.GTE', 'static foam.mlang.MLang.LT', 'static foam.mlang.MLang.MAX', 'static foam.mlang.MLang.MIN', 'static foam.mlang.MLang.OR', 'foam.mlang.sink.Count', 'foam.mlang.sink.Max', 'foam.mlang.sink.Min', 'foam.mlang.sink.Sequence', 'foam.nanos.logger.PrefixLogger', 'foam.nanos.logger.Logger', 'java.util.List' ], properties: [ { name: 'logger', class: 'FObjectProperty', of: 'foam.nanos.logger.Logger', visibility: 'HIDDEN', transient: true, javaCloneProperty: '//noop', javaFactory: ` return new PrefixLogger(new Object[] { this.getClass().getSimpleName() }, (Logger) getX().get("logger")); ` } ], methods: [ { name: 'put_', javaCode: ` ClusterConfig nu = (ClusterConfig) obj; ClusterConfig old = (ClusterConfig) find_(x, nu.getId()); nu = (ClusterConfig) getDelegate().put_(x, nu); ClusterConfigSupport support = (ClusterConfigSupport) x.get("clusterConfigSupport"); ClusterConfig myConfig = support.getConfig(x, support.getConfigId()); if ( old != null && old.getStatus() != nu.getStatus() && nu.getStatus() == Status.ONLINE && nu.getRealm().equals(myConfig.getRealm()) ) { if ( ! ( myConfig.getType() == MedusaType.MEDIATOR && myConfig.getRegionStatus() == RegionStatus.STANDBY && myConfig.getStatus() == Status.ONLINE ) ) { return nu; } getLogger().info(nu.getName(), old.getStatus().getLabel(), "->", nu.getStatus().getLabel().toUpperCase()); if ( nu.getType() == MedusaType.NODE && nu.getRegionStatus() == RegionStatus.ACTIVE && nu.getZone() == 0L ) { // Self already ONLINE, replay from Active Node replay(x, myConfig, nu); } else if ( nu.getType() == MedusaType.MEDIATOR && nu.getId().equals(myConfig.getId()) ) { // Self ONLINE, replay from all Active Nodes List<ClusterConfig> configs = ((ArraySink) ((DAO) x.get("clusterConfigDAO")) .where( AND( EQ(ClusterConfig.TYPE, MedusaType.NODE), EQ(ClusterConfig.ZONE, 0L), EQ(ClusterConfig.ENABLED, true), EQ(ClusterConfig.STATUS, Status.ONLINE), EQ(ClusterConfig.REALM, myConfig.getRealm()), EQ(ClusterConfig.REGION_STATUS, RegionStatus.ACTIVE) ) ) .select(new ArraySink())).getArray(); for ( ClusterConfig config : configs ) { replay(x, myConfig, config); } } } return nu; ` }, { name: 'replay', args: [ { name: 'x', type: 'Context' }, { name: 'myConfig', type: 'foam.nanos.medusa.ClusterConfig' }, { name: 'config', type: 'foam.nanos.medusa.ClusterConfig' } ], javaCode: ` ClusterConfigSupport support = (ClusterConfigSupport) x.get("clusterConfigSupport"); String serviceName = "medusaNodeDAO"; DAO clientDAO = support.getClientDAO(x, serviceName, myConfig, config); clientDAO = new RetryClientSinkDAO.Builder(x) .setName(serviceName) .setDelegate(clientDAO) .setMaxRetryAttempts(0) // .setMaxRetryAttempts(support.getMaxRetryAttempts()) // .setMaxRetryDelay(support.getMaxRetryDelay()) .build(); // NOTE: using internalMedusaDAO else we'll block on ReplayingDAO. DAO dao = (DAO) x.get("internalMedusaDAO"); dao = dao.where(EQ(MedusaEntry.PROMOTED, false)); Min min = (Min) dao.select(MIN(MedusaEntry.INDEX)); Long minIndex = 0L; ReplayDetailsCmd details = new ReplayDetailsCmd(); details.setRequester(myConfig.getId()); details.setResponder(config.getId()); if ( min != null && min.getValue() != null ) { details.setMinIndex((Long) min.getValue()); minIndex = details.getMinIndex(); } getLogger().info("ReplayDetailsCmd", "from", myConfig.getId(), "to", config.getId(), "request"); details = (ReplayDetailsCmd) clientDAO.cmd_(x, details); getLogger().info("ReplayDetailsCmd", "from", myConfig.getId(), "to", config.getId(), "response", details); if ( details.getMaxIndex() > minIndex ) { ReplayCmd cmd = new ReplayCmd(); cmd.setDetails(details); cmd.setServiceName("medusaMediatorDAO"); // TODO: configuration getLogger().info("ReplayCmd", "from", myConfig.getId(), "to", config.getId(), "request", cmd.getDetails()); cmd = (ReplayCmd) clientDAO.cmd_(x, cmd); getLogger().info("ReplayCmd", "from", myConfig.getId(), "to", config.getId(), "response"); } ` } ] });
33.644172
115
0.576039
4046d3abc952d9da6447c9c9b036110a6fc9a635
737
py
Python
createtables.py
CampusHackTeamMeme/Busoton-API
7214aa903f83963ab64aae772dd59926e6493dec
[ "Apache-2.0" ]
null
null
null
createtables.py
CampusHackTeamMeme/Busoton-API
7214aa903f83963ab64aae772dd59926e6493dec
[ "Apache-2.0" ]
null
null
null
createtables.py
CampusHackTeamMeme/Busoton-API
7214aa903f83963ab64aae772dd59926e6493dec
[ "Apache-2.0" ]
null
null
null
import psycopg2 def createStops(conn): c = conn.cursor() c.execute(''' CREATE TABLE IF NOT EXISTS stops( stop_id TEXT PRIMARY KEY, name TEXT, lon DOUBLE PRECISION, lat DOUBLE PRECISION); ''') c.execute('''CREATE INDEX CONCURRENTLY IF NOT EXISTS lon_lon_lat_lat ON stops(lon,lon,lat,lat); ''') conn.commit() def createOps(conn): c = conn.cursor() c.execute(''' CREATE TABLE IF NOT EXISTS operators( code TEXT PRIMARY KEY, operator TEXT); ''') conn.commit() with open('postgres.config') as file: creds = file.read() with psycopg2.connect(creds) as conn: createStops(conn) createOps(conn)
20.472222
57
0.588874
6c72716623db54c4dde56572d5fd0729634fddcc
1,462
go
Go
stacks/stacks_test.go
C0MM4ND/wasman-go
87e38ef26abd9c92e957e455aca3369e87d6cbc5
[ "MIT" ]
5
2020-10-14T16:37:19.000Z
2021-09-28T06:55:18.000Z
stacks/stacks_test.go
C0MM4ND/wasman-go
87e38ef26abd9c92e957e455aca3369e87d6cbc5
[ "MIT" ]
null
null
null
stacks/stacks_test.go
C0MM4ND/wasman-go
87e38ef26abd9c92e957e455aca3369e87d6cbc5
[ "MIT" ]
1
2020-10-27T09:11:12.000Z
2020-10-27T09:11:12.000Z
package stacks_test import ( "reflect" "testing" "github.com/c0mm4nd/wasman/stacks" ) func TestVirtualMachineOperandStack(t *testing.T) { s := stacks.NewOperandStack() if stacks.InitialOperandStackHeight != len(s.Values) { t.Fail() } var exp uint64 = 10 s.Push(exp) if exp != s.Pop() { t.Fail() } // verify the length grows for i := 0; i < stacks.InitialOperandStackHeight+1; i++ { s.Push(uint64(i)) } if len(s.Values) <= stacks.InitialOperandStackHeight { t.Fail() } // verify the length is not shortened for i := 0; i < len(s.Values); i++ { _ = s.Pop() } if len(s.Values) <= stacks.InitialOperandStackHeight { t.Fail() } // for coverage OperandStack.Drop() // verify the length is not shortened for i := 0; i < len(s.Values); i++ { s.Drop() } if len(s.Values) <= stacks.InitialOperandStackHeight { t.Fail() } } func TestVirtualMachineLabelStack(t *testing.T) { s := stacks.NewLabelStack() if stacks.InitialLabelStackHeight != len(s.Values) { t.Fail() } exp := &stacks.Label{Arity: 100} s.Push(exp) if !reflect.DeepEqual(exp, s.Pop()) { t.Fail() } // verify the length grows for i := 0; i < stacks.InitialLabelStackHeight+1; i++ { s.Push(&stacks.Label{}) } if len(s.Values) <= stacks.InitialLabelStackHeight { t.Fail() } // verify the length is not shortened for i := 0; i < len(s.Values); i++ { _ = s.Pop() } if len(s.Values) <= stacks.InitialLabelStackHeight { t.Fail() } }
18.506329
58
0.644323
f153b264ab359f1b950e55c81e37eb597c43e853
3,081
swift
Swift
AlertPickerView/AlertPickerViewController.swift
tomoyamatsuyama/AlertPickerView
67c41316864eb895ab536b85d8d28a01d4c64de4
[ "MIT" ]
null
null
null
AlertPickerView/AlertPickerViewController.swift
tomoyamatsuyama/AlertPickerView
67c41316864eb895ab536b85d8d28a01d4c64de4
[ "MIT" ]
null
null
null
AlertPickerView/AlertPickerViewController.swift
tomoyamatsuyama/AlertPickerView
67c41316864eb895ab536b85d8d28a01d4c64de4
[ "MIT" ]
null
null
null
// // AlertPickerViewController.swift // AlertPickerView // // Created by 松山 友也 on 2018/11/12. // Copyright © 2018年 松山 友也. All rights reserved. // import UIKit import RxSwift import RxCocoa public class AlertPickerViewController: UIViewController { private let disposeBag = DisposeBag() @IBOutlet private weak var backRoundedView: UIView! { didSet { backRoundedView.layer.cornerRadius = Const.cornarRadius } } @IBOutlet private weak var pickerView: UIPickerView! @IBOutlet private weak var leftButton: UIButton! @IBOutlet private weak var rightButton: UIButton! @IBOutlet private weak var holizonalLineView: UIView! @IBOutlet private weak var verticalLineView: UIView! private var model: Model! var tappedLeftButton: Observable<Void> { return leftButton.rx.tap.asObservable() } var tapeedRightButton: Observable<Void> { return rightButton.rx.tap.asObservable() } var selected: Observable<SelectedItem> { return selectedRelay.asObservable() } private let selectedRelay = PublishRelay<SelectedItem>() public override func viewDidLoad() { super.viewDidLoad() modalPresentationStyle = .custom pickerView.delegate = self pickerView.dataSource = self } } public extension AlertPickerViewController { private enum Const { static let cornarRadius: CGFloat = 12 } struct Model { let columns: [Colum] struct Colum { let rows: [Row] struct Row { let title: String? } } } struct SelectedItem { let component: Int let row: Int init(_ component: Int, _ row: Int) { self.component = component self.row = row } } static func instantiate(with model: Model) -> AlertPickerViewController? { let path = Bundle.main.path(forResource: "AlertPickerView", ofType: "bundle")! let bundle = Bundle(path: path) let storyBoard = UIStoryboard(name: String(describing: AlertPickerViewController.self), bundle: bundle) guard let viewController = storyBoard.instantiateInitialViewController() as? AlertPickerViewController else { return nil } viewController.model = model return viewController } } extension AlertPickerViewController: UIPickerViewDataSource, UIPickerViewDelegate { public func numberOfComponents(in pickerView: UIPickerView) -> Int { return model.columns.count } public func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { return model.columns[component].rows.count } public func pickerView(_ pickerview: UIPickerView, titleForRow row: Int, forComponent component: Int)-> String? { return model.columns[component].rows[row].title } public func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { selectedRelay.accept(.init(component, row)) } }
27.026316
130
0.670886
019ed3bd4b2fb675c6487f362b0a2b3d8a815539
3,118
rs
Rust
src/material.rs
SimSmith/rusty_ray_tracer
cb47e34bf7b9b7387d88e4da8e9d51a8a70e4e2e
[ "MIT" ]
null
null
null
src/material.rs
SimSmith/rusty_ray_tracer
cb47e34bf7b9b7387d88e4da8e9d51a8a70e4e2e
[ "MIT" ]
null
null
null
src/material.rs
SimSmith/rusty_ray_tracer
cb47e34bf7b9b7387d88e4da8e9d51a8a70e4e2e
[ "MIT" ]
null
null
null
use crate::ray::Ray; use rand::Rng; use crate::vec3::Real; use crate::vec3::Vec3; pub trait Material: Sync { fn scatter(&self, r_in: &Ray, point: Vec3, normal: Vec3) -> Option<(Vec3, Ray)>; } // the lambertian class does not make sense pub struct Lambertian { pub albedo: Vec3, } impl Material for Lambertian { fn scatter(&self, _r_in: &Ray, point: Vec3, normal: Vec3) -> Option<(Vec3, Ray)> { let target = point + normal + crate::random_in_unit_sphere(); let attenuation = self.albedo; let scattered = Ray::new(point, target - point); Some((attenuation, scattered)) } } fn reflect(v: Vec3, n: Vec3) -> Vec3 { v - 2. * v.dot(&n) * n } pub struct Metal { albedo: Vec3, fuzz: Real, } impl Metal { pub fn new(albedo: Vec3, fuzz: Real) -> Self { Metal { albedo, fuzz: fuzz.min(1.), } } pub fn boxed(albedo: Vec3, fuzz: Real) -> Box<Self> { Box::new(Metal::new(albedo, fuzz)) } } impl Material for Metal { fn scatter(&self, r_in: &Ray, point: Vec3, normal: Vec3) -> Option<(Vec3, Ray)> { let reflected = reflect(r_in.direction().unit_vec(), normal); let attenuation = self.albedo; let scattered = Ray::new( point, reflected + self.fuzz * crate::random_in_unit_sphere(), ); if scattered.direction().dot(&normal) > 0. { Some((attenuation, scattered)) } else { None } } } fn refract(v: Vec3, n: Vec3, ni_over_nt: Real) -> Option<Vec3> { let uv = v.unit_vec(); let dt = uv.dot(&n); let discriminant = 1.0 - ni_over_nt * ni_over_nt * (1. - dt * dt); if discriminant > 0. { let refracted = ni_over_nt * (uv - n * dt) - n * discriminant.sqrt(); Some(refracted) } else { None } } fn schlick(cosine: Real, ref_idx: Real) -> Real { let mut r0 = (1. - ref_idx) / (1. + ref_idx); r0 *= r0; r0 + (1. - r0) * (1. - cosine).powi(5) } pub struct Dielectric { pub ref_idx: Real, } impl Material for Dielectric { fn scatter(&self, r_in: &Ray, point: Vec3, normal: Vec3) -> Option<(Vec3, Ray)> { let reflected = reflect(r_in.direction(), normal); let attenuation = Vec3::new(1., 1., 1.); let cosine = self.ref_idx * r_in.direction().dot(&normal) / r_in.direction().length(); let (outward_normal, ni_over_nt, cosine) = if r_in.direction().dot(&normal) > 0. { (-normal, self.ref_idx, cosine) } else { (normal, 1. / self.ref_idx, -cosine) }; let scattered = if let Some(refracted) = refract(r_in.direction(), outward_normal, ni_over_nt) { let reflect_prob = schlick(cosine, self.ref_idx); if rand::thread_rng().gen::<Real>() < reflect_prob { Ray::new(point, reflected) } else { Ray::new(point, refracted) } } else { Ray::new(point, reflected) }; Some((attenuation, scattered)) } }
28.87037
94
0.546825
0bfacc2ddcc76a3d46e433ce32e4f8c218064c5b
1,363
kts
Kotlin
kachej/build.gradle.kts
jeziellago/kachej
69ee3c269f6d5936593af7f5fb89eaffe79cd445
[ "Apache-2.0" ]
22
2020-05-05T02:00:28.000Z
2021-07-27T11:03:51.000Z
kachej/build.gradle.kts
jeziellago/kachej
69ee3c269f6d5936593af7f5fb89eaffe79cd445
[ "Apache-2.0" ]
null
null
null
kachej/build.gradle.kts
jeziellago/kachej
69ee3c269f6d5936593af7f5fb89eaffe79cd445
[ "Apache-2.0" ]
3
2020-05-11T16:21:20.000Z
2020-10-15T16:55:42.000Z
plugins { id("kotlin") id("maven-publish") jacoco } sourceSets { main { java.srcDir("src/main/kotlin") } test { java.srcDir("src/test/kotlin") } } tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { kotlinOptions { jvmTarget = "1.8" freeCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn") } } tasks.withType<JacocoReport> { classDirectories.from("$buildDir/classes/kotlin/main") sourceDirectories.from("$projectDir/src/main/kotlin") reports { xml.isEnabled = true html.isEnabled = true xml.destination = File("$buildDir/jacoco/coverage.xml") } executionData.from("$buildDir/jacoco/test.exec") } val sourcesJar by tasks.creating(Jar::class) { archiveClassifier.set("sources") from(sourceSets.getByName("main").allSource) } artifacts { archives(sourcesJar) } publishing { publications { create<MavenPublication>("release") { from(components["java"]) groupId = "com.kachej" artifactId = "kachej" version = "0.2.0" artifact(sourcesJar) } } } dependencies { implementation(Libs.kotlin) implementation(Libs.kotlin) implementation(Libs.coroutines) testImplementation(Libs.turbine) testImplementation(Libs.junit4) }
20.969231
66
0.631695
6c1755db4249e12a7e99a85ecb1245fd640af914
1,817
go
Go
writer.go
koji-hirono/bitio
7a8ae8bfbf420cb5b14eb759d05562c3138e44ae
[ "MIT" ]
null
null
null
writer.go
koji-hirono/bitio
7a8ae8bfbf420cb5b14eb759d05562c3138e44ae
[ "MIT" ]
null
null
null
writer.go
koji-hirono/bitio
7a8ae8bfbf420cb5b14eb759d05562c3138e44ae
[ "MIT" ]
null
null
null
package bitio import ( "github.com/koji-hirono/memio" ) // A Writer provides sequential bit-level writing. type Writer struct { g memio.Grower n int } // NewWriter returns a new Writer func NewWriter(g memio.Grower) *Writer { return &Writer{g: g} } func (w *Writer) Bytes() []byte { return w.g.Bytes() } func (w *Writer) Align() { w.n = (w.n + 7) &^ 0x7 } func (w *Writer) Grow(nbits int) (err error) { nbytes := (nbits + 7) >> 3 return w.g.Grow(nbytes) } func (w *Writer) Write(p []byte) (int, error) { m := len(p) n := w.n + m*8 err := w.Grow(n) if err != nil { return 0, err } for _, c := range p { w.writebit(c, 8) } return m, nil } // WriteByte writes a single byte. func (w *Writer) WriteByte(c byte) error { n := w.n + 8 err := w.Grow(n) if err != nil { return err } w.writebit(c, 8) return nil } // WriteBool writes the specified boolean value as a single bit. func (w *Writer) WriteBool(b bool) error { n := w.n + 1 err := w.Grow(n) if err != nil { return err } if b { w.writebit(0x80, 1) } else { w.writebit(0, 1) } return nil } // WriteBits writes nbits bits. func (w *Writer) WriteBits(p []byte, nbits int) error { n := w.n + nbits err := w.Grow(n) if err != nil { return err } i := nbits >> 3 for _, c := range p[:i] { w.writebit(c, 8) } off := nbits & 7 if off != 0 { w.writebit(p[i], off) } return nil } func (w *Writer) WriteBitField(v uint64, nbits int) error { v <<= 64 - nbits nbytes := (nbits + 7) >> 3 p := make([]byte, nbytes) for i := 0; i < nbytes; i++ { k := 56 - (i << 3) p[i] = byte(v >> k) } return w.WriteBits(p, nbits) } func (w *Writer) writebit(c byte, nbits int) { buf := w.g.Bytes() i := w.n >> 3 off := w.n & 7 buf[i] |= c >> off if nbits+off > 8 { buf[i+1] = c << (8 - off) } w.n += nbits }
16.669725
64
0.572372
0cd346f1de289a9e93d3b25b5635b78a4192c096
1,126
py
Python
gen-raw-logs.py
lightoyou/grapl
77488059891091e5656254ee15efef038a1b46a7
[ "Apache-2.0" ]
null
null
null
gen-raw-logs.py
lightoyou/grapl
77488059891091e5656254ee15efef038a1b46a7
[ "Apache-2.0" ]
null
null
null
gen-raw-logs.py
lightoyou/grapl
77488059891091e5656254ee15efef038a1b46a7
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python try: from typing import Any, Dict, Union, Optional except: pass import time import string import boto3 import random import zstd import sys def rand_str(l): # type: (int) -> str return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(l)) def main(prefix): s3 = boto3.client('s3') with open('./eventlog.xml', 'rb') as b: body = b.readlines() body = [line for line in body] def chunker(seq, size): return [seq[pos:pos + size] for pos in range(0, len(seq), size)] for chunks in chunker(body, 50): c_body = zstd.compress(b"\n".join(chunks), 4) epoch = int(time.time()) s3.put_object( Body=c_body, Bucket="{}-sysmon-log-bucket".format(prefix), Key=str(epoch - (epoch % (24 * 60 * 60))) + "/sysmon/" + str(epoch) + rand_str(3) ) print(time.ctime()) if __name__ == '__main__': if len(sys.argv) != 2: raise Exception("Provide bucket prefix as first argument") else: main(sys.argv[1])
22.078431
72
0.571936
88ef9bf85d12335881728efb071f59a3985143ee
1,210
kt
Kotlin
androidApp/src/main/kotlin/tech/alexib/yaba/android/util/notifications.kt
ruffCode/yaba-kmm
ca86e5a60d0fcc2accfd6c12da07a334558cce0e
[ "Apache-2.0" ]
5
2021-06-28T17:26:42.000Z
2022-02-21T02:32:52.000Z
androidApp/src/main/kotlin/tech/alexib/yaba/android/util/notifications.kt
ruffCode/yaba-kmm
ca86e5a60d0fcc2accfd6c12da07a334558cce0e
[ "Apache-2.0" ]
39
2021-06-22T20:47:07.000Z
2021-10-02T02:24:28.000Z
androidApp/src/main/kotlin/tech/alexib/yaba/android/util/notifications.kt
ruffCode/yaba-kmm
ca86e5a60d0fcc2accfd6c12da07a334558cce0e
[ "Apache-2.0" ]
1
2021-06-27T20:37:21.000Z
2021-06-27T20:37:21.000Z
/* * Copyright 2021 Alexi Bre * * 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 tech.alexib.yaba.android.util import android.app.NotificationManager sealed class YabaNotificationChannel { abstract val name: String abstract val id: String } object NewTransactionChannel : YabaNotificationChannel() { override val id: String = "new_transaction" override val name: String = "New transactions" } fun NotificationManager.isChannelActive(channel: YabaNotificationChannel): Boolean { val notificationChannel = this.getNotificationChannel(channel.id) return notificationChannel != null && notificationChannel.importance != NotificationManager.IMPORTANCE_NONE }
34.571429
84
0.761157
122fa3737b13a5e395cf9680a73cf9dde59af10e
1,882
h
C
src/filters/oidc/in_memory_session_store.h
incfly/authservice
c918b4b52070bab45fca596be5747d531ea73e44
[ "Apache-2.0" ]
null
null
null
src/filters/oidc/in_memory_session_store.h
incfly/authservice
c918b4b52070bab45fca596be5747d531ea73e44
[ "Apache-2.0" ]
null
null
null
src/filters/oidc/in_memory_session_store.h
incfly/authservice
c918b4b52070bab45fca596be5747d531ea73e44
[ "Apache-2.0" ]
null
null
null
#ifndef AUTHSERVICE_IN_MEMORY_SESSION_STORE_H #define AUTHSERVICE_IN_MEMORY_SESSION_STORE_H #include "src/common/utilities/synchronized.h" #include "src/common/utilities/time_service.h" #include "src/filters/oidc/session_store.h" namespace authservice { namespace filters { namespace oidc { class Session; class InMemorySessionStore : public SessionStore { private: std::unordered_map<std::string, std::shared_ptr<Session>> session_map_; std::shared_ptr<common::utilities::TimeService> time_service_; uint32_t absolute_session_timeout_in_seconds_; uint32_t idle_session_timeout_in_seconds_; std::recursive_mutex mutex_; virtual absl::optional<std::shared_ptr<Session>> FindSession( absl::string_view session_id); virtual void Set(absl::string_view session_id, std::function<void(Session &session)> &lambda); public: InMemorySessionStore( std::shared_ptr<common::utilities::TimeService> time_service, uint32_t absolute_session_timeout_in_seconds, uint32_t idle_session_timeout_in_seconds); virtual void SetTokenResponse( absl::string_view session_id, std::shared_ptr<TokenResponse> token_response) override; virtual std::shared_ptr<TokenResponse> GetTokenResponse( absl::string_view session_id) override; virtual void SetAuthorizationState( absl::string_view session_id, std::shared_ptr<AuthorizationState> authorization_state) override; virtual std::shared_ptr<AuthorizationState> GetAuthorizationState( absl::string_view session_id) override; virtual void ClearAuthorizationState(absl::string_view session_id) override; virtual void RemoveSession(absl::string_view session_id) override; virtual void RemoveAllExpired() override; }; } // namespace oidc } // namespace filters } // namespace authservice #endif // AUTHSERVICE_IN_MEMORY_SESSION_STORE_H
31.366667
78
0.782147
96a04a5d096590251e78c9f8798a0c3220ba410f
2,125
kt
Kotlin
issuechecker/src/main/kotlin/com/starter/issuechecker/Di.kt
usefulness/issuechecker
d6f258bb2642d08ff64e86a6849ced054bbe7fac
[ "MIT" ]
8
2021-03-04T14:32:05.000Z
2021-09-14T12:12:12.000Z
issuechecker/src/main/kotlin/com/starter/issuechecker/Di.kt
usefulness/issuechecker
d6f258bb2642d08ff64e86a6849ced054bbe7fac
[ "MIT" ]
126
2021-02-27T06:53:23.000Z
2022-03-31T19:45:33.000Z
issuechecker/src/main/kotlin/com/starter/issuechecker/Di.kt
usefulness/issuechecker
d6f258bb2642d08ff64e86a6849ced054bbe7fac
[ "MIT" ]
null
null
null
package com.starter.issuechecker import com.starter.issuechecker.resolvers.github.GithubService import com.starter.issuechecker.resolvers.github.GithubStatusResolver import com.starter.issuechecker.resolvers.youtrack.YoutrackService import com.starter.issuechecker.resolvers.youtrack.YoutrackStatusResolver import kotlinx.coroutines.asCoroutineDispatcher import okhttp3.OkHttpClient import retrofit2.Retrofit import retrofit2.converter.moshi.MoshiConverterFactory import java.util.concurrent.Executor internal fun defaultChecker( config: IssueChecker.Config, ): DefaultChecker { val supportedTrackers = setOf( createGithub(config), createYoutrack(config), ) return DefaultChecker( supportedTrackers = supportedTrackers, dispatcher = config.executor.asCoroutineDispatcher(), ) } internal fun restApi( baseUrl: String, okHttpClient: OkHttpClient, executor: Executor, ) = Retrofit.Builder() .baseUrl(baseUrl) .addConverterFactory(MoshiConverterFactory.create()) .callbackExecutor(executor) .client(okHttpClient) .build() private fun createYoutrack( config: IssueChecker.Config, ) = YoutrackStatusResolver( service = restApi( baseUrl = "https://youtrack.jetbrains.com/", okHttpClient = config.okHttpClient, executor = config.executor, ).create(YoutrackService::class.java), ) private fun createGithub( config: IssueChecker.Config, ) = GithubStatusResolver( service = restApi( baseUrl = "https://api.github.com/", okHttpClient = config.okHttpClient.githubOkHttpClient { config.githubToken }, executor = config.executor, ).create(GithubService::class.java), ) private fun OkHttpClient.githubOkHttpClient(auth: () -> String?) = newBuilder() .addInterceptor { chain -> val newRequest = auth()?.let { token -> chain.request().newBuilder() .addHeader("Authorization", "token $token") .build() } ?: chain.request() chain.proceed(newRequest) } .build()
30.357143
85
0.699294
71e1116260efb1fed3ded67eaafbcbfd0945fefb
613
tsx
TypeScript
src/app/pages/ApplicationsPage/Main/index.tsx
ivulovic/retrosfera.com
1cd0210659b5dab4a574c1f778bfee9157ea5dd2
[ "MIT" ]
null
null
null
src/app/pages/ApplicationsPage/Main/index.tsx
ivulovic/retrosfera.com
1cd0210659b5dab4a574c1f778bfee9157ea5dd2
[ "MIT" ]
null
null
null
src/app/pages/ApplicationsPage/Main/index.tsx
ivulovic/retrosfera.com
1cd0210659b5dab4a574c1f778bfee9157ea5dd2
[ "MIT" ]
null
null
null
import CryptoExchangePage from 'app/pages/CryptoExchangePage'; import WishlistPage from 'app/pages/WishlistPage'; import { Redirect, useParams } from 'react-router'; import { ApplicationDetailsParams } from '../types'; const Components = { wishlist: WishlistPage, cryptoexchange: CryptoExchangePage, }; export default function ApplicationMain(): JSX.Element { const params = useParams<ApplicationDetailsParams>(); const { applicationId } = params; const Component = Components[applicationId.toLowerCase()]; if (!Component) { return <Redirect to="/applications" />; } return <Component />; }
30.65
62
0.743883
ecdf1c2f58d3dd23fea3b92f03b32e51812b0920
1,193
swift
Swift
day-074/Projects/Challenges/MoonshotRefactor/Moonshot/Data/Services/DataLoader.swift
CypherPoet/100-days-of-swiftui
d7bf8063f4eb97b59e7f2c665b42083a364f7b1c
[ "Unlicense" ]
24
2019-10-09T03:24:06.000Z
2020-01-13T10:34:04.000Z
day-092/Projects/Challenges/MoonshotRefactor/Moonshot/Moonshot/Data/Services/DataLoader.swift
michael-mimi/100-days-of-swiftui-and-combine
d7bf8063f4eb97b59e7f2c665b42083a364f7b1c
[ "Unlicense" ]
64
2019-10-09T00:07:46.000Z
2020-01-10T13:18:53.000Z
day-092/Projects/Challenges/MoonshotRefactor/Moonshot/Moonshot/Data/Services/DataLoader.swift
michael-mimi/100-days-of-swiftui-and-combine
d7bf8063f4eb97b59e7f2c665b42083a364f7b1c
[ "Unlicense" ]
6
2019-10-15T09:00:47.000Z
2019-12-16T12:28:10.000Z
// // DataLoader.swift // Moonshot // // Created by CypherPoet on 11/2/19. // ✌️ // import Foundation import Combine import CypherPoetCore_FileSystem struct DataLoader { static let shared = DataLoader() enum Error: Swift.Error { case fileNotFound case failedToLoadData(Swift.Error) case generic(Swift.Error) } func decodeJSON<T: Decodable>( fromFileNamed fileName: String, withExtension extensionName: String = "json", using decoder: JSONDecoder = JSONDecoder() ) -> AnyPublisher<T, DataLoader.Error> { Just(Bundle.main) .map { $0.url(forResource: fileName, withExtension: extensionName) } .tryMap { url throws -> Data in guard let url = url else { throw Error.fileNotFound } do { return try Data(contentsOf: url) } catch { throw Error.failedToLoadData(error) } } .decode(type: T.self, decoder: decoder) .mapError { Error.generic($0) } .eraseToAnyPublisher() } }
25.382979
80
0.540654
7d613cc22de3f5d5ec20ab1c81b9fdee4f3f0227
561
html
HTML
layouts/partials/icons/yoast.html
bugoio/bugo-font-awesome
b13de4a9447710e87feb9aaeb455c1b51fb93c39
[ "MIT" ]
null
null
null
layouts/partials/icons/yoast.html
bugoio/bugo-font-awesome
b13de4a9447710e87feb9aaeb455c1b51fb93c39
[ "MIT" ]
null
null
null
layouts/partials/icons/yoast.html
bugoio/bugo-font-awesome
b13de4a9447710e87feb9aaeb455c1b51fb93c39
[ "MIT" ]
null
null
null
<svg tabindex="-1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"tabindex="-1"><path d="M91.3 76h186l-7 18.9h-179c-39.7 0-71.9 31.6-71.9 70.3v205.4c0 35.4 24.9 70.3 84 70.3V460H91.3C41.2 460 0 419.8 0 370.5V165.2C0 115.9 40.7 76 91.3 76zm229.1-56h66.5C243.1 398.1 241.2 418.9 202.2 459.3c-20.8 21.6-49.3 31.7-78.3 32.7v-51.1c49.2-7.7 64.6-49.9 64.6-75.3 0-20.1.6-12.6-82.1-223.2h61.4L218.2 299 320.4 20zM448 161.5V460H234c6.6-9.6 10.7-16.3 12.1-19.4h182.5V161.5c0-32.5-17.1-51.9-48.2-62.9l6.7-17.6c41.7 13.6 60.9 43.1 60.9 80.5z" tabindex="-1"/></svg>
561
561
0.673797
23edf6941edeba0e4865bb37a1da532e772b4532
5,978
kt
Kotlin
service/src/test/kotlin/io/provenance/digitalcurrency/consortium/frameworks/BalanceReportQueueTest.kt
Fin3-Technologies-Inc/digital-currency-consortium
d022c0d2e60a298a6bd2a894236b6cc7b2bfe018
[ "Apache-2.0" ]
2
2021-11-23T06:16:26.000Z
2021-12-30T16:11:13.000Z
service/src/test/kotlin/io/provenance/digitalcurrency/consortium/frameworks/BalanceReportQueueTest.kt
Fin3-Technologies-Inc/digital-currency-consortium
d022c0d2e60a298a6bd2a894236b6cc7b2bfe018
[ "Apache-2.0" ]
37
2021-08-18T18:03:28.000Z
2022-03-30T14:38:29.000Z
service/src/test/kotlin/io/provenance/digitalcurrency/consortium/frameworks/BalanceReportQueueTest.kt
Fin3-Technologies-Inc/digital-currency-consortium
d022c0d2e60a298a6bd2a894236b6cc7b2bfe018
[ "Apache-2.0" ]
2
2021-11-16T15:06:09.000Z
2022-02-14T19:41:46.000Z
package io.provenance.digitalcurrency.consortium.frameworks import io.provenance.digitalcurrency.consortium.BaseIntegrationTest import io.provenance.digitalcurrency.consortium.TEST_ADDRESS import io.provenance.digitalcurrency.consortium.config.BalanceReportProperties import io.provenance.digitalcurrency.consortium.config.CoroutineProperties import io.provenance.digitalcurrency.consortium.config.ServiceProperties import io.provenance.digitalcurrency.consortium.domain.AddressRegistrationRecord import io.provenance.digitalcurrency.consortium.domain.BalanceEntryRecord import io.provenance.digitalcurrency.consortium.domain.BalanceEntryTable import io.provenance.digitalcurrency.consortium.domain.BalanceReportRecord import io.provenance.digitalcurrency.consortium.service.PbcService import org.jetbrains.exposed.sql.and import org.jetbrains.exposed.sql.selectAll import org.jetbrains.exposed.sql.transactions.transaction import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.mockito.kotlin.any import org.mockito.kotlin.never import org.mockito.kotlin.reset import org.mockito.kotlin.times import org.mockito.kotlin.verify import org.mockito.kotlin.whenever import org.springframework.beans.factory.annotation.Autowired import java.util.UUID class BalanceReportQueueTest : BaseIntegrationTest() { @Autowired lateinit var pbcServiceMock: PbcService @Autowired private lateinit var coroutineProperties: CoroutineProperties @Autowired private lateinit var serviceProperties: ServiceProperties @BeforeEach fun beforeAll() { reset(pbcServiceMock) } @Test fun `empty whitelist should not error`() { val balanceReportProperties = BalanceReportProperties( pageSize = 1, pollingDelayMs = 1000, addressesWhitelist = "" ) val balanceReportQueue = BalanceReportQueue( balanceReportProperties = balanceReportProperties, serviceProperties = serviceProperties, coroutineProperties = coroutineProperties, pbcService = pbcServiceMock ) val balanceReport: BalanceReportRecord = transaction { BalanceReportRecord.insert() } balanceReportQueue.processMessage( BalanceReportDirective(balanceReport.id.value) ) verify(pbcServiceMock, never()).getCoinBalance(any(), any()) transaction { Assertions.assertEquals(BalanceEntryTable.selectAll().count(), 0) } } @Test fun `one whitelist, no addresses should generate report`() { whenever(pbcServiceMock.getCoinBalance(any(), any())).thenReturn("500") val balanceReportProperties = BalanceReportProperties( pageSize = 1, pollingDelayMs = 1000, addressesWhitelist = TEST_ADDRESS ) val balanceReportQueue = BalanceReportQueue( balanceReportProperties = balanceReportProperties, serviceProperties = serviceProperties, coroutineProperties = coroutineProperties, pbcService = pbcServiceMock ) val balanceReport: BalanceReportRecord = transaction { BalanceReportRecord.insert() } balanceReportQueue.processMessage( BalanceReportDirective(balanceReport.id.value) ) transaction { Assertions.assertEquals( BalanceEntryRecord.find { (BalanceEntryTable.report eq balanceReport.id) and (BalanceEntryTable.address eq TEST_ADDRESS) }.count(), 1 ) } } @Test fun `one whitelist, some addresses should generate report`() { whenever(pbcServiceMock.getCoinBalance(any(), any())).thenReturn("500") val balanceReportProperties = BalanceReportProperties( pageSize = 1, pollingDelayMs = 1000, addressesWhitelist = TEST_ADDRESS ) val balanceReportQueue = BalanceReportQueue( balanceReportProperties = balanceReportProperties, serviceProperties = serviceProperties, coroutineProperties = coroutineProperties, pbcService = pbcServiceMock ) transaction { AddressRegistrationRecord.insert( bankAccountUuid = UUID.randomUUID(), address = "dummyAddress1" ) AddressRegistrationRecord.insert( bankAccountUuid = UUID.randomUUID(), address = "dummyAddress2" ) } val balanceReport: BalanceReportRecord = transaction { BalanceReportRecord.insert() } balanceReportQueue.processMessage( BalanceReportDirective(balanceReport.id.value) ) verify(pbcServiceMock, times(3)).getCoinBalance(any(), any()) transaction { Assertions.assertEquals( BalanceEntryRecord.find { (BalanceEntryTable.report eq balanceReport.id) and (BalanceEntryTable.address eq TEST_ADDRESS) }.count(), 1 ) Assertions.assertEquals( BalanceEntryRecord.find { (BalanceEntryTable.report eq balanceReport.id) and (BalanceEntryTable.address eq "dummyAddress1") }.count(), 1 ) Assertions.assertEquals( BalanceEntryRecord.find { (BalanceEntryTable.report eq balanceReport.id) and (BalanceEntryTable.address eq "dummyAddress2") }.count(), 1 ) Assertions.assertEquals( BalanceEntryRecord.find { (BalanceEntryTable.report eq balanceReport.id) }.count(), 3 ) } } }
34.356322
117
0.655236
ff205b4ff841bf6b69a1fa8a16b0be1bc2fd2689
492
kt
Kotlin
src/main/kotlin/br/com/zup/edu/pix/repository/ChaveRepository.kt
tiagoalcantara/orange-talents-01-template-pix-keymanager-grpc
a41383eabbc8029f17f7c4ac1ac6320e7f8d2dbe
[ "Apache-2.0" ]
null
null
null
src/main/kotlin/br/com/zup/edu/pix/repository/ChaveRepository.kt
tiagoalcantara/orange-talents-01-template-pix-keymanager-grpc
a41383eabbc8029f17f7c4ac1ac6320e7f8d2dbe
[ "Apache-2.0" ]
null
null
null
src/main/kotlin/br/com/zup/edu/pix/repository/ChaveRepository.kt
tiagoalcantara/orange-talents-01-template-pix-keymanager-grpc
a41383eabbc8029f17f7c4ac1ac6320e7f8d2dbe
[ "Apache-2.0" ]
null
null
null
package br.com.zup.edu.pix.repository import br.com.zup.edu.pix.model.Chave import io.micronaut.data.annotation.Repository import io.micronaut.data.jpa.repository.JpaRepository import java.util.* @Repository interface ChaveRepository: JpaRepository<Chave, UUID>{ fun existsByChave(chave: String?): Boolean fun findByIdAndIdCliente(id: UUID, idCliente: UUID): Optional<Chave> fun findByChave(chave: String): Optional<Chave> fun findByIdCliente(idCliente: UUID): List<Chave> }
35.142857
72
0.784553
1face4c1beeeb7de9091cea8a66c66e58618d1f7
938
htm
HTML
lege.htm
jhon50/usolt
3e351466246a4aeee78d016109b7b8a6b00d5d38
[ "CC-BY-3.0" ]
null
null
null
lege.htm
jhon50/usolt
3e351466246a4aeee78d016109b7b8a6b00d5d38
[ "CC-BY-3.0" ]
null
null
null
lege.htm
jhon50/usolt
3e351466246a4aeee78d016109b7b8a6b00d5d38
[ "CC-BY-3.0" ]
null
null
null
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Documento sem t&iacute;tulo</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#99CCCC"> <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="3"><div align="center"><a href="http://www.legemimoveis.com.br/"><img src="images/lege1.jpg" width="786" height="335" border="0"></a></div></td> </tr> <tr> <td height="88" colspan="3" bgcolor="#336699"> <div align="center">[[<a href="http://www.legemimoveis.com.br/">ENTRAR</a>]]<font color="#336699">.......</font>..[[<a href="imoveis.htm">VOLTAR</a>]]<br> VISITANTES: <a href="http://contador.s12.com.br" target="_blank"><img src="http://contador.s12.com.br/img-xyZwyA3w-6.gif" alt="Contador de acesso" border="0" align="middle"></a><br> </div></td> </tr> </table> </body> </html>
42.636364
189
0.634328
fb0e9c10bdfc4a9052aa0400c966be9391b1009e
108
c
C
src/coreclr/pal/src/libunwind/tests/Ltest-trace.c
pyracanda/runtime
72bee25ab532a4d0636118ec2ed3eabf3fd55245
[ "MIT" ]
12,278
2015-01-29T17:11:33.000Z
2022-03-31T21:12:00.000Z
src/coreclr/pal/src/libunwind/tests/Ltest-trace.c
pyracanda/runtime
72bee25ab532a4d0636118ec2ed3eabf3fd55245
[ "MIT" ]
37,522
2019-11-25T23:30:32.000Z
2022-03-31T23:58:30.000Z
src/coreclr/pal/src/libunwind/tests/Ltest-trace.c
pyracanda/runtime
72bee25ab532a4d0636118ec2ed3eabf3fd55245
[ "MIT" ]
3,629
2019-11-25T23:29:16.000Z
2022-03-31T21:52:28.000Z
#define UNW_LOCAL_ONLY #include <libunwind.h> #if !defined(UNW_REMOTE_ONLY) #include "Gtest-trace.c" #endif
18
29
0.777778
82248e110741f9a7916f17aaf2128169818c48f3
1,736
swift
Swift
B05101_2_Commonly_Used_Data_Structures.playground/Pages/Tuples.xcplaygroundpage/Contents.swift
ruddyscent/swift-dsa
525d60a7cb9946cdedfbfa41d197305136dd56e8
[ "MIT" ]
null
null
null
B05101_2_Commonly_Used_Data_Structures.playground/Pages/Tuples.xcplaygroundpage/Contents.swift
ruddyscent/swift-dsa
525d60a7cb9946cdedfbfa41d197305136dd56e8
[ "MIT" ]
null
null
null
B05101_2_Commonly_Used_Data_Structures.playground/Pages/Tuples.xcplaygroundpage/Contents.swift
ruddyscent/swift-dsa
525d60a7cb9946cdedfbfa41d197305136dd56e8
[ "MIT" ]
null
null
null
//: [Previous](@previous) import Foundation //: ## Tuples //: ### Unamed Tuples //: //: You can create tuples with any number and combination of types. Let’s create a tuple that would contain an integer, string, and integer types let responseCode = (4010, "Invalid file contents", 0x21451fff3b) //: If you want to control the type used and not rely on the compiler inferring the type from the literal expression you can explicitly declare the value type: let explicitResponseCode: (Int, String, Double) = (4010, "Invalid file contents", 0x8fffffffffffffff) // You can verify the tuple types assigned print(type(of: responseCode)) //: ### Named Tuples //: //: Named tuples are just as their name implies; they allow you to name the tuple values. Using named tuples will allow you to write terser code and can be helpful for identifying what an index position is when returning a tuple from a method. let errorCode = (errorCode:4010, errorMessage:"Invalid file contents", offset:0x7fffffffffffffff) print(errorCode.errorCode) //: Tuples are most useful as providing temporary structured values fthat are returned from methods. func getPartnerList() -> (statusCode:Int, description:String, metaData:(partnerStatusCode:Int, partnerErrorMessage:String, parterTraceId:String)) { //... some error occurred return (503, "Service Unavailable", (32323, "System is down for maintainance until 2015-11-05T03:30:00+00:00", "5A953D9C-7781-427C-BC00-257B2EB98426")) } var result = getPartnerList() result.statusCode result.description result.metaData.partnerErrorMessage result.metaData.partnerStatusCode result.metaData.parterTraceId /*: [Next](@next) The license for this document is available [here](License). */
31.563636
243
0.759793
53c08ca263bcf973fabe56d696ba94df459916ce
788
java
Java
interpreter/bytecode/LabelCode.java
TSechrist/csc413Interpreter
8f1681219c162141e4273d05b8a3ebd3c7ecf1db
[ "MIT" ]
null
null
null
interpreter/bytecode/LabelCode.java
TSechrist/csc413Interpreter
8f1681219c162141e4273d05b8a3ebd3c7ecf1db
[ "MIT" ]
null
null
null
interpreter/bytecode/LabelCode.java
TSechrist/csc413Interpreter
8f1681219c162141e4273d05b8a3ebd3c7ecf1db
[ "MIT" ]
null
null
null
package interpreter.bytecode; import interpreter.VirtualMachine; import java.util.ArrayList; /* LabelCode is a placeholder to help resolve all of the address jumps. It is the location where CallCode, GotoCode, and FalseBranchCode will jump to. */ public class LabelCode extends ByteCode { private String label; private int point; @Override public void init(ArrayList<String> argument) { label = argument.get(0); } @Override public void execute(VirtualMachine vm) { } public String getLabel(){ return label; } public int getPoint() { return point; } public void setPoint(int newPoint){ point = newPoint; } public String print(){ return ("LABEL " + label + "\n"); } }
16.081633
59
0.642132
d2cda26fdaac573a7a0fccc27b9268775c64314c
34
php
PHP
resources/views/backend/pages/user/index.blade.php
eshariar71/laravel-admin-panel
ddf17ce6e96bd483ca16e2325fd97f78131f2fb1
[ "Apache-2.0" ]
null
null
null
resources/views/backend/pages/user/index.blade.php
eshariar71/laravel-admin-panel
ddf17ce6e96bd483ca16e2325fd97f78131f2fb1
[ "Apache-2.0" ]
null
null
null
resources/views/backend/pages/user/index.blade.php
eshariar71/laravel-admin-panel
ddf17ce6e96bd483ca16e2325fd97f78131f2fb1
[ "Apache-2.0" ]
null
null
null
<h1>This is user Desh Board!</h1>
17
33
0.676471
fddce19d0ac3a4fa0f464d3f8d07b7b08637d413
6,462
swift
Swift
HMCatalog/Supporting Files/HMHome+Properties.swift
snOOrz/FixHomeKitNames
9fa4bf9c33b33d33b00d44c001daca96323f6357
[ "AML" ]
1
2017-08-20T15:50:15.000Z
2017-08-20T15:50:15.000Z
HMCatalog/Supporting Files/HMHome+Properties.swift
snOOrz/FixHomeKitNames
9fa4bf9c33b33d33b00d44c001daca96323f6357
[ "AML" ]
null
null
null
HMCatalog/Supporting Files/HMHome+Properties.swift
snOOrz/FixHomeKitNames
9fa4bf9c33b33d33b00d44c001daca96323f6357
[ "AML" ]
null
null
null
/* Copyright (C) 2016 Apple Inc. All Rights Reserved. See LICENSE.txt for this sample’s licensing information Abstract: The `HMHome+Properties` methods provide convenience methods for deconstructing `HMHome` objects. */ import HomeKit extension HMHome { /// All the services within all the accessories within the home. var allServices: [HMService] { return accessories.reduce([], combine: { (accumulator, accessory) -> [HMService] in return accumulator + accessory.services.filter { return !accumulator.contains($0) } }) } /// All the characteristics within all of the services within the home. var allCharacteristics: [HMCharacteristic] { return allServices.reduce([], combine: { (accumulator, service) -> [HMCharacteristic] in return accumulator + service.characteristics.filter { return !accumulator.contains($0) } }) } /** - returns: A dictionary mapping localized service types to an array of all services of that type. */ var serviceTable: [String: [HMService]] { var serviceDictionary = [String: [HMService]]() for service in self.allServices { if !service.isControlType { continue } let serviceType = service.localizedDescription var existingServices: [HMService] = serviceDictionary[serviceType] ?? [HMService]() existingServices.append(service) serviceDictionary[service.localizedDescription] = existingServices } for (serviceType, services) in serviceDictionary { serviceDictionary[serviceType] = services.sort { return $0.accessory!.name.localizedCompare($1.accessory!.name) == .OrderedAscending } } return serviceDictionary } /// - returns: All rooms in the home, including `roomForEntireHome`. var allRooms: [HMRoom] { let allRooms = [self.roomForEntireHome()] + self.rooms return allRooms.sortByLocalizedName() } /// - returns: `true` if the current user is the admin of this home; `false` otherwise. var isAdmin: Bool { return self.homeAccessControlForUser(currentUser).administrator } /// - returns: All accessories which are 'control accessories'. var sortedControlAccessories: [HMAccessory] { let filteredAccessories = self.accessories.filter { accessory -> Bool in for service in accessory.services { if service.isControlType { return true } } return false } return filteredAccessories.sortByLocalizedName() } /** - parameter identifier: The UUID to look up. - returns: The accessory within the receiver that matches the given UUID, or nil if there is no accessory with that UUID. */ func accessoryWithIdentifier(identifier: NSUUID) -> HMAccessory? { for accessory in self.accessories { if accessory.uniqueIdentifier == identifier { return accessory } } return nil } /** - parameter identifiers: An array of `NSUUID`s that match accessories in the receiver. - returns: An array of `HMAccessory` instances corresponding to the UUIDs passed in. */ func accessoriesWithIdentifiers(identifiers: [NSUUID]) -> [HMAccessory] { return self.accessories.filter { accessory in identifiers.contains(accessory.uniqueIdentifier) } } /** Searches through the home's accessories to find the accessory that is bridging the provided accessory. - parameter accessory: The bridged accessory. - returns: The accessory bridging the bridged accessory. */ func bridgeForAccessory(accessory: HMAccessory) -> HMAccessory? { if !accessory.bridged { return nil } for bridge in self.accessories { if let identifiers = bridge.uniqueIdentifiersForBridgedAccessories where identifiers.contains(accessory.uniqueIdentifier) { return bridge } } return nil } func nameForRoomId(uuid: String) -> String { return roomFromId(uuid).name } func roomFromId(uuid : String) -> HMRoom { for room in self.rooms { if (room.uniqueIdentifier.UUIDString == uuid) { return room } } return self.roomForEntireHome() } public func assignAccessory(accessory: HMAccessory, toRoomId roomId: String, completionHandler completion: (NSError?) -> Void) { self.assignAccessory(accessory, toRoom: roomFromId(roomId), completionHandler: completion) } /** - parameter zone: The zone. - parameter rooms: A list of rooms to add to the final list. - returns: A list of rooms that exist in the home and have not yet been added to this zone. */ func roomsNotAlreadyInZone(zone: HMZone, includingRooms rooms: [HMRoom]? = nil) -> [HMRoom] { var filteredRooms = self.rooms.filter { room in return !zone.rooms.contains(room) } if let rooms = rooms { filteredRooms += rooms } return filteredRooms } /** - parameter home: The home. - parameter serviceGroup: The service group. - parameter services: A list of services to add to the final list. - returns: A list of services that exist in the home and have not yet been added to this service group. */ func servicesNotAlreadyInServiceGroup(serviceGroup: HMServiceGroup, includingServices services: [HMService]? = nil) -> [HMService] { var filteredServices = self.allServices.filter { service in /* Exclude services that are already in the service group and the accessory information service. */ return !serviceGroup.services.contains(service) && service.serviceType != HMServiceTypeAccessoryInformation } if let services = services { filteredServices += services } return filteredServices } }
36.508475
136
0.610492
90eef96e4aca63199fbb61f96abc35b732345c57
6,791
py
Python
feder/cases/tests.py
dzemeuksis/feder
32ef7793af6256d4ecada61505c7baf334b34419
[ "MIT" ]
16
2015-08-11T17:20:26.000Z
2022-02-11T20:15:41.000Z
feder/cases/tests.py
dzemeuksis/feder
32ef7793af6256d4ecada61505c7baf334b34419
[ "MIT" ]
534
2015-08-04T00:10:54.000Z
2022-03-17T10:44:47.000Z
feder/cases/tests.py
dzemeuksis/feder
32ef7793af6256d4ecada61505c7baf334b34419
[ "MIT" ]
10
2017-08-30T13:34:32.000Z
2022-02-18T13:00:35.000Z
from django.urls import reverse from django.test import RequestFactory, TestCase from django.utils.http import urlencode from feder.cases.models import Case from feder.institutions.factories import InstitutionFactory from feder.letters.factories import IncomingLetterFactory from feder.letters.models import Letter from feder.main.tests import PermissionStatusMixin from feder.parcels.factories import IncomingParcelPostFactory from feder.users.factories import UserFactory from .factories import CaseFactory, AliasFactory from .forms import CaseForm from .views import CaseAutocomplete from feder.teryt.factories import CommunityJSTFactory, CountyJSTFactory class ObjectMixin: def setUp(self): self.user = UserFactory(username="john") self.case = CaseFactory() self.permission_object = self.case.monitoring class CaseFormTestCase(ObjectMixin, TestCase): def test_standard_save(self): data = {"name": "example", "institution": InstitutionFactory().pk} form = CaseForm(monitoring=self.case.monitoring, user=self.user, data=data) self.assertTrue(form.is_valid(), msg=form.errors) obj = form.save() self.assertEqual(obj.name, "example") self.assertEqual(obj.monitoring, self.case.monitoring) self.assertEqual(obj.user, self.user) class CaseListViewTestCase(ObjectMixin, PermissionStatusMixin, TestCase): permission = [] status_anonymous = 200 status_no_permission = 200 def get_url(self): return reverse("cases:list") def test_filter_out_quarantined(self): Case.objects.filter(pk=self.case.pk).update(is_quarantined=True) response = self.client.get(self.get_url()) self.assertNotContains(response, self.case.name) def test_show_quaranited_for_authorized(self): Case.objects.filter(pk=self.case.pk).update(is_quarantined=True) self.grant_permission("monitorings.view_quarantined_case") self.login_permitted_user() response = self.client.get(self.get_url()) self.assertContains(response, self.case) def test_for_filter_cases_by_community(self): common_county = CountyJSTFactory() valid = CaseFactory(institution__jst=CommunityJSTFactory(parent=common_county)) invalid = CaseFactory( institution__jst=CommunityJSTFactory(parent=common_county) ) response = self.client.get( "{}?voideship={}&county={}&community={}".format( self.get_url(), common_county.parent.pk, common_county.pk, valid.institution.jst.pk, ) ) self.assertContains(response, valid.name) self.assertContains(response, valid.institution.name) self.assertNotContains(response, invalid.name) self.assertNotContains(response, invalid.institution.name) class CaseDetailViewTestCase(ObjectMixin, PermissionStatusMixin, TestCase): permission = [] status_anonymous = 200 status_no_permission = 200 def get_url(self): return reverse("cases:details", kwargs={"slug": self.case.slug}) def test_show_note_on_letter(self): letter = IncomingLetterFactory(record__case=self.case) response = self.client.get(self.get_url()) self.assertContains(response, letter.note) def test_not_contains_spam_letter(self): letter = IncomingLetterFactory(record__case=self.case, is_spam=Letter.SPAM.spam) response = self.client.get(self.get_url()) self.assertNotContains(response, letter.body) def test_contains_letter(self): letter = IncomingLetterFactory(record__case=self.case) response = self.client.get(self.get_url()) self.assertContains(response, letter.body) def test_show_parce_post(self): parcel = IncomingParcelPostFactory(record__case=self.case) response = self.client.get(self.get_url()) self.assertContains(response, parcel.title) class CaseCreateViewTestCase(ObjectMixin, PermissionStatusMixin, TestCase): permission = ["monitorings.add_case"] def get_url(self): return reverse( "cases:create", kwargs={"monitoring": str(self.case.monitoring.pk)} ) class CaseUpdateViewTestCase(ObjectMixin, PermissionStatusMixin, TestCase): permission = ["monitorings.change_case"] def get_url(self): return reverse("cases:update", kwargs={"slug": self.case.slug}) class CaseDeleteViewTestCase(ObjectMixin, PermissionStatusMixin, TestCase): permission = ["monitorings.delete_case"] def get_url(self): return reverse("cases:delete", kwargs={"slug": self.case.slug}) class CaseAutocompleteTestCase(TestCase): # TODO: Why `self.Client` is not in use? def setUp(self): self.factory = RequestFactory() def test_filter_by_name(self): CaseFactory(name="123") CaseFactory(name="456") request = self.factory.get("/customer/details", data={"q": "123"}) request.user = UserFactory() response = CaseAutocomplete.as_view()(request) self.assertContains(response, "123") self.assertNotContains(response, "456") class SitemapTestCase(ObjectMixin, TestCase): def test_cases(self): url = reverse("sitemaps", kwargs={"section": "cases"}) needle = reverse("cases:details", kwargs={"slug": self.case.slug}) response = self.client.get(url) self.assertContains(response, needle) class CaseQuerySetTestCase(TestCase): def test_find_by_email(self): case = CaseFactory(email="case-123@example.com") self.assertEqual( Case.objects.by_addresses(["case-123@example.com"]).get(), case ) def test_find_by_alias(self): case = CaseFactory(email="case-123@example.com") AliasFactory(case=case, email="alias-123@example.com") self.assertEqual( Case.objects.by_addresses(["alias-123@example.com"]).get(), case ) class CaseReportViewSetTestCase(TestCase): # TODO: Tests for other available filters could be added here def test_filter_by_name(self): CaseFactory(institution=InstitutionFactory(name="123")) CaseFactory(institution=InstitutionFactory(name="456")) response = self.client.get( "{}?{}".format(reverse("case-report-list"), urlencode({"name": "2"})) ) self.assertContains(response, "123") self.assertNotContains(response, "456") def test_csv_renderer_used(self): response = self.client.get( "{}?{}".format(reverse("case-report-list"), urlencode({"format": "csv"})) ) self.assertEqual(response.status_code, 200) self.assertIn("text/csv", response["content-type"])
36.315508
88
0.691945
d2e6f4e359f14e0c50b30e200036365d1e9db6d0
3,818
php
PHP
app/Http/Controllers/UserController.php
kodinginaj/TreklinApi
7f4664e2666b48a0c3bc6e5e81a7a48629a0a3ef
[ "MIT" ]
null
null
null
app/Http/Controllers/UserController.php
kodinginaj/TreklinApi
7f4664e2666b48a0c3bc6e5e81a7a48629a0a3ef
[ "MIT" ]
1
2021-02-02T19:06:51.000Z
2021-02-02T19:06:51.000Z
app/Http/Controllers/UserController.php
kodinginaj/TreklinApi
7f4664e2666b48a0c3bc6e5e81a7a48629a0a3ef
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers; use App\Article; use App\Complaint; use Illuminate\Http\Request; use App\User; use App\Officer; use Carbon\Carbon; class UserController extends Controller { public function getOfficer() { $result = Officer::getOfficer(); $data['status'] = '1'; if (sizeOf($result) > 0) { $data['message'] = 'Data tersedia'; } else { $data['message'] = 'Data kosong'; } $data['officer'] = Officer::getOfficer(); return $data; } public function userComplaint(Request $request) { $userid = $request->userid; $officerid = $request->officerid; $complaint = $request->complaint; $latitude = $request->latitude; $longitude = $request->longitude; $insert = Complaint::insertComplaint($userid, $officerid, $complaint, $latitude, $longitude); if ($insert->exists) { $data['status'] = "1"; $data['message'] = "Berhasil mengajukan complaint"; return $data; } else { $data['status'] = "0"; $data['message'] = "Oops ada kesalahan"; return $data; } } public function insertArticle(Request $request) { $judul = $request->judul; $penulis = $request->penulis; $isi = $request->isi; $angka = mt_rand(0, 100); $images = $request->foto->getClientOriginalName(); $array = explode(".", $images); $gabung = "img-article/" . $angka . $array[0] . Carbon::now()->format('ymd') . "ART." . end($array); $simpan = $angka . $array[0] . Carbon::now()->format('ymd') . "ART." . end($array); $request->foto->move(public_path() . "/img-article", $simpan); $save['judul'] = $judul; $save['penulis'] = $penulis; $save['foto'] = $gabung; $save['isi'] = $isi; $insert = Article::insertArticle($save); if ($insert->exists) { $data['status'] = "1"; $data['message'] = "Berhasil menambah article"; return $data; } else { $data['status'] = "0"; $data['message'] = "Oops ada kesalahan"; return $data; } } public function getArticle() { $article = Article::getArticle(); if ($article->count() > 0) { $data['status'] = "1"; $data['message'] = "Data tersedia"; $data['data'] = $article->toArray(); return $data; } else { $data['status'] = "1"; $data['message'] = "Data kosong"; $data['data'] = []; return $data; } } public function getDetailArticle(Request $request) { $id = $request->id; $result = Article::getArticleById($id); $article = Article::getAnotherArticle($id); if ($result['status'] == 1 && $article->count() > 0) { $data['status'] = "1"; $data['message'] = "Data tersedia"; $data['data'] = $article->toArray(); $data['article'] = $result['article']; return $data; } else if ($result['status'] == 1 && !$article->count() > 0) { $data['status'] = "1"; $data['message'] = "Data tersedia"; $data['data'] = []; $data['article'] = $result['article']; return $data; } else if ($article->count() > 0) { $data['status'] = "1"; $data['message'] = "Data tersedia"; $data['data'] = $article->toArray(); $data['article'] = null; return $data; } else { $data['status'] = "0"; $data['message'] = "Data kosong"; return $data; } } }
30.062992
108
0.486118
46174574afdec8cbb7ef9c0c1a19375768b47986
5,582
asm
Assembly
dv3/msd/salt4.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
dv3/msd/salt4.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
dv3/msd/salt4.asm
olifink/smsqe
c546d882b26566a46d71820d1539bed9ea8af108
[ "BSD-2-Clause" ]
null
null
null
; DV3 MSDOS Sector Allocate, Locate and Truncate V3.00  1993 Tony Tebby section dv3 xdef msd_sal4 xdef msd_slc4 xdef msd_str4 xref msd_setmu include 'dev8_keys_DOS' include 'dev8_dv3_keys' include 'dev8_dv3_msd_keys' include 'dev8_keys_err' include 'dev8_mac_assert' include 'dev8_mac_xword' ;+++ ; DV3 MSDOS allocate new group of sectors ; ; d0 cr known logical drive group / logical drive group ; d1 c p file group of known drive group ; d2 c p next file group ; d6 c p file ID ; d7 c p drive ID / number ; a0 c p pointer to channel block ; a3 c p pointer to linkage ; a4 c p pointer to drive definition ; ; status return positive (OK) or standard error ; ;--- msd_sal4 ms4a.reg reg d1/d2/a2 movem.l ms4a.reg,-(sp) subq.l #1,d2 blt.s ms4a_new ; new file bsr.s ms4l_find ; find previous group blt.s ms4a_exit move.l d0,d2 ; keep previus group bsr.s ms4a_vg ; looking from d0 ble.s ms4a_drfl ; ... not found add.l d2,d2 ; index the FAT for previous group add.l d2,a2 move.w d0,d1 xword d1 move.w d1,(a2) ; link new one into list jsr msd_setmu ms4a_exit movem.l (sp)+,ms4a.reg rts ms4a_drfl ms4n_drfl moveq #err.drfl,d0 bra.s ms4a_exit ; drive full ;+++ ; DV3 MSDOS allocate first group of new file ; ; d0 r logical drive group ; d6 c u file ID (0 if not allocated) ; d7 c p drive ID / number ; a0 c p pointer to channel block ; a3 c p pointer to linkage ; a4 c p pointer to drive definition ; ; status return positive (OK) or standard error ;--- ;;;msd_snw4 ;;; movem.l ms4a.reg,-(sp) ms4a_new bsr.s ms4a_vg0 ; look for vacant sector from start ble.s ms4n_drfl ; ... not found move.w d0,d6 ; use first group number as file ID move.l d0,d3c_flid(a0) ; and set ID in channel movem.l (sp)+,ms4a.reg rts ; look for vacant group ms4a_vg bsr.s ms4a_vgx ; look for vacant group from d0 bgt.s ms4a_rts ; .. ok ms4a_vg0 moveq #1,d0 ; try from start ms4a_vgx move.l mdf_fat(a4),a2 ; base of FAT addq.l #1,d0 ; + 1 entry add.l d0,a2 ; + group offset add.l d0,a2 moveq #0,d1 move.w mdf_fent(a4),d1 ; number to search subq.l #1,d1 sub.l d0,d1 blt.s ms4a_nv ; ... none assert dos.free,0 ms4a_vloop tst.w (a2)+ ; free? dbeq d1,ms4a_vloop bne.s ms4a_nv ; none move.w #dos.eff4,-(a2) ; new end of file subq.w #1,ddf_afree+2(a4) jsr msd_setmu move.l a2,d0 move.l mdf_fat(a4),a2 ; base of FAT sub.l a2,d0 lsr.l #1,d0 ; new group number ms4a_rts rts ms4a_nv moveq #0,d0 ; no vacant groups rts ;+++ ; DV3 MSDOS locate group of sectors ; ; d0 cr known logical drive group / logical drive group ; d1 c p file group of known drive group ; d2 c p file group required ; d6 c p file ID ; d7 c p drive ID / number ; a0 c p pointer to channel block ; a3 c p pointer to linkage ; a4 c p pointer to drive definition ; ; status return positive (OK) or standard error ;--- msd_slc4 ms4l.reg reg d1/d2/a2 movem.l ms4l.reg,-(sp) bsr.s ms4l_find movem.l (sp)+,ms4l.reg rts ; routine to find a group in the map ms4l_find tst.w d0 ; any known group? beq.s ms4l_start cmp.w d1,d2 ; req sector before or after known? bhi.s ms4l_look ; here or after beq.s ms4l_d0 ms4l_start move.l d6,d0 ; zeroth cluster moveq #0,d1 ms4l_look move.l mdf_fat(a4),a2 sub.w d1,d2 ; go this far beq.s ms4l_d0 subq.w #1,d2 ms4l_ckl move.l d0,d1 ; cluster in long add.l d1,d1 ; index table move.w (a2,d1.l),d0 ; next xword d0 dbeq d2,ms4l_ckl beq.s ms4l_mchk ; ... empty sector cmp.w ddf_atotal+2(a4),d0 ; valid sector? blo.s ms4l_d0 ; ... yes ms4l_mchk moveq #err.mchk,d0 ; oops, not found ms4l_d0 tst.l d0 rts ;+++ ; DV3 MSDOS truncate sector allocation ; ; d0 cr known logical drive group / error status ; d1 c p file group of known drive group ; d2 c p first file group to free ; d6 c u file ID ; d7 c p drive ID / number ; a0 c p pointer to channel block ; a3 c p pointer to linkage ; a4 c p pointer to drive definition ; ; status return standard ;--- msd_str4 tst.l d6 ; any sectors allocated at all? bne.s ms4t_do ; ... yes moveq #0,d0 rts ms4t_do ms4t.reg reg d1/d2/d3/a1/a2 movem.l ms4t.reg,-(sp) subq.l #1,d2 ; previous sector blt.s ms4t_start ; ... none bsr.s ms4l_find ; find previous blt.s ms4t_exit move.l d0,d1 add.l d1,d1 ; index table move.w (a2,d1.l),d0 ; ... next group xword d0 move.w #dos.eff4,(a2,d1.l) ; set new end of file move.l d1,d2 ; check for sector update bra.s ms4t_sa1 ms4t_start move.l d6,d0 ; start at beginning of file moveq #0,d6 ; no ID now move.l d6,d3c_flid(a0) ; nor in channel block move.l d0,d2 add.l d2,d2 ; our check for update ms4t_sa1 move.l mdf_fat(a4),a1 move.l ddf_smask(a4),d3 not.l d3 and.l d3,d2 ; just the sector bra.s ms4t_cknext ms4t_loop move.l d0,d1 add.l d1,d1 move.w (a1,d1.l),d0 ; next group beq.s ms4t_mchk ; ... oops xword d0 clr.w (a1,d1.l) ; clear it addq.w #1,ddf_afree+2(a4) ; ... one more sector free and.l d3,d1 ; sector the same as previous? cmp.l d2,d1 beq.s ms4t_cknext bsr.s ms4t_upd ; mark updated move.l d1,d2 ; our next check ms4t_cknext cmp.w ddf_atotal+2(a4),d0 ; valid next sector? blo.s ms4t_loop ; ... yes cmp.w #dos.eof4,d0 ; end of file? blo.s ms4t_mchk ; ... no move.l d1,d2 bsr.s ms4t_upd ; last sector updated moveq #0,d0 ms4t_exit movem.l (sp)+,ms4t.reg rts ms4t_mchk moveq #err.mchk,d0 bra.s ms4t_exit rts ms4t_upd lea (a1,d2.l),a2 ; this sector updated jmp msd_setmu end
19.794326
79
0.669294
87ca9e5d269d0e835a7521fd430976fe43329c9b
3,911
swift
Swift
Floral/Floral/Classes/Profile/Setting/Controller/SettingViewController.swift
SunLiner/Floral
68d1e490864375be5a5d8c6cc5e8f505d40a6cdb
[ "MIT" ]
423
2016-06-09T07:29:55.000Z
2021-06-03T18:43:24.000Z
Floral/Floral/Classes/Profile/Setting/Controller/SettingViewController.swift
yuntiaoOS/Floral
68d1e490864375be5a5d8c6cc5e8f505d40a6cdb
[ "MIT" ]
10
2016-06-11T02:06:48.000Z
2017-07-20T07:21:29.000Z
Floral/Floral/Classes/Profile/Setting/Controller/SettingViewController.swift
yuntiaoOS/Floral
68d1e490864375be5a5d8c6cc5e8f505d40a6cdb
[ "MIT" ]
131
2016-06-09T09:10:46.000Z
2021-01-12T07:01:21.000Z
// // SettingViewController.swift // Floral // // Created by 孙林 on 16/5/25. // Copyright © 2016年 ALin. All rights reserved. // import UIKit import Kingfisher let LoginoutNotify = "LoginoutNotify" class SettingViewController: UITableViewController { // 缓存label @IBOutlet weak var cacheLabel: UILabel! // 图片缓存 private lazy var cache = Kingfisher.ImageCache.defaultCache override func viewDidLoad() { super.viewDidLoad() setup() } private func setup() { tableView.contentInset = UIEdgeInsets(top: -20, left: 0, bottom: 0, right: 0) // 由于这个项目的主要缓存集中在图片上, 这儿只做了图片的缓存显示和清理. // 显示图片缓存 cache.calculateDiskCacheSizeWithCompletionHandler { (size) in // b 转换 为 Mb let mSize = Float(size) / 1024.0 / 1024.0 // 取一位小数即可 self.cacheLabel.text = String(format: "%.1fM", mSize) } } override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { if indexPath.section == 0 { switch indexPath.row { case 0,1,2: showErrorMessage("账号相关的需要登录.暂未做, 敬请期待") case 3: jumpToProtocal("积分规则", url: "http://m.htxq.net/servlet/SysContentServlet?action=getDetail&id=309356e8-6bde-40f4-98aa-6d745e804b1f") case 4: jumpToProtocal("认证规则", url: "http://m.htxq.net/servlet/SysContentServlet?action=getDetail&id=48d4eac5-18e6-4d48-8695-1a42993e082e") default: break } }else if(indexPath.section == 1){ switch indexPath.row { case 0: jumpToProtocal("关于我们", url: "http://m.htxq.net/servlet/SysContentServlet?action=getDetail&id=0001c687-9393-4ad3-a6ad-5b81391c5253") case 1: jumpToProtocal("商业合作", url: "http://m.htxq.net/servlet/SysContentServlet?action=getDetail&id=e30840e6-ef01-4e97-b612-8b930bdfd8bd") case 2: ALinLog("意见反馈") case 3: toAppStore() default: break } }else{ if indexPath.row == 0 { // 清除缓存 cache.clearDiskCache() // 清除缓存 showHudInView(view, hint: "正在清除缓存...", yOffset: 0) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), { self.hideHud() self.showHint("清理完成", duration: 2.0, yOffset: 0.0) self.cacheLabel.text = "0M" }) } } } // MARK: - private method // 去AppStore给我们评分 private func toAppStore() { UIApplication.sharedApplication().openURL(NSURL(string: "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=998252000")!) } // 跳转到协议界面 private func jumpToProtocal(title: String, url: String) { let protocolVc = ProtocolViewController() protocolVc.navigationItem.title = title protocolVc.HTM5Url = url let nav = NavgationViewController(rootViewController: protocolVc) presentViewController(nav, animated: true, completion: nil) } // 退出登录 @IBAction func logout() { // 花田小憩官方版的做法, 是调用一个接口, 告诉后台, 该号码已经退出了. 也可以把cookie清除. // 退出的接口: (POST) // http://m.htxq.net/servlet/UserCustomerServlet // 参数 // action=logout&token=&userId= // 0. 设置登录状态 LoginHelper.sharedInstance.setLoginStatus(false) // 1. 返回到登录界面 // 1.2 退出设置界面 navigationController?.popToRootViewControllerAnimated(false) // 1.1 发送通知, 通知tab进行调整 NSNotificationCenter.defaultCenter().postNotificationName(LoginoutNotify, object: nil) } }
33.715517
151
0.579136
4bc28434864d8cb4ba6cb8606c37485d1a31313a
8,309
tab
SQL
data/2007_Tabita_Rubisco_examples.tab
Asplund-Samuelsson/redmagpie
c1cb1e73fde61ef2ddcc746896beb407ee3109d4
[ "MIT" ]
null
null
null
data/2007_Tabita_Rubisco_examples.tab
Asplund-Samuelsson/redmagpie
c1cb1e73fde61ef2ddcc746896beb407ee3109d4
[ "MIT" ]
null
null
null
data/2007_Tabita_Rubisco_examples.tab
Asplund-Samuelsson/redmagpie
c1cb1e73fde61ef2ddcc746896beb407ee3109d4
[ "MIT" ]
null
null
null
Form Organism Accession IA Acidithiobacillus ferrooxidans AAD30508 IA Alkalilimnicola ehrlichei MLHE-1 YP_743666 IA Allochromatium vinosum P22859 IA Allochromatium vinosum P22849 IA Bradyrhizobium sp. BTAi1 ZP_00862357 IA Cupriavidus (Rasltonia) metallidurans ZP_00599453 IA Halorhodospira halophila SL1 YP_001002624 IA Hydrogenophilus thermoluteolus Q51856 IA Hydrogenovibrio marinus Q59460 IA Methylococcus capsulatus str. Bath AAU91176 IA Nitrobacter hamburgensis X14 ZP_00628048 IA Nitrobacter vulgaris Q59613 IA Nitrobacter winogradskyi Nb-255 ABA05246 IA Nitrosomonas europaea ATCC 19718 CAD85832 IA Nitrosomonas eutropha C91 YP_747036 IA Prochlorococcus marinus str. CCMP1375 AAP99596 IA Prochlorococcus marinus str. MIT9312 ABB49611 IA Prochlorococcus marinus str. MIT9313 NP_895035 IA Rhodobacter capsulatus O32740 IA Rhodopseudomonas palustris BisB5 YP_568687 IA Solemya velum gill symbiont AAT01429 IA Synechococcus sp. CC9605 ABB34521 IA Synechococcus sp. CC9902 ABB26572 IA Synechococcus sp. WH 7803 P96486 IA Synechococcus sp. WH 8102 CAE08233 IA Thiobacillus denitrificans ATCC 25259 YP_316382 IA Thiomicrospira crunogena XCL-2 ABB41023 IA Thiomicrospira crunogena XCL-2 ABB41434 IA Global Ocean Sampling expedition EDH70269 IA Global Ocean Sampling expedition EDJ35923 IA Global Ocean Sampling expedition ECW27924 IA Global Ocean Sampling expedition EDJ53092 IA uncultured bacterium 441 AAR37722 IB Anabaena variabilis ATCC 29413 ABA23512 IB Chlamydomonas reinhardtii P00877 IB Chlorella ellipsoidea BAA01765 IB Crocosphaera watsonii WH 8501 ZP_00516814 IB Euglena gracilis NP_041936 IB Gloeobacter violaceus PCC 7421 BAC90097 IB Nicotiana tabacum P00876 IB Nostoc punctiforme PCC 73102 ZP_00108159 IB Nostoc sp. PCC 7120 BAB77890 IB Prochlorothrix hollandica P27568 IB Sargasso Sea EAH88772 IB Spinacia oleracea P00875 IB Synechococcus elongatus PCC 6301 P00880 IB Synechocystis sp. PCC 6803 CAA46773 IB Thermosynechococcus BP-1 BAC09058 IB Trichodesmium erythraeum IMS101 ZP_00674058 IC/D Paracoccus denitrificans PD1222 ZP_00629446 IC/D Rhodobacter sphaeroides 2.4.1 AAA26115 IC/D Rubrivivax gelatinosus ZP_00243663 IC/D Rubrivivax gelatinosus PM1 ZP_00243775 IC/D Sinorhizobium meliloti CAC48591 IC/D Xanthobacter autotrophicus Py2 ZP_01200598 IC/D Xanthobacter flavus P23011 IC/D Acidiphilium cryptum JF-5 ZP_01146719 IC/D Aurantimonas sp. SI85-9A1 AAB41464 IC/D Bradyrhizobium japonicum USDA110 BAC47850 IC/D Bradyrhizobium sp. BTAi1 ZP_00859065 IC/D Bradyrhizobium sp. BTAi1 ZP_00859216 IC/D Burkholderia xenovorans (fungorum) LB400 ZP_00283421 IC/D Chrysochromulina hirta P48692 IC/D Cylindrotheca sp. strain N1 AAA84192 IC/D Ectocarpus siliculosus P24313 IC/D Emiliania huxleyi YP_277313 IC/D Nitrobacter hamburgensis X14 ZP_00626373 IC/D Nitrobacter winogradskyi Nb-255 ABA06179 IC/D Nitrosococcus oceani ATCC 19707 ABA56859 IC/D Nitrosospira multiformis ATCC 251966 YP_411385 IC/D Odontella sinensis NP_043654 IC/D Olisthodiscus luteus P14959 IC/D Pleurochrysis carterae Q08051 IC/D Porphyridium aerugineum Q09119 IC/D Rhodopseudomonas palustris BisA53 YP_780293 IC/D Rhodopseudomonas palustris BisB18 YP_531208 IC/D Rhodopseudomonas palustris BisB5 YP_570844 IC/D Rhodopseudomonas palustris CGA009 CAE27000 IC/D Rhodopseudomonas palustris HaA2 YP_487568 IC/D Global Ocean Sampling expedition EDB85359 IC/D Global Ocean Sampling expedition EBN02296 IC/D Global Ocean Sampling expedition EDC15610 IC/D Global Ocean Sampling expedition EDD64574 II Dechloromonas aromatica RCB AAZ48366 II Hydrogenovibrio marinus Q59462 II Lingulodinium polyedrum AAA98748 II Magnetospirillum magnetotacticum AAL76920 II Magnetospirillum magnetotacticum AMB-1 YP_422059 II Polaromonas napthalenivorans CJ2 YP_982208 II Prorocentrum minimum AF463409 II Rhodobacter capsulatus P50922 II Rhodobacter sphaeroides 2.4.1 ABA80879 II Rhodoferax ferrireducens T118 YP_522655 II Rhodopseudomonas palustris BisA53 YP_781603 II Rhodopseudomonas palustris BisB18 YP_532762 II Rhodopseudomonas palustris BisB5 YP_568193 II Rhodopseudomonas palustris CGA009 CAE30081 II Rhodopseudomonas palustris HaA2 YP_484572 II Rhodospirillum rubrum CAA25080 II Symbiodinium sp. AAG37859 II Thiobacillus denitrificans ATCC 25259 YP_316396 II Thiomicrospira crunogena XCL-2 ABB41020 II Global Ocean Sampling expedition ECW52658 II Methanococcoides burtonii DSM 6242 ZP_00563653 II Methanosaeta thermophila PT ZP_01153096 II Methanospirillum hungatei JF-1 YP_503739 III-1 Methanocaldococcus jannaschii AAB99239 III-1 Methanosarcina acetivorans C2A AAM07894 III-1 Methanosarcina barkeri str. fusaro AAZ69876 III-1 Methanosarcina mazei Go1 AAM30945 III-2 Archaeoglobus fulgidus DSM 4304 NP_070466 III-2 Hyperthermus butylicus DSM 5456 YP_001012710 III-2 Methanoculleus marisnigri JR1 ZP_01391373 III-2 Natronomonas pharaonis DSM 2160 CAI49476 III-2 Pyrococcus abyssi GE5 CAB50122 III-2 Pyrococcus furiosus DSM 3638 AAL81280 III-2 Pyrococcus horikoshii OT3 BAA30036 III-2 Thermococcus kodakaraensis KOD1 BAD86479 III-2 Thermofilum pendens Hrk 5 YP_920628 IV-Non-photo Acidiphilium cryptum JF-5 ZP_01146529 IV-Non-photo Bordetella bronchiseptica RB50 CAE31534 IV-Non-photo Burkholderia xenovorans (fungorum) LB400 ZP_00284840 IV-Non-photo Chromohalobacter salexigens DSM 3043 ZP_00471249 IV-Non-photo Delftia acidovorans SPH1 ZP_01577127 IV-Non-photo Fulvimarina pelagi HTCC2506 ZP_01438569 IV-Non-photo Jannaschia sp. CCS1 YP_511005 IV-Non-photo Mesorhizobium loti BAB53192 IV-Non-photo Polaromonas sp. JS666 ZP_00502320 IV-Non-photo Polaromonas sp. JS666 ZP_00502381 IV-Non-photo Pseudomonas putida F1 ZP_00900417 IV-Non-photo Rhizobium etli CFN 42 YP_472663 IV-Non-photo Roseobacter sp. MED193 ZP_01056409 IV-Non-photo Sinorhizobium meliloti 1021 CAC48779 IV-Non-photo Xanthobacter autotrophicus Py2 ZP_01199940 IV-Non-photo Global Ocean Sampling expedition EBH72800 IV-Non-photo Global Ocean Sampling expedition EDC83230 IV-Non-photo Global Ocean Sampling expedition ECV58360 IV-GOS Global Ocean Sampling expedition EBH57905 IV-GOS Global Ocean Sampling expedition EBM16636 IV-GOS Global Ocean Sampling expedition EDE27295 IV-GOS Global Ocean Sampling expedition EBO60441 IV-GOS Global Ocean Sampling expedition EBK48460 IV-DeepYkr Alkalilimnicola ehrlichei MLHE-1 YP_742007 IV-DeepYkr Archaeoglobus fulgidus DSM 4304 NP_070416 IV-DeepYkr Halorhodospira halophila SL1 YP_001002057 IV-DeepYkr Heliobacillus mobilis ABH04879 IV-DeepYkr Rhodopseudomonas palustris BisA53 YP_782588 IV-DeepYkr Rhodopseudomonas palustris BisB18 YP_532057 IV-DeepYkr Rhodopseudomonas palustris BisB5 YP_569369 IV-DeepYkr Rhodopseudomonas palustris CGA009 CAE27610 IV-DeepYkr Rhodopseudomonas palustris HaA2 YP_486834 IV-DeepYkr Rhodospirillum rubrum ABC22798 IV-DeepYkr Global Ocean Sampling expedition EDE24211 IV-DeepYkr Global Ocean Sampling expedition EDE26668 IV-DeepYkr Global Ocean Sampling expedition ECW00733 IV-DeepYkr Global Ocean Sampling expedition EDG90708 IV-EnvOnly Acid Mine Consortium AADL01000066 IV-EnvOnly Acid Mine Consortium AADL01000179 IV-Photo Allochromatium vinosum BAB44150 IV-Photo Chlorobium chlorochromatii CaD3 ABB28892 IV-Photo Chlorobium limicola f sp thiosulfatophilum AAK14332 IV-Photo Chlorobium phaeobacteroides DSM 266 ZP_00527577 IV-Photo Chlorobium tepidum TLS1 AAM72993 IV-Photo Pelodictyon luteolum DSM 273 ABB23300 IV-Photo Pelodictyon phaeoclathratiforme BU-1 ZP_00590598 IV-Photo Prosthecochloris aestuarii DSM 271 ZP_00590874 IV-Photo Rhodopseudomonas palustris BisA53 YP_779361 IV-Photo Rhodopseudomonas palustris BisB18 YP_530146 IV-Photo Rhodopseudomonas palustris BisB5 YP_567601 IV-Photo Rhodopseudomonas palustris CGA009 CAE25706 IV-Photo Rhodopseudomonas palustris HaA2 YP_483922 IV-Photo Global Ocean Sampling expedition ECV93956 IV-YkrW Acid Mine Consortium AADL01000541 IV-YkrW Bacillus anthracis str. Ames AAP27976 IV-YkrW Bacillus cereus ATCC 10987 NP_980397 IV-YkrW Bacillus cereus ATCC 14579 AAP10955 IV-YkrW Bacillus cereus E33L AAU16474 IV-YkrW Bacillus clausii KSM-K16 BAD64310 IV-YkrW Bacillus licheniformis ATCC 14580 AAU23062 IV-YkrW Bacillus licheniformis DSM 13 AAU40416 IV-YkrW Bacillus subtilis subsp. subtilis str. 168 CAB13232 IV-YkrW Bacillus thuringiensis str. 97-27 AAT63718 IV-YkrW Exiguobacterium sibiricum 255-15 ZP_00539172 IV-YkrW Geobacillus kaustophilus HTA426 BAD75238
44.672043
65
0.86316
c7f57ef35d48742b0a9239a1b3d0e0ecd4c79f1b
249
java
Java
spring-native-buildtools/src/test/java/org/springframework/nativex/buildtools/factories/fixtures/TestAutoConfigurationMissingType.java
cemnura/spring-native
3966891ec884d0f12528e36c626ffa9b9b3ef0f7
[ "Apache-2.0" ]
null
null
null
spring-native-buildtools/src/test/java/org/springframework/nativex/buildtools/factories/fixtures/TestAutoConfigurationMissingType.java
cemnura/spring-native
3966891ec884d0f12528e36c626ffa9b9b3ef0f7
[ "Apache-2.0" ]
null
null
null
spring-native-buildtools/src/test/java/org/springframework/nativex/buildtools/factories/fixtures/TestAutoConfigurationMissingType.java
cemnura/spring-native
3966891ec884d0f12528e36c626ffa9b9b3ef0f7
[ "Apache-2.0" ]
null
null
null
package org.springframework.nativex.buildtools.factories.fixtures; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @ConditionalOnClass(name = "org.example.MissingType") public class TestAutoConfigurationMissingType { }
31.125
75
0.855422
0785166ca2c4f5b93fc149c2cae90c4ed97c6be4
384
kt
Kotlin
app/src/main/java/com/huotu/android/mifang/mvp/contract/WalletContract.kt
hottech-jxd/mifang-shopman-android
d409993f3900a1ebef52bfd8ea2bbbd7799bce79
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/huotu/android/mifang/mvp/contract/WalletContract.kt
hottech-jxd/mifang-shopman-android
d409993f3900a1ebef52bfd8ea2bbbd7799bce79
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/huotu/android/mifang/mvp/contract/WalletContract.kt
hottech-jxd/mifang-shopman-android
d409993f3900a1ebef52bfd8ea2bbbd7799bce79
[ "Apache-2.0" ]
null
null
null
package com.huotu.android.mifang.mvp.contract import com.huotu.android.mifang.bean.* import com.huotu.android.mifang.mvp.IPresenter import com.huotu.android.mifang.mvp.IView interface WalletContract { interface Presenter: IPresenter { fun myWallet() } interface View: IView<Presenter> { fun myWalletCallback(apiResult: ApiResult<MyWalletBean>) } }
22.588235
64
0.736979
1ffe887bf9fb03bc6e906ba744cd3bc5a9c3811e
4,714
sql
SQL
Sales/Tables/CountryRegionCurrency.sql
jwmoore21/AW2008R2WithAuditCRUD
6ff88836d22ff3a1068b2e11d9dbba0605008d04
[ "MIT" ]
null
null
null
Sales/Tables/CountryRegionCurrency.sql
jwmoore21/AW2008R2WithAuditCRUD
6ff88836d22ff3a1068b2e11d9dbba0605008d04
[ "MIT" ]
null
null
null
Sales/Tables/CountryRegionCurrency.sql
jwmoore21/AW2008R2WithAuditCRUD
6ff88836d22ff3a1068b2e11d9dbba0605008d04
[ "MIT" ]
null
null
null
CREATE TABLE [Sales].[CountryRegionCurrency] ( [CountryRegionCode] NVARCHAR (3) NOT NULL, [CurrencyCode] NCHAR (3) NOT NULL, [RowStatus] TINYINT NOT NULL, [CreatedBy] UNIQUEIDENTIFIER NOT NULL, [ModifiedBy] UNIQUEIDENTIFIER NOT NULL, [CreatedDate] DATETIME NOT NULL, [ModifiedDate] DATETIME NOT NULL, [Uuid] UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL, CONSTRAINT [PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode] PRIMARY KEY CLUSTERED ([CountryRegionCode] ASC, [CurrencyCode] ASC), CONSTRAINT [FK_CountryRegionCurrency_CountryRegion_CountryRegionCode] FOREIGN KEY ([CountryRegionCode]) REFERENCES [Person].[CountryRegion] ([CountryRegionCode]), CONSTRAINT [FK_CountryRegionCurrency_Currency_CurrencyCode] FOREIGN KEY ([CurrencyCode]) REFERENCES [Sales].[Currency] ([CurrencyCode]) ); GO /* Defaults */ ALTER TABLE [Sales].[CountryRegionCurrency] ADD CONSTRAINT [DF__CountryRegionCurrency__RowStatus] DEFAULT ((1)) FOR [RowStatus] GO ALTER TABLE [Sales].[CountryRegionCurrency] ADD CONSTRAINT [DF__CountryRegionCurrency__CreatedBy] DEFAULT ('4E3A7D6D-8351-8494-FDB7-39E2A3A2E972') FOR [CreatedBy] GO ALTER TABLE [Sales].[CountryRegionCurrency] ADD CONSTRAINT [DF__CountryRegionCurrency__ModifiedBy] DEFAULT ('4E3A7D6D-8351-8494-FDB7-39E2A3A2E972') FOR [ModifiedBy] GO ALTER TABLE [Sales].[CountryRegionCurrency] ADD CONSTRAINT [DF__CountryRegionCurrency__CreatedDate] DEFAULT (GETUTCDATE()) FOR [CreatedDate] GO ALTER TABLE [Sales].[CountryRegionCurrency] ADD CONSTRAINT [DF__CountryRegionCurrency__ModifiedDate] DEFAULT (GETUTCDATE()) FOR [ModifiedDate] GO ALTER TABLE [Sales].[CountryRegionCurrency] ADD CONSTRAINT [DF__CountryRegionCurrency__Uuid] DEFAULT (NEWID()) FOR [Uuid] GO CREATE NONCLUSTERED INDEX [IX_CountryRegionCurrency_CurrencyCode] ON [Sales].[CountryRegionCurrency]([CurrencyCode] ASC); GO EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Nonclustered index.', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = N'TABLE', @level1name = N'CountryRegionCurrency', @level2type = N'INDEX', @level2name = N'IX_CountryRegionCurrency_CurrencyCode'; GO EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Default constraint value of GETDATE()', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = N'TABLE', @level1name = N'CountryRegionCurrency', @level2type = N'CONSTRAINT', @level2name = N'DF__CountryRegionCurrency__ModifiedDate'; GO EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Foreign key constraint referencing Currency.CurrencyCode.', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = N'TABLE', @level1name = N'CountryRegionCurrency', @level2type = N'CONSTRAINT', @level2name = N'FK_CountryRegionCurrency_Currency_CurrencyCode'; GO EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Foreign key constraint referencing CountryRegion.CountryRegionCode.', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = N'TABLE', @level1name = N'CountryRegionCurrency', @level2type = N'CONSTRAINT', @level2name = N'FK_CountryRegionCurrency_CountryRegion_CountryRegionCode'; GO EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Primary key (clustered) constraint', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = N'TABLE', @level1name = N'CountryRegionCurrency', @level2type = N'CONSTRAINT', @level2name = N'PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode'; GO EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Date and time the record was last updated.', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = N'TABLE', @level1name = N'CountryRegionCurrency', @level2type = N'COLUMN', @level2name = N'ModifiedDate'; GO EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'ISO standard currency code. Foreign key to Currency.CurrencyCode.', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = N'TABLE', @level1name = N'CountryRegionCurrency', @level2type = N'COLUMN', @level2name = N'CurrencyCode'; GO EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'ISO code for countries and regions. Foreign key to CountryRegion.CountryRegionCode.', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = N'TABLE', @level1name = N'CountryRegionCurrency', @level2type = N'COLUMN', @level2name = N'CountryRegionCode'; GO EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Cross-reference table mapping ISO currency codes to a country or region.', @level0type = N'SCHEMA', @level0name = N'Sales', @level1type = N'TABLE', @level1name = N'CountryRegionCurrency';
67.342857
355
0.772168
389c68e0fea86cc371de5c158b6b74c2c7e54e97
7,913
c
C
Dark soft/Carberp Botnet/source - absource/pro/all source/RemoteCtl/hvnc2/libs/libvncsrv/zrleoutstream.c
ExaByt3s/hack_scripts
cc801b36ea25f3b5a82d2900f53f5036e7abd8ad
[ "WTFPL" ]
3
2021-01-22T19:32:23.000Z
2022-01-03T01:06:44.000Z
Dark soft/Carberp Botnet/source - absource/pro/all source/RemoteCtl/hvnc2/libs/hvnc/libvncsrv/zrleoutstream.c
a04512/hack_scripts
cc801b36ea25f3b5a82d2900f53f5036e7abd8ad
[ "WTFPL" ]
null
null
null
Dark soft/Carberp Botnet/source - absource/pro/all source/RemoteCtl/hvnc2/libs/hvnc/libvncsrv/zrleoutstream.c
a04512/hack_scripts
cc801b36ea25f3b5a82d2900f53f5036e7abd8ad
[ "WTFPL" ]
1
2019-06-18T22:10:53.000Z
2019-06-18T22:10:53.000Z
/* * Copyright (C) 2002 RealVNC Ltd. All Rights Reserved. * Copyright (C) 2003 Sun Microsystems, Inc. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, * USA. */ #include "zrleoutstream.h" #include <stdlib.h> #include "defines.h" #define ZRLE_IN_BUFFER_SIZE 16384 #define ZRLE_OUT_BUFFER_SIZE 1024 #undef ZRLE_DEBUG static rfbBool zrleBufferAlloc(zrleBuffer *buffer, int size) { buffer->ptr = buffer->start = MemAlloc(size); if (buffer->start == NULL) { buffer->end = NULL; return FALSE; } buffer->end = buffer->start + size; return TRUE; } static void zrleBufferFree(zrleBuffer *buffer) { if (buffer->start) MemFree(buffer->start); buffer->start = buffer->ptr = buffer->end = NULL; } static rfbBool zrleBufferGrow(zrleBuffer *buffer, int size) { int offset; size += buffer->end - buffer->start; offset = ZRLE_BUFFER_LENGTH (buffer); buffer->start = MemRealloc(buffer->start, size); if (!buffer->start) { return FALSE; } buffer->end = buffer->start + size; buffer->ptr = buffer->start + offset; return TRUE; } zrleOutStream *zrleOutStreamNew(void) { zrleOutStream *os; os = MemAlloc(sizeof(zrleOutStream)); if (os == NULL) return NULL; if (!zrleBufferAlloc(&os->in, ZRLE_IN_BUFFER_SIZE)) { MemFree(os); return NULL; } if (!zrleBufferAlloc(&os->out, ZRLE_OUT_BUFFER_SIZE)) { zrleBufferFree(&os->in); MemFree(os); return NULL; } os->zs.zalloc = Z_NULL; os->zs.zfree = Z_NULL; os->zs.opaque = Z_NULL; if (deflateInit(&os->zs, Z_DEFAULT_COMPRESSION) != Z_OK) { zrleBufferFree(&os->in); MemFree(os); return NULL; } return os; } void zrleOutStreamFree (zrleOutStream *os) { deflateEnd(&os->zs); zrleBufferFree(&os->in); zrleBufferFree(&os->out); MemFree(os); } rfbBool zrleOutStreamFlush(zrleOutStream *os) { os->zs.next_in = os->in.start; os->zs.avail_in = ZRLE_BUFFER_LENGTH (&os->in); #ifdef ZRLE_DEBUG ///rfbLog("zrleOutStreamFlush: avail_in %d\n", os->zs.avail_in); #endif while (os->zs.avail_in != 0) { do { int ret; if (os->out.ptr >= os->out.end && !zrleBufferGrow(&os->out, os->out.end - os->out.start)) { ///rfbLog("zrleOutStreamFlush: failed to grow output buffer\n"); return FALSE; } os->zs.next_out = os->out.ptr; os->zs.avail_out = os->out.end - os->out.ptr; #ifdef ZRLE_DEBUG ///rfbLog("zrleOutStreamFlush: calling deflate, avail_in %d, avail_out %d\n", /// os->zs.avail_in, os->zs.avail_out); #endif if ((ret = deflate(&os->zs, Z_SYNC_FLUSH)) != Z_OK) { ///rfbLog("zrleOutStreamFlush: deflate failed with error code %d\n", ret); return FALSE; } #ifdef ZRLE_DEBUG ///rfbLog("zrleOutStreamFlush: after deflate: %d bytes\n", /// os->zs.next_out - os->out.ptr); #endif os->out.ptr = os->zs.next_out; } while (os->zs.avail_out == 0); } os->in.ptr = os->in.start; return TRUE; } static int zrleOutStreamOverrun(zrleOutStream *os, int size) { #ifdef ZRLE_DEBUG ///rfbLog("zrleOutStreamOverrun\n"); #endif while (os->in.end - os->in.ptr < size && os->in.ptr > os->in.start) { os->zs.next_in = os->in.start; os->zs.avail_in = ZRLE_BUFFER_LENGTH (&os->in); do { int ret; if (os->out.ptr >= os->out.end && !zrleBufferGrow(&os->out, os->out.end - os->out.start)) { ///rfbLog("zrleOutStreamOverrun: failed to grow output buffer\n"); return FALSE; } os->zs.next_out = os->out.ptr; os->zs.avail_out = os->out.end - os->out.ptr; #ifdef ZRLE_DEBUG ///rfbLog("zrleOutStreamOverrun: calling deflate, avail_in %d, avail_out %d\n", /// os->zs.avail_in, os->zs.avail_out); #endif if ((ret = deflate(&os->zs, 0)) != Z_OK) { ///rfbLog("zrleOutStreamOverrun: deflate failed with error code %d\n", ret); return 0; } #ifdef ZRLE_DEBUG ///rfbLog("zrleOutStreamOverrun: after deflate: %d bytes\n", /// os->zs.next_out - os->out.ptr); #endif os->out.ptr = os->zs.next_out; } while (os->zs.avail_out == 0); /* output buffer not full */ if (os->zs.avail_in == 0) { os->in.ptr = os->in.start; } else { /* but didn't consume all the data? try shifting what's left to the * start of the buffer. */ ///rfbLog("zrleOutStreamOverrun: out buf not full, but in data not consumed\n"); memcpy(os->in.start, os->zs.next_in, os->in.ptr - os->zs.next_in); os->in.ptr -= os->zs.next_in - os->in.start; } } if (size > os->in.end - os->in.ptr) size = os->in.end - os->in.ptr; return size; } static int zrleOutStreamCheck(zrleOutStream *os, int size) { if (os->in.ptr + size > os->in.end) { return zrleOutStreamOverrun(os, size); } return size; } void zrleOutStreamWriteBytes(zrleOutStream *os, const zrle_U8 *data, int length) { const zrle_U8* dataEnd = data + length; while (data < dataEnd) { int n = zrleOutStreamCheck(os, dataEnd - data); memcpy(os->in.ptr, data, n); os->in.ptr += n; data += n; } } void zrleOutStreamWriteU8(zrleOutStream *os, zrle_U8 u) { zrleOutStreamCheck(os, 1); *os->in.ptr++ = u; } void zrleOutStreamWriteOpaque8(zrleOutStream *os, zrle_U8 u) { zrleOutStreamCheck(os, 1); *os->in.ptr++ = u; } void zrleOutStreamWriteOpaque16 (zrleOutStream *os, zrle_U16 u) { zrleOutStreamCheck(os, 2); *os->in.ptr++ = ((zrle_U8*)&u)[0]; *os->in.ptr++ = ((zrle_U8*)&u)[1]; } void zrleOutStreamWriteOpaque32 (zrleOutStream *os, zrle_U32 u) { zrleOutStreamCheck(os, 4); *os->in.ptr++ = ((zrle_U8*)&u)[0]; *os->in.ptr++ = ((zrle_U8*)&u)[1]; *os->in.ptr++ = ((zrle_U8*)&u)[2]; *os->in.ptr++ = ((zrle_U8*)&u)[3]; } void zrleOutStreamWriteOpaque24A(zrleOutStream *os, zrle_U32 u) { zrleOutStreamCheck(os, 3); *os->in.ptr++ = ((zrle_U8*)&u)[0]; *os->in.ptr++ = ((zrle_U8*)&u)[1]; *os->in.ptr++ = ((zrle_U8*)&u)[2]; } void zrleOutStreamWriteOpaque24B(zrleOutStream *os, zrle_U32 u) { zrleOutStreamCheck(os, 3); *os->in.ptr++ = ((zrle_U8*)&u)[1]; *os->in.ptr++ = ((zrle_U8*)&u)[2]; *os->in.ptr++ = ((zrle_U8*)&u)[3]; }
26.643098
93
0.544168
fece7bb26f8036f3a04fe0fbceb95a59df707049
259
html
HTML
templates/responseform.html
dotakshit/file
a4f521f411ddc05644be7bfc674b7b7732024363
[ "CC0-1.0" ]
null
null
null
templates/responseform.html
dotakshit/file
a4f521f411ddc05644be7bfc674b7b7732024363
[ "CC0-1.0" ]
7
2020-02-12T00:23:53.000Z
2022-02-10T08:12:31.000Z
templates/responseform.html
dotakshit/file
a4f521f411ddc05644be7bfc674b7b7732024363
[ "CC0-1.0" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Django Forms Tutorial</title> </head> <body> <h2>Django Forms Tutorial</h2> <form> {% csrf_token %} {{form}} <input type="submit" value="Submit" /> </form> </body> </html>
15.235294
40
0.602317
85b1594b9489253766e1d7650e9dff7b4404ce61
2,995
swift
Swift
Riot/Modules/Common/Recents/DataSources/RecentsDataSourceSections.swift
elsiehupp/element-ios
faea2de85b9e61717acbf5d997812f3ca627ac24
[ "Apache-2.0" ]
644
2016-12-03T23:53:19.000Z
2020-08-01T20:45:42.000Z
Riot/Modules/Common/Recents/DataSources/RecentsDataSourceSections.swift
elsiehupp/element-ios
faea2de85b9e61717acbf5d997812f3ca627ac24
[ "Apache-2.0" ]
1,755
2016-12-02T13:17:36.000Z
2020-08-03T12:17:32.000Z
Riot/Modules/Common/Recents/DataSources/RecentsDataSourceSections.swift
elsiehupp/element-ios
faea2de85b9e61717acbf5d997812f3ca627ac24
[ "Apache-2.0" ]
253
2016-12-02T08:11:14.000Z
2020-08-01T00:55:05.000Z
// // Copyright 2022 New Vector Ltd // // 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 Foundation /** Data structure representing the current arrangement of sections in a given data source, where a numerical session index (used for table views) is associated with its semantic value (e.g. "favorites" = 2). */ @objc class RecentsDataSourceSections: NSObject { typealias SectionIndex = Int static let MissingSectionIndex = -1 @objc var count: Int { sections.count } @objc var sectionTypes: [NSNumber] { sections .sorted { $0.value < $1.value } .map { NSNumber(value: $0.key.rawValue) } } private var sections: [RecentsDataSourceSectionType: SectionIndex] = [:] init(sectionTypes: [RecentsDataSourceSectionType]) { sections = sectionTypes .enumerated() .reduce(into: [RecentsDataSourceSectionType: SectionIndex]()) { dict, item in dict[item.element] = item.offset } } // Objective-C cannot represent int-enums as an array, so a convenience function // allows passing them as a list of NSNumbers, that are internally extracted @objc convenience init(sectionTypes: [NSNumber]) { let types = sectionTypes.compactMap { RecentsDataSourceSectionType(rawValue: $0.intValue) } self.init(sectionTypes: types) } @objc func contains(_ sectionType: RecentsDataSourceSectionType) -> Bool { return sections.contains { $0.key == sectionType } } @objc func sectionIndex(forSectionType sectionType: RecentsDataSourceSectionType) -> SectionIndex { guard let index = sections[sectionType] else { // Objective-c code does not allow returning optional Int, so must use -1 return Self.MissingSectionIndex } return index } @objc func sectionType(forSectionIndex sectionIndex: SectionIndex) -> RecentsDataSourceSectionType { guard let item = sections.first(where: { $0.value == sectionIndex }) else { // Objective-c code does not allow returning optional Int, so must use .unknown return .unknown } return item.key } override func isEqual(_ object: Any?) -> Bool { guard let other = object as? RecentsDataSourceSections else { return false } return sections == other.sections } }
34.825581
104
0.656093
febe053323eedf0a7364ffbf8879accf26498f67
1,260
sql
SQL
src/main/resources/schema-h2.sql
pivotal-tokyo/spring-security-authentication-example
9e2bb65f6677df0acd711ef0ad6943ab659faf7e
[ "BSD-2-Clause" ]
null
null
null
src/main/resources/schema-h2.sql
pivotal-tokyo/spring-security-authentication-example
9e2bb65f6677df0acd711ef0ad6943ab659faf7e
[ "BSD-2-Clause" ]
null
null
null
src/main/resources/schema-h2.sql
pivotal-tokyo/spring-security-authentication-example
9e2bb65f6677df0acd711ef0ad6943ab659faf7e
[ "BSD-2-Clause" ]
1
2019-06-14T11:51:52.000Z
2019-06-14T11:51:52.000Z
create table users(username varchar(50) not null primary key,password varchar(500) not null,enabled boolean not null); create table authorities (username varchar(50) not null,authority varchar(50) not null,constraint fk_authorities_users foreign key(username) references users(username)); create unique index ix_auth_username on authorities (username,authority); -- -- These statements come from spring-session schema-postgresql.sql -- and are required to store sessions in the database. -- CREATE TABLE SPRING_SESSION ( SESSION_ID CHAR(36), CREATION_TIME BIGINT NOT NULL, LAST_ACCESS_TIME BIGINT NOT NULL, MAX_INACTIVE_INTERVAL INT NOT NULL, PRINCIPAL_NAME VARCHAR(100), CONSTRAINT SPRING_SESSION_PK PRIMARY KEY (SESSION_ID) ); CREATE INDEX SPRING_SESSION_IX1 ON SPRING_SESSION (LAST_ACCESS_TIME); CREATE TABLE SPRING_SESSION_ATTRIBUTES ( SESSION_ID CHAR(36), ATTRIBUTE_NAME VARCHAR(200), ATTRIBUTE_BYTES BYTEA, CONSTRAINT SPRING_SESSION_ATTRIBUTES_PK PRIMARY KEY (SESSION_ID, ATTRIBUTE_NAME), CONSTRAINT SPRING_SESSION_ATTRIBUTES_FK FOREIGN KEY (SESSION_ID) REFERENCES SPRING_SESSION(SESSION_ID) ON DELETE CASCADE ); CREATE INDEX SPRING_SESSION_ATTRIBUTES_IX1 ON SPRING_SESSION_ATTRIBUTES (SESSION_ID); -- end spring-session tables
42
169
0.818254
421f9fa218067a1bebba58156ad0c5edfabf32d9
998
kt
Kotlin
compiler-plugin/src/main/kotlin/backend/utils.kt
Him188/kotlin-dynamic-delegation
f8063b33970a2b703749a23f9ba2db1ad24b26a5
[ "Apache-2.0" ]
11
2021-12-02T02:37:33.000Z
2022-01-26T00:33:32.000Z
compiler-plugin/src/main/kotlin/backend/utils.kt
Him188/kotlin-dynamic-delegation
f8063b33970a2b703749a23f9ba2db1ad24b26a5
[ "Apache-2.0" ]
null
null
null
compiler-plugin/src/main/kotlin/backend/utils.kt
Him188/kotlin-dynamic-delegation
f8063b33970a2b703749a23f9ba2db1ad24b26a5
[ "Apache-2.0" ]
null
null
null
package me.him188.kotlin.dynamic.delegation.compiler.backend import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope import org.jetbrains.kotlin.ir.builders.irCall import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol fun IrBuilderWithScope.irCall(callee: IrSimpleFunctionSymbol, dispatchReceiver: IrExpression?): IrCall = irCall(callee, callee.owner.returnType).apply { this.dispatchReceiver = dispatchReceiver } internal fun IrPluginContext.createIrBuilder( symbol: IrSymbol, startOffset: Int = UNDEFINED_OFFSET, endOffset: Int = UNDEFINED_OFFSET, ) = DeclarationIrBuilder(this, symbol, startOffset, endOffset)
41.583333
104
0.826653
67a0e798aec719af63ca2eafa19a4b11d0a96132
2,232
swift
Swift
TelnyxWebRTCDemo/Extensions/UserDefaultExtension.swift
team-telnyx/telnyx-webrtc-ios
aba27c6e85efc802111483f7790db12ee11b9e44
[ "MIT" ]
7
2021-07-07T20:40:29.000Z
2021-09-09T11:01:51.000Z
TelnyxWebRTCDemo/Extensions/UserDefaultExtension.swift
team-telnyx/telnyx-webrtc-ios
aba27c6e85efc802111483f7790db12ee11b9e44
[ "MIT" ]
3
2021-05-12T20:34:20.000Z
2021-11-10T11:08:54.000Z
TelnyxWebRTCDemo/Extensions/UserDefaultExtension.swift
team-telnyx/telnyx-webrtc-ios
aba27c6e85efc802111483f7790db12ee11b9e44
[ "MIT" ]
2
2021-08-14T05:50:02.000Z
2021-09-09T11:01:52.000Z
// // UserDefaultExtension.swift // TelnyxWebRTCDemo // // Created by Guillermo Battistel on 18/05/2021. // import Foundation import TelnyxRTC fileprivate let PUSH_DEVICE_TOKEN = "" fileprivate let SIP_USER = "SIP_USER" fileprivate let SIP_USER_PASSWORD = "SIP_USER_PASSWORD" fileprivate let CALL_DESTINATION = "CALL_DESTINATION" fileprivate let WEBRTC_ENVIRONMENT = "WEBRTC_ENVIRONMENT" extension UserDefaults { func savePushToken(pushToken: String) { let userDefaults = UserDefaults.standard userDefaults.set(pushToken, forKey: PUSH_DEVICE_TOKEN) userDefaults.synchronize() } func deletePushToken() { let userDefaults = UserDefaults.standard userDefaults.removeObject(forKey: PUSH_DEVICE_TOKEN) userDefaults.synchronize() } func getPushToken() -> String { let userDefaults = UserDefaults.standard return userDefaults.string(forKey: PUSH_DEVICE_TOKEN) ?? "" } func saveUser(sipUser: String, password: String) { let userDefaults = UserDefaults.standard userDefaults.set(sipUser, forKey: SIP_USER) userDefaults.set(password, forKey: SIP_USER_PASSWORD) userDefaults.synchronize() } func saveCallDestination(callDestination: String) { let userDefaults = UserDefaults.standard userDefaults.set(callDestination, forKey: CALL_DESTINATION) userDefaults.synchronize() } func getSipUser() -> String { let userDefaults = UserDefaults.standard return userDefaults.string(forKey: SIP_USER) ?? "" } func getSipUserPassword() -> String { let userDefaults = UserDefaults.standard return userDefaults.string(forKey: SIP_USER_PASSWORD) ?? "" } func saveEnvironment(environment: WebRTCEnvironment) { let userDefaults = UserDefaults.standard userDefaults.set((environment == .development) ? "development" : "production", forKey: WEBRTC_ENVIRONMENT) userDefaults.synchronize() } func getEnvironment() -> WebRTCEnvironment { let userDefaults = UserDefaults.standard return (userDefaults.string(forKey: WEBRTC_ENVIRONMENT) == "development") ? .development : .production } }
31.43662
114
0.704749
2671d89042562c4f505f433bfc3f78681e8a6e83
1,893
java
Java
build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromUpdateCenter.java
MailOnline/jenkins-build-monitor-plugin
063019d2fea0b7508d72b3370fcf124dcc5d6e94
[ "MIT" ]
null
null
null
build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromUpdateCenter.java
MailOnline/jenkins-build-monitor-plugin
063019d2fea0b7508d72b3370fcf124dcc5d6e94
[ "MIT" ]
null
null
null
build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromUpdateCenter.java
MailOnline/jenkins-build-monitor-plugin
063019d2fea0b7508d72b3370fcf124dcc5d6e94
[ "MIT" ]
1
2021-03-16T08:23:56.000Z
2021-03-16T08:23:56.000Z
package net.serenitybdd.integration.jenkins.environment.rules; import com.google.common.base.Charsets; import net.serenitybdd.integration.jenkins.JenkinsInstance; import net.serenitybdd.integration.jenkins.environment.UpdateCenter; import org.junit.rules.TestRule; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import static java.util.Arrays.asList; public class InstallPluginsFromUpdateCenter implements ApplicativeTestRule<JenkinsInstance> { private final static Logger Log = LoggerFactory.getLogger(InstallPluginsFromUpdateCenter.class); private final UpdateCenter updateCenter = new UpdateCenter(); private final List<String> requiredPlugins; public InstallPluginsFromUpdateCenter(String... plugins) { this.requiredPlugins = asList(plugins); } @Override public TestRule applyTo(final JenkinsInstance jenkins) { return new TestWatcher() { @Override protected void starting(Description description) { warmUpUpdateCenterCacheFor(jenkins); jenkins.client().installPlugins(requiredPlugins); } }; } private void warmUpUpdateCenterCacheFor(JenkinsInstance jenkins) { try { Log.info("Warming up the Update Center cache for Jenkins '{}'", jenkins.version()); String json = updateCenter.jsonFor(jenkins.version()); Path destination = Files.createDirectories(jenkins.home().resolve("updates")).resolve("default.json"); Files.write(destination, json.getBytes(Charsets.UTF_8)); } catch (IOException e) { throw new RuntimeException("Couldn't warm up the Update Center cache", e); } } }
33.803571
116
0.717908
2a67fd391427b796049e9f7c5d7cb7800e69324f
157
java
Java
src/main/java/com/stylefeng/guns/modular/manage/dao/Wq_stockDao.java
ningxiaojiang/guns-wq
468d088d3a51b7725361cecbc1d1f21e6401d8ce
[ "Apache-2.0" ]
null
null
null
src/main/java/com/stylefeng/guns/modular/manage/dao/Wq_stockDao.java
ningxiaojiang/guns-wq
468d088d3a51b7725361cecbc1d1f21e6401d8ce
[ "Apache-2.0" ]
null
null
null
src/main/java/com/stylefeng/guns/modular/manage/dao/Wq_stockDao.java
ningxiaojiang/guns-wq
468d088d3a51b7725361cecbc1d1f21e6401d8ce
[ "Apache-2.0" ]
null
null
null
package com.stylefeng.guns.modular.manage.dao; /** * 库存管理Dao * * @author fengshuonan * @Date 2018-01-30 08:58:35 */ public interface Wq_stockDao { }
12.076923
46
0.681529
72273a95cc7a8333cc02e830b24957f9fb7b470f
6,760
swift
Swift
pocket.gg/pocket.gg/Controller/VideoGamesVC.swift
gcsiu/pocket.gg
78ead139c16c572529a5f2d1d1482236c5592c39
[ "MIT" ]
null
null
null
pocket.gg/pocket.gg/Controller/VideoGamesVC.swift
gcsiu/pocket.gg
78ead139c16c572529a5f2d1d1482236c5592c39
[ "MIT" ]
null
null
null
pocket.gg/pocket.gg/Controller/VideoGamesVC.swift
gcsiu/pocket.gg
78ead139c16c572529a5f2d1d1482236c5592c39
[ "MIT" ]
null
null
null
// // VideoGamesVC.swift // pocket.gg // // Created by Gabriel Siu on 2022-01-30. // Copyright © 2022 Gabriel Siu. All rights reserved. // import UIKit import MessageUI final class VideoGamesVC: UITableViewController { let searchController: UISearchController var videoGames = [VideoGame]() var filteredVideoGames = [VideoGame]() var enabledGames = [VideoGame]() var enabledGamesChanged: Bool var applyChanges: (([VideoGame]) -> Void)? // MARK: - Initialization init(_ enabledGames: [VideoGame]) { searchController = UISearchController(searchResultsController: nil) filteredVideoGames = [] do { videoGames = try VideoGameDatabase.getVideoGames() } catch { videoGames = [] // TODO: Show error } enabledGamesChanged = false self.enabledGames = enabledGames super.init(style: .insetGrouped) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() title = "Video Game Selection" navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(dismissVC)) navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(saveChanges)) navigationItem.searchController = searchController searchController.searchResultsUpdater = self searchController.obscuresBackgroundDuringPresentation = false searchController.searchBar.setValue("Done", forKey: "cancelButtonText") tableView.register(UITableViewCell.self, forCellReuseIdentifier: k.Identifiers.videoGameCell) } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationItem.hidesSearchBarWhenScrolling = false } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) navigationItem.hidesSearchBarWhenScrolling = true } // MARK: - Actions @objc private func dismissVC() { dismiss(animated: true, completion: nil) } @objc private func saveChanges() { if enabledGamesChanged { if let applyChanges = applyChanges { dismiss(animated: true) { [weak self] in guard let self = self else { return } applyChanges(self.enabledGames) } } } dismiss(animated: true, completion: nil) } private func presentVideoGamesAlert() { let alert = UIAlertController(title: "", message: k.Alert.videoGameSelection, preferredStyle: .alert) alert.addAction(UIAlertAction(title: "Send video game update request", style: .default, handler: { [weak self] _ in if MFMailComposeViewController.canSendMail() { let mail = MFMailComposeViewController() mail.mailComposeDelegate = self mail.setToRecipients([k.Mail.address]) mail.setSubject("pocket.gg Video Game Update Request") mail.setMessageBody(k.Mail.videoGameUpdateRequest, isHTML: false) self?.present(mail, animated: true) } else { let alert = UIAlertController(title: "Video Game Update Request", message: k.Mail.videoGameUpdateRequestFallback, preferredStyle: .alert) alert.addAction(UIAlertAction(title: "Dismiss", style: .default, handler: nil)) self?.present(alert, animated: true) } })) alert.addAction(UIAlertAction(title: "Dismiss", style: .cancel, handler: nil)) present(alert, animated: true) } // MARK: - Table View Data Source override func numberOfSections(in tableView: UITableView) -> Int { return searchController.isActive ? 1 : 2 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { switch section { case 0: return searchController.isActive ? filteredVideoGames.count : 1 case 1 : return videoGames.count default: return 0 } } override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { return searchController.isActive ? "Search Results" : nil } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if !searchController.isActive, indexPath.section == 0 { return UITableViewCell().setupActive(textColor: .systemRed, text: "Can't find the video game that you're looking for?") } let cell = tableView.dequeueReusableCell(withIdentifier: k.Identifiers.videoGameCell, for: indexPath) let videoGame = searchController.isActive ? filteredVideoGames[indexPath.row] : videoGames[indexPath.row] cell.textLabel?.text = videoGame.name cell.accessoryType = enabledGames.contains(videoGame) ? .checkmark : .none return cell } // MARK: - Table View Delegate override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { tableView.deselectRow(at: indexPath, animated: true) if !searchController.isActive, indexPath.section == 0 { presentVideoGamesAlert() return } enabledGamesChanged = true let selectedGame = searchController.isActive ? filteredVideoGames[indexPath.row] : videoGames[indexPath.row] if enabledGames.contains(selectedGame) { if let index = enabledGames.firstIndex(where: { $0 == selectedGame }) { enabledGames.remove(at: index) } tableView.cellForRow(at: indexPath)?.accessoryType = .none } else { enabledGames.append(selectedGame) tableView.cellForRow(at: indexPath)?.accessoryType = .checkmark } } } extension VideoGamesVC: UISearchResultsUpdating { func updateSearchResults(for searchController: UISearchController) { filteredVideoGames.removeAll() guard let searchText = searchController.searchBar.text else { return } filteredVideoGames = videoGames.filter { $0.name.range(of: searchText, options: [.caseInsensitive]) != nil } tableView.reloadData() } } extension VideoGamesVC: MFMailComposeViewControllerDelegate { func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) { controller.dismiss(animated: true) } }
38.850575
153
0.653846
5592c9c1fa83f7e67754cecc9c0e059c1f982dff
1,880
html
HTML
public/partials/create-activity.html
spierala/groupay-angularjs
9c84b54e1d896cf67eb5d9b2308acc3749fd2b0d
[ "MIT" ]
null
null
null
public/partials/create-activity.html
spierala/groupay-angularjs
9c84b54e1d896cf67eb5d9b2308acc3749fd2b0d
[ "MIT" ]
null
null
null
public/partials/create-activity.html
spierala/groupay-angularjs
9c84b54e1d896cf67eb5d9b2308acc3749fd2b0d
[ "MIT" ]
null
null
null
<div class="page-header"> <h1>Welcome to Groupay</h1> </div> <p class="lead">'groupay' simplifies to manage the expenses of a group (e.g. during a holiday).</p> <p>Create a new activity to get started...</p> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title">Create a new activity</h3> </div> <div class="panel-body"> <form name="userForm" ng-submit="submitForm(userForm.$valid)" novalidate> <div class="form-group" ng-class="{ 'has-error' : userForm.title.$invalid && submitted }"> <label for="title">Title</label> <input type="text" class="form-control" id="title" name="title" ng-model="newActivity.title" placeholder="Enter Activity Title" required> <p ng-show="userForm.title.$invalid && submitted" class="help-block">Title is required.</p> </div> <div class="form-group" ng-class="{ 'has-error' : userForm.name.$invalid && submitted}"> <label for="name">Your Name</label> <input type="text" class="form-control" id="name" name="name" ng-model="newActivity.name" placeholder="Enter Your Name" required> <p ng-show="userForm.name.$invalid && submitted" class="help-block">Name is required.</p> </div> <div class="form-group" ng-class="{ 'has-error' : userForm.email.$invalid && submitted}"> <label for="email">Your e-Mail Address</label> <input type="email" class="form-control" id="email" name="email" ng-model="newActivity.email" placeholder="Enter Your e-Mail" required> <p ng-show="userForm.email.$invalid && submitted" class="help-block">Enter a valid email.</p> </div> <button class="btn btn-default" type="submit">Create Activity</button> </form> </div> </div>
58.75
153
0.606915
77591679928f17e42e3610be8f1e2bb980456501
7,730
html
HTML
html/addCustomerDetail.html
tomargit/blockchain-car-rental
5e3a6929da0d087a4b6a17d75833fdc90b1b00c0
[ "MIT" ]
null
null
null
html/addCustomerDetail.html
tomargit/blockchain-car-rental
5e3a6929da0d087a4b6a17d75833fdc90b1b00c0
[ "MIT" ]
null
null
null
html/addCustomerDetail.html
tomargit/blockchain-car-rental
5e3a6929da0d087a4b6a17d75833fdc90b1b00c0
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> <meta name="description" content=""> <meta name="author" content=""> <link rel="icon" href="favicon.ico"> <title>BlockChain</title> <!-- Bootstrap core CSS --> <link href="../assets/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="../assets/css/font-awesome.min.css"> <!-- Custom styles for this template --> <link href="../assets/css/jquery.bxslider.css" rel="stylesheet"> <link href="../assets/css/home.css" rel="stylesheet"> </head> <body> <nav class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li class="active"><a href="home.html">Home</a></li> <li><a href="addCustomerDetail.html">Add Customer Detail</a></li> <li><a href="viewCustomerDetail.html">View Customer Detail</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li class="active"><a href="../index.html">Sign Out</a></li> </ul> </div> </div> </nav> <div class="container"> <header> <a href="home.html"><img src="../assets/images/car-rental.jpg"></a> </header> <form class="well form-horizontal"> <table class="table table-striped"> <tbody> <tr> <td colspan="1"> <fieldset> <div class="form-group"> <label class="col-md-4 control-label">Full Name</label> <div class="col-md-8 inputGroupContainer"> <div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span><input id="fullName" name="fullName" placeholder="Full Name" class="form-control" required="true" value="" type="text"></div> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Address Line 1</label> <div class="col-md-8 inputGroupContainer"> <div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span><input id="addressLine1" name="addressLine1" placeholder="Address Line 1" class="form-control" required="true" value="" type="text"></div> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Address Line 2</label> <div class="col-md-8 inputGroupContainer"> <div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span><input id="addressLine2" name="addressLine2" placeholder="Address Line 2" class="form-control" required="true" value="" type="text"></div> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">City</label> <div class="col-md-8 inputGroupContainer"> <div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span><input id="city" name="city" placeholder="City" class="form-control" required="true" value="" type="text"></div> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">State/Province/Region</label> <div class="col-md-8 inputGroupContainer"> <div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span><input id="state" name="state" placeholder="State/Province/Region" class="form-control" required="true" value="" type="text"></div> </div> </div> </fieldset> </td> <td colspan="1"> <fieldset> <div class="form-group"> <label class="col-md-4 control-label">Postal Code/ZIP</label> <div class="col-md-8 inputGroupContainer"> <div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span><input id="postcode" name="postcode" placeholder="Postal Code/ZIP" class="form-control" required="true" value="" type="text"></div> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Country</label> <div class="col-md-8 inputGroupContainer"> <div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-home"></i></span><input id="country" name="postcode" placeholder="Country" class="form-control" required="true" value="" type="text"></div> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Email</label> <div class="col-md-8 inputGroupContainer"> <div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span><input id="email" name="email" placeholder="Email" class="form-control" required="true" value="" type="text"></div> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">Phone Number</label> <div class="col-md-8 inputGroupContainer"> <div class="input-group"><span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span><input id="phoneNumber" name="phoneNumber" placeholder="Phone Number" class="form-control" required="true" value="" type="text"></div> </div> </div> </fieldset> </td> </tr> </tbody> </table> <div> <button type="button" class="btn btn-success" style="margin-left: 45%;">Success</button> </div> </form> </div><!-- /.container --> <div style="width: 100%; height: 40px; background-color: black; position: absolute; bottom: 0;"> </div> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="../js/jquery.min.js"></script> <script src="../js/bootstrap.min.js"></script> <script src="../js/jquery.bxslider.js"></script> <script src="../js/mooz.scripts.min.js"></script> </body> </html>
56.423358
273
0.525097
40357f693b71f1c592ef012fd0ff065b04aa357d
3,399
py
Python
tests/test_api/test_drone.py
OrderAndCh4oS/drone_squadron_api_prototype
4d7c22cebb03576986d443634b17910cb460a60f
[ "MIT" ]
1
2020-05-20T09:44:37.000Z
2020-05-20T09:44:37.000Z
tests/test_api/test_drone.py
sarcoma/drone_squadron_api_prototype
4d7c22cebb03576986d443634b17910cb460a60f
[ "MIT" ]
1
2021-06-01T22:30:10.000Z
2021-06-01T22:30:10.000Z
tests/test_api/test_drone.py
OrderAndCh4oS/drone_squadron_api_prototype
4d7c22cebb03576986d443634b17910cb460a60f
[ "MIT" ]
null
null
null
from sqlalchemy.engine import ResultProxy from drone_squadron.crud.drone_crud import DroneCrud from drone_squadron.crud.squadron_crud import SquadronCrud class TestDrone: def test_post(self, log_in, test_client): with SquadronCrud() as crud: result = crud.insert(name="Squad Test", user=1) # type: ResultProxy last_id = result.inserted_primary_key[0] response = test_client.post( '/drone', json={"name": "Drone One", "squadron": last_id}, content_type="application/json" ) data = response.get_json() assert response.status_code == 200 assert 'id' in data assert 'name' in data assert 'kills' in data assert 'missions' in data assert 'value' in data assert 'weapon_name' in data assert 'gimbal_name' in data assert 'thruster_name' in data assert 'steering_name' in data assert 'scanner_name' in data def test_post_unauthorized(self, log_out, test_client): response = test_client.post( '/drone', json={"name": "Drone One"}, content_type="application/json" ) assert response.status_code == 401 def test_get(self, log_in, test_client): with SquadronCrud() as crud: result = crud.insert(name="Squad Test", user=1) # type: ResultProxy last_squadron_id = result.inserted_primary_key[0] with DroneCrud() as crud: result = crud.insert( name="Drone One", squadron=last_squadron_id, ) # type: ResultProxy # type: ResultProxy last_drone_id = result.inserted_primary_key[0] response = test_client.get('/drone/%d' % last_drone_id) data = response.get_json() assert response.status_code == 200 assert last_drone_id == data['id'] assert 'id' in data assert 'name' in data assert 'kills' in data assert 'missions' in data assert 'value' in data assert 'weapon_name' in data assert 'gimbal_name' in data assert 'thruster_name' in data assert 'steering_name' in data assert 'scanner_name' in data def test_get_by_squadron(self, log_in, test_client): response = test_client.get('/squadron/1/drone') data = response.get_json()[0] assert response.status_code == 200 assert 1 == data['id'] assert 'id' in data assert 'name' in data assert 'kills' in data assert 'missions' in data assert 'value' in data assert 'weapon_name' in data assert 'gimbal_name' in data assert 'thruster_name' in data assert 'steering_name' in data assert 'scanner_name' in data def test_put(self, log_in, test_client): response = test_client.put( '/drone/1', json={"name": "Drone Two", "squadron": 1}, content_type="application/json" ) data = response.get_json() assert response.status_code == 200 assert {'id_1': '1', 'name': 'Drone Two'} == data def test_delete(self, log_in, test_client): response = test_client.delete('/drone/1') data = response.get_json() assert response.status_code == 200 assert 1 == data['deleted_rows']
35.778947
80
0.60253
fcd550889b1f981b997202f4021d589cb53cffd8
39
css
CSS
bundles/uikit/Anchor.mod.css
TreZc0/donation-tracker
3a833a5eba3c0b7cedd8249b44b1435f526095ba
[ "Apache-2.0" ]
39
2016-01-04T04:13:27.000Z
2022-01-18T19:17:24.000Z
bundles/uikit/Anchor.mod.css
TreZc0/donation-tracker
3a833a5eba3c0b7cedd8249b44b1435f526095ba
[ "Apache-2.0" ]
140
2015-11-01T01:19:54.000Z
2022-03-10T13:00:33.000Z
bundles/uikit/Anchor.mod.css
TreZc0/donation-tracker
3a833a5eba3c0b7cedd8249b44b1435f526095ba
[ "Apache-2.0" ]
35
2016-01-20T12:42:21.000Z
2022-01-20T07:06:47.000Z
.anchor { color: var(--text-link); }
9.75
26
0.564103
dfc222a97635a44a9e206e51fbb870cb8c5a6b5d
226
ts
TypeScript
packages/editor/editor-core/src/plugins/mentions/styles.ts
HereSinceres/atlaskit-mk-2
be4cdd0b1f9566847c274d0d05b9549881e0ae4a
[ "Apache-2.0" ]
18
2019-09-25T18:00:05.000Z
2022-01-03T22:38:43.000Z
packages/editor/editor-core/src/plugins/mentions/styles.ts
HereSinceres/atlaskit-mk-2
be4cdd0b1f9566847c274d0d05b9549881e0ae4a
[ "Apache-2.0" ]
72
2019-05-07T10:17:13.000Z
2022-02-03T15:00:47.000Z
packages/editor/editor-core/src/plugins/mentions/styles.ts
HereSinceres/atlaskit-mk-2
be4cdd0b1f9566847c274d0d05b9549881e0ae4a
[ "Apache-2.0" ]
4
2019-12-12T02:43:15.000Z
2021-05-23T16:16:19.000Z
import { css } from 'styled-components'; import { akEditorMentionSelected } from '../../styles'; export const mentionsStyles = css` .ProseMirror-selectednode .ak-mention { background: ${akEditorMentionSelected}; } `;
25.111111
55
0.712389
76aedbe317d87a0f81f6f5311ff2244d9834e9f3
1,852
kt
Kotlin
KotlinMail/ordercenter/src/main/java/cn/xwj/order/data/repository/ShipAddressRepository.kt
xiaowujiang/AndroidProjectStudio
2796496ebb7d279ad0f405102c107db9085545e7
[ "Apache-2.0" ]
null
null
null
KotlinMail/ordercenter/src/main/java/cn/xwj/order/data/repository/ShipAddressRepository.kt
xiaowujiang/AndroidProjectStudio
2796496ebb7d279ad0f405102c107db9085545e7
[ "Apache-2.0" ]
null
null
null
KotlinMail/ordercenter/src/main/java/cn/xwj/order/data/repository/ShipAddressRepository.kt
xiaowujiang/AndroidProjectStudio
2796496ebb7d279ad0f405102c107db9085545e7
[ "Apache-2.0" ]
null
null
null
package cn.xwj.order.data.repository import cn.xwj.baselibrary.data.net.RetrofitFactory import cn.xwj.baselibrary.ext.convert import cn.xwj.baselibrary.ext.convertBoolean import cn.xwj.order.data.api.ShipAddressApi import cn.xwj.order.data.protocol.AddShipAddressReq import cn.xwj.order.data.protocol.DeleteShipAddressReq import cn.xwj.order.data.protocol.EditShipAddressReq import cn.xwj.order.data.protocol.ShipAddress import io.reactivex.Observable import javax.inject.Inject /** * Author: xw * Date: 2018-06-06 15:52:13 * Description: OrderRepository: . */ class ShipAddressRepository @Inject constructor() : ShipAddressDataSource { override fun addShipAddress(shipUserName: String, shipUserMobile: String, shipAddress: String): Observable<Boolean> { return RetrofitFactory.instance.create(ShipAddressApi::class.java) .addShipAddress(AddShipAddressReq(shipUserName, shipUserMobile, shipAddress)) .convertBoolean() } override fun getShipAddressList(): Observable<MutableList<ShipAddress>?> { return RetrofitFactory.instance.create(ShipAddressApi::class.java) .getShipAddressList() .convert() } override fun editShipAddress(address: ShipAddress): Observable<Boolean> { return RetrofitFactory.instance.create(ShipAddressApi::class.java) .editShipAddress(EditShipAddressReq(address.id, address.shipUserName, address.shipUserMobile, address.shipAddress, address.shipIsDefault)) .convertBoolean() } override fun deleteShipAddress(id: Int): Observable<Boolean> { return RetrofitFactory.instance.create(ShipAddressApi::class.java) .deleteShipAddress(DeleteShipAddressReq(id)) .convertBoolean() } }
39.404255
93
0.713823
4a6dd5a6517e8cfd4585a5bb9600339ad0b05269
7,088
swift
Swift
CocoaHeads/13/eDSL.playground/Pages/Livecode.xcplaygroundpage/Contents.swift
trimmurrti/Talks
19d9ea4863267ed4aac633924c89a2ab8c6c2ae6
[ "BSD-3-Clause" ]
2
2018-10-22T12:20:10.000Z
2020-03-01T07:21:38.000Z
CocoaHeads/13/eDSL.playground/Pages/Livecode.xcplaygroundpage/Contents.swift
trimmurrti/Talks
19d9ea4863267ed4aac633924c89a2ab8c6c2ae6
[ "BSD-3-Clause" ]
null
null
null
CocoaHeads/13/eDSL.playground/Pages/Livecode.xcplaygroundpage/Contents.swift
trimmurrti/Talks
19d9ea4863267ed4aac633924c89a2ab8c6c2ae6
[ "BSD-3-Clause" ]
1
2018-01-23T12:26:59.000Z
2018-01-23T12:26:59.000Z
import Foundation // Uncle Bob level ugly bools func printMama() { print("mama") } func f(x: Int) -> Bool { if (x == 1) { printMama() return true } else { return false } } func scope(action: () -> ()) { action() } scope { func f(x: Int) -> Bool { if (x == 1) { printMama() return true } else { return false } } } scope { func f(x: Int) -> Bool { let result = x == 1 if (result) { printMama() } return result } } func ignoreInput<Value, Result>(action: @escaping () -> Result) -> (Value) -> Result { return { _ in action() } } func sideEffect<Value>(action: @escaping (Value) -> ()) -> (Value) -> Value { return { action($0) return $0 } } precedencegroup LeftFunctionApplicationPrecedence { associativity: left higherThan: AssignmentPrecedence } precedencegroup RightFunctionApplicationPrecedence { associativity: right higherThan: LeftFunctionApplicationPrecedence } precedencegroup LeftCompositionPrecedence { associativity: left higherThan: RightFunctionApplicationPrecedence } infix operator |> :LeftFunctionApplicationPrecedence infix operator <| :RightFunctionApplicationPrecedence infix operator § :RightFunctionApplicationPrecedence infix operator • :LeftCompositionPrecedence func § <Value, Result>(transform: (Value) -> Result, value: Value) -> Result { return transform(value) } func |> <Value, Result>(value: Value, transform: (Value) -> Result) -> Result { return transform § value } func <| <Value, Result>(transform: (Value) -> Result, value: Value) -> Result { return transform § value } func • <A, B, C>(lhs: @escaping (A) -> B, rhs: @escaping (B) -> C) -> (A) -> C { return { rhs(lhs($0)) } } func stringify<Value: CustomStringConvertible>(value: Value) -> String { return value.description } func stringify<Value>(value: Value) -> String { return "\(value)" } let print = { Swift.print($0) } func test(action: @escaping (Int) -> Bool) { [1, 3, 100].forEach(action • stringify • print) print("\n") } scope { test § { sideEffect(action: ignoreInput(action: printMama))($0 == 1) } } scope { let ffffuuuuu = { $0 == 1 } • (sideEffect § ignoreInput § printMama) test § ffffuuuuu } scope { func condition<Result>( value: Bool, `if`: () -> Result, `else`: () -> Result ) -> Result { return value ? `if`() : `else`() } } scope { func condition<Result>( value: Bool, `if`: () -> Result, `else`: () -> Result ) -> Result { return withoutActuallyEscaping(`if`) { `if` in withoutActuallyEscaping(`else`) { () |> (value ? `if` : $0) } } } } func call<Result>(action: () -> Result) -> Result { return action() } func lambda<Result>(action: @escaping () -> Result) -> () -> Result { return action } struct S { let value = call { /* asrfaswf asrfaswf asrfaswf asrfaswf asrfaswf asrfaswf asrfaswf */ return 1 } } scope { func condition<Result>( value: Bool, `if`: () -> Result, `else`: () -> Result ) -> Result { return withoutActuallyEscaping(`if`) { `if` in withoutActuallyEscaping(`else`) { call § (value ? `if` : $0) } } } } func condition<Result>( value: Bool, `if`: () -> Result, `else`: () -> Result ) -> Result { return value ? `if`() : `else`() } scope { let ffffuuuuu = { $0 == 1 } • (sideEffect § { condition(value: $0, if: printMama, else: { () }) }) test § ffffuuuuu } func returnValue<Value>(value: Value) -> () -> Value { return { value } } scope { let ffffuuuuu = { $0 == 1 } • (sideEffect § { condition(value: $0, if: printMama, else: returnValue § ()) }) test § ffffuuuuu } func when<Result>(value: Bool, action: () -> Result) -> Result? { return value ? action() : nil } // when with explicit nil (callIf -> became when thx to Paul Taykalo) // when with returnValue // Useful as well: // ignoreAndReturn // unless // Solution using uncurried when scope { let ffffuuuuu = { $0 == 1 } • (sideEffect § { when(value: $0, action: printMama) }) test § ffffuuuuu } func curry<A, B, C>(action: @escaping (A, B) -> C) -> (A) -> (B) -> C { return { a in { action(a, $0) } } } func flip<A, B, C>(action: @escaping (A) -> (B) -> C) -> (B) -> (A) -> C { return { b in { action($0)(b) } } } func ignoreOutput<Value, Result>(action: @escaping (Value) -> Result) -> (Value) -> () { return { _ = action($0) } } func equals<Value: Equatable>(_ lhs: Value) -> (Value) -> Bool { return { lhs == $0 } } scope { let ffffuuuuu = (1 |> equals) • (sideEffect § ignoreOutput § (when |> curry |> flip) § printMama) test § ffffuuuuu } func less<Value: Comparable>(_ lhs: Value) -> (Value) -> Bool { return { lhs < $0 } } // Solution using curried when // Additional example // greater // curried greater to less // eDSL using trailing closures // extract //func outerCall(_ action: () -> ()) { // // do something before // action() // // do something after //} // adjust //struct Value { // var x: Int //} // //let values = [1, 2].map(Value.init) //let result: [Value] = values.map { // var value = $0 // value.x += 1 // // return value //} // tuple with optionals //let printInts: (Int, Int) -> () = { // print("x1 = \($0), x2 = \($1)") //} // //let x1: Int? = 1 //let x2: Int? = 2 // //if // let x1 = x1, // let x2 = x2 //{ // printInts(x1, x2) //} // lift tuple, lift to tuple // Optional+do // Namespaced eDSL // iOS.device { print("DO SOME METAL PROCESSING USING BLE") } // iOS.simulator § printMama //Platform // mobile -> arch(arm) || arch(arm64) // mac -> arch(i386) || arch(x86_64) //OS // iOS -> os(iOS) // macOS -> os(macOS) // ~> // iOS // device // simulator // Namespaced Constrained eDSL //iOS.do( // device: { print("DO SOME METAL PROCESSING USING BLE") }, // simulator: printMama, // none: { } //) // //let deviceOne = extract(iOS.simulator) { 1 } //print(deviceOne ?? -1) // //let simulatorOne = extract(Platform.mac ~> OS.iOS) { 1 } //print(simulatorOne ?? -1) //protocol SumType: Equatable //SumType + do //~> SumType //enum Platform: SumType //enum OS: SumType //enum iOS: SumType -> device | simulator | none // Holder DSL //let user = User(name: "Vasia") //print(user.dsl.renamed(to: "Ganzolder")) //DSL<Base> //DSLProvider //DSLProvider + dsl //User: DSLProvider //DSL + adjust //DSL<User> + renamed //Declarative DSL - see IDPDesignable //Non-constrained syntax DSL - see SnapKit //Constrained syntax DSL - see Nimble-
19.105121
101
0.552765
cf93883fe1631fe98a9e55568edf706c30d8c332
445
css
CSS
public/css/mujeres.css
gongarvi/DAW2Reto2Final
d90d8f1408e8f1b304a59d069ff3ff538709a36f
[ "MIT" ]
null
null
null
public/css/mujeres.css
gongarvi/DAW2Reto2Final
d90d8f1408e8f1b304a59d069ff3ff538709a36f
[ "MIT" ]
null
null
null
public/css/mujeres.css
gongarvi/DAW2Reto2Final
d90d8f1408e8f1b304a59d069ff3ff538709a36f
[ "MIT" ]
null
null
null
body{ background-image: url("../image/fondo3.jpg"); background-repeat: no-repeat; background-size: cover; background-attachment: fixed; color: white; font-family: Verdana, Geneva, Tahoma, sans-serif; } .cards{ width:14em; } .ir-arriba{ display:none; background-repeat:no-repeat; font-size:20px; color:black; cursor:pointer; position:fixed; bottom:10px; right:10px; z-index:2; }
18.541667
53
0.635955