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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ee90e49fd624b60aadd2f852f3f62390c5c7fc86 | 445 | asm | Assembly | programs/oeis/129/A129296.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/129/A129296.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/129/A129296.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A129296: Number of divisors of n^2 - 1 that are not greater than n.
; 1,1,2,2,4,2,5,3,5,3,8,2,8,4,6,4,9,2,12,4,8,4,10,3,10,6,8,4,16,2,14,4,7,8,12,4,12,4,10,4,20,2,16,6,8,6,12,3,18,6,12,4,16,4,20,8,10,4,16,2,16,6,8,12,16,4,16,4,16,4,30,2,15,6,8,12,16,4,24,5,12,5,16,4,16,8,10,4,30,4,24,8,8,8,14,4,21,6,18,6
add $0,1
pow $0,2
trn $0,3
mov $1,$0
add $0,1
seq $0,94820 ; Partial sums of A038548.
seq $1,94820 ; Partial sums of A038548.
sub $0,$1
| 37.083333 | 237 | 0.61573 |
173b2ef20e182647ae139be89d09a17f64aa533e | 1,586 | swift | Swift | Sources/Paginator/OffsetPaginatorLinks.swift | baldoph/paginator | d294c45c09a4498d93cb48f802563182a347f4d9 | [
"MIT"
] | 75 | 2016-12-27T15:52:48.000Z | 2021-09-02T07:06:14.000Z | Sources/Paginator/OffsetPaginatorLinks.swift | baldoph/paginator | d294c45c09a4498d93cb48f802563182a347f4d9 | [
"MIT"
] | 73 | 2016-12-23T06:59:14.000Z | 2020-05-04T15:15:54.000Z | Sources/Paginator/OffsetPaginatorLinks.swift | baldoph/paginator | d294c45c09a4498d93cb48f802563182a347f4d9 | [
"MIT"
] | 20 | 2017-01-24T21:38:00.000Z | 2022-03-31T07:56:43.000Z | import Vapor
public extension OffsetMetadata {
static func nextAndPreviousLinks(
currentPage: Int,
totalPages: Int,
url: URL
) throws -> (previous: String?, next: String?) {
var previous: String? = nil
var next: String? = nil
if currentPage > 1 {
let previousPage = (currentPage <= totalPages) ? currentPage - 1 : totalPages
previous = try link(url: url, page: previousPage)
}
if currentPage < totalPages {
next = try link(url: url, page: currentPage + 1)
}
return (previous, next)
}
func links(
in range: CountableClosedRange<Int>
) throws -> [String] {
return try range.map { try link(for: $0) }
}
func link(
for page: Int
) throws -> String {
return try OffsetMetadata.link(url: self.url, page: page)
}
private static func link(url: URL, page: Int) throws -> String {
guard
let pageName = try OffsetQueryParameters.reflectProperty(forKey: \.page)?.path.last,
var components = URLComponents(url: url, resolvingAgainstBaseURL: false)
else {
throw Abort(.internalServerError)
}
var queryItems = components.queryItems?.filter { $0.name != pageName } ?? []
queryItems.append(URLQueryItem(name: pageName, value: String(page)))
components.queryItems = queryItems
guard let url = components.url?.absoluteString else {
throw Abort(.internalServerError)
}
return url
}
}
| 28.836364 | 96 | 0.589533 |
4fbc39691a8d9a94c50716a4aa50ff1b43991826 | 2,654 | sql | SQL | backtesting.sql | dade1987/StockPricePredictor | cc7eccee3bd2d1957fcdadca90b88fb72c9b3ac8 | [
"MIT"
] | 2 | 2022-01-09T19:47:30.000Z | 2022-01-10T14:00:16.000Z | backtesting.sql | dade1987/StockPricePredictor | cc7eccee3bd2d1957fcdadca90b88fb72c9b3ac8 | [
"MIT"
] | null | null | null | backtesting.sql | dade1987/StockPricePredictor | cc7eccee3bd2d1957fcdadca90b88fb72c9b3ac8 | [
"MIT"
] | 1 | 2022-01-10T14:01:02.000Z | 2022-01-10T14:01:02.000Z |
david@LAPTOP-I702TPUN MINGW64 /c/laragon/www/StockPricePredictor (master)
$ node analisi.js
DATE 2022-03-16T12:03:17.009Z
CRYPTO INTRADAY_5_MIN BTC USD
VOLATILITA' PERCENTUALE MEDIANA SUL TIMEFRAME CORRENTE 0.08031166180983007
40647.24
NIENTE
VALIDAZIONE BACKTESTING {
verificata_buy: 32,
non_verificata_buy: 1,
verificata_sell: 40,
non_verificata_sell: 4,
percentuale_buy_giuste: '97.0',
percentuale_sell_giuste: '90.9',
percentuale_totale_giuste: '93.5'
}
CRYPTO INTRADAY_5_MIN ETH USD
VOLATILITA' PERCENTUALE MEDIANA SUL TIMEFRAME CORRENTE 0.09171045808794531
40642.03
NIENTE
VALIDAZIONE BACKTESTING {
verificata_buy: 32,
non_verificata_buy: 5,
verificata_sell: 42,
non_verificata_sell: 9,
percentuale_buy_giuste: '86.5',
percentuale_sell_giuste: '82.4',
percentuale_totale_giuste: '84.1'
}
CRYPTO INTRADAY_5_MIN BNB USD
VOLATILITA' PERCENTUALE MEDIANA SUL TIMEFRAME CORRENTE 0.08040739748057035
40628.06
LONG 0.12061109622085553 40628.06 0.040203698740285176
VALIDAZIONE BACKTESTING {
verificata_buy: 31,
non_verificata_buy: 6,
verificata_sell: 42,
non_verificata_sell: 4,
percentuale_buy_giuste: '83.8',
percentuale_sell_giuste: '91.3',
percentuale_totale_giuste: '88.0'
}
CRYPTO INTRADAY_5_MIN LUNA USD
VOLATILITA' PERCENTUALE MEDIANA SUL TIMEFRAME CORRENTE 0.1846020197632754
40663.67
NIENTE
VALIDAZIONE BACKTESTING {
verificata_buy: 38,
non_verificata_buy: 0,
verificata_sell: 28,
non_verificata_sell: 1,
percentuale_buy_giuste: '100.0',
percentuale_sell_giuste: '96.6',
percentuale_totale_giuste: '98.5'
}
CRYPTO INTRADAY_5_MIN ADA USD
VOLATILITA' PERCENTUALE MEDIANA SUL TIMEFRAME CORRENTE 0.1253132832080155
40642.6
NIENTE
VALIDAZIONE BACKTESTING {
verificata_buy: 36,
non_verificata_buy: 16,
verificata_sell: 24,
non_verificata_sell: 16,
percentuale_buy_giuste: '69.2',
percentuale_sell_giuste: '60.0',
percentuale_totale_giuste: '65.2'
}
DATE 2022-03-16T12:04:32.346Z
CRYPTO INTRADAY_5_MIN SOL USD
VOLATILITA' PERCENTUALE MEDIANA SUL TIMEFRAME CORRENTE 0.11365071347393041
40656.7
NIENTE
VALIDAZIONE BACKTESTING {
verificata_buy: 34,
non_verificata_buy: 5,
verificata_sell: 32,
non_verificata_sell: 6,
percentuale_buy_giuste: '87.2',
percentuale_sell_giuste: '84.2',
percentuale_totale_giuste: '85.7'
}
CRYPTO INTRADAY_5_MIN AVAX USD
VOLATILITA' PERCENTUALE MEDIANA SUL TIMEFRAME CORRENTE 0.14009526478004375
40656.69
NIENTE
VALIDAZIONE BACKTESTING {
verificata_buy: 36,
non_verificata_buy: 6,
verificata_sell: 27,
non_verificata_sell: 2,
percentuale_buy_giuste: '85.7',
percentuale_sell_giuste: '93.1',
percentuale_totale_giuste: '88.7'
}
| 26.808081 | 74 | 0.795026 |
11d0fdfc72867ee8b2580c3bf6926a99b8cac5ca | 900 | html | HTML | manuscript/page-1615/body.html | marvindanig/the-possessed | 320e30271a695448762320dfe141637ef7e7abbb | [
"BlueOak-1.0.0",
"MIT"
] | null | null | null | manuscript/page-1615/body.html | marvindanig/the-possessed | 320e30271a695448762320dfe141637ef7e7abbb | [
"BlueOak-1.0.0",
"MIT"
] | null | null | null | manuscript/page-1615/body.html | marvindanig/the-possessed | 320e30271a695448762320dfe141637ef7e7abbb | [
"BlueOak-1.0.0",
"MIT"
] | null | null | null | <div class="leaf "><div class="inner justify"><p>“If you are going to Spasov and on foot, it will take you a week in your boots,” laughed the woman.</p><p>“I dare say, I dare say, no matter, <em>mes amis</em>, no matter.” Stepan Trofimovitch cut her short impatiently.</p><p>“Awfully inquisitive people; but the woman speaks better than he does, and I notice that since February 19,* their language has altered a little, and … and what business is it of mine whether I’m going to Spasov or not? Besides, I’ll pay them, so why do they pester me.”</p><blockquote><p> *February 19, 1861, the day of the Emancipation of the Serfs, is
meant.—Translator’s note.</p></blockquote><p>“If you are going to Spasov, you must take the steamer,” the peasant persisted.</p><p class=" stretch-last-line ">“That’s true indeed,” the woman put in with animation, “for if you drive along the bank it’s</p></div> </div> | 450 | 631 | 0.725556 |
453030e3e6e652374acb6bfeb33e4104f51d698b | 234 | rs | Rust | firmware/usbd_scsi/src/scsi/responses/read_capacity.rs | ololoshka2871/stm32-usb.rs | f1f8c3716e059fc36668358b9b38af11dfd5d898 | [
"Apache-2.0",
"MIT"
] | 21 | 2020-04-25T16:14:22.000Z | 2021-11-28T14:23:43.000Z | firmware/usbd_scsi/src/scsi/responses/read_capacity.rs | ololoshka2871/stm32-usb.rs | f1f8c3716e059fc36668358b9b38af11dfd5d898 | [
"Apache-2.0",
"MIT"
] | 1 | 2020-07-30T16:52:46.000Z | 2020-07-30T16:52:46.000Z | firmware/usbd_scsi/src/scsi/responses/read_capacity.rs | ololoshka2871/stm32-usb.rs | f1f8c3716e059fc36668358b9b38af11dfd5d898 | [
"Apache-2.0",
"MIT"
] | 3 | 2020-05-01T18:24:50.000Z | 2021-10-15T05:26:29.000Z | use packing::Packed;
#[derive(Clone, Copy, Eq, PartialEq, Debug, Packed)]
#[packed(big_endian, lsb0)]
pub struct ReadCapacity10Response {
#[pkd(7, 0, 0, 3)]
pub max_lba: u32,
#[pkd(7, 0, 4, 7)]
pub block_size: u32,
} | 21.272727 | 52 | 0.628205 |
65a51cd39207a579de8f3ad373715656e7ee80a2 | 161 | asm | Assembly | src/BreathOfTheWild/Cheats/InfiniteArrows/patch_InfiniteArrows.asm | lilystudent2016/cemu_graphic_packs | a7aaa6d07df0d5ca3f6475d741fb8b80fadd1a46 | [
"CC0-1.0"
] | 1,002 | 2017-01-10T13:10:55.000Z | 2020-11-20T18:34:19.000Z | src/BreathOfTheWild/Cheats/InfiniteArrows/patch_InfiniteArrows.asm | lilystudent2016/cemu_graphic_packs | a7aaa6d07df0d5ca3f6475d741fb8b80fadd1a46 | [
"CC0-1.0"
] | 347 | 2017-01-11T21:13:20.000Z | 2020-11-27T11:33:05.000Z | src/BreathOfTheWild/Cheats/InfiniteArrows/patch_InfiniteArrows.asm | lilystudent2016/cemu_graphic_packs | a7aaa6d07df0d5ca3f6475d741fb8b80fadd1a46 | [
"CC0-1.0"
] | 850 | 2017-01-10T06:06:43.000Z | 2020-11-06T21:16:49.000Z | [BotW_InfiniteArrows_V208]
moduleMatches = 0x6267BFD0
0x02EB6758 = nop
[BotW_InfiniteArrows_V176V192]
moduleMatches = 0xFD091F9F,0xD472D8A5
0x02EB61BC = nop
| 14.636364 | 37 | 0.832298 |
3b2633f71419bca32cd5836e1c5ed44f11ce36f5 | 1,039 | h | C | include/Core/Utilities/Tools/TranformQGateTypeStringAndEnum.h | 4ier/QPanda-2 | ce44256bd7eb81f0982e6092090c9fc1b8b3f6b7 | [
"Apache-2.0"
] | 3 | 2020-05-14T09:30:25.000Z | 2021-11-17T10:58:53.000Z | include/Core/Utilities/Tools/TranformQGateTypeStringAndEnum.h | yinxx/QPanda-2 | c70c4117a90978916b871424e204c5159f645642 | [
"Apache-2.0"
] | null | null | null | include/Core/Utilities/Tools/TranformQGateTypeStringAndEnum.h | yinxx/QPanda-2 | c70c4117a90978916b871424e204c5159f645642 | [
"Apache-2.0"
] | null | null | null | /*
Copyright (c) 2017-2020 Origin Quantum Computing. All Right Reserved.
Licensed under the Apache License 2.0
TranformQGateTypeStringAndEnum.h
Author: Wangjing
Created in 2018-10-15
Classes for tranform gate type enum and std::string
*/
#ifndef TRANSFORM_QGATE_TYPE_STRING_ENUM_H
#define TRANSFORM_QGATE_TYPE_STRING_ENUM_H
#include <iostream>
#include <map>
#include <string>
#include "Core/QuantumCircuit/QGlobalVariable.h"
#include "Core/Utilities/QPandaNamespace.h"
QPANDA_BEGIN
/**
* @brief Classes for tranform gate type and gate name
* @ingroup Utilities
*/
class TransformQGateType
{
public:
static TransformQGateType &getInstance();
~TransformQGateType() {};
std::string operator [](GateType);
GateType operator [](std::string gate_name);
private:
std::map<std::string, GateType> m_qgate_type_map;
TransformQGateType &operator=(const TransformQGateType &);
TransformQGateType();
TransformQGateType(const TransformQGateType &);
};
QPANDA_END
#endif // TRANSFORM_QGATE_TYPE_STRING_ENUM_H
| 22.106383 | 69 | 0.769971 |
93132780e5bebeeb608d2771ad40fb02edf8f6e3 | 1,150 | swift | Swift | iOS/HPHC/HPHC/Controllers/StudyUI/ActivityUI/QuestionStepController/Views/TextChoiceCell.swift | JSalazar88/FDA-My-Studies-Mobile-Application-System | f86290bc4a483a75a8d7e80a6106dd48c4a1ebfb | [
"Apache-2.0"
] | null | null | null | iOS/HPHC/HPHC/Controllers/StudyUI/ActivityUI/QuestionStepController/Views/TextChoiceCell.swift | JSalazar88/FDA-My-Studies-Mobile-Application-System | f86290bc4a483a75a8d7e80a6106dd48c4a1ebfb | [
"Apache-2.0"
] | 6 | 2021-05-27T20:32:34.000Z | 2022-02-25T08:08:18.000Z | iOS/HPHC/HPHC/Controllers/StudyUI/ActivityUI/QuestionStepController/Views/TextChoiceCell.swift | JSalazar88/FDA-My-Studies-Mobile-Application-System | f86290bc4a483a75a8d7e80a6106dd48c4a1ebfb | [
"Apache-2.0"
] | 2 | 2021-05-12T20:25:59.000Z | 2021-06-09T16:40:57.000Z | //
// TextChoiceCell.swift
// Survey-Demo
//
// Created by Tushar on 3/25/19.
// Copyright © 2019 Tushar. All rights reserved.
//
import UIKit
class TextChoiceCell: UITableViewCell {
@IBOutlet weak var titleLbl: UILabel!
@IBOutlet weak var checkmarkView: UIImageView!
@IBOutlet weak var detailedTextLbl: UILabel!
var didSelected: Bool = false {
didSet {
if didSelected {
self.titleLbl.textColor = #colorLiteral(red: 0.2431372549, green: 0.5411764706, blue: 0.9921568627, alpha: 1)
self.checkmarkView.isHidden = false
} else {
self.titleLbl.textColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1)
self.checkmarkView.isHidden = true
}
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
self.didSelected = selected
// Configure the view for the selected state
}
}
| 26.136364 | 125 | 0.596522 |
8666165e174706bbd37fa85da1ad059c1a4ecaed | 2,235 | go | Go | benchmark/fibonacci_test.go | masa-suzu/monkey | 574ba0bc80336865c4f4e09cc28d758a018f34d5 | [
"MIT"
] | 1 | 2019-06-26T13:47:12.000Z | 2019-06-26T13:47:12.000Z | benchmark/fibonacci_test.go | masaxsuzu/monkey | 574ba0bc80336865c4f4e09cc28d758a018f34d5 | [
"MIT"
] | 1 | 2019-01-28T11:57:09.000Z | 2019-01-28T14:09:00.000Z | benchmark/fibonacci_test.go | masa-suzu/monkey | 574ba0bc80336865c4f4e09cc28d758a018f34d5 | [
"MIT"
] | null | null | null | package benchmark
import (
"fmt"
"github.com/masa-suzu/monkey/ast"
"github.com/masa-suzu/monkey/compiler"
"github.com/masa-suzu/monkey/evaluator"
"github.com/masa-suzu/monkey/lexer"
"github.com/masa-suzu/monkey/object"
"github.com/masa-suzu/monkey/parser"
"github.com/masa-suzu/monkey/vm"
"testing"
)
var input string = `
let f = fn(x){
if (x < 2) { return x}
return f(x-1) + f(x-2)
}
f(%v)
`
func BenchmarkRun10NestedFibonacci_Evaluator(b *testing.B) {
evaluate(fmt.Sprintf(input, 10))
}
func BenchmarkRun10NestedFibonacci_VM(b *testing.B) {
run(fmt.Sprintf(input, 10))
}
func BenchmarkRun20NestedFibonacci_Evaluator(b *testing.B) {
evaluate(fmt.Sprintf(input, 20))
}
func BenchmarkRun20NestedFibonacci_VM(b *testing.B) {
run(fmt.Sprintf(input, 20))
}
func BenchmarkRun25NestedFibonacci_Evaluator(b *testing.B) {
evaluate(fmt.Sprintf(input, 25))
}
func BenchmarkRun25NestedFibonacci_VM(b *testing.B) {
run(fmt.Sprintf(input, 25))
}
func BenchmarkRun26NestedFibonacci_Evaluator(b *testing.B) {
evaluate(fmt.Sprintf(input, 26))
}
func BenchmarkRun26NestedFibonacci_VM(b *testing.B) {
run(fmt.Sprintf(input, 26))
}
func BenchmarkRun27NestedFibonacci_Evaluator(b *testing.B) {
evaluate(fmt.Sprintf(input, 27))
}
func BenchmarkRun27NestedFibonacci_VM(b *testing.B) {
run(fmt.Sprintf(input, 27))
}
func BenchmarkRun28NestedFibonacci_Evaluator(b *testing.B) {
evaluate(fmt.Sprintf(input, 28))
}
func BenchmarkRun28NestedFibonacci_VM(b *testing.B) {
run(fmt.Sprintf(input, 28))
}
func BenchmarkRun29NestedFibonacci_Evaluator(b *testing.B) {
evaluate(fmt.Sprintf(input, 29))
}
func BenchmarkRun29NestedFibonacci_VM(b *testing.B) {
run(fmt.Sprintf(input, 29))
}
func BenchmarkRun30NestedFibonacci_Evaluator(b *testing.B) {
evaluate(fmt.Sprintf(input, 30))
}
func BenchmarkRun30NestedFibonacci_VM(b *testing.B) {
run(fmt.Sprintf(input, 30))
}
func evaluate(src string) {
p := parse(src)
env := object.NewEnvironment()
evaluator.Eval(p, env)
}
func run(src string) {
p := parse(src)
c := compiler.New()
c.Compile(p)
vm := vm.New(c.ByteCode())
vm.Run()
vm.LastPoppedStackElement()
}
func parse(src string) *ast.Program {
l := lexer.New(src)
p := parser.New(l)
return p.ParseProgram()
}
| 21.911765 | 60 | 0.736018 |
1f277f5a2141014e8cbcfa5f5f87c409886e0c44 | 2,257 | kt | Kotlin | src/examples/kotlin/dev/augu/nino/butterfly/examples/SettingsOverloadExample.kt | NinoDiscord/Butterfly | 9b878b8b01a1cc07b8c9777817e175d3f0ca0bbb | [
"MIT"
] | 11 | 2020-06-22T19:27:10.000Z | 2021-03-07T23:42:30.000Z | src/examples/kotlin/dev/augu/nino/butterfly/examples/SettingsOverloadExample.kt | NinoDiscord/Butterfly | 9b878b8b01a1cc07b8c9777817e175d3f0ca0bbb | [
"MIT"
] | 19 | 2020-06-28T11:15:02.000Z | 2020-11-01T18:04:19.000Z | src/examples/kotlin/dev/augu/nino/butterfly/examples/SettingsOverloadExample.kt | NinoDiscord/Butterfly | 9b878b8b01a1cc07b8c9777817e175d3f0ca0bbb | [
"MIT"
] | null | null | null | @file:JvmName("SettingsOverloadExample")
package dev.augu.nino.butterfly.examples
import club.minnced.jda.reactor.ReactiveEventManager
import dev.augu.nino.butterfly.ButterflyClient
import dev.augu.nino.butterfly.GuildSettings
import dev.augu.nino.butterfly.GuildSettingsLoader
import dev.augu.nino.butterfly.command.Command
import dev.augu.nino.butterfly.command.CommandContext
import net.dv8tion.jda.api.JDABuilder
import net.dv8tion.jda.api.entities.Guild
/**
* Custom settings
*
* @property prefix the guild prefix
* @property counter counts the number of command calls for each guild.
*/
private class CustomSettings(override var prefix: String?, var counter: Int) : GuildSettings(prefix, null) {
suspend fun save() {
// Save to a database
}
}
/**
* Custom settings loader
*/
private object CustomSettingsLoader : GuildSettingsLoader<CustomSettings> {
val map = mutableMapOf<String, CustomSettings>()
override suspend fun load(guild: Guild): CustomSettings =
map.getOrPut(guild.id, { CustomSettings(prefix = null, counter = 0) })
}
private class AddCommand : Command("add", "simple", "++", guildOnly = true) {
override suspend fun execute(ctx: CommandContext) {
ctx.settings<CustomSettings>()!!.counter++
}
}
private class PrintCommand : Command("print", "simple", "printcount", "value", guildOnly = true) {
override suspend fun execute(ctx: CommandContext) {
ctx.reply("The value is: ${ctx.settings<CustomSettings>()!!.counter}")
}
}
private class ClearCommand : Command("clear", "simple", guildOnly = true) {
override suspend fun execute(ctx: CommandContext) {
ctx.settings<CustomSettings>()!!.counter = 0
}
}
private object SettingsOverload {
fun launch() {
val jda = JDABuilder
.createDefault(System.getenv("TOKEN"))
.setEventManager(ReactiveEventManager())
.build()
val client =
ButterflyClient.builder(jda, arrayOf("239790360728043520"), guildSettingsLoader = CustomSettingsLoader)
.addCommands(AddCommand(), PrintCommand(), ClearCommand())
.addPrefixes("test!")
.build()
}
}
private fun main() {
SettingsOverload.launch()
} | 31.788732 | 115 | 0.694284 |
6c50eb74fd7b5ee3a735f93889ed767ea65d428b | 7,061 | go | Go | canvas.go | WesleiRamos/canvas2d | 76dbd87a978dc53e4078e4d3828238080b5fe3c4 | [
"MIT"
] | 10 | 2016-12-12T21:24:35.000Z | 2021-09-18T17:24:24.000Z | canvas.go | WesleiRamos/canvas2d | 76dbd87a978dc53e4078e4d3828238080b5fe3c4 | [
"MIT"
] | null | null | null | canvas.go | WesleiRamos/canvas2d | 76dbd87a978dc53e4078e4d3828238080b5fe3c4 | [
"MIT"
] | null | null | null | package canvas2d
import "image"
import "runtime"
import "github.com/go-gl/gl/v2.1/gl"
import "github.com/go-gl/glfw/v3.2/glfw"
type KEY_PRESS func(key int32, mod int32)
type MOUSE_PRESS func(x, y float32, btn, mod int32)
type MOUSE_MOVE func(x, y float32)
type WINDOW_RESIZE func(w, h int)
func init() {
runtime.LockOSThread()
}
type Canvas struct {
Width, Height int
title string
loopFunc func()
fullScreen bool
resizable bool
loadResources func()
swapInterval int
cursor bool
icon []image.Image
glfwInit bool
glInit bool
Window *glfw.Window
windowResize WINDOW_RESIZE
keyDown KEY_PRESS
keyUp KEY_PRESS
keyPress KEY_PRESS
mouseDown MOUSE_PRESS
mouseUp MOUSE_PRESS
mouseMove MOUSE_MOVE
}
func NewCanvas(w, h int, title string) Canvas {
if w < 0 || h < 0 {
panic("Width and Height need be positive")
}
return Canvas{Width: w, Height: h, title: title, resizable: true}
}
/*
Funções "set"
*/
func (self *Canvas) SetLoadResources(x func()) {
/*
Seta uma função para carregar elementos ao jogo após iniciar o opengl
*/
self.loadResources = x
}
func (self *Canvas) SetLoopFunc(x func()) {
/*
Seta a função de loop do jogo
*/
self.loopFunc = x
}
func (self *Canvas) SetFullScreen(full bool) {
/*
Seta o modo do display
**Se a tela não for full screen não precisa chamar
*/
self.fullScreen = full
}
func (self *Canvas) SetResizable(b bool) {
/*
Seta se a tela poderá ser redimensionada ou não
*/
self.resizable = b
}
func (self *Canvas) SetSwapInterval(i int) {
self.swapInterval = i
}
func (self *Canvas) SetIcon(iconpath string) {
self.icon = loadIcon(iconpath)
}
/*
Funções "get"
*/
func (self Canvas) GetContext() Context {
return Context{fill{}, stroke{}}
}
/*
Funções "on"
*/
func (self *Canvas) OnKeyDown(x KEY_PRESS) {
// Define a ação de clicar no botão
self.keyDown = x
}
func (self *Canvas) OnKeyUp(x KEY_PRESS) {
// Define a ação de doltar o botão
self.keyUp = x
}
func (self *Canvas) OnKeyPress(x KEY_PRESS) {
// Define a ação de segurar o botão
self.keyPress = x
}
func (self *Canvas) OnMouseDown(x MOUSE_PRESS) {
// Define a ação de clicar os botões do mouse
self.mouseDown = x
}
func (self *Canvas) OnMouseUp(x MOUSE_PRESS) {
// Define a ação de soltar os botões do mouse
self.mouseUp = x
}
func (self *Canvas) OnMouseMove(x MOUSE_MOVE) {
// Define a ação de mover o mouse
self.mouseMove = x
}
func (self *Canvas) OnWindowResize(x WINDOW_RESIZE) {
// Seta a função que será chamada quando a janela for redimensionada
self.windowResize = x
}
func (self *Canvas) EnableCursor() {
/*
Mostra o cursor do mouse
*/
self.cursor = true
self.enableDisableCursor()
}
func (self *Canvas) DisableCursor() {
/*
Esconde o cursor do mouse
*/
self.cursor = false
self.enableDisableCursor()
}
/*
Outras funções
*/
func (self Canvas) ApplicationExit() {
// Fecha o programa
self.Window.SetShouldClose(true)
}
func (self *Canvas) Show() {
/*
Inicia a janela
*/
// Inicializa o GLFW
if err := glfw.Init(); err != nil {
panic(err)
}
self.glfwInit = true
glfw.WindowHint(glfw.Samples, 4)
if !self.resizable {
glfw.WindowHint(glfw.Resizable, glfw.False)
}
/* Cria a janela */
window, err := self.newWindow()
if err != nil {
panic(err)
}
window.MakeContextCurrent()
if self.swapInterval > 0 {
glfw.SwapInterval(self.swapInterval)
}
/* Inicializa o OpenGL */
if err := gl.Init(); err != nil {
panic(err)
}
self.glInit = true
if self.loadResources != nil {
self.loadResources()
}
self.Window = window
if len(self.icon) == 1 {
self.Window.SetIcon(self.icon)
}
/* Callback events */
// Quando a janela for redimensionada
self.Window.SetSizeCallback(self.sizeCallback)
// Quando alguma tecla for pressionada
self.Window.SetKeyCallback(func(w *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey) {
if action == glfw.Press && self.keyDown != nil {
/* Quando a tecla for pressionada */
self.keyDown(int32(key), int32(mods))
} else if action == glfw.Release && self.keyUp != nil {
/* Quando a tecla for solta */
self.keyUp(int32(key), int32(mods))
} else if action == glfw.Repeat && self.keyPress != nil {
/* Se a tecla estiver ainda sendo pressionada */
self.keyPress(int32(key), int32(mods))
}
})
// Quando algum botão do mouse for pressionado
self.Window.SetMouseButtonCallback(func(w *glfw.Window, btn glfw.MouseButton, atc glfw.Action, mod glfw.ModifierKey) {
posx, posy := w.GetCursorPos()
if atc == glfw.Press && self.mouseDown != nil {
// Quando o botão do mouse for pressionado
self.mouseDown(float32(posx), float32(posy), int32(btn), int32(mod))
} else if atc == glfw.Release && self.mouseUp != nil {
// Quando o botão do mouse for solto
self.mouseUp(float32(posx), float32(posy), int32(btn), int32(mod))
}
})
// Pega a posição x e y do mouse quando for movimentado
self.Window.SetCursorPosCallback(func(w *glfw.Window, x, y float64) {
if self.mouseMove != nil {
self.mouseMove(float32(x), float32(y))
}
})
/*****************/
if self.loopFunc != nil {
self.set2d()
for !self.Window.ShouldClose() {
gl.Clear(gl.COLOR_BUFFER_BIT)
self.loopFunc()
gl.Flush()
self.Window.SwapBuffers()
glfw.PollEvents()
}
}
}
/* Funções privadas */
func (self Canvas) set2d() {
/*
Como o nome já diz, faz com que a projeção seja 2d
*/
gl.Viewport(0, 0, int32(self.Width), int32(self.Height))
gl.MatrixMode(gl.PROJECTION)
gl.LoadIdentity()
gl.Ortho(0, float64(self.Width), 0, float64(self.Height), -1, 1)
gl.Scalef(1, -1, 1)
gl.Translatef(0, -float32(self.Height), 0)
gl.MatrixMode(gl.MODELVIEW)
gl.Enable(gl.BLEND)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
gl.LoadIdentity()
}
func (self *Canvas) sizeCallback(_window *glfw.Window, w, h int) {
/*
Quando a janela for redimensionada, altera também a projeção da janela
*/
self.Width = w
self.Height = h
self.set2d()
if self.windowResize != nil {
self.windowResize(w, h)
}
}
func (self *Canvas) newWindow() (*glfw.Window, error) {
/*
Faz com que a janela entre em fullscreen
*/
if self.fullScreen {
monitor := glfw.GetPrimaryMonitor().GetVideoMode()
self.Width = monitor.Width
self.Height = monitor.Height
return glfw.CreateWindow(self.Width, self.Height, self.title, glfw.GetPrimaryMonitor(), nil)
} else {
return glfw.CreateWindow(self.Width, self.Height, self.title, nil, nil)
}
}
func (self *Canvas) enableDisableCursor() {
if self.glfwInit {
cursor := glfw.CursorNormal
if !self.cursor {
cursor = glfw.CursorHidden
}
self.Window.SetInputMode(glfw.CursorMode, cursor)
}
}
| 21.860681 | 122 | 0.648492 |
c88e7b92764383e7f398f38da9a988ced60cddee | 884 | swift | Swift | Example/DolyameSDKUsageDemo/Workflows/Checkout/Views/SwitchParameterView.swift | Tinkoff/dolyamesdk-ios | d28838fc4cac1df96f48f71ea649051447ccb764 | [
"MIT"
] | 2 | 2022-03-10T07:37:41.000Z | 2022-03-10T23:54:41.000Z | Example/DolyameSDKUsageDemo/Workflows/Checkout/Views/SwitchParameterView.swift | Tinkoff/dolyamesdk-ios | d28838fc4cac1df96f48f71ea649051447ccb764 | [
"MIT"
] | null | null | null | Example/DolyameSDKUsageDemo/Workflows/Checkout/Views/SwitchParameterView.swift | Tinkoff/dolyamesdk-ios | d28838fc4cac1df96f48f71ea649051447ccb764 | [
"MIT"
] | null | null | null | //
// SwitchParameterView.swift
// DolyameSDKUsageDemo
//
// Created by a.tonkhonoev on 02.12.2021.
//
import UIKit
class SwitchParameterView: UIView {
let label = UILabel()
let switcher = UISwitch()
init() {
super.init(frame: .zero)
label.font = .systemFont(ofSize: 13, weight: .light)
addSubview(label)
label.snp.makeConstraints { make in
make.top.bottom.equalToSuperview().inset(8)
make.leading.equalToSuperview().inset(16)
}
addSubview(switcher)
switcher.snp.makeConstraints { make in
make.top.bottom.equalToSuperview().inset(8)
make.leading.equalTo(label.snp.trailing).offset(8)
make.trailing.equalToSuperview().inset(8)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
| 24.555556 | 62 | 0.616516 |
b9c7a873fdf5f00ebacd1976529a2080af097201 | 21,789 | swift | Swift | TwilioVerifySDKTests/TwilioVerify/Sources/Domain/Manager/TwilioVerifyManagerTests.swift | twilio/twilio-verify-ios | df16896a4e0bed01f9212c0c08c4b148b81b00b5 | [
"Apache-2.0"
] | 9 | 2020-10-15T17:33:02.000Z | 2022-02-11T20:19:15.000Z | TwilioVerifySDKTests/TwilioVerify/Sources/Domain/Manager/TwilioVerifyManagerTests.swift | twilio/twilio-verify-ios | df16896a4e0bed01f9212c0c08c4b148b81b00b5 | [
"Apache-2.0"
] | 89 | 2020-10-15T17:03:27.000Z | 2022-03-14T21:26:24.000Z | TwilioVerifySDKTests/TwilioVerify/Sources/Domain/Manager/TwilioVerifyManagerTests.swift | twilio/twilio-verify-ios | df16896a4e0bed01f9212c0c08c4b148b81b00b5 | [
"Apache-2.0"
] | 4 | 2021-03-22T18:21:44.000Z | 2022-02-17T20:24:08.000Z | //
// TwilioVerifyManagerTests.swift
// TwilioVerifyTests
//
// Copyright © 2020 Twilio.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import XCTest
@testable import TwilioVerifySDK
// swiftlint:disable type_body_length file_length force_cast
class TwilioVerifyManagerTests: XCTestCase {
private var twilioVerify: TwilioVerify!
private var factorFacade: FactorFacadeMock!
private var challengeFacade: ChallengeFacadeMock!
override func setUpWithError() throws {
try super.setUpWithError()
factorFacade = FactorFacadeMock()
challengeFacade = ChallengeFacadeMock()
twilioVerify = TwilioVerifyManager(factorFacade: factorFacade, challengeFacade: challengeFacade)
}
func testCreateFactor_withFactorResponse_shouldSucceed() {
let successExpectation = expectation(description: "Wait for success response")
factorFacade.factor = Constants.expectedFactor
var factorResponse: Factor!
twilioVerify.createFactor(withPayload: Constants.factorPayload, success: { factor in
factorResponse = factor
successExpectation.fulfill()
}) { _ in
XCTFail()
successExpectation.fulfill()
}
wait(for: [successExpectation], timeout: 5)
XCTAssertEqual(factorResponse.sid, Constants.expectedFactor.sid,
"Factor sid should be \(Constants.expectedFactor.sid) but was \(factorResponse.sid)")
XCTAssertEqual(factorResponse.friendlyName, Constants.expectedFactor.friendlyName,
"Factor friendlyName should be \(Constants.expectedFactor.friendlyName) but was \(factorResponse.friendlyName)")
XCTAssertEqual(factorResponse.accountSid, Constants.expectedFactor.accountSid,
"Factor accountSid should be \(Constants.expectedFactor.accountSid) but was \(factorResponse.accountSid)")
XCTAssertEqual(factorResponse.serviceSid, Constants.expectedFactor.serviceSid,
"Factor serviceSid should be \(Constants.expectedFactor.serviceSid) but was \(factorResponse.serviceSid)")
XCTAssertEqual(factorResponse.identity, Constants.expectedFactor.identity,
"Factor identity should be \(Constants.expectedFactor.identity) but was \(factorResponse.identity)")
XCTAssertEqual(factorResponse.createdAt, Constants.expectedFactor.createdAt,
"Factor createdAt should be \(Constants.expectedFactor.createdAt) but was \(factorResponse.createdAt)")
}
func testCreateFactor_withErrorResponse_shouldFail() {
let failureExpectation = expectation(description: "Wait for failure response")
let expectedError = TwilioVerifyError.inputError(error: TestError.operationFailed as NSError)
factorFacade.error = expectedError
var error: TwilioVerifyError!
twilioVerify.createFactor(withPayload: Constants.factorPayload, success: { _ in
XCTFail()
failureExpectation.fulfill()
}) { failure in
error = failure
failureExpectation.fulfill()
}
wait(for: [failureExpectation], timeout: 5)
XCTAssertEqual(error.localizedDescription, expectedError.localizedDescription, "Error should be \(expectedError.localizedDescription) but was \(error.localizedDescription)")
}
func testVerifyFactor_withFactorResponse_shouldSucceed() {
let successExpectation = expectation(description: "Wait for success response")
let factorPayload = VerifyPushFactorPayload(sid: "sid")
factorFacade.factor = Constants.expectedFactor
var factorResponse: Factor!
twilioVerify.verifyFactor(withPayload: factorPayload, success: { factor in
factorResponse = factor
successExpectation.fulfill()
}) { _ in
XCTFail()
successExpectation.fulfill()
}
wait(for: [successExpectation], timeout: 5)
XCTAssertEqual(factorResponse.sid, Constants.expectedFactor.sid,
"Factor sid should be \(Constants.expectedFactor.sid) but was \(factorResponse.sid)")
XCTAssertEqual(factorResponse.friendlyName, Constants.expectedFactor.friendlyName,
"Factor friendlyName should be \(Constants.expectedFactor.friendlyName) but was \(factorResponse.friendlyName)")
XCTAssertEqual(factorResponse.accountSid, Constants.expectedFactor.accountSid,
"Factor accountSid should be \(Constants.expectedFactor.accountSid) but was \(factorResponse.accountSid)")
XCTAssertEqual(factorResponse.serviceSid, Constants.expectedFactor.serviceSid,
"Factor serviceSid should be \(Constants.expectedFactor.serviceSid) but was \(factorResponse.serviceSid)")
XCTAssertEqual(factorResponse.identity, Constants.expectedFactor.identity,
"Factor identity should be \(Constants.expectedFactor.identity) but was \(factorResponse.identity)")
XCTAssertEqual(factorResponse.createdAt, Constants.expectedFactor.createdAt,
"Factor createdAt should be \(Constants.expectedFactor.createdAt) but was \(factorResponse.createdAt)")
}
func testVerifyFactor_withErrorResponse_shouldFail() {
let failureExpectation = expectation(description: "Wait for failure response")
let factorPayload = VerifyPushFactorPayload(sid: "sid")
let expectedError = TwilioVerifyError.inputError(error: TestError.operationFailed as NSError)
factorFacade.error = expectedError
var error: TwilioVerifyError!
twilioVerify.verifyFactor(withPayload: factorPayload, success: { _ in
XCTFail()
failureExpectation.fulfill()
}) { failure in
error = failure
failureExpectation.fulfill()
}
wait(for: [failureExpectation], timeout: 5)
XCTAssertEqual(error.localizedDescription, expectedError.localizedDescription, "Error should be \(expectedError.localizedDescription) but was \(error.localizedDescription)")
}
func testUpdateFactor_withSuccessResponse_shouldSucceed() {
let expectation = self.expectation(description: "testUpdateFactor_withSuccessResponse_shouldSucceed")
factorFacade.factor = Constants.expectedFactor
var factor: Factor!
twilioVerify.updateFactor(withPayload: Constants.updatePushFactorPayload, success: { response in
factor = response
expectation.fulfill()
}) { _ in
XCTFail()
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(factor.sid, Constants.expectedFactor.sid,
"Factor sid should be \(Constants.expectedFactor.sid) but was \(factor.sid)")
XCTAssertEqual(factor.friendlyName, Constants.expectedFactor.friendlyName,
"Factor friendlyName should be \(Constants.expectedFactor.friendlyName) but was \(factor.friendlyName)")
XCTAssertEqual(factor.accountSid, Constants.expectedFactor.accountSid,
"Factor accountSid should be \(Constants.expectedFactor.accountSid) but was \(factor.accountSid)")
XCTAssertEqual(factor.serviceSid, Constants.expectedFactor.serviceSid,
"Factor serviceSid should be \(Constants.expectedFactor.serviceSid) but was \(factor.serviceSid)")
XCTAssertEqual(factor.identity, Constants.expectedFactor.identity,
"Factor identity should be \(Constants.expectedFactor.identity) but was \(factor.identity)")
XCTAssertEqual(factor.createdAt, Constants.expectedFactor.createdAt,
"Factor createdAt should be \(Constants.expectedFactor.createdAt) but was \(factor.createdAt)")
}
func testUpdateFactor_withErrorResponse_shouldFail() {
let expectation = self.expectation(description: "testUpdateFactor_withErrorResponse_shouldFail")
let expectedError = TwilioVerifyError.inputError(error: TestError.operationFailed as NSError)
factorFacade.error = expectedError
var error: TwilioVerifyError!
twilioVerify.updateFactor(withPayload: Constants.updatePushFactorPayload, success: { _ in
XCTFail()
expectation.fulfill()
}) { failure in
error = failure
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(error.localizedDescription, expectedError.localizedDescription, "Error should be \(expectedError.localizedDescription) but was \(error.localizedDescription)")
}
func testDeleteFactor_withSuccessResponse_shouldSucceed() {
let expectation = self.expectation(description: "testDeleteFactor_withSuccessResponse_shouldSucceed")
twilioVerify.deleteFactor(withSid: Constants.factorSid, success: {
expectation.fulfill()
}) { _ in
XCTFail()
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
}
func testDeleteFactor_withErrorResponse_shouldFail() {
let expectation = self.expectation(description: "testDeleteFactor_withErrorResponse_shouldFail")
let expectedError = TwilioVerifyError.inputError(error: TestError.operationFailed as NSError)
factorFacade.error = expectedError
var error: TwilioVerifyError!
twilioVerify.deleteFactor(withSid: Constants.factorSid, success: {
XCTFail()
expectation.fulfill()
}) { failure in
error = failure
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(error.code, expectedError.code, "Error code should be \(expectedError.code) but was \(error.code)")
XCTAssertEqual(error.localizedDescription, expectedError.localizedDescription,
"Error description should be \(expectedError.localizedDescription) but was \(error.localizedDescription)")
XCTAssertEqual(error.originalError, expectedError.originalError,
"Original error should be \(expectedError.originalError) but was \(error.originalError)")
}
func testGetChallenge_withSuccessResponse_shouldSucceed() {
let expectation = self.expectation(description: "testGetChallenge_withSuccessResponse_shouldSucceed")
challengeFacade.challenge = Constants.expectedChallenge
var challenge: Challenge!
twilioVerify.getChallenge(challengeSid: Constants.challengeSid, factorSid: Constants.expectedFactor.sid, success: { response in
challenge = response
expectation.fulfill()
}) { _ in
XCTFail()
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(challenge.sid, Constants.expectedChallenge.sid,
"Challenge sid should be \(Constants.expectedChallenge.sid) but was \(challenge.sid)")
XCTAssertEqual(challenge.hiddenDetails, Constants.expectedChallenge.hiddenDetails,
"Challenge hiddenDetails should be \(Constants.expectedChallenge.hiddenDetails!) but was \(challenge.hiddenDetails!)")
XCTAssertEqual(challenge.factorSid, Constants.expectedChallenge.factorSid,
"Challenge factorSid should be \(Constants.expectedChallenge.factorSid) but was \(challenge.factorSid)")
XCTAssertEqual(challenge.status, Constants.expectedChallenge.status,
"Challenge status should be \(Constants.expectedChallenge.status) but was \(challenge.status)")
XCTAssertEqual(challenge.createdAt, Constants.expectedChallenge.createdAt,
"Challenge createdAt should be \(Constants.expectedChallenge.createdAt) but was \(challenge.createdAt)")
XCTAssertEqual(challenge.updatedAt, Constants.expectedChallenge.updatedAt,
"Challenge updatedAt should be \(Constants.expectedChallenge.updatedAt) but was \(challenge.updatedAt)")
XCTAssertEqual(challenge.expirationDate, Constants.expectedChallenge.expirationDate,
"Challenge expirationDate should be \(Constants.expectedChallenge.expirationDate) but was \(challenge.expirationDate)")
XCTAssertEqual(challenge.challengeDetails.message, Constants.expectedChallenge.challengeDetails.message,
"Challenge challengeDetails should be \(Constants.expectedChallenge.challengeDetails) but was \(challenge.challengeDetails)")
}
func testGetChallenge_withErrorResponse_shouldFail() {
let expectation = self.expectation(description: "testGetChallenge_withErrorResponse_shouldFail")
let expectedError = TwilioVerifyError.inputError(error: TestError.operationFailed as NSError)
challengeFacade.error = expectedError
var error: TwilioVerifyError!
twilioVerify.getChallenge(challengeSid: Constants.challengeSid, factorSid: Constants.expectedFactor.sid, success: { _ in
XCTFail()
expectation.fulfill()
}) { failure in
error = failure
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(error.code, expectedError.code, "Error code should be \(expectedError.code) but was \(error.code)")
XCTAssertEqual(error.localizedDescription, expectedError.localizedDescription,
"Error description should be \(expectedError.localizedDescription) but was \(error.localizedDescription)")
XCTAssertEqual(error.originalError, expectedError.originalError,
"Original error should be \(expectedError.originalError) but was \(error.originalError)")
}
func testUpdateChallenge_withSuccessResponse_shouldSucceed() {
let expectation = self.expectation(description: "testUpdateChallenge_withSuccessResponse_shouldSucceed")
twilioVerify.updateChallenge(withPayload: Constants.updatePushChallengePayload, success: {
expectation.fulfill()
}) { _ in
XCTFail()
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
}
func testUpdateChallenge_withErrorResponse_shouldFail() {
let expectation = self.expectation(description: "testUpdateChallenge_withErrorResponse_shouldFail")
let expectedError = TwilioVerifyError.inputError(error: TestError.operationFailed as NSError)
challengeFacade.error = expectedError
var error: TwilioVerifyError!
twilioVerify.updateChallenge(withPayload: Constants.updatePushChallengePayload, success: {
expectation.fulfill()
XCTFail()
}) { failure in
error = failure
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(error.code, expectedError.code, "Error code should be \(expectedError.code) but was \(error.code)")
XCTAssertEqual(error.localizedDescription, expectedError.localizedDescription,
"Error description should be \(expectedError.localizedDescription) but was \(error.localizedDescription)")
XCTAssertEqual(error.originalError, expectedError.originalError,
"Original error should be \(expectedError.originalError) but was \(error.originalError)")
}
func testGetAllFactors_withSuccessResponse_shouldSucceed() {
let expectation = self.expectation(description: "testGetAllFactors_withSuccessResponse_shouldSucceed")
factorFacade.factor = Constants.expectedFactor
var factors: [Factor]!
twilioVerify.getAllFactors(success: { response in
factors = response
expectation.fulfill()
}) { _ in
XCTFail()
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(factors.first?.sid, Constants.expectedFactor.sid, "Factor should be \(Constants.expectedFactor) but was \(factors.first!)")
}
func testGetAllFactors_withFAILUREResponse_shouldFail() {
let expectation = self.expectation(description: "testGetAllFactors_withFAILUREResponse_shouldFail")
factorFacade.factor = Constants.expectedFactor
let expectedError = TwilioVerifyError.inputError(error: TestError.operationFailed as NSError)
factorFacade.error = expectedError
var error: TwilioVerifyError!
twilioVerify.getAllFactors(success: { _ in
XCTFail()
expectation.fulfill()
}) { failure in
error = failure
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(error.code, expectedError.code, "Error code should be \(expectedError.code) but was \(error.code)")
XCTAssertEqual(error.localizedDescription, expectedError.localizedDescription,
"Error description should be \(expectedError.localizedDescription) but was \(error.localizedDescription)")
XCTAssertEqual(error.originalError, expectedError.originalError,
"Original error should be \(expectedError.originalError) but was \(error.originalError)")
}
func testGetAllChallenges_withValidData_shouldSucceed() {
let expectation = self.expectation(description: "testGetAllChallenges_withValidData_shouldSucceed")
challengeFacade.challengeList = Constants.expectedChallengeList
var challengeList: ChallengeList!
twilioVerify.getAllChallenges(withPayload: Constants.challengeListPayload, success: { result in
challengeList = result
expectation.fulfill()
}) { _ in
XCTFail()
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(challengeList.challenges.count, Constants.expectedChallengeList.challenges.count,
"Challenge list should be \(Constants.expectedChallengeList.challenges) but were \(challengeList.challenges)")
}
func testGetAllChallenges_withFailureResponse_shouldFail() {
let expectation = self.expectation(description: "testGetAllChallenges_withFailureResponse_shouldFail")
let expectedError = TwilioVerifyError.networkError(error: TestError.operationFailed as NSError)
challengeFacade.error = expectedError
var error: TwilioVerifyError!
twilioVerify.getAllChallenges(withPayload: Constants.challengeListPayload, success: { _ in
XCTFail()
expectation.fulfill()
}) { failure in
error = failure
expectation.fulfill()
}
waitForExpectations(timeout: 3, handler: nil)
XCTAssertEqual(error.code, expectedError.code, "Error code should be \(expectedError.code) but was \(error.code)")
XCTAssertEqual(error.localizedDescription, expectedError.localizedDescription,
"Error description should be \(expectedError.localizedDescription) but was \(error.localizedDescription)")
}
func testClearLocalStorage_withError_shouldThrow() {
let expectedError = TwilioVerifyError.storageError(error: TestError.operationFailed as NSError)
factorFacade.error = expectedError
XCTAssertThrowsError(try twilioVerify.clearLocalStorage(), "Clear local storage should throw") { error in
let error = error as! TwilioVerifyError
XCTAssertEqual(error.localizedDescription, expectedError.localizedDescription,
"Error description should be \(expectedError.localizedDescription) but was \(error.localizedDescription)")
XCTAssertEqual(error.originalError, expectedError.originalError,
"Original error should be \(expectedError.originalError) but was \(error.originalError)")
}
}
func testClearLocalStorage_withoutError_shouldNotThrow() {
XCTAssertNoThrow(try twilioVerify.clearLocalStorage(), "Clear local storage should not throw")
}
}
private extension TwilioVerifyManagerTests {
struct Constants {
static let factorSid = "factorSid123"
static let friendlyName = "friendlyName123"
static let serviceSid = "serviceSid123"
static let identity = "identityValue"
static let pushToken = "ACBtoken"
static let accessToken = "accessToken"
static let challengeSid = "challengeSid"
static let challengeSid2 = "challengeSid2"
static let expectedFactor = PushFactor(
sid: factorSid,
friendlyName: "friendlyName",
accountSid: "accountSid",
serviceSid: "serviceSid",
identity: "identity",
createdAt: Date(),
config: Config(credentialSid: "credentialSid"))
static let factorPayload = PushFactorPayload(
friendlyName: Constants.friendlyName,
serviceSid: Constants.serviceSid,
identity: Constants.identity,
pushToken: Constants.pushToken,
accessToken: Constants.accessToken)
static let updatePushFactorPayload = UpdatePushFactorPayload(
sid: Constants.factorSid,
pushToken: Constants.pushToken)
static let expectedChallenge = FactorChallenge(
sid: challengeSid,
challengeDetails: ChallengeDetails(message: "message", fields: [], date: Date()),
hiddenDetails: ["key1": "value1"],
factorSid: factorSid,
status: .pending,
createdAt: Date(),
updatedAt: Date(),
expirationDate: Date(),
factor: expectedFactor)
static let expectedChallenge2 = FactorChallenge(
sid: challengeSid2,
challengeDetails: ChallengeDetails(message: "message", fields: [], date: Date()),
hiddenDetails: ["key2": "value2"],
factorSid: factorSid,
status: .approved,
createdAt: Date(),
updatedAt: Date(),
expirationDate: Date(),
factor: expectedFactor)
static let updatePushChallengePayload = UpdatePushChallengePayload(
factorSid: factorSid,
challengeSid: challengeSid,
status: .approved)
static let challengeListPayload = ChallengeListPayload(
factorSid: factorSid,
pageSize: 1)
static let expectedChallengeList = FactorChallengeList(
challenges: [expectedChallenge, expectedChallenge2],
metadata: ChallengeListMetadata(page: 1, pageSize: 1, previousPageToken: nil, nextPageToken: nil))
}
}
| 51.389151 | 177 | 0.742393 |
33269c8198e5473d3ddda4bf83fff9637afee268 | 1,793 | py | Python | src/graph2.py | gpu0/nnGraph | ae68af41804ce95dd4dbd6deeea57e377915acc9 | [
"MIT"
] | null | null | null | src/graph2.py | gpu0/nnGraph | ae68af41804ce95dd4dbd6deeea57e377915acc9 | [
"MIT"
] | null | null | null | src/graph2.py | gpu0/nnGraph | ae68af41804ce95dd4dbd6deeea57e377915acc9 | [
"MIT"
] | null | null | null | # t = 2 * (x*y + max(z,w))
class Num:
def __init__(self, val):
self.val = val
def forward(self):
return self.val
def backward(self, val):
print val
class Mul:
def __init__(self, left, right):
self.left = left
self.right = right
def forward(self):
self.left_fw = self.left.forward()
self.right_fw = self.right.forward()
return self.left_fw * self.right_fw
def backward(self, val):
self.left.backward(val * self.right_fw)
self.right.backward(val * self.left_fw)
class Factor:
def __init__(self, center, factor):
self.center = center
self.factor = factor
def forward(self):
return self.factor * self.center.forward()
def backward(self, val):
self.center.backward(val * self.factor)
class Add:
def __init__(self, left, right):
self.left = left
self.right = right
def forward(self):
return self.left.forward() + self.right.forward()
def backward(self, val):
self.left.backward(val)
self.right.backward(val)
class Max:
def __init__(self, left, right):
self.left = left
self.right = right
def forward(self):
self.left_fw = self.left.forward()
self.right_fw = self.right.forward()
self.out = 0
if self.left_fw > self.right_fw:
self.out = 1
return self.left_fw
return self.right_fw
def backward(self, val):
self.left.backward(val * self.out)
self.right.backward(val * (1 - self.out))
if __name__ == '__main__':
x = Num(3)
y = Num(-4)
z = Num(2)
w = Num(-1)
p = Mul(x, y)
q = Max(z, w)
r = Add(p, q)
t = Factor(r, 2)
print t.forward()
t.backward(1)
| 25.985507 | 57 | 0.572783 |
162953fcde74255d5209548af104d6a0019a1f06 | 437 | h | C | LeanChat/Pods/Headers/Public/LeanChatLib/AVIMEmotionMessage.h | ArtisanSay/ArtisaSay | 7e24ebfd691f3ac5c3d4b4826a114cc2dc6d93f8 | [
"MIT"
] | null | null | null | LeanChat/Pods/Headers/Public/LeanChatLib/AVIMEmotionMessage.h | ArtisanSay/ArtisaSay | 7e24ebfd691f3ac5c3d4b4826a114cc2dc6d93f8 | [
"MIT"
] | null | null | null | LeanChat/Pods/Headers/Public/LeanChatLib/AVIMEmotionMessage.h | ArtisanSay/ArtisaSay | 7e24ebfd691f3ac5c3d4b4826a114cc2dc6d93f8 | [
"MIT"
] | null | null | null | //
// AVIMEmotionMessage.h
// LeanChatLib
//
// Created by lzw on 15/8/12.
// Copyright (c) 2015年 lzwjava@LeanCloud QQ: 651142978. All rights reserved.
//
#import "AVIMTypedMessage.h"
static AVIMMessageMediaType const kAVIMMessageMediaTypeEmotion = 1;
@interface AVIMEmotionMessage : AVIMTypedMessage<AVIMTypedMessageSubclassing>
+ (instancetype)messageWithEmotionPath:(NSString *)emotionPath;
- (NSString *)emotionPath;
@end
| 20.809524 | 77 | 0.768879 |
80c00a13a13a3df83a641f1b548297a7209298b4 | 1,140 | sql | SQL | Java/ProjetoProduto/script.sql | viniciusarre/Hello-world | 4fe86ec7f5b453d44b77760c3ecc5e25e22b9997 | [
"MIT"
] | null | null | null | Java/ProjetoProduto/script.sql | viniciusarre/Hello-world | 4fe86ec7f5b453d44b77760c3ecc5e25e22b9997 | [
"MIT"
] | null | null | null | Java/ProjetoProduto/script.sql | viniciusarre/Hello-world | 4fe86ec7f5b453d44b77760c3ecc5e25e22b9997 | [
"MIT"
] | null | null | null | CREATE TABLE categoria(
idcategoria SERIAL,
desccategoria VARCHAR(200),
CONSTRAINT pkcategoria PRIMARY KEY (idcategoria)
);
CREATE TABLE produto(
idprod SERIAL,
descprod VARCHAR(200),
valor NUMERIC(9,2),
marca VARCHAR(200),
idcategoria INTEGER NOT NULL,
CONSTRAINT pkprod PRIMARY KEY (idprod),
CONSTRAINT fkcategoria FOREIGN KEY (idcategoria) REFERENCES categoria
);
INSERT INTO categoria VALUES (DEFAULT, 'CATEGORIA 1');
INSERT INTO categoria VALUES (DEFAULT, 'CATEGORIA 2');
INSERT INTO categoria VALUES (DEFAULT, 'CATEGORIA 3');
INSERT INTO categoria VALUES (DEFAULT, 'CATEGORIA 4');
INSERT INTO categoria VALUES (DEFAULT, 'CATEGORIA 5');
INSERT INTO produto VALUES (DEFAULT, 'PRODUTO 1', 100.00, 'MARCA', 5);
INSERT INTO produto VALUES (DEFAULT, 'PRODUTO 2', 500.00, 'MARCA', 4);
INSERT INTO produto VALUES (DEFAULT, 'PRODUTO 3', 200.00, 'MARCA', 3);
INSERT INTO produto VALUES (DEFAULT, 'PRODUTO 4', 300.00, 'MARCA', 2);
INSERT INTO produto VALUES (DEFAULT, 'PRODUTO 5', 1000.00,'MARCA', 1);
SELECT * FROM produto JOIN categoria USING (idcategoria) ORDER BY idprod;
SELECT * FROM categoria order by idcategoria;
| 31.666667 | 73 | 0.744737 |
263d0e0e72b81762f575a5e347077e8b6103456d | 3,764 | java | Java | src/java/util/WeakList.java | kamelher/java-gpu | 0d3186217dae0308f50384d461d6ae218c64abfa | [
"Apache-2.0"
] | null | null | null | src/java/util/WeakList.java | kamelher/java-gpu | 0d3186217dae0308f50384d461d6ae218c64abfa | [
"Apache-2.0"
] | null | null | null | src/java/util/WeakList.java | kamelher/java-gpu | 0d3186217dae0308f50384d461d6ae218c64abfa | [
"Apache-2.0"
] | null | null | null | /*
* Parallelising JVM Compiler
*
* Copyright 2010 Peter Calvert, University of Cambridge
*
* 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 util;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;
/**
* Implements a list in which all elements are only weakly referenced. As
* elements are garbage collected, they are automatically removed from the list.
* This automatic removal occurs only before read operations (i.e.
* <code>get</code> and <code>size</code>).
*/
public class WeakList<T> extends AbstractList<T> {
/**
* Internal list for actual store.
*/
private final List<EquatableWeakReference<T>> internalList;
/**
* Reference queue for detecting dead objects.
*/
private final ReferenceQueue<T> queue = new ReferenceQueue<T>();
/**
* Constructs a weak reference list.
*/
public WeakList() {
internalList = new ArrayList<EquatableWeakReference<T>>();
}
/**
* Removes any items that have been garbage collected from the underlying
* list.
*/
private void removeDead() {
Reference<? extends T> r;
while((r = queue.poll()) != null) {
internalList.remove(r);
}
}
/**
* Adds an element to the list at the specified position. Shifts the element
* currently at that position (if any) and any subsequent elements to the
* right (adds one to their indices).
*
* @param index Index at which to add the element
* @param item Item to add.
*/
@Override
public void add(int index, T item) {
internalList.add(index, new EquatableWeakReference<T>(item, queue));
}
/**
* Replaces the element at the specified position in this list with the
* specified element.
*
* @param index Index of the element to replace.
* @param item Element to be stored at the specified position.
* @return The element previously at the specified position.
*/
@Override
public T set(int index, T item) {
EquatableWeakReference<T> old = internalList.set(
index,
new EquatableWeakReference<T>(item, queue)
);
if(old != null) {
return old.get();
} else {
return null;
}
}
/**
* Returns the element at the specified position in this list.
*
* @param index Index of element to be returned.
* @return Item at the given index.
*/
@Override
public T get(int index) {
removeDead();
return internalList.get(index).get();
}
/**
* Removes the element at the specified position in this list. Shifts any
* subsequent elements to the left (subtracts one from their indices). Returns
* the element that was removed from the list.
*
* @param index Index of element to be removed.
* @return Item that was removed.
*/
@Override
public T remove(int index) {
EquatableWeakReference<T> item = internalList.remove(index);
if(item != null) {
return item.get();
} else {
return null;
}
}
/**
* Returns the size of the list.
*
* @return Number of elements in the list.
*/
@Override
public int size() {
removeDead();
return internalList.size();
}
}
| 26.321678 | 80 | 0.666047 |
b3b2d2fcf8455d32ab3f703211bdedcd4ba1b53f | 2,627 | swift | Swift | Sources/IBLinterFrontend/Commands/ValidateCommand.swift | Adobels/IBLinter | aa34f5b758d2f95fae17b77e10668697cd3f5e19 | [
"MIT"
] | null | null | null | Sources/IBLinterFrontend/Commands/ValidateCommand.swift | Adobels/IBLinter | aa34f5b758d2f95fae17b77e10668697cd3f5e19 | [
"MIT"
] | null | null | null | Sources/IBLinterFrontend/Commands/ValidateCommand.swift | Adobels/IBLinter | aa34f5b758d2f95fae17b77e10668697cd3f5e19 | [
"MIT"
] | null | null | null | //
// ValidateCommand.swift
// IBLinterKit
//
// Created by SaitoYuta on 2017/12/13.
//
import Foundation
import IBDecodable
import IBLinterKit
import ArgumentParser
struct ValidateCommand: ParsableCommand {
static let configuration = CommandConfiguration(commandName: "lint", abstract: "Print lint warnings and errors")
@Option(name: .long, help: "validate project root directory", completion: .directory)
var path: String?
@Option(name: .long, help: "the reporter used to log errors and warnings")
var reporter: String?
@Option(name: .long, help: "the path to IBLint's configuration file", completion: .file())
var configurationFile: String?
@Argument(help: "included files/paths to lint. This is ignored if you specified included paths in your yml configuration file.",
completion: .file())
var included: [String] = []
func run() throws {
let workDirectoryString = path ?? FileManager.default.currentDirectoryPath
let workDirectory = URL(fileURLWithPath: workDirectoryString)
guard FileManager.default.isDirectory(workDirectory.path) else {
fatalError("\(workDirectoryString) is not directory.")
}
var config = (try? Config(url: deriveConfigurationFile())) ?? Config.default
if config.disableWhileBuildingForIB &&
ProcessInfo.processInfo.compiledForInterfaceBuilder {
return
}
if config.included.isEmpty {
config.included = included
}
let validator = Validator()
let violations = validator.validate(workDirectory: workDirectory, config: config)
let reporter = Reporters.reporter(from: self.reporter ?? config.reporter)
let report = reporter.generateReport(violations: violations)
print(report)
let numberOfSeriousViolations = violations.filter { $0.level == .error }.count
if numberOfSeriousViolations > 0 {
throw ExitCode.failure
}
}
func deriveConfigurationFile() -> URL {
if let configurationFile = configurationFile {
let configurationURL = URL(fileURLWithPath: configurationFile)
return configurationURL
} else {
let workDirectoryString = path ?? FileManager.default.currentDirectoryPath
let workDirectory = URL(fileURLWithPath: workDirectoryString)
return workDirectory.appendingPathComponent(Config.fileName)
}
}
}
extension ProcessInfo {
var compiledForInterfaceBuilder: Bool {
return environment["COMPILED_FOR_INTERFACE_BUILDER"] != nil
}
}
| 37 | 132 | 0.681386 |
01a1065069642d8b495a4f17db8d05227203a54c | 2,659 | rs | Rust | fix50sp2/src/related_order_grp.rs | nappa85/serde_fix | 1f11fc5484e6f7fd516c430a61241fb7070e7d4c | [
"Apache-2.0",
"MIT"
] | null | null | null | fix50sp2/src/related_order_grp.rs | nappa85/serde_fix | 1f11fc5484e6f7fd516c430a61241fb7070e7d4c | [
"Apache-2.0",
"MIT"
] | null | null | null | fix50sp2/src/related_order_grp.rs | nappa85/serde_fix | 1f11fc5484e6f7fd516c430a61241fb7070e7d4c | [
"Apache-2.0",
"MIT"
] | 1 | 2021-05-04T18:10:10.000Z | 2021-05-04T18:10:10.000Z |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct RelatedOrderGrp {
/// NoOrders
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "73")]
pub orders: Option<fix_common::RepeatingValues<Order>>,
}
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct Order {
/// Required if NoOrders(73) > 0.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "2887")]
pub related_order_id: Option<String>,
/// The same value must be used for all orders having the same OrderRelationship(2890) value.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "2888")]
pub related_order_id_source: Option<RelatedOrderIDSource>,
/// RelatedOrderTime
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "2836")]
pub related_order_time: Option<fix_common::UTCTimestamp>,
/// RelatedOrderQty
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(deserialize_with = "fix_common::workarounds::from_opt_str")]// https://github.com/serde-rs/serde/issues/1183
#[serde(default)]
#[serde(rename = "2889")]
pub related_order_qty: Option<f64>,
/// May be used to explicitly express the type of relationship or to provide orders having different relationships.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "2890")]
pub order_relationship: Option<OrderRelationship>,
/// May be used when aggregating orders that were originally submitted by different firms, e.g. due to a merger or acquisition.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "2835")]
pub order_origination_firm_id: Option<String>,
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq)]
pub enum RelatedOrderIDSource {
/// Non-FIX Source
#[serde(rename = "0")]
NonFixSource,
/// Order identifier
#[serde(rename = "1")]
OrderIdentifier,
/// Client order identifier
#[serde(rename = "2")]
ClientOrderIdentifier,
/// Secondary order identifier
#[serde(rename = "3")]
SecondaryOrderIdentifier,
/// Secondary client order identifier
#[serde(rename = "4")]
SecondaryClientOrderIdentifier,
}
impl Default for RelatedOrderIDSource {
fn default() -> Self {
RelatedOrderIDSource::NonFixSource
}
}
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq)]
pub enum OrderRelationship {
/// Not specified
#[serde(rename = "0")]
NotSpecified,
/// Order aggregation
#[serde(rename = "1")]
OrderAggregation,
/// Order split
#[serde(rename = "2")]
OrderSplit,
}
impl Default for OrderRelationship {
fn default() -> Self {
OrderRelationship::NotSpecified
}
}
| 31.282353 | 128 | 0.725837 |
bd26f09ae928c26110f210f497a73bbfa4511b0b | 496 | sql | SQL | COEN 280 - Database Systems/q8.sql | nicholasmfong/oldHomework | 82f10998a7f05c0db79647818e40924c38484484 | [
"MIT"
] | 1 | 2018-03-05T17:45:05.000Z | 2018-03-05T17:45:05.000Z | COEN 280 - Database Systems/q8.sql | nicholasmfong/oldHomework | 82f10998a7f05c0db79647818e40924c38484484 | [
"MIT"
] | null | null | null | COEN 280 - Database Systems/q8.sql | nicholasmfong/oldHomework | 82f10998a7f05c0db79647818e40924c38484484 | [
"MIT"
] | null | null | null | --Nicholas Fong COEN 280 HW 2: Actors never unemployed for more than 2 years
--Assume that this means that all movies an actor participated in are within 2 years of each other
SELECT p.pid, p.first_name, p.last_name, r.mid, m.release_year
FROM person p, roles r, movie m
WHERE p.pid = r.pid AND m.mid = r.mid;
--I'm not sure how to finish this, but I would group the movies based on the actor, and then calculate the differences between them, then filter out the ones with a difference >= 3 years | 82.666667 | 186 | 0.762097 |
1d47b4879a3bdb6019257e05b602669d3e60ae37 | 755 | swift | Swift | Services/ShareLib/NSCoreframework/Extensions/UITextFieldExtension.swift | rstakaiito/GametacSDK | 732f08994f7933623f0011b72c3020cf0a2b8641 | [
"MIT"
] | null | null | null | Services/ShareLib/NSCoreframework/Extensions/UITextFieldExtension.swift | rstakaiito/GametacSDK | 732f08994f7933623f0011b72c3020cf0a2b8641 | [
"MIT"
] | null | null | null | Services/ShareLib/NSCoreframework/Extensions/UITextFieldExtension.swift | rstakaiito/GametacSDK | 732f08994f7933623f0011b72c3020cf0a2b8641 | [
"MIT"
] | null | null | null | ////
//// UITextFieldExtension.swift
//// iTower
////
//// Created by Nguyen Thanh Tung on 4/17/17.
//// Copyright © 2017 Nguyen Thanh Tung. All rights reserved.
////
//
//import UIKit
//
//class TextFieldExtension: UITextField {
//
//
// @IBInspectable var paddingLeft: CGFloat = 0
// @IBInspectable var paddingRight: CGFloat = 0
//
// override func textRect(forBounds bounds: CGRect) -> CGRect {
// return CGRect(bounds.origin.x + paddingLeft, bounds.origin.y,
// bounds.size.width - paddingLeft - paddingRight, bounds.size.height);
// }
//
// override func editingRect(forBounds bounds: CGRect) -> CGRect {
// return textRect(forBounds: bounds)
// }
//
//
//
//}
//
| 25.166667 | 92 | 0.598675 |
2a20e0f314676511734d83453ef9d7b4547c8ea3 | 4,721 | java | Java | test/framework/src/main/java/org/elasticsearch/test/rest/parser/DoSectionParser.java | mfussenegger/elasticsearch | 5fe1916be942aefc0215f85ed26a56ece91ca8ef | [
"Apache-2.0"
] | 4 | 2015-05-15T20:08:35.000Z | 2021-04-02T02:19:07.000Z | test/framework/src/main/java/org/elasticsearch/test/rest/parser/DoSectionParser.java | mfussenegger/elasticsearch | 5fe1916be942aefc0215f85ed26a56ece91ca8ef | [
"Apache-2.0"
] | 7 | 2021-01-20T08:51:43.000Z | 2021-01-20T08:51:55.000Z | test/framework/src/main/java/org/elasticsearch/test/rest/parser/DoSectionParser.java | mfussenegger/elasticsearch | 5fe1916be942aefc0215f85ed26a56ece91ca8ef | [
"Apache-2.0"
] | 15 | 2017-01-12T10:16:22.000Z | 2019-04-18T21:18:41.000Z | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.test.rest.parser;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.test.rest.section.ApiCallSection;
import org.elasticsearch.test.rest.section.DoSection;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Parser for do sections
*/
public class DoSectionParser implements RestTestFragmentParser<DoSection> {
@Override
public DoSection parse(RestTestSuiteParseContext parseContext) throws IOException, RestTestParseException {
XContentParser parser = parseContext.parser();
String currentFieldName = null;
XContentParser.Token token;
DoSection doSection = new DoSection();
ApiCallSection apiCallSection = null;
Map<String, String> headers = new HashMap<>();
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token.isValue()) {
if ("catch".equals(currentFieldName)) {
doSection.setCatch(parser.text());
}
} else if (token == XContentParser.Token.START_OBJECT) {
if ("headers".equals(currentFieldName)) {
String headerName = null;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
headerName = parser.currentName();
} else if (token.isValue()) {
headers.put(headerName, parser.text());
}
}
} else if (currentFieldName != null) { // must be part of API call then
apiCallSection = new ApiCallSection(currentFieldName);
String paramName = null;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
paramName = parser.currentName();
} else if (token.isValue()) {
if ("body".equals(paramName)) {
String body = parser.text();
XContentType bodyContentType = XContentFactory.xContentType(body);
XContentParser bodyParser = XContentFactory.xContent(bodyContentType).createParser(body);
//multiple bodies are supported e.g. in case of bulk provided as a whole string
while(bodyParser.nextToken() != null) {
apiCallSection.addBody(bodyParser.mapOrdered());
}
} else {
apiCallSection.addParam(paramName, parser.text());
}
} else if (token == XContentParser.Token.START_OBJECT) {
if ("body".equals(paramName)) {
apiCallSection.addBody(parser.mapOrdered());
}
}
}
}
}
}
try {
if (apiCallSection == null) {
throw new RestTestParseException("client call section is mandatory within a do section");
}
if (headers.isEmpty() == false) {
apiCallSection.addHeaders(headers);
}
doSection.setApiCallSection(apiCallSection);
} finally {
parser.nextToken();
}
return doSection;
}
}
| 44.537736 | 121 | 0.571065 |
64ad4274f74fabdfa913a7f434be464350133a8a | 767 | sql | SQL | Ora_SQLPlus_SQLcL_sql_scripts/streams_print_lcr.sql | gpipperr/OraPowerShell | 4209ef928229daf0942975610f1ff7a1bcc95e0f | [
"MS-PL"
] | 4 | 2018-02-19T11:07:37.000Z | 2021-04-22T17:34:47.000Z | Ora_SQLPlus_SQLcL_sql_scripts/streams_print_lcr.sql | gpipperr/OraPowerShell | 4209ef928229daf0942975610f1ff7a1bcc95e0f | [
"MS-PL"
] | null | null | null | Ora_SQLPlus_SQLcL_sql_scripts/streams_print_lcr.sql | gpipperr/OraPowerShell | 4209ef928229daf0942975610f1ff7a1bcc95e0f | [
"MS-PL"
] | 2 | 2018-06-20T14:57:56.000Z | 2019-06-06T03:38:39.000Z | --==============================================================================
-- GPI - Gunther Pippèrr
-- Desc: get one LCR of a streams replication
--==============================================================================
set verify off
set linesize 130 pagesize 3000
prompt.... Detail Error messages around the actual error
select em.local_transaction_id
, em.object_owner || '.' || em.object_name as object_name
, em.operation
, em.transaction_message_number
, em.message
from dba_apply_error_messages em
, dba_apply_error ar
where em.local_transaction_id=ar.local_transaction_id
and em.transaction_message_number = &LCR_NUM.
order by em.local_transaction_id
, em.transaction_message_number
, em.position
/
| 29.5 | 80 | 0.588005 |
cf7329ad3ea65fbdd56e6a4cc490f2426e098040 | 288 | sql | SQL | 03-23-2022/insert_table.sql | Terria028/SQLICTProg | bced96cf54a4160d4c58869d1e71876b879203c8 | [
"MIT"
] | null | null | null | 03-23-2022/insert_table.sql | Terria028/SQLICTProg | bced96cf54a4160d4c58869d1e71876b879203c8 | [
"MIT"
] | null | null | null | 03-23-2022/insert_table.sql | Terria028/SQLICTProg | bced96cf54a4160d4c58869d1e71876b879203c8 | [
"MIT"
] | null | null | null | INSERT INTO EMPLOYEES (employee_id, employee_name, salary, hire_date)
VALUES(10, 'Kenji', 40, TO_DATE('07/28/2020', 'MM/DD/YYYY'));
INSERT INTO EMPLOYEES (employee_id, employee_name, salary, hire_date, department_id)
VALUES(10, 'Luna', 40, TO_DATE('07/28/2020', 'MM/DD/YYYY'), 10); | 57.6 | 86 | 0.715278 |
de6c809d8e1fc8414f86dce8810f80e78b1246c7 | 24,894 | swift | Swift | Tests/MusicXMLTests/XCTestManifests.swift | himanshusingh/MusicXML | 91412126ad1b5ef7cb79ad88ec39667b28e75f9f | [
"MIT"
] | 59 | 2016-12-09T04:33:23.000Z | 2022-03-20T15:26:12.000Z | Tests/MusicXMLTests/XCTestManifests.swift | himanshusingh/MusicXML | 91412126ad1b5ef7cb79ad88ec39667b28e75f9f | [
"MIT"
] | 185 | 2016-12-09T04:28:15.000Z | 2021-02-04T20:55:50.000Z | Tests/MusicXMLTests/XCTestManifests.swift | himanshusingh/MusicXML | 91412126ad1b5ef7cb79ad88ec39667b28e75f9f | [
"MIT"
] | 15 | 2019-01-19T02:14:48.000Z | 2021-11-21T19:39:00.000Z | #if !canImport(ObjectiveC)
import XCTest
extension AccidentalTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__AccidentalTests = [
("testDecodingPlacement", testDecodingPlacement),
("testDecodingSimple", testDecodingSimple),
("testSimple", testSimple),
]
}
extension AccordionRegistrationTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__AccordionRegistrationTests = [
("testDecoding", testDecoding),
("testRoundTrip", testRoundTrip),
]
}
extension ArrowTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ArrowTests = [
("testAPI", testAPI),
]
}
extension ArticulationsTextsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ArticulationsTextsTests = [
("testColorHex", testColorHex),
]
}
extension AttributesTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__AttributesTests = [
("testDecoding", testDecoding),
]
}
extension BackupTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__BackupTests = [
("testBackup", testBackup),
]
}
extension BarlineTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__BarlineTests = [
("testDecodingSimple", testDecodingSimple),
]
}
extension ChordsFretsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ChordsFretsTests = [
("testFrame", testFrame),
("testString", testString),
("testStringRoundTrip", testStringRoundTrip),
]
}
extension ClefTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ClefTests = [
("testNoSign", testNoSign),
("testOctaveChange", testOctaveChange),
("testPercussion", testPercussion),
("testSimple", testSimple),
("testTAB", testTAB),
]
}
extension CreatorTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__CreatorTests = [
("testCreatorRoundTrip", testCreatorRoundTrip),
]
}
extension DirectionTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__DirectionTests = [
("testDecodingDirection_bracket", testDecodingDirection_bracket),
("testDecodingDirection_metronome", testDecodingDirection_metronome),
("testDecodingDirection_octaveShift", testDecodingDirection_octaveShift),
("testDecodingDirection_wedge", testDecodingDirection_wedge),
]
}
extension DirectionsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__DirectionsTests = [
("testCoda", testCoda),
("testCodaMultiple", testCodaMultiple),
("testDashesDirection", testDashesDirection),
("testDashesStop", testDashesStop),
("testDirectionWedgeAndDynamic", testDirectionWedgeAndDynamic),
("testEyeglasses", testEyeglasses),
("testFormattedText", testFormattedText),
("testHarpPedals", testHarpPedals),
("testHarpPedalsDirectionType", testHarpPedalsDirectionType),
("testLyricNumberText", testLyricNumberText),
("testLyricSyllabic", testLyricSyllabic),
("testNoteWithLyric", testNoteWithLyric),
("testOtherDynamics", testOtherDynamics),
("testPedalChange", testPedalChange),
("testPedalDirection", testPedalDirection),
("testRehearsal", testRehearsal),
("testRehearsalMultiple", testRehearsalMultiple),
("testScordatura", testScordatura),
("testScordaturaDirectionType", testScordaturaDirectionType),
("testSegno", testSegno),
]
}
extension EndingTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__EndingTests = [
("testRoundTrip", testRoundTrip),
]
}
extension FretTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__FretTests = [
("testRoundTrip", testRoundTrip),
]
}
extension HarmonicTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__HarmonicTests = [
("testRoundTrip", testRoundTrip),
]
}
extension HarmonyTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__HarmonyTests = [
("testDecoding_degree", testDecoding_degree),
("testDecoding_degreesAndBass", testDecoding_degreesAndBass),
("testDecoding_inversion", testDecoding_inversion),
("testDecoding_multipleHarmonyChord", testDecoding_multipleHarmonyChord),
("testDecoding_rootOrFunction", testDecoding_rootOrFunction),
]
}
extension HelloWorld {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__HelloWorld = [
("testHelloWorldDecoding", testHelloWorldDecoding),
]
}
extension IdentificationTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__IdentificationTests = [
("testDecoding", testDecoding),
("testDecodingSimple", testDecodingSimple),
]
}
extension KeyTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__KeyTests = [
("testDecodingKeyOctave", testDecodingKeyOctave),
("testDecodingNonTraditional", testDecodingNonTraditional),
("testDecodingNonTraditionalMixed", testDecodingNonTraditionalMixed),
("testDecodingNonTraditionalWithAccidental", testDecodingNonTraditionalWithAccidental),
("testDecodingNonTraditionalWithAccidentalSomeMissing", testDecodingNonTraditionalWithAccidentalSomeMissing),
("testDecodingTraditional", testDecodingTraditional),
("testRoundTripKeyOctave", testRoundTripKeyOctave),
("testRoundTripNonTraditional", testRoundTripNonTraditional),
("testRoundTripNonTraditionalMixed", testRoundTripNonTraditionalMixed),
("testRoundTripNonTraditionalWithAccidental", testRoundTripNonTraditionalWithAccidental),
("testRoundTripNonTraditionalWithAccidentalSomeMissing", testRoundTripNonTraditionalWithAccidentalSomeMissing),
("testRoundTripTraditional", testRoundTripTraditional),
]
}
extension LilyPondTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__LilyPondTests = [
("testAll", testAll),
]
}
extension LyricFontTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__LyricFontTests = [
("testRoundTrip", testRoundTrip),
]
}
extension MIDIDeviceTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__MIDIDeviceTests = [
("testDecoding", testDecoding),
("testEncoding", testEncoding),
]
}
extension MIDIInstrumentTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__MIDIInstrumentTests = [
("testDecoding", testDecoding),
("testEncoding", testEncoding),
]
}
extension MeasureNumberingTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__MeasureNumberingTests = [
("testRoundTrip", testRoundTrip),
]
}
extension MeasureStyleTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__MeasureStyleTests = [
("testMultipleRest", testMultipleRest),
]
}
extension MetronomeTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__MetronomeTests = [
("testDecodingMetronome_beatUnit", testDecodingMetronome_beatUnit),
("testDecodingMetronome_noBeatUnitInFirst", testDecodingMetronome_noBeatUnitInFirst),
("testDecodingMetronome_perMinute_withDot", testDecodingMetronome_perMinute_withDot),
("testDecodingMetronome_perMinute", testDecodingMetronome_perMinute),
]
}
extension MidmeasureClefTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__MidmeasureClefTests = [
("testImplicitMeasureStringNumber", testImplicitMeasureStringNumber),
]
}
extension MiscellaneousTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__MiscellaneousTests = [
("testDecoding", testDecoding),
("testMiscellaneousRoundTrip", testMiscellaneousRoundTrip),
]
}
extension MusicDataTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__MusicDataTests = [
("testDecodingAttributes", testDecodingAttributes),
("testDecodingDivisions", testDecodingDivisions),
]
}
extension NotationsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__NotationsTests = [
("testAccidentalMark", testAccidentalMark),
("testAccidentalMarkNotation", testAccidentalMarkNotation),
("testArpeggiate", testArpeggiate),
("testArticulations", testArticulations),
("testBreathMarkArticulations", testBreathMarkArticulations),
("testDownBowTechnical", testDownBowTechnical),
("testFermata", testFermata),
("testFermataNoValue", testFermataNoValue),
("testFingeringEmpty", testFingeringEmpty),
("testFingeringEmptyRoundTrip", testFingeringEmptyRoundTrip),
("testFingeringValue", testFingeringValue),
("testFingeringValueRoundTrip", testFingeringValueRoundTrip),
("testFretTechnical", testFretTechnical),
("testMultipleArticulations", testMultipleArticulations),
("testNonArpeggiate", testNonArpeggiate),
("testOrnamentsNotation", testOrnamentsNotation),
("testPluckTechnical", testPluckTechnical),
("testSlideNoValue", testSlideNoValue),
("testSpiccatoArticulations", testSpiccatoArticulations),
("testStaccatoArticulations", testStaccatoArticulations),
("testStaccatoNotations", testStaccatoNotations),
("testStoppedTechnical", testStoppedTechnical),
("testStressArticulations", testStressArticulations),
("testStringTechnical", testStringTechnical),
("testStrongAccentArticulations", testStrongAccentArticulations),
("testTechnical", testTechnical),
("testTied", testTied),
("testTuplet", testTuplet),
("testTurn", testTurn),
("testUpBowTechnical", testUpBowTechnical),
]
}
extension NoteTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__NoteTests = [
("testBeam", testBeam),
("testBeamRoundtrip", testBeamRoundtrip),
("testChord", testChord),
("testChordRoundTrip", testChordRoundTrip),
("testNoteAccidentalDecoding", testNoteAccidentalDecoding),
("testNoteAccidentalRoundTrip", testNoteAccidentalRoundTrip),
("testNoteDecoding", testNoteDecoding),
("testNoteDottedRestDecoding", testNoteDottedRestDecoding),
("testNoteDottedRestRoundTrip", testNoteDottedRestRoundTrip),
("testNoteheads", testNoteheads),
("testNoteheadsRoundTrip", testNoteheadsRoundTrip),
("testNoteRoundTrip", testNoteRoundTrip),
("testTies", testTies),
("testTiesRoundTrip", testTiesRoundTrip),
("testTuplet", testTuplet),
("testTupletRoundTrip", testTupletRoundTrip),
("testUnpitched", testUnpitched),
("testUnpitchedRoundTrip", testUnpitchedRoundTrip),
]
}
extension OrnamentsTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__OrnamentsTests = [
("testDecoding_2", testDecoding_2),
("testDecoding", testDecoding),
]
}
extension PartListTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PartListTests = [
("testScorePartAndPartGroupDecoding", testScorePartAndPartGroupDecoding),
("testScorePartDecoding", testScorePartDecoding),
]
}
extension PartNameLineBreakTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PartNameLineBreakTests = [
("testMeasurePrintNewSystem", testMeasurePrintNewSystem),
]
}
extension PartNameTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PartNameTests = [
("testDecoding", testDecoding),
("testDecodingPartName", testDecodingPartName),
]
}
extension PartwiseMeasureTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PartwiseMeasureTests = [
("testDecodingAttributes", testDecodingAttributes),
("testDecodingBarline", testDecodingBarline),
("testDecodingEmpty", testDecodingEmpty),
("testDecodingNotes", testDecodingNotes),
]
}
extension PartwisePartTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PartwisePartTests = [
("testDecoding", testDecoding),
("testDecodingSingleMeasure", testDecodingSingleMeasure),
]
}
extension PercussionTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PercussionTests = [
("testOrnamentsEmpty", testOrnamentsEmpty),
]
}
extension PickupMeasureChordnamesFiguredBassTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PickupMeasureChordnamesFiguredBassTests = [
("testFiguredBass", testFiguredBass),
("testFiguredBassDecoding", testFiguredBassDecoding),
("testHarmony", testHarmony),
("testRoot", testRoot),
]
}
extension PitchTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PitchTests = [
("testHighFQuarterSharpRoundTrip", testHighFQuarterSharpRoundTrip),
("testMiddleCRoundTrip", testMiddleCRoundTrip),
]
}
extension PitchUnpitchedRestTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PitchUnpitchedRestTests = [
("testPitch", testPitch),
("testRest", testRest),
("testUnpitched", testUnpitched),
]
}
extension RepeatWithAlternativesTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__RepeatWithAlternativesTests = [
("testBarlineDiscontinue", testBarlineDiscontinue),
]
}
extension RestTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__RestTests = [
("testEmpty", testEmpty),
]
}
extension ReveTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ReveTests = [
("testAppearance", testAppearance),
("testDefaults", testDefaults),
("testEncoding", testEncoding),
("testIdentification", testIdentification),
("testLyricFonts", testLyricFonts),
("testMusicFont", testMusicFont),
("testPageLayout", testPageLayout),
("testPartListDecoding", testPartListDecoding),
("testPrint", testPrint),
("testRights", testRights),
("testScaling", testScaling),
("testStaffLayout", testStaffLayout),
("testSupportsAttributeElementTypeValue", testSupportsAttributeElementTypeValue),
("testSupportsElementType", testSupportsElementType),
("testSystemLayout2", testSystemLayout2),
("testSystemLayout", testSystemLayout),
("testWordFont", testWordFont),
]
}
extension ScoreInstrumentTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ScoreInstrumentTests = [
("testDecoding", testDecoding),
]
}
extension ScorePartTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ScorePartTests = [
("testComplex", testComplex),
("testDecoding_complex", testDecoding_complex),
("testDecoding", testDecoding),
("testRoundTrip", testRoundTrip),
]
}
extension ScoreTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ScoreTests = [
("testAll", testAll),
]
}
extension SimpleRepeatTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__SimpleRepeatTests = [
("testBarlineRepeatBackward", testBarlineRepeatBackward),
]
}
extension StabatMaterTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__StabatMaterTests = [
("testDynamics", testDynamics),
("testDynamicsDirection", testDynamicsDirection),
("testDynamicsDirectionType", testDynamicsDirectionType),
("testDynamicsMultipleInDirectionType", testDynamicsMultipleInDirectionType),
("testWordsDirection", testWordsDirection),
("testWordsDirectionType", testWordsDirectionType),
("testWordsMultipleInDirectionType", testWordsMultipleInDirectionType),
]
}
extension StaffNoteStylesTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__StaffNoteStylesTests = [
("testMeasureStyles", testMeasureStyles),
("testMeasureStylesAttributes", testMeasureStylesAttributes),
("testSlash", testSlash),
]
}
extension SystemLayoutTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__SystemLayoutTests = [
("testDecoding", testDecoding),
]
}
extension TimeTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__TimeTests = [
("testDecodingCommon", testDecodingCommon),
("testDecodingMeasured", testDecodingMeasured),
]
}
extension TraversalConversionTests {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__TraversalConversionTests = [
("testHelloWorldRoundTrip", testHelloWorldRoundTrip),
]
}
extension TupletsTremoloTest {
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__TupletsTremoloTest = [
("testTremolo", testTremolo),
("testTupletsTremolo", testTupletsTremolo),
]
}
public func __allTests() -> [XCTestCaseEntry] {
return [
testCase(AccidentalTests.__allTests__AccidentalTests),
testCase(AccordionRegistrationTests.__allTests__AccordionRegistrationTests),
testCase(ArrowTests.__allTests__ArrowTests),
testCase(ArticulationsTextsTests.__allTests__ArticulationsTextsTests),
testCase(AttributesTests.__allTests__AttributesTests),
testCase(BackupTests.__allTests__BackupTests),
testCase(BarlineTests.__allTests__BarlineTests),
testCase(ChordsFretsTests.__allTests__ChordsFretsTests),
testCase(ClefTests.__allTests__ClefTests),
testCase(CreatorTests.__allTests__CreatorTests),
testCase(DirectionTests.__allTests__DirectionTests),
testCase(DirectionsTests.__allTests__DirectionsTests),
testCase(EndingTests.__allTests__EndingTests),
testCase(FretTests.__allTests__FretTests),
testCase(HarmonicTests.__allTests__HarmonicTests),
testCase(HarmonyTests.__allTests__HarmonyTests),
testCase(HelloWorld.__allTests__HelloWorld),
testCase(IdentificationTests.__allTests__IdentificationTests),
testCase(KeyTests.__allTests__KeyTests),
testCase(LilyPondTests.__allTests__LilyPondTests),
testCase(LyricFontTests.__allTests__LyricFontTests),
testCase(MIDIDeviceTests.__allTests__MIDIDeviceTests),
testCase(MIDIInstrumentTests.__allTests__MIDIInstrumentTests),
testCase(MeasureNumberingTests.__allTests__MeasureNumberingTests),
testCase(MeasureStyleTests.__allTests__MeasureStyleTests),
testCase(MetronomeTests.__allTests__MetronomeTests),
testCase(MidmeasureClefTests.__allTests__MidmeasureClefTests),
testCase(MiscellaneousTests.__allTests__MiscellaneousTests),
testCase(MusicDataTests.__allTests__MusicDataTests),
testCase(NotationsTests.__allTests__NotationsTests),
testCase(NoteTests.__allTests__NoteTests),
testCase(OrnamentsTests.__allTests__OrnamentsTests),
testCase(PartListTests.__allTests__PartListTests),
testCase(PartNameLineBreakTests.__allTests__PartNameLineBreakTests),
testCase(PartNameTests.__allTests__PartNameTests),
testCase(PartwiseMeasureTests.__allTests__PartwiseMeasureTests),
testCase(PartwisePartTests.__allTests__PartwisePartTests),
testCase(PercussionTests.__allTests__PercussionTests),
testCase(PickupMeasureChordnamesFiguredBassTests.__allTests__PickupMeasureChordnamesFiguredBassTests),
testCase(PitchTests.__allTests__PitchTests),
testCase(PitchUnpitchedRestTests.__allTests__PitchUnpitchedRestTests),
testCase(RepeatWithAlternativesTests.__allTests__RepeatWithAlternativesTests),
testCase(RestTests.__allTests__RestTests),
testCase(ReveTests.__allTests__ReveTests),
testCase(ScoreInstrumentTests.__allTests__ScoreInstrumentTests),
testCase(ScorePartTests.__allTests__ScorePartTests),
testCase(ScoreTests.__allTests__ScoreTests),
testCase(SimpleRepeatTests.__allTests__SimpleRepeatTests),
testCase(StabatMaterTests.__allTests__StabatMaterTests),
testCase(StaffNoteStylesTests.__allTests__StaffNoteStylesTests),
testCase(SystemLayoutTests.__allTests__SystemLayoutTests),
testCase(TimeTests.__allTests__TimeTests),
testCase(TraversalConversionTests.__allTests__TraversalConversionTests),
testCase(TupletsTremoloTest.__allTests__TupletsTremoloTest),
]
}
#endif
| 36.026049 | 119 | 0.696754 |
578b01b9665dd16cde87669d1c99be7db0bfeb72 | 110 | h | C | src/KingPin/Errors.h | jojelen/Spazy | 9d24e0f2ad0731a729cbc903d2384ddaa7a38f1a | [
"MIT"
] | null | null | null | src/KingPin/Errors.h | jojelen/Spazy | 9d24e0f2ad0731a729cbc903d2384ddaa7a38f1a | [
"MIT"
] | null | null | null | src/KingPin/Errors.h | jojelen/Spazy | 9d24e0f2ad0731a729cbc903d2384ddaa7a38f1a | [
"MIT"
] | null | null | null | #pragma once
#include <string>
namespace KingPin
{
extern void fatalError(std::string errorString);
} | 13.75 | 49 | 0.718182 |
049fb7e0078a7ac2251389a054a8ba8831a3e439 | 2,484 | java | Java | src/com/cineplex/action/FilmRecordAction.java | shenjie1993/assaic | a7280c67d0481e00b617a3e11d5d281a8b0fe17a | [
"Apache-2.0"
] | null | null | null | src/com/cineplex/action/FilmRecordAction.java | shenjie1993/assaic | a7280c67d0481e00b617a3e11d5d281a8b0fe17a | [
"Apache-2.0"
] | null | null | null | src/com/cineplex/action/FilmRecordAction.java | shenjie1993/assaic | a7280c67d0481e00b617a3e11d5d281a8b0fe17a | [
"Apache-2.0"
] | null | null | null | package com.cineplex.action;
import java.util.List;
import javax.annotation.Resource;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import com.cineplex.entity.FilmRecord;
import com.cineplex.service.FilmRecordService;
/**
*
* @author Andy 1993sj19993@gmail.com
* @date 2015年4月16日 下午4:24:50
*
*/
public class FilmRecordAction extends BaseAction {
private static final Logger LOGGER = LogManager
.getLogger(FilmRecordAction.class);
/**
* @Fields serialVersionUID : TODO
*/
private static final long serialVersionUID = 1L;
@Resource
private FilmRecordService filmRecordService;
private int recordId;
private int filmId;
private List<FilmRecord> filmRecords;
private char[] seats;
public int getRecordId() {
return recordId;
}
public void setRecordId(int recordId) {
this.recordId = recordId;
}
public int getFilmId() {
return filmId;
}
public void setFilmId(int filmId) {
this.filmId = filmId;
}
public List<FilmRecord> getFilmRecords() {
return filmRecords;
}
public void setFilmRecords(List<FilmRecord> filmRecords) {
this.filmRecords = filmRecords;
}
public char[] getSeats() {
return seats;
}
public void setSeats(char[] seats) {
this.seats = seats;
}
/**
*
* get screening records of a film by its id
* @return
* String
* @throws
*/
public String getFilmRecordByFilmId() {
LOGGER.info("film id: " + filmId);
filmRecords = filmRecordService.getFilmRecords(filmId);
String accountType = (String) session().get("account_type");
if (accountType.equals(LoginAction.ACCOUNT_TYPE_MEMBER)) {
return LoginAction.MEMBER_SUCCESS;
} else if (accountType.equals(LoginAction.ACCOUNT_TYPE_WAITER)) {
return LoginAction.WAITER_SUCCESS;
}
return ERROR;
}
/**
*
* get seat situation of a screening record
* @return
* String
* @throws
*/
public String checkSeat() {
seats = filmRecordService.getSeatSate(recordId);
String accountType = (String) session().get("account_type");
if (accountType.equals(LoginAction.ACCOUNT_TYPE_MEMBER)) {
return LoginAction.MEMBER_SUCCESS;
} else if (accountType.equals(LoginAction.ACCOUNT_TYPE_WAITER)) {
return LoginAction.WAITER_SUCCESS;
}
return ERROR;
}
/**
*
* choose a seat
* @return
* String
* @throws
*/
@Deprecated
public String chooseSeat() {
return SUCCESS;
}
}
| 21.050847 | 68 | 0.68438 |
12f81282662baa50d56c84b96ed9bea8a1040f49 | 4,958 | html | HTML | flaskbb/templates/management/plugins.html | rehee/try_discuz | 063c2c89c25054c88b3ac785a3ed135c7abc9be5 | [
"BSD-3-Clause"
] | 8 | 2015-08-08T00:19:34.000Z | 2019-08-28T16:20:19.000Z | flaskbb/templates/management/plugins.html | rehee/try_discuz | 063c2c89c25054c88b3ac785a3ed135c7abc9be5 | [
"BSD-3-Clause"
] | 45 | 2021-03-22T07:15:27.000Z | 2021-12-23T21:07:10.000Z | flaskbb/templates/management/plugins.html | rehee/try_discuz | 063c2c89c25054c88b3ac785a3ed135c7abc9be5 | [
"BSD-3-Clause"
] | 6 | 2021-03-26T18:30:56.000Z | 2022-03-27T10:58:53.000Z | {% set page_title = _("Plugins") %}
{% extends theme("management/management_layout.html") %}
{% block breadcrumb %}
<ol class="breadcrumb flaskbb-breadcrumb">
<li><a href="{{ url_for('forum.index') }}">{% trans %}Forum{% endtrans %}</a></li>
<li><a href="{{ url_for('management.overview') }}">{% trans %}Management{% endtrans %}</a></li>
<li class="active">{% trans %}Plugins{% endtrans %}</li>
</ol>
{% endblock %}
{% block management_content %}
{% from theme('macros.html') import render_pagination %}
<div class="col-md-12 settings-col">
<div class="panel settings-panel">
<div class="panel-heading settings-head">
<span class="fa fa-puzzle-piece"></span> {% trans %}Manage Plugins{% endtrans %}
</div>
<div class="panel-body settings-body">
<div class="settings-content">
<div class="settings-meta">
<div class="row settings-row">
<div class="col-md-4 col-sm-4 col-xs-4 meta-item">{% trans %}Plugin{% endtrans %}</div>
<div class="col-md-4 col-sm-4 col-xs-4 meta-item">{% trans %}Information{% endtrans %}</div>
<div class="col-md-4 col-sm-4 col-xs-4 meta-item">{% trans %}Manage{% endtrans %}</div>
</div>
</div>
{% for plugin in plugins %}
<div class="row settings-row hover with-border-bottom">
<div class="col-md-4 col-sm-4 col-xs-4">
{{ plugin.name.title() }}
(
{%- if plugin.info.get('home_page') -%}
<a href="{{ plugin.info.get('home_page') }}">{{ plugin.info.get("name") }}</a>
{%- else -%}
{{ plugin.info.get("name") }}
{%- endif -%}
)
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<div class="plugin-version">{% trans %}Version{% endtrans %}: {{ plugin.info.get('version') }}</div>
<div class="plugin-description">{{ plugin.info.get('summary') }}</div>
<div class="plugin-author">{% trans %}by{% endtrans %} {{ plugin.info.get('author') }}</div>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
{% if not plugin.enabled %}
<form class="inline-form" method="post" action="{{ url_for('management.enable_plugin', name=plugin.name) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<button class="btn btn-success">{% trans %}Enable{% endtrans %}</button>
</form>
{% else %}
<form class="inline-form" method="post" action="{{ url_for('management.disable_plugin', name=plugin.name) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<button class="btn btn-warning">{% trans %}Disable{% endtrans %}</button>
</form>
{% endif %}
{% if plugin.is_installable and not plugin.is_installed %}
<form class="inline-form" method="post" action="{{ url_for('management.install_plugin', name=plugin.name) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<button class="btn btn-info" name="confirmDialog" data-toggle="tooltip" data-placement="top" title="Creates the settings for the plugin">
{% trans %}Install{% endtrans %}
</button>
</form>
{% elif plugin.is_installable and plugin.is_installed %}
<form class="inline-form" method="post" action="{{ url_for('management.uninstall_plugin', name=plugin.name) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<button class="btn btn-danger" name="confirmDialog" data-toggle="tooltip" data-placement="top" title="Removes the settings">
{% trans %}Uninstall{% endtrans %}
</button>
</form>
<a class="btn btn-info" href="{{ url_for('management.settings', plugin=plugin.name) }}">Settings</a>
{% endif %}
</div>
</div>
{% endfor %}
</div>
</div>
</div>
</div>
{% include theme('confirm_dialog.html') %}
{% endblock %}
{% block scripts %}
<script>
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>
{% endblock %}
| 52.189474 | 165 | 0.474183 |
445cda587bad72c67f4425be38e44edfd2f7a1be | 3,536 | swift | Swift | Tests/ThenKitTests/ThenKitSingleTests.swift | rodrigo-lima/ThenKit | 70a44754644877e1ff9896dba8f9ae01ab48950b | [
"MIT"
] | 1 | 2016-04-11T15:52:00.000Z | 2016-04-11T15:52:00.000Z | Tests/ThenKitTests/ThenKitSingleTests.swift | rodrigo-lima/ThenKit | 70a44754644877e1ff9896dba8f9ae01ab48950b | [
"MIT"
] | null | null | null | Tests/ThenKitTests/ThenKitSingleTests.swift | rodrigo-lima/ThenKit | 70a44754644877e1ff9896dba8f9ae01ab48950b | [
"MIT"
] | null | null | null | //
// ThenKitSingleTests.swift
// ThenKitSingleTests
//
// Created by Rodrigo Lima on 8/18/15.
// Copyright © 2015 Rodrigo. All rights reserved.
//
import XCTest
@testable import ThenKit
class ThenKitSingleTests: XCTestCase {
override func setUp() {
super.setUp()
Logger.logLevel = .debug
Logger.runningTest(">> -------------------- INIT TEST \(self) -------------------- <<", newLine: true)
}
override func tearDown() {
super.tearDown()
if promisesCounter == 0 {
Logger.escaped(color: .lightGreen, "NO MEMORY LEAK -- Promise counter ==> \(promisesCounter)\n")
} else {
Logger.escaped(color: .lightRed, "OPS!? MEMORY LEAK -- Promise counter ==> \(promisesCounter)\n")
}
}
func waitForPromise(p: Thenable, expect: XCTestExpectation, timeout: TimeInterval) {
testDebugPrint("PROMISE - \(p)")
p.then(onFulfilled: { fulfillVal in
testDebugPrint("PROMISE - FULFILLED:\(fulfillVal)")
return ""
},
onRejected: { error in
testDebugPrint("PROMISE - REJECTED:\(error)")
return error
},
onCompleted: { _ in
testDebugPrint("PROMISE - COMPLETE")
dispatch_after(0.5) {
expect.fulfill()
testDebugPrint("=== \(expect.description) DONE ===")
}
})
// WAIT
waitForExpectations(timeout: timeout) { error in
XCTAssertNil(error)
}
}
func testSimple() {
let expect = expectation(description: "testSimple")
let p = Promise()
p.name = expect.description
testDebugPrint("PROMISE - \(p)")
p.then(onFulfilled: { fulfillVal in
testDebugPrint("PROMISE - FULFILLED:\(fulfillVal)")
return ""
},
onRejected: { error in
testDebugPrint("PROMISE - REJECTED:\(error)")
return error
},
onCompleted: { _ in
testDebugPrint("PROMISE - COMPLETE")
})
// should we auto-fulfill this?
dispatch_after(1) { [weak p] in
p?.fulfill(fulfilledValue: "done")
dispatch_after(1) {
expect.fulfill()
testDebugPrint("=== \(expect.description) DONE ===")
}
}
// WAIT
waitForExpectations(timeout: 10) { error in
XCTAssertNil(error)
}
}
func testStaticPromisesFulfilled() {
let expect = expectation(description: "testStaticPromisesFulfilled")
let p = Promise.fulfilledEmptyPromise()
waitForPromise(p: p, expect: expect, timeout: 10)
}
func testStaticPromisesEmpty() {
let expect = expectation(description: "testStaticPromisesEmpty")
let p = Promise.emptyPromise()
waitForPromise(p: p, expect: expect, timeout: 10)
}
func testStaticPromisesRejected() {
let expect = expectation(description: "testStaticPromisesRejected")
let p = Promise.rejectedPromise(error: thenKitTestsError1)
waitForPromise(p: p, expect: expect, timeout: 10)
}
static var allTests: [(String, (ThenKitSingleTests) -> () throws -> Void)] {
return [
("testSimple", testSimple),
("testStaticPromisesFulfilled", testStaticPromisesFulfilled),
("testStaticPromisesEmpty", testStaticPromisesEmpty),
("testStaticPromisesRejected", testStaticPromisesRejected)
]
}
}
| 32.440367 | 110 | 0.572964 |
c1a0979f42e0ae55fa2c4f0133dbf05de21b50cd | 14,444 | sql | SQL | carora.sql | jdcadenas/unaproyectocarora336 | 6f12e2d24137625b7cf3660e3dabfe5bcef9c491 | [
"MIT"
] | null | null | null | carora.sql | jdcadenas/unaproyectocarora336 | 6f12e2d24137625b7cf3660e3dabfe5bcef9c491 | [
"MIT"
] | 1 | 2019-05-04T18:12:05.000Z | 2019-05-04T18:12:05.000Z | carora.sql | jdcadenas/unaproyectocarora336 | 6f12e2d24137625b7cf3660e3dabfe5bcef9c491 | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Servidor: 127.0.0.1
-- Tiempo de generación: 07-05-2019 a las 10:34:25
-- Versión del servidor: 10.1.19-MariaDB
-- Versión de PHP: 7.0.13
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `carora`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `almacen`
--
CREATE TABLE `almacen` (
`id` int(11) NOT NULL,
`sucursal_id` int(11) NOT NULL,
`producto_id` int(11) NOT NULL,
`cantidad` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `almacen`
--
INSERT INTO `almacen` (`id`, `sucursal_id`, `producto_id`, `cantidad`) VALUES
(1, 1, 2, 5),
(2, 1, 3, 10),
(3, 2, 4, 100),
(4, 2, 14, 100),
(5, 1, 15, 15),
(6, 2, 16, 100),
(7, 3, 17, 123),
(8, 5, 20, 77),
(9, 1, 22, 20),
(10, 6, 23, 40),
(11, 6, 24, 113),
(12, 3, 25, 123),
(13, 4, 26, 25),
(14, 1, 27, 55),
(15, 3, 28, 12),
(16, 1, 29, 22),
(17, 1, 30, 12),
(18, 1, 31, 34);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `detalle_venta`
--
CREATE TABLE `detalle_venta` (
`id_det_venta` int(11) NOT NULL,
`producto_id` int(11) NOT NULL,
`cantidad` int(11) NOT NULL,
`precio_venta` int(11) NOT NULL,
`venta_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `detalle_venta`
--
INSERT INTO `detalle_venta` (`id_det_venta`, `producto_id`, `cantidad`, `precio_venta`, `venta_id`) VALUES
(4, 3, 10, 15500, 15),
(5, 2, 10, 15500, 16),
(6, 7, 1, 22000, 16),
(7, 11, 22, 23, 19),
(11, 2, 1, 15500, 22),
(12, 2, 10, 15500, 23),
(13, 11, 2, 23, 23),
(14, 4, 10, 26000, 24),
(15, 3, 10, 15500, 25),
(16, 2, 33, 15500, 26),
(17, 3, 4, 15500, 26),
(18, 15, 4, 12000, 26),
(19, 4, 1, 26000, 27),
(20, 4, 5, 26000, 28),
(21, 14, 5, 4555, 29),
(22, 3, 23, 15500, 30),
(23, 15, 9, 12000, 30),
(24, 15, 1, 12000, 31),
(25, 22, 2, 32, 32),
(26, 23, 10, 13000, 33),
(27, 24, 7, 4500, 33),
(28, 23, 15, 13000, 34),
(29, 2, 9, 15500, 34),
(30, 16, 23, 124, 35),
(31, 2, 5, 15500, 36),
(32, 3, 10, 15500, 36),
(33, 15, 15, 12000, 36);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `empleados`
--
CREATE TABLE `empleados` (
`id_empleado` int(11) NOT NULL,
`cedula` int(11) NOT NULL,
`nombre` varchar(50) NOT NULL,
`apellido` varchar(50) NOT NULL,
`telefono` varchar(12) NOT NULL,
`correo` varchar(40) NOT NULL,
`usuario` varchar(50) NOT NULL,
`clave` varchar(100) NOT NULL,
`rol_id` int(11) NOT NULL,
`sucursal_id` int(11) NOT NULL DEFAULT '1',
`estado` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `empleados`
--
INSERT INTO `empleados` (`id_empleado`, `cedula`, `nombre`, `apellido`, `telefono`, `correo`, `usuario`, `clave`, `rol_id`, `sucursal_id`, `estado`) VALUES
(1, 6, 'José', 'Cadenas', '1342', 'jdcadenas@gmail.com', '1', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 4, 1, 1),
(2, 2, 'Vicente', 'Perez', '2', 'perez@gmail.com', '2', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 2, 2, 0),
(3, 211, 'Vicente219', 'Perez9', '29', 'perez21@gmail.com9', '399', '666', 4, 3, 1),
(4, 3, 'Super3', 'Visor', '3', '3@gmail.com', '123', '40bd001563085fc35165329ea1ff5c5ecbdbbeef', 3, 1, 1),
(5, 31, 'Super', 'Visor', '31', '3@gmail.com', '', '31', 3, 1, 1),
(6, 4, 'vend', 'edor', '4', '4@gmail.com', '', '4', 4, 1, 0),
(7, 41, 'Oto', 'vendedor', '41', '41#gmail.com', '', '41', 4, 1, 0),
(8, 43, 'vend 43', 'edor', '4', '4@gmail.com', '', '4', 4, 1, 1),
(9, 42, 'Oto42', 'vendedor', '41', '41#gmail.com', '', '41', 4, 1, 1),
(10, 22, 'gerenoeste', 'te', '2', '2@gmail.com', '', '2', 2, 1, 1),
(11, 24, 'gerenoeste', 'te', '2', '2@gmail.com', '', '2', 2, 1, 1),
(13, 98, '9888', '98888', '9999', '999', '9', '9', 4, 1, 1),
(14, 78, '7878', '787', '78', '787', '787', '7110eda4d09e062aa5e4a390b0a572ac0d2c0220', 4, 6, 1),
(15, 123123, 'pepe', 'grillo', '22342', 'hjh@gmail.com', '123', '123', 4, 2, 1),
(16, 333, '33', '33', '33', 'hjh@gmail.com', '333', '333', 4, 1, 1),
(17, 23449, '13419', '31419', '249', '249', '239', '0ade7c2cf97f75d009975f4d720d1fa6c19f4897', 4, 3, 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `lineas`
--
CREATE TABLE `lineas` (
`id_linea` int(11) NOT NULL,
`nombre_linea` varchar(100) NOT NULL,
`estado` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `lineas`
--
INSERT INTO `lineas` (`id_linea`, `nombre_linea`, `estado`) VALUES
(1, 'Brillo de seda88', 1),
(2, 'Aceite brillante', 0),
(3, 'Para Exteriores', 1),
(4, 'Aceite Mate', 1),
(5, 'Al agua vv', 0),
(6, 'Secado rápido', 1),
(7, 'para Metal', 1),
(8, 'Antioxidante varias', 1),
(9, 'linea nueva', 1),
(10, 'linea antigua', 1),
(11, 'otra linea', 1),
(12, 'Brillo de seda nueva', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `productos`
--
CREATE TABLE `productos` (
`id_producto` int(11) NOT NULL,
`codigo` varchar(20) NOT NULL,
`nombre` varchar(200) NOT NULL,
`precio` float(12,2) NOT NULL,
`cantidad` int(11) NOT NULL,
`imagen_producto` varchar(255) NOT NULL,
`linea` int(11) NOT NULL,
`estado` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `productos`
--
INSERT INTO `productos` (`id_producto`, `codigo`, `nombre`, `precio`, `cantidad`, `imagen_producto`, `linea`, `estado`) VALUES
(2, '12009', 'Pintura para radiadores satinada', 15500.00, 10, 'assets/images/productos/12009.jpg', 1, 0),
(3, '2343', 'Pintura pastosa Rojaxx', 15500.00, 20, 'assets/images/productos/2343.jpg', 4, 0),
(4, '3434', 'Pintura marca XYZ', 26000.00, 20, 'assets/images/productos/3434.jpg', 1, 1),
(5, '343455', 'Pintura La Otra', 22000.00, 30, '', 3, 1),
(6, '7654', 'Pintura marca XYZ', 26000.00, 20, '', 1, 1),
(7, '432', 'Pintura La Otra', 22000.00, -169, '', 3, 1),
(8, '1005', 'Pintura para tubod', 12500.00, 4, '', 1, 1),
(9, '1234', 'Pintura', 3002.00, 44, '', 10, 1),
(10, '123456', 'Pintura de carton', 1000.00, 10, '', 11, 1),
(11, '1111', 'pintura rara', 23.22, 4, '', 6, 1),
(12, '9999', 'material', 99.99, 88, '', 9, 1),
(13, '777', 'otro producto', 55.00, 66, '', 3, 1),
(14, '777', 'otro producto', 4555.00, 123, 'assets/images/productos/777.jpg', 3, 1),
(15, '10006', 'pintura blanca', 12000.00, 30, '', 4, 1),
(16, '1', 'mi cool399', 123.99, 1239, 'assets/images/productos/1.jpg', 10, 1),
(17, '1231232', '123', 123.00, 129, '', 9, 1),
(18, '123222', '22222', 222.00, 222, '', 9, 1),
(19, '123222', '22222', 222.00, 222, '', 9, 1),
(20, '8989', '778877', 77.00, 77, '', 9, 1),
(21, '100002009', 'uturr', 776.00, 669, '', 6, 1),
(22, '23323', 'producto 22', 32.00, 22, '', 11, 1),
(23, '6000213', 'Pinturas color azul', 13000.00, 50, '', 3, 1),
(24, '600999', 'Pintura amarilla', 4500.00, 120, '', 3, 1),
(25, '213', '13419', 123.00, 123, 'assets/images/productos/2133.jpg', 4, 0),
(26, '400034', 'Pintura para radiadores blanco satinado ', 50500.00, 25, 'assets/images/productos/400034.jpg', 7, 1),
(27, '11000', 'pintura mate sat', 29800.00, 5, '', 7, 1),
(28, '12322233', '223', 2321.00, 12, 'assets/images/productos/12322233.jpg', 3, 0),
(29, '1011000', 'Pintura Para Madera', 12333.00, 22, '', 11, 1),
(30, '12233456', '444', 12.00, 12, 'assets/images/productos/12233456.jpg', 3, 1),
(31, '122990000', 'Pintura negra', 12000.00, 34, 'assets/images/productos/122990000.jpg', 6, 0);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `roles`
--
CREATE TABLE `roles` (
`id_rol` int(11) NOT NULL,
`rol` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `roles`
--
INSERT INTO `roles` (`id_rol`, `rol`) VALUES
(1, 'administrador'),
(2, 'Gerente Ventas'),
(3, 'Supervisor Sucursal'),
(4, 'Vendedor');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `sucursales`
--
CREATE TABLE `sucursales` (
`id` int(11) NOT NULL,
`nombre` varchar(20) NOT NULL,
`ubicacion` varchar(100) NOT NULL,
`estado` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `sucursales`
--
INSERT INTO `sucursales` (`id`, `nombre`, `ubicacion`, `estado`) VALUES
(1, 'sede centraluu', 'principalio', 1),
(2, 'oeste', 'miralejos', 1),
(3, 'este', 'vereste', 1),
(4, 'norte', 'miralejos Norte', 1),
(5, 'Sur', 'verSur', 1),
(6, 'sede capital barq', 'barquisimeto', 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `ventas`
--
CREATE TABLE `ventas` (
`id_venta` int(11) NOT NULL,
`fecha_venta` date NOT NULL,
`total` float(12,2) NOT NULL,
`empleado_id` int(11) NOT NULL,
`sucursal_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `ventas`
--
INSERT INTO `ventas` (`id_venta`, `fecha_venta`, `total`, `empleado_id`, `sucursal_id`) VALUES
(2, '2019-04-20', 17360.00, 1, 1),
(4, '2018-04-05', 17360.00, 2, 2),
(8, '2018-04-03', 17360.00, 3, 1),
(9, '2019-03-29', 17360.00, 11, 1),
(10, '2019-04-01', 8520.00, 9, 1),
(11, '2019-04-06', 8460.00, 5, 1),
(12, '2019-06-30', 4000.00, 4, 1),
(13, '2019-04-23', 500.00, 3, 1),
(14, '2019-04-23', 9500.00, 3, 1),
(15, '2019-04-03', 1000.00, 3, 1),
(16, '2019-04-10', 5000.00, 5, 1),
(19, '2019-05-03', 572.14, 3, 2),
(20, '2019-05-03', 572.14, 3, 2),
(21, '2019-05-03', 17052.00, 1, 2),
(22, '2019-05-03', 1052.00, 1, 2),
(23, '2019-05-03', 1752.00, 1, 2),
(24, '2019-05-03', 2910.00, 1, 2),
(25, '2019-05-04', 1700.00, 14, 1),
(26, '2019-05-05', 8300.00, 1, 1),
(27, '2019-05-04', 29120.00, 1, 2),
(28, '2019-05-05', 0.00, 3, 2),
(29, '2019-05-05', 0.00, 1, 2),
(30, '2019-05-05', 520240.00, 1, 1),
(31, '2019-05-06', 13440.00, 1, 1),
(32, '2019-04-27', 71.68, 1, 1),
(33, '2019-03-06', 180880.00, 14, 6),
(34, '2019-05-05', 374640.00, 17, 3),
(35, '2019-05-06', 3193.98, 15, 2),
(36, '2019-05-06', 462000.00, 1, 1);
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `almacen`
--
ALTER TABLE `almacen`
ADD PRIMARY KEY (`id`),
ADD KEY `fk_suc` (`sucursal_id`),
ADD KEY `fk_prod` (`producto_id`);
--
-- Indices de la tabla `detalle_venta`
--
ALTER TABLE `detalle_venta`
ADD PRIMARY KEY (`id_det_venta`),
ADD KEY `pro` (`producto_id`),
ADD KEY `vent` (`venta_id`),
ADD KEY `vend` (`producto_id`) USING BTREE;
--
-- Indices de la tabla `empleados`
--
ALTER TABLE `empleados`
ADD PRIMARY KEY (`id_empleado`),
ADD UNIQUE KEY `cedula` (`cedula`),
ADD KEY `rolindex` (`rol_id`),
ADD KEY `sucu1` (`sucursal_id`);
--
-- Indices de la tabla `lineas`
--
ALTER TABLE `lineas`
ADD PRIMARY KEY (`id_linea`);
--
-- Indices de la tabla `productos`
--
ALTER TABLE `productos`
ADD PRIMARY KEY (`id_producto`),
ADD KEY `lin` (`linea`);
--
-- Indices de la tabla `roles`
--
ALTER TABLE `roles`
ADD PRIMARY KEY (`id_rol`);
--
-- Indices de la tabla `sucursales`
--
ALTER TABLE `sucursales`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `ventas`
--
ALTER TABLE `ventas`
ADD PRIMARY KEY (`id_venta`),
ADD KEY `vend` (`empleado_id`),
ADD KEY `sucursal_id` (`sucursal_id`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `almacen`
--
ALTER TABLE `almacen`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
--
-- AUTO_INCREMENT de la tabla `detalle_venta`
--
ALTER TABLE `detalle_venta`
MODIFY `id_det_venta` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT de la tabla `empleados`
--
ALTER TABLE `empleados`
MODIFY `id_empleado` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT de la tabla `lineas`
--
ALTER TABLE `lineas`
MODIFY `id_linea` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT de la tabla `productos`
--
ALTER TABLE `productos`
MODIFY `id_producto` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;
--
-- AUTO_INCREMENT de la tabla `roles`
--
ALTER TABLE `roles`
MODIFY `id_rol` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `sucursales`
--
ALTER TABLE `sucursales`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT de la tabla `ventas`
--
ALTER TABLE `ventas`
MODIFY `id_venta` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `almacen`
--
ALTER TABLE `almacen`
ADD CONSTRAINT `rel_prod` FOREIGN KEY (`producto_id`) REFERENCES `productos` (`id_producto`),
ADD CONSTRAINT `rel_suc` FOREIGN KEY (`sucursal_id`) REFERENCES `sucursales` (`id`);
--
-- Filtros para la tabla `detalle_venta`
--
ALTER TABLE `detalle_venta`
ADD CONSTRAINT `detalle_venta_ibfk_1` FOREIGN KEY (`venta_id`) REFERENCES `ventas` (`id_venta`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `detarest` FOREIGN KEY (`producto_id`) REFERENCES `productos` (`id_producto`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `empleados`
--
ALTER TABLE `empleados`
ADD CONSTRAINT `qwe` FOREIGN KEY (`sucursal_id`) REFERENCES `sucursales` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `restroles` FOREIGN KEY (`rol_id`) REFERENCES `roles` (`id_rol`);
--
-- Filtros para la tabla `productos`
--
ALTER TABLE `productos`
ADD CONSTRAINT `productos_ibfk_1` FOREIGN KEY (`linea`) REFERENCES `lineas` (`id_linea`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `ventas`
--
ALTER TABLE `ventas`
ADD CONSTRAINT `ventas_ibfk_1` FOREIGN KEY (`empleado_id`) REFERENCES `empleados` (`id_empleado`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `ventas_ibfk_2` FOREIGN KEY (`sucursal_id`) REFERENCES `sucursales` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 30.408421 | 155 | 0.610911 |
8ead86b5dedc6ab9221a9df3a20cdffbd0ff4201 | 283 | rb | Ruby | app/controllers/account_transacts_controller.rb | carl1984r/js_portfolio_project | ba693e988473e386e83437871e9dc169c6857005 | [
"MIT"
] | null | null | null | app/controllers/account_transacts_controller.rb | carl1984r/js_portfolio_project | ba693e988473e386e83437871e9dc169c6857005 | [
"MIT"
] | 5 | 2020-03-02T16:37:08.000Z | 2022-03-31T00:27:12.000Z | app/controllers/account_transacts_controller.rb | carl1984r/js_portfolio_project | ba693e988473e386e83437871e9dc169c6857005 | [
"MIT"
] | null | null | null | class AccountTransactsController < ApplicationController
def show
account_transactions = AccountTransact.where(account_id: params[:id])
options = {
include: [:account, :transact] }
render json: AccountTransactSerializer.new(account_transactions, options)
end
end
| 31.444444 | 77 | 0.766784 |
c22bdc213e812685cadecfece2cfda71f0599878 | 2,839 | go | Go | src/tpl/operation_log.go | teambition/urbs-console | 8e4a07a3eb570e81508469443cc15d49f96eb94f | [
"MIT"
] | 1 | 2021-07-07T06:44:45.000Z | 2021-07-07T06:44:45.000Z | src/tpl/operation_log.go | teambition/urbs-console | 8e4a07a3eb570e81508469443cc15d49f96eb94f | [
"MIT"
] | null | null | null | src/tpl/operation_log.go | teambition/urbs-console | 8e4a07a3eb570e81508469443cc15d49f96eb94f | [
"MIT"
] | null | null | null | package tpl
import (
"time"
"github.com/teambition/gear"
)
// OperationLogListReq ...
type OperationLogListReq struct {
Pagination
ProductURL
Label string `json:"label" query:"label"`
Module string `json:"module" query:"module"`
Setting string `json:"setting" query:"setting"`
}
// Validate 实现 gear.BodyTemplate。
func (t *OperationLogListReq) Validate() error {
if err := t.Pagination.Validate(); err != nil {
return err
}
if err := t.ProductURL.Validate(); err != nil {
return err
}
if t.Label != "" {
if !validLabelReg.MatchString(t.Label) {
return gear.ErrBadRequest.WithMsgf("invalid label: %s", t.Label)
}
} else {
if !validNameReg.MatchString(t.Module) {
return gear.ErrBadRequest.WithMsgf("invalid module name: %s", t.Module)
}
if !validNameReg.MatchString(t.Setting) {
return gear.ErrBadRequest.WithMsgf("invalid setting name: %s", t.Setting)
}
}
return nil
}
// OperationLogListRes ...
type OperationLogListRes struct {
SuccessResponseType
Result []*OperationLogListItem `json:"result"` // 空数组也保留
}
// OperationLogListItem ...
type OperationLogListItem struct {
HID string `json:"hid"`
Operator string `json:"operator"` // 操作人
OperatorName string `json:"operatorName"` // 操作人
Action string `json:"action"` // 操作行为
Desc string `json:"desc"` // 操作说明
CreatedAt time.Time `json:"createdAt"`
Groups []string `json:"groups,omitempty"` // 群组
Users []string `json:"users,omitempty"` // 用户
Value string `json:"value,omitempty"`
Kind string `json:"kind"`
Percent *int `json:"percent,omitempty"` // 灰度百分比
}
// LogProductLabelPaginationURL ...
type LogProductLabelPaginationURL struct {
ConsolePagination
ProductURL
Label string `json:"label" param:"label"`
}
// Validate 实现 gear.BodyTemplate。
func (t *LogProductLabelPaginationURL) Validate() error {
if err := t.ProductURL.Validate(); err != nil {
return err
}
if !validLabelReg.MatchString(t.Label) {
return gear.ErrBadRequest.WithMsgf("invalid label: %s", t.Label)
}
if err := t.ConsolePagination.Validate(); err != nil {
return err
}
return nil
}
// LogProductModuleSettingURL ...
type LogProductModuleSettingURL struct {
ConsolePagination
ProductURL
Module string `json:"module" param:"module"`
Setting string `json:"setting" param:"setting"`
}
// Validate 实现 gear.BodyTemplate。
func (t *LogProductModuleSettingURL) Validate() error {
if err := t.ProductURL.Validate(); err != nil {
return err
}
if !validNameReg.MatchString(t.Module) {
return gear.ErrBadRequest.WithMsgf("invalid module name: %s", t.Module)
}
if !validNameReg.MatchString(t.Setting) {
return gear.ErrBadRequest.WithMsgf("invalid setting name: %s", t.Setting)
}
if err := t.ConsolePagination.Validate(); err != nil {
return err
}
return nil
}
| 25.576577 | 76 | 0.693906 |
046b2bb4d1c332620d93ac5744eef02817295685 | 360 | java | Java | sources/android/support/p000v4/widget/C0675F.java | tusharchoudhary0003/Custom-Football-Game | 47283462b2066ad5c53b3c901182e7ae62a34fc8 | [
"MIT"
] | 1 | 2019-10-01T11:34:10.000Z | 2019-10-01T11:34:10.000Z | sources/android/support/p000v4/widget/C0675F.java | tusharchoudhary0003/Custom-Football-Game | 47283462b2066ad5c53b3c901182e7ae62a34fc8 | [
"MIT"
] | null | null | null | sources/android/support/p000v4/widget/C0675F.java | tusharchoudhary0003/Custom-Football-Game | 47283462b2066ad5c53b3c901182e7ae62a34fc8 | [
"MIT"
] | 1 | 2020-05-26T05:10:33.000Z | 2020-05-26T05:10:33.000Z | package android.support.p000v4.widget;
import android.view.animation.Interpolator;
/* renamed from: android.support.v4.widget.F */
/* compiled from: ViewDragHelper */
class C0675F implements Interpolator {
C0675F() {
}
public float getInterpolation(float t) {
float t2 = t - 1.0f;
return (t2 * t2 * t2 * t2 * t2) + 1.0f;
}
}
| 22.5 | 47 | 0.647222 |
4193d060e424c503558b3b2b162ea18318ec65b2 | 556 | asm | Assembly | programs/oeis/121/A121801.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/121/A121801.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/121/A121801.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A121801: Expansion of 2*x^2*(3-x)/((1+x)*(1-3*x+x^2)).
; 0,6,10,32,78,210,544,1430,3738,9792,25630,67106,175680,459942,1204138,3152480,8253294,21607410,56568928,148099382,387729210,1015088256,2657535550,6957518402,18215019648,47687540550,124847601994,326855265440,855718194318,2240299317522,5865179758240,15355239957206,40200540113370,105246380382912,275538601035358,721369422723170,1888569667134144,4944339578679270
add $0,1
cal $0,226205 ; a(n) = F(n)^2 - F(n-1)^2 or F(n+1) * F(n-2) where F(n) = A000045(n), the Fibonacci numbers.
mul $0,2
add $1,$0
| 69.5 | 361 | 0.769784 |
57418ffd1929acc03ad285791cabc494127828c7 | 1,530 | h | C | KaMuS/CircularDoubleLinkList.h | MAqielHilmanM/KaMuS | 5ef985fd908601a62c3e37590762f1a27cbaf296 | [
"MIT"
] | null | null | null | KaMuS/CircularDoubleLinkList.h | MAqielHilmanM/KaMuS | 5ef985fd908601a62c3e37590762f1a27cbaf296 | [
"MIT"
] | null | null | null | KaMuS/CircularDoubleLinkList.h | MAqielHilmanM/KaMuS | 5ef985fd908601a62c3e37590762f1a27cbaf296 | [
"MIT"
] | null | null | null | #ifndef CIRCULARDOUBLELINKLIST_H_INCLUDED
#define CIRCULARDOUBLELINKLIST_H_INCLUDED
//Circullar Double Link List without pointer last used as Child (English word Storage)
#include "tools.h"
#include "mainHeader.h"
#define first(L) L.first
#define info(P) P->info
#define next(P) P->next
#define prev(P) P->prev
// InfoType :
// kata = used for save english keyword
// tanggal = used for save timestamp (conversion of date time)
struct infotypeChild{
string kata;
long tanggal;
int counter;
};
typedef struct elementChild *adrChild;
struct elementChild{
infotypeChild info;
adrChild next;
adrChild prev;
};
struct ListChild{
adrChild first;
};
void createList(ListChild &L);
adrChild alokasiChild(string kata);
void dealokasi(adrChild P);
void insertFirst(ListChild &L, adrChild P);
void insertAfter(ListChild &L, adrChild prec, adrChild P);
void insertLast(ListChild &L, adrChild P);
void deleteFirst(ListChild &L, adrChild &P);
void deleteAfter(ListChild &L, adrChild prec, adrChild &P);
void deleteLast(ListChild &L, adrChild &P);
adrChild cariKata(ListChild L, string kata);
adrChild cariTanggal(ListChild L, long tanggal);
void update(adrChild &elemen_diubah, string kata);
void update(adrChild &elemen_diubah, int counter);
void update(adrChild &elemen_diubah, long tanggal);
void show(ListChild L);
void BanyakData(ListChild L);
int TotalData(ListChild L);
void ShowTopKeyword(ListChild L);
ListChild ShortingAscending(ListChild L);
#endif // CIRCULARDOUBLELINKLIST_H_INCLUDED
| 23.181818 | 86 | 0.762745 |
7f625f60b2a31415368fbdd47d2d88cdfee770ac | 1,556 | dart | Dart | lib/big_picture/ui/explain/explain_mar_ui.dart | ivofernandes/turingDealApp | 544736140c36316e1cd5c7ad3a6fcb319fee6124 | [
"MIT"
] | 1 | 2021-03-16T18:59:14.000Z | 2021-03-16T18:59:14.000Z | lib/big_picture/ui/explain/explain_mar_ui.dart | ivofernandes/turingDealApp | 544736140c36316e1cd5c7ad3a6fcb319fee6124 | [
"MIT"
] | 3 | 2021-10-14T22:52:01.000Z | 2021-11-02T17:46:36.000Z | lib/big_picture/ui/explain/explain_mar_ui.dart | ivofernandes/turingDealApp | 544736140c36316e1cd5c7ad3a6fcb319fee6124 | [
"MIT"
] | null | null | null | import 'package:flutter/material.dart';
import 'package:turing_deal/shared/ui/Web.dart';
class ExplainMAR extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
SizedBox(
height: 20,
),
Text(
'MAR ratio',
style: Theme.of(context).textTheme.headline6,
textAlign: TextAlign.center,
),
SizedBox(
height: 20,
),
Text(
'A MAR ratio is a measurement of returns adjusted for risk that can be used to compare the performance of different assets or strategies',
),
SizedBox(
height: 20,
),
Text('The MAR forumla is: MAR ='),
Text('CAGR / Max drawdown'),
SizedBox(
height: 20,
),
MaterialButton(
color: Theme.of(context).textTheme.bodyText1!.color,
child: Text('More about MAR',
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(color: Theme.of(context).backgroundColor)),
onPressed: () {
Web.openView(context,
'https://www.investopedia.com/terms/m/mar-ratio.asp');
})
],
),
),
);
}
}
| 30.509804 | 152 | 0.472365 |
d2724f9513001f364fa720da1c2bdac42edf1229 | 101 | asm | Assembly | src/main/fragment/mos6502-common/vdum1=vwum2_plus_vwum3.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/main/fragment/mos6502-common/vdum1=vwum2_plus_vwum3.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/main/fragment/mos6502-common/vdum1=vwum2_plus_vwum3.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | clc
lda {m2}
adc {m3}
sta {m1}
lda {m2}+1
adc {m3}+1
sta {m1}+1
lda #0
sta {m1}+3
adc #0
sta {m1}+2
| 7.769231 | 10 | 0.554455 |
41ca9f92f797ef499a0916038656abbcf566100b | 1,645 | h | C | src/NessEngine/renderable/entities/shapes.h | aquafox/debuggame | bef6eb66fe7b4133faf1e406856edd9e10d20ff9 | [
"MIT"
] | 30 | 2015-05-03T21:30:59.000Z | 2022-01-12T04:25:06.000Z | src/NessEngine/renderable/entities/shapes.h | aquafox/debuggame | bef6eb66fe7b4133faf1e406856edd9e10d20ff9 | [
"MIT"
] | 1 | 2015-08-20T14:35:06.000Z | 2015-08-20T21:17:21.000Z | src/NessEngine/renderable/entities/shapes.h | aquafox/debuggame | bef6eb66fe7b4133faf1e406856edd9e10d20ff9 | [
"MIT"
] | 5 | 2015-02-05T11:53:51.000Z | 2020-03-08T10:57:24.000Z | /*
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Ronen Ness
ronenness@gmail.com
*/
/**
* renderable basic shapes
* Author: Ronen Ness
* Since: 07/1014
*/
#pragma once
#include "entity.h"
namespace Ness
{
// the renderable rectangle with color, either filled or just lines
class RectangleShape: public Entity
{
private:
bool m_is_filled;
public:
// create the rectangle shape
NESSENGINE_API RectangleShape(Renderer* renderer);
// set if this rectangle is filled or just outlines
NESSENGINE_API inline void set_filled(bool filled) {m_is_filled = filled;}
protected:
// the actual rendering function
NESSENGINE_API virtual void do_render(const Rectangle& target, const SRenderTransformations& transformations);
};
// rectangle shape pointer
NESSENGINE_API typedef SharedPtr<RectangleShape> RectangleShapePtr;
}; | 29.909091 | 112 | 0.763526 |
585b098349392071a6e03075d3b9db0b54c9d41d | 106 | sql | SQL | migration/sql-test-files/084-codebases-spaceid-url-idx-test.sql | rgarg1/fabric8-wit | e53e3d309b07b9a366fbd07c5f51e4f22bab7890 | [
"Apache-2.0"
] | 27 | 2016-07-13T20:09:38.000Z | 2017-05-24T06:46:35.000Z | migration/sql-test-files/084-codebases-spaceid-url-idx-test.sql | rgarg1/fabric8-wit | e53e3d309b07b9a366fbd07c5f51e4f22bab7890 | [
"Apache-2.0"
] | 1,364 | 2016-06-23T16:13:07.000Z | 2017-06-28T08:36:06.000Z | migration/sql-test-files/084-codebases-spaceid-url-idx-test.sql | baijum/fabric8-wit | ef839971d08bd1644de27b18f9701e120bbe95ff | [
"Apache-2.0"
] | 55 | 2017-07-03T06:57:20.000Z | 2022-03-05T10:46:32.000Z | -- Try to create duplicate entry
SELECT *
FROM codebases
WHERE id='97bd2bc3-106a-41d8-a1d9-3fdd6d2df1f7';
| 21.2 | 48 | 0.783019 |
993184dc50777a50abdcde0794014bbca74f1eb5 | 74 | asm | Assembly | test/ascii/sub.asm | Gibstick/mips241 | 5121b5e1c7d25c0b834b2da31f29f37e05e2dde2 | [
"MIT"
] | 2 | 2016-07-08T22:03:36.000Z | 2018-03-09T03:36:31.000Z | test/ascii/sub.asm | Gibstick/mips241 | 5121b5e1c7d25c0b834b2da31f29f37e05e2dde2 | [
"MIT"
] | 4 | 2016-06-25T05:14:43.000Z | 2016-07-16T23:53:07.000Z | test/ascii/sub.asm | Gibstick/mips241 | 5121b5e1c7d25c0b834b2da31f29f37e05e2dde2 | [
"MIT"
] | 2 | 2020-05-15T17:35:36.000Z | 2021-09-30T21:37:41.000Z | lis $10
.word 10
lis $4
.word 4
sub $1, $10, $4
sub $2, $4, $10
jr $31
| 6.727273 | 15 | 0.513514 |
7489aeac9b18c87702f1426736400e4feae1122e | 168 | sql | SQL | evo-X-Scriptdev2/sql/Updates/0.0.2/r769_mangos.sql | Gigelf-evo-X/evo-X | d0e68294d8cacfc7fb3aed5572f51d09a47136b9 | [
"OpenSSL"
] | 1 | 2019-01-19T06:35:40.000Z | 2019-01-19T06:35:40.000Z | src/bindings/Scriptdev2/sql/Updates/0.0.2/r769_mangos.sql | mfooo/wow | 3e5fad4cfdf0fd1c0a2fd7c9844e6f140a1bb32d | [
"OpenSSL"
] | null | null | null | src/bindings/Scriptdev2/sql/Updates/0.0.2/r769_mangos.sql | mfooo/wow | 3e5fad4cfdf0fd1c0a2fd7c9844e6f140a1bb32d | [
"OpenSSL"
] | null | null | null | UPDATE `creature_template` SET `ScriptName`='mob_phoenix_tk' WHERE `entry`=21362;
UPDATE `creature_template` SET `ScriptName`='mob_phoenix_egg_tk' WHERE `entry`=21364;
| 56 | 85 | 0.797619 |
39e0f6616a6d556347e3b229f6d72f79185f2648 | 637 | java | Java | src/main/java/no/bekk/bekkopen/banking/annotation/Kidnummer.java | kvangaball/NoCommons | 2326df3b095243e91b194a580d0f34ee9887873a | [
"MIT"
] | null | null | null | src/main/java/no/bekk/bekkopen/banking/annotation/Kidnummer.java | kvangaball/NoCommons | 2326df3b095243e91b194a580d0f34ee9887873a | [
"MIT"
] | null | null | null | src/main/java/no/bekk/bekkopen/banking/annotation/Kidnummer.java | kvangaball/NoCommons | 2326df3b095243e91b194a580d0f34ee9887873a | [
"MIT"
] | null | null | null | package no.bekk.bekkopen.banking.annotation;
import no.bekk.bekkopen.banking.KidnummerValidator;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target({METHOD, FIELD, ANNOTATION_TYPE})
@Retention(RUNTIME)
@Constraint(validatedBy = KidnummerValidator.class)
public @interface Kidnummer {
String message() default "Invalid KID";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
| 26.541667 | 59 | 0.77708 |
26fd16f93710d36c6b41e7cd8e55474d03cad0cc | 49 | sql | SQL | Emoji_Metadata/SQL/create/index/index_Emoji_id.sql | ZedTheLed/Emoji_Browser | 5d55d8db4897c39a46dff21742fd72288b4197ca | [
"MIT"
] | 2 | 2017-05-05T12:39:04.000Z | 2018-07-09T01:32:07.000Z | Emoji_Metadata/SQL/create/index/index_Emoji_id.sql | ZedTheLed/Emoji_Browser | 5d55d8db4897c39a46dff21742fd72288b4197ca | [
"MIT"
] | null | null | null | Emoji_Metadata/SQL/create/index/index_Emoji_id.sql | ZedTheLed/Emoji_Browser | 5d55d8db4897c39a46dff21742fd72288b4197ca | [
"MIT"
] | null | null | null | CREATE INDEX `index_Emoji_id` ON `Emoji` (`id` )
| 24.5 | 48 | 0.693878 |
2232df9c18b4f687c3d11790d3e2dc4c69680dd3 | 237 | asm | Assembly | samples/PEEKPOKE.asm | taisukef/asm15 | f717f78af1768eb1c6d5b50de3675a0e141b1514 | [
"CC0-1.0"
] | 3 | 2021-01-30T12:18:30.000Z | 2021-02-03T22:33:54.000Z | samples/PEEKPOKE.asm | taisukef/asm15 | f717f78af1768eb1c6d5b50de3675a0e141b1514 | [
"CC0-1.0"
] | null | null | null | samples/PEEKPOKE.asm | taisukef/asm15 | f717f78af1768eb1c6d5b50de3675a0e141b1514 | [
"CC0-1.0"
] | 1 | 2019-05-03T06:24:20.000Z | 2019-05-03T06:24:20.000Z | 'LET [0],AdrLow,AdrHigh:USR(#700,0):L=[2]:H=[3]
'peek
r0=8
r0=r0<<#8
r1=r1+r0
r0=[r1+#0] L
r0=[r0+#0] L
[r1+1]L=r0
ret
'[2]=L:[3]=H:LET [0],AdrLow,AdrHigh:USR(#70E,0)
'poke
r0=8
r0=r0<<#8
r1=r1+r0
r0=[r1+1] L
r1=[r1+0] L
[r1+0]L=r0
ret
| 11.85 | 47 | 0.565401 |
e8fc53ef376367f7c8b17273ac9b30e8bcf26788 | 4,981 | py | Python | scripts/mc_counting_same_origin.py | jonassagild/Track-to-Track-Fusion | 6bb7fbe6a6e2d9a2713c47f211899226485eee79 | [
"MIT"
] | 4 | 2021-06-16T19:33:56.000Z | 2022-03-14T06:47:41.000Z | scripts/mc_counting_same_origin.py | jonassagild/Track-to-Track-Fusion | 6bb7fbe6a6e2d9a2713c47f211899226485eee79 | [
"MIT"
] | 2 | 2021-06-08T16:18:45.000Z | 2021-11-25T09:38:08.000Z | scripts/mc_counting_same_origin.py | jonassagild/Track-to-Track-Fusion | 6bb7fbe6a6e2d9a2713c47f211899226485eee79 | [
"MIT"
] | 4 | 2020-09-28T04:54:17.000Z | 2021-10-15T15:58:38.000Z | """
script to run mc sims on the three associations techniques when the tracks origin are equal. Used to calculate the
total number of correctly associating tracks and total # falsly not associating tracks from the same target.
"""
import numpy as np
from stonesoup.types.state import GaussianState
from data_association.CountingAssociator import CountingAssociator
from data_association.bar_shalom_hypothesis_associators import HypothesisTestDependenceAssociator, \
HypothesisTestIndependenceAssociator
from trackers.kf_dependent_fusion_async_sensors import KalmanFilterDependentFusionAsyncSensors
from utils import open_object
from utils.scenario_generator import generate_scenario_3
start_seed = 0
end_seed = 5 # normally 500
num_mc_iterations = end_seed - start_seed
# params
save_fig = False
# scenario parameters
sigma_process_list = [0.3] # [0.05, 0.05, 0.05, 0.5, 0.5, 0.5, 3, 3, 3]
sigma_meas_radar_list = [50] # [5, 30, 200, 5, 30, 200, 5, 30, 200]
sigma_meas_ais_list = [10] # [10] * 9
radar_meas_rate = 1 # relevant radar meas rates: 1
ais_meas_rate_list = [6] # relevant AIS meas rates: 2 - 12
timesteps = 200
# associator params
association_distance_threshold = 10
consecutive_hits_confirm_association = 3
consecutive_misses_end_association = 2
# dicts to store final results for printing in a latex friendly way
Pc_overall = {} # Pc is the percentage of correctly associating tracks that originate from the same target
something_else_overall = {}
stats = []
for sigma_process, sigma_meas_radar, sigma_meas_ais, ais_meas_rate in zip(sigma_process_list, sigma_meas_radar_list,
sigma_meas_ais_list, ais_meas_rate_list):
for seed in range(start_seed, end_seed):
# generate scenario
generate_scenario_3(seed=seed, permanent_save=False, radar_meas_rate=radar_meas_rate,
ais_meas_rate=ais_meas_rate, sigma_process=sigma_process,
sigma_meas_radar=sigma_meas_radar, sigma_meas_ais=sigma_meas_ais,
timesteps=timesteps)
folder = "temp" # temp instead of seed, as it is not a permanent save
# load ground truth and the measurements
data_folder = "../scenarios/scenario3/" + folder + "/"
ground_truth = open_object.open_object(data_folder + "ground_truth.pk1")
measurements_radar = open_object.open_object(data_folder + "measurements_radar.pk1")
measurements_ais = open_object.open_object(data_folder + "measurements_ais.pk1")
# load start_time
start_time = open_object.open_object(data_folder + "start_time.pk1")
# prior
initial_covar = np.diag([sigma_meas_radar * sigma_meas_ais, sigma_meas_radar * sigma_process,
sigma_meas_radar * sigma_meas_ais, sigma_meas_radar * sigma_process]) ** 2
prior = GaussianState([1, 1.1, -1, 0.9], initial_covar, timestamp=start_time)
kf_dependent_fusion = KalmanFilterDependentFusionAsyncSensors(start_time, prior,
sigma_process_radar=sigma_process,
sigma_process_ais=sigma_process,
sigma_meas_radar=sigma_meas_radar,
sigma_meas_ais=sigma_meas_ais)
tracks_fused_dependent, tracks_radar, tracks_ais = kf_dependent_fusion.track_async(
start_time, measurements_radar, measurements_ais, fusion_rate=1)
# use the CountingAssociator to evaluate whether the tracks are associated
associator = CountingAssociator(association_distance_threshold, consecutive_hits_confirm_association,
consecutive_misses_end_association)
num_correct_associations = 0
num_false_mis_associations = 0
for i in range(1, len(tracks_radar)):
# use the associator to check the association
associated = associator.associate_tracks(tracks_radar[:i], tracks_ais[:i])
if associated:
num_correct_associations += 1
else:
num_false_mis_associations += 1
# save the number of correct associations and false mis associations in a dict
stats_individual = {'seed': seed, 'num_correct_associations': num_correct_associations,
'num_false_mis_associations': num_false_mis_associations}
stats.append(stats_individual)
# todo count the number of associations that turn out to be correct
# calc the #correct_associations and #false_mis_associations
tot_num_correct_associations = sum([stat['num_correct_associations'] for stat in stats])
tot_num_false_mis_associations = sum([stat['num_false_mis_associations'] for stat in stats])
print("")
| 49.81 | 116 | 0.682995 |
415d2834dc9dba1db926b4ee90f196d6ce31b7ed | 6,386 | c | C | Src/ESP_Weather.c | radii-dev/stm32-weather-api-example | 7ae98949089e5f389adf424aa4cb1e59759774b4 | [
"MIT"
] | null | null | null | Src/ESP_Weather.c | radii-dev/stm32-weather-api-example | 7ae98949089e5f389adf424aa4cb1e59759774b4 | [
"MIT"
] | null | null | null | Src/ESP_Weather.c | radii-dev/stm32-weather-api-example | 7ae98949089e5f389adf424aa4cb1e59759774b4 | [
"MIT"
] | null | null | null | /**
* Weather API test program.
*
* ESP_Weather.c
*
* MCU: STM32F103C8T6
* IDE: Keil uVision V5.29.0.0 & STM32CubeMX 5.6.0
* HCLK : 40 MHz
*
* Wifi Module : ESP8266-01
* AT version: 1.3.0.0
* SDK version: 2.0.0
*
* Copyright 2020 Gachon University, TAKE OUT, Development Group, electric engineering, Seongwook Kang.
*/
#include "ESP_Weather.h"
#include <string.h>
void getWeather(void) {
if (flags.system_Timeout == SYSTEM_TIMEOUT) {
rx_Buffer = 0;
tickStart = 0U;
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_12, GPIO_PIN_RESET);
if (flags.ESP_Init_Flag == ESP_INITIALIZE_DONE) {
connect_process = 0;
flags.ESP_Cipstart_Flag = ESP_CIPSTART_WAIT;
flags.ESP_Sendhttp_Flag = ESP_SENDHTTP_WAIT;
flags.ESP_Cipsend_Flag = ESP_CIPSEND_WAIT;
flags.Rx_Complete_Flag = Rx_COMPLETE_READY;
flags.system_Timeout = SYSTEM_OK;
}
else {
init_process = 0;
connect_process = 0;
memset(&flags, 0, sizeof(struct critical_Flag));
}
}
else {
if (flags.ESP_Init_Flag == ESP_INITIALIZE_DONE)
getTCPData();
else
ESP_init();
}
}
void AT_Command(char* cmdname) {
if (flags.Rx_Complete_Flag == Rx_COMPLETE_READY && matchingFlag(cmdname) == 0) {
tickStart = HAL_GetTick();
flags.Rx_Complete_Flag = Rx_COMPLETE_WAIT;
data_index = 0;
isComplete_length = 0;
for(int i = 0; rx_Data[i]; i++)
rx_Data[i] = 0;
for(int i = 0; isComplete[i]; i++)
isComplete[i] = 0;
cmd = matchingCmd(cmdname);
for(int i = 0; isComplete[i]; i++)
isComplete_length++;
uint8_t cnt = 0;
for(int i = 0; cmd[i]; i++)
cnt++;
HAL_UART_Transmit(&huart1, (uint8_t *)cmd, cnt, 15);
}
else {
if ((HAL_GetTick() - tickStart) > systemTimeout) {
flags.system_Timeout = SYSTEM_TIMEOUT;
}
}
}
uint8_t matchingFlag(char* cmd) {
if (strcmp(cmd, "resetSystem\0") == 0)
return flags.ESP_Rst_Flag;
else if (strcmp(cmd, "setWifimode\0") == 0)
return flags.ESP_Cwmode_Flag;
else if (strcmp(cmd, "connectWifi\0") == 0)
return flags.ESP_Cwjap_Flag;
else if (strcmp(cmd, "getIP\0") == 0)
return flags.ESP_Cifsr_Flag;
else if (strcmp(cmd, "startTCPConnection\0") == 0)
return flags.ESP_Cipstart_Flag;
else if (strcmp(cmd, "sendCmd\0") == 0)
return flags.ESP_Cipsend_Flag;
else if (strcmp(cmd, "sendHTTP\0") == 0)
return flags.ESP_Sendhttp_Flag;
else if (strcmp(cmd, "closeTCPConnection\0") == 0)
return flags.ESP_Cipclose_Flag;
}
char* matchingCmd(char* cmd) {
if (strcmp(cmd, "resetSystem\0") == 0) {
strcpy(isComplete, isComplete_resetSystem);
return resetSystem;
}
else if (strcmp(cmd, "setWifimode\0") == 0) {
strcpy(isComplete, isComplete_setWifimode);
return setWifimode;
}
else if (strcmp(cmd, "connectWifi\0") == 0) {
strcpy(isComplete, isComplete_connectWifi);
return connectWifi;
}
else if (strcmp(cmd, "getIP\0") == 0) {
strcpy(isComplete, isComplete_getIP);
return getIP;
}
else if (strcmp(cmd, "startTCPConnection\0") == 0) {
strcpy(isComplete, isComplete_startTCPConnection);
return startTCPConnection;
}
else if (strcmp(cmd, "sendCmd\0") == 0) {
strcpy(isComplete, isComplete_sendCmd);
return sendCmd;
}
else if (strcmp(cmd, "sendHTTP\0") == 0) {
strcpy(isComplete, isComplete_sendHTTP);
return sendHTTP;
}
else if (strcmp(cmd, "closeTCPConnection\0") == 0) {
strcpy(isComplete, isComplete_closeTCPConnection);
return closeTCPConnection;
}
else {
flags.system_Timeout = SYSTEM_TIMEOUT;
return 0;
}
}
void ESP_init(void) {
switch (init_process) {
case 0:
if (flags.ESP_Rst_Flag == ESP_RST_DONE)
init_process = 3;
else
AT_Command("resetSystem");
break;
/*
case 1:
if (flags.ESP_Cwmode_Flag == ESP_CWMODE_DONE)
init_process = 2;
else
AT_Command("setWifimode");
break;
case 2:
if (flags.ESP_Cwjap_Flag == ESP_CWJAP_DONE)
init_process = 3;
else
AT_Command("connectWifi");
break;
*/
case 3:
if (flags.ESP_Cifsr_Flag == ESP_CIFSR_DONE) {
flags.ESP_Init_Flag = ESP_INITIALIZE_DONE;
init_process = 4;
}
else{
flags.ESP_Cwmode_Flag = ESP_CWMODE_DONE;
flags.ESP_Cwjap_Flag = ESP_CWJAP_DONE;
AT_Command("getIP");
}
break;
}
}
void getTCPData(void) {
switch(connect_process) {
case 0:
if (flags.ESP_Cipstart_Flag == ESP_CIPSTART_DONE)
connect_process = 1;
else
AT_Command("startTCPConnection");
break;
case 1:
if (flags.ESP_Cipsend_Flag == ESP_CIPSEND_DONE) {
flags.ESP_Sendhttp_Flag = ESP_SENDHTTP_WAIT;
connect_process = 2;
}
else
AT_Command("sendCmd");
break;
case 2:
if (flags.ESP_Sendhttp_Flag == ESP_SENDHTTP_DONE){
HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_12);
flags.ESP_Cipsend_Flag = ESP_CIPSEND_WAIT;
connect_process = 1;
}
else {
AT_Command("sendHTTP");
HAL_Delay(period);
}
break;
/*
case 3:
if (flags.ESP_Cipclose_Flag == ESP_CIPCLOSE_DONE)
connect_process = 0;
else
AT_Command("closeTCPConnection");
break;
*/
}
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)
{
if (huart->Instance == USART1) {
HAL_UART_Receive_IT(&huart1, &rx_Buffer, 1);
rx_Data[data_index++] = rx_Buffer;
if (rx_Buffer == isComplete[receive_index])
receive_index++;
else
receive_index = 0;
if (receive_index >= isComplete_length) {
if (strcmp(isComplete, "OK\r\n") == 0) {
if (strcmp(cmd, setWifimode) == 0)
flags.ESP_Cwmode_Flag = ESP_CWMODE_DONE;
else if (strcmp(cmd, getIP) == 0)
flags.ESP_Cifsr_Flag = ESP_CIFSR_DONE;
else if (strcmp(cmd, startTCPConnection) == 0)
flags.ESP_Cipstart_Flag = ESP_CIPSTART_DONE;
else if (strcmp(cmd, closeTCPConnection) == 0)
flags.ESP_Cipclose_Flag = ESP_CIPCLOSE_DONE;
}
else if (strcmp(isComplete, "WIFI GOT IP\r\n") == 0) {
if (strcmp(cmd, resetSystem) == 0)
flags.ESP_Rst_Flag = ESP_RST_DONE;
else if (strcmp(cmd, connectWifi) == 0)
flags.ESP_Cwjap_Flag = ESP_CWJAP_DONE;
}
else if (strcmp(isComplete, isComplete_sendCmd) == 0) {
if (strcmp(cmd, sendCmd) == 0)
flags.ESP_Cipsend_Flag = ESP_CIPSEND_DONE;
}
else if (strcmp(isComplete, isComplete_sendHTTP) == 0) {
if (strcmp(cmd, sendHTTP) == 0)
flags.ESP_Sendhttp_Flag = ESP_SENDHTTP_DONE;
}
else if (strcmp(isComplete, isComplete_sendHTTP) == 0)
receive_index = 0;
flags.Rx_Complete_Flag = Rx_COMPLETE_READY;
}
}
}
| 26.065306 | 104 | 0.673974 |
ddbbb6ef9ac5128a4665d46a7ac4ea01695959ff | 194 | php | PHP | wp/index.php | ColbyCommunications/colby-svg | ed1096631534d88a06e396b0b3625823c315c728 | [
"MIT"
] | null | null | null | wp/index.php | ColbyCommunications/colby-svg | ed1096631534d88a06e396b0b3625823c315c728 | [
"MIT"
] | 6 | 2018-01-04T11:59:28.000Z | 2018-02-08T15:19:05.000Z | wp/index.php | ColbyCommunications/colby-svg | ed1096631534d88a06e396b0b3625823c315c728 | [
"MIT"
] | null | null | null | <?php
/**
* WordPress setup.
*
* @package colbycomms/colby-svg
*/
// Load the shortcode class if we're in a WP environment.
if ( defined( 'ABSPATH' ) ) {
new ColbyComms\SVG\Shortcode();
}
| 16.166667 | 57 | 0.649485 |
72a94f776d76d2534e84ba6dcba2b6816996135e | 2,738 | rs | Rust | src/examples.rs | aignas/git_prompt | 6547897d740ab375dbd23fd634049fc5e4c3cdf6 | [
"MIT"
] | 1 | 2019-10-02T16:16:25.000Z | 2019-10-02T16:16:25.000Z | src/examples.rs | aignas/git_prompt | 6547897d740ab375dbd23fd634049fc5e4c3cdf6 | [
"MIT"
] | 5 | 2018-12-08T15:02:12.000Z | 2018-12-26T17:46:40.000Z | src/examples.rs | aignas/git-prompt-rs | 6547897d740ab375dbd23fd634049fc5e4c3cdf6 | [
"MIT"
] | 1 | 2018-12-02T21:19:10.000Z | 2018-12-02T21:19:10.000Z | use super::model;
use super::view;
use std::fmt::{self, Display, Formatter};
use std::string::String;
pub fn all<'a>() -> Examples<'a> {
use git2::RepositoryState::{Clean, Rebase};
let master = Some("master".to_owned());
fn b(ahead: usize, behind: usize) -> Option<model::BranchStatus> {
Some(model::BranchStatus { ahead, behind })
}
fn s(staged: usize, unstaged: usize, unmerged: usize, untracked: usize) -> model::LocalStatus {
model::LocalStatus {
staged,
unstaged,
unmerged,
untracked,
..Default::default()
}
}
Examples::new()
.with("after 'git init'", None, Clean, None, s(0, 3, 0, 0))
.with("ok", master.clone(), Clean, b(0, 0), s(0, 0, 0, 0))
.with("stage", master.clone(), Clean, b(0, 0), s(3, 0, 0, 0))
.with("partial", master.clone(), Clean, b(0, 0), s(3, 12, 0, 0))
.with(
"conflicts",
Some("a83e2a3f".to_owned()),
Rebase,
b(0, 3),
s(0, 2, 1, 0),
)
.with("rebase", master.clone(), Rebase, b(0, 3), s(0, 3, 0, 0))
.with("diverged", master, Rebase, b(12, 3), s(0, 0, 0, 3))
}
pub struct Examples<'a> {
examples: std::collections::HashMap<String, view::Prompt<'a>>,
}
impl<'a> Examples<'a> {
pub fn new() -> Examples<'a> {
use std::collections::HashMap;
Examples {
examples: HashMap::new(),
}
}
fn with(
mut self,
key: &str,
br: Option<String>,
state: git2::RepositoryState,
branch: Option<model::BranchStatus>,
local: model::LocalStatus,
) -> Examples<'a> {
self.examples.insert(
key.to_string(),
view::Prompt::new(&model::RepoStatus { branch: br, state })
.with_branch(branch)
.with_local(Some(local)),
);
self
}
pub fn with_style(
mut self,
c: &'a view::Colors,
bs: &'a view::BranchSymbols,
ss: &'a view::StatusSymbols,
) -> Examples<'a> {
self.examples = self
.examples
.iter()
.map(|(l, p)| (l.to_owned(), p.with_style(c, bs, ss)))
.collect();
self
}
}
impl<'a> Display for Examples<'a> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
let max_length = self
.examples
.keys()
.map(String::len)
.max()
.expect("failed to get the maximum example key length");
self.examples.iter().for_each(|(l, p)| {
writeln!(f, "{0:>1$}: {2}", l, max_length, p).unwrap();
});
Ok(())
}
}
| 28.226804 | 99 | 0.490139 |
65062a372482addb49962017028cc1b94a652b86 | 4,604 | rs | Rust | src/process.rs | alopatindev/cargo-lim | f3793a66f5515b55b84da616f29ea51484aa49c5 | [
"Apache-2.0",
"MIT"
] | 79 | 2020-09-13T23:31:52.000Z | 2022-03-08T02:10:33.000Z | src/process.rs | alopatindev/cargo-lim | f3793a66f5515b55b84da616f29ea51484aa49c5 | [
"Apache-2.0",
"MIT"
] | 18 | 2020-09-14T00:56:42.000Z | 2021-10-19T18:47:55.000Z | src/process.rs | alopatindev/cargo-lim | f3793a66f5515b55b84da616f29ea51484aa49c5 | [
"Apache-2.0",
"MIT"
] | 3 | 2020-09-15T02:44:33.000Z | 2021-01-29T16:18:33.000Z | use crate::options::Options;
use anyhow::{Context, Result};
use atomig::{Atom, Atomic};
use getset::MutGetters;
use std::{
env, fmt,
path::PathBuf,
process::{Child, Command, Stdio},
sync::{atomic::Ordering, Arc},
thread,
time::Duration,
};
pub(crate) const CARGO_EXECUTABLE: &str = "cargo";
const CARGO_ENV_VAR: &str = "CARGO";
#[doc(hidden)]
pub const NO_EXIT_CODE: i32 = 127;
#[derive(Debug, MutGetters)]
pub struct CargoProcess {
#[get_mut = "pub"]
child: Child,
state: Arc<Atomic<State>>,
}
#[derive(Atom, Debug, Clone, Copy, PartialEq)]
#[repr(u8)]
pub enum State {
Running,
KillTimerStarted,
Killing,
NotRunning,
FailedToKill,
}
trait StateExt {
fn try_set_killing(&self) -> bool;
fn try_set_start_kill_timer(&self) -> bool;
fn set_not_running(&self);
fn force_set_not_running(&self);
fn set_failed_to_kill(&self);
fn transit(&self, current: State, new: State) -> bool;
}
impl CargoProcess {
pub fn run(options: &Options) -> Result<Self> {
let cargo_path = env::var(CARGO_ENV_VAR)
.map(PathBuf::from)
.ok()
.unwrap_or_else(|| PathBuf::from(CARGO_EXECUTABLE));
let error_text = failed_to_execute_error_text(&cargo_path);
let child = Command::new(cargo_path)
.args(options.all_args())
.stdout(Stdio::piped())
.spawn()
.context(error_text)?;
let state = Arc::new(Atomic::new(State::Running));
ctrlc::set_handler({
let pid = child.id();
let state = state.clone();
move || {
Self::kill(pid, state.clone());
}
})?;
Ok(Self { child, state })
}
pub fn wait(&mut self) -> Result<i32> {
let exit_status = self.child.wait()?;
self.state.force_set_not_running();
Ok(exit_status.code().unwrap_or(NO_EXIT_CODE))
}
pub fn wait_if_killing_is_in_progress(&self) -> State {
loop {
let state = self.state.load(Ordering::Acquire);
if state == State::Killing {
thread::yield_now();
} else {
break state;
}
}
}
pub fn kill_after_timeout(&self, time_limit: Duration) {
if self.state.try_set_start_kill_timer() {
thread::spawn({
let pid = self.child.id();
let state = self.state.clone();
move || {
thread::sleep(time_limit);
Self::kill(pid, state);
}
});
}
}
fn kill(pid: u32, state: Arc<Atomic<State>>) {
if state.try_set_killing() {
let success = {
#[cfg(unix)]
unsafe {
libc::kill(pid as libc::pid_t, libc::SIGINT) == 0
}
#[cfg(windows)]
{
use std::process::Output;
if let Ok(Output { stderr, .. }) = Command::new("taskkill")
.args(&["/PID", pid.to_string().as_str(), "/t"])
.output()
{
String::from_utf8_lossy(&stderr).starts_with("SUCCESS")
} else {
false
}
}
#[cfg(not(any(unix, windows)))]
compile_error!("this platform is unsupported");
};
if success {
state.set_not_running()
} else {
state.set_failed_to_kill()
}
}
}
}
impl StateExt for Arc<Atomic<State>> {
fn try_set_killing(&self) -> bool {
self.transit(State::Running, State::Killing)
|| self.transit(State::KillTimerStarted, State::Killing)
}
fn try_set_start_kill_timer(&self) -> bool {
self.transit(State::Running, State::KillTimerStarted)
}
fn set_not_running(&self) {
let _ = self.transit(State::Killing, State::NotRunning);
}
fn force_set_not_running(&self) {
self.store(State::NotRunning, Ordering::Release);
}
fn set_failed_to_kill(&self) {
let _ = self.transit(State::Killing, State::FailedToKill);
}
fn transit(&self, current: State, new: State) -> bool {
self.compare_exchange(current, new, Ordering::AcqRel, Ordering::Acquire)
.is_ok()
}
}
pub(crate) fn failed_to_execute_error_text<T: fmt::Debug>(app: T) -> String {
format!("failed to execute {:?}", app)
}
| 27.568862 | 80 | 0.524544 |
036bb3b370e901098d75536bb5166991858e07c4 | 99 | sql | SQL | microservicio/infraestructura/src/main/resources/sql/reserva/disponibilidadVehiculo.sql | je-west/alquilerCarrosJE | be4f028810737eab86c94791ce819b82c19c56c0 | [
"Apache-2.0"
] | null | null | null | microservicio/infraestructura/src/main/resources/sql/reserva/disponibilidadVehiculo.sql | je-west/alquilerCarrosJE | be4f028810737eab86c94791ce819b82c19c56c0 | [
"Apache-2.0"
] | null | null | null | microservicio/infraestructura/src/main/resources/sql/reserva/disponibilidadVehiculo.sql | je-west/alquilerCarrosJE | be4f028810737eab86c94791ce819b82c19c56c0 | [
"Apache-2.0"
] | null | null | null | select count(1) from reserva where vehiculo_id = :idVehiculo and fecha_fin_rerserva > :fechaInicio
| 49.5 | 98 | 0.818182 |
9b893091264fb5256efd5381c71e142337bc6aa8 | 6,515 | js | JavaScript | test/internal-command-specs.js | tcardoso2/vermon | 178a72913faf2992cf0fc2714b0362a71618ba7b | [
"BSD-2-Clause"
] | 1 | 2017-04-15T23:08:41.000Z | 2017-04-15T23:08:41.000Z | test/internal-command-specs.js | tcardoso2/vermon | 178a72913faf2992cf0fc2714b0362a71618ba7b | [
"BSD-2-Clause"
] | 7 | 2021-11-16T11:04:33.000Z | 2021-11-16T11:04:42.000Z | test/internal-command-specs.js | tcardoso2/t-motion-detector | 178a72913faf2992cf0fc2714b0362a71618ba7b | [
"BSD-2-Clause"
] | null | null | null | /*****************************************************
* Internal tests
* What are internal tests?
* As this is a npm package, it should be tested from
* a package context, so I'll use "interal" preffix
* for tests which are NOT using the npm tarball pack
* For all others, the test should obviously include
* something like:
* var md = require('vermon');
*****************************************************/
let chai = require('chai');
let chaiAsPromised = require("chai-as-promised");
let should = chai.should();
let expect = chai.expect();
let fs = require('fs');
let core = require('vermon-core-entities')
let ent = core.entities
let ext = core.extensions
let filters = core.filters
let main = require('../main.js');
let events = require('events');
var os = require('os');
var client = require('ssh2').Client;
before(function(done) {
done();
});
after(function(done) {
// here you can clear fixtures, etc.
main.Reset();
done();
});
describe("When a new Simple Command is created for an environment,", function() {
it('The first parameter (command) is required.', function (done) {
//Prepare
main.Reset();
try{
let env = new ext.SystemEnvironment();
} catch(e){
e.message.should.equal("ERROR: You must provide a command as the first argument.");
done();
return;
};
should.fail();
});
it('SystemEnvironment inherits type Environment.', function () {
//Prepare
main.Reset();
let env = new ext.SystemEnvironment("ls");
(env instanceof ent.Environment).should.equal(true);
});
it('SystemEnvironment should contain as currentState property: totalmem, freemem and cpus.', function (done) {
//Prepare
main.Reset();
let alternativeConfig = new main.Config("/test/config_test11.js");
let = _done = false;
main.StartWithConfig(alternativeConfig, (e, d, n, f)=>{
console.log("SystemEnvironment last State: ", e.currentState);
if(!_done)
{
_done = true;
e.currentState.cpus.should.equal(-1);
e.currentState.freemem.should.equal(-1);
e.currentState.totalmem.should.equal(-1);
done();
}
});
});
it('should be able to output the command line stdout, and provide info such as cpus used, freemem and totalmem', function (done) {
//Prepare
main.Reset();
let alternativeConfig = new main.Config("/test/config_test11.js");
main.StartWithConfig(alternativeConfig, (e, d, n, f)=>{
let = _done = false;
n[0].on('pushedNotification', function(message, text, data){
if(!_done)
{
_done = true;
//Contrary to Motion Detector Filters, Environment filters prevent state to change
data.newState.stdout.data.should.equal(process.cwd()+'\n');
data.newState.cpus.should.not.equal(undefined);
data.newState.freemem.should.not.equal(undefined);
data.newState.totalmem.should.not.equal(undefined);
done();
}
});
//Should send a signal right away
});
});
it('should allow defining an interval (ms) time period where values are being sent by the environment', function (done) {
//Prepare
main.Reset();
let alternativeConfig = new main.Config("/test/config_test12.js");
main.StartWithConfig(alternativeConfig, (e, d, n, f)=>{
let count = 0;
n[0].on('pushedNotification', function(message, text, data){
//Contrary to Motion Detector Filters, Environment filters prevent state to change
console.log(`Received notification, count is ${count}, freemem is ${data.newState.freemem}`);
data.newState.stdout.data.should.equal(process.cwd()+'\n');
count++;
if (count == 3)
{
done();
}
});
//Should send a signal right away
});
});
it('should notify if free memory goes below certain threshold', function (done) {
//Prepare
main.Reset();
let alternativeConfig = new main.Config("/test/config_test13.js");
main.StartWithConfig(alternativeConfig, (e, d, n, f)=>{
let _done = false;
n[0].on('pushedNotification', function(message, text, data){
if (!_done){
//Contrary to Motion Detector Filters, Environment filters prevent state to change
console.log("MEMORY:", data.newState.freemem);
(data.newState.freemem < 9900000000000).should.equal(true);
done();
_done = true;
}
});
//Should send a signal right away
});
});
it('it should not filter if the signal is not coming from the environment.', function (done) {
main.Reset();
let alternativeConfig = new main.Config("/test/config_test17.js");
main.StartWithConfig(alternativeConfig, (e, d, n, f)=>{
n[0].on('pushedNotification', function(message, text, data){
//Contrary to Motion Detector Filters, Environment filters prevent state to change
data.newState.should.equal(9);
done();
});
//Act
d[0].send(9, d[0]);
});
});
it('it should be able to filter for more than one detector.', function (done) {
main.Reset();
setTimeout(() => { done(); },1000);
let alternativeConfig = new main.Config("/test/config_test17.js");
main.StartWithConfig(alternativeConfig, (e, d, n, f)=>{
n[0].on('pushedNotification', function(message, text, data){
//Contrary to Motion Detector Filters, Environment filters prevent state to change
console.log(message, text, data);
should.fail();
});
//Will already send a value
});
});
it('should expose "Cmd" as a "node-cmd" object.', function (done) {
main.Reset();
main.Cmd.get(
'pwd',
function(err, data, stderr){
(err == null).should.equal(true);
stderr.should.equal('');
console.log('the current working dir is : ',data);
data.should.not.equal(null);
done();
}
);
});
it('should expose "Cli" as a "commander" object.', function (done) {
//Test command Must be run with --testcli argument for this test to pass
main.Reset();
main.Cli.version('0.1.0')
.option('-p, --testcli', 'test')
.option('-P, --pineapple', 'Add pineapple')
.option('-b, --bbq-sauce', 'Add bbq sauce')
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
.parse(process.argv);
console.log(main.Cli);
main.Cli.options.length.should.eql(5);
done();
});
}); | 35.601093 | 132 | 0.611358 |
e050d4324b83f1e7c6ac2fd77134178327b88fa1 | 3,110 | sql | SQL | Swordfish.Web/Swordfish.Database/dbo/Procedures/crud_ProspectCustomer.sql | tolgak/swordfish | 1308fcb257518dc0727a3d93090641c787bd32fe | [
"Unlicense"
] | 1 | 2015-07-05T21:01:46.000Z | 2015-07-05T21:01:46.000Z | Swordfish.Web/Swordfish.Database/dbo/Procedures/crud_ProspectCustomer.sql | tolgak/swordfish | 1308fcb257518dc0727a3d93090641c787bd32fe | [
"Unlicense"
] | null | null | null | Swordfish.Web/Swordfish.Database/dbo/Procedures/crud_ProspectCustomer.sql | tolgak/swordfish | 1308fcb257518dc0727a3d93090641c787bd32fe | [
"Unlicense"
] | null | null | null | /*
select 'if exists(select * from sys.objects where type = N''P'' and name = '''
+ cast(name as varchar) + ''')'
+ char(13) + char(10)
+ ' drop procedure '
+ cast(name as varchar)
from sys.objects where type = N'P'
*/
create procedure dbo.spProspectCustomer_List
as begin
set nocount on
select P.Id
, P.SmsNumber
, P.SupplierTypeId
, S.Name SupplierTypeName
, P.CityId
, C.Name CityName
, P.TownId
, T.Name TownName
, P.IsSubscribed
, P.UnsubscribeDate
, P.CreatedBy
, U.UserName
, P.CreatedDate
from ProspectCustomer P
inner join SupplierType S on S.Id = P.SupplierTypeId
inner join City C on C.Id = P.CityId
left join Town T on T.Id = P.TownId
left join AspNetUsers U on U.Id = P.CreatedBy
exit_Proc:
set nocount off
end
go
create procedure dbo.spProspectCustomer_PagedList
as begin
set nocount on
exit_Proc:
set nocount off
end
go
create procedure dbo.spProspectCustomer_GetById @id int
as begin
set nocount on
select P.Id
, P.SmsNumber
, P.SupplierTypeId
, S.Name SupplierTypeName
, P.CityId
, C.Name CityName
, P.TownId
, T.Name TownName
, P.IsSubscribed
, P.UnsubscribeDate
, P.CreatedBy
, U.UserName
, P.CreatedDate
from ProspectCustomer P
inner join SupplierType S on S.Id = P.SupplierTypeId
inner join City C on C.Id = P.CityId
left join Town T on T.Id = P.TownId
left join AspNetUsers U on U.Id = P.CreatedBy
where P.Id = @id
exit_Proc:
set nocount off
end
go
create procedure dbo.spProspectCustomer_Insert
@SmsNumber varchar(10), @SupplierTypeId int, @CityId int, @TownId int, @IsSubscribed bit, @UnsubscribeDate smalldatetime
, @CreatedBy nvarchar(128), @CreatedDate smalldatetime
as begin
set nocount on
insert into ProspectCustomer (SmsNumber, SupplierTypeId, CityId, TownId, IsSubscribed, UnsubscribeDate, CreatedBy, CreatedDate)
values (@SmsNumber, @SupplierTypeId, @CityId, @TownId, @IsSubscribed, @UnsubscribeDate, @CreatedBy, @CreatedDate)
exit_Proc:
set nocount off
end
go
create procedure dbo.spProspectCustomer_Update
@id int
, @SmsNumber varchar(10)
, @SupplierTypeId int
, @CityId int
, @TownId int
, @IsSubscribed bit
, @UnsubscribeDate smalldatetime
, @CreatedBy nvarchar(128)
, @CreatedDate smalldatetime
as begin
set nocount on
UPDATE [dbo].[ProspectCustomer]
SET [SmsNumber] = @SmsNumber
,[SupplierTypeId] = @SupplierTypeId
,[CityId] = @CityId
,[TownId] = @TownId
,[IsSubscribed] = @IsSubscribed
,[UnsubscribeDate] = @UnsubscribeDate
,[CreatedBy] = @CreatedBy
,[CreatedDate] = @CreatedDate
WHERE Id = @id
exit_Proc:
set nocount off
end
go
create procedure dbo.spProspectCustomer_Delete @id int
as begin
set nocount on
delete from ProspectCustomer where Id = @id
exit_Proc:
set nocount off
end
go
| 21.748252 | 129 | 0.648553 |
4719bdc5bea9b0dc7a46a09897f7107d1682ff4b | 1,782 | sql | SQL | persistence/sql/migrations/sql/20200830172221_recovery_token_expires.cockroach.down.sql | zzpu/ums | 81cd3a7cecac64b2e8536c80d3c81bfd3e32d9ac | [
"Apache-2.0"
] | 2 | 2020-09-27T04:03:24.000Z | 2020-09-28T00:36:59.000Z | persistence/sql/migrations/sql/20200830172221_recovery_token_expires.cockroach.down.sql | zzpu/ums | 81cd3a7cecac64b2e8536c80d3c81bfd3e32d9ac | [
"Apache-2.0"
] | null | null | null | persistence/sql/migrations/sql/20200830172221_recovery_token_expires.cockroach.down.sql | zzpu/ums | 81cd3a7cecac64b2e8536c80d3c81bfd3e32d9ac | [
"Apache-2.0"
] | 1 | 2021-06-10T00:48:55.000Z | 2021-06-10T00:48:55.000Z | DELETE FROM identity_recovery_tokens WHERE selfservice_recovery_flow_id IS NULL;
ALTER TABLE "identity_recovery_tokens" DROP CONSTRAINT "identity_recovery_tokens_selfservice_recovery_requests_id_fk";COMMIT TRANSACTION;BEGIN TRANSACTION;
DROP INDEX IF EXISTS "identity_recovery_tokens_auto_index_identity_recovery_tokens_selfservice_recovery_requests_id_fk";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "identity_recovery_tokens" RENAME COLUMN "selfservice_recovery_flow_id" TO "_selfservice_recovery_flow_id_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "identity_recovery_tokens" ADD COLUMN "selfservice_recovery_flow_id" UUID;COMMIT TRANSACTION;BEGIN TRANSACTION;
UPDATE "identity_recovery_tokens" SET "selfservice_recovery_flow_id" = "_selfservice_recovery_flow_id_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "identity_recovery_tokens" ALTER COLUMN "selfservice_recovery_flow_id" SET NOT NULL;COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "identity_recovery_tokens" DROP COLUMN "_selfservice_recovery_flow_id_tmp";COMMIT TRANSACTION;BEGIN TRANSACTION;
CREATE INDEX "identity_recovery_tokens_auto_index_identity_recovery_tokens_selfservice_recovery_requests_id_fk" ON "identity_recovery_tokens" (selfservice_recovery_flow_id);COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "identity_recovery_tokens" ADD CONSTRAINT "identity_recovery_tokens_selfservice_recovery_requests_id_fk" FOREIGN KEY ("selfservice_recovery_flow_id") REFERENCES "selfservice_recovery_flows" ("id") ON UPDATE NO ACTION ON DELETE CASCADE;COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "identity_recovery_tokens" DROP COLUMN "expires_at";COMMIT TRANSACTION;BEGIN TRANSACTION;
ALTER TABLE "identity_recovery_tokens" DROP COLUMN "issued_at";COMMIT TRANSACTION;BEGIN TRANSACTION; | 148.5 | 284 | 0.884961 |
d3053ee05f95426aff215a08fd91f1079fa4ee78 | 714 | swift | Swift | Sources/Modifiers/CornerRadiusModifier.swift | dragosmandu/Loophole | 8c75ede8d3fcd2ee53da1790b9b8372a2a373fdf | [
"MIT"
] | null | null | null | Sources/Modifiers/CornerRadiusModifier.swift | dragosmandu/Loophole | 8c75ede8d3fcd2ee53da1790b9b8372a2a373fdf | [
"MIT"
] | null | null | null | Sources/Modifiers/CornerRadiusModifier.swift | dragosmandu/Loophole | 8c75ede8d3fcd2ee53da1790b9b8372a2a373fdf | [
"MIT"
] | null | null | null | //
//
// Project Name: Thecircle
// Workspace: Loophole
// MacOS Version: 11.2
//
// File Name: CornerRadiusModifier.swift
// Creation: 4/9/21 6:01 PM
//
// Company: Thecircle LLC
// Contact: dev@thecircle.xyz
// Website: https://thecircle.xyz
// Author: Dragos-Costin Mandu
//
// Copyright © 2021 Thecircle LLC. All rights reserved.
//
//
import SwiftUI
struct CornerRadiusModifier: ViewModifier
{
private let cornerRadius: CGFloat
init(cornerRadius: CGFloat)
{
self.cornerRadius = cornerRadius
}
func body(content: Content) -> some View
{
content
.clipShape(RoundedRectangle(cornerRadius: cornerRadius, style: .continuous))
}
}
| 19.297297 | 88 | 0.64986 |
43cb7b1f11934623be4f5d400d489452852b7e20 | 382 | kt | Kotlin | androidApp/src/main/java/com/iamtravisjsmith/starwarskmm/android/person_details/PersonDetailsViewModelFactory.kt | travis-j-smith/StarWarsKMM | 7bbb07daa9cfb4eedfb856f354e563dde69b91f1 | [
"Apache-2.0"
] | null | null | null | androidApp/src/main/java/com/iamtravisjsmith/starwarskmm/android/person_details/PersonDetailsViewModelFactory.kt | travis-j-smith/StarWarsKMM | 7bbb07daa9cfb4eedfb856f354e563dde69b91f1 | [
"Apache-2.0"
] | null | null | null | androidApp/src/main/java/com/iamtravisjsmith/starwarskmm/android/person_details/PersonDetailsViewModelFactory.kt | travis-j-smith/StarWarsKMM | 7bbb07daa9cfb4eedfb856f354e563dde69b91f1 | [
"Apache-2.0"
] | null | null | null | package com.iamtravisjsmith.starwarskmm.android.person_details
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
//class PersonDetailsViewModelFactory(private val personId: Long) :
// ViewModelProvider.NewInstanceFactory() {
// override fun <T : ViewModel?> create(modelClass: Class<T>): T =
// PersonDetailsViewModel(personId) as T
//}
| 34.727273 | 69 | 0.777487 |
04c16033d755adef003f9431bf0ac98a4f12ff94 | 429 | java | Java | injecaoDeDependencia/src/main/java/fraga/luis/injecaoDeDependencia/model/Cat.java | luisfelipefraga/codigos-de-spring | 6b0334b8a3a889efdd8698e3fcc80acd9b6d10a8 | [
"MIT"
] | null | null | null | injecaoDeDependencia/src/main/java/fraga/luis/injecaoDeDependencia/model/Cat.java | luisfelipefraga/codigos-de-spring | 6b0334b8a3a889efdd8698e3fcc80acd9b6d10a8 | [
"MIT"
] | null | null | null | injecaoDeDependencia/src/main/java/fraga/luis/injecaoDeDependencia/model/Cat.java | luisfelipefraga/codigos-de-spring | 6b0334b8a3a889efdd8698e3fcc80acd9b6d10a8 | [
"MIT"
] | null | null | null | package fraga.luis.injecaoDeDependencia.model;
import fraga.luis.injecaoDeDependencia.interfaces.AnimalInterface;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
/**
* @author Luís Felipe
*/
@Component
@Qualifier("cat")
public class Cat implements AnimalInterface {
@Override
public void comunicar() {
System.out.println("Maiu MIAAU");
}
}
| 22.578947 | 66 | 0.762238 |
941551c8bb8e9ea32ea7220a39efb632cf19fedd | 48 | dart | Dart | lib/model/group.dart | k2wanko/taskshare-flutter | e10d7b6ab40141779f6871f4d7a9642df9b016f9 | [
"MIT"
] | 13 | 2018-07-14T07:30:46.000Z | 2020-07-31T05:53:23.000Z | lib/model/group.dart | k2wanko/taskshare-flutter | e10d7b6ab40141779f6871f4d7a9642df9b016f9 | [
"MIT"
] | null | null | null | lib/model/group.dart | k2wanko/taskshare-flutter | e10d7b6ab40141779f6871f4d7a9642df9b016f9 | [
"MIT"
] | 2 | 2019-10-09T17:54:14.000Z | 2019-10-31T04:58:04.000Z | class Group {
static const name = 'groups';
}
| 12 | 31 | 0.645833 |
d799e059163770b9a053f7b8b0895ccbdc6af685 | 685 | asm | Assembly | oeis/191/A191821.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/191/A191821.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/191/A191821.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A191821: a(n) = n*(2^n - n + 1) + 2^(n-1)*(n^2 - 3*n + 2).
; Submitted by Jamie Morken(s1)
; 2,6,26,100,332,994,2774,7368,18872,47014,114578,274300,647012,1507146,3473198,7929616,17956592,40369870,90177194,200277636,442498652,973078066,2130705926,4647288280,10099883432,21877489014,47244639554,101737037068,218506460372,468151434394,1000727379038,2134598745120,4544075398112,9655086480286,20478404066138,43361989819156,91671781964492,193514046487170,407918813903414,858718581291496,1805398092806552,3791116092569926,7951668092074226,16659800184060060,34867712740030532,72902018968057834
lpb $0
mul $1,2
add $2,$0
sub $0,1
add $1,2
lpe
mul $2,$1
add $2,$1
mov $0,$2
add $0,2
| 45.666667 | 495 | 0.789781 |
1cd46eda1c310920f5069d666762115f6b8c2b98 | 1,638 | sql | SQL | src/test/tinc/tincrepo/mpp/gpdb/tests/package/etablefunc_gppc/sql/query37.sql | lintzc/GPDB | b48c8b97da18f495c10065d0853db87960aebae2 | [
"PostgreSQL",
"Apache-2.0"
] | null | null | null | src/test/tinc/tincrepo/mpp/gpdb/tests/package/etablefunc_gppc/sql/query37.sql | lintzc/GPDB | b48c8b97da18f495c10065d0853db87960aebae2 | [
"PostgreSQL",
"Apache-2.0"
] | null | null | null | src/test/tinc/tincrepo/mpp/gpdb/tests/package/etablefunc_gppc/sql/query37.sql | lintzc/GPDB | b48c8b97da18f495c10065d0853db87960aebae2 | [
"PostgreSQL",
"Apache-2.0"
] | 1 | 2018-12-04T09:13:57.000Z | 2018-12-04T09:13:57.000Z | -- ETF can be called within following sub query expression:
-- IN/NOT IN, EXISTS / NOT EXISTS, ANY/SOME, ALL
-- ETF called in IN
SELECT * FROM t1 WHERE a IN (
SELECT b FROM transform(
TABLE(select a,e from t1
order by a
scatter randomly))
) AND a < 10 ORDER BY a, b;
-- ETF called in IN
SELECT * FROM t1 WHERE a NOT IN ( -- using NOT IN here
SELECT b FROM transform(
TABLE(select a,e from t1
order by a
scatter randomly))
) AND a < 10 ;
-- For EXISTS and NOT EXISTS
SELECT * FROM t1 WHERE EXISTS (
SELECT 1 FROM transform(
TABLE(select a,e from t1
order by a
scatter randomly))
) AND a < 10 ORDER BY a, b;
SELECT * FROM t1 WHERE NOT EXISTS (
SELECT 1 FROM transform(
TABLE(select a,e from t1
order by a
scatter randomly))
) AND a < 10 ;
-- For ANY/SOME
SELECT * FROM t1 WHERE a> ANY (
SELECT b FROM transform(
TABLE(select a,e from t1
where a>98
order by a
scatter randomly))
);
SELECT * FROM t1 WHERE a < SOME (
SELECT b FROM transform(
TABLE(select a,e from t1
where a<3
order by a
scatter randomly))
);
-- For ALL
SELECT * FROM t1 WHERE a > ALL (
SELECT b FROM transform(
TABLE(select a,e from t1
where a<98
order by a
scatter randomly))
) ORDER BY a;
| 26.852459 | 60 | 0.5 |
98c8a97362f42726c1e9f0c57faa7dc8aee56118 | 45,694 | html | HTML | docs/globals.html | OmgImAlexis/spread-the-word | 9b5f670972fb13405afedfa5059879560e59a5bc | [
"MIT"
] | null | null | null | docs/globals.html | OmgImAlexis/spread-the-word | 9b5f670972fb13405afedfa5059879560e59a5bc | [
"MIT"
] | null | null | null | docs/globals.html | OmgImAlexis/spread-the-word | 9b5f670972fb13405afedfa5059879560e59a5bc | [
"MIT"
] | null | null | null | <!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>spread-the-word</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="assets/js/search.js" data-base=".">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="index.html" class="title">spread-the-word</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
<input type="checkbox" id="tsd-filter-only-exported" />
<label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="globals.html">Globals</a>
</li>
</ul>
<h1>spread-the-word</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Classes</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-class"><a href="classes/a.html" class="tsd-kind-icon">A</a></li>
<li class="tsd-kind-class"><a href="classes/aaaa.html" class="tsd-kind-icon">AAAA</a></li>
<li class="tsd-kind-class"><a href="classes/listener.html" class="tsd-kind-icon">Listener</a></li>
<li class="tsd-kind-class"><a href="classes/localtransport.html" class="tsd-kind-icon">Local<wbr>Transport</a></li>
<li class="tsd-kind-class"><a href="classes/mdnstransport.html" class="tsd-kind-icon">MDNSTransport</a></li>
<li class="tsd-kind-class"><a href="classes/ptr.html" class="tsd-kind-icon">PTR</a></li>
<li class="tsd-kind-class"><a href="classes/query.html" class="tsd-kind-icon">Query</a></li>
<li class="tsd-kind-class"><a href="classes/question.html" class="tsd-kind-icon">Question</a></li>
<li class="tsd-kind-class"><a href="classes/record.html" class="tsd-kind-icon">Record</a></li>
<li class="tsd-kind-class"><a href="classes/recordregistry.html" class="tsd-kind-icon">Record<wbr>Registry</a></li>
<li class="tsd-kind-class"><a href="classes/referrer.html" class="tsd-kind-icon">Referrer</a></li>
<li class="tsd-kind-class"><a href="classes/remoteservice.html" class="tsd-kind-icon">Remote<wbr>Service</a></li>
<li class="tsd-kind-class"><a href="classes/response.html" class="tsd-kind-icon">Response</a></li>
<li class="tsd-kind-class"><a href="classes/srv.html" class="tsd-kind-icon">SRV</a></li>
<li class="tsd-kind-class"><a href="classes/server.html" class="tsd-kind-icon">Server</a></li>
<li class="tsd-kind-class"><a href="classes/service.html" class="tsd-kind-icon">Service</a></li>
<li class="tsd-kind-class"><a href="classes/spreadtheword.html" class="tsd-kind-icon">Spread<wbr>The<wbr>Word</a></li>
<li class="tsd-kind-class"><a href="classes/txt.html" class="tsd-kind-icon">TXT</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Interfaces</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-interface"><a href="interfaces/listeneroptions.html" class="tsd-kind-icon">Listener<wbr>Options</a></li>
<li class="tsd-kind-interface"><a href="interfaces/localtransportoptions.html" class="tsd-kind-icon">Local<wbr>Transport<wbr>Options</a></li>
<li class="tsd-kind-interface"><a href="interfaces/mdnsnameoptions.html" class="tsd-kind-icon">MDNSName<wbr>Options</a></li>
<li class="tsd-kind-interface"><a href="interfaces/queryoptions.html" class="tsd-kind-icon">Query<wbr>Options</a></li>
<li class="tsd-kind-interface"><a href="interfaces/referreroptions.html" class="tsd-kind-icon">Referrer<wbr>Options</a></li>
<li class="tsd-kind-interface"><a href="interfaces/responseoptions.html" class="tsd-kind-icon">Response<wbr>Options</a></li>
<li class="tsd-kind-interface"><a href="interfaces/serveroptions.html" class="tsd-kind-icon">Server<wbr>Options</a></li>
<li class="tsd-kind-interface"><a href="interfaces/serviceoptions.html" class="tsd-kind-icon">Service<wbr>Options</a></li>
<li class="tsd-kind-interface"><a href="interfaces/txtdata.html" class="tsd-kind-icon">TXTData</a></li>
<li class="tsd-kind-interface"><a href="interfaces/transport.html" class="tsd-kind-icon">Transport</a></li>
<li class="tsd-kind-interface"><a href="interfaces/transportoptions.html" class="tsd-kind-icon">Transport<wbr>Options</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Type aliases</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-type-alias"><a href="globals.html#addressrecord" class="tsd-kind-icon">Address<wbr>Record</a></li>
<li class="tsd-kind-type-alias"><a href="globals.html#datatype" class="tsd-kind-icon">Data<wbr>Type</a></li>
<li class="tsd-kind-type-alias"><a href="globals.html#recordtype" class="tsd-kind-icon">Record<wbr>Type</a></li>
<li class="tsd-kind-type-alias"><a href="globals.html#statustype" class="tsd-kind-icon">Status<wbr>Type</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Variables</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-variable"><a href="globals.html#reannounce_factor" class="tsd-kind-icon">REANNOUNCE_<wbr>FACTOR</a></li>
<li class="tsd-kind-variable"><a href="globals.html#reannounce_max_ms" class="tsd-kind-icon">REANNOUNCE_<wbr>MAX_<wbr>MS</a></li>
<li class="tsd-kind-variable"><a href="globals.html#requery_factor" class="tsd-kind-icon">REQUERY_<wbr>FACTOR</a></li>
<li class="tsd-kind-variable"><a href="globals.html#requery_max_ms" class="tsd-kind-icon">REQUERY_<wbr>MAX_<wbr>MS</a></li>
<li class="tsd-kind-variable"><a href="globals.html#top_level_domain" class="tsd-kind-icon">TOP_<wbr>LEVEL_<wbr>DOMAIN</a></li>
<li class="tsd-kind-variable"><a href="globals.html#wildcard" class="tsd-kind-icon">WILDCARD</a></li>
<li class="tsd-kind-variable"><a href="globals.html#debuglog" class="tsd-kind-icon">debug<wbr>Log</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Functions</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-function"><a href="globals.html#getexternaladdresses" class="tsd-kind-icon">get<wbr>External<wbr>Addresses</a></li>
<li class="tsd-kind-function"><a href="globals.html#parsednsname" class="tsd-kind-icon">parseDNSName</a></li>
<li class="tsd-kind-function"><a href="globals.html#parserecord" class="tsd-kind-icon">parse<wbr>Record</a></li>
<li class="tsd-kind-function"><a href="globals.html#parsetxtdata" class="tsd-kind-icon">parseTXTData</a></li>
<li class="tsd-kind-function"><a href="globals.html#samerecord" class="tsd-kind-icon">same<wbr>Record</a></li>
<li class="tsd-kind-function"><a href="globals.html#serializednsname" class="tsd-kind-icon">serializeDNSName</a></li>
<li class="tsd-kind-function"><a href="globals.html#serializerecord" class="tsd-kind-icon">serialize<wbr>Record</a></li>
<li class="tsd-kind-function"><a href="globals.html#serializetxtdata" class="tsd-kind-icon">serializeTXTData</a></li>
<li class="tsd-kind-function"><a href="globals.html#toplainobject" class="tsd-kind-icon">to<wbr>Plain<wbr>Object</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Type aliases</h2>
<section class="tsd-panel tsd-member tsd-kind-type-alias">
<a name="addressrecord" class="tsd-anchor"></a>
<h3>Address<wbr>Record</h3>
<div class="tsd-signature tsd-kind-icon">Address<wbr>Record<span class="tsd-signature-symbol">:</span> <a href="classes/a.html" class="tsd-signature-type">A</a><span class="tsd-signature-symbol"> | </span><a href="classes/aaaa.html" class="tsd-signature-type">AAAA</a></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/records/AddressRecord.ts#L4">src/records/AddressRecord.ts:4</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias">
<a name="datatype" class="tsd-anchor"></a>
<h3>Data<wbr>Type</h3>
<div class="tsd-signature tsd-kind-icon">Data<wbr>Type<span class="tsd-signature-symbol">:</span> <a href="interfaces/txtdata.html" class="tsd-signature-type">TXTData</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">Buffer</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/records/TXT.ts#L5">src/records/TXT.ts:5</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias">
<a name="recordtype" class="tsd-anchor"></a>
<h3>Record<wbr>Type</h3>
<div class="tsd-signature tsd-kind-icon">Record<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"TXT"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"A"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"AAAA"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"PTR"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"SRV"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"ANY"</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/records/Record.ts#L1">src/records/Record.ts:1</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-type-alias">
<a name="statustype" class="tsd-anchor"></a>
<h3>Status<wbr>Type</h3>
<div class="tsd-signature tsd-kind-icon">Status<wbr>Type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"uninitialized"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"spreaded"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"destroyed"</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/SpreadTheWord.ts#L9">src/SpreadTheWord.ts:9</a></li>
</ul>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Variables</h2>
<section class="tsd-panel tsd-member tsd-kind-variable">
<a name="reannounce_factor" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> REANNOUNCE_<wbr>FACTOR</h3>
<div class="tsd-signature tsd-kind-icon">REANNOUNCE_<wbr>FACTOR<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">3</span><span class="tsd-signature-symbol"> = 3</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/Constants.ts#L4">src/Constants.ts:4</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable">
<a name="reannounce_max_ms" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> REANNOUNCE_<wbr>MAX_<wbr>MS</h3>
<div class="tsd-signature tsd-kind-icon">REANNOUNCE_<wbr>MAX_<wbr>MS<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 60 * 60 * 1000</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/Constants.ts#L3">src/Constants.ts:3</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable">
<a name="requery_factor" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> REQUERY_<wbr>FACTOR</h3>
<div class="tsd-signature tsd-kind-icon">REQUERY_<wbr>FACTOR<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">1.5</span><span class="tsd-signature-symbol"> = 1.5</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/Constants.ts#L6">src/Constants.ts:6</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable">
<a name="requery_max_ms" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> REQUERY_<wbr>MAX_<wbr>MS</h3>
<div class="tsd-signature tsd-kind-icon">REQUERY_<wbr>MAX_<wbr>MS<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> = 60 * 60 * 1000</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/Constants.ts#L5">src/Constants.ts:5</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable">
<a name="top_level_domain" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> TOP_<wbr>LEVEL_<wbr>DOMAIN</h3>
<div class="tsd-signature tsd-kind-icon">TOP_<wbr>LEVEL_<wbr>DOMAIN<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"local"</span><span class="tsd-signature-symbol"> = "local"</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/Constants.ts#L1">src/Constants.ts:1</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable">
<a name="wildcard" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> WILDCARD</h3>
<div class="tsd-signature tsd-kind-icon">WILDCARD<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> = "_services._dns-sd._udp." + TOP_LEVEL_DOMAIN</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/Constants.ts#L2">src/Constants.ts:2</a></li>
</ul>
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-variable">
<a name="debuglog" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagConst">Const</span> debug<wbr>Log</h3>
<div class="tsd-signature tsd-kind-icon">debug<wbr>Log<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">IDebugger</span><span class="tsd-signature-symbol"> = debug("SpreadTheWord:Listener")</span></div>
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/records/TXT.ts#L7">src/records/TXT.ts:7</a></li>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/Service.ts#L12">src/Service.ts:12</a></li>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/Server.ts#L12">src/Server.ts:12</a></li>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/Listener.ts#L15">src/Listener.ts:15</a></li>
</ul>
</aside>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Functions</h2>
<section class="tsd-panel tsd-member tsd-kind-function">
<a name="getexternaladdresses" class="tsd-anchor"></a>
<h3>get<wbr>External<wbr>Addresses</h3>
<ul class="tsd-signatures tsd-kind-function">
<li class="tsd-signature tsd-kind-icon">get<wbr>External<wbr>Addresses<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">{ </span>address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>family<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/MDNSUtil.ts#L72">src/MDNSUtil.ts:72</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-symbol">{ </span>address<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">; </span>family<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">[]</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function">
<a name="parsednsname" class="tsd-anchor"></a>
<h3>parseDNSName</h3>
<ul class="tsd-signatures tsd-kind-function">
<li class="tsd-signature tsd-kind-icon">parseDNSName<span class="tsd-signature-symbol">(</span>dnsName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="interfaces/mdnsnameoptions.html" class="tsd-signature-type">MDNSNameOptions</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/MDNSUtil.ts#L34">src/MDNSUtil.ts:34</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>dnsName: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="interfaces/mdnsnameoptions.html" class="tsd-signature-type">MDNSNameOptions</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function">
<a name="parserecord" class="tsd-anchor"></a>
<h3>parse<wbr>Record</h3>
<ul class="tsd-signatures tsd-kind-function">
<li class="tsd-signature tsd-kind-icon">parse<wbr>Record<span class="tsd-signature-symbol">(</span>record<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>binaryTXT<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="classes/a.html" class="tsd-signature-type">A</a><span class="tsd-signature-symbol"> | </span><a href="classes/txt.html" class="tsd-signature-type">TXT</a><span class="tsd-signature-symbol"> | </span><a href="classes/srv.html" class="tsd-signature-type">SRV</a><span class="tsd-signature-symbol"> | </span><a href="classes/ptr.html" class="tsd-signature-type">PTR</a><span class="tsd-signature-symbol"> | </span><a href="classes/aaaa.html" class="tsd-signature-type">AAAA</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/MDNSUtil.ts#L91">src/MDNSUtil.ts:91</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>record: <span class="tsd-signature-type">any</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-symbol">{ </span>binaryTXT<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = {}</span></h5>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5><span class="tsd-flag ts-flagOptional">Optional</span> binaryTXT<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5>
</li>
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="classes/a.html" class="tsd-signature-type">A</a><span class="tsd-signature-symbol"> | </span><a href="classes/txt.html" class="tsd-signature-type">TXT</a><span class="tsd-signature-symbol"> | </span><a href="classes/srv.html" class="tsd-signature-type">SRV</a><span class="tsd-signature-symbol"> | </span><a href="classes/ptr.html" class="tsd-signature-type">PTR</a><span class="tsd-signature-symbol"> | </span><a href="classes/aaaa.html" class="tsd-signature-type">AAAA</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function">
<a name="parsetxtdata" class="tsd-anchor"></a>
<h3>parseTXTData</h3>
<ul class="tsd-signatures tsd-kind-function">
<li class="tsd-signature tsd-kind-icon">parseTXTData<span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Buffer</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>binary<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="interfaces/txtdata.html" class="tsd-signature-type">TXTData</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/MDNSUtil.ts#L115">src/MDNSUtil.ts:115</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>data: <span class="tsd-signature-type">Buffer</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-symbol">{ </span>binary<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = { binary: false }</span></h5>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5><span class="tsd-flag ts-flagOptional">Optional</span> binary<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5>
</li>
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="interfaces/txtdata.html" class="tsd-signature-type">TXTData</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function">
<a name="samerecord" class="tsd-anchor"></a>
<h3>same<wbr>Record</h3>
<ul class="tsd-signatures tsd-kind-function">
<li class="tsd-signature tsd-kind-icon">same<wbr>Record<span class="tsd-signature-symbol">(</span>a<span class="tsd-signature-symbol">: </span><a href="classes/record.html" class="tsd-signature-type">Record</a>, b<span class="tsd-signature-symbol">: </span><a href="classes/record.html" class="tsd-signature-type">Record</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/MDNSUtil.ts#L62">src/MDNSUtil.ts:62</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>a: <a href="classes/record.html" class="tsd-signature-type">Record</a></h5>
</li>
<li>
<h5>b: <a href="classes/record.html" class="tsd-signature-type">Record</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function">
<a name="serializednsname" class="tsd-anchor"></a>
<h3>serializeDNSName</h3>
<ul class="tsd-signatures tsd-kind-function">
<li class="tsd-signature tsd-kind-icon">serializeDNSName<span class="tsd-signature-symbol">(</span>options<span class="tsd-signature-symbol">: </span><a href="interfaces/mdnsnameoptions.html" class="tsd-signature-type">MDNSNameOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/MDNSUtil.ts#L18">src/MDNSUtil.ts:18</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>options: <a href="interfaces/mdnsnameoptions.html" class="tsd-signature-type">MDNSNameOptions</a></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function">
<a name="serializerecord" class="tsd-anchor"></a>
<h3>serialize<wbr>Record</h3>
<ul class="tsd-signatures tsd-kind-function">
<li class="tsd-signature tsd-kind-icon">serialize<wbr>Record<span class="tsd-signature-symbol">(</span>record<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>binaryTXT<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="classes/a.html" class="tsd-signature-type">A</a><span class="tsd-signature-symbol"> | </span><a href="classes/txt.html" class="tsd-signature-type">TXT</a><span class="tsd-signature-symbol"> | </span><a href="classes/srv.html" class="tsd-signature-type">SRV</a><span class="tsd-signature-symbol"> | </span><a href="classes/ptr.html" class="tsd-signature-type">PTR</a><span class="tsd-signature-symbol"> | </span><a href="classes/aaaa.html" class="tsd-signature-type">AAAA</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/MDNSUtil.ts#L101">src/MDNSUtil.ts:101</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>record: <span class="tsd-signature-type">any</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-symbol">{ </span>binaryTXT<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = {}</span></h5>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5><span class="tsd-flag ts-flagOptional">Optional</span> binaryTXT<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5>
</li>
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="classes/a.html" class="tsd-signature-type">A</a><span class="tsd-signature-symbol"> | </span><a href="classes/txt.html" class="tsd-signature-type">TXT</a><span class="tsd-signature-symbol"> | </span><a href="classes/srv.html" class="tsd-signature-type">SRV</a><span class="tsd-signature-symbol"> | </span><a href="classes/ptr.html" class="tsd-signature-type">PTR</a><span class="tsd-signature-symbol"> | </span><a href="classes/aaaa.html" class="tsd-signature-type">AAAA</a></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function">
<a name="serializetxtdata" class="tsd-anchor"></a>
<h3>serializeTXTData</h3>
<ul class="tsd-signatures tsd-kind-function">
<li class="tsd-signature tsd-kind-icon">serializeTXTData<span class="tsd-signature-symbol">(</span>data<span class="tsd-signature-symbol">: </span><a href="interfaces/txtdata.html" class="tsd-signature-type">TXTData</a>, options<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{ </span>binary<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Buffer</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/MDNSUtil.ts#L120">src/MDNSUtil.ts:120</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>data: <a href="interfaces/txtdata.html" class="tsd-signature-type">TXTData</a></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <span class="tsd-signature-symbol">{ </span>binary<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> }</span><span class="tsd-signature-symbol"> = { binary: false }</span></h5>
<ul class="tsd-parameters">
<li class="tsd-parameter">
<h5><span class="tsd-flag ts-flagOptional">Optional</span> binary<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5>
</li>
</ul>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Buffer</span></h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-function">
<a name="toplainobject" class="tsd-anchor"></a>
<h3>to<wbr>Plain<wbr>Object</h3>
<ul class="tsd-signatures tsd-kind-function">
<li class="tsd-signature tsd-kind-icon">to<wbr>Plain<wbr>Object<span class="tsd-signature-symbol">(</span>instance<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ardean/spread-the-word/blob/3182d02/src/transports/LocalTransport.ts#L68">src/transports/LocalTransport.ts:68</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>instance: <span class="tsd-signature-type">any</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="globals current ">
<a href="globals.html"><em>Globals</em></a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-class">
<a href="classes/a.html" class="tsd-kind-icon">A</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/aaaa.html" class="tsd-kind-icon">AAAA</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/listener.html" class="tsd-kind-icon">Listener</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/localtransport.html" class="tsd-kind-icon">Local<wbr>Transport</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/mdnstransport.html" class="tsd-kind-icon">MDNSTransport</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/ptr.html" class="tsd-kind-icon">PTR</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/query.html" class="tsd-kind-icon">Query</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/question.html" class="tsd-kind-icon">Question</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/record.html" class="tsd-kind-icon">Record</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/recordregistry.html" class="tsd-kind-icon">Record<wbr>Registry</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/referrer.html" class="tsd-kind-icon">Referrer</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/remoteservice.html" class="tsd-kind-icon">Remote<wbr>Service</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/response.html" class="tsd-kind-icon">Response</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/srv.html" class="tsd-kind-icon">SRV</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/server.html" class="tsd-kind-icon">Server</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/service.html" class="tsd-kind-icon">Service</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/spreadtheword.html" class="tsd-kind-icon">Spread<wbr>The<wbr>Word</a>
</li>
<li class=" tsd-kind-class">
<a href="classes/txt.html" class="tsd-kind-icon">TXT</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/listeneroptions.html" class="tsd-kind-icon">Listener<wbr>Options</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/localtransportoptions.html" class="tsd-kind-icon">Local<wbr>Transport<wbr>Options</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/mdnsnameoptions.html" class="tsd-kind-icon">MDNSName<wbr>Options</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/queryoptions.html" class="tsd-kind-icon">Query<wbr>Options</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/referreroptions.html" class="tsd-kind-icon">Referrer<wbr>Options</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/responseoptions.html" class="tsd-kind-icon">Response<wbr>Options</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/serveroptions.html" class="tsd-kind-icon">Server<wbr>Options</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/serviceoptions.html" class="tsd-kind-icon">Service<wbr>Options</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/txtdata.html" class="tsd-kind-icon">TXTData</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/transport.html" class="tsd-kind-icon">Transport</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/transportoptions.html" class="tsd-kind-icon">Transport<wbr>Options</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="globals.html#addressrecord" class="tsd-kind-icon">Address<wbr>Record</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="globals.html#datatype" class="tsd-kind-icon">Data<wbr>Type</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="globals.html#recordtype" class="tsd-kind-icon">Record<wbr>Type</a>
</li>
<li class=" tsd-kind-type-alias">
<a href="globals.html#statustype" class="tsd-kind-icon">Status<wbr>Type</a>
</li>
<li class=" tsd-kind-variable">
<a href="globals.html#reannounce_factor" class="tsd-kind-icon">REANNOUNCE_<wbr>FACTOR</a>
</li>
<li class=" tsd-kind-variable">
<a href="globals.html#reannounce_max_ms" class="tsd-kind-icon">REANNOUNCE_<wbr>MAX_<wbr>MS</a>
</li>
<li class=" tsd-kind-variable">
<a href="globals.html#requery_factor" class="tsd-kind-icon">REQUERY_<wbr>FACTOR</a>
</li>
<li class=" tsd-kind-variable">
<a href="globals.html#requery_max_ms" class="tsd-kind-icon">REQUERY_<wbr>MAX_<wbr>MS</a>
</li>
<li class=" tsd-kind-variable">
<a href="globals.html#top_level_domain" class="tsd-kind-icon">TOP_<wbr>LEVEL_<wbr>DOMAIN</a>
</li>
<li class=" tsd-kind-variable">
<a href="globals.html#wildcard" class="tsd-kind-icon">WILDCARD</a>
</li>
<li class=" tsd-kind-variable">
<a href="globals.html#debuglog" class="tsd-kind-icon">debug<wbr>Log</a>
</li>
<li class=" tsd-kind-function">
<a href="globals.html#getexternaladdresses" class="tsd-kind-icon">get<wbr>External<wbr>Addresses</a>
</li>
<li class=" tsd-kind-function">
<a href="globals.html#parsednsname" class="tsd-kind-icon">parseDNSName</a>
</li>
<li class=" tsd-kind-function">
<a href="globals.html#parserecord" class="tsd-kind-icon">parse<wbr>Record</a>
</li>
<li class=" tsd-kind-function">
<a href="globals.html#parsetxtdata" class="tsd-kind-icon">parseTXTData</a>
</li>
<li class=" tsd-kind-function">
<a href="globals.html#samerecord" class="tsd-kind-icon">same<wbr>Record</a>
</li>
<li class=" tsd-kind-function">
<a href="globals.html#serializednsname" class="tsd-kind-icon">serializeDNSName</a>
</li>
<li class=" tsd-kind-function">
<a href="globals.html#serializerecord" class="tsd-kind-icon">serialize<wbr>Record</a>
</li>
<li class=" tsd-kind-function">
<a href="globals.html#serializetxtdata" class="tsd-kind-icon">serializeTXTData</a>
</li>
<li class=" tsd-kind-function">
<a href="globals.html#toplainobject" class="tsd-kind-icon">to<wbr>Plain<wbr>Object</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer>
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
<ul class="tsd-legend">
<li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li>
<li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li>
<li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
<li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
<li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
<li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li>
<li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li>
<li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li>
<li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li>
<li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
<li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
<li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li>
<li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li>
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
<li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li>
<li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li>
</ul>
</div>
</div>
</footer>
<div class="overlay"></div>
<script src="assets/js/main.js"></script>
<script>if (location.protocol == 'file:') document.write('<script src="assets/js/search.js"><' + '/script>');</script>
</body>
</html> | 62.423497 | 1,020 | 0.651267 |
331d90c240056dc40d2894ad9cce53ebe9c791c5 | 4,001 | py | Python | gdrivefs-0.14.9-py3.6.egg/gdrivefs/utility.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | gdrivefs-0.14.9-py3.6.egg/gdrivefs/utility.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | gdrivefs-0.14.9-py3.6.egg/gdrivefs/utility.py | EnjoyLifeFund/macHighSierra-py36-pkgs | 5668b5785296b314ea1321057420bcd077dba9ea | [
"BSD-3-Clause",
"BSD-2-Clause",
"MIT"
] | null | null | null | import logging
import json
import re
import sys
import gdrivefs.conf
_logger = logging.getLogger(__name__)
# TODO(dustin): Make these individual functions.
class _DriveUtility(object):
"""General utility functions loosely related to GD."""
# # Mime-types to translate to, if they appear within the "exportLinks" list.
# gd_to_normal_mime_mappings = {
# 'application/vnd.google-apps.document':
# 'text/plain',
# 'application/vnd.google-apps.spreadsheet':
# 'application/vnd.ms-excel',
# 'application/vnd.google-apps.presentation':
#/gd_to_normal_mime_mappings
# 'application/vnd.ms-powerpoint',
# 'application/vnd.google-apps.drawing':
# 'application/pdf',
# 'application/vnd.google-apps.audio':
# 'audio/mpeg',
# 'application/vnd.google-apps.photo':
# 'image/png',
# 'application/vnd.google-apps.video':
# 'video/x-flv'
# }
# Default extensions for mime-types.
# TODO(dustin): !! Move this to the config directory.
default_extensions = {
'text/plain': 'txt',
'application/vnd.ms-excel': 'xls',
'application/vnd.ms-powerpoint': 'ppt',
'application/pdf': 'pdf',
'audio/mpeg': 'mp3',
'image/png': 'png',
'video/x-flv': 'flv'
}
local_character_set = sys.getfilesystemencoding()
def __init__(self):
self.__load_mappings()
def __load_mappings(self):
# Allow someone to override our default mappings of the GD types.
# TODO(dustin): Isn't actually used, so commenting.
# gd_to_normal_mapping_filepath = \
# gdrivefs.conf.Conf.get('gd_to_normal_mapping_filepath')
#
# try:
# with open(gd_to_normal_mapping_filepath, 'r') as f:
# self.gd_to_normal_mime_mappings.extend(json.load(f))
# except IOError:
# _logger.info("No mime-mapping was found.")
# Allow someone to set file-extensions for mime-types, and not rely on
# Python's educated guesses.
extension_mapping_filepath = \
gdrivefs.conf.Conf.get('extension_mapping_filepath')
try:
with open(extension_mapping_filepath, 'r') as f:
self.default_extensions.extend(json.load(f))
except IOError:
_logger.info("No extension-mapping was found.")
def get_first_mime_type_by_extension(self, extension):
found = [
mime_type
for mime_type, temp_extension
in self.default_extensions.items()
if temp_extension == extension
]
if not found:
return None
return found[0]
def translate_filename_charset(self, original_filename):
"""Convert the given filename to the correct character set."""
# fusepy doesn't support the Python 2.x Unicode type. Expect a native
# string (anything but a byte string).
return original_filename
# # If we're in an older version of Python that still defines the Unicode
# # class and the filename isn't unicode, translate it.
#
# try:
# sys.modules['__builtin__'].unicode
# except AttributeError:
# pass
# else:
# if issubclass(original_filename.__class__, unicode) is False:
# return unicode(original_filename)#original_filename.decode(self.local_character_set)
#
# # It's already unicode. Don't do anything.
# return original_filename
def make_safe_for_filename(self, text):
"""Remove any filename-invalid characters."""
return re.sub('[^a-z0-9\-_\.]+', '', text)
utility = _DriveUtility()
| 33.90678 | 101 | 0.579355 |
5a3eedbd6f7d8a52c56d80a432e10e4ba036129d | 337 | sql | SQL | 09. Exam Prep/01. Exam - 22 October 2017/12. Birthday Report/Birthday Report.sql | pirocorp/Databases-Basics-MS-SQL-Server | 2049499b2b8f7d011be79abc0b326486258e4d0a | [
"MIT"
] | null | null | null | 09. Exam Prep/01. Exam - 22 October 2017/12. Birthday Report/Birthday Report.sql | pirocorp/Databases-Basics-MS-SQL-Server | 2049499b2b8f7d011be79abc0b326486258e4d0a | [
"MIT"
] | null | null | null | 09. Exam Prep/01. Exam - 22 October 2017/12. Birthday Report/Birthday Report.sql | pirocorp/Databases-Basics-MS-SQL-Server | 2049499b2b8f7d011be79abc0b326486258e4d0a | [
"MIT"
] | null | null | null | SELECT DISTINCT c.[Name] AS [Category Name]
FROM Reports AS r
JOIN Users AS u
ON u.Id = r.UserId
JOIN Categories AS c
ON c.Id = r.CategoryId
WHERE DAY(r.OpenDate) = DAY(u.BirthDate)
AND MONTH(r.OpenDate) = MONTH(u.BirthDate)
ORDER BY [Category Name] | 37.444444 | 54 | 0.548961 |
cd4b5b4d3a4c23aaa0c1b4fb681dcae0b622421b | 958 | asm | Assembly | data/phone/text/beverly_overworld.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 28 | 2019-11-08T07:19:00.000Z | 2021-12-20T10:17:54.000Z | data/phone/text/beverly_overworld.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 13 | 2020-01-11T17:00:40.000Z | 2021-09-14T01:27:38.000Z | data/phone/text/beverly_overworld.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | 22 | 2020-05-28T17:31:38.000Z | 2022-03-07T20:49:35.000Z | BeverlyAskNumber1Text:
text "Your MARILL is so"
line "cute and adorable!"
para "You love #MON"
line "just like I do!"
para "Want to trade"
line "phone numbers?"
para "Let's chat! It'll"
line "be so much fun!"
done
BeverlyAskNumber2Text:
text "Your MARILL is so"
line "cute and adorable!"
para "We should chat, it"
line "will be fun."
para "Can I have your"
line "phone number?"
done
BeverlyNumberAcceptedText:
text "To be honest, I"
line "want a MARILL."
para "But I make do with"
line "my cute SNUBBULL."
done
BeverlyNumberDeclinedText:
text "Oh… That's"
line "disappointing…"
para "Goodbye, MARILL…"
done
BeverlyPhoneFullText:
text "Oh? Your phone's"
line "memory is full."
done
BeverlyGiftText:
text "Oh? <PLAYER>? "
line "I waited here for"
para "you. I brought you"
line "a little gift."
done
BeverlyPackFullText:
text "Oh?"
line "You have no room."
para "Please come back"
line "for it later."
done
| 15.704918 | 26 | 0.691023 |
0bfc1a9f915fb0bec765afefe90d2d2257dac1cc | 71,710 | js | JavaScript | appserver/static/components/pages/showcase_simple_search.js | ericsix-splunk/Splunk_Essentials_For_Telco | 95f160c5e01f06078934e8aee86b956edb9e720c | [
"Apache-2.0",
"CC0-1.0"
] | 2 | 2019-02-12T09:17:24.000Z | 2021-04-23T19:06:07.000Z | appserver/static/components/pages/showcase_simple_search.js | ericsix-splunk/Splunk_Essentials_For_Telco | 95f160c5e01f06078934e8aee86b956edb9e720c | [
"Apache-2.0",
"CC0-1.0"
] | null | null | null | appserver/static/components/pages/showcase_simple_search.js | ericsix-splunk/Splunk_Essentials_For_Telco | 95f160c5e01f06078934e8aee86b956edb9e720c | [
"Apache-2.0",
"CC0-1.0"
] | null | null | null | "use strict";
/* This ultimately belongs in a separate file...*/
require(['jquery', 'splunkjs/mvc/simplexml/controller', 'components/controls/Modal'], function($, DashboardController, Modal) {
var triggerModal = function(bodycontent) {
var myModal = new Modal('MyModalID-irrelevant-unless-you-want-many', {
title: 'Find Out More',
destroyOnHide: true,
type: 'wide'
});
$(myModal.$el).on("hide", function() {
// Not taking any action on hide, but you can if you want to!
})
myModal.body.addClass('mlts-modal-form-inline')
.append($(bodycontent));
myModal.footer.append($('<button>').addClass('mlts-modal-submit').attr({
type: 'button',
'data-dismiss': 'modal'
}).addClass('btn btn-primary mlts-modal-submit').text('Close').on('click', function() {
// Not taking any action on Close... but I could!
}))
myModal.show(); // Launch it!
}
window.triggerModal = triggerModal
})
/* END This ultimately belongs in a separate file...*/
var _templateObject = _taggedTemplateLiteral(["| loadjob $searchBarSearchJobIdToken$\n | head 1\n | transpose\n | fields column\n | search column != \"column\" AND column != \"_*\""], ["| loadjob $searchBarSearchJobIdToken$\n | head 1\n | transpose\n | fields column\n | search column != \"column\" AND column != \"_*\""]),
_templateObject2 = _taggedTemplateLiteral(["| inputlookup ", "_lookup\n | eval Actions=actions\n | eval \"Search query\" = search_query,\n \"Field to analyze\" = outlier_variable,\n \"Threshold method\" = threshold_method,\n \"Threshold multiplier\" = threshold_multiplier,\n \"Sliding window\" = window_size,\n \"Include current point\" = if(use_current_point == \"0\", \"false\", \"true\"),\n \"# of outliers\" = outliers_count"], ["| inputlookup ", "_lookup\n | eval Actions=actions\n | eval \"Search query\" = search_query,\n \"Field to analyze\" = outlier_variable,\n \"Threshold method\" = threshold_method,\n \"Threshold multiplier\" = threshold_multiplier,\n \"Sliding window\" = window_size,\n \"Include current point\" = if(use_current_point == \"0\", \"false\", \"true\"),\n \"# of outliers\" = outliers_count"]);
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
require(["jquery",
"underscore",
"splunkjs/mvc",
"splunkjs/mvc/chartview",
"splunkjs/mvc/dropdownview",
"splunkjs/mvc/textinputview",
"splunkjs/mvc/singleview",
"splunkjs/mvc/checkboxview",
"splunkjs/mvc/tableview",
"splunkjs/mvc/utils",
'splunkjs/mvc/visualizationregistry',
'Options',
"components/splunk/AlertModal",
"components/splunk/Forms",
"components/splunk/KVStore",
'components/splunk/SearchBarWrapper',
"components/splunk/Searches",
"components/data/parameters/ParseSearchParameters",
"components/data/formatters/compactTemplateString",
"components/data/serializers/ShowcaseHistorySerializer",
"components/controls/AssistantControlsFooter",
"components/controls/AssistantPanel/Master",
"components/controls/QueryHistoryTable",
"components/controls/SearchStringDisplay",
"components/controls/DrilldownLinker",
"components/controls/Messages",
"components/controls/Modal",
"components/controls/Spinners",
"components/controls/Tabs",
"components/controls/ProcessSummaryUI",
"components/data/sampleSearches/SampleSearchLoader",
"components/data/validators/NumberValidator",
"splunkjs/mvc/searchmanager",
'json!components/data/ShowcaseInfo.json',
'bootstrap.tooltip',
'bootstrap.popover'
],
function($,
_,
mvc,
ChartView,
DropdownView,
TextInputView,
SingleView,
CheckboxView,
TableView,
utils,
VisualizationRegistry,
Options,
AlertModal,
Forms,
KVStore,
SearchBarWrapper,
Searches,
ParseSearchParameters,
compact,
ShowcaseHistorySerializer,
AssistantControlsFooter,
AssistantPanel,
QueryHistoryTable,
SearchStringDisplay,
DrilldownLinker,
Messages,
Modal,
Spinners,
Tabs,
ProcessSummaryUI,
SampleSearchLoader,
NumberValidator,
SearchManager,
ShowcaseInfo
) {
var showcaseName = 'showcase_simple_search';
$(".hideable").each(function(index, value) {
var id = "random_id_" + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 5);
$(value).attr("id", id);
console.log("setting div to id", $(value), id);
$(value).parent().prepend("<p><a href=\"#\" onclick='$(\"#" + id + "\").toggle(); return false;'>Toggle Help</a></p>");
$(value).toggle();
})
var appName = Options.getOptionByName('appName');
var submitButtonText = 'Run Search Again';
var baseSearchString = null;
var baseTimerange = null;
// stores the current sample search, if applicable
var currentSampleSearch = null;
var isRunning = false;
// stores whether or not the last value entered into a given control is valid
var controlValidity = function() {
var controlValidityStore = {};
return {
set: function set(id, value) {
controlValidityStore[id] = value;
},
/**
* Checks whether all entries in controlValidityStore are true
* @returns {boolean}
*/
getAll: function getAll() {
return Object.keys(controlValidityStore).every(function(validity) {
return controlValidityStore[validity];
});
}
};
}();
var historyCollectionId = showcaseName + "_history";
var historySerializer = new ShowcaseHistorySerializer(historyCollectionId, {
_time: null,
search_query: null
/*,
earliest_time: null,
latest_time: null,
outlierValueTracked1: null,
outlierValueTracked2: null,
outliers_count: null*/
}, function() {
Searches.startSearch('queryHistorySearch');
});
// the possible searches and their descriptions, one per analysis function
var outlierResultsSearchSettings = {
'findNewValues': {
search: ['| eval isOutlier = 1'],
description: ['Return all events', '']
}
};
var outlierFieldSearchStrings = {
both: "",
above: "",
below: "",
split: ""
};
function setupSearches() {
(function setupSearchBarSearch() {
Searches.setSearch('searchBarSearch', {
targetJobIdTokenName: 'searchBarSearchJobIdToken',
onStartCallback: function onStartCallback() {
hideErrorMessage();
hidePanels();
},
onDoneCallback: function onDoneCallback(searchManager) {
DrilldownLinker.setSearchDrilldown(datasetPreviewTable.$el.prev('h3'), searchManager.search);
Searches.startSearch('outlierVariableSearch');
Searches.startSearch('outlierVariableSubjectSearch');
},
onErrorCallback: function onErrorCallback(errorMessage) {
showErrorMessage(errorMessage);
hidePanels();
}
});
})();
(function setupOutlierVariableSearch() {
Searches.setSearch("outlierVariableSearch", {
searchString: compact(_templateObject),
onStartCallback: function onStartCallback() {
hideErrorMessage();
},
onErrorCallback: function onErrorCallback(errorMessage) {
showErrorMessage(errorMessage);
hidePanels();
}
});
})();
(function setupOutlierVariableSubjectSearch() {
Searches.setSearch("outlierVariableSubjectSearch", {
searchString: compact(_templateObject),
onStartCallback: function onStartCallback() {
hideErrorMessage();
},
onErrorCallback: function onErrorCallback(errorMessage) {
showErrorMessage(errorMessage);
hidePanels();
}
});
})();
(function setupOutlierResultsSearches() {
Object.keys(outlierResultsSearchSettings).forEach(function(searchName) {
Searches.setSearch(searchName, {
autostart: false,
searchString: ['| loadjob $searchBarSearchJobIdToken$'].concat(outlierResultsSearchSettings[searchName].search, [outlierFieldSearchStrings.both]),
targetJobIdTokenName: 'outlierResultsSearchToken',
onStartCallback: function onStartCallback() {
hideErrorMessage();
updateForm(true);
},
onDoneCallback: function onDoneCallback() {
showPanels();
},
onDataCallback: function onDataCallback(data) {
var collection = {
_time: parseInt(new Date().valueOf() / 1000, 10),
search_query: baseSearchString,
earliest_time: baseTimerange.earliest_time,
latest_time: baseTimerange.latest_time
};
historySerializer.persist(Searches.getSid(searchName), collection);
Searches.startSearch('outliersVizSearch')
Searches.startSearch('outliersVizSearchOutliersOnly');
var showOutliersOverTimeViz = false;
if (data != null && data.fields != null && data.rows != null && data.rows.length > 0) {
var timeIndex = data.fields.indexOf('_time');
// plotting the outliers count over time only makes sense on time-series data
if (timeIndex > -1 && data.rows[0][timeIndex] != null) {
showOutliersOverTimeViz = true;
}
}
if (showOutliersOverTimeViz) {
Forms.setToken('showOutliersOverTimeToken', true);
Searches.startSearch('outliersOverTimeVizSearch');
} else {
Forms.unsetToken('showOutliersOverTimeToken');
}
},
onErrorCallback: function onErrorCallback(errorMessage) {
showErrorMessage(errorMessage);
hidePanels();
},
onFinallyCallback: function onFinallyCallback() {
updateForm(false);
}
});
});
})();
(function setupEventCountCountSearch() {
var sharedSearchArray = [' | eval totalcount = max(eventCount, resultCount, scanCount, \'performance.command.inputlookup.output_count\') | table totalcount '];
var vizQueryArray = [];
var vizQuerySearch = null;
var vizOptions = DrilldownLinker.parseVizOptions({ category: 'singlevalue' });
singleResultsPanel.openInSearchButton.on('click', function() {
//window.open(DrilldownLinker.getUrl('search', vizQuerySearch, vizOptions), '_blank');
window.open(DrilldownLinker.getUrl('search', vizQuerySearch), '_blank');
});
singleResultsPanel.showSPLButton.on('click', function() {
ModifiedLaunchQuerySPL('resultsCountSearchModal', 'Display the number of results', vizQueryArray, getFullSearchQueryComments().concat(['count the results']), baseTimerange, vizOptions);
//SearchStringDisplay.showSearchStringModal('resultsCountSearchModal', 'Display the number of results', vizQueryArray, getFullSearchQueryComments().concat(['count the results']), baseTimerange, vizOptions);
});
mysearch = Searches.getSearchManager("searchBarSearch");
if (typeof mysearch != "undefined" && typeof mysearch.attributes.data != "undefined" && typeof mysearch.attributes.data.dispatchState != "undefined" && mysearch.attributes.data.dispatchState != "DONE") {
console.log("Hey DVeuve -- got my mysearch", mysearch, mysearch.attributes.data.eventCount, mysearch.attributes.data.resultCount)
} else {
console.log("Hey DVeuve -- got my mysearch", mysearch)
}
Searches.setSearch("eventCountCountSearch", {
autostart: true,
targetJobIdTokenName: "resultsCountSearchToken",
searchString: ['| rest /services/search/jobs | search sid=$searchBarSearchJobIdToken$ '].concat(sharedSearchArray),
onStartCallback: function onStartCallback() {
Spinners.showLoadingOverlay(singleResultsPanel.viz.$el);
vizQueryArray = getFullSearchQueryArray().concat(sharedSearchArray);
vizQuerySearch = DrilldownLinker.createSearch(vizQueryArray, baseTimerange);
DrilldownLinker.setSearchDrilldown(singleResultsPanel.title, vizQuerySearch, vizOptions);
},
onFinallyCallback: function onFinallyCallback() {
Spinners.hideLoadingOverlay(singleResultsPanel.viz.$el);
}
});
})();
(function setupResultsCountSearch() {
var sharedSearchArray = ['| stats count'];
var vizQueryArray = [];
var vizQuerySearch = null;
var vizOptions = DrilldownLinker.parseVizOptions({ category: 'singlevalue' });
singleResultsPanel.openInSearchButton.on('click', function() {
window.open(DrilldownLinker.getUrl('search', vizQuerySearch, vizOptions), '_blank');
});
singleResultsPanel.showSPLButton.on('click', function() {
ModifiedLaunchQuerySPL('resultsCountSearchModal', 'Display the number of results', vizQueryArray, getFullSearchQueryComments().concat(['count the results']), baseTimerange, vizOptions);
//SearchStringDisplay.showSearchStringModal('resultsCountSearchModal', 'Display the number of results', vizQueryArray, getFullSearchQueryComments().concat(['count the results']), baseTimerange, vizOptions);
});
Searches.setSearch("resultsCountSearch", {
autostart: true,
targetJobIdTokenName: "resultsCountSearchToken",
searchString: ['| loadjob $outlierResultsSearchToken$'].concat(sharedSearchArray),
onStartCallback: function onStartCallback() {
Spinners.showLoadingOverlay(singleResultsPanel.viz.$el);
vizQueryArray = getFullSearchQueryArray().concat(sharedSearchArray);
vizQuerySearch = DrilldownLinker.createSearch(vizQueryArray, baseTimerange);
DrilldownLinker.setSearchDrilldown(singleResultsPanel.title, vizQuerySearch, vizOptions);
},
onFinallyCallback: function onFinallyCallback() {
Spinners.hideLoadingOverlay(singleResultsPanel.viz.$el);
}
});
})();
(function setupOutliersCountSearch() {
var sharedSearchArray = ['| where isOutlier=1', '| stats count'];
var vizQueryArray = [];
var vizQuerySearch = null;
var vizOptions = DrilldownLinker.parseVizOptions({ category: 'singlevalue' });
singleOutliersPanel.openInSearchButton.on('click', function() {
window.open(DrilldownLinker.getUrl('search', vizQuerySearch, vizOptions), '_blank');
});
singleOutliersPanel.showSPLButton.on('click', function() {
ModifiedLaunchQuerySPL('outliersCountSearchModal', 'Display the number of outliers', vizQueryArray, getFullSearchQueryComments().concat(['show only outliers', 'count the outliers']), baseTimerange, vizOptions);
//SearchStringDisplay.showSearchStringModal('outliersCountSearchModal', 'Display the number of outliers', vizQueryArray, getFullSearchQueryComments().concat(['show only outliers', 'count the outliers']), baseTimerange, vizOptions);
});
Searches.setSearch("outliersCountSearch", {
autostart: true,
targetJobIdTokenName: "outliersCountSearchToken",
searchString: ['| loadjob $outlierResultsSearchToken$'].concat(sharedSearchArray),
onStartCallback: function onStartCallback() {
Spinners.showLoadingOverlay(singleOutliersPanel.viz.$el);
vizQueryArray = getFullSearchQueryArray().concat(sharedSearchArray);
vizQuerySearch = DrilldownLinker.createSearch(vizQueryArray, baseTimerange);
DrilldownLinker.setSearchDrilldown(singleOutliersPanel.title, vizQuerySearch, vizOptions);
},
onDataCallback: function onDataCallback(data) {
var countIndex = data.fields.indexOf('count');
if (data.rows.length > 0 && countIndex >= 0) {
var jobId = Searches.getSid(getCurrentSearchName());
var collection = {
outliers_count: data.rows[0][countIndex]
};
historySerializer.persist(jobId, collection);
}
},
onFinallyCallback: function onFinallyCallback() {
Spinners.hideLoadingOverlay(singleOutliersPanel.viz.$el);
}
});
})();
(function setupOutliersVizSearch() {
var sharedSearchArray = ['| table * '];
var vizQuerySearch = null;
var vizQueryArray = [];
var outliersVizAlertModal = null;
var vizOptions = DrilldownLinker.parseVizOptions({
category: 'custom',
type: appName + ".OutliersViz"
});
function openInSearch() {
window.open(DrilldownLinker.getUrl('search', vizQuerySearch /*, vizOptions*/ ), '_blank');
}
function showSPL(e) {
// adjust the modal title depending on whether or not the modal is from the plot or not
var modalTitle = outliersVizPanel.showSPLButton.first().is($(e.target)) ? 'Plot the outliers' : 'Calculate the outliers';
ModifiedLaunchQuerySPL('outliersVizSearchModal', modalTitle, vizQueryArray, getFullSearchQueryComments(), baseTimerange, vizOptions);
//SearchStringDisplay.showSearchStringModal('outliersVizSearchModal', modalTitle, vizQueryArray, getFullSearchQueryComments(), baseTimerange, vizOptions);
}
setTimeout(function() {
$("#showSPLMenu").append($("<button>Show SPL (Splunk Search Language)</button>").click(function() { ModifiedLaunchQuerySPL('SearchModal', 'Show Search Query', vizQueryArray, getFullSearchQueryComments(), baseTimerange, vizOptions); }))
}, 1500)
function scheduleAlert() {
require([
"jquery", "components/data/sendTelemetry"
], function($, Telemetry) {
Telemetry.SendTelemetryToSplunk("PageStatus", { "status": "scheduleAlertStarted", "searchName": window.currentSampleSearch.label })
})
if (outliersVizAlertModal == null) {
(function() {
outliersVizAlertModal = new Modal('outliersVizAlertModal', {
title: 'Schedule an alert',
destroyOnHide: false,
type: 'wide'
});
var outlierSearchTypeControl = new DropdownView({
id: 'outliersVizAlertModalTypeControl',
el: $('<span>'),
labelField: 'label',
valueField: 'value',
showClearButton: false,
choices: [{ value: 'both', label: 'outside both thresholds' }, { value: 'above', label: 'above the upper threshold' }, { value: 'below', label: 'below the lower threshold' }]
}).render();
var outliersVizAlertModalValueControl = new TextInputView({
id: 'outliersVizAlertModalValueControl',
el: $('<span>')
}).render();
outliersVizAlertModal.body.addClass('mlts-modal-form-inline').append($('<p>').text('Alert me when the number of outliers is greater than '), outliersVizAlertModalValueControl.$el);
outliersVizAlertModal.footer.append($('<button>').addClass('mlts-modal-cancel').attr({
type: 'button',
'data-dismiss': 'modal'
}).addClass('btn btn-default mlts-modal-cancel').text('Cancel'), $('<button>').attr({
type: 'button'
}).on('click', function() {
outliersVizAlertModal.removeAlert();
var minOutliersCount = outliersVizAlertModalValueControl.val();
var isValid = NumberValidator.validate(minOutliersCount, { min: 0 });
Messages.setFormInputStatus(outliersVizAlertModalValueControl, isValid);
if (isValid) {
var searchString = Forms.parseTemplate(getFullSearchQueryArray(outlierSearchTypeControl.val()).join('') + " | search isOutlier=1");
outliersVizAlertModal.hide();
var alertModal = new AlertModal({
searchString: searchString
});
alertModal.model.alert.cron.set({
"cronType": "custom",
"cron_schedule": "37 1 * * *",
"dayOfWeek": "*",
"hour": "1",
"minute": "37"
});
alertModal.model.alert.workingTimeRange.set("earliest", "-30d@d")
alertModal.model.alert.workingTimeRange.set("latest", "@d")
alertModal.model.alert.entry.content.set("name", currentSampleSearchLabel.replace(" - Demo", "").replace(" - Live", "").replace(" - Accelerated", "").replace(/ /g, "_", "g").replace(/#/g, "Num"));
alertModal.model.alert.entry.content.set("description", "Generated by the Splunk Security Essentials app at " + (new Date().toUTCString()));
alertModal.model.alert.entry.content.set('ui.scheduled.resultsinput', minOutliersCount);
console.log("About to set Params", window.actions)
if (typeof window.actions.createUBA != "undefined") {
console.log("ParamBeingSet", window.actions.createUBA);
alertModal.model.alert.entry.content.set('action.send2uba', window.actions.createUBA);
}
if (typeof window.actions.UBASeverity != "undefined") {
console.log("ParamBeingSet", window.actions.UBASeverity);
alertModal.model.alert.entry.content.set('action.send2uba.param.severity', window.actions.UBASeverity);
}
if (typeof window.actions.createNotable != "undefined") {
console.log("ParamBeingSet", window.actions.createNotable);
alertModal.model.alert.entry.content.set('action.notable', window.actions.createNotable);
}
if (typeof window.actions.createRisk != "undefined") {
console.log("ParamBeingSet", window.actions.createRisk);
alertModal.model.alert.entry.content.set('action.risk', window.actions.createRisk);
}
if (typeof window.actions.riskObject != "undefined") {
console.log("ParamBeingSet", window.actions.riskObject);
alertModal.model.alert.entry.content.set('action.risk.param._risk_object', window.actions.riskObject);
}
if (typeof window.actions.riskObjectType != "undefined") {
console.log("ParamBeingSet", window.actions.riskObjectType);
alertModal.model.alert.entry.content.set('action.risk.param._risk_object_type', window.actions.riskObjectType);
}
if (typeof window.actions.riskObjectScore != "undefined") {
console.log("ParamBeingSet", window.actions.riskObjectScore);
alertModal.model.alert.entry.content.set('action.risk.param._risk_score', window.actions.riskObjectScore);
}
console.log("Here's my thing...", alertModal, window.actions);
window.dvtestalertmodal = alertModal
alertModal.render().appendTo($('body')).show();
setTimeout(function() {
$(".alert-save-as").find("a:contains(Save)").click(function() {
require([
"jquery", "components/data/sendTelemetry"
], function($, Telemetry) {
Telemetry.SendTelemetryToSplunk("PageStatus", { "status": "scheduleAlertCompleted", "searchName": window.currentSampleSearch.label })
})
})
}, 500)
} else {
outliersVizAlertModal.setAlert('Alert count must be a positive number.');
}
}).addClass('btn btn-primary mlts-modal-submit').text('Next'));
outliersVizAlertModal.$el.on('show.bs.modal', function() {
outliersVizAlertModal.removeAlert();
Messages.setFormInputStatus(outliersVizAlertModalValueControl, true);
outlierSearchTypeControl.val('both');
outliersVizAlertModalValueControl.val(0);
});
})();
}
outliersVizAlertModal.show();
}
assistantControlsFooter.controls.openInSearchButton.on('click', openInSearch);
assistantControlsFooter.controls.showSPLButton.on('click', showSPL);
outliersVizPanel.openInSearchButton.on('click', openInSearch);
outliersVizPanel.showSPLButton.on('click', showSPL);
outliersTablePanel.openInSearchButton.on('click', openInSearch);
outliersTablePanel.showSPLButton.on('click', showSPL);
outliersVizPanel.scheduleAlertButton.on('click', scheduleAlert);
singleOutliersPanel.scheduleAlertButton.on('click', scheduleAlert);
Searches.setSearch('outliersVizSearch', {
autostart: false, // this doesn't autostart on purpose, to prevent the chart from flickering when the user changes the "Field to predict" but doesn't actually run the search
searchString: ['| loadjob $outlierResultsSearchToken$| search isOutlier=1'].concat(sharedSearchArray),
onStartCallback: function onStartCallback() {
Spinners.showLoadingOverlay(outliersVizPanel.viz.$el);
Messages.removeAlert(outliersVizPanel.message, true);
},
onDoneCallback: function onDoneCallback() {
vizQueryArray = getFullSearchQueryArray().concat(sharedSearchArray);
vizQuerySearch = DrilldownLinker.createSearch(vizQueryArray, baseTimerange);
DrilldownLinker.setSearchDrilldown(outliersTablePanel.title, vizQuerySearch);
DrilldownLinker.setSearchDrilldown(outliersVizPanel.title, vizQuerySearch, vizOptions);
},
onDataCallback: function onDataCallback(data) {
if (data != null && data.fields != null && data.rows != null && data.rows.length > 0) {
(function() {
var tableFields = data.fields;
var timeIndex = tableFields.indexOf('_time');
var outlierVariableToken = Forms.getToken('outlierVariableToken');
var outlierVariableIndex = tableFields.indexOf(outlierVariableToken);
var nonNumeric = data.rows.every(function(row) {
return isNaN(parseFloat(row[outlierVariableIndex]));
});
if (nonNumeric) {
Messages.setAlert(outliersVizPanel.message, "All values in \"" + outlierVariableToken + "\" are non-numeric. You may be able to analyze this data in the \"Detect Categorical Outliers\" assistant.", 'error', 'alert-inline', true);
}
// if the data isn't time-series, remove the _time column from the table
if (timeIndex === -1 || data.rows[0][timeIndex] == null) tableFields.splice(timeIndex, 1);
outliersTablePanel.viz.settings.set('fields', tableFields);
})();
}
},
onErrorCallback: function onErrorCallback() {
Messages.removeAlert(outliersVizPanel.message, true);
},
onFinallyCallback: function onFinallyCallback() {
Spinners.hideLoadingOverlay(outliersVizPanel.viz.$el);
}
});
Searches.setSearch('outliersVizSearchOutliersOnly', {
autostart: false, // this doesn't autostart on purpose, to prevent the chart from flickering when the user changes the "Field to predict" but doesn't actually run the search
searchString: ['| loadjob $outlierResultsSearchToken$ '].concat(sharedSearchArray),
onStartCallback: function onStartCallback() {
Spinners.showLoadingOverlay(outliersVizPanel.viz.$el);
Messages.removeAlert(outliersVizPanel.message, true);
},
onDoneCallback: function onDoneCallback() {
vizQueryArray = getFullSearchQueryArray().concat(sharedSearchArray);
vizQuerySearch = DrilldownLinker.createSearch(vizQueryArray, baseTimerange);
DrilldownLinker.setSearchDrilldown(outliersTablePanel.title, vizQuerySearch);
DrilldownLinker.setSearchDrilldown(outliersVizPanel.title, vizQuerySearch, vizOptions);
},
onDataCallback: function onDataCallback(data) {
if (data != null && data.fields != null && data.rows != null && data.rows.length > 0) {
(function() {
var tableFields = data.fields;
var timeIndex = tableFields.indexOf('_time');
var outlierVariableToken = Forms.getToken('outlierVariableToken');
var outlierVariableIndex = tableFields.indexOf(outlierVariableToken);
var nonNumeric = data.rows.every(function(row) {
return isNaN(parseFloat(row[outlierVariableIndex]));
});
if (nonNumeric) {
Messages.setAlert(outliersVizPanel.message, "All values in \"" + outlierVariableToken + "\" are non-numeric. You may be able to analyze this data in the \"Detect Categorical Outliers\" assistant.", 'error', 'alert-inline', true);
}
// if the data isn't time-series, remove the _time column from the table
if (timeIndex === -1 || data.rows[0][timeIndex] == null) tableFields.splice(timeIndex, 1);
outliersTablePanel.viz.settings.set('fields', tableFields);
})();
}
},
onErrorCallback: function onErrorCallback() {
Messages.removeAlert(outliersVizPanel.message, true);
},
onFinallyCallback: function onFinallyCallback() {
Spinners.hideLoadingOverlay(outliersVizPanel.viz.$el);
}
});
})();
(function setupOutliersOverTimeVizSearch() {
var sharedSearchArray = ['| timechart sum(isOutlierUpper), sum(isOutlierLower)'];
var vizQueryArray = [];
var vizQuerySearch = null;
var vizOptions = DrilldownLinker.parseVizOptions({
category: 'charting',
type: 'column'
});
vizOptions['display.visualizations.charting.chart.stackMode'] = 'stacked';
outliersOverTimeVizPanel.openInSearchButton.on('click', function() {
window.open(DrilldownLinker.getUrl('search', vizQueryArray, vizOptions), '_blank');
});
outliersOverTimeVizPanel.showSPLButton.on('click', function() {
ModifiedLaunchQuerySPL('outliersOverTimeVizSearchModal', 'Plot the outlier count over time', vizQueryArray, getFullSearchQueryComments().concat(['plot the outlier count over time']), baseTimerange, vizOptions);
//SearchStringDisplay.showSearchStringModal('outliersOverTimeVizSearchModal', 'Plot the outlier count over time', vizQueryArray, getFullSearchQueryComments().concat(['plot the outlier count over time']), baseTimerange, vizOptions);
});
Searches.setSearch('outliersOverTimeVizSearch', {
autostart: false,
searchString: ['| loadjob $outlierResultsSearchToken$'].concat([outlierFieldSearchStrings.split], sharedSearchArray),
onStartCallback: function onStartCallback() {
Spinners.showLoadingOverlay(outliersOverTimeVizPanel.viz.$el);
vizQueryArray = getFullSearchQueryArray('split').concat(sharedSearchArray);
vizQuerySearch = DrilldownLinker.createSearch(vizQueryArray, baseTimerange);
DrilldownLinker.setSearchDrilldown(outliersOverTimeVizPanel.title, vizQuerySearch, vizOptions);
},
onFinallyCallback: function onFinallyCallback() {
Spinners.hideLoadingOverlay(outliersOverTimeVizPanel.viz.$el);
}
});
})();
}
(function setupQueryHistorySearch() {
Searches.setSearch('queryHistorySearch', {
searchString: compact(_templateObject2, showcaseName)
});
})();
function getCurrentSearchName() {
return "findNewValues";
}
function runPreReqs(prereqs) {
if (prereqs.length > 0) {
window.datacheck = []
console.log("Got " + prereqs.length + " prereqs!");
$("<div id=\"row11\" class=\"dashboard-row dashboard-row1 splunk-view\"> <div id=\"panel11\" class=\"dashboard-cell last-visible splunk-view\" style=\"width: 100%;\"> <div class=\"dashboard-panel clearfix\" style=\"min-height: 0px;\"><h2 class=\"panel-title empty\"></h2><div id=\"view_22841\" class=\"fieldset splunk-view editable hide-label hidden empty\"></div> <div class=\"panel-element-row\"> <div id=\"element11\" class=\"dashboard-element html splunk-view\" style=\"width: 100%;\"> <div class=\"panel-body html\"> <table class=\"table table-striped\" id=\"data_check_table\" > <tr><td>Data Check</td><td>Status</td><td>Open in Search</td><td>Resolution (if needed)</td></tr> </table> </div> </div> </div> </div> </div> </div>").insertBefore($(".fieldset").first())
for (var i = 0; i < prereqs.length; i++) {
window.datacheck[i] = new Object
// create table entry including unique id for the status
$("#data_check_table tr:last").after("<tr><td>" + prereqs[i].name + "</td><td id=\"data_check_test" + i + "\"><img title=\"Checking...\" src=\"/static//app/Splunk_Security_Essentials/images/general_images/loader.gif\"></td><td><a target=\"_blank\" href=\"/app/Splunk_Security_Essentials/search?q=" + encodeURI(prereqs[i].test) + "\">Open in Search</a></td><td>" + prereqs[i].resolution + "</td></tr>")
// create search manager
window.datacheck[i].mainSearch = new SearchManager({
"id": "data_check_search" + i,
"cancelOnUnload": true,
"latest_time": "",
"status_buckets": 0,
"earliest_time": "0",
"search": prereqs[i].test,
"app": appName,
"auto_cancel": 90,
"preview": true,
"runWhenTimeIsUndefined": false
}, { tokens: true, tokenNamespace: "submitted" });
window.datacheck[i].myResults = window.datacheck[i].mainSearch.data('results', { output_mode: 'json', count: 0 });
window.datacheck[i].mainSearch.on('search:error', function(properties) {
var searchName = properties.content.request.label
var myCheckNum = searchName.substr(17, 20)
$("#row11").css("display", "block")
document.getElementById("data_check_test" + myCheckNum).innerHTML = "<img title=\"Error\" src=\"/static//app/Splunk_Security_Essentials/images/general_images/err_ico.gif\">";
console.log("Data Check Failure code 3", searchName, myCheckNum, prereqs[myCheckNum])
});
window.datacheck[i].mainSearch.on('search:fail', function(properties) {
var searchName = properties.content.request.label
var myCheckNum = searchName.substr(17, 20)
$("#row11").css("display", "block")
document.getElementById("data_check_test" + myCheckNum).innerHTML = "<img title=\"Error\" src=\"/static//app/Splunk_Security_Essentials/images/general_images/err_ico.gif\">";
console.log("Data Check Failure code 4", searchName, myCheckNum, prereqs[myCheckNum])
});
window.datacheck[i].mainSearch.on('search:done', function(properties) {
var searchName = properties.content.request.label
var myCheckNum = searchName.substr(17, 20)
console.log("Got Results from Data Check Search", searchName, myCheckNum, properties);
if (window.datacheck[myCheckNum].mainSearch.attributes.data.resultCount == 0) {
document.getElementById("data_check_test" + myCheckNum).innerHTML = "<img title=\"Error\" src=\"/static//app/Splunk_Security_Essentials/images/general_images/err_ico.gif\">";
console.log("Data Check Failure code 1", preqreqs[myCheckNum])
return;
}
window.datacheck[myCheckNum].myResults.on("data", function(properties) {
var searchName = properties.attributes.manager.id
var myCheckNum = searchName.substr(17, 20)
var data = window.datacheck[myCheckNum].myResults.data().results;
status = false;
if (typeof data[0][prereqs[myCheckNum].field] !== "undefined") {
status = true;
if (typeof prereqs[myCheckNum].greaterorequalto !== "undefined") {
if (data[0][prereqs[myCheckNum].field] >= prereqs[myCheckNum].greaterorequalto) {
status = true;
} else {
status = false;
}
}
}
if (status == "true") {
document.getElementById("data_check_test" + myCheckNum).innerHTML = "<img title=\"Success\" src=\"/static//app/Splunk_Security_Essentials/images/general_images/ok_ico.gif\">";
console.log("Data Check success", searchName, myCheckNum, prereqs[myCheckNum])
} else {
document.getElementById("data_check_test" + myCheckNum).innerHTML = "<img title=\"Error\" src=\"/static//app/Splunk_Security_Essentials/images/general_images/err_ico.gif\">";
$("#row11").css("display", "block")
console.log("Data Check Failure code 2", searchName, myCheckNum, prereqs[myCheckNum])
}
});
});
}
}
}
function submitForm() {
// the controlValidity.getAll() check is intentionally made here so that the user can try to submit the form even with empty fields
// the submission will fail and they'll see the appropriate errors
console.log("starting submitform function")
if (!assistantControlsFooter.getDisabled() && controlValidity.getAll()) {
//currentSampleSearch = null;
currentSampleSearch = null;
Object.keys(outlierResultsSearchSettings).forEach(function() {
return Searches.cancelSearch;
});
console.log("Starting search... ", getCurrentSearchName())
Searches.startSearch(getCurrentSearchName());
}
}
/**
* gets the current full search query as an array, where array[0] is the search bar search
* @param {string} [outliersFilterType='both'] Whether to report points "above", "below", or "both" as outliers
* @returns {Array}
*/
function getFullSearchQueryArray() {
var outliersFilterType = arguments.length <= 0 || arguments[0] === undefined ? 'both' : arguments[0];
var fullSearchQueryArray = [];
var outlierResultsSearchQuery = outlierResultsSearchSettings[getCurrentSearchName()];
if (baseSearchString != null && outlierResultsSearchQuery != null) {
fullSearchQueryArray[0] = baseSearchString;
for (var i = 0; i < outlierResultsSearchQuery.search.length; i++) {
fullSearchQueryArray[i + 1] = outlierResultsSearchQuery.search[i];
}
fullSearchQueryArray.push(outlierFieldSearchStrings[outliersFilterType]);
}
return fullSearchQueryArray;
}
function getFullSearchQueryComments() {
return [null].concat(outlierResultsSearchSettings[getCurrentSearchName()].description, ['values outside the bounds are outliers']);
}
var updateForm = function updateForm(newIsRunningValue) {
// optionally set a new value for isRunning
console.log("Starting updateForm", isRunning, newIsRunningValue)
if (newIsRunningValue != null) isRunning = newIsRunningValue;
//outlierSearchTypeControl.settings.set('disabled', isRunning);
//scaleFactorControl.settings.set('disabled', isRunning);
//windowedAnalysisCheckboxControl.settings.set('disabled', isRunning);
// don't re-enable windowSizeControl and currentPointCheckboxControl if they're disabled by windowedAnalysisCheckboxControl
//var windowingControlsEnabled = isRunning || !windowedAnalysisCheckboxControl.val();
//windowSizeControl.settings.set('disabled', windowingControlsEnabled);
//currentPointCheckboxControl.settings.set('disabled', windowingControlsEnabled);
if (isRunning) {
console.log("updateForm - checkpoint 1")
assistantControlsFooter.setDisabled(true);
assistantControlsFooter.controls.submitButton.text('Detecting Outliers...');
} else {
console.log("updateForm - checkpoint 2")
var fieldsValid = true;
console.log("updateForm - checkpoint 3", fieldsValid)
assistantControlsFooter.setDisabled(!fieldsValid);
assistantControlsFooter.controls.submitButton.text(submitButtonText);
$("button:contains(Show SPL)")[0].disabled = false
$("button:contains(Show SPL)").first().unbind("click")
$("button:contains(Show SPL)").first().click(function() { window.dvtestLaunchQuery() });
}
};
function showErrorMessage(errorMessage) {
var errorDisplay$El = $("#errorDisplay");
Messages.setAlert(errorDisplay$El, errorMessage, undefined, undefined, true);
}
function hideErrorMessage() {
var errorDisplay$El = $("#errorDisplay");
Messages.removeAlert(errorDisplay$El, true);
}
function showPanels() {
Forms.setToken('showResultPanelsToken', true);
}
function hidePanels() {
Forms.unsetToken('showResultPanelsToken');
}
function setCurrentSampleSearch(sampleSearch) {
console.log("Hello 6", sampleSearch)
currentSampleSearch = _.extend({}, {
// outlierSearchType: 'Avg',
// scaleFactor: 2,
useCurrentPoint: true
}, sampleSearch);
window.currentSampleSearch = currentSampleSearch
var isWindowed = 0; //currentSampleSearch.windowSize != null && currentSampleSearch.windowSize > 0;
//outlierSearchTypeControl.val(currentSampleSearch.outlierSearchType);
//scaleFactorControl.val(currentSampleSearch.scaleFactor);
//windowedAnalysisCheckboxControl.val(isWindowed);
//windowSizeControl.val(isWindowed ? currentSampleSearch.windowSize : 0);
var earliest = currentSampleSearch.earliestTime
var latest = currentSampleSearch.latestTime
window.currentSampleSearchLabel = currentSampleSearch.label
console.log("Setting up currentSampleSearchLabel", currentSampleSearchLabel)
if (currentSampleSearch.value.match(/^\s*\|\s*inputlookup/)) {
earliest = 0
latest = "now"
} else {
earliest = "-30d@d"
latest = "@d"
}
console.log("showcase Time Range Settings...", earliest, latest, currentSampleSearch.value, currentSampleSearch.value.match(/^\s*\|\s*inputlookup/))
searchBarControl.setProperties(currentSampleSearch.value, earliest, latest);
window.actions = new Object();
for (var param in currentSampleSearch) {
if (param.indexOf("actions_") != -1) {
newfield = param.substr(8, 100)
window.actions[newfield] = currentSampleSearch[param]
console.log("Found an Action config", param, param.indexOf("actions_"), newfield, param.substr(8, 100), window.actions[newfield])
}
}
window.actions.createUBA = window.actions.createUBA || 1
if (window.actions.createUBA == 1) {
window.actions.UBASeverity = window.actions.UBASeverity || 5;
}
if (window.actions.createRisk == 1) {
window.actions.riskObjectType = window.actions.riskObjectType || "system";
window.actions.riskObject = window.actions.riskObject || currentSampleSearch.outlierVariableSubject;
window.actions.riskObjectScore = window.actions.riskObjectScore || 10;
}
// if (typeof currentSampleSearch.prereqs !== 'undefined') {
// console.log("Running my prereqs..", currentSampleSearch.prereqs)
/*require(["components/data/parameters/HandlePreRequisites"], function(HandlePreRequisites, currentSampleSearch){
HandlePreRequisites.runPreReqs(currentSampleSearch.prereqs)
})*/
// runPreReqs(currentSampleSearch.prereqs)
// }
var DoCheck = function() {
console.log("ShowcaseInfo: - Checking ShowcaseInfo", ShowcaseInfo, showcaseName)
if (window.location.href.match(/app\/Splunk_Security_Essentials\/showcase_standard_deviation\/?$/)) {
//ProcessSummaryUI.process_chosen_summary(ShowcaseInfo.summaries["showcase_standard_deviation_generic"], "generic", sampleSearch)
} else if (window.location.href.match(/app\/Splunk_Security_Essentials\/showcase_first_seen_demo\/?$/)) {
// ProcessSummaryUI.process_chosen_summary(ShowcaseInfo.summaries["showcase_first_seen_generic"], "generic", sampleSearch)
} else if (window.location.href.match(/app\/Splunk_Security_Essentials\/showcase_simple_search\/?$/)) {
//ProcessSummaryUI.process_chosen_summary(ShowcaseInfo.summaries["showcase_simple_search"], "generic", sampleSearch)
} else {
for (var summary in ShowcaseInfo.summaries) {
summary = ShowcaseInfo.summaries[summary]
dashboardname = summary.dashboard
if (dashboardname.indexOf("?") > 0) {
dashboardname = dashboardname.substr(0, dashboardname.indexOf("?"))
}
if (typeof summary.examples != "undefined" && dashboardname == showcaseName) {
for (var example in summary.examples) {
if (summary.examples[example].name == sampleSearch.label) {
ProcessSummaryUI.process_chosen_summary(summary, sampleSearch, ShowcaseInfo, showcaseName)
}
}
}
}
}
}
var Loop = function() {
if (typeof ShowcaseInfo != "undefined" && typeof ShowcaseInfo.summaries != "undefined") {
DoCheck()
} else {
setTimeout(function() { Loop() }, 200)
}
}
Loop()
// outlierVariable is the only part of the sample search that has to be set asynchronously
// if it's null, we can remove the sample search now
currentSampleSearch = null;
}
// ModifiedLaunchQuerySPL('outliersVizSearchModal', modalTitle, vizQueryArray, getFullSearchQueryComments(), baseTimerange, vizOptions)
var ModifiedLaunchQuerySPL = function(modalName, modalTitle, vizQueryArray, vizQueryComments, baseTimerange, vizOptions) {
vizQueryArray = getFullSearchQueryArray();
vizQueryComments = getFullSearchQueryComments()
//Time to break apart the base string, but only if we actually have a description.
if (typeof window.currentSampleSearch.description != "undefined" && window.currentSampleSearch.description.length > 0) {
lineOneComponents = vizQueryArray[0].split("\n")
vizQueryArray.splice(0, 1)
vizQueryComments.splice(0, 1)
for (var i = lineOneComponents.length - 1; i >= 0; i--) {
if (window.currentSampleSearch.description.length > i) {
vizQueryArray.unshift(lineOneComponents[i])
vizQueryComments.unshift(window.currentSampleSearch.description[i])
} else {
vizQueryArray.unshift(lineOneComponents[i])
vizQueryComments.unshift(null)
}
}
console.log("Here's the updated query..", vizQueryArray, vizQueryComments, window.currentSampleSearch)
}
SearchStringDisplay.showSearchStringModal(modalName, modalTitle, vizQueryArray, vizQueryComments, baseTimerange, vizOptions);
var tableheight = $("#" + modalName).find("table").height()
var modalheight = $("#" + modalName).height()
var windowheight = $(window).height()
if (tableheight != modalheight) {
if (tableheight > modalheight && tableheight < windowheight - 100) {
$("#" + modalName).height(tableheight + 60)
} else if (tableheight > modalheight) {
$("#" + modalName).height(windowheight - 100)
$("#" + modalName).css("overflow", "scroll")
}
}
console.log("Logic around modal height..", "Tableheight: " + tableheight, "Modalheight: " + modalheight, "Window height: ", windowheight, "finalHeight (similar to modal): " + $("#" + modalName).height())
require([
"jquery", "components/data/sendTelemetry"
], function($, Telemetry) {
Telemetry.SendTelemetryToSplunk("PageStatus", { "status": "SPLViewed", "searchName": window.currentSampleSearch.label })
})
}
var tabsControl = function() {
return new Tabs($('#dashboard-form-tabs'), $('#dashboard-form-controls'));
}();
var searchBarControl = function() {
return new SearchBarWrapper({
"id": "searchBarControl",
"managerid": "searchBarSearch",
"el": $("#searchBarControl"),
"autoOpenAssistant": false
}, {
"id": "searchControlsControl",
"managerid": "searchBarSearch",
"el": $("#searchControlsControl")
}, function() {
var searchBarSearch = Searches.getSearchManager("searchBarSearch");
baseSearchString = this.searchBarView.val();
baseTimerange = this.searchBarView.timerange.val();
searchBarSearch.settings.unset("search");
searchBarSearch.settings.set("search", baseSearchString);
searchBarSearch.search.set(baseTimerange);
window.dvtestLaunchQuery = function() {
vizQueryArray = getFullSearchQueryArray();
ModifiedLaunchQuerySPL('outliersVizSearchModal', "View SPL", vizQueryArray, getFullSearchQueryComments(), baseTimerange, {})
//SearchStringDisplay.showSearchStringModal('outliersVizSearchModal', "View SPL" , vizQueryArray, getFullSearchQueryComments(), baseTimerange, {});
}
updateForm();
});
}();
// target variable control
// analysis function control
/*
var outlierSearchTypeControl = function () {
var outlierSearchTypeControl = new DropdownView({
id: 'outlierSearchTypeControl',
el: $('#outlierSearchTypeControl'),
labelField: 'label',
valueField: 'value',
showClearButton: false,
choices: [{ value: 'Avg', label: 'Standard Deviation' }]//, { value: 'MAD', label: 'Median Absolute Deviation' }, { value: 'IQR', label: 'Interquartile Range' }]
});
outlierSearchTypeControl.on("change", function (value) {
Forms.setToken("outlierSearchTypeToken", value);
});
outlierSearchTypeControl.render();
return outlierSearchTypeControl;
}();
*/
// outlier scale factor control
/*
var scaleFactorControl = function () {
var scaleFactorControl = new TextInputView({
id: 'scaleFactorControl',
el: $('#scaleFactorControl')
});
controlValidity.set(scaleFactorControl.id, false);
scaleFactorControl.on('change', function (value) {
var numValue = parseFloat(value);
if (isNaN(numValue) || numValue < 0) {
controlValidity.set(scaleFactorControl.id, false);
Messages.setTextInputMessage(this, 'Multiplier must be a number greater than zero.');
} else {
controlValidity.set(scaleFactorControl.id, true);
Messages.removeTextInputMessage(this);
Forms.setToken('scaleFactorToken', value);
}
updateForm();
});
scaleFactorControl.render();
return scaleFactorControl;
}();*/
// window size control
/*
var windowSizeControl = function() {
var windowSizeControl = new TextInputView({
id: 'windowSizeControl',
el: $('#windowSizeControl')
});
windowSizeControl.on('change', function(value) {
Forms.setToken('windowSizeToken', parseInt(value, 10));
updateWindowSizeControlValidity();
});
windowSizeControl.render();
return windowSizeControl;
}();
*/
// whether to use windowed analysis or not (streamstats vs eventstats)
// this is defined after windowSizeControl on purpose
/*
var windowedAnalysisCheckboxControl = function () {
var windowedAnalysisCheckboxControl = new CheckboxView({
id: 'windowedAnalysisCheckboxControl',
el: $('#windowedAnalysisCheckboxControl'),
value: true
});
windowedAnalysisCheckboxControl.on('change', function (isWindowed) {
updateWindowSizeControlValidity();
Forms.setToken('windowedAnalysisToken', isWindowed ? 'StreamStats' : 'EventStats');
});
windowedAnalysisCheckboxControl.render();
return windowedAnalysisCheckboxControl;
}();*/
Forms.setToken('windowedAnalysisToken', 'LatestStats'); //DV
// after rendering, re-parent currentPointCheckboxControl to windowSizeControl so that it's on the same line (and above the potential error message)
//windowSizeControl.$el.append(currentPointCheckboxControl.$el.parent()); DV
/**
* Update the validity of the windowSizeControl, which depends on the values of both itself and the windowedAnalysisCheckboxControl
*/
/*function updateWindowSizeControlValidity() { DV
if (windowSizeControl != null && windowedAnalysisCheckboxControl != null && currentPointCheckboxControl != null) {
var windowSize = windowSizeControl.val();
var isWindowed = windowedAnalysisCheckboxControl.val();
if (isWindowed && (isNaN(windowSize) || windowSize <= 0)) {
controlValidity.set(windowSizeControl.id, false);
Messages.setTextInputMessage(windowSizeControl, 'Number of samples must be a positive integer.');
} else {
controlValidity.set(windowSizeControl.id, true);
Messages.removeTextInputMessage(windowSizeControl);
}
windowSizeControl.settings.set("disabled", !isWindowed);
currentPointCheckboxControl.settings.set("disabled", !isWindowed);
updateForm();
}
}
*/
var assistantControlsFooter = function() {
var assistantControlsFooter = new AssistantControlsFooter($('#assistantControlsFooter'), submitButtonText);
assistantControlsFooter.controls.submitButton.on('submit', function() {
submitForm();
});
return assistantControlsFooter;
}();
var queryHistoryPanel = new QueryHistoryTable($('#queryHistoryPanel'), 'queryHistorySearch', historyCollectionId, ['Actions', '_time', 'Search query', 'Field to analyze', 'Threshold method', 'Threshold multiplier', 'Sliding window', 'Include current point', '# of outliers'], submitButtonText, function(params, autostart) {
var sampleSearch = {
value: params.data['row.search_query'],
earliestTime: params.data['row.earliest_time'],
latestTime: params.data['row.latest_time'],
/*outlierValueTracked1: params.data['row.outlierValueTracked1'],
outlierValueTracked2: params.data['row.outlierValueTracked2'],
*/
// outlierSearchType: params.data['row.threshold_method'],
// scaleFactor: params.data['row.threshold_multiplier'],
/*windowSize: params.data['row.window_size'],
// Splunk searches map boolean true to "1" and boolean false to "0"
// defaulting to true instead of false here because this value didn't exist in early history entries
useCurrentPoint: params.data['row.use_current_point'] !== "0",*/
autostart: autostart
};
setCurrentSampleSearch(sampleSearch);
tabsControl.activate('newOutliers');
});
var singleOutliersPanel = function() {
return new AssistantPanel($('#singleOutliersPanel'), 'Outlier(s)', SingleView, {
id: 'singleOutliersViz',
managerid: 'outliersCountSearch',
underLabel: 'Outlier(s)'
}, { footerButtons: { scheduleAlertButton: true } });
}();
var singleResultsPanel = function() {
return new AssistantPanel($('#singleResultsPanel'), 'Total Result(s)', SingleView, {
id: 'singleResultsViz',
managerid: 'resultsCountSearch',
underLabel: 'Total Result(s)'
});
}();
var singleEventCountPanel = function() {
return new AssistantPanel($('#singleEventCountPanel'), 'Raw Event(s)', SingleView, {
id: 'singleEventCountViz',
managerid: 'eventCountCountSearch',
underLabel: 'Raw Event(s)'
}, { footerButtons: { scheduleAlertButton: false, openInSearchButton: false, showSPLButton: false } });
}();
var outliersVizPanel = function() {
//var vizName = 'OutliersViz';
//var OutliersViz = VisualizationRegistry.getVisualizer(appName, vizName);
return new AssistantPanel($('#outliersPanel'), 'Outliers Only', TableView, {
id: 'outliersViz',
managerid: 'outliersVizSearch'
}, { footerButtons: { scheduleAlertButton: true } });
}();
var outliersOverTimeVizPanel = function() {
return new AssistantPanel($('#outliersOverTimePanel'), 'Outlier Count Over Time', ChartView, {
id: 'outliersOverTimeViz',
managerid: 'outliersOverTimeVizSearch',
type: 'column',
'charting.legend.placement': 'bottom',
'charting.chart.stackMode': 'stacked'
});
}();
var datasetPreviewTable = function() {
return new TableView({
id: 'datasetPreviewTable',
el: $('#datasetPreviewPanel'),
managerid: 'searchBarSearch'
});
}();
var outliersTablePanel = function() {
return new AssistantPanel($('#outliersTablePanel'), 'All Data', TableView, {
id: 'outliersTable',
managerid: 'outliersVizSearchOutliersOnly',
sortKey: 'isOutlier',
sortDirection: 'desc',
fields: '*'
});
}();
// update validity for the initial state of the window size controls
//updateWindowSizeControlValidity(); DV
// set up the searches
setupSearches();
// load canned searches from URL bar parameters
(function setInputs() {
var searchParams = ParseSearchParameters(showcaseName);
console.log("Got a showcase.. for better or worse..", showcaseName, searchParams)
if (searchParams.mlToolkitDataset != null) {
SampleSearchLoader.getSampleSearchByLabel(searchParams.mlToolkitDataset).then(setCurrentSampleSearch);
} else {
setCurrentSampleSearch(searchParams);
}
})();
if ($(".dvTooltip").length > 0) { $(".dvTooltip").tooltip() }
if ($(".dvPopover").length > 0) { $(".dvPopover").popover() }
$("#ReminderToSubmit").html("(Click <i>" + $("#submitControl").html() + "</i> above to clear search results.)")
$("#assistantControlsFooter button:contains(Open in Search)").hide()
$("#assistantControlsFooter button:contains(Show SPL)").hide()
// disable the form on initial load
setTimeout(updateForm, 0);
function startSearchASAP() {
console.log("Starting searches..")
if (typeof splunkjs.mvc.Components.getInstance(getCurrentSearchName()).attributes.data == "undefined") {
mvc.Components.getInstance(getCurrentSearchName()).startSearch()
setTimeout(function() {
startSearchASAP()
}, 500)
}
}
startSearchASAP()
});
| 51.331424 | 1,456 | 0.536034 |
53d70331963c90ddcb5e9739774a218c34ba7ec5 | 5,964 | java | Java | core/src/main/java/org/jruby/runtime/InterpretedIRBlockBody.java | meerabo/jruby | 25f27e5312e54a02eda919250dd30b86c2b5a18f | [
"Ruby",
"Apache-2.0"
] | null | null | null | core/src/main/java/org/jruby/runtime/InterpretedIRBlockBody.java | meerabo/jruby | 25f27e5312e54a02eda919250dd30b86c2b5a18f | [
"Ruby",
"Apache-2.0"
] | null | null | null | core/src/main/java/org/jruby/runtime/InterpretedIRBlockBody.java | meerabo/jruby | 25f27e5312e54a02eda919250dd30b86c2b5a18f | [
"Ruby",
"Apache-2.0"
] | null | null | null | package org.jruby.runtime;
import org.jruby.EvalType;
import org.jruby.RubyInstanceConfig;
import org.jruby.RubyModule;
import org.jruby.compiler.Compilable;
import org.jruby.ir.IRClosure;
import org.jruby.ir.IRScope;
import org.jruby.ir.interpreter.Interpreter;
import org.jruby.ir.interpreter.InterpreterContext;
import org.jruby.ir.runtime.IRRuntimeHelpers;
import org.jruby.runtime.Block.Type;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.cli.Options;
import org.jruby.util.log.Logger;
import org.jruby.util.log.LoggerFactory;
public class InterpretedIRBlockBody extends IRBlockBody implements Compilable<InterpreterContext> {
private static final Logger LOG = LoggerFactory.getLogger("InterpretedIRBlockBody");
protected boolean pushScope;
protected boolean reuseParentScope;
private boolean displayedCFG = false; // FIXME: Remove when we find nicer way of logging CFG
private int callCount = 0;
private InterpreterContext interpreterContext;
public InterpretedIRBlockBody(IRClosure closure, Signature signature) {
super(closure, signature);
this.pushScope = true;
this.reuseParentScope = false;
// JIT currently JITs blocks along with their method and no on-demand by themselves. We only
// promote to full build here if we are -X-C.
if (closure.getManager().getInstanceConfig().getCompileMode().shouldJIT() || Options.JIT_THRESHOLD.load() == -1) {
callCount = -1;
}
}
@Override
public void setCallCount(int callCount) {
this.callCount = callCount;
}
@Override
public void completeBuild(InterpreterContext interpreterContext) {
this.interpreterContext = interpreterContext;
}
@Override
public IRScope getIRScope() {
return closure;
}
@Override
public ArgumentDescriptor[] getArgumentDescriptors() {
return closure.getArgumentDescriptors();
}
public InterpreterContext ensureInstrsReady() {
if (IRRuntimeHelpers.isDebug() && !displayedCFG) {
LOG.info("Executing '" + closure + "' (pushScope=" + pushScope + ", reuseParentScope=" + reuseParentScope);
LOG.info(closure.debugOutput());
displayedCFG = true;
}
if (interpreterContext == null) {
interpreterContext = closure.getInterpreterContext();
}
return interpreterContext;
}
@Override
public String getClassName(ThreadContext context) {
return null;
}
@Override
public String getName() {
return null;
}
protected IRubyObject commonYieldPath(ThreadContext context, IRubyObject[] args, IRubyObject self, Binding binding, Type type, Block block) {
if (callCount >= 0) promoteToFullBuild(context);
// SSS: Important! Use getStaticScope() to use a copy of the static-scope stored in the block-body.
// Do not use 'closure.getStaticScope()' -- that returns the original copy of the static scope.
// This matters because blocks created for Thread bodies modify the static-scope field of the block-body
// that records additional state about the block body.
//
// FIXME: Rather than modify static-scope, it seems we ought to set a field in block-body which is then
// used to tell dynamic-scope that it is a dynamic scope for a thread body. Anyway, to be revisited later!
Visibility oldVis = binding.getFrame().getVisibility();
Frame prevFrame = context.preYieldNoScope(binding);
// SSS FIXME: Why is self null in non-binding-eval contexts?
if (self == null || this.evalType.get() == EvalType.BINDING_EVAL) {
self = useBindingSelf(binding);
}
// SSS FIXME: Maybe, we should allocate a NoVarsScope/DummyScope for for-loop bodies because the static-scope here
// probably points to the parent scope? To be verified and fixed if necessary. There is no harm as it is now. It
// is just wasteful allocation since the scope is not used at all.
InterpreterContext ic = ensureInstrsReady();
// Pass on eval state info to the dynamic scope and clear it on the block-body
DynamicScope actualScope = binding.getDynamicScope();
if (ic.pushNewDynScope()) {
actualScope = DynamicScope.newDynamicScope(getStaticScope(), actualScope, this.evalType.get());
if (type == Type.LAMBDA) actualScope.setLambda(true);
context.pushScope(actualScope);
} else if (ic.reuseParentDynScope()) {
// Reuse! We can avoid the push only if surrounding vars aren't referenced!
context.pushScope(actualScope);
}
this.evalType.set(EvalType.NONE);
try {
return Interpreter.INTERPRET_BLOCK(context, self, ic, args, binding.getMethod(), block, type);
}
finally {
// IMPORTANT: Do not clear eval-type in case this is reused in bindings!
// Ex: eval("...", foo.instance_eval { binding })
// The dyn-scope used for binding needs to have its eval-type set to INSTANCE_EVAL
binding.getFrame().setVisibility(oldVis);
if (ic.popDynScope()) {
context.postYield(binding, prevFrame);
} else {
context.postYieldNoScope(prevFrame);
}
}
}
// Unlike JIT in MixedMode this will always successfully build but if using executor pool it may take a while
// and replace interpreterContext asynchronously.
protected void promoteToFullBuild(ThreadContext context) {
if (context.runtime.isBooting()) return; // don't Promote to full build during runtime boot
if (callCount++ >= Options.JIT_THRESHOLD.load()) context.runtime.getJITCompiler().buildThresholdReached(context, this);
}
public RubyModule getImplementationClass() {
return null;
}
}
| 40.849315 | 145 | 0.675889 |
9c3db046934ca6fb39483949751737939194c7ee | 86 | swift | Swift | Tests/LinuxMain.swift | shanehsu/redis | ff856db861a862af5870490c52cf7580acc637ef | [
"MIT"
] | null | null | null | Tests/LinuxMain.swift | shanehsu/redis | ff856db861a862af5870490c52cf7580acc637ef | [
"MIT"
] | null | null | null | Tests/LinuxMain.swift | shanehsu/redis | ff856db861a862af5870490c52cf7580acc637ef | [
"MIT"
] | null | null | null | import XCTest
@testable import RedisTests
XCTMain([
testCase(LiveTests.allTests)
])
| 12.285714 | 29 | 0.790698 |
cb7191b6c07c717eb56e7ef225b82a50f81e87b8 | 867 | go | Go | interceptors/sentry/interceptors.go | linka-cloud/grpc | e5a45801a188af6df5e863bbe68bcd3c33cbb04e | [
"Apache-2.0"
] | null | null | null | interceptors/sentry/interceptors.go | linka-cloud/grpc | e5a45801a188af6df5e863bbe68bcd3c33cbb04e | [
"Apache-2.0"
] | 3 | 2021-11-30T06:39:28.000Z | 2022-03-13T16:38:58.000Z | interceptors/sentry/interceptors.go | linka-cloud/grpc | e5a45801a188af6df5e863bbe68bcd3c33cbb04e | [
"Apache-2.0"
] | null | null | null | package sentry
import (
"google.golang.org/grpc"
grpc_sentry "github.com/johnbellone/grpc-middleware-sentry"
"go.linka.cloud/grpc/interceptors"
)
type interceptor struct {
opts []grpc_sentry.Option
}
func NewInterceptors(option ...grpc_sentry.Option) interceptors.Interceptors {
return &interceptor{opts: option}
}
func (i *interceptor) UnaryServerInterceptor() grpc.UnaryServerInterceptor {
return grpc_sentry.UnaryServerInterceptor(i.opts...)
}
func (i *interceptor) StreamServerInterceptor() grpc.StreamServerInterceptor {
return grpc_sentry.StreamServerInterceptor(i.opts...)
}
func (i *interceptor) UnaryClientInterceptor() grpc.UnaryClientInterceptor {
return grpc_sentry.UnaryClientInterceptor(i.opts...)
}
func (i *interceptor) StreamClientInterceptor() grpc.StreamClientInterceptor {
return grpc_sentry.StreamClientInterceptor(i.opts...)
}
| 25.5 | 78 | 0.795848 |
0444054d7d409f2b12fbbf2535af0a2c58f39bbe | 3,641 | java | Java | src/com/sf/web/si/order/entity/OmsOpHistory.java | chenth0517/JatWeb | dad6617ddcb11f829ddfed05dcfb1e36ce391fa8 | [
"Apache-2.0"
] | null | null | null | src/com/sf/web/si/order/entity/OmsOpHistory.java | chenth0517/JatWeb | dad6617ddcb11f829ddfed05dcfb1e36ce391fa8 | [
"Apache-2.0"
] | null | null | null | src/com/sf/web/si/order/entity/OmsOpHistory.java | chenth0517/JatWeb | dad6617ddcb11f829ddfed05dcfb1e36ce391fa8 | [
"Apache-2.0"
] | null | null | null | package com.sf.web.si.order.entity;
import java.io.Serializable;
import javax.persistence.*;
import com.smartframework.web.core.annotation.SmartFieldAnnotation;
import com.smartframework.core.annotation.SmartComment;
import java.util.*;
/**
* oms_op_history
* @创建人 chenth
* @日期 2020/05/20
*/
@Entity
@Table(name = "oms_op_history")
@SmartComment("oms_op_history")
public class OmsOpHistory implements Serializable
{
@Id
@SequenceGenerator(name = "_generated_id", allocationSize = 1,initialValue=1,sequenceName="SQ_OMS_OP_HISTORY")
@GeneratedValue(strategy = GenerationType.AUTO,generator="_generated_id")
@Column(name = "id" ,length = 10 ,nullable = false)
@SmartFieldAnnotation(description="工单处理流水号",checkValueRange=false ,minValue=0,maxValue = 0)
private Integer id;
@Column(name = "order_id" ,length = 10)
@SmartFieldAnnotation(description="工单编号",checkValueRange=false ,minValue=0,maxValue = 0)
private Integer orderId;
@Column(name = "remark" ,length = 512)
@SmartFieldAnnotation(description="处理过程描述",checkValueRange=false ,minLength=0,maxLength = 512)
private String remark;
@Column(name = "result" ,length = 10)
@SmartFieldAnnotation(description="处理结果", enumName = "SMART_INFO_DIC_TASKSTATUS", checkValueRange=false ,minValue=0,maxValue = 0)
private Integer result;
@Column(name = "op_time" ,length = 19)
@SmartFieldAnnotation(description="操作时间",checkValueRange=false ,minDate="1970-01-01 00:00:00",maxDate = "1970-01-01 00:00:00")
private Date opTime;
@Column(name = "op_type" ,length = 10)
@SmartFieldAnnotation(description = "操作类型", enumName = "SMART_INFO_DIC_OPHISTORYTYPE", checkValueRange = false, minValue = 0, maxValue = 0)
private Integer opType;
@Column(name = "user_id" ,length = 10)
@SmartFieldAnnotation(description="处理人员ID",checkValueRange=false ,minValue=0,maxValue = 0)
private Integer userId;
@Column(name = "task_id" ,length = 10)
@SmartFieldAnnotation(description="任务编号",checkValueRange=false ,minValue=0,maxValue = 0)
private Integer taskId;
@Transient
private Map<String, String> mapFileNameId;
public void setId(Integer id)
{
this.id = id ;
}
public Integer getId()
{
return this.id ;
}
public void setOrderId(Integer orderId)
{
this.orderId = orderId ;
}
public Integer getOrderId()
{
return this.orderId ;
}
public void setRemark(String remark)
{
this.remark = remark ;
}
public String getRemark()
{
return this.remark ;
}
public void setResult(Integer result)
{
this.result = result ;
}
public Integer getResult()
{
return this.result ;
}
public Date getOpTime() {
return opTime;
}
public void setOpTime(Date opTime) {
this.opTime = opTime;
}
public Integer getOpType() {
return opType;
}
public void setOpType(Integer opType) {
this.opType = opType;
}
public void setUserId(Integer userId)
{
this.userId = userId ;
}
public Integer getUserId()
{
return this.userId ;
}
public void setTaskId(Integer taskId)
{
this.taskId = taskId ;
}
public Integer getTaskId()
{
return this.taskId ;
}
public Map<String, String> getMapFileNameId() {
return mapFileNameId;
}
public void setMapFileNameId(Map<String, String> mapFileNameId) {
this.mapFileNameId = mapFileNameId;
}
}
| 24.601351 | 143 | 0.651469 |
92870569a06303a28613e04d62a31690eb8baca9 | 150 | h | C | Engine/Updater.h | rubis-lab/CPSim_Linux_Generalized | da276f7686fd0775d0787fc6ea96c7e9b992cd48 | [
"MIT"
] | 4 | 2020-11-04T13:08:14.000Z | 2020-12-04T05:51:30.000Z | Engine/Updater.h | rubis-lab/CPSim_Linux_Generalized | da276f7686fd0775d0787fc6ea96c7e9b992cd48 | [
"MIT"
] | 1 | 2020-12-11T13:23:43.000Z | 2020-12-11T13:23:43.000Z | Engine/Updater.h | rubis-lab/CPSim_Linux_Generalized | da276f7686fd0775d0787fc6ea96c7e9b992cd48 | [
"MIT"
] | 29 | 2020-11-09T05:21:02.000Z | 2020-12-04T09:29:14.000Z | #ifndef UPDATER_H__
#define UPDATER_H__
class Updater
{
private:
public:
Updater();
~Updater();
void update();
};
#endif | 10 | 20 | 0.586667 |
e71ba17ab11e845ce217a05693b83a4926078751 | 13,129 | js | JavaScript | packages/people-and-teams/focused-task-close-account/dist/esm/i18n/de.js | rholang/archive-old | 55d05c67b2015b646e6f3aa7c4e1fde778162eea | [
"Apache-2.0"
] | 1 | 2020-04-24T13:28:17.000Z | 2020-04-24T13:28:17.000Z | packages/people-and-teams/focused-task-close-account/dist/esm/i18n/de.js | rholang/archive-old | 55d05c67b2015b646e6f3aa7c4e1fde778162eea | [
"Apache-2.0"
] | 1 | 2022-03-02T07:06:35.000Z | 2022-03-02T07:06:35.000Z | packages/people-and-teams/focused-task-close-account/dist/esm/i18n/de.js | rholang/archive-old | 55d05c67b2015b646e6f3aa7c4e1fde778162eea | [
"Apache-2.0"
] | null | null | null | /**
* NOTE:
*
* This file is automatically generated by i18n-tools.
* DO NOT CHANGE IT BY HAND or your changes will be lost.
*/
// German
export default {
'focused-task-close-account.deactivate-account': 'Konto deaktivieren',
'focused-task-close-account.delete-account': 'Konto löschen',
'focused-task-close-account.learnMore': 'Mehr erfahren',
'focused-task-close-account.cancel': 'Abbrechen',
'focused-task-close-account.next': 'Weiter',
'focused-task-close-account.previous': 'Zurück',
'focused-task-close-account.delete-account.overview.heading.self': 'Ihr Konto löschen',
'focused-task-close-account.delete-account.overview.heading.admin': 'Konto löschen',
'focused-task-close-account.delete-account.overview.first.line.self': 'Sie sind dabei, Ihr Konto zu löschen:',
'focused-task-close-account.delete-account.overview.first.line.admin': 'Sie sind dabei, das Konto zu löschen von:',
'focused-task-close-account.delete-account.overview.warning-section.body': 'Nach einer 14-tägigen Nachfrist können Sie die Löschung des Kontos nicht mehr rückgängig machen. Wenn Sie Ihr Konto später weiterverwenden möchten, sollten Sie es nur deaktivieren.',
'focused-task-close-account.delete-account.overview.warning-section.deactivated.body': 'Nach einer 14-tägigen Nachfrist können Sie die Löschung des Kontos nicht mehr rückgängig machen.',
'focused-task-close-account.delete-account.overview.paragraph.about-to-delete.admin': 'Wenn Sie das Konto löschen:',
'focused-task-close-account.delete-account.overview.paragraph.about-to-delete.self': 'Wenn Sie Ihr Konto löschen:',
'focused-task-close-account.delete-account.overview.paragraph.loseAccess.admin': '{fullName} <b>verliert sofort den Zugriff</b> auf alle Atlassian-Konto-Services. Er/sie hat derzeit Zugriff auf:',
'focused-task-close-account.delete-account.overview.paragraph.loseAccess.self': 'Sie <b>verlieren sofort den Zugriff</b> auf alle Atlassian-Konto-Services. Sie haben derzeit Zugriff auf:',
'focused-task-close-account.delete-account.overview.paragraph.loseAccess.admin.noSites': '{fullName} <b>verliert sofort den Zugriff</b> auf alle Atlassian-Konto-Services. Derzeit hat er/sie ausschließlich Zugriff auf Services wie Community und Marketplace.',
'focused-task-close-account.delete-account.overview.paragraph.loseAccess.self.noSites': 'Sie <b>verlieren sofort den Zugriff</b> auf alle Atlassian-Konto-Services. Derzeit haben Sie ausschließlich Zugriff auf Services wie Community und Marketplace.',
'focused-task-close-account.delete-account.overview.paragraph.loseAccess.footnote': 'Andere Atlassian-Konto-Services, wie Atlassian Community und Marketplace.',
'focused-task-close-account.delete-account.overview.paragraph.content-created.admin': 'Die erstellten Inhalte bleiben in den Atlassian-Konto-Services bestehen.',
'focused-task-close-account.delete-account.overview.paragraph.content-created.self': 'Die von Ihnen erstellten Inhalte bleiben in den Atlassian-Konto-Services bestehen.',
'focused-task-close-account.delete-account.overview.inline-dialog.content-created.admin': 'Zum Beispiel Seiten, Vorgänge und Kommentare, die in den Produkten erstellt wurden.',
'focused-task-close-account.delete-account.overview.inline-dialog.content-created.self': 'Zum Beispiel Seiten, Vorgänge und Kommentare, die Sie in den Produkten erstellt haben.',
'focused-task-close-account.delete-account.overview.paragraph.personal-data-will-be-deleted.admin': 'Wir <b>löschen die personenbezogenen Daten</b>, wie den vollständigen Namen und die E-Mail-Adresse der Atlassian-Konto-Services innerhalb von 30 Tagen, außer in einigen Fällen, falls für notwendige geschäftliche oder legale Zwecke erforderlich.',
'focused-task-close-account.delete-account.overview.paragraph.personal-data-will-be-deleted.self': 'Wir <b>löschen Ihre personenbezogenen Daten</b>, wie Ihren vollständigen Namen und Ihre E-Mail-Adresse der Atlassian-Konto-Services innerhalb von 30 Tagen, außer in einigen Fällen, falls für notwendige geschäftliche oder legale Zwecke erforderlich.',
'focused-task-close-account.delete-account.overview.paragraph.list-of-apps-with-personal-data.admin': 'Sie erhalten per E-Mail eine Liste mit Apps, in denen ggf. Ihre personenbezogenen Daten gespeichert sind.',
'focused-task-close-account.delete-account.overview.paragraph.list-of-apps-with-personal-data.self': 'Sie erhalten per E-Mail eine Liste mit Apps, in denen ggf. Ihre personenbezogenen Daten gespeichert sind.',
'focused-task-close-account.delete-account.overview.paragraph.grace-period.admin': 'Nach einer 14-tägigen Nachfrist können Sie die Löschung des Kontos nicht mehr rückgängig mache.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.p1.admin': 'Wir speichern personenbezogene Daten für einen begrenzten Zeitraum, wenn wir dafür notwendige geschäftliche oder legale Zwecke haben. Dazu gehören unter anderem:',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.p1.self': 'Wir speichern personenbezogene Daten für einen begrenzten Zeitraum, wenn wir dafür notwendige geschäftliche oder legale Zwecke haben. Dazu gehören unter anderem:',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.li1.admin': 'Mit Käufen verbundene Informationen, die für den Finanzbericht gespeichert wurden.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.li1.self': 'Mit Käufen verbundene Informationen, die für den Finanzbericht gespeichert wurden.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.li2.admin': 'Einträge zeigen, dass ein Konto einer Person gelöscht wurde, das wir ggf. einer Aufsichtsbehörde melden müssen.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.li2.self': 'Einträge zeigen, dass ein Konto einer Person gelöscht wurde, das wir ggf. einer Aufsichtsbehörde melden müssen.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.li3.admin': 'Daten, die Teil eines laufenden Verfahrens sind, die von Rechts wegen gespeichert wurden.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.li3.self': 'Daten, die Teil eines laufenden Verfahrens sind, die von Rechts wegen gespeichert wurden.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.p2.admin': 'Wir löschen keine personenbezogenen Daten von von anderen Personen erstellten Inhalten, wie Namen oder E-Mail-Adressen, die in eine Seite oder einen Vorgang eingegeben wurden. Die Produktadministratoren müssen diese Daten manuell löschen.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.p2.self': 'Wir löschen keine personenbezogenen Daten von von Ihnen oder anderen Personen erstellten Inhalten, wie Namen oder E-Mail-Adressen, die in eine Seite oder einen Vorgang eingegeben wurden. Ihre Produktadministratoren müssen diese Daten manuell löschen.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.p3.admin': 'Benutzer haben das Recht, Beschwerde bei einer Aufsichtsbehörde in ihrem Land einzureichen.',
'focused-task-close-account.delete-account.overview.inline-dialog.personal-data-will-be-deleted.p3.self': 'Sie haben das Recht, Beschwerde bei einer Aufsichtsbehörde in Ihrem Land einzureichen.',
'focused-task-close-account.delete-account.overview.inline-dialog.data-apps.admin': 'Sie und andere Benutzer haben ggf. installierte Apps, die Funktionen zu Atlassian-Produkten hinzufügen. Diese Apps haben ggf. die Profilinformationen des Benutzers gespeichert.',
'focused-task-close-account.delete-account.overview.inline-dialog.data-apps.self': 'Sie oder andere Benutzer haben ggf. installierte Apps, die Funktionen zu Atlassian-Produkten hinzufügen. Diese Apps haben ggf. deine Profilinformationen gespeichert.',
'focused-task-close-account.deactivate-account.overview.heading.self': 'Konto deaktivieren',
'focused-task-close-account.deactivate-account.overview.heading.admin': 'Konto deaktivieren',
'focused-task-close-account.deactivate-account.overview.first.line.self': 'Sie sind dabei, das Benutzerkonto zu löschen von:',
'focused-task-close-account.deactivate-account.overview.first.line.admin': 'Sie sind dabei, das Benutzerkonto zu löschen von:',
'focused-task-close-account.deactivate-account.overview.last.line.self': 'Sie können das Konto jederzeit reaktivieren.',
'focused-task-close-account.deactivate-account.overview.last.line.admin': 'Sie können das Konto jederzeit reaktivieren.',
'focused-task-close-account.deactivate-account.overview.paragraph.about-to-deactivate.admin': 'Wenn Sie das Konto deaktivieren:',
'focused-task-close-account.deactivate-account.overview.paragraph.about-to-deactivate.self': 'Wenn Sie das Konto deaktivieren:',
'focused-task-close-account.deactivate-account.overview.paragraph.loseAccess.admin': '{fullName} <b>verliert sofort den Zugriff</b> auf alle Atlassian-Konto-Services. Er/sie hat derzeit Zugriff auf:',
'focused-task-close-account.deactivate-account.overview.paragraph.loseAccess.self': 'Sie <b>verlieren sofort den Zugriff</b> auf alle Atlassian-Konto-Services. Sie haben derzeit Zugriff auf:',
'focused-task-close-account.deactivate-account.overview.paragraph.loseAccess.admin.noSites': '{fullName} <b>verliert sofort den Zugriff</b> auf alle Atlassian-Konto-Services. Derzeit hat er/sie ausschließlich Zugriff auf Services wie Community und Marketplace.',
'focused-task-close-account.deactivate-account.overview.paragraph.loseAccess.self.noSites': 'Sie <b>verlieren sofort den Zugriff</b> auf alle Atlassian-Konto-Services. Derzeit haben Sie ausschließlich Zugriff auf Services wie Community und Marketplace.',
'focused-task-close-account.deactivate-account.overview.paragraph.loseAccess.footnote': 'Andere Atlassian-Konto-Services, wie Atlassian Community und Marketplace.',
'focused-task-close-account.deactivate-account.overview.paragraph.personal-data.admin': 'Die personenbezogenen Daten, wie der vollständige Name und die E-Mail-Adresse, und erstellte Inhalte bleiben in den Atlassian-Konto-Services bestehen.',
'focused-task-close-account.deactivate-account.overview.paragraph.personal-data.self': 'Die personenbezogenen Daten, wie der vollständige Name und die E-Mail-Adresse, und erstellte Inhalte bleiben in den Atlassian-Konto-Services bestehen.',
'focused-task-close-account.deactivate-account.overview.paragraph.billing.admin': 'Dafür wird Ihnen nichts mehr berechnet.',
'focused-task-close-account.deactivate-account.overview.paragraph.billing.self': 'Dafür wird Ihnen nichts mehr berechnet.',
'focused-task-close-account.delete-account.content-preview.heading.admin': 'Wie sollte Ihrer Meinung nach der gelöschte Benutzer angezeigt werden?',
'focused-task-close-account.delete-account.content-preview.heading.self': 'Wie sollte Ihrer Meinung nach Ihr gelöschtes Konto angezeigt werden?',
'focused-task-close-account.delete-account.content-preview.paragraph.survey.admin': 'Nach der Löschung des Kontos des Benutzers erscheint er für andere Benutzer als „Ehemaliger Benutzer”. Bitte nehmen Sie sich einen Moment Zeit, an unserer Umfrage teilzunehmen.',
'focused-task-close-account.delete-account.content-preview.paragraph.survey.self': 'Nach der Löschung Ihres Kontos erscheinen Sie für andere Benutzer als „Ehemaliger Benutzer”. Bitte nehmen Sie sich einen Moment Zeit, an unserer Umfrage teilzunehmen.',
'focused-task-close-account.delete-account.content-preview.line.survey.admin': 'Wenn Sie die Wahl hätten, wie sollte Ihrer Meinung nach der gelöschte Benutzer für andere Benutzer angezeigt werden?',
'focused-task-close-account.delete-account.content-preview.line.survey.self': 'Wenn Sie die Wahl hätten, wie sollten Sie Ihrer Meinung nach für andere Benutzer angezeigt werden?',
'focused-task-close-account.delete-account.content-preview.footnote.admin': 'Hinweis: Wenn Sie an dieser Umfrage teilnehmen, können wir die Benutzerfreundlichkeit für alle verbessern. Wenn Sie sein Konto löschen, erscheint der Benutzer dennoch als „Ehemaliger Benutzer”.',
'focused-task-close-account.delete-account.content-preview.footnote.self': 'Hinweis: Wenn Sie an dieser Umfrage teilnehmen, können wir die Benutzerfreundlichkeit für alle verbessern, auch für diejenigen, die ihr Konto löschen. Wenn Sie Ihr Konto löschen, erscheinen Sie dennoch als „Ehemaliger Benutzer”.',
'focused-task-close-account.delete-account.content-preview.formerUser': 'Ehemaliger Benutzer',
'focused-task-close-account.delete-account.drop-down-expand-button': '{num} weitere',
'focused-task-close-account.delete-account.drop-down-collapse-button': 'Weniger anzeigen',
};
//# sourceMappingURL=de.js.map | 164.1125 | 363 | 0.795186 |
a5e2a43a563242773886e4011249697859784584 | 1,131 | dart | Dart | lib/pages/player/widgets/control_background.dart | pmtothemoon/unusable_player | 9e8bd2ba52b7a01d3639a3711f529192112013b9 | [
"X11"
] | 68 | 2021-12-01T10:35:43.000Z | 2022-03-28T08:06:38.000Z | lib/pages/player/widgets/control_background.dart | pmtothemoon/unusable_player | 9e8bd2ba52b7a01d3639a3711f529192112013b9 | [
"X11"
] | 1 | 2021-12-28T16:49:02.000Z | 2021-12-28T16:49:02.000Z | lib/pages/player/widgets/control_background.dart | pmtothemoon/unusable_player | 9e8bd2ba52b7a01d3639a3711f529192112013b9 | [
"X11"
] | 2 | 2021-12-21T21:43:31.000Z | 2021-12-29T14:30:16.000Z | import 'package:flutter/material.dart';
import 'package:neat/neat.dart';
import 'package:unusable_player/unusable_player.dart' as up;
class ControlBackground extends StatelessWidget {
const ControlBackground({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(vertical: up.Dimensions.space3),
decoration: BoxDecoration(
border: Border.all(
color: context.colorScheme.onSurface,
width: up.Dimensions.borderSize,
),
borderRadius: BorderRadius.circular(up.Dimensions.borderRadius1),
color: context.colorScheme.primary,
),
child: Container(
margin: const EdgeInsets.all(up.Dimensions.space5),
decoration: BoxDecoration(
border: Border.all(
color: context.colorScheme.onSurface,
width: up.Dimensions.borderSize,
),
borderRadius: BorderRadius.circular(up.Dimensions.borderRadius2),
color: context.colorScheme.secondary,
),
// child: SizedBox.expand(),
),
);
}
}
| 32.314286 | 75 | 0.658709 |
6b3f277ba552d3449ae4601e5c6904703bff32be | 1,526 | h | C | nb/mbe/internal/vocoder/sa_enh.h | go-voice/voice | f5275d2171e170f3712897734a43fc3c214c4840 | [
"MIT"
] | null | null | null | nb/mbe/internal/vocoder/sa_enh.h | go-voice/voice | f5275d2171e170f3712897734a43fc3c214c4840 | [
"MIT"
] | null | null | null | nb/mbe/internal/vocoder/sa_enh.h | go-voice/voice | f5275d2171e170f3712897734a43fc3c214c4840 | [
"MIT"
] | null | null | null | /*
* Project 25 IMBE Encoder/Decoder Fixed-Point implementation
* Developed by Pavel Yazev E-mail: pyazev@gmail.com
* Version 1.0 (c) Copyright 2009
*
* 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 3, or (at your option)
* any later version.
*
* The 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; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Boston, MA
* 02110-1301, USA.
*/
#ifndef _SA_ENH
#define _SA_ENH
#define CNST_0_9898_Q1_15 0x7EB3
#define CNST_0_5_Q2_14 0x2000
#define CNST_1_2_Q2_14 0x4CCC
//-----------------------------------------------------------------------------
// PURPOSE:
// Perform Spectral Amplitude Enhancement
//
//
// INPUT:
// IMBE_PARAM *imbe_param - pointer to IMBE_PARAM structure with
// valid num_harms, sa and fund_freq items
//
// OUTPUT:
// None
//
// RETURN:
// Enhanced Spectral Amplitudes
//
//-----------------------------------------------------------------------------
void sa_enh(IMBE_PARAM *imbe_param);
#endif
| 29.921569 | 80 | 0.625164 |
d8051423322c3e53e45973298d5529fc3aa44c00 | 427 | swift | Swift | AlgorithmDataStructure/LeetCode/219-ContainsDuplicateII/duplicate.swift | MA806P/ComputerScienceNotes | 819638319d64e22e6ac60e4d128508fb59203350 | [
"Apache-2.0"
] | null | null | null | AlgorithmDataStructure/LeetCode/219-ContainsDuplicateII/duplicate.swift | MA806P/ComputerScienceNotes | 819638319d64e22e6ac60e4d128508fb59203350 | [
"Apache-2.0"
] | null | null | null | AlgorithmDataStructure/LeetCode/219-ContainsDuplicateII/duplicate.swift | MA806P/ComputerScienceNotes | 819638319d64e22e6ac60e4d128508fb59203350 | [
"Apache-2.0"
] | null | null | null |
class Solution {
func containsNearbyDuplicate(_ nums: [Int], _ k: Int) -> Bool {
var map = [Int: Int]()
for (i, value) in nums.enumerated() {
if map[value] != nil && i - map[value]! <= k {
return true
} else {
map[value] = i;
}
}
return false
}
}
let s = Solution()
print(s.containsNearbyDuplicate([1,2,3,1,2,3],2))
| 22.473684 | 67 | 0.466042 |
3e98046ff94036ae9fcca91afba7cde726d5f6c9 | 1,073 | h | C | src/commands/newlayer.h | circlingthesun/cloudclean | 4b9496bc3b52143c35f0ad83ee68bbc5e8aa32d5 | [
"MIT"
] | 2 | 2018-10-18T16:10:21.000Z | 2020-05-28T01:52:24.000Z | src/commands/newlayer.h | circlingthesun/cloudclean | 4b9496bc3b52143c35f0ad83ee68bbc5e8aa32d5 | [
"MIT"
] | null | null | null | src/commands/newlayer.h | circlingthesun/cloudclean | 4b9496bc3b52143c35f0ad83ee68bbc5e8aa32d5 | [
"MIT"
] | 4 | 2017-12-13T07:39:18.000Z | 2021-05-29T13:13:48.000Z | #ifndef NEWLAYERCOMMAND_H
#define NEWLAYERCOMMAND_H
#include <vector>
#include <memory>
#include <map>
#include <QUndoCommand>
#include <QColor>
#include <QString>
#include <boost/shared_ptr.hpp>
#include <boost/weak_ptr.hpp>
#include "commands/export.h"
class LayerList;
class PointCloud;
class Layer;
class COMMAND_API NewLayer : public QUndoCommand
{
public:
NewLayer(boost::shared_ptr<PointCloud> pc,
boost::shared_ptr<std::vector<int> > idxs,
LayerList * ll);
QString actionText();
virtual void undo();
virtual void redo();
virtual bool mergeWith(const QUndoCommand *other);
virtual int id() const;
private:
uint16_t getNewLabel(uint16_t old, boost::shared_ptr<Layer> layer);
private:
std::map<uint16_t, uint16_t> old_to_new;
std::map<uint16_t, uint16_t> new_to_old;
boost::shared_ptr<PointCloud> pc_;
boost::shared_ptr<std::vector<int> > idxs_;
LayerList * ll_;
uint new_layer_id_;
QColor layer_color_;
bool applied_once_;
};
#endif // NEWLAYERCOMMAND_H
| 21.897959 | 71 | 0.696179 |
2f201e1bd6bc2ddac4bf4f92e7069a3afba452af | 6,050 | php | PHP | app/Http/Controllers/Api/OcorrenciaController.php | mwtelles/HorseHoof | dfa1fc7ecc63f30a3f6a0f39c0e24bf4dcfedb1d | [
"MIT"
] | null | null | null | app/Http/Controllers/Api/OcorrenciaController.php | mwtelles/HorseHoof | dfa1fc7ecc63f30a3f6a0f39c0e24bf4dcfedb1d | [
"MIT"
] | null | null | null | app/Http/Controllers/Api/OcorrenciaController.php | mwtelles/HorseHoof | dfa1fc7ecc63f30a3f6a0f39c0e24bf4dcfedb1d | [
"MIT"
] | null | null | null | <?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Requests\StoreOcorrenciaRequest;
use App\Http\Resources\OcorrenciaResource;
use App\Models\Cavalo;
use App\Models\Ocorrencia;
use App\Models\OcorrenciaFoto;
use App\Models\User;
use App\Notifications\NovaOcorrencia;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class OcorrenciaController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
*/
public function index()
{
return OcorrenciaResource::collection(auth()->user()->ocorrencias);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function store(StoreOcorrenciaRequest $request)
{
DB::beginTransaction();
$cavalo = Cavalo::create($request->only(['apelido', 'sexo', 'idade','cavalo_raca_id']));
$ocorrencia = new OcorrenciaResource(
auth('api')->user()->ocorrencias()->create(
$request->merge(['cavalo_id' => $cavalo->id,'status'=>0])->all()
)
);
$ocorrencia->fotos()->create([
'type' => 'VISTA LATERAL',
'pata' => 'POSTERIOR ESQUERDA',
'path' => $request->fotos_posterior_esquerda_lateral->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA PALMAR',
'pata' => 'POSTERIOR ESQUERDA',
'path' => $request->fotos_posterior_esquerda_palmar->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA FRONTAL',
'pata' => 'POSTERIOR ESQUERDA',
'path' => $request->fotos_posterior_esquerda_frontal->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA LATERAL',
'pata' => 'POSTERIOR DIREITA',
'path' => $request->fotos_posterior_direita_lateral->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA PALMAR',
'pata' => 'POSTERIOR DIREITA',
'path' => $request->fotos_posterior_direita_palmar->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA FRONTAL',
'pata' => 'POSTERIOR DIREITA',
'path' => $request->fotos_posterior_direita_frontal->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA LATERAL',
'pata' => 'ANTERIOR ESQUERDA',
'path' => $request->fotos_anterior_esquerda_lateral->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA PALMAR',
'pata' => 'ANTERIOR ESQUERDA',
'path' => $request->fotos_anterior_esquerda_palmar->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA FRONTAL',
'pata' => 'ANTERIOR ESQUERDA',
'path' => $request->fotos_anterior_esquerda_frontal->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA LATERAL',
'pata' => 'ANTERIOR DIREITA',
'path' => $request->fotos_anterior_direita_lateral->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA PALMAR',
'pata' => 'ANTERIOR DIREITA',
'path' => $request->fotos_anterior_direita_palmar->store('ocorrencias/fotos/','public')
]);
$ocorrencia->fotos()->create([
'type' => 'VISTA FRONTAL',
'pata' => 'ANTERIOR DIREITA',
'path' => $request->fotos_anterior_direita_frontal->store('ocorrencias/fotos/','public')
]);
DB::commit();
//NOTIFICA ADMINISTRADORES
$admins = User::where('is_admin',true)->get();
foreach ($admins as $admin){
Notification::send($admin, new NovaOcorrencia($ocorrencia));
}
return response()->json($ocorrencia,201);
}
/**
* Display the specified resource.
*
* @param \App\Models\Ocorrencia $ocorrencia
* @return \Illuminate\Http\Response
*/
public function show(Request $request, Ocorrencia $ocorrencia)
{
if($ocorrencia->user_id !== auth()->user()->id){
abort(404);
}
return new OcorrenciaResource($ocorrencia);
}
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Ocorrencia $ocorrencia
* @return \Illuminate\Http\Response
*/
public function edit(Ocorrencia $ocorrencia)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Ocorrencia $ocorrencia
* @return OcorrenciaResource
*/
public function update(Request $request, Ocorrencia $ocorrencia)
{
$ocorrencia->update($request->all());
return new OcorrenciaResource($ocorrencia);
}
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Ocorrencia $ocorrencia
* @return \Illuminate\Http\Response
*/
public function destroy(Ocorrencia $ocorrencia)
{
$ocorrencia->fotos()->delete();
$ocorrencia->delete();
return response()->noContent();
}
}
| 33.060109 | 104 | 0.57438 |
9dd7aa6f2b83f16ffb6fa656ec7e5a6fdbf94e71 | 4,462 | swift | Swift | Cashew/Models/QIssueEvent.swift | bellebethcooper/cashew | 0927ac11e43de2bd48c02a36d4df827b31894e76 | [
"MIT"
] | 24 | 2018-10-29T05:57:17.000Z | 2021-04-27T20:58:17.000Z | Cashew/Models/QIssueEvent.swift | bellebethcooper/cashew | 0927ac11e43de2bd48c02a36d4df827b31894e76 | [
"MIT"
] | 66 | 2018-10-28T19:39:16.000Z | 2019-05-11T21:10:18.000Z | Cashew/Models/QIssueEvent.swift | bellebethcooper/cashew | 0927ac11e43de2bd48c02a36d4df827b31894e76 | [
"MIT"
] | 2 | 2018-10-29T21:59:25.000Z | 2019-01-14T22:12:11.000Z | //
// QIssueEvent.swift
// Issues
//
// Created by Hicham Bouabdallah on 1/26/16.
// Copyright © 2016 Hicham Bouabdallah. All rights reserved.
//
import Cocoa
class QIssueEvent: NSObject, IssueEventInfo, SRIssueDetailItem {
@objc var identifier: NSNumber!
@objc var actor: QOwner!
@objc var issueNumber: NSNumber!
@objc var createdAt: Date!
@objc var event: NSString?
@objc var commitId: NSString?
@objc var label: QLabel?
@objc var assignee: QOwner?
@objc var milestone: QMilestone?
@objc var renameFrom: NSString?
@objc var renameTo: NSString?
@objc var account: QAccount? {
didSet {
if let anAccount = account {
self.repository?.account = anAccount
self.actor?.account = anAccount
self.assignee?.account = anAccount
self.milestone?.account = anAccount
self.label?.account = anAccount
} else {
self.repository?.account = nil
self.actor?.account = nil
self.assignee?.account = nil
self.milestone?.account = nil
self.label?.account = nil
}
}
}
@objc var repository: QRepository? {
didSet {
if let aRepository = repository {
self.milestone?.repository = aRepository
self.label?.repository = aRepository
} else {
self.milestone?.repository = nil
self.label?.repository = nil
}
}
}
func sortDate() -> Date! {
return self.createdAt
}
@objc var additions: NSMutableOrderedSet {
get {
guard let event = event else { return NSMutableOrderedSet() }
if let labelName = label?.name , event == "labeled" {
return [labelName]
} else if let milestoneName = milestone?.title , event == "milestoned" {
return NSMutableOrderedSet(array: [milestoneName])
}
return NSMutableOrderedSet()
}
}
var removals: NSMutableOrderedSet {
get {
guard let event = event else { return NSMutableOrderedSet() }
if let labelName = label?.name , event == "unlabeled" {
return [labelName]
} else if let milestoneName = milestone?.title , event == "demilestoned" {
return NSMutableOrderedSet(array: [milestoneName])
}
return NSMutableOrderedSet()
}
}
override var description: String {
return "IssueEvent: actor=\(actor.login) createdAt=\(createdAt) event=\(event) label=\(label) milestone=\(milestone?.title) renameFrom=\(renameFrom) renameTo=\(renameTo)"
}
@objc static func fromJSON(_ json: NSDictionary) -> QIssueEvent {
let event = QIssueEvent()
event.identifier = json["id"] as! NSNumber
event.actor = QOwner.fromJSON(json["actor"] as? [AnyHashable: Any])
let createdAt = json["created_at"] as! String
event.createdAt = Date.githubDateFormatter.date(from: createdAt)
event.event = json["event"] as? NSString
if let theCommitId = json["commit_id"] as? String {
event.commitId = theCommitId as NSString?
}
if let anAssignee = json["assignee"] as? [AnyHashable: Any] {
event.assignee = QOwner.fromJSON(anAssignee)
}
if let aMilestone = json["milestone"] as? [AnyHashable: Any] {
event.milestone = QMilestone.fromJSON(aMilestone)
}
if let rename = json["rename"] as? [String: Any] {
event.renameFrom = rename["from"] as? NSString
event.renameTo = rename["to"] as? NSString
}
if let aLabel = json["label"] as? [AnyHashable: Any] {
event.label = QLabel.fromJSON(aLabel)
}
// if let labelsJSONArray = json["label"] as? [AnyObject] {
// event.labels = []
// for labelJSON in labelsJSONArray {
// let label = QLabel.fromJSON(labelJSON as! [NSObject : AnyObject])
// event.labels?.append(label)
// }
// }
return event
}
}
| 33.298507 | 178 | 0.541013 |
141c75b8f422a60cc58c0b16eb8efbee8e0b5992 | 53,733 | css | CSS | data/usercss/180090.user.css | 33kk/uso-archive | 2c4962d1d507ff0eaec6dcca555efc531b37a9b4 | [
"MIT"
] | 118 | 2020-08-28T19:59:28.000Z | 2022-03-26T16:28:40.000Z | data/usercss/180090.user.css | 33kk/uso-archive | 2c4962d1d507ff0eaec6dcca555efc531b37a9b4 | [
"MIT"
] | 38 | 2020-09-02T01:08:45.000Z | 2022-01-23T02:47:24.000Z | data/usercss/180090.user.css | 33kk/uso-archive | 2c4962d1d507ff0eaec6dcca555efc531b37a9b4 | [
"MIT"
] | 21 | 2020-08-19T01:12:43.000Z | 2022-03-15T21:55:17.000Z | /* ==UserStyle==
@name HR Polish Poppies
@namespace USO Archive
@author Samarti
@description `Based on HR's Polish Poppies Background.`
@version 20200220.0.49
@license CC-BY-NC-ND-4.0
@preprocessor uso
==/UserStyle== */
@-moz-document domain("horsereality.com"), domain("horsereality.nl") {
body > div.container.cta > div.container_12.center > div.banner > div, body > div.container > div.container_12.center > div.banner > div {
background-image: url(https://i.imgur.com/p5mfPWs.png) !important;
background-size: 50%;
background-position: 540px 20px;
}
body > div.container.cta > div.container_12.center > div.banner, body > div.container > div.container_12.center > div.banner {
background-image: url(https://www.horsereality.com/images/profilebg_poppyfields.jpg) !important;
background-size: 120%;
background-position: center 610px;
}
body > div.container.cta > div.container_12.center > div.banner > div > div > div {
margin-left: -20px;
}
/* latin */
@font-face {
font-family: 'Cinzel Decorative';
font-style: normal;
font-weight: 400;
src: local('Cinzel Decorative Regular'), local('CinzelDecorative-Regular'), url(https://fonts.gstatic.com/s/cinzeldecorative/v7/daaCSScvJGqLYhG8nNt8KPPswUAPni7TTMw.woff2) format('woff2');
}
/* latin */
@font-face {
font-family: 'Lobster Two';
font-style: normal;
font-weight: 400;
src: local('Lobster Two'), local('LobsterTwo'), url(https://fonts.gstatic.com/s/lobstertwo/v11/BngMUXZGTXPUvIoyV6yN5-fN5qU.woff2) format('woff2');
}
/* latin */
@font-face {
font-family: 'Quicksand';
font-style: normal;
font-weight: 400;
src: local('Quicksand Regular'), local('Quicksand-Regular'), url(https://fonts.gstatic.com/s/quicksand/v9/6xKtdSZaM9iE8KbpRA_hK1QN.woff2) format('woff2');
}
/* announcement header */
.header-cta button.yellow {
height: 25px;
}
.header-cta h2 {
font-family: Roboto;
padding-top: 4px;
color: #ffdaad;
text-shadow: 0 0 5px #ffffff7d;
}
.header-cta h2 span {
text-shadow: 0 0 5px #ffffff7d;
font-family: Roboto;
color: #ffdaad;
}
.header-cta .cta-button {
padding-top: 6px;
}
.header-cta .cta-timer {
padding-top: 9px;
text-shadow: 0 0 5px #bb77044f;
color: #ffdaad;
}
.header-cta {
background-color: #263a35;
border-bottom: 2px ridge #c5724c;
height: 37px;
z-index: 991;
}
/* mobile menu */
.mobile-menu-container {
background: linear-gradient(#980000, #450000);
}
input[type="submit"].yellow.front, input[type="button"].yellow.front {
height: 32px;
}
input[type="file"] {
padding-top: 4px;
padding-left: 4px;
padding-bottom: 4px;
}
input[type="radio"] {
box-shadow: none;
}
input, textarea, select {
background-color: #202a26 ;
border: 1px solid #c5724c ;
color: #e1d0ca ;
font-family: Quicksand ;
font-weight: bold ;
border-radius: 5px ;
padding-left: 3px;
}
button.green, input[type="submit"].green {
height: 30px;
background-color: #722402;
color: #e1d0ca;
font-weight: bold;
border: 1px inset #e08f6a;
font-family: Quicksand ;
border-radius: 5px ;
}
button.green:hover, input[type="submit"].green:hover {
background-color: #98360c;
}
button.gray, input[type="submit"].gray {
height: 30px;
background-color: #25342e ;
border: 1px solid #753e24 ;
color: #e1d0ca ;
font-family: Quicksand ;
font-weight: bold ;
border-radius: 5px ;
}
button.gray:hover, input[type="submit"].gray:hover {
background-color: #14211c;
}
input:focus, textarea:focus, select:focus {
outline: none;
}
.market_left input {
border:none;
}
.column_300 input[type="number"], .market_left select, .store_flex select, form fieldset select, form fieldset input[type="text"], form fieldset input[type="email"], form fieldset input[type="password"], form.contact textarea, form.contact input[type="text"] {
background-color: #202a26 ;
border: 1px ridge #c5724c ;
color: #e1d0ca ;
box-shadow: 0 0 8px -2px #00000052 inset ;
font-family: Quicksand ;
font-weight: bold ;
border-radius: 5px ;
}
.logo.user img, .footer.user .botleft img {
filter: drop-shadow(0 0 5px #c5724c);
opacity: 0.8;
}
h2 {
font-family: Lobster Two ;
font-size: 18px ;
color: #715151 ;
}
.introwrapper .container_12 h1, .banner .bimages h1, .title h1,
div.npc_box > div > h1, .banner .bimages .box {
text-shadow: 0 0 5px #bb77044f;
padding-bottom: 10px;
color: #e6a181;
}
.banner .bimages h1 {
border-radius: 5px;
}
.banner .bimages .box {
opacity: 0.9;
border-radius: 5px;
}
.gamestats, .gamestats a:link, .gamestats a:hover, .gamestats a:active, .gamestats a:visited {
color: #ded6c1 ;
text-shadow: 0 0 5px #000 ;
}
ul li a:active, ul li a:link, ul li a:visited, .footer ul li a:active, .footer ul li a:visited, .footer ul li a:link {
color: #e3ccc4 ;
font-size: 14px ;
}
.footer h6, #user > div.footer.user > div > div.botright > ul > li:nth-child(n) > a {
color: #9f8e81 ;
text-shadow: 0 0 3px #000 ;
}
#horses > div.container > div.container_12.center > div.horse_banner.asia > div.horse_left > h1 {
padding-left: 0px;
font-size: 22px;
}
#user > div.footer.user > div > div.botleft > a > img {
opacity: 0.7;
}
.disc {
background: #cc8039; /* Old browsers */
background: -moz-linear-gradient(top, #cc8039 0%,#953c0d 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #cc8039 0%,#953c0d 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #cc8039 0%,#953c0d 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
}
.affection {
background: #bd3b44; /* Old browsers */
background: -moz-linear-gradient(top, #bd3b44 0%,#8a0f17 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #bd3b44 0%,#8a0f17 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to bottom, #bd3b44 0%,#8a0f17 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
}
.energy_val, .trainbar > .exp, .training_right > .block > .barcon > .trainbar > .trained, .energy, .training_right>.block>.barcon>.trainbar, .training_right>.block>.barcon>.trainbar>.value, .energy_val_half, .value {
color: #fdeae4;
}
.introwrapper .container_12 h1, .banner .bimages h1, h1 {
font-family: Lobster Two;
font-size: 33px;
padding-left: 26px;
}
h1 {
padding-top: 10px;
text-align: center;
}
#bbmenu.user ul.slidedown li ul.slidedownmenu {
border: 2px ridge #c5724c;
border-radius: 0 0 10px 10px ;
border-top: none ;
background-color: #22302c ;
}
#bbmenu.user ul.slidedown li ul.slidedownmenu li .level p {
color: #e3ccc4 ;
font-family: Quicksand ;
font-weight: bold ;
}
#bbmenu.user ul.slidedown li ul.slidedownmenu li .ava {
border: none ;
filter: drop-shadow(0 0 5px #000000ab) ;
}
#bbmenu.user ul.slidedown li:hover, #bbmenu.user ul.slidedown li:focus, #bbmenu.user ul.slidedown li:active {
background-color: transparent ;
}
#bbmenu.user ul.slidedown li a:hover, .toplinks ul li a:hover, .gamestats a:hover {
color: #ffe4cc;
text-shadow: 0 0 5px #ffffff73;
}
.advertising {
background: #162420;
border-top: 3px ridge #c5724c ;
}
.avatar {
border: 3px ridge #c5724c;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.60);
border-radius: 8px;
}
.minimap:hover {
filter: brightness(120%) drop-shadow(0px 0px 5px #f4ca378a);
}
.mavatar {
border: 3px ridge #c5724c;
border-radius: 0%;
box-shadow: 0px 0px 10px 0px rgba(176, 126, 119, .28);
}
.bluebar_container {
border-bottom: 2px ridge #c5724c ;
border-top: 2px ridge #c5724c ;
box-shadow: 0px 14px 20px -9px rgba(0,0,0,0.36) ;
background: url(https://www.horsereality.com/images/profilebg_poppyfields.jpg);
background-size: 100%;
background-position: 0 400px;
}
.container, .container_12 .center-area {
outline: 3px ridge #c5724c;
background-color: #192421;
}
body > div.container > div.container_12.center > div.introwrapper > div > div:nth-child(4) > div:nth-child(3) > table > tbody {
outline: none;
}
body {
background-color: #16221f;
color: #c1bbb3;
}
body p, h6, form fieldset label#check, fieldset label#check {
color: #c1bbb3
}
.training_left .horsetraining .traincon .trainblock h3, .quote, div.row_960.half.even p strong, .training_right>.block>.comp h3, .training_right>.block>.show h3, .introwrapper .container_12 p {
color: #c1bbb3;
}
span.achievement {
color: #c5724c;
font-size: 20px;
}
.center, div.container_12.center {
background-color: #192421;
}
.leftnav {
background: #1d2e29;
border-bottom: 2px ridge #c5724c ;
border-radius: 0 0 80px 0;
border-right: 2px ridge #c5724c ;
border-color: #c5724c;
box-shadow: none ;
margin-left: 0px ;
width: 148px ;
height: 668px;
margin-top: -1px;
}
.leftnav > ul > li {
margin-top: 10px ;
text-transform: uppercase ;
font-size: 12px ;
}
.leftnav::before {
content: "Theme © Samarti";
color: #c5724c;
text-align: center ;
padding-left: 10px ;
font-size: 11px ;
font-family: Quicksand ;
font-weight: 1000;
}
.leftnav > ul > li > ul > li a:active, .leftnav > ul > li > ul > li a:link, .leftnav > ul > li > ul > li a:visited {
color: #e69e76;
text-transform: capitalize;
text-shadow: none;
}
.leftnav > ul > li > ul > li a:hover {
color: #ff6b19;
}
.subtitle, .mobile-menu-container .mobile-menu-scroller .sidemenu li .subtitle {
font-family: Quicksand ;
color: #ec8938;
text-shadow: 0 0 5px #7800005c;
}
.mobile-menu-container .mobile-menu-scroller .sidemenu li ul li a {
color: #e8dec7;
}
.parents a p, .parents a:link p, .parents a:visited p,
.grandparents a:active p, .grandparents a:link p, .grandparents a:visited p, .ggrandparents a:active p, .ggrandparents a:link p, .ggrandparents a:visited p, .grandparents p {
color: #c1bbb3;
}
.grandparents_tree, .parents_tree {
filter: invert(1);
opacity: 0.3;
}
p a:active, p a:link, p a:visited, .col_400 a:active, .col_400 a:link, .col_400 a:visited, .col_100 a:active, .col_100 a:link, .col_100 a:visited, .col_200 a:active, .col_200 a:link, .col_200 a:visited, .col_500 a:active, .col_500 a:link, .col_500 a:visited, .col_300 a:active, .col_300 a:link, .col_300 a:visited, .col_750 a:active, .col_750 a:link, .col_750 a:visited, .col_150 a:active, .col_150 a:link, .col_150 a:visited, .breadcrumbs a:link, .breadcrumbs a:visited, .breadcrumbs a:active, div.breadcrumbs, table tr td a:active, table tr td a:link, table tr td a:visited, div.adopt_blocktitle a b, .adopt_blocktext p a:active, .adopt_blocktext p a:link, .adopt_blocktext p a:visited, h1 a:active, h1 a:link, h1 a:visited, .col_700 a:active, .col_700 a:link, .col_700 a:visited, .miniparents a p, .minigparents a p, .minigparents p, .minigparents a, .miniggparents a p, .miniggparents p, .miniggparents a, .grid_12 form fieldset label, .grid_12 fieldset label, .pagenumbers a:active, .pagenumbers a:link, .pagenumbers a:visited, #mail_right p a:active, #mail_right p a:visited, #mail_right p a:link, .store_title a:active, .store_title a:link, .store_title a:visited, form fieldset label, fieldset label, .subtop .col_900 a:link, .subtop .col_900 a:visited, .subtop .col_900 a:active, p.white a:active, p.white a:link, p.white a:visited, .column_200 a:active, .column_200 a:link, .column_200 a:visited, form fieldset a:active, form fieldset a:link, form fieldset a:visited, .horse_blocktext p a:active, .horse_blocktext p a:link, .horse_blocktext p a:visited, .alert a {
color: #ee8054;
}
div.col_100 p a:hover, div.col_200 p a:hover, div.col_300 p a:hover, div.col_500 p a:hover, div.horse_blocktext p a:hover, div.right a:hover, p a:hover, p i a:hover, td p a:hover, .col_400 a:active:hover, .col_400 a:link:hover, .col_400 a:hover, .col_750 a:hover, .col_750 a:link:hover, .col_750 a:hover, .col_150 a:hover, .breadcrumbs a:hover, table tr td a:hover, div.adopt_blocktitle a b:hover, .adopt_blocktext p a:hover, .parents a:hover p, .grandparents a:hover p, .ggrandparents a:hover p, h1 a:hover, div.looking_at p a:hover, .col_700 a:hover, .miniparents a:hover p, .minigparents a:hover p, .miniggparents a:hover p, .pagenumbers a:hover, .introwrapper .container_12 p.link.big a:link, .introwrapper .container_12 p.link.big a:active, .introwrapper .container_12 p.link.big a:visited, #mail_right p a:hover, .store_title a:hover, .subtop .col_900 a:hover, .column_200 a:hover, form fieldset a:hover {
color: #ffb98e;
text-decoration: none;
}
#forum .footnote {
filter: brightness(0.9);
}
#forum .footnote_border {
border-color: #573c2c;
filter: brightness(1.2);
}
.block_tabclick, block_tabclick.tabsel, #store_left.tabnav .store_tabclick.tabsel, .grid_12.deltapoints .buy_container .buy_block, #store_left.tabnav .store_tabclick {
border: 1px solid transparent;
border-left: 2px solid transparent;
background-color: #243631;
border-radius: 5px;
margin-top: 1px;
}
#store_left.tabnav .store_tabclick.tabsel, #store_left.tabnav .store_tabclick {
height: 10px;
line-height: 0.8;
}
.grid_12.deltapoints .buy_container .buy_block {
outline: 2px ridge #c5724c;
outline-offset: -2px;
}
.mail_link:hover, .block_tabclick:hover, .block_tabclick:active, #store_left.tabnav .store_tabclick:hover, #store_left.tabnav .store_tabclick:active{
border-left: 2px solid #d2451b;
background-color: transparent;
}
.block_tabclick.tabsel, #store_left.tabnav .store_tabclick.tabsel {
border-bottom: 1px solid #ffc09c;
border-top: 1px solid #c5724c;
border-right: 1px solid #c5724c;
border-left: 4px ridge #c5724c;
background: linear-gradient(to top, #00241b, #13483a);
color: #e9c8a0;
text-shadow: 0 0 3px #000;
border-radius: 5px;
}
#store_left {
color: #c1bbb3;
}
.mail_link {
border-left-width: 4px;
}
.mail_link:hover {
border-left-width: 4px;
}
.mail_link.selected {
border-bottom: 1px solid #ffc09c;
border-top: 1px solid #c5724c;
border-right: 1px solid #c5724c;
border-left: 4px ridge #c5724c;
background: linear-gradient(to top, #00241b, #13483a);
}
.mail_link.selected p {
color: #eee198;
text-shadow: 0 0 4px black;
}
.introwrapper .container_12 p.link.big a:hover {
color: #7c9550;
transition: 0.5s;
}
.numselected {
background: #2b4039;
border-bottom: 2px ridge #c5724c;
color: #c5724c;
}
.breadcrumbs {
background-color: #2f3d39;
}
.footer {
border: 2px ridge #c5724c ;
border-top: none;
box-shadow: 0px 14px 20px -9px rgba(0,0,0,0.36) ;
background-color: #0f1714;
}
span.numbers {
background-color: #2b4039;
}
span.numbers:hover {
border-bottom: 2px ridge #c5724c;
}
.pagenumbers a:link, .pagenumbers a:visited {
color: #caa06d;
text-shadow: 0 0 3px #000;
}
#flag {
background-color: #2b4039;
filter: drop-shadow(0 0 5px #0000007a);
}
#flag:after {
border-color: #2b4039 #2b4039 transparent #2b4039;
}
.grid_12.breeding {
border-right: none;
}
.banner .bimages {
width: 100%;
background-size: cover;
}
.alert.info {
background-color: #2b4039;
color: #ff6c6c;
font-weight: 600;
border: 2px ridge #c5724c;
}
.alert.error {
background-color: #2b4039;
color: #ff2d2d;
font-weight: 600;
border: 2px ridge #c5724c;
}
.alert.warning {
background-color: #2b4039;
border: 2px ridge #c5724c;
color: #ffd0aa;
}
.milestone_text h2 {
font-size: 20px;
}
.minimap {
border: 2px ridge #c5724c ;
border-radius: 100% ;
box-shadow: 0px 0px 8px 1px #0009 ;
margin-left: 10px ;
margin-top: 15px;
width: 115px ;
height: 115px ;
}
.profile_account {
border: 2px ridge #dca287 ;
border-radius: 10px ;
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, .31) inset;
background: #826144;
color: #e9d2b6;
}
.profile_account h2 {
border: none ;
border-bottom: 2px ridge #dca287 ;
border-radius: 0px ;
box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.1) ;
color: #eee0ce ;
text-shadow: 0 0 10px #00000094;
font-family: Quicksand ;
text-transform: uppercase;
font-size: 15px ;
font-weight: 1000 ;
padding: 5px 10px ;
text-align: center ;
margin-top: -10px ;
margin-left: -10px ;
width: 230px ;
margin-bottom: 5px ;
background: url(https://www.horsereality.com/images/profilebg_poppyfields.jpg);
background-position: center 80px;
}
.trainbar > .exp, .training_right > .block > .barcon > .trainbar > .trained, .energy, .uni_xp, .xpvalue
{
background: #438e5a; /* Old browsers */
background: -moz-linear-gradient(top, #438e5a, #0d5140 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(top, #438e5a 0%,#0d5140 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(#438e5a,#0d5140); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
}
.minidetails, table tr td {
border-left: 1px transparent solid ;
}
table tr td {
background-color: transparent ;
}
h2 {
font-family: Lobster Two;
font-size: 25px;
font-weight: 500;
padding-top: 10px;
color: #e6a181;
}
.profile_menu {
background: url(https://www.horsereality.com/images/profilebg_poppyfields.jpg);
background-position: bottom;
border-bottom: 3px ridge #c5724c ;
border-top: 3px ridge #c5724c ;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.60) ;
text-transform: uppercase ;
font-family: Quicksand ;
text-shadow: 0 0 5px #000000bd;
}
.profile_menu ul li {
font-size: 17px;
color: #f1c9a7;
text-shadow: 0 0 10px #000;
border-left: 1px transparent ridge;
border-right: 1px transparent ridge;
font-weight: 1000;
}
.profile_menu ul li:hover, .profile_menu ul li.tabclick:hover {
color: #edd9c7 ;
text-shadow: 0 0 5px #f00;
border-left: 1px ridge transparent;
border-right: 1px ridge transparent;
background-color: rgba(3, 80, 55, 0);
}
#selectnav {
background: linear-gradient(#00241b, #13483a);
color: #dec593;
margin-left: 10px;
}
.profile_menu ul li.rightside img {
height: 34px;
}
.profile_ranking {
opacity: 0.8 ;
}
.profile_username h1 {
color: #ffeee5fc ;
font-family: Lobster Two ;
font-size: 40px ;
font-weight: 100 ;
text-shadow: 0px 0px 5px #000000b0 ;
text-align: left;
padding-left: 0px;
}
.profile_username h2 {
color: #f6dacfc7 ;
font-family: Roboto ;
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 100;
text-shadow: 0px 0px 5px #000000fc ;
font-size: 12px ;
margin-top: -20px;
}
.mobile-menu-container .mobile-menu-scroller>ul.slidedownmenu li a i {
color: #f2c036 ;
text-shadow: none;
}
@media (max-width: 768px) {
#veterinarian > div.bluebar_container.user > div > div.show-xs.mobile-menu-container.open > div > div.toplinks > ul > li:nth-child(n) > a, #bbmenu > ul > li > a, ul li a:active, ul li a:link, ul li a:visited {
color: #f0eade ;
text-shadow: none;
}
.mobile-menu-container .mobile-menu-scroller .sidemenu li .minimap {
margin-top: 20px;
}
#bbmenu.user ul.slidedown li ul.slidedownmenu {
border: none;
}
#horses > div.container > div.container_12.center > div.title > button,
#horses > div.container > div.container_12.center > div.title > a > button {
height: 50px;
}
.grid_12.select_nav select {
height: 40px;
}
}
#bbmenu > ul > li > ul > li > div.ava > img {
filter: drop-shadow(0 0 0px transparent);
}
.mobile-menu-container .mobile-menu-scroller>ul.slidedownmenu {
border-bottom: 2px solid #c5724c !important;
}
.mobile-menu-container .mobile-menu-scroller .toplinks {
border-bottom: 1px solid #c5724c !important;
}
::selection {
background-color: #dc4d0069;
color: #e5ecea;
}
::-webkit-scrollbar {
height: 10px ;
width: 10px ;
background: #12241f ;
}
::-webkit-scrollbar-thumb {
background: linear-gradient(to right, #861f01, #854c29);
border-radius: 100px ;
border: 1px ridge #c5724c;
}
::-webkit-scrollbar-thumb:hover {
background: linear-gradient(to right, #c66d39, #c94605);
border-radius: 10px ;
}
.traincon.terrain-click *, .traincon.duration-click * {
background: transparent;
}
body.background.north-america, body.background.south-america, body.background.europe, body.background.australia, body.background.asia, body.background.africa {
background-image: url("https://www.horsereality.com/images/profilebg_poppyfields.jpg");
background-size: cover;
background-position: 0%;
}
tbody {
outline: 1px solid #5b463a;
}
button._train-round.yellow, button.yellow, input[type="submit"].yellow, button.yellow.front, button.dark.marg, input[type="submit"].dark.marg, button.darkblue, button.dark, input[type="submit"].dark, button.buy_fhorse.dark.marg, input[type="submit"].yellow.front, input[type="button"].yellow.front, .adopt_button button {
background-color: #722402 ;
color: #e1d0ca ;
font-family: Quicksand ;
font-weight: bold ;
border: 1px inset #e08f6a ;
}
button._train-round.yellow:hover, input[type="submit"].yellow:hover, button.yellow:hover,button.dark.marg:hover, input[type="submit"].dark.marg:hover, button.darkblue:hover, button.dark:hover, input[type="submit"].dark:hover, button.buy_fhorse.dark.marg:hover,.adopt_button button:hover, button.orange {
background-color: #b63507 ;
}
button.orange:hover {
background-color: #8e1616 ;
color: #f4d41b ;
font-family: Quicksand ;
font-weight: bold ;
border: 1px inset #c5724c ;
}
.adopt_blockimg.white, .adopt_blockimg.white.locked {
background-color: rgba(255, 255, 255, .4);
}
/* PROFILE */
grid_12 stable_block {
background-color: #f4eeee ;
}
div section table {
border-color: #c5724c;
border-left-width: 0;
border-right-width: 0;
border-style: ridge;
border-top-width: 0;
}
div.comp a img {
background-color: #ffffff;
border-color: #c5724c;
border-style: none;
border-width: 2px;
}
.container_12 .grid_8.training_left, div.genetic_potential, div.genetic_result, .genetic_tests .test_block .first {
background-color: #2e3d39;
}
div.grid_12.deltapoints {
border: none;
outline: 2px ridge #c5724c;
background-color: #25322f;
}
.buy_explain h4 {
color: #eab598;
}
.buy_explain h5 {
color: #ffc038;
}
div.grid_8.training_left h6, div.subtop {
width: calc(100% - 10px);
margin-left: 0px;
background-color: #16221f;
border-bottom: 1px ridge #884020;
color: #eab598;
}
#deltapoints > div.container.cta > div.container_12.center > div > div:nth-child(3) > div > div.row_960 > p > strong {
color: #f66 !important;
}
.container_12 .grid_4.training_right, div.genetic_table_row, div.grid_6.genetics, .container_12 .grid_8.training_left {
outline: 1px solid #5b463a;
border: none;
background-color: #25322f;
}
div.genetic_table_row {
outline: none;
}
.even, .row_300 {
background-color: #25322f;
}
div.row_460.odd {
background-color: #2e3d39;
}
.container_12 .grid_6.half_block {
border: none;
outline: 1px solid #5b463a;
}
div.horse_blockimg, .training_right>.block>.comp img, .training_right>.block>.show img, .training_right>.block>.comp img, .training_right>.block>.comp img {
background-color: transparent;
}
p{
color: #22512b;
}
div.horse_left {
background-color: #192622e6;
border: 1px ridge #8c3d1c;
color: #d9b89d;
opacity: 1;
}
div.horse_left h1 {
font-family: Lobster Two;
font-size: 24px;
text-align: left;
padding-left: 0;
color: #fd8941;
}
.horse_left .right a:active, .horse_left .right a:link, .horse_left .right a:visited, #horses > div.container > div.container_12.center > div.horse_banner.asia > div.horse_left > p:nth-child(3) > i > a {
color: #ff983e;
}
.horse_left .right a:hover, #horses > div.container > div.container_12.center > div.horse_banner.asia > div.horse_left > p:nth-child(3) > i > a:hover {
color: #ffb98e;
}
#horses > div.container > div.container_12.center > div.horse_banner.asia > div.horse_left > p:nth-child(2) > strong {
color: #d9b89d;
}
ins {
background-image: none;
background-color: #767467;
}
.a_c_div {
border: none;
filter: grayscale(0.4);
}
div.idea_support {
background-color: #25322f;
border-top: 1px solid #573c2c;
}
body#user #tab_profile2 h3, body#forum .grid_12 h3 {
color: #ded6c1;
}
div.looking_at {
background-color: #192622e6;
border: 1px ridge #c66947;
opacity: 1;
}
div.looking_at p a:hover {
color: #f50;
}
div.looking_at p strong {
color: #ded6c1;
}
div.quote {
background-color: #25322f;
}
#tab_training2 > div > div.grid_4.training_right > div:nth-child(2) > div.show > a > img,
#tab_training2 > div > div > div.grid_4.training_right > div:nth-child(2) > div > a > img,
#tab_training2 > div > div.grid_4.training_right > div:nth-child(2) > div.comp > a > img,
.training_left .horsetraining .traincon .trainblock .trainimg {
filter: invert(1);
}
#tab_training2 > div > div.grid_8.training_left > div:nth-child(5) > div.traincon.terrain-click.selected > div > label > div > img,
#tab_training2 > div > div.grid_8.training_left > div:nth-child(5) > div:nth-child(2) > div > label > div > img,
#tab_training2 > div > div.grid_8.training_left > div:nth-child(5) > div:nth-child(3) > div > label > div > img,
#tab_training2 > div > div.grid_8.training_left > div:nth-child(5) > div:nth-child(4) > div > label > div > img,
#tab_training2 > div > div.grid_8.training_left > div:nth-child(5) > div:nth-child(1) > div > label > div > img,
#tab_training2 > div > div > div.grid_8.training_left > div:nth-child(5) > div:nth-child(1) > div > label > div > img,
#tab_training2 > div > div > div.grid_8.training_left > div:nth-child(5) > div:nth-child(2) > div > label > div > img,
#tab_training2 > div > div > div.grid_8.training_left > div:nth-child(5) > div.traincon.terrain-click.selected > div > label > div > img,
#tab_training2 > div > div > div.grid_8.training_left > div:nth-child(5) > div:nth-child(4) > div > label > div > img,
#train_estimate > div:nth-child(1) > div > label > div.trainimg > img,
#train_estimate > div:nth-child(2) > div > label > div.trainimg > img,
#train_estimate > div:nth-child(3) > div > label > div.trainimg > img,
#train_estimate > div:nth-child(4) > div > label > div.trainimg > img,
#train_estimate > div.traincon.duration-click.selected > div > label > div.trainimg > img,
#tab_training2 > div > div > div.grid_8.training_left > div:nth-child(5) > div:nth-child(3) > div > label > div > img,
#\31 > div > div.trainimg > img,
#\32 > div > div.trainimg > img,
#\33 > div > div.trainimg > img,
#\34 > div > div.trainimg > img,
#\35 > div > div.trainimg > img,
#\36 > div > div.trainimg > img,
#\37 > div > div.trainimg > img,
#\38 > div > div.trainimg > img{
filter: invert(1);
}
#competitions > div.container > div.container_12.center > div.grid_12.stable_block > div:nth-child(n) > div:nth-child(1) > a > img {
filter: invert(1);
opacity: 0.6;
}
.registry_block .row.even {
background-color: #25322f !important;
padding: 5px 0;
}
.registry_block .row.odd {
background-color: #2e3d39 !important;
}
div.row_960.even {
background-color: #25322f;
}
div.row_960.no_padding {
background-color: #d6d2ce;
}
div.row_960.odd {
background-color: #2e3d39;
}
div.row_960.odd.myhorse, div.row_960.even.myhorse {
background-color: #49615b;
border-bottom: 1px solid #283d33;
}
div.row_960.odd.myhorse p a, div.row_960.even.myhorse p a {
color: #ff7b46;
}
span.shoutout.bestdeal {
background-color: #b95d16;
color: #fffcea;
text-shadow: 0 0 5px #eee198;
box-shadow: 0 0 5px #eee198;
}
span.shoutout.popular {
background-color: #b95d16;
color: #fffcea;
text-shadow: 0 0 5px #eee198;
box-shadow: 0 0 5px #eee198;
}
.buy_img span.superdeal {
background-color: #f7ccb3;
color: #890000;
box-shadow: 0 0 5px #00000054;
transform: rotate(5deg);
}
div.show a img {
background-color: #ffffff;
border-color: #e3d5c9;
border-style: none;
border-width: 2px;
}
div.storeblocks {
background-color: #25322f;
border-bottom-width: 4px;
border-color: #c5724c;
border-left-width: 1px;
border-right-width: 1px;
border-style: ridge;
border-top-width: 2px;
}
.store_title, h3, .base p, .base ul, .base ol, .milestone_text h2 {
color: #c1bbb3;
}
div.tabclick {
padding-bottom: 3px;
padding: 5px 10px;
border: 1px ridge #c5724c;
}
div.tabtext.flex-container.wrap table {
background-color: #000;
border-style: none;
}
div.top, table thead tr.sub {
outline: 3px ridge #c5724c;
outline-offset: -1px;
border: none;
padding: 8px;
padding-right: 3px;
color: #f0d0b3;
background: url(https://www.horsereality.com/images/profilebg_poppyfields.jpg);
background-position: center 230px;
background-blend-mode: overlay;
background-color: #25322f63;
text-transform: uppercase;
}
.container_12 .grid_12.stable_block .top {
outline: 3px ridge #c5724c !important;
outline-offset: -2px;
}
#competition > div.container > div.container_12.center > div:nth-child(n) > div.top {
outline-offset: -2px;
}
div.top {
font-size: 18px;
letter-spacing: 4px;
}
.col_960 {
margin-left: 10px;
}
.buy_block .buy_top {
background-color: #0f2620;
border-bottom: 1px solid #623622;
}
.container_12 .grid_12.stable_block {
border: none;
outline: 1px solid #5b463a;
}
div.traincon.selected {
background-color: #2e3d39 !important;
}
div.traincon.terrain-click.selected {
background-color: #2e3d39 !important;
}
.training_left .horsetraining .traincon {
background-color: transparent;
}
div.vet_blocks, .adopt_blocks, div.npc_box, .uni_blocks, #mail_right{
background-color: #25322f;
outline: 2px ridge #5b463a;
}
#mail_right {
width: 735px;
padding-bottom: 10px;
}
.mail_text {
background-color: #2e3d39;
border: none;
border-bottom: 1px solid #573c2c;
}
#mail_right > a > button {
margin-left: 10px;
}
.mail_header {
outline: 3px ridge #c5724c;
outline-offset: -1px;
border: none;
background: url(https://www.horsereality.com/images/profilebg_poppyfields.jpg);
background-position: center 230px;
background-blend-mode: overlay;
background-color: #25322f63;
}
.mail_header h2 {
padding-top: 0px;
}
.mail_subheader {
background-color: #16221f;
border-bottom: 1px ridge #884020;
}
#mail_right > div:nth-child(even) {
background-color: #16221f;
border-bottom: 1px solid #573c2c;
}
#mail_right > div:nth-child(even):hover {
background-color: #2e3d39;
}
#mail_right > div.mail_subheader:hover {
background-color: #16221f;
}
.mail_row {
width: 720px;
padding-top: 7px;
padding-bottom: 7px;
}
.mail_link {
width: 100px;
background-color: #243631;
margin-left: 10px;
border-radius: 5px;
margin-top: 5px;
height: 22px;
}
table thead tr.sub {
outline: 3px ridge #c5724c;
border: none;
color: #d9bba1;
background: url("https://www.horsereality.com/images/profilebg_poppyfields.jpg");
background-position: center 230px;
background-blend-mode: overlay;
background-color: #25322f63;
}
table, div.tabtext.flex-container.wrap table, table thead tr.top, div section table {
background-color: transparent;
}
tr.even td {
background-color: #25322f;
}
tr.odd td {
background-color: #2e3d39;
}
tr.top {
background-color: transparent;
border-color: transparent;
border-top-width: 0;
}
tr.top td {
border-color: #ead5ce;
border-style: ridge;
border-width: 2px;
}
#forum .row_960 .col_750.mod {
background: url("https://www.horsereality.com/images/moderator.png") no-repeat right top #25322f;
}
#forum .row_960 .col_750 {
background-color: #25322f;
}
.tox :not(svg), .tox .tox-toolbar, .tox .tox-toolbar__overflow, .tox .tox-toolbar__primary, .tox .tox-statusbar {
border: none;
}
div.tabclick {
background: #16221f;
border-bottom: 2px ridge transparent !important;
color: #eab598;
text-shadow: 0px 0px 4px #ffd700a8;
height: 10px;
}
div.tabclick:hover {
border-bottom: 2px ridge #dbb3a1 !important;
text-decoration: none;
}
.tabclick.tabsel, .tabclick2.tabsel, .tabclick3.tabsel {
border-bottom: 2px ridge #c5724c !important;
background: linear-gradient(#6a1a1a, #8c5131);
color: #ded6c1;
}
.lab_selectall {
background-color: #25322f;
color: #e1d0ca;
font-family: Quicksand;
}
button.red, input[type=submit].red {
background-color: #1d2e29;
border: 1px ridge red;
color: #edc5a8;
font-family: Quicksand;
}
button.red:hover {
background-color: #e10404;
color: black;
border-color: #f00;
}
.premium-only {
background: none;
background-color: #1e1e1e4a;
color: #031d08;
border: 2px ridge #ffb133;
text-shadow: 0 0 5px #0000;
}
.premium-only fieldset label, .premium-only h3 {
background: -webkit-linear-gradient(#ffb133, #9f7600);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
text-shadow: 0 0 5px #bb77044f;
}
#total_gp_type, #acceleration_type, #agility_type, #balance_type, #bascule_type, #pullingpower_type, #speed_type, #sprint_type, #stamina_type, #strength_type, #surefootedness_type,
#total_gp, #acceleration, #agility, #balance, #bascule, #pullingpower, #speed, #sprint, #stamina, #strength, #surefootedness,
#walk, #trot, #canter, #gallop, #posture, #head, #neck, #shoulders, #frontlegs, #hindquarters, #back, #socks{
border: 1px ridge #ffb133;
box-shadow: 0 0 5px #5b5b5b2b;
color: #ffd083;
}
#retirement-home > div.container > div.container_12.center > div:nth-child(1) > div.top {
color: transparent;
}
#retirement-home > div.container > div.container_12.center > div:nth-child(1) > div.top::before {
content: "🥀 Poppy Ponies 🥀";
width: 200px;
height: 200px;
color: #ded6c1;
font-size: 16px;
}
.training_right>.block {
background-color: transparent;
}
.pedigree, .container_12 .grid_6.half_block {
background-color: #25322f;
}
.training_right>.block>.barcon>.trainbar, .trainbar, .energybar, .horse_statusbar, .uni_statusbar, .statusbar, .energybar_half {
background-color: #2e3d39;
border: 1px ridge #5b463a;
}
body > div.container.cta > div.container_12.center > div.introwrapper > div > div:nth-child(4) > div:nth-child(3) > table > tbody {
outline: none;
}
.uni_blockimg {
background-color: transparent;
}
#mail_right > div.mail_text.tinymce > input {
margin-top: 10px;
margin-left: 2px;
}
#mail_right > div.mail_text.tinymce {
background-color: transparent;
border: none;
}
p {
color: #c1bbb3;
}
.tox .tox-statusbar, .tox .tox-toolbar, .tox .tox-toolbar__overflow, .tox .tox-toolbar__primary {
background-color: #2e3d39;
border-bottom: 1px solid #5b463a;
}
.tox .tox-tbtn svg, .tox .tox-tbtn--disabled svg, .tox .tox-tbtn--disabled:hover svg, .tox .tox-tbtn:disabled svg, .tox .tox-tbtn:disabled:hover svg {
fill: #c5724c;
}
.tox .tox-tbtn:hover {
background: #c5724c;
}
.tox-tinymce {
border: none;
}
.tox .tox-toolbar {
border-bottom: 2px ridge #c5724c;
}
.tox .tox-toolbar, .tox .tox-toolbar__overflow, .tox .tox-toolbar__primary {
background: none;
}
.tox .tox-edit-area {
border-top: none;
}
.tox .tox-statusbar__resize-handle svg {
fill: #c5724c;
}
#mail_right > div.mail_text.tinymce > div > div.tox-editor-container {
width: 866px;
}
.tox .tox-statusbar a {
color: #c5724ca1;
}
#bbmenu.user ul.slidedown li a.arrow, #bbmenu.user ul.slidedown li a.arrow:hover, .slidedownmenu li a.logout, .slidedownmenu li a.logout:hover {
background-image: none;
}
#bbmenu.user ul.slidedown li a.arrow::after {
content: "⮟";
position: absolute;
margin-left: 10px;
}
.slidedownmenu li a.logout::after {
content: "⌦";
position: absolute;
margin-left: 40px;
font-size: 18px;
}
}
@-moz-document url-prefix("https://www.horsereality.com/currency-exchange"), url-prefix("https://www.horsereality.nl/currency-exchange") {
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_books > div.exchange_books_window.exchange_books_window_buy > div > table,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_books > div.exchange_books_window.exchange_books_window_sell > div > table,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_mine > div > table,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_history > div > table,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_mine > div
{
width: 100% !important;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_books > div.exchange_books_window.exchange_books_window_buy > div > div,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_history > div > div,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_books > div.exchange_books_window.exchange_books_window_sell > div > div,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_books > div.exchange_books_window.exchange_books_window_buy > div > div > table,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_history > div > div > table,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_mine > div > div {
overflow-x: hidden !important;
width: 100% !important;
}
/* width */
.tablescroll ::-webkit-scrollbar {
width: 10px;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy > h2 > img,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell > h2 > img{
height: 0px;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy > form > table > tbody > tr:nth-child(n) {
background-color: #25322f;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy {
border: 1px solid #82e182;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell,
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell > form > table > tbody > tr:nth-child(n) {
background-color: #572e22;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell {
border: 1px solid #ff9b9b;
}
.exchange_actions_window h2 {
text-align: center;
}
.exchange_books_window, .exchange_orders_window, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell {
border: none;
outline: 2px ridge #c5724c;
background-color: #25322f;
}
.exchange_actions_window_buy h2 {
background: linear-gradient(#1c4f34, #0d3721);
color: #dec593;
width: 100%;
padding: 10px 10px;
margin-left: -10px;
margin-top: -10px;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy > form > table > tbody > tr:nth-child(n), #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell > form > table > tbody > tr:nth-child(n) {
background-color: #25322f;
}
.exchange_actions_window table td div span {
background-color: #3d4f4a;
}
.exchange_actions_window_sell h2 {
background: linear-gradient(#661717, #4d0f0f);
color: #dec593;
width: 100%;
padding: 10px 10px;
margin-left: -10px;
margin-top: -10px;
}
.exchange table thead th {
outline: none;
border: none ;
padding: 8px;
padding-right: 3px;
color: #f0d0b3;
background: url(https://www.horsereality.com/images/profilebg_poppyfields.jpg);
background-position: center 230px;
background-blend-mode: overlay;
background-color: #25322f63;
text-transform: uppercase;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_books > div.exchange_books_window.exchange_books_window_buy > div > table, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_books > div.exchange_books_window.exchange_books_window_sell > div > table, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_mine > div > table, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_history > div > table, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_mine > div {
outline: 3px ridge #c5724c;
outline-offset: -3px;
}
.exchange_books_window table tbody tr, table tr {
background-color: transparent;
}
.exchange_books_window table tbody tr:nth-child(even) {
background-color: #25322f;
}
.exchange_books_window table tbody tr:nth-child(odd) {
background-color: #2e3d39;
}
#currency-exchange > div.container.cta > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_history > div > div > table > tbody > tr:nth-child(even) {
background-color: #25322f;
}
#currency-exchange > div.container.cta > div.container_12.center > div.text > div > div.exchange_orders > div.exchange_orders_window.exchange_orders_window_history > div > div > table > tbody > tr:nth-child(odd) {
background-color: #2e3d39;
}
.exchange table td {
border: 1px solid #5b463a;
}
.exchange_actions_window table td {
border: none;
}
#currency-exchange > div.container.cta > div.container_12.center > div.text > div > div.exchange_books > div.exchange_books_window.exchange_books_window_buy > div > div {
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy > form > table > tbody > tr:nth-child(5) > td > button {
background-color: #0d3721 ;
color: #dec593 ;
font-family: Quicksand ;
font-weight: bold ;
border: 1px inset #c5724c ;
width: 100%;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy > form > table > tbody > tr:nth-child(5) > td > button:hover {
background-color: #125331 ;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell > form > table > tbody > tr:nth-child(5) > td > button {
background-color: #661717 ;
color: #dec593 ;
font-family: Quicksand ;
font-weight: bold ;
border: 1px inset #c5724c ;
width: 100%;
}
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell > form > table > tbody > tr:nth-child(5) > td > button:hover {
background-color: #8c1818 ;
}
.exchange_actions_window table td div input {
border: 1px inset #c5724c;
}
/* Track */
.tablescroll ::-webkit-scrollbar-track {
background: #202b28;
}
/* Handle */
.tablescroll ::-webkit-scrollbar-thumb {
background: #392318;
}
/* Handle on hover */
.tablescroll ::-webkit-scrollbar-thumb:hover {
background: #c5724c;
}
tbody {
outline: none;
}
}
@-moz-document url-prefix("https://www.horsereality.com/currency-exchange"), url-prefix("https://www.horsereality.nl/currency-exchange") {
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy > h2::after, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell > h2::after {
content: "DP";
position: absolute;
}
}
@-moz-document url-prefix("https://www.horsereality.com/currency-exchange?market=ft-hrc"), url-prefix("https://www.horsereality.nl/currency-exchange?market=ft-hrc") {
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy > h2::after, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell > h2::after {
content: "FT";
position: absolute;
}
}
@-moz-document url-prefix("https://www.horsereality.com/currency-exchange?market=wt-hrc") {
#currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_buy > h2::after, #currency-exchange > div.container > div.container_12.center > div.text > div > div.exchange_actions > div.exchange_actions_window.exchange_actions_window_sell > h2::after {
content: "WT";
position: absolute;
}
}
@-moz-document url-prefix("https://www.horsereality.com/user/"), url-prefix("https://www.horsereality.nl/user/") {
tbody {
outline: none;
}
#tab_horses2 > div > section > table > tbody {
outline: 1px solid #5b463a;
}
}
@-moz-document url("https://www.horsereality.com/user/edit_profile"), url("https://www.horsereality.nl/user/edit_profile"), url-prefix("https://www.horsereality.com/forum/topic"), url-prefix("https://www.horsereality.nl/forum/topic") {
.row_960 {
background-color: #25322f !important;
}
#forum .row_960.no_padding {
background-color: #2e3d39 !important;
}
.tinymce ul {
color: #cca572;
}
}
@-moz-document url("https://www.horsereality.com/horses"), url("https://www.horsereality.nl/horses") {
input, textarea, select {
height: 30px;
}
button._train-round.yellow, button.yellow, input[type="submit"].yellow, button.yellow.front, button.dark.marg, input[type="submit"].dark.marg, button.darkblue, button.dark, input[type="submit"].dark, button.buy_fhorse.dark.marg, input[type="submit"].yellow.front, input[type="button"].yellow.front {
height: 30px;
}
}
@-moz-document url-prefix("https://www.horsereality.com/horses"), url-prefix("https://www.horsereality.nl/horses") {
div.top {
font-size: 16px;
letter-spacing: 0;
padding: 5px;
}
}
@-moz-document url("https://www.horsereality.com/equistore"), url("https://www.horsereality.nl/equistore"), url-prefix("https://www.horsereality.com/search"), url-prefix("https://www.horsereality.nl/search") {
form fieldset select, form.contact input[type="text"], .column_300 input[type="number"], .market_left select, .store_flex select, form fieldset select, form fieldset input[type="text"], form fieldset input[type="email"], form fieldset input[type="password"], form.contact textarea, form.contact input[type="text"] {
height: 30px;
}
.container_12 .grid_12.stable_block, div.row_960.even {
background-color: #25322f !important;
}
}
@-moz-document url-prefix("https://www.horsereality.com/veterinarian"), url-prefix("https://www.horsereality.nl/veterinarian"), url-prefix("https://www.horsereality.com/blacksmith"), url-prefix("https://www.horsereality.nl/blacksmith") {
input, textarea, select {
height: 28px;
margin-top: -3px;
}
}
@-moz-document url-prefix("https://www.horsereality.com/breed/"), url-prefix("https://www.horsereality.nl/breed/"), url-prefix("https://www.horsereality.com/inseminate/"), url-prefix("https://www.horsereality.nl/inseminate/") {
.tabclick, .tabclick2, .tabclick3 {
background: #16221f;
border-bottom: 2px solid #16221f !important;
color: #ded6c1;
text-shadow: 0 0 3px #000;
border-top: none;
}
.tabclick.tabsel, .tabclick2.tabsel, .tabclick3.tabsel {
border-bottom: 2px ridge #c5724c !important;
}
table tr td, .minidetails, table tr td {
background-color: #25322f;
}
.genetic_table_row {
border-bottom: none!important;
}
.container_12 .grid_12.stable_block, .container_12 .grid_6.half_block, .container_12 .grid_8.training_left, .container_12 .grid_4.training_right, div.genetic_table_row, div.grid_6.genetics, .container_12 .grid_12, div.row_960.half, div.row_960.even {
background-color: #25322f;
}
.grid_12.breeding {
outline: 1px solid #5b463a;
border: none;
}
.tabclick:hover, .tabclick2:hover, .tabclick3:hover {
text-decoration: none;
border-bottom: 2px ridge #c5724c !important;
}
tbody {
outline: none;
}
.mininav {
background: #1f2b28;
}
}
@-moz-document url-prefix("https://www.horsereality.com/laboratory"), url-prefix("https://www.horsereality.nl/laboratory") {
div.top {
outline-offset: -3px;
}
}
@-moz-document url("https://www.horsereality.com/competitions"), url("https://www.horsereality.nl/competitions") {
div.top {
font-size: 16px;
}
}
@-moz-document url("https://www.horsereality.nl/registries"), url("https://www.horsereality.com/registries") {
div.top {
font-size: 15px;
letter-spacing: 2px;
}
}
@-moz-document url-prefix("https://www.horsereality.com/retirement-home"), url-prefix("https://www.horsereality.nl/retirement-home") {
#retirement-home > div.container > div.container_12.center > div:nth-child(1) > div.top {
font-size: 1px;
}
} | 31.644876 | 1,575 | 0.663819 |
90e1334f6db7dcd9f29084b9c69ef22c824a70f5 | 9,078 | py | Python | zookeeper/zootils.py | alejandropages/Zookeeper | f3d5c2bb6f7f95d38902e99ec93aac0037105ee0 | [
"MIT"
] | null | null | null | zookeeper/zootils.py | alejandropages/Zookeeper | f3d5c2bb6f7f95d38902e99ec93aac0037105ee0 | [
"MIT"
] | null | null | null | zookeeper/zootils.py | alejandropages/Zookeeper | f3d5c2bb6f7f95d38902e99ec93aac0037105ee0 | [
"MIT"
] | null | null | null | from getpass import getpass
import os.path as osp
import os
from datetime import datetime as dt
import csv
import re
from subprocess import run, CalledProcessError
import panoptes_client as pan
from panoptes_client.panoptes import PanoptesAPIException
from .logger import get_logger
log = get_logger()
def upload(imgdir, projid, subject, quiet):
'''
Does:
- Uploads images from the specified image directory to zooniverse
project specified by zoo_project_id.
- Will also generate a manifest if one is not already present inside
imgdir.
Note:
- This program uploads only images listed in the manifest.csv file.
Args:
- imgdir
-type: str
-desc: The directory of the images to be uploaded
- proj_id
-type: str
-desc: The zooniverse project id to upload the images to.
- subject
-type: str
-desc: the subject set id number of an already existing subject set
- quiet
-type: bool
-desc: sets verbosity of upload
Returns:
None
'''
if quiet:
log.setLevel(logging.ERROR)
if not osp.isdir(imgdir):
log.error("Image directory '{}' does not exist".format(imgdir))
return False
try:
project = pan.Project.find(id=projid)
except PanoptesAPIException:
return False
if subject:
try:
subject_set = pan.SubjectSet.find(subject)
except PanoptesAPIException as e:
log.error("Could not find subject set id")
for arg in e.args:
log.error("> " + arg)
return False
else:
log.info("Creating new subject set")
subject_set = pan.SubjectSet()
subject_set.links.project = project
while(True):
name = input("Enter subject set display name: ")
try:
subject_set.display_name = name
subject_set.save()
except PanoptesAPIException as e:
log.error("Could not set subject set display name")
for arg in e.args:
if arg == 'You must be logged in to access this resource.':
log.error("User credentials invalid")
exit(False)
log.error("> " + arg)
if arg == 'Validation failed:' \
+ ' Display name has already been taken':
log.info("To use {} as the display name,"
+ " get the subject set id from zooniverse"
+ " and call this command with --subject <id>")
if not utils.get_yn('Try again?'):
exit(False)
continue
break
if not osp.isfile(osp.join(imgdir, 'manifest.csv')):
log.info("Generating manifest")
manif_gen_succeeded = manifest(imgdir)
if not manif_gen_succeeded:
log.error("No images to upload.")
return False
mfile = open(osp.join(imgdir, 'manifest.csv'), 'r')
fieldnames = mfile.readline().strip().split(",")
mfile.seek(0)
reader = csv.DictReader(mfile)
if 'filename' not in fieldnames:
log.error("Manifest file must have a 'filename' column")
return False
log.info("Loading images from manifest...")
error_count = 0
success_count = 0
project.reload()
for row in reader:
try:
# getsize returns file size in bytes
filesize = osp.getsize(osp.join(imgdir, row['filename'])) / 1000
if filesize > 256:
log.warning("File size of {}KB is larger than recommended 256KB"
.format(filesize))
temp_subj = pan.Subject()
temp_subj.add_location(osp.join(imgdir, row['filename']))
temp_subj.metadata.update(row)
temp_subj.links.project = project
temp_subj.save()
subject_set.add(temp_subj)
except PanoptesAPIException as e:
error_count += 1
log.error("Error on row: {}".format(row))
for arg in e.args:
log.error("> " + arg)
try:
log.info("Trying again...")
subject_set.add(temp_subj)
except PanoptesAPIException as e2:
for arg in e2.args:
log.error("> " + arg)
log.info("Skipping")
continue
success_count += 1
success_count += 1
log.debug("{}- {} - success"
.format(success_count,
str(osp.basename(row['filename']))))
log.info("DONE")
log.info("Summary:")
log.info(" Upload completed at: " + dt.now().strftime("%H:%M:%S %m/%d/%y"))
log.info(" {} of {} images loaded".format(success_count,
success_count + error_count))
log.info("\n")
log.info("Remember to link your workflow to this subject set")
return True
def manifest(imgdir):
'''
Does:
- Generates a generic manifest in the specified image directory.
- Fields are an id in the format [date]-[time]-[filenumber] and
the filename.
Args
- imgdir: str
-desc: image directory for which to generate manifest
Returns:
None
Notes:
- Default supported image types: [ tiff, jpg, jpeg, png ] - can specify any
'''
if not osp.isdir(imgdir):
log.error("Image directory " + imgdir + " does not exist")
return False
log.info("Manifest being generated with fields: [ id, filename ]")
mfile = open(osp.join(imgdir, 'manifest.csv'), 'w')
writer = csv.writer(mfile, lineterminator='\n')
writer.writerow(["id", "filename"])
idtag = dt.now().strftime("%m%d%y-%H%M%S")
PATTERN = re.compile(r".*\.(jpg|jpeg|png|tiff)")
img_c = 0
for id, filename in enumerate(os.listdir(imgdir)):
if PATTERN.match(filename):
writer.writerow(["{}-{:04d}".format(idtag, id),
osp.basename(filename)])
img_c += 1
if img_c == 999:
log.warning("Zooniverse's default limit of subjects per"
+ " upload is 1000.")
if not utils.get_yn("Continue adding images to manifest?"):
break
img_c += 1
if img_c == 0:
log.error("Could not generate manifest.")
log.error("No images found in " + imgdir + " with file extension:"
+ (extension if extension else "[jpg,jpeg,png,tiff]"))
return False
else:
log.info("DONE: {} subjects written to manifest"
.format(img_c))
mfile.close()
return True
def export(projid, outfile, exp_type, no_generate):
'''
%prog export project_id output_dir
Does:
Fetches export from zooniverse for specified project.
Args:
- project_id
-type: str
-desc: The zooniverse project id
- output_dir
-type: str
-desc: Path to the image directory with images to be uploaded
- exp_type
-type: str
-desc: The type of export to fetch
- no_generate
-type: bool
-desc: whether to avoid generating a new export to get an already generated one
Returns:
None
'''
project = pan.Project.find(id=projid)
try:
log.info("Getting export...")
if not no_generate:
log.info("Generating new export. This can take a while")
export = project.get_export(exp_type, generate=not no_generate)
with open(outfile, 'w') as zoof:
zoof.write(export.text)
except PanoptesAPIException as e:
log.error("Error getting export")
for arg in e.args:
log.error("> " + arg)
print(e.with_traceback())
return False
return True
class utils:
def connect(un=None, pw=None):
''' Connect to zooniverse '''
if not un:
un = input("Enter zooniverse username: ")
if not pw:
pw = getpass()
try:
pan.Panoptes.connect(username=un, password=pw)
except PanoptesAPIException as e:
log.error("Could not connect to zooniverse project")
raise
return
def get_yn(message):
while True:
val = input(message + " [y/n] ")
if val.lower() in ['y', 'n']:
return True if val.lower() == 'y' else False
else:
print("Invalid input")
| 31.964789 | 92 | 0.530734 |
462d2c032b092643c29443a5059545918596bf57 | 5,163 | sql | SQL | auxiliar/definicion1/34_mantenimiento.sql | megacharles56/portal2018 | 6082dc0be70589c4ee82c94e78c7f9e0a10125cd | [
"BSD-3-Clause"
] | null | null | null | auxiliar/definicion1/34_mantenimiento.sql | megacharles56/portal2018 | 6082dc0be70589c4ee82c94e78c7f9e0a10125cd | [
"BSD-3-Clause"
] | null | null | null | auxiliar/definicion1/34_mantenimiento.sql | megacharles56/portal2018 | 6082dc0be70589c4ee82c94e78c7f9e0a10125cd | [
"BSD-3-Clause"
] | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Author: develop0
* Created: 10/08/2018
*/
/*
MANTO_ID TID NOT NULL,
MNTO_FOLIO_E TID,
MNTO_FOLIO_S TID,
MNTO_FOLIO_M TID,
EMPL_ID TID,
MNTO_FALLA TSNOMBREL,
MNTO_OBSERVACIONES_U varchar(512),
MNTO_FSOLICITUD date,
MNTO_HSOLICITUD time,
MNTO_RESPONSABLE TID,
INVEN_ID TID
MNTO_F_INICIO date,
MNTO_H_INICIO time,
MNTO_DIAGNOSTICO TSNOMBREL,
MNTO_ACCIONES varchar(512),
MNTO_OBSERVACIONES_M varchar(512),
MNTO_F_ENTREGA date,
MNTO_H_ENTREGA time,
MNTO_F_RECEPCION date,
MNTO_H_RECEPCION time,
MNTO_CALIFICACION TID,
MNTO_ESTADO TID,
DEPT_ID TID,
MNTO_TIPO_MNTO TSNOMBREL,
MNTO_FECHA_PREFERENTE TSNOMBREL,
MNTO_HORA_PREFERENTE TSNOMBREL,
CONSTRAINT MNTO_KEY PRIMARY KEY (MNTO_ID)
*/
/******************************mantenimiento******************************/
Create Table mantenimiento(manto_Id Tid
Constraint manto_Id_NN Not Null
Constraint manto_key Primary Key,
manto_folio_s integer,
manto_folio_m integer,
manto_folio_e integer,
autor tid
Constraint autor_manto_NN Not Null
Constraint manto_lnk_Perso
References Personas(Perso_ID)
on Delete Cascade
on Update Cascade,
modificacion timestamp,
manto_falla tsNombreL
Constraint manto_falla_NN Not Null,
manto_observaciones tsNombre1X,
manto_f_solicitud date
Constraint manto_f_solicitud_NN Not Null,
manto_h_solicitud time
Constraint manto_h_solicitud_NN Not Null,
manto_responsable tId
Constraint manto_lnk_emple_id
References empleados
on Delete Cascade
on Update Cascade,
manto_inven_id tId
Constraint manto_lnk_inven_id
References inventario
on Delete Cascade
on Update Cascade,
manto_f_inicio date,
manto_h_inicio time,
manto_diagnostico tsNombreL,
manto_acciones tsNombre1X,
manto_observaciones_m tsNombre1X,
manto_f_entrega date,
manto_h_entrega time,
manto_f_recepcion date,
manto_h_recepcion time,
manto_califiacion tid
Constraint manto_lnk_varia_id
References variables
on Delete Cascade
on Update Cascade,
manto_estado tid
Constraint manto_estado_NN Not Null
Constraint manto_estado_lnk_varia_id
References variables
on Delete Cascade
on Update Cascade,
manto_tipo_Manto tid
Constraint manto_tipo_lnk_varia_id
References Variables
on Delete Cascade
on Update Cascade,
manto_f_preferente tsnombrel,
manto_h_preferente tsnombrel);
Create Generator manto_Id_Gen;
Commit work;
Create Generator manto_folio_s_Gen;
Commit work;
Create Generator manto_folio_m_Gen;
Commit work;
Create Generator manto_folio_e_Id_Gen;
Commit work;
Set term ^;
Create trigger
Alta_manto For mantenimiento
Active Before Insert
as
Begin
If (New.manto_Id Is null) Then
New.manto_Id = Gen_id(manto_Id_Gen,1);
new.modificacion = current_timestamp;
End ;
^
Create trigger
Modif_manto For mantenimiento
Active Before update
As
Begin
new.modificacion = current_timestamp;
End;
^
Commit work^
Create Procedure manto_Key_Gen
Returns( Avalue Integer)
As
Begin
aValue = Gen_id(manto_Id_Gen,1);
End
^
set term ; ^
Grant all on mantenimiento To Public;
Grant Execute on Procedure manto_Key_Gen To Public;
| 34.885135 | 79 | 0.499516 |
75d515d3b4e6b1d46180920e31dbe8ca0d751b70 | 681 | asm | Assembly | oeis/097/A097251.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/097/A097251.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/097/A097251.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A097251: Numbers whose set of base 5 digits is {0,4}.
; Submitted by Jon Maiga
; 0,4,20,24,100,104,120,124,500,504,520,524,600,604,620,624,2500,2504,2520,2524,2600,2604,2620,2624,3000,3004,3020,3024,3100,3104,3120,3124,12500,12504,12520,12524,12600,12604,12620,12624,13000,13004,13020,13024,13100,13104,13120,13124,15000,15004,15020,15024,15100,15104,15120,15124,15500,15504,15520,15524,15600,15604,15620,15624,62500,62504,62520,62524,62600,62604,62620,62624,63000,63004,63020,63024,63100,63104,63120,63124,65000,65004,65020,65024,65100,65104,65120,65124,65500,65504,65520,65524
mov $2,4
lpb $0
mov $3,$0
div $0,2
mod $3,2
mul $3,$2
add $1,$3
mul $2,5
lpe
mov $0,$1
| 45.4 | 499 | 0.750367 |
c4aa4ecb5de38fbb52f91e343bd5b886b816bf16 | 256 | h | C | Src/Constant/NumericConstant.h | L-proger/libComInterfaceGenerator | bb41537975ca8beff551c316ad67ef927cd138dd | [
"MIT"
] | null | null | null | Src/Constant/NumericConstant.h | L-proger/libComInterfaceGenerator | bb41537975ca8beff551c316ad67ef927cd138dd | [
"MIT"
] | null | null | null | Src/Constant/NumericConstant.h | L-proger/libComInterfaceGenerator | bb41537975ca8beff551c316ad67ef927cd138dd | [
"MIT"
] | null | null | null | #pragma once
#include "Constant.h"
class NumericConstant : public Constant {
public:
NumericConstant(std::shared_ptr<Type> type) : Constant(type){}
virtual void increment() = 0;
virtual void decrement() = 0;
virtual void negate() = 0;
};
| 21.333333 | 66 | 0.679688 |
58396e86f0cf2b350ea6ae5e16ea2bb4cef1a91e | 8,659 | c | C | stage1/appexec/appexec.c | chancez/rkt | 5bb989a39dad9e6a4efe6dc4d84bdddda4880209 | [
"Apache-2.0"
] | null | null | null | stage1/appexec/appexec.c | chancez/rkt | 5bb989a39dad9e6a4efe6dc4d84bdddda4880209 | [
"Apache-2.0"
] | null | null | null | stage1/appexec/appexec.c | chancez/rkt | 5bb989a39dad9e6a4efe6dc4d84bdddda4880209 | [
"Apache-2.0"
] | null | null | null | // Copyright 2014 The rkt Authors
//
// 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.
#define _GNU_SOURCE
#include <errno.h>
#include <fcntl.h>
#include <grp.h>
#include <inttypes.h>
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "elf.h"
static int exit_err;
#define exit_if(_cond, _fmt, _args...) \
exit_err++; \
if(_cond) { \
fprintf(stderr, "Error: " _fmt "\n", ##_args); \
exit(exit_err); \
}
#define pexit_if(_cond, _fmt, _args...) \
exit_if(_cond, _fmt ": %s", ##_args, strerror(errno))
#define MAX_DIAG_DEPTH 10
#define MIN(_a, _b) (((_a) < (_b)) ? (_a) : (_b))
static void map_file(const char *path, int prot, int flags, struct stat *st, void **map)
{
int fd;
pexit_if((fd = open(path, O_RDONLY)) == -1,
"Unable to open \"%s\"", path);
pexit_if(fstat(fd, st) == -1,
"Cannot stat \"%s\"", path);
exit_if(!S_ISREG(st->st_mode), "\"%s\" is not a regular file", path);
pexit_if(!(*map = mmap(NULL, st->st_size, prot, flags, fd, 0)),
"Mmap of \"%s\" failed", path);
pexit_if(close(fd) == -1,
"Close of %i [%s] failed", fd, path);
}
static void diag(const char *exe)
{
static const uint8_t elf[] = {0x7f, 'E', 'L', 'F'};
static const uint8_t shebang[] = {'#','!'};
static int diag_depth;
struct stat st;
const uint8_t *mm;
const char *itrp = NULL;
map_file(exe, PROT_READ, MAP_SHARED, &st, (void **)&mm);
exit_if(!((S_IXUSR|S_IXGRP|S_IXOTH) & st.st_mode),
"\"%s\" is not executable", exe)
if(st.st_size >= sizeof(shebang) &&
!memcmp(mm, shebang, sizeof(shebang))) {
const uint8_t *nl;
int maxlen = MIN(PATH_MAX, st.st_size - sizeof(shebang));
/* TODO(vc): EOF-terminated shebang lines are technically possible */
exit_if(!(nl = memchr(&mm[sizeof(shebang)], '\n', maxlen)),
"Shebang line too long");
pexit_if(!(itrp = strndup((char *)&mm[sizeof(shebang)], (nl - mm) - 2)),
"Failed to dup interpreter path");
} else if(st.st_size >= sizeof(elf) &&
!memcmp(mm, elf, sizeof(elf))) {
uint64_t (*lget)(const uint8_t *) = NULL;
uint32_t (*iget)(const uint8_t *) = NULL;
uint16_t (*sget)(const uint8_t *) = NULL;
const void *phoff = NULL, *phesz = NULL, *phecnt = NULL;
const uint8_t *ph = NULL;
int i, phreloff, phrelsz;
exit_if(mm[ELF_VERSION] != 1,
"Unsupported ELF version: %hhx", mm[ELF_VERSION]);
/* determine which accessors to use and where */
if(mm[ELF_BITS] == ELF_BITS_32) {
if(mm[ELF_ENDIAN] == ELF_ENDIAN_LITL) {
lget = le32_lget;
sget = le_sget;
iget = le_iget;
} else if(mm[ELF_ENDIAN] == ELF_ENDIAN_BIG) {
lget = be32_lget;
sget = be_sget;
iget = be_iget;
}
phoff = &mm[ELF32_PHT_OFF];
phesz = &mm[ELF32_PHTE_SIZE];
phecnt = &mm[ELF32_PHTE_CNT];
phreloff = ELF32_PHE_OFF;
phrelsz = ELF32_PHE_SIZE;
} else if(mm[ELF_BITS] == ELF_BITS_64) {
if(mm[ELF_ENDIAN] == ELF_ENDIAN_LITL) {
lget = le64_lget;
sget = le_sget;
iget = le_iget;
} else if(mm[ELF_ENDIAN] == ELF_ENDIAN_BIG) {
lget = be64_lget;
sget = be_sget;
iget = be_iget;
}
phoff = &mm[ELF64_PHT_OFF];
phesz = &mm[ELF64_PHTE_SIZE];
phecnt = &mm[ELF64_PHTE_CNT];
phreloff = ELF64_PHE_OFF;
phrelsz = ELF64_PHE_SIZE;
}
exit_if(!lget, "Unsupported ELF format");
if(!phoff) /* program header may be absent, don't make it an error */
return;
/* TODO(vc): sanity checks on values before using them */
for(ph = &mm[lget(phoff)], i = 0; i < sget(phecnt); i++, ph += sget(phesz)) {
if(iget(ph) == ELF_PT_INTERP) {
itrp = strndup((char *)&mm[lget(&ph[phreloff])], lget(&ph[phrelsz]));
break;
}
}
} else {
exit_if(1, "Unsupported file type");
}
exit_if(!itrp, "Unable to determine interpreter for \"%s\"", exe);
exit_if(*itrp != '/', "Path must be absolute: \"%s\"", itrp);
exit_if(++diag_depth > MAX_DIAG_DEPTH,
"Excessive interpreter recursion, giving up");
diag(itrp);
}
/* Append env variables listed in keep_env to env_file if they're present in
* current environment */
void append_env(const char *env_file, const char **keep_env)
{
FILE *f;
const char **p;
char *v;
char nul = '\0';
pexit_if((f = fopen(env_file, "a")) == NULL,
"Unable to fopen \"%s\"", env_file);
p = keep_env;
while (*p) {
v = getenv(*p);
if (v) {
pexit_if(fprintf(f, "%s=%s%c", *p, v, nul) != (strlen(*p) + strlen(v) + 2),
"Unable to write to \"%s\"", env_file);
}
p++;
}
pexit_if(fclose(f) == EOF,
"Unable to fclose \"%s\"", env_file);
return;
}
/* Read environment from env and make it our own keeping the env variables in
* keep_env if they're present in the current environment.
* The environment file must exist, may be empty, and is expected to be of the format:
* key=value\0key=value\0...
*/
static void load_env(const char *env, const char **keep_env)
{
struct stat st;
char *map, *k, *v;
typeof(st.st_size) i;
append_env(env, keep_env);
map_file(env, PROT_READ|PROT_WRITE, MAP_PRIVATE, &st, (void **)&map);
pexit_if(clearenv() != 0,
"Unable to clear environment");
if(!st.st_size)
return;
map[st.st_size - 1] = '\0'; /* ensure the mapping is null-terminated */
for(i = 0; i < st.st_size;) {
k = &map[i];
i += strlen(k) + 1;
exit_if((v = strchr(k, '=')) == NULL,
"Malformed environment entry: \"%s\"", k);
/* a private writable map is used permitting s/=/\0/ */
*v = '\0';
v++;
pexit_if(setenv(k, v, 1) == -1,
"Unable to set env variable: \"%s\"=\"%s\"", k, v);
}
}
/* Parse a comma-separated list of numeric gids from str, returns an malloc'd
* array of gids in *gids_p with the number of elements in *n_gids_p.
*/
static void parse_gids(const char *str, size_t *n_gids_p, gid_t **gids_p)
{
char c = ',', last_c;
int i, n_gids = 0, done = 0;
gid_t gid = 0;
gid_t *gids = NULL;
for(i = 0; !done; i++) {
last_c = c;
switch(c = str[i]) {
case '0' ... '9':
gid *= 10;
gid += c - '0';
break;
case '\0':
done = 1;
/* fallthrough */
case ',':
exit_if(last_c == ',',
"Gids contains an empty gid: \"%s\"", str);
pexit_if((gids = realloc(gids, sizeof(*gids) * (n_gids + 1))) == NULL,
"Unable to allocate gids: \"%s\"", str);
gids[n_gids++] = gid;
gid = 0;
break;
default:
exit_if(1,
"Gids contains invalid input (%c): \"%s\"",
c, str);
}
}
exit_if(!n_gids, "At least one gid is required, got: \"%s\"", str);
*gids_p = gids;
*n_gids_p = n_gids;
}
int main(int argc, char *argv[])
{
/* We need to keep these env variables since systemd uses them for socket
* activation
*/
static const char *keep_env[] = {
"LISTEN_FDS",
"LISTEN_PID",
NULL
};
const char *root, *cwd, *env, *uid_str, *gid_str, *exe;
char **args;
uid_t uid;
gid_t *gids;
size_t n_gids;
exit_if(argc < 7,
"Usage: %s /path/to/root /work/directory /env/file uid gid[,gid...] /to/exec [args ...]", argv[0]);
root = argv[1];
cwd = argv[2];
env = argv[3];
uid_str = argv[4];
uid = atoi(uid_str);
gid_str = argv[5];
args = &argv[6];
exe = args[0];
parse_gids(gid_str, &n_gids, &gids);
load_env(env, keep_env);
pexit_if(chroot(root) == -1, "Chroot \"%s\" failed", root);
pexit_if(chdir(cwd) == -1, "Chdir \"%s\" failed", cwd);
pexit_if(gids[0] > 0 && setresgid(gids[0], gids[0], gids[0]) == -1,
"Setresgid \"%s\" failed", gid_str);
pexit_if(n_gids > 1 && setgroups(n_gids - 1, &gids[1]) == -1,
"Setgroups \"%s\" failed", gid_str);
pexit_if(uid > 0 && setresuid(uid, uid, uid) == -1,
"Setresuid \"%s\" failed", uid_str);
/* XXX(vc): note that since execvp() is happening post-chroot, the
* app's environment settings correctly affect the PATH search.
* This is why execvpe() isn't being used, we manipulate the environment
* manually then let it potentially affect execvp(). execvpe() simply
* passes the environment to execve() _after_ performing the search, not
* what we want here. */
pexit_if(execvp(exe, args) == -1 &&
errno != ENOENT && errno != EACCES,
"Exec of \"%s\" failed", exe);
diag(exe);
return EXIT_FAILURE;
}
| 27.842444 | 101 | 0.624091 |
793163bcb27cc2c0183e397786fae1d86adcc03e | 1,456 | swift | Swift | Keyboard/Classes/KeyboardItem.swift | Dede/Keyboard | c354115e7603966e70bb55b9530513dc391733aa | [
"MIT"
] | 2 | 2018-05-15T11:16:13.000Z | 2021-11-14T16:42:37.000Z | Keyboard/Classes/KeyboardItem.swift | Dede/Keyboard | c354115e7603966e70bb55b9530513dc391733aa | [
"MIT"
] | 1 | 2019-07-17T06:40:20.000Z | 2019-07-17T06:40:20.000Z | Keyboard/Classes/KeyboardItem.swift | Dede/Keyboard | c354115e7603966e70bb55b9530513dc391733aa | [
"MIT"
] | 2 | 2019-07-17T06:37:35.000Z | 2021-11-13T23:34:20.000Z | //
// KeyboardItem.swift
// Keyboard
//
// Created by Adrián Bouza Correa on 11/05/2018.
//
import UIKit
public enum KeyboardItem {
case barButton(title: String, style: UIBarButtonItem.Style, action: UIBarButtonItemTargetClosure?)
case systemBarButton(system: UIBarButtonItem.SystemItem, action: UIBarButtonItemTargetClosure?)
case flexibleSpace
case fixedSpace(width: CGFloat)
case custom(view: UIView)
func barButtonItem() -> UIBarButtonItem? {
switch self {
case .barButton(title: let title, style: let style, action: let action):
let button = UIBarButtonItem(title: title, style: style, target: nil, action: nil)
button.actionClosure = action
return button
case .systemBarButton(system: let system, action: let action):
let button = UIBarButtonItem(barButtonSystemItem: system, target: nil, action: nil)
button.actionClosure = action
return button
case .flexibleSpace:
return UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
case .fixedSpace(width: let width):
let fixedSpaceItem = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
fixedSpaceItem.width = width
return fixedSpaceItem
case .custom(view: let view):
return UIBarButtonItem(customView: view)
}
}
}
| 36.4 | 108 | 0.663462 |
9c1b7ac7e4473ead7d1cb4a964c2268fa1702c36 | 90 | js | JavaScript | lib/utility/chance.js | pachet/pirc | a65012b650cd43dc8413716ba06ac11343e6bba8 | [
"0BSD"
] | 3 | 2018-03-27T17:02:04.000Z | 2019-04-11T16:09:51.000Z | lib/utility/chance.js | pachet/pirc | a65012b650cd43dc8413716ba06ac11343e6bba8 | [
"0BSD"
] | null | null | null | lib/utility/chance.js | pachet/pirc | a65012b650cd43dc8413716ba06ac11343e6bba8 | [
"0BSD"
] | null | null | null |
function chance(percent) {
return Math.random() < percent;
}
module.exports = chance;
| 11.25 | 32 | 0.7 |
c76464274e5238425783ae83a71d3b23664b5fd7 | 2,217 | swift | Swift | Twitter/Twitter/EditTweetViewController.swift | tim-kim/Twitter | d9ef94e35dc9f18342a02eb0954f19352cde7f31 | [
"Apache-2.0"
] | null | null | null | Twitter/Twitter/EditTweetViewController.swift | tim-kim/Twitter | d9ef94e35dc9f18342a02eb0954f19352cde7f31 | [
"Apache-2.0"
] | 1 | 2017-02-28T14:03:22.000Z | 2017-03-08T04:40:44.000Z | Twitter/Twitter/EditTweetViewController.swift | tim-kim/Twitter | d9ef94e35dc9f18342a02eb0954f19352cde7f31 | [
"Apache-2.0"
] | null | null | null | //
// EditTweetViewController.swift
// Twitter
//
// Created by Tim Kim on 3/6/17.
// Copyright © 2017 Tim Kim. All rights reserved.
//
import UIKit
class EditTweetViewController: UIViewController {
weak var delegate: refreshDelegate?
var replyID: NSString?
var replyToUser: NSString?
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var screenNameLabel: UILabel!
@IBOutlet weak var profileImageView: UIImageView!
@IBOutlet weak var cancelButton: UIBarButtonItem!
@IBOutlet weak var textInputField: UITextView!
var isReply = 0
override func viewDidLoad() {
super.viewDidLoad()
self.textInputField.becomeFirstResponder()
self.nameLabel.text = User.currentUser!.name! as String
self.screenNameLabel.text = "@" + (User.currentUser!.screenname!as String)
self.profileImageView.setImageWith(User.currentUser!.profileUrl! as URL)
self.editTextforReply(self.isReply)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func editTextforReply(_ isReply: Int) {
if (isReply == 1) {
self.textInputField.text = "@" + (self.replyToUser as! String) + "\r\n"
}
}
@IBAction func onCancel(_ sender: UIBarButtonItem) {
self.dismiss(animated: false, completion: nil)
}
@IBAction func onTweetButton(_ sender: Any) {
let input = self.textInputField.text
if (self.isReply == 0){
TwitterClient.sharedInstance?.tweetNewPost(success: { (newtweet: Tweet) in
self.delegate?.didChangeHome()
}, failure:{ (error: Error) in
print(error.localizedDescription)
}, tweetMessage: input!)
} else {
TwitterClient.sharedInstance?.replyPost(success: { (newtweet: Tweet) in
self.delegate?.didChangeHome()
}, failure: { (error: Error) in
print(error.localizedDescription)
}, tweetMessage: input!, replyID: self.replyID as! String)
}
self.dismiss(animated: false, completion: nil)
}
}
| 34.640625 | 86 | 0.633739 |
afb571732f5a8fef1d0f91bbf933f0d965512898 | 1,190 | swift | Swift | Source/UIImageExtension.swift | diaoshihao/SwiftyExtensions | 40862ce0f6502869dc7c1ca1d63dfd0f7b89cfb3 | [
"MIT"
] | null | null | null | Source/UIImageExtension.swift | diaoshihao/SwiftyExtensions | 40862ce0f6502869dc7c1ca1d63dfd0f7b89cfb3 | [
"MIT"
] | null | null | null | Source/UIImageExtension.swift | diaoshihao/SwiftyExtensions | 40862ce0f6502869dc7c1ca1d63dfd0f7b89cfb3 | [
"MIT"
] | null | null | null | //
// UIImageExtension.swift
// SwiftyExtensions
//
// Created by 刁世浩 on 2019/9/17.
// Copyright © 2019 刁世浩. All rights reserved.
//
import UIKit
public extension UIImage {
/// 通过颜色创建图片
///
/// - Parameters:
/// - color: 图片填充色
/// - size: 图片大小
/// - Returns: 填充对应颜色的图片
static func image(color: UIColor, size: CGSize) -> UIImage? {
UIGraphicsBeginImageContext(size)
let context = UIGraphicsGetCurrentContext()
context?.setFillColor(color.cgColor)
context?.fill(CGRect(origin: .zero, size: size))
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image
}
/// 获取 view 的截图
///
/// - Parameter view: 需要截图的 view
/// - Returns: view 的截图
static func image(from view: UIView) -> UIImage? {
UIGraphicsBeginImageContext(view.bounds.size)
if let currentContext = UIGraphicsGetCurrentContext() {
view.layer.render(in: currentContext)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image;
}
return nil;
}
}
| 27.045455 | 67 | 0.615126 |
cb993f0204f41de318c506025d7ec26bb5677223 | 1,045 | go | Go | Category/03.HashTable/001-242. Valid Anagram/242. Valid Anagram.go | mudssky/leetcodeNotes | ba84711b1eed1e3dc7be515a90813ff6be343b7b | [
"Apache-2.0"
] | null | null | null | Category/03.HashTable/001-242. Valid Anagram/242. Valid Anagram.go | mudssky/leetcodeNotes | ba84711b1eed1e3dc7be515a90813ff6be343b7b | [
"Apache-2.0"
] | null | null | null | Category/03.HashTable/001-242. Valid Anagram/242. Valid Anagram.go | mudssky/leetcodeNotes | ba84711b1eed1e3dc7be515a90813ff6be343b7b | [
"Apache-2.0"
] | null | null | null | package main
import "fmt"
func charMap(s string) (resMap map[byte]int) {
resMap = map[byte]int{}
for i := 0; i < len(s); i++ {
resMap[s[i]]++
}
return
}
// 解法一:求两个字符串词频的哈希表,然后比较
// func isAnagram(s string, t string) bool {
// sLen := len(s)
// tLen := len(t)
// if sLen != tLen {
// return false
// }
// sMap := charMap(s)
// tMap := charMap(t)
// if sLen > tLen {
// for k, v := range sMap {
// if tv, ok := tMap[k]; !ok || tv != v {
// return false
// }
// }
// } else {
// for k, v := range tMap {
// if tv, ok := sMap[k]; !ok || tv != v {
// return false
// }
// }
// }
// return true
// }
// 解法一优化
func isAnagram(s string, t string) bool {
sLen := len(s)
tLen := len(t)
if sLen != tLen {
return false
}
sMap := map[byte]int{}
for i := 0; i < sLen; i++ {
sMap[s[i]]++
}
for i := 0; i < tLen; i++ {
if sMap[t[i]] < 1 {
return false
}
sMap[t[i]]--
}
return true
}
func main() {
s := "a"
// s := "anagram"
// t := "nagaram"
t := "ab"
fmt.Println(isAnagram(s, t))
}
| 16.076923 | 46 | 0.490909 |
0414148673028d0ccd57db99692f5cd4b9010bdf | 446 | js | JavaScript | frontend/src/ui/components/FormFieldContainer.js | Michal-sw/poke-app | 8b01910040bbd9d87cb6e62f9edb61265d59ac89 | [
"MIT"
] | 1 | 2022-01-30T12:53:04.000Z | 2022-01-30T12:53:04.000Z | frontend/src/ui/components/FormFieldContainer.js | Michal-sw/poke-app | 8b01910040bbd9d87cb6e62f9edb61265d59ac89 | [
"MIT"
] | 1 | 2022-01-21T11:57:35.000Z | 2022-01-21T12:02:27.000Z | frontend/src/ui/components/FormFieldContainer.js | Michal-sw/poke-app | 8b01910040bbd9d87cb6e62f9edb61265d59ac89 | [
"MIT"
] | null | null | null | import { ErrorMessage } from "formik";
import { FormInputContainer, FormRow, MyField } from "../styles/MultiUsageStyles";
const FormFieldContainer = ({ type, label, name }) => {
return (
<FormRow>
<FormInputContainer>
<label>{label}</label>
<MyField name={name} type={type ? type : 'string'}/>
</FormInputContainer>
<ErrorMessage name={name}/>
</FormRow>
)
}
export default FormFieldContainer; | 27.875 | 82 | 0.634529 |
dfc6384bb393bbf93252414b480f7db4339f72a7 | 560 | ts | TypeScript | src/resolvers/role/role.repository.ts | LuisGH1234/nest-graphql | 2932e4fd26b9ce9b77d6ab103dd66e1872311bbf | [
"MIT"
] | null | null | null | src/resolvers/role/role.repository.ts | LuisGH1234/nest-graphql | 2932e4fd26b9ce9b77d6ab103dd66e1872311bbf | [
"MIT"
] | 4 | 2021-03-10T03:08:32.000Z | 2021-09-21T06:07:59.000Z | src/resolvers/role/role.repository.ts | LuisGH1234/nest-graphql | 2932e4fd26b9ce9b77d6ab103dd66e1872311bbf | [
"MIT"
] | null | null | null | import { EntityRepository, Repository } from 'typeorm';
import { Role } from '../../database/entity';
@EntityRepository(Role)
export class RoleRepository extends Repository<Role> {
findRoles(filter: string) {
return this.createQueryBuilder('role')
.where(`role.description like "%${filter}"`)
.getMany();
}
findRoleByUser(userID: number) {
return this.createQueryBuilder('role')
.leftJoin('role.users', 'user')
.where('user.id = :userID', { userID })
.getOne();
}
}
| 29.473684 | 56 | 0.598214 |
2926069ff8b24e3083633dbd48dcce221e24ecb4 | 9,918 | py | Python | pontoon/machinery/views.py | SafaAlfulaij/pontoon | 9e062522ee337399daf1326c800e188c26dd45f7 | [
"BSD-3-Clause"
] | null | null | null | pontoon/machinery/views.py | SafaAlfulaij/pontoon | 9e062522ee337399daf1326c800e188c26dd45f7 | [
"BSD-3-Clause"
] | 9 | 2021-03-10T21:34:51.000Z | 2022-02-19T03:30:06.000Z | pontoon/machinery/views.py | ramiahmadieh/fpipontoon | 20d377b5d55755316950b4da0227bc47adaf6b3d | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
import json
import logging
import requests
import xml.etree.ElementTree as ET
from caighdean import Translator
from caighdean.exceptions import TranslationError
from six.moves.urllib.parse import quote
from uuid import uuid4
from django.conf import settings
from django.http import JsonResponse
from django.shortcuts import render
from django.template.loader import get_template
from django.utils.datastructures import MultiValueDictKeyError
from django.utils.html import escape
from pontoon.base import utils
from pontoon.base.models import Entity, Locale, Translation
from pontoon.machinery.utils import (
get_google_translate_data,
get_translation_memory_data,
)
log = logging.getLogger(__name__)
def machinery(request):
locale = utils.get_project_locale_from_request(request, Locale.objects) or "en-GB"
return render(
request,
"machinery/machinery.html",
{
"locale": Locale.objects.get(code=locale),
"locales": Locale.objects.all(),
"is_google_translate_supported": bool(settings.GOOGLE_TRANSLATE_API_KEY),
"is_microsoft_translator_supported": bool(
settings.MICROSOFT_TRANSLATOR_API_KEY
),
},
)
def translation_memory(request):
"""Get translations from internal translations memory."""
try:
text = request.GET["text"]
locale = request.GET["locale"]
pk = request.GET["pk"]
except MultiValueDictKeyError as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
try:
locale = Locale.objects.get(code=locale)
except Locale.DoesNotExist as e:
return JsonResponse(
{"status": False, "message": "Not Found: {error}".format(error=e)},
status=404,
)
data = get_translation_memory_data(text, locale, pk)
return JsonResponse(data, safe=False)
def microsoft_translator(request):
"""Get translation from Microsoft machine translation service."""
try:
text = request.GET["text"]
locale_code = request.GET["locale"]
except MultiValueDictKeyError as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
api_key = settings.MICROSOFT_TRANSLATOR_API_KEY
if not api_key:
log.error("MICROSOFT_TRANSLATOR_API_KEY not set")
return JsonResponse(
{"status": False, "message": "Bad Request: Missing api key."}, status=400
)
# Validate if locale exists in the database to avoid any potential XSS attacks.
if not Locale.objects.filter(ms_translator_code=locale_code).exists():
return JsonResponse(
{
"status": False,
"message": "Not Found: {error}".format(error=locale_code),
},
status=404,
)
url = "https://api.cognitive.microsofttranslator.com/translate"
headers = {"Ocp-Apim-Subscription-Key": api_key, "Content-Type": "application/json"}
payload = {
"api-version": "3.0",
"from": "en",
"to": locale_code,
"textType": "html",
}
body = [{"Text": text}]
try:
r = requests.post(url, params=payload, headers=headers, json=body)
root = json.loads(r.content)
if "error" in root:
log.error("Microsoft Translator error: {error}".format(error=root))
return JsonResponse(
{
"status": False,
"message": "Bad Request: {error}".format(error=root),
},
status=400,
)
return JsonResponse({"translation": root[0]["translations"][0]["text"]})
except requests.exceptions.RequestException as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
def google_translate(request):
"""Get translation from Google machine translation service."""
try:
text = request.GET["text"]
locale_code = request.GET["locale"]
except MultiValueDictKeyError as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
# Validate if locale exists in the database to avoid any potential XSS attacks.
if not Locale.objects.filter(google_translate_code=locale_code).exists():
return JsonResponse(
{
"status": False,
"message": "Not Found: {error}".format(error=locale_code),
},
status=404,
)
data = get_google_translate_data(text, locale_code)
if not data["status"]:
return JsonResponse(data, status=400)
return JsonResponse(data)
def caighdean(request):
"""Get translation from Caighdean machine translation service."""
try:
entityid = int(request.GET["id"])
except (MultiValueDictKeyError, ValueError) as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
try:
entity = Entity.objects.get(id=entityid)
except Entity.DoesNotExist as e:
return JsonResponse(
{"status": False, "message": "Not Found: {error}".format(error=e)},
status=404,
)
try:
text = entity.translation_set.get(
locale__code="gd",
plural_form=None if entity.string_plural == "" else 0,
approved=True,
).string
except Translation.DoesNotExist:
return JsonResponse({})
try:
translation = Translator().translate(text)
return JsonResponse({"original": text, "translation": translation})
except TranslationError as e:
return JsonResponse(
{"status": False, "message": "Server Error: {error}".format(error=e)},
status=500,
)
def microsoft_terminology(request):
"""Get translations from Microsoft Terminology Service."""
try:
text = request.GET["text"]
locale_code = request.GET["locale"]
except MultiValueDictKeyError as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
# Validate if locale exists in the database to avoid any potential XSS attacks.
if not Locale.objects.filter(ms_terminology_code=locale_code).exists():
return JsonResponse(
{
"status": False,
"message": "Not Found: {error}".format(error=locale_code),
},
status=404,
)
obj = {}
url = "http://api.terminology.microsoft.com/Terminology.svc"
headers = {
"SOAPAction": (
'"http://api.terminology.microsoft.com/terminology/Terminology/GetTranslations"'
),
"Content-Type": "text/xml; charset=utf-8",
}
payload = {
"uuid": uuid4(),
"text": quote(text.encode("utf-8")),
"to": locale_code,
"max_result": 5,
}
template = get_template("machinery/microsoft_terminology.jinja")
payload = template.render(payload)
try:
r = requests.post(url, data=payload, headers=headers)
translations = []
xpath = ".//{http://api.terminology.microsoft.com/terminology}"
root = ET.fromstring(r.content)
results = root.find(xpath + "GetTranslationsResult")
if results is not None:
for translation in results:
translations.append(
{
"source": translation.find(xpath + "OriginalText").text,
"target": translation.find(xpath + "TranslatedText").text,
"quality": int(
translation.find(xpath + "ConfidenceLevel").text
),
}
)
obj["translations"] = translations
return JsonResponse(obj)
except requests.exceptions.RequestException as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
def transvision(request):
"""Get Mozilla translations from Transvision service."""
try:
text = request.GET["text"]
locale = request.GET["locale"]
except MultiValueDictKeyError as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
try:
text = quote(text.encode("utf-8"))
except KeyError as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
url = u"https://transvision.mozfr.org/api/v1/tm/global/en-US/{locale}/{text}/".format(
locale=locale, text=text
)
payload = {
"max_results": 5,
"min_quality": 70,
}
try:
r = requests.get(url, params=payload)
if "error" in r.json():
error = r.json()["error"]
log.error("Transvision error: {error}".format(error=error))
error = escape(error)
return JsonResponse(
{
"status": False,
"message": "Bad Request: {error}".format(error=error),
},
status=400,
)
return JsonResponse(r.json(), safe=False)
except requests.exceptions.RequestException as e:
return JsonResponse(
{"status": False, "message": "Bad Request: {error}".format(error=e)},
status=400,
)
| 31.287066 | 92 | 0.587215 |
b94eb81d17823186d93bdc4368bb4b374412f792 | 385 | h | C | include/stack.h | u0p1a/algorithm-learn | 027d4bf80336899c36526bd7e4e0dec41e9d2dd2 | [
"Apache-2.0"
] | null | null | null | include/stack.h | u0p1a/algorithm-learn | 027d4bf80336899c36526bd7e4e0dec41e9d2dd2 | [
"Apache-2.0"
] | null | null | null | include/stack.h | u0p1a/algorithm-learn | 027d4bf80336899c36526bd7e4e0dec41e9d2dd2 | [
"Apache-2.0"
] | null | null | null | // @Author Raim.Yan
// @Date 2021/5/21 3:58 下午
// @Description
#ifndef ALGORITHM_LEARN_STACK_H
#define ALGORITHM_LEARN_STACK_H
#include "linearlist.h"
#include "linklist.h"
template <class ElemType> class Stack : public LinearList {
public:
virtual int Push(ElemType elem) = 0; // 压栈
virtual ElemType Pop() = 0; // 出栈
};
#endif // ALGORITHM_LEARN_STACK_H
| 22.647059 | 59 | 0.683117 |
8a8847923117372146742b2e7ce513d9203b928e | 10,459 | rs | Rust | src/oid.rs | zonyitoo/bson-rs | b62338a56f8e63af63b131e918ce3da63094495c | [
"MIT"
] | 119 | 2015-04-09T09:40:06.000Z | 2019-12-21T21:28:32.000Z | src/oid.rs | zonyitoo/bson-rs | b62338a56f8e63af63b131e918ce3da63094495c | [
"MIT"
] | 108 | 2015-05-28T08:47:31.000Z | 2019-12-20T20:18:00.000Z | src/oid.rs | zonyitoo/bson-rs | b62338a56f8e63af63b131e918ce3da63094495c | [
"MIT"
] | 53 | 2015-05-18T17:56:50.000Z | 2019-12-20T02:43:44.000Z | //! ObjectId
use std::{
convert::TryInto,
error,
fmt,
result,
str::FromStr,
sync::atomic::{AtomicUsize, Ordering},
time::SystemTime,
};
use hex::{self, FromHexError};
use rand::{thread_rng, Rng};
use lazy_static::lazy_static;
const TIMESTAMP_SIZE: usize = 4;
const PROCESS_ID_SIZE: usize = 5;
const COUNTER_SIZE: usize = 3;
const TIMESTAMP_OFFSET: usize = 0;
const PROCESS_ID_OFFSET: usize = TIMESTAMP_OFFSET + TIMESTAMP_SIZE;
const COUNTER_OFFSET: usize = PROCESS_ID_OFFSET + PROCESS_ID_SIZE;
const MAX_U24: usize = 0xFF_FFFF;
lazy_static! {
static ref OID_COUNTER: AtomicUsize = AtomicUsize::new(thread_rng().gen_range(0..=MAX_U24));
}
/// Errors that can occur during [`ObjectId`] construction and generation.
#[derive(Clone, Debug)]
#[non_exhaustive]
pub enum Error {
/// An invalid character was found in the provided hex string. Valid characters are: `0...9`,
/// `a...f`, or `A...F`.
#[non_exhaustive]
InvalidHexStringCharacter { c: char, index: usize, hex: String },
/// An [`ObjectId`]'s hex string representation must be an exactly 12-byte (24-char)
/// hexadecimal string.
#[non_exhaustive]
InvalidHexStringLength { length: usize, hex: String },
}
/// Alias for Result<T, oid::Error>.
pub type Result<T> = result::Result<T, Error>;
impl fmt::Display for Error {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::InvalidHexStringCharacter { c, index, hex } => {
write!(
fmt,
"invalid character '{}' was found at index {} in the provided hex string: \
\"{}\"",
c, index, hex
)
}
Error::InvalidHexStringLength { length, hex } => {
write!(
fmt,
"provided hex string representation must be exactly 12 bytes, instead got: \
\"{}\", length {}",
hex, length
)
}
}
}
}
impl error::Error for Error {}
/// A wrapper around raw 12-byte ObjectId representations.
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash)]
pub struct ObjectId {
id: [u8; 12],
}
impl Default for ObjectId {
fn default() -> Self {
Self::new()
}
}
impl FromStr for ObjectId {
type Err = Error;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Self::parse_str(s)
}
}
impl From<[u8; 12]> for ObjectId {
fn from(bytes: [u8; 12]) -> Self {
Self { id: bytes }
}
}
impl ObjectId {
/// Generates a new [`ObjectId`], represented in bytes.
/// See the [docs](http://docs.mongodb.org/manual/reference/object-id/)
/// for more information.
pub fn new() -> ObjectId {
let timestamp = ObjectId::gen_timestamp();
let process_id = ObjectId::gen_process_id();
let counter = ObjectId::gen_count();
let mut buf: [u8; 12] = [0; 12];
buf[TIMESTAMP_OFFSET..(TIMESTAMP_SIZE + TIMESTAMP_OFFSET)]
.clone_from_slice(×tamp[..TIMESTAMP_SIZE]);
buf[PROCESS_ID_OFFSET..(PROCESS_ID_SIZE + PROCESS_ID_OFFSET)]
.clone_from_slice(&process_id[..PROCESS_ID_SIZE]);
buf[COUNTER_OFFSET..(COUNTER_SIZE + COUNTER_OFFSET)]
.clone_from_slice(&counter[..COUNTER_SIZE]);
ObjectId::from_bytes(buf)
}
/// Constructs a new ObjectId wrapper around the raw byte representation.
pub const fn from_bytes(bytes: [u8; 12]) -> ObjectId {
ObjectId { id: bytes }
}
/// Creates an ObjectID using a 12-byte (24-char) hexadecimal string.
pub fn parse_str(s: impl AsRef<str>) -> Result<ObjectId> {
let s = s.as_ref();
let bytes: Vec<u8> = hex::decode(s.as_bytes()).map_err(|e| match e {
FromHexError::InvalidHexCharacter { c, index } => Error::InvalidHexStringCharacter {
c,
index,
hex: s.to_string(),
},
FromHexError::InvalidStringLength | FromHexError::OddLength => {
Error::InvalidHexStringLength {
length: s.len(),
hex: s.to_string(),
}
}
})?;
if bytes.len() != 12 {
Err(Error::InvalidHexStringLength {
length: s.len(),
hex: s.to_string(),
})
} else {
let mut byte_array: [u8; 12] = [0; 12];
byte_array[..].copy_from_slice(&bytes[..]);
Ok(ObjectId::from_bytes(byte_array))
}
}
/// Retrieves the timestamp from an [`ObjectId`].
pub fn timestamp(&self) -> crate::DateTime {
let mut buf = [0; 4];
buf.copy_from_slice(&self.id[0..4]);
let seconds_since_epoch = u32::from_be_bytes(buf);
// This doesn't overflow since u32::MAX * 1000 < i64::MAX
crate::DateTime::from_millis(seconds_since_epoch as i64 * 1000)
}
/// Returns the raw byte representation of an ObjectId.
pub const fn bytes(&self) -> [u8; 12] {
self.id
}
/// Convert this [`ObjectId`] to its hex string representation.
pub fn to_hex(self) -> String {
hex::encode(self.id)
}
/// Generates a new timestamp representing the current seconds since epoch.
/// Represented in Big Endian.
fn gen_timestamp() -> [u8; 4] {
let timestamp: u32 = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.expect("system clock is before 1970")
.as_secs()
.try_into()
.unwrap(); // will succeed until 2106 since timestamp is unsigned
timestamp.to_be_bytes()
}
/// Generate a random 5-byte array.
fn gen_process_id() -> [u8; 5] {
lazy_static! {
static ref BUF: [u8; 5] = thread_rng().gen();
}
*BUF
}
/// Gets an incremental 3-byte count.
/// Represented in Big Endian.
fn gen_count() -> [u8; 3] {
let u_counter = OID_COUNTER.fetch_add(1, Ordering::SeqCst);
// Mod result instead of OID_COUNTER to prevent threading issues.
let u = u_counter % (MAX_U24 + 1);
// Convert usize to writable u64, then extract the first three bytes.
let u_int = u as u64;
let buf = u_int.to_be_bytes();
let buf_u24: [u8; 3] = [buf[5], buf[6], buf[7]];
buf_u24
}
}
impl fmt::Display for ObjectId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(&self.to_hex())
}
}
impl fmt::Debug for ObjectId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_tuple("ObjectId").field(&self.to_hex()).finish()
}
}
#[cfg(test)]
use crate::tests::LOCK;
#[test]
fn count_generated_is_big_endian() {
let _guard = LOCK.run_exclusively();
let start = 1_122_866;
OID_COUNTER.store(start, Ordering::SeqCst);
// Test count generates correct value 1122866
let count_bytes = ObjectId::gen_count();
let mut buf: [u8; 4] = [0; 4];
buf[1..=COUNTER_SIZE].clone_from_slice(&count_bytes[..COUNTER_SIZE]);
let count = u32::from_be_bytes(buf);
assert_eq!(start as u32, count);
// Test OID formats count correctly as big endian
let oid = ObjectId::new();
assert_eq!(0x11u8, oid.bytes()[COUNTER_OFFSET]);
assert_eq!(0x22u8, oid.bytes()[COUNTER_OFFSET + 1]);
assert_eq!(0x33u8, oid.bytes()[COUNTER_OFFSET + 2]);
}
#[test]
fn test_counter_overflow_u24_max() {
let _guard = LOCK.run_exclusively();
let start = MAX_U24;
OID_COUNTER.store(start, Ordering::SeqCst);
let oid = ObjectId::new();
assert_eq!(0xFFu8, oid.bytes()[COUNTER_OFFSET]);
assert_eq!(0xFFu8, oid.bytes()[COUNTER_OFFSET + 1]);
assert_eq!(0xFFu8, oid.bytes()[COUNTER_OFFSET + 2]);
// Test counter overflows to 0 when set to MAX_24 + 1
let oid_new = ObjectId::new();
assert_eq!(0x00u8, oid_new.bytes()[COUNTER_OFFSET]);
assert_eq!(0x00u8, oid_new.bytes()[COUNTER_OFFSET + 1]);
assert_eq!(0x00u8, oid_new.bytes()[COUNTER_OFFSET + 2]);
}
#[test]
fn test_counter_overflow_usize_max() {
let _guard = LOCK.run_exclusively();
let start = usize::max_value();
OID_COUNTER.store(start, Ordering::SeqCst);
// Test counter overflows to u24_max when set to usize_max
let oid = ObjectId::new();
assert_eq!(0xFFu8, oid.bytes()[COUNTER_OFFSET]);
assert_eq!(0xFFu8, oid.bytes()[COUNTER_OFFSET + 1]);
assert_eq!(0xFFu8, oid.bytes()[COUNTER_OFFSET + 2]);
// Test counter overflows to 0 when set to usize_max + 1
let oid_new = ObjectId::new();
assert_eq!(0x00u8, oid_new.bytes()[COUNTER_OFFSET]);
assert_eq!(0x00u8, oid_new.bytes()[COUNTER_OFFSET + 1]);
assert_eq!(0x00u8, oid_new.bytes()[COUNTER_OFFSET + 2]);
}
#[cfg(test)]
mod test {
use time::macros::datetime;
#[test]
fn test_display() {
let id = super::ObjectId::parse_str("53e37d08776f724e42000000").unwrap();
assert_eq!(format!("{}", id), "53e37d08776f724e42000000")
}
#[test]
fn test_debug() {
let id = super::ObjectId::parse_str("53e37d08776f724e42000000").unwrap();
assert_eq!(
format!("{:?}", id),
"ObjectId(\"53e37d08776f724e42000000\")"
);
assert_eq!(
format!("{:#?}", id),
"ObjectId(\n \"53e37d08776f724e42000000\",\n)"
);
}
#[test]
fn test_timestamp() {
let id = super::ObjectId::parse_str("000000000000000000000000").unwrap();
// "Jan 1st, 1970 00:00:00 UTC"
assert_eq!(datetime!(1970-01-01 0:00 UTC), id.timestamp().to_time_0_3());
let id = super::ObjectId::parse_str("7FFFFFFF0000000000000000").unwrap();
// "Jan 19th, 2038 03:14:07 UTC"
assert_eq!(
datetime!(2038-01-19 3:14:07 UTC),
id.timestamp().to_time_0_3()
);
let id = super::ObjectId::parse_str("800000000000000000000000").unwrap();
// "Jan 19th, 2038 03:14:08 UTC"
assert_eq!(
datetime!(2038-01-19 3:14:08 UTC),
id.timestamp().to_time_0_3()
);
let id = super::ObjectId::parse_str("FFFFFFFF0000000000000000").unwrap();
// "Feb 7th, 2106 06:28:15 UTC"
assert_eq!(
datetime!(2106-02-07 6:28:15 UTC),
id.timestamp().to_time_0_3()
);
}
}
| 31.035608 | 97 | 0.589444 |
f0483801bce0be01cae4ae9b08257ec38deeaf54 | 1,424 | js | JavaScript | src/reducers/quoteReducer.test.js | vudknguyen/react-redux-bolerplate | d716d0b26179b6b5eacc0f754b5eb414da84a44c | [
"Unlicense",
"MIT"
] | null | null | null | src/reducers/quoteReducer.test.js | vudknguyen/react-redux-bolerplate | d716d0b26179b6b5eacc0f754b5eb414da84a44c | [
"Unlicense",
"MIT"
] | null | null | null | src/reducers/quoteReducer.test.js | vudknguyen/react-redux-bolerplate | d716d0b26179b6b5eacc0f754b5eb414da84a44c | [
"Unlicense",
"MIT"
] | null | null | null | import expect from 'expect';
import * as actions from '../actions/quoteActions';
import quoteReducer from './quoteReducer';
describe('Quote Reducer', () => {
it('should add quote when passed CREATE_QUOTE_SUCCESS', () => {
// Arrange
const initalState = [
{ name: 'A' },
{ name: 'B' },
];
const newQuote = { name: 'C' };
const action = actions.createQuoteSuccess(newQuote);
// Act
const newState = quoteReducer(initalState, action);
// Assert
expect(newState.length).toEqual(3);
expect(newState[0].name).toEqual('A');
expect(newState[1].name).toEqual('B');
expect(newState[2].name).toEqual('C');
});
it('should update quote when passed UPDATE_QUOTE_SUCCESS', () => {
// Arrange
const initalState = [
{ id: 'a', name: 'A' },
{ id: 'b', name: 'B' },
{ id: 'c', name: 'C' },
];
const firstQuote = initalState.find(a => a.id === 'a');
const quote = { id: 'b', name: 'D' };
const action = actions.updateQuoteSuccess(quote);
// Act
const newState = quoteReducer(initalState, action);
const updateQuote = newState.find(a => a.id === quote.id);
const untoucedQuote = newState.find(a => a.id === 'a');
// Assert
expect(newState.length).toEqual(3);
expect(untoucedQuote).toEqual(firstQuote);
expect(updateQuote.name).toEqual(quote.name);
expect(updateQuote).toEqual(quote);
});
});
| 29.061224 | 68 | 0.603933 |
64aafb638d2b55336f8170f41f6e019c11c5b773 | 7,384 | asm | Assembly | src/spread/cmd_file_demo.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/spread/cmd_file_demo.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/spread/cmd_file_demo.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | * Spreadsheet 03/03-92
* - file command routines
section prog
include win1_keys_wman
include win1_keys_wstatus
include win1_keys_wwork
include win1_keys_err
include win1_keys_k
include win1_keys_qdos_ioa
include win1_keys_qdos_io
include win1_mac_oli
include win1_spread_keys
xdef fil_forg
xdef fil_xloa
xdef fil_ximp,fil_mpag
xdef fil_prtf
xdef forg_grd,fil_setf
xdef blk_stor,blk_rstr
xref.l mv_sznc,mv_sznr,mv_popp,mv_popf,mv_popw
xref.l wst_main,mv_poef,mv_popl,mv_poif
blk_stor
move.l da_cbx0(a6),da_anbuf(a6)
move.l da_cbx1(a6),da_anbuf+4(a6)
rts
blk_rstr
movem.l d1/d0,-(sp)
move.l da_anbuf(a6),d1
xjsr cel_topl
move.l da_anbuf+4(a6),d1
xjsr cel_botr
movem.l (sp)+,d1/d0
*
* print at page
fil_prtp
bsr.s blk_stor
bsr.s fil_page
bsr fil_prtb
bsr.s blk_rstr
tst.l d0
rts
fil_mpag
bsr.s fil_page
tst.l d0
rts
fil_page
subr a0-a4/d1-d4
move.l da_cbx0(a6),d1 ; current cell
move.w mv_popw(a6),d4 ; paper width
xjsr cel_wdth
sub.w d3,d4
ble.s page_sc
page_clp
add.l #$00010000,d1 ; next column
xjsr in_grid
bne.s page_cx
xjsr cel_wdth
sub.w d3,d4
bge page_clp
page_cx
sub.l #$00010000,d1
page_sc
move.w mv_popl(a6),d4
subq.w #1,d4
ble.s page_sr
page_rlp
addq.w #1,d1
xjsr in_grid
bne.s page_rx
subq.w #1,d4
bgt page_rlp
page_sr
move.l da_wwork(a6),a4
xjsr cel_clr
move.l d1,da_cbx1(a6)
xjsr cel_newb
subend
page_rx subq.w #1,d1
bra.s page_sr
*
* print formulae report
fil_prtf
subr a0-a5/d1-d4
bsr opn_prt
bne.s prtf_exit
move.l da_cbx0(a6),da_anbuf(a6)
lea prtf_act,a5
xjsr mul_blok
prtf_clos
xjsr gu_fclos ; close printer
prtf_exit
subend
prtf_act
subr a0-a3/d1-d4
move.l d1,d2
swap d2
cmp.w da_anbuf(a6),d2
beq.s prtf_line
xjsr ut_prlf
prtf_line
move.l d1,da_anbuf(a6)
lea da_buff(a6),a1
xjsr acc_getf
bmi.s prtf_skip
cmpi.b #'"',2(a1)
beq.s prtf_skip
bsr.s prtf_ref
bmi.s prtf_skip
xjsr ut_prstr
prtf_skip
xjsr ut_prtab
moveq #0,d0
subend
prtf_ref
subr a0-a3/d1-d3
move.l a1,a0
lea da_echs(a6),a1
lea da_echl(a6),a2
xjsr cel_fref ; find references
tst.l (a2)
subend
*
* print a block
fil_prtb
subr a0-a4/d1-d4
bsr.s opn_prt ; open printer
bne.s prtb_exit
lea mv_popf(a6),a1 ; link filter job
tst.w (a1)
beq.s prtb_prt ; no filter, print normal
xjsr flt_expt
bne.s prtb_clos
exg a0,a1
prtb_prt
xjsr fil_prnt ; print block
prtb_clos
xjsr gu_fclos ; close printer
prtb_exit
subend
opn_prt
subr d1-d3
prt_try
moveq #ioa.open,d0
moveq #myself,d1
moveq #ioa.kovr,d3
lea mv_popp(a6),a0
trap #do.ioa
tst.l d0
beq.s prt_exit
bsr fil_err
tst.l d0
beq.s prt_exit
bra.s prt_try
prt_exit
subend
fil_xloa
moveq #0,d0
bra.s fil_loax
fil_ximp
moveq #-1,d0
*
* load a new file
r_forg reg a3
fil_loax
subr a0-a4/d1-d4/d7
move.l d0,d7
bsr conf_forg ; confirm forget
beq.s xloa_exit ; ... do not load!
xloa_edt
bsr gfn_load ; get filename for loading
bgt.s xloa_no
moveq #ioa.kshr,d3 ; open key=shared
xloa_try
lea da_fname(a6),a0
xjsr gu_fopen ; open new file
beq.s xloa_ok
bsr fil_err ; errors...
beq.s xloa_no ; esc'aped, give up
moveq #ioa.kshr,d3
subq.w #1,d0
beq.s xloa_try ; retry
bra.s xloa_edt ; edit name
xloa_ok
bsr.s set_ifj ; setup import filter
bne.s xloa_clo
xjsr fil_load ; load file contents
bsr.s fil_extn ; add extension for imported file
xloa_clo
xjsr gu_fclos ; close logic file
bsr.s clo_phys ; close physical file
xloa_exit
tst.l d0
subend
;
; loading was unsuccessful
xloa_no
move.w #0,da_fname(a6)
moveq #0,d0
bra.s xloa_exit
;
; close physical file
clo_phys
subr a0/d0
tst.l d7
beq.s cphys_exit
move.l d7,a0
xjsr gu_fclos
cphys_exit
subend
;
; add extension to filename
fil_extn
subr d0/a0/a1
lea da_fname(a6),a0
lea da_fextn(a6),a1
xjsr ut_fextn
subend
;
; setup the import filter job
set_ifj
subr a1
tst.b d7
beq.s setifj_exit
lea mv_poif(a6),a1 ; setup import filter
tst.w (a1)
beq.s setifj_exit
moveq #0,d7
xjsr flt_impt
bne.s setifj_exit
move.l a0,d7 ; physical channel id
move.l a1,a0 ; channel to read from
moveq #0,d0
setifj_exit
subend
gfn_load
subr a0-a4/d0-d4
moveq #-1,d1 ; window origin
;;; move.b cols(a6),d2 ; window colourways
;;; swap d2
;;; move.b colm(a6),d2
;;; andi.l #$000F000F,d2
moveq #0,d2
moveq #0,d5 ; max. number of lines
xlea met_load,a0 ; menu header
lea da_fname(a6),a2 ; pointer to current filename
move.l a2,a4
lea da_fextn(a6),a3 ; default _tab extension
move.l a3,d4
lea da_datad(a6),a3 ; data default directory
tst.b d7 ; was it load or import
beq.s gfnl_do
moveq #0,d4 ; no extension for import
xlea met_imp,a0 ; another menu name
gfnl_do
xjsr mu_fsel
subend
fil_oldf
subr a0/a1
lea da_fname(a6),a1
lea da_oldf(a6),a0
xjsr ut_cpyst
subend
fil_sold
subr a0/a1
lea da_fname(a6),a0
lea da_oldf(a6),a1
xjsr ut_cpyst
subend
rdfn_exit
tst.l d0
subend
rdfn_nc
moveq #err.nc,d0
bra.s rdfn_exit
fil_setf
subr a0-a3/d0-d3
move.l da_wmvec(a6),a2
move.l da_wwork(a6),a4
xjsr set_fnam
moveq #-5,d3 ; redraw info window 2
jsr wm.idraw(a2)
tst.l d0
bne do_kill
subend
;+++
; report a file error
;
; Entry Exit
; d0 error code -1 no file error
; 0 ESC
; 1 retry
; 2 overwrite
; 3 edit
;---
fil_err
subr d1-d3
moveq #-1,d1
;;; move.b colm(a6),d2
moveq #0,d2
moveq #1,d3
xjsr mu_filer
tst.l d0
bmi do_kill
subq.l #1,d0
beq.s err_esc
move.l d3,d0
err_exit
subend
err_esc
moveq #0,d0
bra.s err_exit
*
* confirmation to forget file
conf_forg
subr a3
move.w da_saved(a6),d0
bne.s conf_exit
xlea ask_forg,a3
xjsr ask_yn
conf_exit
subend
*
* forget sheet and setup a new one
* r_forg reg a3 ; already definied
fil_forg
move.l a3,-(sp)
move.l ww_wstat(a4),a1
bsr.s conf_forg ; confirmation to forget
beq.s forg_exit
forg_siz
xjsr siz_puld
cmpi.b #k.cancel,d4 ; intercepted?
beq.s forg_exit
* check for window manager error!
move.l (a2),d0
sub.l #'1.45',d0
bgt.s fil_new
move.w mv_sznc(a6),d0
mulu mv_sznr(a6),d0
cmp.l #$7fff,d0
bmi.s fil_new
movem.l r_forg,-(sp)
xlea ask_covr,a3
xjsr ask_yn
movem.l (sp)+,r_forg
beq forg_siz
*
fil_new
move.w mv_sznc(a6),da_ncols(a6) ; set new grid size
move.w mv_sznr(a6),da_nrows(a6)
move.w #1,da_saved(a6)
clr.w da_fname(a6)
bsr.s forg_grd
forg_exit
move.l (sp)+,a3
rts
do_kill
xjmp kill
;+++
; release all memory, set grid of new size and redraw window
; (gridsize is set in da_ncols/da_nrows)
;
;---
forg_grd
subr a0-a3/d1-d3
xjsr dma_quit ; release complete dma
bne.s grd_exit
move.l da_miobl(a6),a0 ; release menu object space
xjsr ut_rechp
bne.s grd_exit
move.l da_chan(a6),a0
xjsr setmol ; create new objects
xjsr dma_frst ; set first dma block
xjsr fnm_init ; format number initialisation
xjsr glb_unit ; set global units format
xjsr stt_init
clr.w da_dupdt(a6) ; allow for display update
move.w #1,da_saved(a6) ; file is saved
move.l #0,da_cbx0(a6) ; first cell is selected
move.l #0,da_usedx(a6) ; ..and the last currently used
move.l #-1,da_cbx1(a6)
xlea men_main,a3
lea wst_main(a6),a1
move.l da_wmvec(a6),a2
move.l da_winsz(a6),d1
move.l wsp_xorg(a1),d6
move.l wsp_xpos(a1),d5
add.l d5,d6
xjsr set_nset
bne.s grd_exit
move.l da_cbx0(a6),d1
bsr cel_topl
moveq #0,d0
grd_exit
tst.l d0
subend
end
| 14.797595 | 60 | 0.708424 |
0ef70b4f02a6003e811c1682c0dcdb06a1db2cd7 | 389 | tsx | TypeScript | react-native/src/components/profile/__test__/AgeSelector.stories.tsx | korykaai717/RN-MeetNative-App-GraphQL-APOLLO | 80a9801ea844385b8afefe4d78884c25843f5146 | [
"MIT"
] | null | null | null | react-native/src/components/profile/__test__/AgeSelector.stories.tsx | korykaai717/RN-MeetNative-App-GraphQL-APOLLO | 80a9801ea844385b8afefe4d78884c25843f5146 | [
"MIT"
] | 16 | 2020-09-07T23:31:08.000Z | 2022-02-27T09:16:09.000Z | react-native/src/components/profile/__test__/AgeSelector.stories.tsx | korykaai717/RN-MeetNative-App-GraphQL-APOLLO | 80a9801ea844385b8afefe4d78884c25843f5146 | [
"MIT"
] | null | null | null | import { storiesOf } from "@storybook/react-native";
import { baseDecorator } from "../../../utils/decorators";
import * as React from "react";
import { AgeSelector } from "../AgeSelector";
storiesOf("AgeSelector", module)
.addDecorator(baseDecorator)
.add("container", () => (
<AgeSelector
value={20}
onChange={value => console.log("onChange: ", value)}
/>
));
| 27.785714 | 58 | 0.637532 |
dd8f0405914dcb9b6e75060ed562129815623477 | 1,622 | php | PHP | application/views/notify_view.php | kripababu2015/BusBookingSysytem | 1d9888f5bf1762659376774a5ce92e819be77da3 | [
"MIT"
] | null | null | null | application/views/notify_view.php | kripababu2015/BusBookingSysytem | 1d9888f5bf1762659376774a5ce92e819be77da3 | [
"MIT"
] | null | null | null | application/views/notify_view.php | kripababu2015/BusBookingSysytem | 1d9888f5bf1762659376774a5ce92e819be77da3 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<title>Bus Notification</title>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width,initial-scale=1">
<!---Fontawesome--->
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
<!---Bootstrap5----->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<style>
fieldset{
width:500px;
height: 400px;
}
.bg{
background-image: url("../img/bg1.jpeg");
}
</style>
</head>
<body class="bg">
<form method="post" action="<?php echo base_url()?>main/notify_action" class="form-group">
<center>
<fieldset>
<h1 class="py-5">Bus notification</h1>
<label class="bold">Select Bus:</label>
<select name="bus" class="form-select">
<?php
if($n->num_rows()>0)
{
foreach($n->result() as $row)
{
?>
<option value="<?php echo $row->bid;?>"><?php echo $row->bname?>
</option>
<?php
}
}
?>
</select><br><br>
<textarea placeholder="Notification" name="noti" class="form-control"></textarea><br><br>
<a href="<?php echo base_url()?>main/adhome" class="btn btn-warning">Back</a>
<input type="submit" name="submit" value="Notify" class="btn btn-primary">
</fieldset>
</center>
</form>
</body>
</html> | 26.590164 | 228 | 0.623921 |
d5b3a2880800bf05abe6cb1c6ac29721709de175 | 1,447 | h | C | kernel/include/paging.h | bifore/yaos | 10ef1267bc780728135611dd3ae14388cd397e90 | [
"MIT"
] | 11 | 2018-05-20T20:41:07.000Z | 2021-12-18T22:38:12.000Z | kernel/include/paging.h | bifore/yaos | 10ef1267bc780728135611dd3ae14388cd397e90 | [
"MIT"
] | null | null | null | kernel/include/paging.h | bifore/yaos | 10ef1267bc780728135611dd3ae14388cd397e90 | [
"MIT"
] | 2 | 2018-10-12T12:36:44.000Z | 2021-07-11T15:21:42.000Z | #ifndef _KERNEL_PAGING_H
#define _KERNEL_PAGING_H
#include <stdbool.h>
#include <stdint.h>
#define TABLE_PRESENT_BIT 0x1
#define TABLE_WRITABLE_BIT 0x2
#define TABLE_USER_BIT 0x4
#define TABLE_FRAME_BIT 0x7FFFF000
#define ENTRY_PER_TABLE 1024
/* 4 KiB */
#define PAGE_SIZE 4096
/*
* Paging
*/
void paging_setup(void);
/*
* Page directory
*/
typedef struct page_dir_t Page_dir;
struct page_dir_t {
uint32_t entry[ENTRY_PER_TABLE];
};
Page_dir *create_page_dir(void);
void pd_entry_add_flags(uint32_t *pd_entry, uint32_t flags);
void pd_entry_del_flags(uint32_t *pd_entry, uint32_t flags);
void pd_entry_set_frame(uint32_t *pd_entry, uint32_t address);
uint32_t pd_entry_get_frame(uint32_t pd_entry);
bool pd_entry_is_present(uint32_t pd_entry);
bool pd_entry_is_writable(uint32_t pd_entry);
uint32_t pd_index(uint32_t virt_addr);
uint32_t pd_entry_phys_addr(uint32_t *pd_entry);
/*
* Page table
*/
typedef struct page_table_t Page_table;
struct page_table_t {
uint32_t entry[ENTRY_PER_TABLE];
};
Page_table *create_page_table(void);
void pt_entry_add_flags(uint32_t *pt_entry, uint32_t flags);
void pt_entry_del_flags(uint32_t *pt_entry, uint32_t flags);
void pt_entry_set_frame(uint32_t *pt_entry, uint32_t address);
uint32_t pt_entry_get_frame(uint32_t pt_entry);
bool pt_entry_is_present(uint32_t pt_entry);
bool pt_entry_is_writable(uint32_t pt_entry);
uint32_t pt_index(uint32_t virt_addr);
#endif
| 23.721311 | 62 | 0.798203 |
4b6fce56f1dd4c00b3d6bfe1164062c6c7b562b2 | 1,626 | sql | SQL | AccountTrend/sqlcontent.sql | tasukus/general-reports | 190a54ffe09a8782eb46e09a4c314f80b2b30011 | [
"MIT"
] | null | null | null | AccountTrend/sqlcontent.sql | tasukus/general-reports | 190a54ffe09a8782eb46e09a4c314f80b2b30011 | [
"MIT"
] | null | null | null | AccountTrend/sqlcontent.sql | tasukus/general-reports | 190a54ffe09a8782eb46e09a4c314f80b2b30011 | [
"MIT"
] | null | null | null | -- TODO: Update account name in line 31.
select strftime('%Y', t1.TRANSDATE) as YEAR
, strftime('%m', t1.TRANSDATE) as MONTH
, c.PFX_SYMBOL, c.SFX_SYMBOL, c.DECIMAL_POINT, c.GROUP_SEPARATOR
, total(t1.TRANSAMOUNT)
+ (select a.INITIALBAL + total(t2.TRANSAMOUNT)
from
(select ACCOUNTID, TRANSDATE, STATUS,
(case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
from CheckingAccount
union all
select TOACCOUNTID, TRANSDATE, STATUS, TOTRANSAMOUNT
from CheckingAccount
where TRANSCODE = 'Transfer') as t2
where t2.ACCOUNTID = t1.ACCOUNTID
and t2.STATUS NOT IN ('D', 'V')
and (strftime('%Y', t2.TRANSDATE) < strftime('%Y', t1.TRANSDATE)
or (strftime('%Y', t2.TRANSDATE) = strftime('%Y', t1.TRANSDATE)
and strftime('%m', t2.TRANSDATE) < strftime('%m', t1.TRANSDATE)))
) as Balance, a.ACCOUNTNAME as ACCOUNTNAME
from
(select ACCOUNTID, TRANSDATE, STATUS,
(case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
from CheckingAccount
union all
select TOACCOUNTID, TRANSDATE, STATUS, TOTRANSAMOUNT
from CheckingAccount
where TRANSCODE = 'Transfer') as t1
inner join AccountList as a on a.ACCOUNTID = t1.ACCOUNTID
inner join CurrencyFormats as c on c.CURRENCYID = a.CURRENCYID
where ACCOUNTNAME = 'Account1'
and t1.STATUS NOT IN ('D', 'V')
group by YEAR, MONTH
order by YEAR asc, MONTH asc;
| 46.457143 | 107 | 0.626691 |
7f58916a0f229119ca9de19825aed10903c73ee4 | 1,299 | go | Go | tests/services/auth_test.go | maktoobgar/core | 79752ef24489d981a311317ea4a1adb1fa92050a | [
"MIT"
] | 2 | 2022-02-20T15:35:07.000Z | 2022-03-22T22:33:56.000Z | tests/services/auth_test.go | maktoobgar/bookstore | 79752ef24489d981a311317ea4a1adb1fa92050a | [
"MIT"
] | null | null | null | tests/services/auth_test.go | maktoobgar/bookstore | 79752ef24489d981a311317ea4a1adb1fa92050a | [
"MIT"
] | 1 | 2021-12-30T08:03:07.000Z | 2021-12-30T08:03:07.000Z | package tests
import (
"testing"
_ "github.com/maktoobgar/go_template/internal/app/load"
service_auth "github.com/maktoobgar/go_template/internal/services/auth"
"github.com/maktoobgar/go_template/tests"
)
func TestAuth(t *testing.T) {
db := tests.New()
auth := service_auth.New()
username, password := "maktoobgar1", "123456789"
// this should pass
_, err := auth.SignUp(db, username, password, username)
if err != nil {
t.Errorf(err.Error())
return
}
// this should pass
_, err = auth.SignIn(db, username, password)
if err != nil {
t.Errorf(err.Error())
return
}
// duplicate error has to happen here
_, err = auth.SignUp(db, username, password, username)
if err == nil {
t.Errorf("here had to happend an error because data is duplicate")
return
}
// signing again, this should pass
_, err = auth.SignIn(db, username, password)
if err != nil {
t.Errorf(err.Error())
return
}
// this should pass
_, err = auth.SignUp(db, "b", "444", "b")
if err != nil {
t.Errorf(err.Error())
return
}
// this should pass
_, err = auth.SignUp(db, "k", "444", "k")
if err != nil {
t.Errorf(err.Error())
return
}
// signing in another user, this should pass
_, err = auth.SignIn(db, "k", "444")
if err != nil {
t.Errorf(err.Error())
return
}
}
| 19.681818 | 72 | 0.6505 |
b143509b03e8dc02adbad48c54ac73208b3d37ce | 7,685 | css | CSS | data/usercss/148360.user.css | 33kk/uso-archive | 2c4962d1d507ff0eaec6dcca555efc531b37a9b4 | [
"MIT"
] | 118 | 2020-08-28T19:59:28.000Z | 2022-03-26T16:28:40.000Z | data/usercss/148360.user.css | 33kk/uso-archive | 2c4962d1d507ff0eaec6dcca555efc531b37a9b4 | [
"MIT"
] | 38 | 2020-09-02T01:08:45.000Z | 2022-01-23T02:47:24.000Z | data/usercss/148360.user.css | 33kk/uso-archive | 2c4962d1d507ff0eaec6dcca555efc531b37a9b4 | [
"MIT"
] | 21 | 2020-08-19T01:12:43.000Z | 2022-03-15T21:55:17.000Z | /* ==UserStyle==
@name Better Hype Machine (aka Hypem) Nightmode
@namespace USO Archive
@author Steve Sellers
@description `• New night theme for Hype Machine! Based off my other 'Daytime' style, this new theme features the usual refinements but with a fresh coat of paint to give your eyes a rest<p>• Various UI, font, & color tweaks to better resemble a music player<p>• Moved user menu & search bar for better access when window is pinned to half screen<p>• Eliminated distracting & unnecessary elements for a much cleaner look`
@version 20180513.6.26
@license CC0-1.0
@preprocessor uso
==/UserStyle== */
@-moz-document domain("hypem.com") {
#content-right {
display: none;
}
#container {
background-color: #1a1a1a;
}
#header {
background-color: #0d1120;
}
#menu-item-popular a {
color: #ffffff;
}
#menu-item-stack a {
display: none;
}
#menu-item-supportus a {
display: none;
}
#menu-username {
background-color: #0d1120;
border-style: none;
border-color: #ffffff;
margin-right: 181px;
margin-top: 2px;
height: 40px;
}
#menu-username > ul {
margin-top: 2px;
margin-right: 160px;
}
#user-menu-feed-link {
background-color: #000000;
color: #ffffff !important;
}
#menu-item-latest a {
color: #ffffff;
}
#menu-item-album a {
color: #ffffff;
}
#menu-item-mytracks a {
background-color: #000000;
color: #ffffff !important;
}
#menu-item-myhistory > a {
background-color: #000000;
color: #ffffff !important;
}
#menu-item-myfriends > a {
background-color: #000000;
color: #ffffff !important;
}
#menu-item-mysettings > a {
background-color: #000000;
color: #ffffff !important;
}
#menu-item-more a b {
color: #949294;
}
#menu-username > ul > li.log-out > a {
background-color: #000000;
color: #ffffff !important;
}
#message h1 {
color: #ffffff;
}
#message {
background-color: #1d1f29;
}
#nav-artists a {
font-size: 16px;
color: #ffffff;
}
#nav-favorites a {
font-size: 16px;
}
#nav-feed a {
font-size: 16px;
}
#nav-genres a {
font-size: 16px;
}
#nav-history a {
font-size: 16px;
}
#nav-lastweek a {
font-size: 16px;
color: #ffffff;
}
#nav-no_remixes a {
font-size: 16px;
color: #ffffff;
}
#nav-obsessed a {
font-size: 16px;
}
#nav-playlist-1 a {
color: #ffffff;
font-size: 16px;
}
#nav-playlist-2 a {
color: #ffffff;
font-size: 16px;
}
#nav-playlist-3 a {
color: #ffffff;
font-size: 16px;
}
#nav-remixes a {
font-size: 16px;
}
#nav-remixes_only a {
font-size: 16px;
color: #ffffff;
}
#nav-videos a {
font-size: 16px;
color: #ffffff;
}
#player-container {
height: 60px;
}
#player-nowplaying {
font-family: Helvetica !important;
margin-top: -3px !important;
font-size: 16px !important;
letter-spacing: 1px !important;
}
#player-timebar {
margin-left: 275px;
}
#playerPlay {
font-size: 25px;
}
#section-track-2msrj {
background-color: #e4ffde !important;
}
#search-form {
margin-right: 310px;
}
#sponsored_tracks {
display: none !important;
}
#submenu {
background-color: #0d1120;
color: #ffffff;
}
#submenu-filter {
font-size: 16px !important;
}
#player-container #player-inner #player-controls #playerFav {
font-size: 15px !important;
}
.section-track.haarp-active {
background-color: #e4ffde !important;
}
a.haarp-fav-ctrl.icon-heart.fav-off {
font-size: 25px;
margin-right: -5px;
}
a.haarp-fav-ctrl.icon-heart.fav-on {
font-size: 25px;
margin-right: -5px;
}
a.logo-txt.icon-logo {
color: #c2c2c2;
}
a.play-ctrl.icon-toggle.haarp-play-ctrl.pause {
font-size: 30px;
}
a.play-ctrl.play.icon-toggle.haarp-play-ctrl {
border-right-width: -25px;
font-size: 30px;
}
a.selected {
font-size: 16px;
}
a.thumb {
background-color: #d62990 !important;
}
div.favcountlist {
display: none;
}
div.profile h1 {
color: #ffffff !important;
}
div.section.section-track.haarp-section-track.haarp-play-ctrl.even {
height: 100px;
}
div.section.section-track.haarp-section-track.haarp-play-ctrl.first {
height: 100px;
}
div.section.section-track.haarp-section-track.haarp-play-ctrl.first.haarp-active {
background-color: #30402f !important;
height: 100px !important;
}
div.section.section-track.haarp-section-track.first.haarp-active {
background-color: #30402f !important;
}
div.section.section-track.haarp-section-track.first.haarp-fav-active {
height: 100px !important;
background-color: #30402f !important;
}
div.section.section-track.haarp-section-track.haarp-play-ctrl.first.haarp-fav-active {
height: 100px !important;
background-color: #30402f !important;
}
div.section.section-track.haarp-section-track.first {
height: 100px !important;
background-color: #424242 !important;
}
div.section.section-track.haarp-section-track.haarp-play-ctrl.odd {
background-color: #dbdbdb !important;
height: 100px !important;
}
div.section.section-track.haarp-section-track.haarp-play-ctrl.odd.haarp-active {
background-color: #30402f !important;
}
div.section.section-track.haarp-section-track.odd.haarp-active {
background-color: #30402f !important;
}
h3.track_name {
color: #ffffff;
}
li.active a {
background-color: #30402f;
}
li.favdiv {
margin-right: -40px;
margin-top: 80px;
}
li.playlist-ctrls.playlist-on {
font-size: 30px;
}
p.post_info {
color: #ffffff !important;
}
span.title {
margin-right: -15px;
}
span.base-title {
color: #ffffff;
}
ul.tools {
margin-right: -20px;
margin-top: 20px;
}
div.meta {
display: none !important;
}
div.section.section-track.haarp-section-track.odd {
height: 100px;
background-color: #262626 !important;
}
div.section.section-track.haarp-section-track.even {
height: 100px;
background-color: #424242 !important;
}
a.haarp-fav-count.toggle-favorites.favcount-on {
color: #b0b0b0;
}
div.track-info.completed {
font-style: italic !important;
color: #616161 !important;
}
div.section.section-moreinpost.same.even {
background-color: #424242 !important;
}
div.track-info {
color: #ffffff !important;
font-size: 12px;
font-weight: bold;
text-transform: capitalize;
font-style: italic;
letter-spacing: .2px;
}
div.track-info.completed {
color: #ffffff !important;
}
div.user.header-box {
display: none;
}
a.user {
font-size: 20px;
color: #ffffff !important;
background-color: #0d1120 !important;
}
a.user_box_promo {
display: none;
}
a.artist {
color: #ffffff !important;
}
a.readpost {
color: #25afe6 !important;
}
a.icon-shuffle {
color: #949294 !important;
}
a.blog-fav-off {
color: #25afe6 !important;
}
a.more {
background-color: #424242 !important;
color: #ffffff !important;
}
div.section.section-track.haarp-section-track.odd.haarp-active {
background-color: #30402f !important;
}
div.section.section-track.haarp-section-track.even.haarp-active {
background-color: #30402f !important;
}
div.unit_head {
display: none;
}
div.previous-premieres.on-bandcamp {
display: none;
}
#content > div:nth-child(3) {
display: none;
}
} | 18.082353 | 424 | 0.627716 |