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
458719a6895a27215d068092e46d87ac1914cf23
618
py
Python
python/src/main/python/pyalink/alink/tests/examples/from_docs/test_berttextembeddingbatchop.py
wenwei8268/Alink
c00702538c95a32403985ebd344eb6aeb81749a7
[ "Apache-2.0" ]
null
null
null
python/src/main/python/pyalink/alink/tests/examples/from_docs/test_berttextembeddingbatchop.py
wenwei8268/Alink
c00702538c95a32403985ebd344eb6aeb81749a7
[ "Apache-2.0" ]
null
null
null
python/src/main/python/pyalink/alink/tests/examples/from_docs/test_berttextembeddingbatchop.py
wenwei8268/Alink
c00702538c95a32403985ebd344eb6aeb81749a7
[ "Apache-2.0" ]
null
null
null
import unittest from pyalink.alink import * import numpy as np import pandas as pd class TestBertTextEmbeddingBatchOp(unittest.TestCase): def test_berttextembeddingbatchop(self): df_data = pd.DataFrame([ [1, 'An english sentence.'], [2, '这是一个中文句子'] ]) batch_data = BatchOperator.fromDataframe(df_data, schemaStr='f1 bigint, f2 string') BertTextEmbeddingBatchOp() \ .setSelectedCol("f2") \ .setOutputCol("embedding") \ .setLayer(-2) \ .linkFrom(batch_data) \ .print() pass
29.428571
91
0.585761
2d84e5586659c2fe3b5e9ddc9057be00cde4c8dd
775
ts
TypeScript
src/models/ledger/ledgerEntry.ts
Brietoe/ripple-lib
494e46ee418a0f68656d2e184b481ee6a39ac074
[ "ISC" ]
null
null
null
src/models/ledger/ledgerEntry.ts
Brietoe/ripple-lib
494e46ee418a0f68656d2e184b481ee6a39ac074
[ "ISC" ]
null
null
null
src/models/ledger/ledgerEntry.ts
Brietoe/ripple-lib
494e46ee418a0f68656d2e184b481ee6a39ac074
[ "ISC" ]
null
null
null
import AccountRoot from './accountRoot' import Amendments from './amendments' import Check from './check' import DepositPreauth from './depositPreauth' import DirectoryNode from './directoryNode' import Escrow from './escrow' import FeeSettings from './feeSettings' import LedgerHashes from './ledgerHashes' import NegativeUNL from './negativeUNL' import Offer from './offer' import PayChannel from './payChannel' import RippleState from './rippleState' import SignerList from './signerList' import Ticket from './ticket' type LedgerEntry = | AccountRoot | Amendments | Check | DepositPreauth | DirectoryNode | Escrow | FeeSettings | LedgerHashes | NegativeUNL | Offer | PayChannel | RippleState | SignerList | Ticket export default LedgerEntry
23.484848
45
0.753548
2c6fd549b9f3f7b7e6f8992df36425f29b992fe1
2,049
py
Python
item_choice_definition/item_choice.py
averytorres/WazHack-Clone
e53e9b1b64f3828b20e45d4eeaafcdedf9bc6fda
[ "Unlicense" ]
1
2019-06-21T17:13:35.000Z
2019-06-21T17:13:35.000Z
item_choice_definition/item_choice.py
averytorres/WazHack-Clone
e53e9b1b64f3828b20e45d4eeaafcdedf9bc6fda
[ "Unlicense" ]
18
2019-06-25T00:48:11.000Z
2019-07-11T17:52:24.000Z
item_choice_definition/item_choice.py
averytorres/WazHack-Clone
e53e9b1b64f3828b20e45d4eeaafcdedf9bc6fda
[ "Unlicense" ]
1
2019-06-21T17:08:23.000Z
2019-06-21T17:08:23.000Z
from item_choice_definition.potion_choices import get_potion_choice from item_choice_definition.weapon_choices import get_weapon_choice from item_choice_definition.shield_choices import get_shield_choice from item_choice_definition.scroll_choices import get_scroll_choice from item_choice_definition.amulet_choices import get_amulet_choice from item_choice_definition.chest_armor_choices import get_chest_armor_choice from item_choice_definition.head_armor_choices import get_head_armor_choice from item_choice_definition.hand_armor_choices import get_hand_armor_choice from item_choice_definition.foot_armor_choices import get_foot_armor_choice from item_choice_definition.eye_choices import get_eye_choice from item_choice_definition.finger_choices import get_finger_choice def get_item_choice(item_choice, x, y): if 'POTION'.upper() in item_choice.upper(): item = get_potion_choice(item_choice, x, y) elif 'SCROLL'.upper() in item_choice.upper(): item = get_scroll_choice(item_choice, x, y) elif 'WEAPON'.upper() in item_choice.upper(): item = get_weapon_choice(item_choice, x, y) elif 'SHIELD'.upper() in item_choice.upper(): item = get_shield_choice(item_choice, x, y) elif 'AMULET'.upper() in item_choice.upper(): item = get_amulet_choice(item_choice, x, y) elif 'EYE'.upper() in item_choice.upper(): item = get_eye_choice(item_choice, x, y) elif 'HEAD_ARMOR'.upper() in item_choice.upper(): item = get_head_armor_choice(item_choice, x, y) elif 'CHEST_ARMOR'.upper() in item_choice.upper(): item = get_chest_armor_choice(item_choice, x, y) elif 'HAND_ARMOR'.upper() in item_choice.upper(): item = get_hand_armor_choice(item_choice, x, y) elif 'FOOT_ARMOR'.upper() in item_choice.upper(): item = get_foot_armor_choice(item_choice, x, y) elif 'FINGER'.upper() in item_choice.upper(): item = get_finger_choice(item_choice, x, y) else: print("ERROR: " + str(item_choice)) return item
38.660377
77
0.757931
daa7ceb37a79bc7fb0a41141d954e16640bf463b
2,997
php
PHP
app/Helper/WechatPayHelper.php
wangsllsgnaw/yunda.com
b368cb38907f89d022d78822682c56edaac05f11
[ "BSD-Source-Code", "IJG" ]
null
null
null
app/Helper/WechatPayHelper.php
wangsllsgnaw/yunda.com
b368cb38907f89d022d78822682c56edaac05f11
[ "BSD-Source-Code", "IJG" ]
null
null
null
app/Helper/WechatPayHelper.php
wangsllsgnaw/yunda.com
b368cb38907f89d022d78822682c56edaac05f11
[ "BSD-Source-Code", "IJG" ]
null
null
null
<?php /** * Created by PhpStorm. * User: wangsl * Date: 2018/6/6 * Time: 18:32 */ namespace App\Helper; use App\Helper\LogHelper; use App\Helper\RsaSignHelp; use App\Models\CustWarranty; use App\Models\ChannelContract; use App\Models\ChannelOperate; use App\Models\Person; use Ixudra\Curl\Facades\Curl; use Validator, DB, Image, Schema; use Session,Cache; class WechatPayHelper { //微信代扣支付 public function WechatPay($person_code){ $return_data = []; $person_res = Person::where('papers_code',$person_code) ->select('id','phone') ->first(); if(empty($person_res)){ $return_data['status'] = '500'; $return_data['content'] = 'no person message'; return $return_data; } //查询签约 $contract_res = ChannelContract::where('channel_user_code',$person_code) ->select(['openid','contract_id']) ->first(); if(empty($contract_res)){ $return_data['status'] = '500'; $return_data['content'] = 'no contract'; return $return_data; } //查询预投保 $prepare_res = ChannelOperate::where('channel_user_code',$person_code) ->where('prepare_status','200') ->where('operate_time',date('Y-m-d',time()-24*3600)) ->select('proposal_num') ->first(); if(empty($prepare_res)){ $return_data['status'] = '500'; $return_data['content'] = 'no prepare'; return $return_data; } $union_order_code = $prepare_res['proposal_num']; $data = []; $data['price'] = '2'; $data['private_p_code'] = 'VGstMTEyMkEwMUcwMQ'; $data['quote_selected'] = ''; $data['insurance_attributes'] = ''; $data['union_order_code'] = $union_order_code??""; $data['pay_account'] = $contract_res['openid']??""; $data['contract_id'] = $contract_res['contract_id']??""; $signhelp = new RsaSignHelp(); $data = $signhelp->tySign($data); //发送请求 $response = Curl::to(env('TY_API_SERVICE_URL') . '/ins_curl/wechat_pay_ins') ->returnResponseObject() ->withData($data) ->withTimeout(60) ->post(); // print_r($response);die; if($response->status != 200){ ChannelOperate::where('channel_user_code',$person_code) ->where('proposal_num',$union_order_code) ->update(['pay_status'=>'500','pay_content'=>$response->content]); $return_data['status'] = '500'; $return_data['content'] = 'faild to pay'; return $return_data; } //TODO 可以改变订单表的状态 DB::beginTransaction();//开启事务 try{ ChannelOperate::where('channel_user_code',$person_code) ->where('proposal_num',$union_order_code) ->update(['pay_status'=>'200']); CustWarranty::where('user_id',$person_res['id']) ->where('pro_policy_no',$union_order_code) ->update([ 'pay_status'=>'3',//支付完成 'warranty_status'=>'4',//保障中 ]); DB::commit(); $content = json_decode($response->content,true);//返回数据 $return_data['status'] = '200'; $return_data['content'] = $content; return $return_data; }catch (\Exception $e) { DB::rollBack(); $return_data['status'] = '500'; $return_data['content'] = '写库失败'; return $return_data; } } }
28.009346
78
0.650651
e4a2d73420ec3d79b88eb8fc45c13dc7bbc70f2c
2,767
c
C
jerry-core/ecma/operations/ecma-eval.c
ideas-detoxes/jerryscript
42523bd6e2b114755498c9f68fd78545f9b33476
[ "Apache-2.0" ]
4,324
2016-11-25T11:25:27.000Z
2022-03-31T03:24:49.000Z
jerry-core/ecma/operations/ecma-eval.c
ideas-detoxes/jerryscript
42523bd6e2b114755498c9f68fd78545f9b33476
[ "Apache-2.0" ]
2,099
2016-11-25T08:08:59.000Z
2022-03-12T07:41:20.000Z
jerry-core/ecma/operations/ecma-eval.c
lygstate/jerryscript
55acdf2048b390d0f56f12e64dbfb2559f0e70ad
[ "Apache-2.0" ]
460
2016-11-25T07:16:10.000Z
2022-03-24T14:05:29.000Z
/* Copyright JS Foundation and other contributors, http://js.foundation * * 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. */ #include "ecma-eval.h" #include "ecma-builtins.h" #include "ecma-exceptions.h" #include "ecma-gc.h" #include "ecma-globals.h" #include "ecma-helpers.h" #include "ecma-lex-env.h" #include "jcontext.h" #include "js-parser.h" #include "vm.h" /** \addtogroup ecma ECMA * @{ * * \addtogroup eval eval * @{ */ /** * Perform 'eval' with code stored in ecma-string * * See also: * ecma_op_eval_chars_buffer * ECMA-262 v5, 15.1.2.1 (steps 2 to 8) * * @return ecma value */ ecma_value_t ecma_op_eval (ecma_value_t source_code, /**< source code */ uint32_t parse_opts) /**< ecma_parse_opts_t option bits */ { JERRY_ASSERT (ecma_is_value_string (source_code)); if (ecma_is_value_magic_string (source_code, LIT_MAGIC_STRING__EMPTY)) { return ECMA_VALUE_UNDEFINED; } return ecma_op_eval_chars_buffer ((void *) &source_code, parse_opts | ECMA_PARSE_HAS_SOURCE_VALUE); } /* ecma_op_eval */ /** * Perform 'eval' with code stored in continuous character buffer * * See also: * ecma_op_eval * ECMA-262 v5, 15.1.2.1 (steps 2 to 8) * * @return ecma value */ ecma_value_t ecma_op_eval_chars_buffer (void *source_p, /**< source code */ uint32_t parse_opts) /**< ecma_parse_opts_t option bits */ { #if JERRY_PARSER JERRY_ASSERT (source_p != NULL); uint32_t is_strict_call = ECMA_PARSE_STRICT_MODE | ECMA_PARSE_DIRECT_EVAL; if ((parse_opts & is_strict_call) != is_strict_call) { parse_opts &= (uint32_t) ~ECMA_PARSE_STRICT_MODE; } parse_opts |= ECMA_PARSE_EVAL; #if JERRY_ESNEXT ECMA_CLEAR_LOCAL_PARSE_OPTS (); #endif /* JERRY_ESNEXT */ ecma_compiled_code_t *bytecode_p = parser_parse_script (source_p, parse_opts, NULL); if (JERRY_UNLIKELY (bytecode_p == NULL)) { return ECMA_VALUE_ERROR; } return vm_run_eval (bytecode_p, parse_opts); #else /* !JERRY_PARSER */ JERRY_UNUSED (code_p); JERRY_UNUSED (code_buffer_size); JERRY_UNUSED (parse_opts); return ecma_raise_syntax_error (ECMA_ERR_PARSER_NOT_SUPPORTED); #endif /* JERRY_PARSER */ } /* ecma_op_eval_chars_buffer */ /** * @} * @} */
25.385321
101
0.700398
cbaa580024a6afc88621043df47bb7605913d0ab
111
sql
SQL
src/main/resources/database/changes/release-15/cleanup_actionplans_and_cases.sql
uk-gov-mirror/ONSdigital.rm-collection-exercise-service
179fe82aedd2959b4a614aeab982cadb56eabab0
[ "MIT" ]
7
2017-07-11T07:40:41.000Z
2019-04-18T20:24:35.000Z
src/main/resources/database/changes/release-15/cleanup_actionplans_and_cases.sql
uk-gov-mirror/ONSdigital.rm-collection-exercise-service
179fe82aedd2959b4a614aeab982cadb56eabab0
[ "MIT" ]
173
2018-01-03T16:42:54.000Z
2022-03-25T14:11:51.000Z
src/main/resources/database/changes/release-15/cleanup_actionplans_and_cases.sql
uk-gov-mirror/ONSdigital.rm-collection-exercise-service
179fe82aedd2959b4a614aeab982cadb56eabab0
[ "MIT" ]
4
2017-06-12T09:33:10.000Z
2021-04-11T07:45:30.000Z
DROP TABLE collectionexercise.casetypedefault cascade; DROP TABLE collectionexercise.casetypeoverride cascade;
37
55
0.891892
463fbcfe074afbda5f9eb8e5b3d5879c3e364222
1,902
php
PHP
resources/views/pages/buttons.blade.php
ArthurPPinheiro/drinkfy
3ccc5f417ca0c7eef6bad693c21acd578cef3bc8
[ "MIT" ]
null
null
null
resources/views/pages/buttons.blade.php
ArthurPPinheiro/drinkfy
3ccc5f417ca0c7eef6bad693c21acd578cef3bc8
[ "MIT" ]
null
null
null
resources/views/pages/buttons.blade.php
ArthurPPinheiro/drinkfy
3ccc5f417ca0c7eef6bad693c21acd578cef3bc8
[ "MIT" ]
null
null
null
@extends('layouts.app') @section('content') <section class="buttons section"> <div class="container"> <div class="row"> <div class="section-title text-center"> <h2>Button Styles</h2> </div> </div> <div class="row mt-30"> <div class="col-md-12"> <div class="buttonPart"> <ul class="list-inline"> <li class="li"><a href="#!" class="btn btn-main btn-large">Default Button</a></li> <li class="li"><a href="#!" class="btn btn-main btn-medium">Default Button</a></li> <li class="li"><a href="#!" class="btn btn-main btn-icon"><i class="tf-ion-ios-cart-outline"></i>Default Button</a></li> <li class="li"><a href="#!" class="btn btn-main btn-small">Default Button</a></li> </ul> <ul class="list-inline mt-10"> <li class="li"><a href="#!" class="btn btn-main btn-large btn-round">Round Button</a></li> <li class="li"><a href="#!" class="btn btn-main btn-medium btn-round">Round Button</a></li> <li class="li"><a href="#!" class="btn btn-main btn-medium btn-round btn-icon"><i class="tf-ion-ios-cart-outline"></i>Round Button</a></li> <li class="li"><a href="#!" class="btn btn-main btn-small btn-round">Round Button</a></li> </ul> <ul class="list-inline mt-10"> <li class="li"><a href="#!" class="btn btn-main btn-large btn-round-full">Full Round Button</a></li> <li class="li"><a href="#!" class="btn btn-main btn-medium btn-round-full btn-icon"><i class="tf-ion-ios-cart-outline"></i>Full Round Button</a></li> <li class="li"><a href="#!" class="btn btn-main btn-small btn-round-full">Full Round Button</a></li> </ul> </div> </div> </div> </div> </section> @endsection
48.769231
167
0.537855
be5dc3be18cdb6c1d22d659dd0f165af0a10d291
292
ts
TypeScript
src/app/recurly/withRecurly.ts
gladeye/checkout-js
b04babb89020883b377664a038fcaab3d9c882d2
[ "MIT" ]
null
null
null
src/app/recurly/withRecurly.ts
gladeye/checkout-js
b04babb89020883b377664a038fcaab3d9c882d2
[ "MIT" ]
null
null
null
src/app/recurly/withRecurly.ts
gladeye/checkout-js
b04babb89020883b377664a038fcaab3d9c882d2
[ "MIT" ]
null
null
null
import { createInjectHoc, createMappableInjectHoc, InjectHoc } from '../common/hoc'; import RecurlyContext, { RecurlyContextProps } from './RecurlyContext'; const withRecurly = createMappableInjectHoc(RecurlyContext, { displayNamePrefix: 'WithRecurly', }); export default withRecurly;
29.2
84
0.780822
9fcfe54f419e3a8ec09bb2264e8fd60442fe4b84
2,076
py
Python
src/django_clickhouse/routers.py
belonesox/django-clickhouse
05ad3b54868a33d6e8dea65b80f4820f4ff09cf2
[ "MIT" ]
2
2020-10-14T07:29:25.000Z
2020-10-14T07:29:36.000Z
src/django_clickhouse/routers.py
M1ha-Shvn/django-clickhouse
f54c4c721f5f93dd0e0fbbcfa4ebdf814e5d626e
[ "MIT" ]
null
null
null
src/django_clickhouse/routers.py
M1ha-Shvn/django-clickhouse
f54c4c721f5f93dd0e0fbbcfa4ebdf814e5d626e
[ "MIT" ]
null
null
null
""" This file defines router to find appropriate database """ from typing import Type import random import six from infi.clickhouse_orm.migrations import Operation, DropTable, CreateTable from .clickhouse_models import ClickHouseModel from .configuration import config from .utils import lazy_class_import class DefaultRouter: def db_for_read(self, model: Type[ClickHouseModel], **hints) -> str: """ Gets database to read from for model :param model: Model to decide for :param hints: Some hints to make correct choice :return: Database alias """ return random.choice(model.read_db_aliases) def db_for_write(self, model: Type[ClickHouseModel], **hints) -> str: """ Gets database to write to for model :param model: Model to decide for :param hints: Some hints to make correct choice :return: Database alias """ return random.choice(model.write_db_aliases) def allow_migrate(self, db_alias: str, app_label: str, operation: Operation, model=None, **hints) -> bool: """ Checks if migration can be applied to given database :param db_alias: Database alias to check :param app_label: App from which migration is got :param operation: Operation object to perform :param model: Model migration is applied to :param hints: Hints to make correct decision :return: boolean """ if hints.get("force_migrate_on_databases", None): return db_alias in hints["force_migrate_on_databases"] if hints.get('model'): model = '%s.%s.%s' % (app_label, config.MODELS_MODULE, hints['model']) \ if isinstance(hints['model'], six.string_types) else hints['model'] model = lazy_class_import(model) if operation.__class__ not in {CreateTable, DropTable}: return db_alias in model.migrate_replicated_db_aliases else: return db_alias in model.migrate_non_replicated_db_aliases
35.793103
84
0.662331
e840481a19b50da6314b5a3e618d5d46b3b63c96
1,830
dart
Dart
lib/ui/pages/me/settings/settings_more_page.dart
cyf/flutter_cyf
d0f3739bd935068eed5c92ef8e087912a8fbd748
[ "MIT" ]
null
null
null
lib/ui/pages/me/settings/settings_more_page.dart
cyf/flutter_cyf
d0f3739bd935068eed5c92ef8e087912a8fbd748
[ "MIT" ]
null
null
null
lib/ui/pages/me/settings/settings_more_page.dart
cyf/flutter_cyf
d0f3739bd935068eed5c92ef8e087912a8fbd748
[ "MIT" ]
null
null
null
import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_gen/gen_l10n/gitter_localizations.dart'; import 'package:flutter_app_boilerplate/common/utils/navigator_util.dart'; import 'package:flutter_app_boilerplate/ui/blocs/me/dark_mode/dark_mode_bloc.dart'; import 'package:flutter_app_boilerplate/ui/pages/me/settings/settings_bottom_page.dart'; import 'package:flutter_app_boilerplate/ui/pages/me/settings/settings_center_page.dart'; import 'package:flutter_app_boilerplate/ui/pages/me/settings/settings_top_page.dart'; class SettingsMorePage extends StatelessWidget { const SettingsMorePage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { const EdgeInsetsGeometry _padding = EdgeInsets.only(left: 14, right: 8); const EdgeInsetsGeometry _margin = EdgeInsets.only(top: 8); return Scaffold( appBar: AppBar( leading: GestureDetector( onTap: () => NavigatorUtil.pop(context), child: const Icon( Icons.arrow_back, size: 24, ), ), title: Text( GitterLocalizations.of(context)!.settings, ), ), body: BlocBuilder<DarkModeBloc, DarkModeState>( builder: (context, state) => ListView( children: <Widget>[ Container( margin: _margin, padding: _padding, child: const SettingsTopPage(), ), Container( margin: _margin, padding: _padding, child: const SettingsCenterPage(), ), Container( margin: _margin, padding: _padding, child: const SettingsBottomPage(), ), ], ), ), ); } }
33.888889
88
0.626776
4b245ce63cff6490497ea0d0b36491f26655e350
745
dart
Dart
lib/Model/main_system.dart
ratulhasanruhan/Flutter-json-Api
f73a5effb37d3c44fb2dc24741413681f212a825
[ "Apache-2.0" ]
1
2021-06-01T04:16:48.000Z
2021-06-01T04:16:48.000Z
lib/Model/main_system.dart
ratulhasanruhan/Flutter-json-Api
f73a5effb37d3c44fb2dc24741413681f212a825
[ "Apache-2.0" ]
null
null
null
lib/Model/main_system.dart
ratulhasanruhan/Flutter-json-Api
f73a5effb37d3c44fb2dc24741413681f212a825
[ "Apache-2.0" ]
null
null
null
import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart' as http; import 'Data.dart'; Future<List<Data>> getAllData() async { var apiUrl = 'https://jsonplaceholder.typicode.com/photos'; var data = await http.get(apiUrl); var jsonData = json.decode(data.body); List<Data> listofdata = []; for (var i in jsonData) { Data data = Data( id: i['id'], title: i['title'], url: i['url'], thumbnailUrl: i['thumbnailUrl'], ); listofdata.add(data); } return listofdata; } List<MaterialColor> randomcolor = [ Colors.green, Colors.blue, Colors.red, Colors.deepOrange, Colors.yellow, Colors.teal, Colors.blueGrey, Colors.brown, Colors.cyan ];
17.325581
61
0.64698
4ff4e9025a31edd694db8bfac4983c7c142ef5e9
880
rb
Ruby
app/controllers/comments_controller.rb
nrsantamaria/opsynthpop
2e6b4a0d62c0b871f0e9a80234b2855c92a76757
[ "MIT" ]
null
null
null
app/controllers/comments_controller.rb
nrsantamaria/opsynthpop
2e6b4a0d62c0b871f0e9a80234b2855c92a76757
[ "MIT" ]
null
null
null
app/controllers/comments_controller.rb
nrsantamaria/opsynthpop
2e6b4a0d62c0b871f0e9a80234b2855c92a76757
[ "MIT" ]
null
null
null
class CommentsController < ApplicationController def new @post = Post.find(params[:post_id]) @comment = Comment.new end def create @post = Post.find(params[:post_id]) @comment = @post.comments.new(comment_params) if @comment.save redirect_to post_path(@comment.post) else render :new end end def edit @post = Post.find(params[:post_id]) @comment = Comment.find(params[:id]) end def update @post = Post.find(params[:post_id]) @comment = Comment.find(params[:id]) if @comment.update(comment_params) redirect_to post_path(@comment.post) else render :edit end end def destroy @comment = Comment.find(params[:id]) @comment.destroy redirect_to post_path(@comment.post) end private def comment_params params.require(:comment).permit(:author, :content) end end
20.465116
54
0.661364
23188aebef2bcf3b47cf4670c626f016d6d0a18c
2,417
css
CSS
css/index.css
AL0YSI0US/cookie-stand
74027921dcf0b13678742fec6260386ed324e99d
[ "MIT" ]
1
2021-02-11T23:30:55.000Z
2021-02-11T23:30:55.000Z
css/index.css
AL0YSI0US/cookie-stand
74027921dcf0b13678742fec6260386ed324e99d
[ "MIT" ]
1
2021-02-06T11:07:42.000Z
2021-02-06T11:07:42.000Z
css/index.css
AL0YSI0US/cookie-stand
74027921dcf0b13678742fec6260386ed324e99d
[ "MIT" ]
null
null
null
h1 { padding-top: 10px; padding-bottom: 10px; font-family: 'Cuprum', sans-serif; font-weight: bold; font-size: 46px; color:rgb(6, 6, 6); } img { border-radius: 10px; } nav { font-family: 'IBM Plex Mono', monospace; font-size: 24px; nav-left: auto; float: left; color: rgb(14, 3, 3); margin-top: 30px; padding-left: 50px; } #feature-section { font-family: 'Cuprum', sans-serif; font-size: 26px; padding-bottom: 20px; } h3 { font-family: 'Cuprum', sans-serif; font-size: 34px; text-align: center; padding-top: 10px; padding-bottom: 10px; } /* SERIF FONT LIVES BELOW !!!!! */ body { background-color: rgb(187, 142, 82); text-align: center; border: solid rgb(0, 62, 78) 6px; font-size: 20px; font-weight: bold; color: rgb(22, 47, 40); font-family: Georgia, 'Times New Roman', Times, serif; } /* ^^^^^ SERIF FONT LIVES IN HERE!!!!! ^^^^^^^^^^^^^^^^^^ */ ul, li { padding-top: 5px; text-align: center; color: rgba(22, 22, 22, 0.85); font-size: 20px; } p{ text-align: cen; } footer { padding-top: 10px; } .salmonCookieScroll { height: 50px; overflow: hidden; position: relative; } .salmonCookieScroll h3 { font-size: 22px; font-family: 'IBM Plex Mono', monospace; color: rgb(0, 68, 38); position: absolute; width: 100%; height: 100%; margin: 0%; line-height: 50px; text-align: center; /* Starting position */ -moz-transform:translateX(100%); -webkit-transform:translateX(100%); transform:translateX(100%); /* Apply animation to this element */ -moz-animation: salmonCookieScroll 15s linear infinite; -webkit-animation: salmonCookieScroll 15s linear infinite; animation: salmonCookieScroll 15s linear infinite; } /* Move it (define the animation) */ @-moz-keyframes salmonCookieScroll { 0% { -moz-transform: translateX(100%); } 100% { -moz-transform: translateX(-100%); } } @-webkit-keyframes salmonCookieScroll { 0% { -webkit-transform: translateX(100%); } 100% { -webkit-transform: translateX(-100%); } } @keyframes salmonCookieScroll { 0% { -moz-transform: translateX(100%); /* Firefox bug fix */ -webkit-transform: translateX(100%); /* Firefox bug fix */ transform: translateX(100%); } 100% { -moz-transform: translateX(-100%); /* Firefox bug fix */ -webkit-transform: translateX(-100%); /* Firefox bug fix */ transform: translateX(-100%); } }
23.019048
61
0.640463
1509d419dfbe88d1d5baae25a435b75bfce7e082
2,152
kt
Kotlin
src/main/kotlin/kui/Diff.kt
Jolley71717/kui
2271549eb78aaa5e51ad8aea05168e699ea256b9
[ "MIT" ]
null
null
null
src/main/kotlin/kui/Diff.kt
Jolley71717/kui
2271549eb78aaa5e51ad8aea05168e699ea256b9
[ "MIT" ]
null
null
null
src/main/kotlin/kui/Diff.kt
Jolley71717/kui
2271549eb78aaa5e51ad8aea05168e699ea256b9
[ "MIT" ]
null
null
null
package kui internal fun <T> diff(first: List<T>, second: List<T>, eq: (T, T) -> Boolean = { x, y -> x == y }): List<Diff<T>> { val a = first.asReversed() val b = second.asReversed() val mat = Array(a.size) { IntArray(b.size) } val pts = Array(a.size) { _ -> Array(b.size) { Ptr.EMPTY } } fun mat(ai: Int, bi: Int): Int = if (ai < 0 || bi < 0) 0 else mat[ai][bi] // build matrix for ((ai, bi) in a.indices product b.indices) { if(eq(a[ai], b[bi])) { mat[ai][bi] = mat(ai - 1, bi - 1) + 1 pts[ai][bi] = Ptr.DIAG } else { val left = mat(ai - 1, bi) val up = mat(ai, bi - 1) if (left >= up) { mat[ai][bi] = left pts[ai][bi] = Ptr.LEFT } else { mat[ai][bi] = up pts[ai][bi] = Ptr.UP } } } // backtrack val result = mutableListOf<Diff<T>>() var ai = a.lastIndex var bi = b.lastIndex while(ai >= 0 && bi >= 0) { when(pts[ai][bi]) { Ptr.DIAG -> { result.add(Unchanged(a[ai], b[bi])) ai-- bi-- } Ptr.LEFT -> { result.add(Removed(a[ai])) ai-- } Ptr.UP -> { result.add(Added(b[bi])) bi-- } Ptr.EMPTY -> error("unfilled matrix $ai $bi") } } while (ai >= 0) { result.add(Removed(a[ai])) ai-- } while (bi >= 0) { result.add(Added(b[bi])) bi-- } return result } internal enum class Ptr { EMPTY, UP, LEFT, DIAG } internal sealed class Diff<T> internal data class Added<T>(val new: T) : Diff<T>() internal data class Removed<T>(val old: T) : Diff<T>() internal data class Unchanged<T>(val old: T, val new: T) : Diff<T>() internal infix fun <T, U> Iterable<T>.product(that: Iterable<U>): List<Pair<T, U>> { val result = mutableListOf<Pair<T, U>>() for (t in this) { for (u in that) { result.add(t to u) } } return result }
26.567901
115
0.449814
af73ca7d3fa3f2c57781e2fab8b806604459aed8
2,870
swift
Swift
Sources/Subsonic/ViewExtensions.swift
mmmayer/Subsonic
156c5742279df5d2315e29534a2410f418c8a772
[ "MIT" ]
173
2021-11-12T16:39:49.000Z
2022-03-30T16:03:32.000Z
Sources/Subsonic/ViewExtensions.swift
mmmayer/Subsonic
156c5742279df5d2315e29534a2410f418c8a772
[ "MIT" ]
1
2021-11-20T13:49:57.000Z
2021-11-20T13:49:57.000Z
Sources/Subsonic/ViewExtensions.swift
mmmayer/Subsonic
156c5742279df5d2315e29534a2410f418c8a772
[ "MIT" ]
15
2021-11-12T17:20:06.000Z
2022-02-06T06:08:50.000Z
// // ViewExtensions.swift // Part of Subsonic, a simple library for playing sounds in SwiftUI // // This file contains `View` extensions that make Subsonic audio // easier to play. // // Copyright (c) 2021 Paul Hudson. // See LICENSE for license information. // import SwiftUI extension View { /// Plays a single sound immediately. /// - Parameters: /// - sound: The name of the sound file you want to load. /// - bundle: The bundle containing the sound file. Defaults to the main bundle. /// - volume: How loud to play this sound relative to other sounds in your app, /// specified in the range 0 (no volume) to 1 (maximum volume). /// - repeatCount: How many times to repeat this sound. Specifying 0 here /// (the default) will play the sound only once. public func play(sound: String, from bundle: Bundle = .main, volume: Double = 1, repeatCount: SubsonicController.RepeatCount = 0) { SubsonicController.shared.play(sound: sound, from: bundle, volume: volume, repeatCount: repeatCount) } /// Plays or stops a single sound based on the isPlaying Boolean /// - Parameters: /// - sound: The name of the sound file you want to load. /// - bundle: The bundle containing the sound file. Defaults to the main bundle. /// - isPlaying: A Boolean tracking whether the sound should currently be playing. /// - volume: How loud to play this sound relative to other sounds in your app, /// specified in the range 0 (no volume) to 1 (maximum volume). /// - repeatCount: How many times to repeat this sound. Specifying 0 here /// (the default) will play the sound only once. /// - playMode: Whether playback should restart from the beginning each time, /// or continue from the last playback point. Defaults to `.reset`. /// - Returns: A new view that plays the sound when isPlaying becomes true. public func sound(_ sound: String, from bundle: Bundle = .main, isPlaying: Binding<Bool>, volume: Double = 1, repeatCount: SubsonicController.RepeatCount = 0, playMode: SubsonicController.PlayMode = .reset) -> some View { self.modifier( SubsonicPlayerModifier(sound: sound, from: bundle, isPlaying: isPlaying, volume: volume, repeatCount: repeatCount, playMode: playMode) ) } /// Stops one specific sound played using `play(sound:)`. This will *not* stop sounds /// that you have bound to your app's state using the `sound()` modifier. public func stop(sound: String) { SubsonicController.shared.stop(sound: sound) } /// Stops all sounds that were played using `play(sound:)`. This will *not* stop sounds /// that you have bound to your app's state using the `sound()` modifier. public func stopAllManagedSounds() { SubsonicController.shared.stopAllManagedSounds() } }
50.350877
225
0.682927
8c9302ccfeccfcd88e754a425dd0b2ebeb9bd365
832
swift
Swift
Sources/Utils/SwiftUI/LoadableImage.swift
amebalabs/Utils
ba33fda4e421f3203604b302aac3e67ec0ab902e
[ "MIT" ]
3
2019-12-31T13:39:29.000Z
2021-02-13T16:00:14.000Z
Sources/Utils/SwiftUI/LoadableImage.swift
amebalabs/Utils
ba33fda4e421f3203604b302aac3e67ec0ab902e
[ "MIT" ]
null
null
null
Sources/Utils/SwiftUI/LoadableImage.swift
amebalabs/Utils
ba33fda4e421f3203604b302aac3e67ec0ab902e
[ "MIT" ]
null
null
null
//import SwiftUI // //@available(iOS 13.0, *) //struct LoadableImage : View { // @State var remoteImage: RemoteImage // // var body: some View { // ZStack { // if remoteImage.image != nil { // Image(uiImage: remoteImage.image!) // .resizable() // .renderingMode(.original) // .frame(width: 300, height: 169) // .cornerRadius(5) // .shadow(radius: 10) // } else { // Rectangle() // .foregroundColor(.gray) // .frame(width: 300, height: 169) // .cornerRadius(5) // .shadow(radius: 10) // } // }.onAppear { // self.remoteImage.download() // } // } //}
29.714286
53
0.411058
4ef5cbcff6de89035266d99fb15b388ad952f900
22,080
cpp
C++
src/game/server/laserText.cpp
35niavlys/teeworlds-fng2-mod
d73be893c060fb3832656679d7756a5c42bca7cc
[ "Zlib" ]
null
null
null
src/game/server/laserText.cpp
35niavlys/teeworlds-fng2-mod
d73be893c060fb3832656679d7756a5c42bca7cc
[ "Zlib" ]
3
2020-05-31T06:36:51.000Z
2020-09-11T08:34:36.000Z
src/game/server/laserText.cpp
35niavlys/teeworlds-fng2-mod
d73be893c060fb3832656679d7756a5c42bca7cc
[ "Zlib" ]
1
2021-09-04T11:32:33.000Z
2021-09-04T11:32:33.000Z
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ /* If you are missing that file, acquire a complete release at teeworlds.com. */ #include <game/generated/protocol.h> #include <game/server/gamecontext.h> #include "laserText.h" #include <string.h> static const bool asciiTable[256][5][3] = { { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 0 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 1 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 2 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 3 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 4 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 5 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 6 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 7 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 8 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 9 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 10 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 11 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 12 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 13 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 14 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 15 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 16 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 17 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 18 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 19 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 20 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 21 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 22 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 23 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 24 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 25 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 26 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 27 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 28 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 29 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 30 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 31 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 32 { {0,1,0}, {0,1,0}, {0,1,0}, {0,0,0}, {0,1,0} }, // ascii 33 ! { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 34 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 35 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 36 { {1,0,1}, {1,0,0}, {0,1,0}, {0,0,1}, {1,0,1} }, // ascii 37 % { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 38 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 39 { {0,1,0}, {1,0,0}, {1,0,0}, {1,0,0}, {0,1,0} }, // ascii 40 ( { {0,1,0}, {0,0,1}, {0,0,1}, {0,0,1}, {0,1,0} }, // ascii 41 ) { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 42 { {0,0,0}, {0,1,0}, {1,1,1}, {0,1,0}, {0,0,0} }, // ascii 43 + { {0,0,0}, {0,0,0}, {0,0,0}, {0,1,0}, {1,0,0} }, // ascii 44 , { {0,0,0}, {0,0,0}, {1,1,1}, {0,0,0}, {0,0,0} }, // ascii 45 - { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,1,0} }, // ascii 46 . { {0,0,0}, {0,0,1}, {0,1,0}, {1,0,0}, {0,0,0} }, // ascii 47 / { {1,1,1}, {1,0,1}, {1,0,1}, {1,0,1}, {1,1,1} }, // 0 { {0,1,0}, {1,1,0}, {0,1,0}, {0,1,0}, {0,1,0} }, // 1 { {1,1,1}, {0,0,1}, {1,1,1}, {1,0,0}, {1,1,1} }, // 2 { {1,1,1}, {0,0,1}, {1,1,1}, {0,0,1}, {1,1,1} }, // 3 { {1,0,1}, {1,0,1}, {1,1,1}, {0,0,1}, {0,0,1} }, // 4 { {1,1,1}, {1,0,0}, {1,1,1}, {0,0,1}, {1,1,1} }, // 5 { {1,1,1}, {1,0,0}, {1,1,1}, {1,0,1}, {1,1,1} }, // 6 { {1,1,1}, {0,0,1}, {0,0,1}, {0,0,1}, {0,0,1} }, // 7 { {1,1,1}, {1,0,1}, {1,1,1}, {1,0,1}, {1,1,1} }, // 8 { {1,1,1}, {1,0,1}, {1,1,1}, {0,0,1}, {1,1,1} }, // 9 { {0,0,0}, {0,1,0}, {0,0,0}, {0,1,0}, {0,0,0} }, // : { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 59 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 60 { {0,0,0}, {1,1,1}, {0,0,0}, {1,1,1}, {0,0,0} }, // ascii 61 = { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 62 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 63 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 64 { {1,1,1}, {1,0,1}, {1,1,1}, {1,0,1}, {1,0,1} }, // A { {1,0,0}, {1,0,0}, {1,1,1}, {1,0,1}, {1,1,1} }, // B { {1,1,1}, {1,0,0}, {1,0,0}, {1,0,0}, {1,1,1} }, // C { {0,0,1}, {0,0,1}, {1,1,1}, {1,0,1}, {1,1,1} }, // D { {1,1,1}, {1,0,0}, {1,1,1}, {1,0,0}, {1,1,1} }, // E { {1,1,1}, {1,0,0}, {1,1,1}, {1,0,0}, {1,0,0} }, // F { {1,1,1}, {1,0,1}, {1,1,1}, {0,0,1}, {0,1,1} }, // G { {1,0,1}, {1,0,1}, {1,1,1}, {1,0,1}, {1,0,1} }, // H { {1,0,0}, {1,0,0}, {1,0,0}, {1,0,0}, {1,0,0} }, // I { {0,0,1}, {0,0,1}, {1,0,1}, {1,0,1}, {1,1,1} }, // J { {1,0,0}, {1,0,0}, {1,0,1}, {1,1,0}, {1,0,1} }, // K { {1,0,0}, {1,0,0}, {1,0,0}, {1,0,0}, {1,1,1} }, // L { {1,0,1}, {1,1,1}, {1,1,1}, {1,0,1}, {1,0,1} }, // M { {0,0,0}, {0,0,0}, {1,1,1}, {1,0,1}, {1,0,1} }, // N { {0,0,0}, {0,0,0}, {1,1,1}, {1,0,1}, {1,1,1} }, // O { {1,1,1}, {1,0,1}, {1,1,1}, {1,0,0}, {1,0,0} }, // P { {1,1,1}, {1,0,1}, {1,1,1}, {0,0,1}, {0,0,1} }, // Q { {0,0,0}, {1,0,1}, {1,1,0}, {1,0,0}, {1,0,0} }, // R { {0,1,1}, {1,0,0}, {0,1,0}, {0,0,1}, {1,1,0} }, // S { {1,1,1}, {0,1,0}, {0,1,0}, {0,1,0}, {0,1,0} }, // T { {0,0,0}, {0,0,0}, {1,0,1}, {1,0,1}, {1,1,1} }, // U { {0,0,0}, {0,0,0}, {1,0,1}, {1,1,1}, {0,1,0} }, // V { {1,0,1}, {1,0,1}, {1,1,1}, {1,1,1}, {1,1,1} }, // W { {0,0,0}, {0,0,0}, {1,0,1}, {0,1,0}, {1,0,1} }, // X { {1,0,1}, {1,0,1}, {1,1,1}, {0,1,0}, {0,1,0} }, // Y { {1,1,1}, {0,0,1}, {0,1,0}, {1,0,0}, {1,1,1} }, // Z { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 91 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 92 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 93 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 94 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 95 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 96 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 97 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 98 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 99 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 100 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 101 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 102 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 103 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 104 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 105 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 106 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 107 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 108 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 109 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 110 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 111 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 112 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 113 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 114 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 115 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 116 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 117 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 118 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 119 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 120 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 121 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 122 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 123 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 124 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 125 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 126 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 127 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 128 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 129 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 130 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 131 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 132 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 133 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 134 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 135 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 136 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 137 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 138 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 139 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 140 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 141 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 142 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 143 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 144 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 145 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 146 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 147 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 148 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 149 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 150 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 151 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 152 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 153 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 154 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 155 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 156 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 157 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 158 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 159 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 160 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 161 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 162 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 163 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 164 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 165 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 166 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 167 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 168 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 169 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 170 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 171 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 172 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 173 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 174 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 175 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 176 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 177 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 178 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 179 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 180 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 181 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 182 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 183 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 184 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 185 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 186 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 187 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 188 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 189 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 190 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 191 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 192 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 193 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 194 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 195 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 196 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 197 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 198 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 199 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 200 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 201 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 202 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 203 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 204 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 205 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 206 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 207 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 208 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 209 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 210 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 211 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 212 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 213 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 214 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 215 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 216 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 217 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 218 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 219 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 220 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 221 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 222 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 223 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 224 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 225 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 226 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 227 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 228 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 229 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 230 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 231 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 232 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 233 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 234 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 235 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 236 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 237 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 238 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 239 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 240 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 241 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 242 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 243 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 244 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 245 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 246 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 247 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 248 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 249 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 250 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 251 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 252 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 253 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} }, // ascii 254 { {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0} } // ascii 255 }; CLaserText::CLaserText(CGameWorld *pGameWorld, vec2 Pos, int Owner, int pAliveTicks, char* pText, int pTextLen) : CEntity(pGameWorld, CGameWorld::ENTTYPE_LASER) { m_Pos = Pos; m_Owner = Owner; GameWorld()->InsertEntity(this); m_CurTicks = Server()->Tick(); m_StartTick = Server()->Tick(); m_AliveTicks = pAliveTicks; m_TextLen = pTextLen; m_Text = new char[pTextLen]; memcpy(m_Text, pText, pTextLen); m_CharNum = 0; for(int i = 0; i < m_TextLen; ++i){ for(int n = 0; n < 5; ++n){ for(int j = 0; j < 3; ++j){ if(asciiTable[(unsigned char)m_Text[i]][n][j]){ ++m_CharNum; } } } } m_Chars = new CLaserChar*[m_CharNum]; m_PosOffsetCharPoints = 15.0; m_PosOffsetChars = m_PosOffsetCharPoints * 3.5; int charCount = 0; for(int i = 0; i < m_TextLen; ++i){ makeLaser(m_Text[i], i, charCount); } } CLaserText::CLaserText(CGameWorld *pGameWorld, vec2 Pos, int Owner, int pAliveTicks, char* pText, int pTextLen, float pCharPointOffset, float pCharOffsetFactor) : CEntity(pGameWorld, CGameWorld::ENTTYPE_LASER) { m_Pos = Pos; m_Owner = Owner; GameWorld()->InsertEntity(this); m_CurTicks = Server()->Tick(); m_StartTick = Server()->Tick(); m_AliveTicks = pAliveTicks; m_TextLen = pTextLen; m_Text = new char[pTextLen]; memcpy(m_Text, pText, pTextLen); m_CharNum = 0; for(int i = 0; i < m_TextLen; ++i){ for(int n = 0; n < 5; ++n){ for(int j = 0; j < 3; ++j){ if(asciiTable[(unsigned char)m_Text[i]][n][j]){ ++m_CharNum; } } } } m_Chars = new CLaserChar*[m_CharNum]; m_PosOffsetCharPoints = pCharPointOffset; m_PosOffsetChars = m_PosOffsetCharPoints * pCharOffsetFactor; int charCount = 0; for(int i = 0; i < m_TextLen; ++i){ makeLaser(m_Text[i], i, charCount); } } void CLaserText::Reset() { GameServer()->m_World.DestroyEntity(this); } void CLaserText::Tick() { if(++m_CurTicks - m_StartTick > m_AliveTicks) GameServer()->m_World.DestroyEntity(this); } void CLaserText::TickPaused() { } inline char NeighboursVert(const bool pCharVert[3], int pVertOff){ char neighbours = 0; if(pVertOff > 0){ if(pCharVert[pVertOff - 1]) ++neighbours; } if(pVertOff < 2){ if(pCharVert[pVertOff + 1]) ++neighbours; } return neighbours; } inline char NeighboursHor(const bool pCharHor[5][3], int pHorOff, int pVertOff){ char neighbours = 0; if(pHorOff > 0){ if(pCharHor[pHorOff - 1][pVertOff]) ++neighbours; } if(pHorOff < 4){ if(pCharHor[pHorOff + 1][pVertOff]) ++neighbours; } return neighbours; } void CLaserText::makeLaser(char pChar, int pCharOffset, int& charCount){ unsigned short tail[5][3]; char neighbourCount[5][3]; for(int n = 0; n < 5; ++n){ for(int j = 0; j < 3; ++j){ if(asciiTable[(unsigned char)pChar][n][j]){ neighbourCount[n][j] = 0; neighbourCount[n][j] += NeighboursVert(asciiTable[(unsigned char)pChar][n], j); neighbourCount[n][j] += NeighboursHor(asciiTable[(unsigned char)pChar], n, j); tail[n][j] = 0; } else tail[n][j] = (unsigned short)-1; } } for(int n = 0; n < 5; ++n){ for(int j = 0; j < 3; ++j){ if(asciiTable[(unsigned char)pChar][n][j]){ //additional x, y offset to draw a line int x = j, y = n; int maxNeighbour = 0; //forced line draw bool forceLine = false; if(j > 0){ if(asciiTable[(unsigned char)pChar][n][j - 1]){ if(tail[n][j - 1] != 0){ if(tail[n][j - 1] != (n << 8 | j)){ forceLine = true; tail[n][j] = (n << 8 | (j - 1)); x = j - 1; y = n; } } else if(neighbourCount[n][j - 1] > maxNeighbour){ maxNeighbour = neighbourCount[n][j - 1]; x = j - 1; y = n; } } } if(!forceLine && j < 2){ if(asciiTable[(unsigned char)pChar][n][j + 1]){ if(tail[n][j + 1] != 0){ if(tail[n][j + 1] != (n << 8 | j)){ forceLine = true; tail[n][j] = (n << 8 | (j + 1)); x = j + 1; y = n; } } else if(neighbourCount[n][j + 1] > maxNeighbour){ maxNeighbour = neighbourCount[n][j + 1]; x = j + 1; y = n; } } } if(!forceLine && n > 0){ if(asciiTable[(unsigned char)pChar][n - 1][j]){ if(tail[n - 1][j] != 0){ if(tail[n - 1][j] != (n << 8 | j)){ forceLine = true; tail[n][j] = ((n-1) << 8 | (j)); x = j; y = n - 1; } } else if(neighbourCount[n - 1][j] > maxNeighbour){ maxNeighbour = neighbourCount[n - 1][j]; x = j; y = n - 1; } } } if(!forceLine && n < 4){ if(asciiTable[(unsigned char)pChar][n + 1][j]){ if(tail[n + 1][j] != 0){ if(tail[n + 1][j] != (n << 8 | j)){ forceLine = true; tail[n][j] = ((n+1) << 8 | (j)); x = j; y = n + 1; } } else if(neighbourCount[n + 1][j] > maxNeighbour){ maxNeighbour = neighbourCount[n + 1][j]; x = j; y = n + 1; } } } if(!forceLine){ tail[n][j] = (y << 8 | x); } CLaserChar* pObj = (m_Chars[charCount] = new CLaserChar(GameWorld())); pObj->m_Pos.x = m_Pos.x + pCharOffset * m_PosOffsetChars + j * m_PosOffsetCharPoints; pObj->m_Pos.y = m_Pos.y + n * m_PosOffsetCharPoints; pObj->m_Frompos.x = m_Pos.x + pCharOffset * m_PosOffsetChars + x * m_PosOffsetCharPoints; pObj->m_Frompos.y = m_Pos.y + y * m_PosOffsetCharPoints; ++charCount; } } } } void CLaserText::Snap(int SnappingClient) { if(NetworkClipped(SnappingClient)) return; for(int i = 0; i < m_CharNum; ++i){ CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Chars[i]->getID(), sizeof(CNetObj_Laser))); if(!pObj) return; pObj->m_X = m_Chars[i]->m_Pos.x; pObj->m_Y = m_Chars[i]->m_Pos.y; pObj->m_FromX = m_Chars[i]->m_Frompos.x; pObj->m_FromY = m_Chars[i]->m_Frompos.y; pObj->m_StartTick = Server()->Tick(); } }
43.722772
160
0.417029
6640b9481c688e8262eee4346ecc065e04a29cf6
2,039
py
Python
pygsp/filters/regular.py
jafluri/pygsp
ff8c0023c25df4cbcfd88a7ef63c6223f3030a51
[ "BSD-3-Clause" ]
341
2015-09-07T16:59:41.000Z
2022-03-23T20:27:55.000Z
pygsp/filters/regular.py
jafluri/pygsp
ff8c0023c25df4cbcfd88a7ef63c6223f3030a51
[ "BSD-3-Clause" ]
96
2017-04-16T04:38:57.000Z
2021-11-02T18:36:41.000Z
pygsp/filters/regular.py
jafluri/pygsp
ff8c0023c25df4cbcfd88a7ef63c6223f3030a51
[ "BSD-3-Clause" ]
95
2016-03-25T14:35:28.000Z
2022-02-08T18:54:29.000Z
# -*- coding: utf-8 -*- from __future__ import division import numpy as np from . import Filter # prevent circular import in Python < 3.5 class Regular(Filter): r"""Design 2 filters with the regular construction (tight frame). This function creates a Parseval filter bank of 2 filters. The low-pass filter is defined by a function :math:`f_l(x)` between :math:`0` and :math:`2`. For :math:`d = 0`. .. math:: f_{l}= \sin\left( \frac{\pi}{4} x \right) For :math:`d = 1` .. math:: f_{l}= \sin\left( \frac{\pi}{4} \left( 1+ \sin\left(\frac{\pi}{2}(x-1)\right) \right) \right) For :math:`d = 2` .. math:: f_{l}= \sin\left( \frac{\pi}{4} \left( 1+ \sin\left(\frac{\pi}{2} \sin\left(\frac{\pi}{2}(x-1)\right)\right) \right) \right) And so forth for other degrees :math:`d`. The high pass filter is adapted to obtain a tight frame. Parameters ---------- G : graph degree : float Degree (default = 3). See above equations. Examples -------- Filter bank's representation in Fourier and time (ring graph) domains. >>> import matplotlib.pyplot as plt >>> G = graphs.Ring(N=20) >>> G.estimate_lmax() >>> G.set_coordinates('line1D') >>> g = filters.Regular(G) >>> s = g.localize(G.N // 2) >>> fig, axes = plt.subplots(1, 2) >>> _ = g.plot(ax=axes[0]) >>> _ = G.plot(s, ax=axes[1]) """ def __init__(self, G, degree=3): self.degree = degree def kernel(x, degree): if degree == 0: return np.sin(np.pi / 4 * x) else: output = np.sin(np.pi * (x - 1) / 2) for _ in range(2, degree): output = np.sin(np.pi * output / 2) return np.sin(np.pi / 4 * (1 + output)) regular = Filter(G, lambda x: kernel(x*2/G.lmax, degree)) complement = regular.complement(frame_bound=1) kernels = regular._kernels + complement._kernels super(Regular, self).__init__(G, kernels)
28.319444
138
0.557136
f87df86d6070d1e95ce790ace782db4413c24e7f
81
h
C
build/build.h
Checoinbank/Checoin
436db740a68c1e6218cbaef9433bf7ea4cb433ee
[ "MIT" ]
1
2021-05-21T06:38:41.000Z
2021-05-21T06:38:41.000Z
build/build.h
Checoinbank/Checoin
436db740a68c1e6218cbaef9433bf7ea4cb433ee
[ "MIT" ]
null
null
null
build/build.h
Checoinbank/Checoin
436db740a68c1e6218cbaef9433bf7ea4cb433ee
[ "MIT" ]
null
null
null
// No build information available #define BUILD_DATE "2016-06-28 12:32:36 -0400"
27
46
0.753086
7f8ed8c1c342677395fda0b531f5ee3f8dde08b8
1,088
php
PHP
app/Models/OrderPhoto.php
q133ss/flowers_new
51abdd2469cb9007fd5fce282e295d166bfd2391
[ "MIT" ]
null
null
null
app/Models/OrderPhoto.php
q133ss/flowers_new
51abdd2469cb9007fd5fce282e295d166bfd2391
[ "MIT" ]
null
null
null
app/Models/OrderPhoto.php
q133ss/flowers_new
51abdd2469cb9007fd5fce282e295d166bfd2391
[ "MIT" ]
null
null
null
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model as Model; /** * Class OrderPhoto * @package App\Models * @version December 5, 2021, 6:42 pm UTC * * @property \App\Models\Order $order * @property integer $order_id * @property string $img */ class OrderPhoto extends Model { public $table = 'order_photos'; const CREATED_AT = 'created_at'; const UPDATED_AT = 'updated_at'; public $fillable = [ 'order_id', 'img' ]; /** * The attributes that should be casted to native types. * * @var array */ protected $casts = [ 'id' => 'integer', 'order_id' => 'integer', 'img' => 'string' ]; /** * Validation rules * * @var array */ public static $rules = [ 'order_id' => 'required', 'img' => 'required|string|max:255' ]; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo **/ public function order() { return $this->belongsTo(\App\Models\Order::class, 'order_id'); } }
17
70
0.556985
60c98a08680089f17240c83ae25b0efb3400ded3
334
h
C
GameConnect/Source/BridgedLanguageManager.h
dDomovoj/Gasconade
593597f734da6bd9a08407bc3382cbd9a54f8785
[ "MIT" ]
null
null
null
GameConnect/Source/BridgedLanguageManager.h
dDomovoj/Gasconade
593597f734da6bd9a08407bc3382cbd9a54f8785
[ "MIT" ]
null
null
null
GameConnect/Source/BridgedLanguageManager.h
dDomovoj/Gasconade
593597f734da6bd9a08407bc3382cbd9a54f8785
[ "MIT" ]
null
null
null
// // BridgedLanguageManager.h // PSGOneApp // // Created by Sergey Dikovitsky on 7/18/17. // Copyright © 2017 Netcosports. All rights reserved. // #import <Foundation/Foundation.h> @interface BridgedLanguageManager : NSObject + (NSString *)localizedStringForString:(NSString *)string; + (NSString *)applicationLanguage; @end
19.647059
58
0.739521
c3cc7adaf0c341a352c1d2fafb3985ddcaee7954
1,455
cs
C#
src/D05/Controllers/HomeController.cs
connectashish/AquariumBooking
e6de692a8d68ec3d79d1d6505c4c0c1d612fb443
[ "FSFAP" ]
null
null
null
src/D05/Controllers/HomeController.cs
connectashish/AquariumBooking
e6de692a8d68ec3d79d1d6505c4c0c1d612fb443
[ "FSFAP" ]
null
null
null
src/D05/Controllers/HomeController.cs
connectashish/AquariumBooking
e6de692a8d68ec3d79d1d6505c4c0c1d612fb443
[ "FSFAP" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNet.Mvc; using D05.Models; namespace D05.Controllers { public class HomeController : Controller { private ApplicationDbContext _context; public HomeController(ApplicationDbContext context) { _context = context; } public IActionResult Index() { return View(_context.Events.ToList()); } public IActionResult About() { ViewData["Message"] = "Your application description page."; return View(_context.Events.ToList()); } public IActionResult Contact() { ViewData["Message"] = "Your contact page."; return View(_context.Events.ToList()); } public IActionResult Error() { return View(); } public IActionResult FAQs() { return View(_context.Events.ToList()); } public IActionResult TeamRoles () { return View(_context.Events.ToList()); } public IActionResult Milestone () { return View(_context.Events.ToList()); } public IActionResult RemainingWorkPlan () { return View(_context.Events.ToList()); } } }
23.095238
72
0.536082
07f692948cde1a0dcc131702a1ded0985476e8ff
7,738
css
CSS
css/bootparts-minimized.css
yelluw/bootparts
7e04564704ad9bcb1d6a13cfd33d530fe7d3c420
[ "MIT" ]
16
2017-01-20T10:32:58.000Z
2017-10-27T23:33:33.000Z
css/bootparts-minimized.css
yelluw/Bootparts
7e04564704ad9bcb1d6a13cfd33d530fe7d3c420
[ "MIT" ]
6
2017-01-20T04:47:36.000Z
2017-07-18T22:11:18.000Z
css/bootparts-minimized.css
yelluw/bootparts
7e04564704ad9bcb1d6a13cfd33d530fe7d3c420
[ "MIT" ]
null
null
null
/*Bootparts version 0.6 MIT License Copyright Pablo Rivera Yelluw yelluw.com*/.action-card-outer-container .action-card .action-card-inner .action-card-image img,.image-action-card-outer-container .image-action-card .image-action-card-inner .image-action-card-image img{max-width:100%}.action-card-outer-container{background:#f1f1f1;padding-top:40px;padding-bottom:40px}.action-card{margin:0 auto}.action-card-outer-container .action-card .action-card-inner{width:30%;margin:0 auto;background:#fff;border:solid #14d;padding:10px 10px 25px}.action-card-outer-container .action-card .action-card-inner .action-card-head p{font-size:2em;font-weight:700}.action-card-outer-container .action-card .action-card-inner .action-card-button a,.action-card-outer-container .action-card .action-card-inner .action-card-caption p{font-size:1em}.action-card-outer-container .action-card .action-card-inner .action-card-caption{padding-top:5px}.action-card-outer-container .action-card .action-card-inner .action-card-button{padding-top:10px}@media (max-width:768px){.action-card-outer-container .action-card .action-card-inner .action-card-head p{font-size:1em}.action-card-outer-container .action-card .action-card-inner .action-card-caption p{font-size:.8em}}.call-to-action-bar{background:#f1f1f1;padding-top:10px;padding-bottom:10px}.call-to-action-bar p{font-size:1.4em;font-family:inherit}@media (max-width:768px){.call-to-action-bar p{font-size:1.2em}}.call-to-action-button{background:#f1f1f1;padding-top:15px;padding-bottom:10px}.call-to-action-button a{font-size:1.4em;font-family:inherit}@media (max-width:768px){.call-to-action-button a{font-size:1em}}.center-aligned-headline{background:#000;padding:50px 10px}.center-aligned-headline .headline{color:#fff;font-size:2.3em;font-weight:500;text-align:center}@media (max-width:768px){.center-aligned-headline .headline{font-size:1.6em}}.hero-subscription-form{background:#f1f1f1;padding:50px 10px}.hero-subscription-form .left-top{padding-bottom:20px}.hero-subscription-form .hero-headline{font-size:2.5em;font-weight:700}.hero-subscription-form .hero-text{font-size:1.3em}.hero-subscription-form .right-bottom .form-container{background:#fff;padding:10px 20px;border-radius:10px}.hero-subscription-form .right-bottom .form-container .form-title{font-size:2em}.image-action-card-outer-container{background:#f1f1f1;padding-top:40px;padding-bottom:40px}.image-action-card{margin:0 auto}.image-action-card-outer-container .image-action-card .image-action-card-inner{width:30%;margin:0 auto;background:#fff;border:solid #14d;padding:10px 10px 25px}.image-action-card-outer-container .image-action-card .image-action-card-inner .image-action-card-caption{padding-top:5px}.image-action-card-outer-container .image-action-card .image-action-card-inner .image-action-card-caption p{font-size:.7em}.image-action-card-outer-container .image-action-card .image-action-card-inner .image-action-card-button{padding-top:10px}.image-action-card-outer-container .image-action-card .image-action-card-inner .image-action-card-button a{font-size:1em}@media (max-width:768px){.image-action-card-outer-container .image-action-card .image-action-card-inner{width:50%}.image-action-card-outer-container .image-action-card .image-action-card-inner .image-action-card-caption p{font-size:.6em}}.image-with-text{background:#f1f1f1;padding:10px}.image-with-text p{font-size:1.5em;font-family:inherit}@media (max-width:768px){.image-with-text p{font-size:1em}}.one-column-content{background:#f1f1f1;padding-top:45px;padding-bottom:40px}.one-column-content p{font-size:1.4em;line-height:2em}@media (max-width:768px){.one-column-content p{font-size:1.1em}}.simple-footer{background:#f1f1f1;padding-top:15px;padding-bottom:10px}.simple-footer li{font-size:1em}@media (max-width:768px){.simple-footer li{font-size:.8em}}.text-with-image{background:#f1f1f1;padding:10px}.text-with-image p{font-size:1.5em;font-family:inherit}@media (max-width:768px){.text-with-image p{font-size:1em}}.three-column-content{background:#f1f1f1;padding-top:15px;padding-bottom:30px;text-align:center}.three-column-content .left-column,.three-column-content .middle-column,.three-column-content .right-column{padding-top:20px}.three-column-content .column-title{padding-top:10px;font-size:1.3em;font-weight:700}.three-column-content .column-content{padding-top:10px;font-size:1.1em}@media (max-width:768px){.three-column-content .column-title{font-size:.8em}.three-column-content .column-content{font-size:.7em}.three-column-content .left-column,.three-column-content .middle-column,.three-column-content .right-column{padding-top:15px}}.three-column-footer{background:#f1f1f1;padding-top:15px;padding-bottom:30px}.three-column-footer .left-column,.three-column-footer .middle-column,.three-column-footer .right-column{padding-top:20px}.three-column-footer .left-column .list-title{font-weight:700;font-size:1.1em}.three-column-footer .left-column a{font-size:1.3em}.three-column-footer .middle-column .list-title{font-weight:700;font-size:1.1em}.three-column-footer .middle-column a{font-size:1.3em}.three-column-footer .right-column .form-container{background:#fff;padding:10px 20px}@media (max-width:768px){.three-column-footer .left-column,.three-column-footer .middle-column,.three-column-footer .right-column{padding-top:10px}.three-column-footer .left-column list-title{font-size:.7em}.three-column-footer .right-column .form-container{width:400px}}.two-column-footer .left-column a,.two-column-footer .right-column a{font-size:1.3em}.two-column-footer{background:#f1f1f1;padding-top:15px;padding-bottom:30px}.two-column-footer .left-column,.two-column-footer .right-column{padding-top:20px}.two-column-footer .list-title{font-weight:700;font-size:1.1em}@media (max-width:768px){.two-column-footer list-title{font-size:.7em;padding-top:10px}.two-column-footer .left-column,.two-column-footer .right-column{padding-top:10px}}.hero-brand-two-buttons{background:#f1f1f1;padding-top:50px;padding-bottom:30px}.hero-brand-two-buttons .logo{margin:0 auto;background:#fff;max-width:480px;padding:10px;border:1px solid #ccc;text-align:center;color:#ccc;font-size:5em;font-weight:700}.hero-brand-two-buttons .headline{padding-top:50px;padding-bottom:10px;text-align:center}.hero-brand-two-buttons .headline p{color:#000;font-size:1.8em}.hero-brand-two-buttons .two-buttons{padding-top:10px;padding-bottom:10px;margin:0 auto;text-align:center}.hero-brand-two-buttons .two-buttons a{font-size:1.5em}.hero-brand-two-buttons .caption{padding-top:5px;padding-bottom:5px}.hero-brand-two-buttons .caption p{text-align:center;font-size:1em;color:#ccc}@media (max-width:768px){.hero-brand-two-buttons{padding-left:20px;padding-right:20px}.hero-brand-two-buttons .logo{max-width:220px;font-size:2em}.hero-brand-two-buttons .headline{font-size:1.4em}.hero-brand-two-buttons .two-buttons a{font-size:1em}.hero-brand-two-buttons .caption p{font-size:.8em}}.two-column-content{background:#f1f1f1;padding-top:10px;padding-bottom:10px}.bottom-row,.top-row{padding-bottom:30px}.two-column-content .left-column p{font-size:.9em}.two-column-content .right-column p{font-size:1.3em}@media (max-width:768px){.two-column-content .left-column p{font-size:.7em}.two-column-content .right-column p{font-size:1.1em}}.two-row-squares{background:#f1f1f1}.top-row{padding-top:30px}.hero-background-image{height:600px;width:100%;background:url(../img/bg.jpg) center center no-repeat fixed;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover}.hero-background-image .headline{color:#fff;font-size:3em;padding-top:250px}@media (max-width:768px){.hero-background-image .headline{font-size:2em;padding-top:175px;text-align:center}}
7,738
7,738
0.793874
58a1916e970d5268f5cbf28bb0c96ff1a16d026c
1,295
lua
Lua
MMOCoreORB/bin/scripts/object/custom_content/static/worldbuilding/serverobjects.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
18
2017-02-09T15:36:05.000Z
2021-12-21T04:22:15.000Z
MMOCoreORB/bin/scripts/object/custom_content/static/worldbuilding/serverobjects.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
61
2016-12-30T21:51:10.000Z
2021-12-10T20:25:56.000Z
MMOCoreORB/bin/scripts/object/custom_content/static/worldbuilding/serverobjects.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
71
2017-01-01T05:34:38.000Z
2022-03-29T01:04:00.000Z
--Child Folders includeFile("custom_content/static/worldbuilding/art/serverobjects.lua") includeFile("custom_content/static/worldbuilding/building/serverobjects.lua") includeFile("custom_content/static/worldbuilding/camping/serverobjects.lua") includeFile("custom_content/static/worldbuilding/decal/serverobjects.lua") includeFile("custom_content/static/worldbuilding/furniture/serverobjects.lua") includeFile("custom_content/static/worldbuilding/furniture/cheap/serverobjects.lua") includeFile("custom_content/static/worldbuilding/mechanical/serverobjects.lua") includeFile("custom_content/static/worldbuilding/mechanical/ship_parts/serverobjects.lua") includeFile("custom_content/static/worldbuilding/organic/serverobjects.lua") includeFile("custom_content/static/worldbuilding/sign/serverobjects.lua") includeFile("custom_content/static/worldbuilding/structures/serverobjects.lua") includeFile("custom_content/static/worldbuilding/terminal/serverobjects.lua") includeFile("custom_content/static/worldbuilding/vegitation/serverobjects.lua") includeFile("custom_content/static/worldbuilding/vehicles/serverobjects.lua") -- Server Objects includeFile("custom_content/static/worldbuilding/battle_droid_powerdown.lua") includeFile("custom_content/static/worldbuilding/battle_droid_static.lua")
58.863636
90
0.867181
b053b7e26c23de7b1065b90c154b234c85c386b8
657
py
Python
pyfftlog/__init__.py
ShazAlvi/pyfftlog
6e99cc3d708f106d8fe0b3fdfc02c6c5c4f74b24
[ "CC0-1.0" ]
14
2018-08-22T17:14:18.000Z
2021-12-30T07:05:30.000Z
pyfftlog/__init__.py
ShazAlvi/pyfftlog
6e99cc3d708f106d8fe0b3fdfc02c6c5c4f74b24
[ "CC0-1.0" ]
12
2019-08-16T18:44:35.000Z
2021-06-28T21:57:13.000Z
pyfftlog/__init__.py
ShazAlvi/pyfftlog
6e99cc3d708f106d8fe0b3fdfc02c6c5c4f74b24
[ "CC0-1.0" ]
9
2017-08-24T12:51:14.000Z
2022-03-30T13:51:46.000Z
from datetime import datetime from pyfftlog.pyfftlog import fhti, fftl, fht, fhtq, krgood __all__ = ['fhti', 'fftl', 'fht', 'fhtq', 'krgood'] # Version try: # - Released versions just tags: 1.10.0 # - GitHub commits add .dev#+hash: 1.10.1.dev3+g973038c # - Uncommitted changes add timestamp: 1.10.1.dev3+g973038c.d20191022 from .version import version as __version__ except ImportError: # If it was not installed, then we don't know the version. We could throw a # warning here, but this case *should* be rare. pyfftlog should be # installed properly! __version__ = 'unknown-'+datetime.today().strftime('%Y%m%d')
38.647059
79
0.687976
795cf4e3d86688d690ae4da1dfe214d59273426b
3,020
php
PHP
src/Lib/ProductType.php
bPolNet/a-vendor-api
ffe8ec2611d34e56e729dde587d3cc824117ec6c
[ "MIT" ]
null
null
null
src/Lib/ProductType.php
bPolNet/a-vendor-api
ffe8ec2611d34e56e729dde587d3cc824117ec6c
[ "MIT" ]
null
null
null
src/Lib/ProductType.php
bPolNet/a-vendor-api
ffe8ec2611d34e56e729dde587d3cc824117ec6c
[ "MIT" ]
null
null
null
<?php namespace BPolNet\A\VendorApi\Lib; class ProductType { /** * @var string $ExternalItemId */ protected $ExternalItemId = null; /** * @var string $CategoryName */ protected $CategoryName = null; /** * @var string $Name */ protected $Name = null; /** * @var string $Description */ protected $Description = null; /** * @var ParameterType[] $Parameter */ protected $Parameter = null; /** * @var ImageType[] $Image */ protected $Image = null; /** * @param string $ExternalItemId * @param string $CategoryName * @param string $Name * @param string $Description */ public function __construct($ExternalItemId, $CategoryName, $Name, $Description) { $this->ExternalItemId = $ExternalItemId; $this->CategoryName = $CategoryName; $this->Name = $Name; $this->Description = $Description; } /** * @return string */ public function getExternalItemId() { return $this->ExternalItemId; } /** * @param string $ExternalItemId * @return \BPolNet\A\VendorApi\Lib\ProductType */ public function setExternalItemId($ExternalItemId) { $this->ExternalItemId = $ExternalItemId; return $this; } /** * @return string */ public function getCategoryName() { return $this->CategoryName; } /** * @param string $CategoryName * @return \BPolNet\A\VendorApi\Lib\ProductType */ public function setCategoryName($CategoryName) { $this->CategoryName = $CategoryName; return $this; } /** * @return string */ public function getName() { return $this->Name; } /** * @param string $Name * @return \BPolNet\A\VendorApi\Lib\ProductType */ public function setName($Name) { $this->Name = $Name; return $this; } /** * @return string */ public function getDescription() { return $this->Description; } /** * @param string $Description * @return \BPolNet\A\VendorApi\Lib\ProductType */ public function setDescription($Description) { $this->Description = $Description; return $this; } /** * @return ParameterType[] */ public function getParameter() { return $this->Parameter; } /** * @param ParameterType[] $Parameter * @return \BPolNet\A\VendorApi\Lib\ProductType */ public function setParameter(array $Parameter = null) { $this->Parameter = $Parameter; return $this; } /** * @return ImageType[] */ public function getImage() { return $this->Image; } /** * @param ImageType[] $Image * @return \BPolNet\A\VendorApi\Lib\ProductType */ public function setImage(array $Image = null) { $this->Image = $Image; return $this; } }
18.757764
84
0.556291
e2fec6055131e105ba05e4edef03713c9709fa69
13,463
py
Python
gui_main.py
flowluap/PyDebloatX
8dc7ab8e494ac9b132bf335510675af75310e9d2
[ "MIT" ]
null
null
null
gui_main.py
flowluap/PyDebloatX
8dc7ab8e494ac9b132bf335510675af75310e9d2
[ "MIT" ]
null
null
null
gui_main.py
flowluap/PyDebloatX
8dc7ab8e494ac9b132bf335510675af75310e9d2
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from PyQt5.QtCore import QRect, QCoreApplication, QMetaObject from PyQt5.QtWidgets import QPushButton, QMainWindow, QWidget, QLabel, QVBoxLayout, QCheckBox, QAction, QMenuBar, QMenu, QHBoxLayout, QProgressBar from PyQt5.QtGui import QIcon class Ui_MainWindow(QMainWindow): def __init__(self): super(Ui_MainWindow, self).__init__() self.setWindowIcon(QIcon('icon.ico')) self.setFixedSize(481, 447) def setupUi(self): self.centralwidget = QWidget(self) self.label_info = QLabel(self.centralwidget) self.label_info.setGeometry(QRect(20, 20, 415, 20)) self.verticalLayoutWidget = QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QRect(20, 50, 121, 271)) self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.checkBox = QCheckBox(self.verticalLayoutWidget) self.verticalLayout.addWidget(self.checkBox) self.checkBox_2 = QCheckBox(self.verticalLayoutWidget) self.verticalLayout.addWidget(self.checkBox_2) self.checkBox_3 = QCheckBox(self.verticalLayoutWidget) self.verticalLayout.addWidget(self.checkBox_3) self.checkBox_4 = QCheckBox(self.verticalLayoutWidget) self.verticalLayout.addWidget(self.checkBox_4) self.checkBox_5 = QCheckBox(self.verticalLayoutWidget) self.verticalLayout.addWidget(self.checkBox_5) self.checkBox_6 = QCheckBox(self.verticalLayoutWidget) self.verticalLayout.addWidget(self.checkBox_6) self.checkBox_7 = QCheckBox(self.verticalLayoutWidget) self.verticalLayout.addWidget(self.checkBox_7) self.checkBox_8 = QCheckBox(self.verticalLayoutWidget) self.verticalLayout.addWidget(self.checkBox_8) self.checkBox_9 = QCheckBox(self.verticalLayoutWidget) self.verticalLayout.addWidget(self.checkBox_9) self.verticalLayoutWidget_2 = QWidget(self.centralwidget) self.verticalLayoutWidget_2.setGeometry(QRect(170, 50, 131, 271)) self.verticalLayout_2 = QVBoxLayout(self.verticalLayoutWidget_2) self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.checkBox_10 = QCheckBox(self.verticalLayoutWidget_2) self.verticalLayout_2.addWidget(self.checkBox_10) self.checkBox_11 = QCheckBox(self.verticalLayoutWidget_2) self.verticalLayout_2.addWidget(self.checkBox_11) self.checkBox_12 = QCheckBox(self.verticalLayoutWidget_2) self.verticalLayout_2.addWidget(self.checkBox_12) self.checkBox_13 = QCheckBox(self.verticalLayoutWidget_2) self.verticalLayout_2.addWidget(self.checkBox_13) self.checkBox_14 = QCheckBox(self.verticalLayoutWidget_2) self.verticalLayout_2.addWidget(self.checkBox_14) self.checkBox_15 = QCheckBox(self.verticalLayoutWidget_2) self.verticalLayout_2.addWidget(self.checkBox_15) self.checkBox_16 = QCheckBox(self.verticalLayoutWidget_2) self.verticalLayout_2.addWidget(self.checkBox_16) self.checkBox_17 = QCheckBox(self.verticalLayoutWidget_2) self.verticalLayout_2.addWidget(self.checkBox_17) self.checkBox_18 = QCheckBox(self.verticalLayoutWidget_2) self.verticalLayout_2.addWidget(self.checkBox_18) self.verticalLayoutWidget_3 = QWidget(self.centralwidget) self.verticalLayoutWidget_3.setGeometry(QRect(330, 50, 131, 271)) self.verticalLayout_3 = QVBoxLayout(self.verticalLayoutWidget_3) self.verticalLayout_3.setContentsMargins(0, 0, 0, 0) self.checkBox_19 = QCheckBox(self.verticalLayoutWidget_3) self.verticalLayout_3.addWidget(self.checkBox_19) self.checkBox_20 = QCheckBox(self.verticalLayoutWidget_3) self.verticalLayout_3.addWidget(self.checkBox_20) self.checkBox_21 = QCheckBox(self.verticalLayoutWidget_3) self.verticalLayout_3.addWidget(self.checkBox_21) self.checkBox_22 = QCheckBox(self.verticalLayoutWidget_3) self.verticalLayout_3.addWidget(self.checkBox_22) self.checkBox_23 = QCheckBox(self.verticalLayoutWidget_3) self.verticalLayout_3.addWidget(self.checkBox_23) self.checkBox_24 = QCheckBox(self.verticalLayoutWidget_3) self.verticalLayout_3.addWidget(self.checkBox_24) self.checkBox_25 = QCheckBox(self.verticalLayoutWidget_3) self.verticalLayout_3.addWidget(self.checkBox_25) self.checkBox_26 = QCheckBox(self.verticalLayoutWidget_3) self.verticalLayout_3.addWidget(self.checkBox_26) self.checkBox_27 = QCheckBox(self.verticalLayoutWidget_3) self.verticalLayout_3.addWidget(self.checkBox_27) self.label_note = QLabel(self.centralwidget) self.label_note.setGeometry(QRect(20, 330, 350, 16)) self.label_space = QLabel(self.centralwidget) self.label_space.setGeometry(QRect(20, 350, 350, 16)) self.label_size = QLabel(self.centralwidget) self.label_size.setGeometry(QRect(200, 350, 350, 16)) self.horizontalLayoutWidget = QWidget(self.centralwidget) self.horizontalLayoutWidget.setGeometry(QRect(379, 380, 81, 31)) self.horizontalLayout = QHBoxLayout(self.horizontalLayoutWidget) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.button_uninstall = QPushButton(self.horizontalLayoutWidget) self.horizontalLayout.addWidget(self.button_uninstall) self.progressbar = QProgressBar(self.centralwidget) self.progressbar.setGeometry(QRect(20, 40, 175, 10)) self.progressbar.hide() self.horizontalLayoutWidget_2 = QWidget(self.centralwidget) self.horizontalLayoutWidget_2.setGeometry(QRect(20, 380, 160, 31)) self.horizontalLayout_2 = QHBoxLayout(self.horizontalLayoutWidget_2) self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0) self.button_select_all = QPushButton(self.horizontalLayoutWidget_2) self.horizontalLayout_2.addWidget(self.button_select_all) self.button_deselect_all = QPushButton(self.horizontalLayoutWidget_2) self.horizontalLayout_2.addWidget(self.button_deselect_all) self.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(self) self.menubar.setGeometry(QRect(0, 0, 481, 21)) self.menuHelp = QMenu(self.menubar) self.setMenuBar(self.menubar) self.actionRefresh = QAction(self) self.actionHomepage = QAction(self) self.actionAbout = QAction(self) self.actionQuit = QAction(self) self.menuHelp.addAction(self.actionRefresh) self.menuHelp.addAction(self.actionHomepage) self.menuHelp.addAction(self.actionAbout) self.menuHelp.addSeparator() self.menuHelp.addAction(self.actionQuit) self.menubar.addAction(self.menuHelp.menuAction()) self.retranslateUi() QMetaObject.connectSlotsByName(self) def retranslateUi(self): _translate = QCoreApplication.translate self.setWindowTitle(_translate("MainWindow", "PyDebloatX")) self.menuHelp.setTitle(_translate("MainWindow", "&Help")) self.actionRefresh.setText(_translate("MainWindow", "&Refresh")) self.actionRefresh.setShortcut(_translate("MainWindow", "Ctrl+R")) self.actionHomepage.setText(_translate("MainWindow", "&Github")) self.actionHomepage.setShortcut(_translate("MainWindow", "Ctrl+G")) self.actionAbout.setText(_translate("MainWindow", "&About")) self.actionAbout.setShortcut(_translate("MainWindow", "Ctrl+A")) self.actionQuit.setText(_translate("MainWindow", "&Quit")) self.actionQuit.setShortcut(_translate("MainWindow", "Ctrl+Q")) self.label_info.setText(_translate("MainWindow", "Updating list of installed apps...")) self.checkBox.setText(_translate("MainWindow", "3D Builder")) self.checkBox_2.setText(_translate("MainWindow", "3D Viewer")) self.checkBox_3.setText(_translate("MainWindow", "Alarms and Clock")) self.checkBox_4.setText(_translate("MainWindow", "Calculator")) self.checkBox_5.setText(_translate("MainWindow", "Calendar and Mail")) self.checkBox_6.setText(_translate("MainWindow", "Camera")) self.checkBox_7.setText(_translate("MainWindow", "Get Help")) self.checkBox_8.setText(_translate("MainWindow", "Groove Music")) self.checkBox_9.setText(_translate("MainWindow", "Maps")) self.checkBox_10.setText(_translate("MainWindow", "Messaging")) self.checkBox_11.setText(_translate("MainWindow", "Money")) self.checkBox_12.setText(_translate("MainWindow", "Movies && TV")) self.checkBox_13.setText(_translate("MainWindow", "News")) self.checkBox_14.setText(_translate("MainWindow", "Office")) self.checkBox_15.setText(_translate("MainWindow", "OneNote")) self.checkBox_16.setText(_translate("MainWindow", "Paint 3D")) self.checkBox_17.setText(_translate("MainWindow", "People")) self.checkBox_18.setText(_translate("MainWindow", "Photos")) self.checkBox_19.setText(_translate("MainWindow", "Skype")) self.checkBox_20.setText(_translate("MainWindow", "Solitaire")) self.checkBox_21.setText(_translate("MainWindow", "Sports")) self.checkBox_22.setText(_translate("MainWindow", "Tips")) self.checkBox_23.setText(_translate("MainWindow", "Voice Recorder")) self.checkBox_24.setText(_translate("MainWindow", "Weather")) self.checkBox_25.setText(_translate("MainWindow", "Windows Feedback")) self.checkBox_26.setText(_translate("MainWindow", "Xbox")) self.checkBox_27.setText(_translate("MainWindow", "Your Phone")) self.label_note.setText(_translate("MainWindow", "NOTE: Microsoft Edge and Cortana cannot be uninstalled using this GUI.")) self.label_space.setText(_translate("MainWindow", "Total amount of disk space you gain:")) self.label_size.setText(_translate("MainWindow", "0 MB")) self.button_select_all.setText(_translate("MainWindow", "Select All")) self.button_deselect_all.setText(_translate("MainWindow", "Deselect All")) self.button_uninstall.setText(_translate("MainWindow", "Uninstall")) self.checkBox.setToolTip('View, create, and personalize 3D objects.') self.checkBox_2.setToolTip('View 3D models and animations in real-time.') self.checkBox_3.setToolTip('A combination of alarm clock, world clock, timer, and stopwatch.') self.checkBox_4.setToolTip('A calculator that includes standard, scientific, and programmer modes, as well as a unit converter.') self.checkBox_5.setToolTip('Stay up to date with email and schedule managing.') self.checkBox_6.setToolTip('Point and shoot to take pictures on Windows 10.') self.checkBox_7.setToolTip('Provide a way to ask a question and get recommended solutions or contact assisted support.') self.checkBox_8.setToolTip('Listen to music on Windows, iOS, and Android devices.') self.checkBox_9.setToolTip('Search for places to get directions, business info, and reviews.') self.checkBox_10.setToolTip('Quick, reliable SMS, MMS and RCS messaging from your phone.') self.checkBox_11.setToolTip('Finance calculators, currency exchange rates and commodity prices from around the world.') self.checkBox_12.setToolTip('All your movies and TV shows, all in one place, on all your devices.') self.checkBox_13.setToolTip('Deliver breaking news and trusted, in-depth reporting from the world\'s best journalists.') self.checkBox_14.setToolTip('Find all your Office apps and files in one place.') self.checkBox_15.setToolTip('Digital notebook for capturing and organizing everything across your devices.') self.checkBox_16.setToolTip('Make 2D masterpieces or 3D models that you can play with from all angles.') self.checkBox_17.setToolTip('Connect with all your friends, family, colleagues, and acquaintances in one place.') self.checkBox_18.setToolTip('View and edit your photos and videos, make movies, and create albums.') self.checkBox_19.setToolTip('Instant message, voice or video call application.') self.checkBox_20.setToolTip('Solitaire is one of the most played computer card games of all time.') self.checkBox_21.setToolTip('Live scores and in-depth game experiences for more than 150 leagues.') self.checkBox_22.setToolTip('Provide users with information and tips about operating system features.') self.checkBox_23.setToolTip('Record sounds, lectures, interviews, and other events.') self.checkBox_24.setToolTip('Latest weather conditions, accurate 10-day and hourly forecasts.') self.checkBox_25.setToolTip('Provide feedback about Windows and apps by sharing suggestions or problems.') self.checkBox_26.setToolTip('Browse the catalogue, view recommendations, and discover PC games with Xbox Game Pass.') self.checkBox_27.setToolTip('Link your Android phone and PC to view and reply to text messages, access mobile apps, and receive notifications.')
64.109524
153
0.717225
8c5cb67243bca25dfb38cd31f1f886b1d08ec35a
1,191
lua
Lua
test/packTest.lua
youxinweizhi/LuatOS-ESP32
a41f1703b04de823afb94a360a5cf9e77e80bf48
[ "Apache-2.0" ]
null
null
null
test/packTest.lua
youxinweizhi/LuatOS-ESP32
a41f1703b04de823afb94a360a5cf9e77e80bf48
[ "Apache-2.0" ]
null
null
null
test/packTest.lua
youxinweizhi/LuatOS-ESP32
a41f1703b04de823afb94a360a5cf9e77e80bf48
[ "Apache-2.0" ]
null
null
null
local packTest = {} local tag = "packTest" function packTest.test() if pack == nil then log.error(tag, "this fireware is not support pack") return end log.info(tag, "START") local data = pack.pack(">fdncbhHiIlLzpPaA", 3.5, 3.5, 3.5, 1, 2, 3, 4, 100, 100, 100, 100, "中国", "中国", "中国", "中国", "ABCD") local _, res1, res2, res3, res4, res5, res6, res7, res8, res9, res10, res11, res12, res13, res14, res15, res16, res17, res18, res19 = pack.unpack( data, ">fdncbhHiIlLzpPaAAAA") local resTable = { res1, res2, res3, res4, res5, res6, res7, res8, res9, res10, res11, res12, res13, res14, res15, res16, res17, res18, res19 } local assertTable = { 3.500000, 3.500000, 3.500000, 1, 2, 3, 4, 100, 100, 100, 100, "中国", "中国", "中国", "中国", "A", "B", "C", "D" } for k, v in pairs(resTable) do assert(v == assertTable[k], tag .. ".unpack ERROR") end log.info(tag, "DONE") end return packTest
34.028571
94
0.478589
03539ef79d7b39be131c21fdddcdf1af03e65e52
21,167
cc
C++
src/cpu/cpu.cc
bit-hack/gbemu
2205a20f76aa2226ac287976c05c231dddecd44a
[ "BSD-3-Clause" ]
null
null
null
src/cpu/cpu.cc
bit-hack/gbemu
2205a20f76aa2226ac287976c05c231dddecd44a
[ "BSD-3-Clause" ]
null
null
null
src/cpu/cpu.cc
bit-hack/gbemu
2205a20f76aa2226ac287976c05c231dddecd44a
[ "BSD-3-Clause" ]
null
null
null
#include "cpu.h" #include "opcode_cycles.h" #include "opcode_names.h" #include "../util/bitwise.h" #include "../util/log.h" using bitwise::compose_bytes; CPU::CPU(MMU& inMMU, Options& inOptions) : mmu(inMMU), options(inOptions), af(a, f), bc(b, c), de(d, e), hl(h, l) { } Cycles CPU::tick() { handle_interrupts(); if (halted) { return 1; } u16 opcode_pc = pc.value(); auto opcode = get_byte_from_pc(); auto cycles = execute_opcode(opcode, opcode_pc); return cycles; } Cycles CPU::execute_opcode(const u8 opcode, u16 opcode_pc) { branch_taken = false; if (opcode == 0xCB) { u8 cb_opcode = get_byte_from_pc(); return execute_cb_opcode(cb_opcode, opcode_pc); } return execute_normal_opcode(opcode, opcode_pc); } void CPU::handle_interrupts() { if (interrupts_enabled) { u8 fired_interrupts = interrupt_flag.value() & interrupt_enabled.value(); if (!fired_interrupts) { return; } halted = false; stack_push(pc); bool handled_interrupt = false; handled_interrupt = handle_interrupt(0, interrupts::vblank, fired_interrupts); if (handled_interrupt) { return; } handled_interrupt = handle_interrupt(1, interrupts::lcdc_status, fired_interrupts); if (handled_interrupt) { return; } handled_interrupt = handle_interrupt(2, interrupts::timer, fired_interrupts); if (handled_interrupt) { return; } handled_interrupt = handle_interrupt(3, interrupts::serial, fired_interrupts); if (handled_interrupt) { return; } handled_interrupt = handle_interrupt(4, interrupts::joypad, fired_interrupts); if (handled_interrupt) { return; } } } bool CPU::handle_interrupt(u8 interrupt_bit, u16 interrupt_vector, u8 fired_interrupts) { using bitwise::check_bit; if (!check_bit(fired_interrupts, interrupt_bit)) { return false; } interrupt_flag.set_bit_to(interrupt_bit, false); pc.set(interrupt_vector); interrupts_enabled = false; return true; } u8 CPU::get_byte_from_pc() { u8 byte = mmu.read(Address(pc)); pc.increment(); return byte; } s8 CPU::get_signed_byte_from_pc() { u8 byte = get_byte_from_pc(); return static_cast<s8>(byte); } u16 CPU::get_word_from_pc() { u8 low_byte = get_byte_from_pc(); u8 high_byte = get_byte_from_pc(); return compose_bytes(high_byte, low_byte); } void CPU::set_flag_zero(bool set) { f.set_flag_zero(set); } void CPU::set_flag_subtract(bool set) { f.set_flag_subtract(set); } void CPU::set_flag_half_carry(bool set) { f.set_flag_half_carry(set); } void CPU::set_flag_carry(bool set) { f.set_flag_carry(set); } bool CPU::is_condition(Condition condition) { bool should_branch; switch (condition) { case Condition::C: should_branch = f.flag_carry(); break; case Condition::NC: should_branch = !f.flag_carry(); break; case Condition::Z: should_branch = f.flag_zero(); break; case Condition::NZ: should_branch = !f.flag_zero(); break; } /* If the branch is taken, remember so that the correct processor cycles * can be used */ branch_taken = should_branch; return should_branch; } void CPU::stack_push(const WordValue& reg) { sp.decrement(); mmu.write(Address(sp), reg.high()); sp.decrement(); mmu.write(Address(sp), reg.low()); } void CPU::stack_pop(WordValue& reg) { u8 low_byte = mmu.read(Address(sp)); sp.increment(); u8 high_byte = mmu.read(Address(sp)); sp.increment(); u16 value = compose_bytes(high_byte, low_byte); reg.set(value); } /* clang-format off */ Cycles CPU::execute_normal_opcode(const u8 opcode, u16 opcode_pc) { log_trace("0x%04X: %s (0x%x)", opcode_pc, opcode_names[opcode].c_str(), opcode); switch (opcode) { case 0x00: opcode_00(); break; case 0x01: opcode_01(); break; case 0x02: opcode_02(); break; case 0x03: opcode_03(); break; case 0x04: opcode_04(); break; case 0x05: opcode_05(); break; case 0x06: opcode_06(); break; case 0x07: opcode_07(); break; case 0x08: opcode_08(); break; case 0x09: opcode_09(); break; case 0x0A: opcode_0A(); break; case 0x0B: opcode_0B(); break; case 0x0C: opcode_0C(); break; case 0x0D: opcode_0D(); break; case 0x0E: opcode_0E(); break; case 0x0F: opcode_0F(); break; case 0x10: opcode_10(); break; case 0x11: opcode_11(); break; case 0x12: opcode_12(); break; case 0x13: opcode_13(); break; case 0x14: opcode_14(); break; case 0x15: opcode_15(); break; case 0x16: opcode_16(); break; case 0x17: opcode_17(); break; case 0x18: opcode_18(); break; case 0x19: opcode_19(); break; case 0x1A: opcode_1A(); break; case 0x1B: opcode_1B(); break; case 0x1C: opcode_1C(); break; case 0x1D: opcode_1D(); break; case 0x1E: opcode_1E(); break; case 0x1F: opcode_1F(); break; case 0x20: opcode_20(); break; case 0x21: opcode_21(); break; case 0x22: opcode_22(); break; case 0x23: opcode_23(); break; case 0x24: opcode_24(); break; case 0x25: opcode_25(); break; case 0x26: opcode_26(); break; case 0x27: opcode_27(); break; case 0x28: opcode_28(); break; case 0x29: opcode_29(); break; case 0x2A: opcode_2A(); break; case 0x2B: opcode_2B(); break; case 0x2C: opcode_2C(); break; case 0x2D: opcode_2D(); break; case 0x2E: opcode_2E(); break; case 0x2F: opcode_2F(); break; case 0x30: opcode_30(); break; case 0x31: opcode_31(); break; case 0x32: opcode_32(); break; case 0x33: opcode_33(); break; case 0x34: opcode_34(); break; case 0x35: opcode_35(); break; case 0x36: opcode_36(); break; case 0x37: opcode_37(); break; case 0x38: opcode_38(); break; case 0x39: opcode_39(); break; case 0x3A: opcode_3A(); break; case 0x3B: opcode_3B(); break; case 0x3C: opcode_3C(); break; case 0x3D: opcode_3D(); break; case 0x3E: opcode_3E(); break; case 0x3F: opcode_3F(); break; case 0x40: opcode_40(); break; case 0x41: opcode_41(); break; case 0x42: opcode_42(); break; case 0x43: opcode_43(); break; case 0x44: opcode_44(); break; case 0x45: opcode_45(); break; case 0x46: opcode_46(); break; case 0x47: opcode_47(); break; case 0x48: opcode_48(); break; case 0x49: opcode_49(); break; case 0x4A: opcode_4A(); break; case 0x4B: opcode_4B(); break; case 0x4C: opcode_4C(); break; case 0x4D: opcode_4D(); break; case 0x4E: opcode_4E(); break; case 0x4F: opcode_4F(); break; case 0x50: opcode_50(); break; case 0x51: opcode_51(); break; case 0x52: opcode_52(); break; case 0x53: opcode_53(); break; case 0x54: opcode_54(); break; case 0x55: opcode_55(); break; case 0x56: opcode_56(); break; case 0x57: opcode_57(); break; case 0x58: opcode_58(); break; case 0x59: opcode_59(); break; case 0x5A: opcode_5A(); break; case 0x5B: opcode_5B(); break; case 0x5C: opcode_5C(); break; case 0x5D: opcode_5D(); break; case 0x5E: opcode_5E(); break; case 0x5F: opcode_5F(); break; case 0x60: opcode_60(); break; case 0x61: opcode_61(); break; case 0x62: opcode_62(); break; case 0x63: opcode_63(); break; case 0x64: opcode_64(); break; case 0x65: opcode_65(); break; case 0x66: opcode_66(); break; case 0x67: opcode_67(); break; case 0x68: opcode_68(); break; case 0x69: opcode_69(); break; case 0x6A: opcode_6A(); break; case 0x6B: opcode_6B(); break; case 0x6C: opcode_6C(); break; case 0x6D: opcode_6D(); break; case 0x6E: opcode_6E(); break; case 0x6F: opcode_6F(); break; case 0x70: opcode_70(); break; case 0x71: opcode_71(); break; case 0x72: opcode_72(); break; case 0x73: opcode_73(); break; case 0x74: opcode_74(); break; case 0x75: opcode_75(); break; case 0x76: opcode_76(); break; case 0x77: opcode_77(); break; case 0x78: opcode_78(); break; case 0x79: opcode_79(); break; case 0x7A: opcode_7A(); break; case 0x7B: opcode_7B(); break; case 0x7C: opcode_7C(); break; case 0x7D: opcode_7D(); break; case 0x7E: opcode_7E(); break; case 0x7F: opcode_7F(); break; case 0x80: opcode_80(); break; case 0x81: opcode_81(); break; case 0x82: opcode_82(); break; case 0x83: opcode_83(); break; case 0x84: opcode_84(); break; case 0x85: opcode_85(); break; case 0x86: opcode_86(); break; case 0x87: opcode_87(); break; case 0x88: opcode_88(); break; case 0x89: opcode_89(); break; case 0x8A: opcode_8A(); break; case 0x8B: opcode_8B(); break; case 0x8C: opcode_8C(); break; case 0x8D: opcode_8D(); break; case 0x8E: opcode_8E(); break; case 0x8F: opcode_8F(); break; case 0x90: opcode_90(); break; case 0x91: opcode_91(); break; case 0x92: opcode_92(); break; case 0x93: opcode_93(); break; case 0x94: opcode_94(); break; case 0x95: opcode_95(); break; case 0x96: opcode_96(); break; case 0x97: opcode_97(); break; case 0x98: opcode_98(); break; case 0x99: opcode_99(); break; case 0x9A: opcode_9A(); break; case 0x9B: opcode_9B(); break; case 0x9C: opcode_9C(); break; case 0x9D: opcode_9D(); break; case 0x9E: opcode_9E(); break; case 0x9F: opcode_9F(); break; case 0xA0: opcode_A0(); break; case 0xA1: opcode_A1(); break; case 0xA2: opcode_A2(); break; case 0xA3: opcode_A3(); break; case 0xA4: opcode_A4(); break; case 0xA5: opcode_A5(); break; case 0xA6: opcode_A6(); break; case 0xA7: opcode_A7(); break; case 0xA8: opcode_A8(); break; case 0xA9: opcode_A9(); break; case 0xAA: opcode_AA(); break; case 0xAB: opcode_AB(); break; case 0xAC: opcode_AC(); break; case 0xAD: opcode_AD(); break; case 0xAE: opcode_AE(); break; case 0xAF: opcode_AF(); break; case 0xB0: opcode_B0(); break; case 0xB1: opcode_B1(); break; case 0xB2: opcode_B2(); break; case 0xB3: opcode_B3(); break; case 0xB4: opcode_B4(); break; case 0xB5: opcode_B5(); break; case 0xB6: opcode_B6(); break; case 0xB7: opcode_B7(); break; case 0xB8: opcode_B8(); break; case 0xB9: opcode_B9(); break; case 0xBA: opcode_BA(); break; case 0xBB: opcode_BB(); break; case 0xBC: opcode_BC(); break; case 0xBD: opcode_BD(); break; case 0xBE: opcode_BE(); break; case 0xBF: opcode_BF(); break; case 0xC0: opcode_C0(); break; case 0xC1: opcode_C1(); break; case 0xC2: opcode_C2(); break; case 0xC3: opcode_C3(); break; case 0xC4: opcode_C4(); break; case 0xC5: opcode_C5(); break; case 0xC6: opcode_C6(); break; case 0xC7: opcode_C7(); break; case 0xC8: opcode_C8(); break; case 0xC9: opcode_C9(); break; case 0xCA: opcode_CA(); break; case 0xCB: opcode_CB(); break; case 0xCC: opcode_CC(); break; case 0xCD: opcode_CD(); break; case 0xCE: opcode_CE(); break; case 0xCF: opcode_CF(); break; case 0xD0: opcode_D0(); break; case 0xD1: opcode_D1(); break; case 0xD2: opcode_D2(); break; case 0xD3: opcode_D3(); break; case 0xD4: opcode_D4(); break; case 0xD5: opcode_D5(); break; case 0xD6: opcode_D6(); break; case 0xD7: opcode_D7(); break; case 0xD8: opcode_D8(); break; case 0xD9: opcode_D9(); break; case 0xDA: opcode_DA(); break; case 0xDB: opcode_DB(); break; case 0xDC: opcode_DC(); break; case 0xDD: opcode_DD(); break; case 0xDE: opcode_DE(); break; case 0xDF: opcode_DF(); break; case 0xE0: opcode_E0(); break; case 0xE1: opcode_E1(); break; case 0xE2: opcode_E2(); break; case 0xE3: opcode_E3(); break; case 0xE4: opcode_E4(); break; case 0xE5: opcode_E5(); break; case 0xE6: opcode_E6(); break; case 0xE7: opcode_E7(); break; case 0xE8: opcode_E8(); break; case 0xE9: opcode_E9(); break; case 0xEA: opcode_EA(); break; case 0xEB: opcode_EB(); break; case 0xEC: opcode_EC(); break; case 0xED: opcode_ED(); break; case 0xEE: opcode_EE(); break; case 0xEF: opcode_EF(); break; case 0xF0: opcode_F0(); break; case 0xF1: opcode_F1(); break; case 0xF2: opcode_F2(); break; case 0xF3: opcode_F3(); break; case 0xF4: opcode_F4(); break; case 0xF5: opcode_F5(); break; case 0xF6: opcode_F6(); break; case 0xF7: opcode_F7(); break; case 0xF8: opcode_F8(); break; case 0xF9: opcode_F9(); break; case 0xFA: opcode_FA(); break; case 0xFB: opcode_FB(); break; case 0xFC: opcode_FC(); break; case 0xFD: opcode_FD(); break; case 0xFE: opcode_FE(); break; case 0xFF: opcode_FF(); break; } return !branch_taken ? opcode_cycles[opcode] : opcode_cycles_branched[opcode]; } Cycles CPU::execute_cb_opcode(const u8 opcode, u16 opcode_pc) { log_trace("0x%04X: %s (CB 0x%x)", opcode_pc, opcode_cb_names[opcode].c_str(), opcode); switch (opcode) { case 0x00: opcode_CB_00(); break; case 0x01: opcode_CB_01(); break; case 0x02: opcode_CB_02(); break; case 0x03: opcode_CB_03(); break; case 0x04: opcode_CB_04(); break; case 0x05: opcode_CB_05(); break; case 0x06: opcode_CB_06(); break; case 0x07: opcode_CB_07(); break; case 0x08: opcode_CB_08(); break; case 0x09: opcode_CB_09(); break; case 0x0A: opcode_CB_0A(); break; case 0x0B: opcode_CB_0B(); break; case 0x0C: opcode_CB_0C(); break; case 0x0D: opcode_CB_0D(); break; case 0x0E: opcode_CB_0E(); break; case 0x0F: opcode_CB_0F(); break; case 0x10: opcode_CB_10(); break; case 0x11: opcode_CB_11(); break; case 0x12: opcode_CB_12(); break; case 0x13: opcode_CB_13(); break; case 0x14: opcode_CB_14(); break; case 0x15: opcode_CB_15(); break; case 0x16: opcode_CB_16(); break; case 0x17: opcode_CB_17(); break; case 0x18: opcode_CB_18(); break; case 0x19: opcode_CB_19(); break; case 0x1A: opcode_CB_1A(); break; case 0x1B: opcode_CB_1B(); break; case 0x1C: opcode_CB_1C(); break; case 0x1D: opcode_CB_1D(); break; case 0x1E: opcode_CB_1E(); break; case 0x1F: opcode_CB_1F(); break; case 0x20: opcode_CB_20(); break; case 0x21: opcode_CB_21(); break; case 0x22: opcode_CB_22(); break; case 0x23: opcode_CB_23(); break; case 0x24: opcode_CB_24(); break; case 0x25: opcode_CB_25(); break; case 0x26: opcode_CB_26(); break; case 0x27: opcode_CB_27(); break; case 0x28: opcode_CB_28(); break; case 0x29: opcode_CB_29(); break; case 0x2A: opcode_CB_2A(); break; case 0x2B: opcode_CB_2B(); break; case 0x2C: opcode_CB_2C(); break; case 0x2D: opcode_CB_2D(); break; case 0x2E: opcode_CB_2E(); break; case 0x2F: opcode_CB_2F(); break; case 0x30: opcode_CB_30(); break; case 0x31: opcode_CB_31(); break; case 0x32: opcode_CB_32(); break; case 0x33: opcode_CB_33(); break; case 0x34: opcode_CB_34(); break; case 0x35: opcode_CB_35(); break; case 0x36: opcode_CB_36(); break; case 0x37: opcode_CB_37(); break; case 0x38: opcode_CB_38(); break; case 0x39: opcode_CB_39(); break; case 0x3A: opcode_CB_3A(); break; case 0x3B: opcode_CB_3B(); break; case 0x3C: opcode_CB_3C(); break; case 0x3D: opcode_CB_3D(); break; case 0x3E: opcode_CB_3E(); break; case 0x3F: opcode_CB_3F(); break; case 0x40: opcode_CB_40(); break; case 0x41: opcode_CB_41(); break; case 0x42: opcode_CB_42(); break; case 0x43: opcode_CB_43(); break; case 0x44: opcode_CB_44(); break; case 0x45: opcode_CB_45(); break; case 0x46: opcode_CB_46(); break; case 0x47: opcode_CB_47(); break; case 0x48: opcode_CB_48(); break; case 0x49: opcode_CB_49(); break; case 0x4A: opcode_CB_4A(); break; case 0x4B: opcode_CB_4B(); break; case 0x4C: opcode_CB_4C(); break; case 0x4D: opcode_CB_4D(); break; case 0x4E: opcode_CB_4E(); break; case 0x4F: opcode_CB_4F(); break; case 0x50: opcode_CB_50(); break; case 0x51: opcode_CB_51(); break; case 0x52: opcode_CB_52(); break; case 0x53: opcode_CB_53(); break; case 0x54: opcode_CB_54(); break; case 0x55: opcode_CB_55(); break; case 0x56: opcode_CB_56(); break; case 0x57: opcode_CB_57(); break; case 0x58: opcode_CB_58(); break; case 0x59: opcode_CB_59(); break; case 0x5A: opcode_CB_5A(); break; case 0x5B: opcode_CB_5B(); break; case 0x5C: opcode_CB_5C(); break; case 0x5D: opcode_CB_5D(); break; case 0x5E: opcode_CB_5E(); break; case 0x5F: opcode_CB_5F(); break; case 0x60: opcode_CB_60(); break; case 0x61: opcode_CB_61(); break; case 0x62: opcode_CB_62(); break; case 0x63: opcode_CB_63(); break; case 0x64: opcode_CB_64(); break; case 0x65: opcode_CB_65(); break; case 0x66: opcode_CB_66(); break; case 0x67: opcode_CB_67(); break; case 0x68: opcode_CB_68(); break; case 0x69: opcode_CB_69(); break; case 0x6A: opcode_CB_6A(); break; case 0x6B: opcode_CB_6B(); break; case 0x6C: opcode_CB_6C(); break; case 0x6D: opcode_CB_6D(); break; case 0x6E: opcode_CB_6E(); break; case 0x6F: opcode_CB_6F(); break; case 0x70: opcode_CB_70(); break; case 0x71: opcode_CB_71(); break; case 0x72: opcode_CB_72(); break; case 0x73: opcode_CB_73(); break; case 0x74: opcode_CB_74(); break; case 0x75: opcode_CB_75(); break; case 0x76: opcode_CB_76(); break; case 0x77: opcode_CB_77(); break; case 0x78: opcode_CB_78(); break; case 0x79: opcode_CB_79(); break; case 0x7A: opcode_CB_7A(); break; case 0x7B: opcode_CB_7B(); break; case 0x7C: opcode_CB_7C(); break; case 0x7D: opcode_CB_7D(); break; case 0x7E: opcode_CB_7E(); break; case 0x7F: opcode_CB_7F(); break; case 0x80: opcode_CB_80(); break; case 0x81: opcode_CB_81(); break; case 0x82: opcode_CB_82(); break; case 0x83: opcode_CB_83(); break; case 0x84: opcode_CB_84(); break; case 0x85: opcode_CB_85(); break; case 0x86: opcode_CB_86(); break; case 0x87: opcode_CB_87(); break; case 0x88: opcode_CB_88(); break; case 0x89: opcode_CB_89(); break; case 0x8A: opcode_CB_8A(); break; case 0x8B: opcode_CB_8B(); break; case 0x8C: opcode_CB_8C(); break; case 0x8D: opcode_CB_8D(); break; case 0x8E: opcode_CB_8E(); break; case 0x8F: opcode_CB_8F(); break; case 0x90: opcode_CB_90(); break; case 0x91: opcode_CB_91(); break; case 0x92: opcode_CB_92(); break; case 0x93: opcode_CB_93(); break; case 0x94: opcode_CB_94(); break; case 0x95: opcode_CB_95(); break; case 0x96: opcode_CB_96(); break; case 0x97: opcode_CB_97(); break; case 0x98: opcode_CB_98(); break; case 0x99: opcode_CB_99(); break; case 0x9A: opcode_CB_9A(); break; case 0x9B: opcode_CB_9B(); break; case 0x9C: opcode_CB_9C(); break; case 0x9D: opcode_CB_9D(); break; case 0x9E: opcode_CB_9E(); break; case 0x9F: opcode_CB_9F(); break; case 0xA0: opcode_CB_A0(); break; case 0xA1: opcode_CB_A1(); break; case 0xA2: opcode_CB_A2(); break; case 0xA3: opcode_CB_A3(); break; case 0xA4: opcode_CB_A4(); break; case 0xA5: opcode_CB_A5(); break; case 0xA6: opcode_CB_A6(); break; case 0xA7: opcode_CB_A7(); break; case 0xA8: opcode_CB_A8(); break; case 0xA9: opcode_CB_A9(); break; case 0xAA: opcode_CB_AA(); break; case 0xAB: opcode_CB_AB(); break; case 0xAC: opcode_CB_AC(); break; case 0xAD: opcode_CB_AD(); break; case 0xAE: opcode_CB_AE(); break; case 0xAF: opcode_CB_AF(); break; case 0xB0: opcode_CB_B0(); break; case 0xB1: opcode_CB_B1(); break; case 0xB2: opcode_CB_B2(); break; case 0xB3: opcode_CB_B3(); break; case 0xB4: opcode_CB_B4(); break; case 0xB5: opcode_CB_B5(); break; case 0xB6: opcode_CB_B6(); break; case 0xB7: opcode_CB_B7(); break; case 0xB8: opcode_CB_B8(); break; case 0xB9: opcode_CB_B9(); break; case 0xBA: opcode_CB_BA(); break; case 0xBB: opcode_CB_BB(); break; case 0xBC: opcode_CB_BC(); break; case 0xBD: opcode_CB_BD(); break; case 0xBE: opcode_CB_BE(); break; case 0xBF: opcode_CB_BF(); break; case 0xC0: opcode_CB_C0(); break; case 0xC1: opcode_CB_C1(); break; case 0xC2: opcode_CB_C2(); break; case 0xC3: opcode_CB_C3(); break; case 0xC4: opcode_CB_C4(); break; case 0xC5: opcode_CB_C5(); break; case 0xC6: opcode_CB_C6(); break; case 0xC7: opcode_CB_C7(); break; case 0xC8: opcode_CB_C8(); break; case 0xC9: opcode_CB_C9(); break; case 0xCA: opcode_CB_CA(); break; case 0xCB: opcode_CB_CB(); break; case 0xCC: opcode_CB_CC(); break; case 0xCD: opcode_CB_CD(); break; case 0xCE: opcode_CB_CE(); break; case 0xCF: opcode_CB_CF(); break; case 0xD0: opcode_CB_D0(); break; case 0xD1: opcode_CB_D1(); break; case 0xD2: opcode_CB_D2(); break; case 0xD3: opcode_CB_D3(); break; case 0xD4: opcode_CB_D4(); break; case 0xD5: opcode_CB_D5(); break; case 0xD6: opcode_CB_D6(); break; case 0xD7: opcode_CB_D7(); break; case 0xD8: opcode_CB_D8(); break; case 0xD9: opcode_CB_D9(); break; case 0xDA: opcode_CB_DA(); break; case 0xDB: opcode_CB_DB(); break; case 0xDC: opcode_CB_DC(); break; case 0xDD: opcode_CB_DD(); break; case 0xDE: opcode_CB_DE(); break; case 0xDF: opcode_CB_DF(); break; case 0xE0: opcode_CB_E0(); break; case 0xE1: opcode_CB_E1(); break; case 0xE2: opcode_CB_E2(); break; case 0xE3: opcode_CB_E3(); break; case 0xE4: opcode_CB_E4(); break; case 0xE5: opcode_CB_E5(); break; case 0xE6: opcode_CB_E6(); break; case 0xE7: opcode_CB_E7(); break; case 0xE8: opcode_CB_E8(); break; case 0xE9: opcode_CB_E9(); break; case 0xEA: opcode_CB_EA(); break; case 0xEB: opcode_CB_EB(); break; case 0xEC: opcode_CB_EC(); break; case 0xED: opcode_CB_ED(); break; case 0xEE: opcode_CB_EE(); break; case 0xEF: opcode_CB_EF(); break; case 0xF0: opcode_CB_F0(); break; case 0xF1: opcode_CB_F1(); break; case 0xF2: opcode_CB_F2(); break; case 0xF3: opcode_CB_F3(); break; case 0xF4: opcode_CB_F4(); break; case 0xF5: opcode_CB_F5(); break; case 0xF6: opcode_CB_F6(); break; case 0xF7: opcode_CB_F7(); break; case 0xF8: opcode_CB_F8(); break; case 0xF9: opcode_CB_F9(); break; case 0xFA: opcode_CB_FA(); break; case 0xFB: opcode_CB_FB(); break; case 0xFC: opcode_CB_FC(); break; case 0xFD: opcode_CB_FD(); break; case 0xFE: opcode_CB_FE(); break; case 0xFF: opcode_CB_FF(); break; } return opcode_cycles_cb[opcode]; }
106.90404
551
0.700383
543816cdb63b87dae476b41cd00690b07963e1d1
11,448
css
CSS
css/emerald.css
robinpokorny/emerald
d67240907b7e56d8f14ae2f3838682cf06fed730
[ "MIT" ]
15
2015-01-19T12:45:29.000Z
2018-08-20T14:55:42.000Z
css/emerald.css
robinpokorny/emerald
d67240907b7e56d8f14ae2f3838682cf06fed730
[ "MIT" ]
6
2015-10-05T08:08:43.000Z
2021-05-11T12:10:10.000Z
css/emerald.css
robinpokorny/emerald
d67240907b7e56d8f14ae2f3838682cf06fed730
[ "MIT" ]
3
2015-07-22T14:33:52.000Z
2020-08-27T06:51:10.000Z
/*! Emerald v1.2.2 | MIT Licence | git.io/g9_ZaA */ .visible--palm { display: block; } .visible--lap { display: none; } .visible--desk { display: none; } .hidden--palm { display: none; } .hidden--lap { display: block; } .hidden--desk { display: block; } @media only screen and (min-width: 768px) { .visible--palm { display: none; } .visible--lap { display: block; } .visible--desk { display: none; } .hidden--palm { display: block; } .hidden--lap { display: none; } .hidden--desk { display: block; } } @media only screen and (min-width: 1020px) { .visible--palm { display: none; } .visible--lap { display: none; } .visible--desk { display: block; } .hidden--palm { display: block; } .hidden--lap { display: block; } .hidden--desk { display: none; } } .wrapper { margin-right: auto; margin-left: auto; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .grid { list-style: none; margin: 0; padding: 0; } .grid__item { display: inline-block; width: 100%; text-align: left; vertical-align: top; direction: ltr; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .grid { margin-right: -3vw; margin-left: -3vw; } .grid__item { padding-right: 3vw; padding-left: 3vw; } .grid__item { display: inline-block; } .wrapper { padding-right: 3vw; padding-left: 3vw; } .wrapper { width: 96vw; } .e-8--palm { width: 96vw; } .e-push-8--palm { margin-left: 96vw; } .e-pull-8--palm { margin-right: 96vw; } .e-7--palm { width: 84vw; } .e-push-7--palm { margin-left: 84vw; } .e-pull-7--palm { margin-right: 84vw; } .e-6--palm { width: 72vw; } .e-push-6--palm { margin-left: 72vw; } .e-pull-6--palm { margin-right: 72vw; } .e-5--palm { width: 60vw; } .e-push-5--palm { margin-left: 60vw; } .e-pull-5--palm { margin-right: 60vw; } .e-4--palm { width: 48vw; } .e-push-4--palm { margin-left: 48vw; } .e-pull-4--palm { margin-right: 48vw; } .e-3--palm { width: 36vw; } .e-push-3--palm { margin-left: 36vw; } .e-pull-3--palm { margin-right: 36vw; } .e-2--palm { width: 24vw; } .e-push-2--palm { margin-left: 24vw; } .e-pull-2--palm { margin-right: 24vw; } .e-1--palm { width: 12vw; } .e-push-1--palm { margin-left: 12vw; } .e-pull-1--palm { margin-right: 12vw; } .e-full--palm { width: 100%; } .e-push-0--palm { margin-left: 0; } .e-pull-0--palm { margin-right: 0; } .e-0--palm { display: none; } .grid--obv--palm { direction: ltr; } .grid--rev--palm { direction: rtl; } .grid--left--palm { text-align: left; } .grid--right--palm { text-align: right; } .grid--center--palm { text-align: center; } .grid--top--palm > .grid__item { vertical-align: top; } .grid--middle--palm > .grid__item { vertical-align: middle; } .grid--bottom--palm > .grid__item { vertical-align: bottom; } @media only screen and (min-width: 768px) { .grid { margin-right: -10px; margin-left: -10px; } .grid__item { padding-right: 10px; padding-left: 10px; } .grid__item { display: inline-block; } .wrapper { padding-right: 10px; padding-left: 10px; } .e-8--palm { width: 320px; } .e-push-8--palm { margin-left: 320px; } .e-pull-8--palm { margin-right: 320px; } .e-7--palm { width: 280px; } .e-push-7--palm { margin-left: 280px; } .e-pull-7--palm { margin-right: 280px; } .e-6--palm { width: 240px; } .e-push-6--palm { margin-left: 240px; } .e-pull-6--palm { margin-right: 240px; } .e-5--palm { width: 200px; } .e-push-5--palm { margin-left: 200px; } .e-pull-5--palm { margin-right: 200px; } .e-4--palm { width: 160px; } .e-push-4--palm { margin-left: 160px; } .e-pull-4--palm { margin-right: 160px; } .e-3--palm { width: 120px; } .e-push-3--palm { margin-left: 120px; } .e-pull-3--palm { margin-right: 120px; } .e-2--palm { width: 80px; } .e-push-2--palm { margin-left: 80px; } .e-pull-2--palm { margin-right: 80px; } .e-1--palm { width: 40px; } .e-push-1--palm { margin-left: 40px; } .e-pull-1--palm { margin-right: 40px; } .e-full--palm { width: 100%; } .e-push-0--palm { margin-left: 0; } .e-pull-0--palm { margin-right: 0; } .wrapper { width: 640px; } .e-16 { width: 640px; } .e-push-16 { margin-left: 640px; } .e-pull-16 { margin-right: 640px; } .e-15 { width: 600px; } .e-push-15 { margin-left: 600px; } .e-pull-15 { margin-right: 600px; } .e-14 { width: 560px; } .e-push-14 { margin-left: 560px; } .e-pull-14 { margin-right: 560px; } .e-13 { width: 520px; } .e-push-13 { margin-left: 520px; } .e-pull-13 { margin-right: 520px; } .e-12 { width: 480px; } .e-push-12 { margin-left: 480px; } .e-pull-12 { margin-right: 480px; } .e-11 { width: 440px; } .e-push-11 { margin-left: 440px; } .e-pull-11 { margin-right: 440px; } .e-10 { width: 400px; } .e-push-10 { margin-left: 400px; } .e-pull-10 { margin-right: 400px; } .e-9 { width: 360px; } .e-push-9 { margin-left: 360px; } .e-pull-9 { margin-right: 360px; } .e-8 { width: 320px; } .e-push-8 { margin-left: 320px; } .e-pull-8 { margin-right: 320px; } .e-7 { width: 280px; } .e-push-7 { margin-left: 280px; } .e-pull-7 { margin-right: 280px; } .e-6 { width: 240px; } .e-push-6 { margin-left: 240px; } .e-pull-6 { margin-right: 240px; } .e-5 { width: 200px; } .e-push-5 { margin-left: 200px; } .e-pull-5 { margin-right: 200px; } .e-4 { width: 160px; } .e-push-4 { margin-left: 160px; } .e-pull-4 { margin-right: 160px; } .e-3 { width: 120px; } .e-push-3 { margin-left: 120px; } .e-pull-3 { margin-right: 120px; } .e-2 { width: 80px; } .e-push-2 { margin-left: 80px; } .e-pull-2 { margin-right: 80px; } .e-1 { width: 40px; } .e-push-1 { margin-left: 40px; } .e-pull-1 { margin-right: 40px; } .e-full { width: 100%; } .e-push-0 { margin-left: 0; } .e-pull-0 { margin-right: 0; } .e-0 { display: none; } .grid--obv { direction: ltr; } .grid--rev { direction: rtl; } .grid--left { text-align: left; } .grid--right { text-align: right; } .grid--center { text-align: center; } .grid--top > .grid__item { vertical-align: top; } .grid--middle > .grid__item { vertical-align: middle; } .grid--bottom > .grid__item { vertical-align: bottom; } } @media only screen and (min-width: 1020px) { .grid__item { display: inline-block; } .wrapper { width: 1000px; } .e-25--desk { width: 1000px; } .e-push-25--desk { margin-left: 1000px; } .e-pull-25--desk { margin-right: 1000px; } .e-24--desk { width: 960px; } .e-push-24--desk { margin-left: 960px; } .e-pull-24--desk { margin-right: 960px; } .e-23--desk { width: 920px; } .e-push-23--desk { margin-left: 920px; } .e-pull-23--desk { margin-right: 920px; } .e-22--desk { width: 880px; } .e-push-22--desk { margin-left: 880px; } .e-pull-22--desk { margin-right: 880px; } .e-21--desk { width: 840px; } .e-push-21--desk { margin-left: 840px; } .e-pull-21--desk { margin-right: 840px; } .e-20--desk { width: 800px; } .e-push-20--desk { margin-left: 800px; } .e-pull-20--desk { margin-right: 800px; } .e-19--desk { width: 760px; } .e-push-19--desk { margin-left: 760px; } .e-pull-19--desk { margin-right: 760px; } .e-18--desk { width: 720px; } .e-push-18--desk { margin-left: 720px; } .e-pull-18--desk { margin-right: 720px; } .e-17--desk { width: 680px; } .e-push-17--desk { margin-left: 680px; } .e-pull-17--desk { margin-right: 680px; } .e-16--desk { width: 640px; } .e-push-16--desk { margin-left: 640px; } .e-pull-16--desk { margin-right: 640px; } .e-15--desk { width: 600px; } .e-push-15--desk { margin-left: 600px; } .e-pull-15--desk { margin-right: 600px; } .e-14--desk { width: 560px; } .e-push-14--desk { margin-left: 560px; } .e-pull-14--desk { margin-right: 560px; } .e-13--desk { width: 520px; } .e-push-13--desk { margin-left: 520px; } .e-pull-13--desk { margin-right: 520px; } .e-12--desk { width: 480px; } .e-push-12--desk { margin-left: 480px; } .e-pull-12--desk { margin-right: 480px; } .e-11--desk { width: 440px; } .e-push-11--desk { margin-left: 440px; } .e-pull-11--desk { margin-right: 440px; } .e-10--desk { width: 400px; } .e-push-10--desk { margin-left: 400px; } .e-pull-10--desk { margin-right: 400px; } .e-9--desk { width: 360px; } .e-push-9--desk { margin-left: 360px; } .e-pull-9--desk { margin-right: 360px; } .e-8--desk { width: 320px; } .e-push-8--desk { margin-left: 320px; } .e-pull-8--desk { margin-right: 320px; } .e-7--desk { width: 280px; } .e-push-7--desk { margin-left: 280px; } .e-pull-7--desk { margin-right: 280px; } .e-6--desk { width: 240px; } .e-push-6--desk { margin-left: 240px; } .e-pull-6--desk { margin-right: 240px; } .e-5--desk { width: 200px; } .e-push-5--desk { margin-left: 200px; } .e-pull-5--desk { margin-right: 200px; } .e-4--desk { width: 160px; } .e-push-4--desk { margin-left: 160px; } .e-pull-4--desk { margin-right: 160px; } .e-3--desk { width: 120px; } .e-push-3--desk { margin-left: 120px; } .e-pull-3--desk { margin-right: 120px; } .e-2--desk { width: 80px; } .e-push-2--desk { margin-left: 80px; } .e-pull-2--desk { margin-right: 80px; } .e-1--desk { width: 40px; } .e-push-1--desk { margin-left: 40px; } .e-pull-1--desk { margin-right: 40px; } .e-full--desk { width: 100%; } .e-push-0--desk { margin-left: 0; } .e-pull-0--desk { margin-right: 0; } .e-0--desk { display: none; } .grid--obv--desk { direction: ltr; } .grid--rev--desk { direction: rtl; } .grid--left--desk { text-align: left; } .grid--right--desk { text-align: right; } .grid--center--desk { text-align: center; } .grid--top--desk > .grid__item { vertical-align: top; } .grid--middle--desk > .grid__item { vertical-align: middle; } .grid--bottom--desk > .grid__item { vertical-align: bottom; } } .visible--print { display: none; } @media print { .grid { margin-right: 0; margin-left: 0; } .grid__item { padding-right: 0; padding-left: 0; } .grid__item { display: inline-block; } .wrapper { padding-right: 0; padding-left: 0; } .grid__item, .wrapper { display: block; width: 100%; } .visible--print { display: block; } .hidden--print { display: none; } }
14.509506
51
0.52935
363ceed2a4a44e6b8b6c7c7387a41aa0d83c1bff
2,657
dart
Dart
lib/services/logs_database.dart
mjablecnik/MyLogger
a94fb0fc48d84ba4699d9456f82b50967cb9bc91
[ "MIT" ]
2
2022-03-03T02:01:47.000Z
2022-03-23T11:33:52.000Z
lib/services/logs_database.dart
mjablecnik/MyLogger
a94fb0fc48d84ba4699d9456f82b50967cb9bc91
[ "MIT" ]
null
null
null
lib/services/logs_database.dart
mjablecnik/MyLogger
a94fb0fc48d84ba4699d9456f82b50967cb9bc91
[ "MIT" ]
null
null
null
import 'dart:async'; import 'package:my_logger/logger.dart'; import 'package:my_logger/core/encryption/gcm.dart'; import 'package:my_logger/logger_core.dart'; import 'package:path/path.dart'; import 'package:path_provider/path_provider.dart'; import 'package:sembast/sembast.dart'; import 'package:sembast/sembast_io.dart'; class LogsDatabase { static final LogsDatabase _singleton = LogsDatabase._(); static LogsDatabase get instance => _singleton; // Completer is used for transforming synchronous code into asynchronous code. Completer<Database>? _dbOpenCompleter; final _dbStore = intMapStoreFactory.store(Constants.STORE_NAME); String encryptionKey = ""; LogsDatabase._(); Future<Database> get database async { if (_dbOpenCompleter == null) { _dbOpenCompleter = Completer(); _setup(); } return _dbOpenCompleter!.future; } Future _setup() async { // Get a platform-specific directory where persistent app data can be stored final directory = await getApplicationSupportDirectory(); final configuration = MyLogger.config; final dbPath = join(directory.path, Constants.DB_NAME); var codec; // Initialize the encryption codec with a user password if (configuration.encryptionKey.isNotEmpty) { switch (configuration.encryption) { case EncryptionType.XXTEA: codec = getXXTeaSembastCodec(password: configuration.encryptionKey); break; case EncryptionType.AES_GCM: codec = getGCMSembastCodec(password: configuration.encryptionKey); break; case EncryptionType.NONE: break; } } final database = await databaseFactoryIo.openDatabase(dbPath, codec: codec); _dbOpenCompleter!.complete(database); } Future<List<Log>> select({List<Filter>? filters}) async { Finder? finder; if (filters != null) { finder = Finder(filter: Filter.and(filters), sortOrders: [SortOrder(LogFields.timeInMillis)]); } final recordSnapshots = await (_dbStore.find( await database, finder: finder, )); return recordSnapshots.map((snapshot) { final log = Log.fromJson(snapshot.value); log.id = snapshot.key; return log; }).toList(); } Future<int> insert(Log log) async { return await _dbStore.add(await database, log.toJson()); } Future<int> delete({List<Filter>? filters}) async { Finder? finder; if (filters != null) { finder = Finder( filter: Filter.and(filters), ); } var deleted = await _dbStore.delete( await database, finder: finder, ); return deleted; } }
26.57
100
0.680467
5d5f8049174be022399d05cb5557683530cd336e
5,785
dart
Dart
lib/pages/Discover.dart
MarcL01/FlutterSocial
33da7dbfe4e69dd9a2dcda77950931b670759382
[ "WTFPL" ]
2
2020-12-09T05:42:41.000Z
2021-03-18T22:36:21.000Z
lib/pages/Discover.dart
BigMarco254/FlutterSocial
33da7dbfe4e69dd9a2dcda77950931b670759382
[ "WTFPL" ]
null
null
null
lib/pages/Discover.dart
BigMarco254/FlutterSocial
33da7dbfe4e69dd9a2dcda77950931b670759382
[ "WTFPL" ]
null
null
null
import 'dart:convert'; import 'package:flutter/material.dart'; class DiscoverPage extends StatefulWidget { DiscoverPage({Key key}) : super(key: key); @override _DiscoverPageState createState() => _DiscoverPageState(); } class _DiscoverPageState extends State<DiscoverPage> { static final _textKey = GlobalKey<FormState>(); @override Widget build(BuildContext context) { return CustomScrollView( slivers: <Widget>[ SliverAppBar( backgroundColor: Colors.transparent, elevation: 0, pinned: true, expandedHeight: 100.0, flexibleSpace: FlexibleSpaceBar( title: Text( "Discover", style: TextStyle( fontWeight: FontWeight.w800, ), ), centerTitle: true, ), ), SliverPersistentHeader( pinned: true, delegate: _SliverChildrenDelegate( TextField( key: _textKey, decoration: InputDecoration( fillColor: Color(0xFF151613), ), ), ), ), SliverPadding( padding: EdgeInsets.all(15.0), sliver: SliverGrid( delegate: SliverChildBuilderDelegate( (context, index) { DiscoverCategory category = categories[index]; return DiscoverCard( category: category, ); }, childCount: categories.length, ), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, mainAxisSpacing: 20.0, crossAxisSpacing: 15.0, childAspectRatio: .8), ), ), ], ); } } class DiscoverCard extends StatelessWidget { final DiscoverCategory category; DiscoverCard({ Key key, this.category, }) : super(key: key); @override Widget build(BuildContext context) { return Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(10.0), image: DecorationImage( image: NetworkImage(category.background), fit: BoxFit.cover), ), child: Material( type: MaterialType.card, color: Colors.black26, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), child: InkWell( onTap: () { print("clicked"); }, child: Padding( padding: const EdgeInsets.all(10.0), child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ CircleAvatar( backgroundImage: NetworkImage(category.pfp), ), Text( category.name, style: TextStyle( color: Colors.white, fontWeight: FontWeight.w900), ), Text( category.major, style: TextStyle(color: Colors.white), ), ], ), ), ), ), ); } } List<DiscoverCategory> categories = [ DiscoverCategory( background: "https://www.irishtimes.com/polopoly_fs/1.4029963.1569503430!/image/image.jpg_gen/derivatives/box_620_330/image.jpg", pfp: "https://www.fakepersongenerator.com/Face/male/male20171086735279511.jpg", name: "Larry burton", major: "Computer Science"), DiscoverCategory( background: "https://www.pandotrip.com/wp-content/uploads/2018/03/Woman-in-the-Taj-Mahal-India.jpg", pfp: "https://www.fakepersongenerator.com/Face/male/male20171086735279511.jpg", name: "Daria darla", major: "Biology"), DiscoverCategory( background: "https://www.pandotrip.com/wp-content/uploads/2018/03/Golden-Gate-Bridge-San-Francisco-California-USA.jpg", pfp: "https://www.fakepersongenerator.com/Face/male/male20171086735279511.jpg", name: "Nathan Drake", major: "Business Administration"), DiscoverCategory( background: "https://www.catster.com/wp-content/uploads/2015/06/blankets-ranked-2.jpg", pfp: "https://www.fakepersongenerator.com/Face/male/male20171086735279511.jpg", name: "Alan Lallana", major: "Computer Science"), DiscoverCategory( background: "https://www.pandotrip.com/wp-content/uploads/2018/03/Amazing-view-of-The-Great-Wall-of-China.jpg", pfp: "https://www.fakepersongenerator.com/Face/male/male20171086735279511.jpg", name: "Larry burton", major: "Computer Science"), DiscoverCategory( background: "https://www.pandotrip.com/wp-content/uploads/2018/03/Woman-looking-at-Mount-Fuji-Japan.jpg", pfp: "https://www.fakepersongenerator.com/Face/male/male20171086735279511.jpg", name: "Larry burton", major: "Computer Science"), ]; class DiscoverCategory { String background; String pfp; String name; String major; DiscoverCategory({ this.background, this.pfp, this.name, this.major, }); } class _SliverChildrenDelegate extends SliverPersistentHeaderDelegate { _SliverChildrenDelegate(this.child); @override double get minExtent => 30; @override double get maxExtent => 30; final TextField child; @override Widget build( BuildContext context, double shrinkOffset, bool overlapsContent) { return this.child; } @override bool shouldRebuild(_SliverChildrenDelegate oldDelegate) { return false; } }
28.781095
127
0.587208
8e9fc9712346e7882973adb38affe96380b093c9
330
js
JavaScript
cinema/public/js/states/censorRating.js
christopher97/cinema-dissertation
f6d6dffcfd3a99949138eef3ea2b4cdf313bb69b
[ "MIT" ]
null
null
null
cinema/public/js/states/censorRating.js
christopher97/cinema-dissertation
f6d6dffcfd3a99949138eef3ea2b4cdf313bb69b
[ "MIT" ]
null
null
null
cinema/public/js/states/censorRating.js
christopher97/cinema-dissertation
f6d6dffcfd3a99949138eef3ea2b4cdf313bb69b
[ "MIT" ]
null
null
null
import Operator from '../utils/model/operator/index.js'; export const censorRating = { state: { censorRatings: [] }, addRating(newRating) { this.state.censorRatings.push(newRating); }, addRatings(model, newRatings) { this.state.censorRatings = Operator.map(model, newRatings); } };
25.384615
67
0.636364
ecb3cc9d8feaff1fdbb96fd99b258debf65a28b8
5,809
sql
SQL
SQL Scripts/Procedures/spUSERS_Delete.3.sql
mr-bwnz/SplendidAppBuilder
79ec92d4cb805ccf408ff95103a1a0a78bc765b7
[ "MIT" ]
1
2022-03-01T10:27:25.000Z
2022-03-01T10:27:25.000Z
SQL Scripts/Procedures/spUSERS_Delete.3.sql
mr-bwnz/SplendidAppBuilder
79ec92d4cb805ccf408ff95103a1a0a78bc765b7
[ "MIT" ]
null
null
null
SQL Scripts/Procedures/spUSERS_Delete.3.sql
mr-bwnz/SplendidAppBuilder
79ec92d4cb805ccf408ff95103a1a0a78bc765b7
[ "MIT" ]
3
2022-02-21T13:28:37.000Z
2022-03-18T06:42:07.000Z
if exists (select * from INFORMATION_SCHEMA.ROUTINES where ROUTINE_NAME = 'spUSERS_Delete' and ROUTINE_TYPE = 'PROCEDURE') Drop Procedure dbo.spUSERS_Delete; GO /********************************************************************************************************************** * Copyright (C) 2005-2022 SplendidCRM Software, Inc. * MIT License * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software * is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *********************************************************************************************************************/ -- 10/15/2006 Paul. Delete team memberships. -- 11/18/2006 Paul. Use a procedure to delete the user from the teams so that all implicit assignments can be recalculated. -- 09/12/2010 Paul. We stopped using the table ROLES_USERS years ago. -- 09/12/2010 Paul. VCALS was never used. -- 01/30/2019 Paul. Trigger audit record so delete workflow will have access to custom fields. Create Procedure dbo.spUSERS_Delete ( @ID uniqueidentifier , @MODIFIED_USER_ID uniqueidentifier ) as begin set nocount on -- 04/02/2006 Paul. Catch the Oracle NO_DATA_FOUND exception. -- BEGIN Oracle Exception -- 12/20/2005 Paul. SugarCRM 4.0 relates Users to Prospect Lists. update PROSPECT_LISTS_PROSPECTS set DELETED = 1 , DATE_MODIFIED = getdate() , DATE_MODIFIED_UTC= getutcdate() , MODIFIED_USER_ID = @MODIFIED_USER_ID where RELATED_ID = @ID and DELETED = 0; -- END Oracle Exception -- BEGIN Oracle Exception update CALLS_USERS set DELETED = 1 , DATE_MODIFIED = getdate() , DATE_MODIFIED_UTC= getutcdate() , MODIFIED_USER_ID = @MODIFIED_USER_ID where USER_ID = @ID and DELETED = 0; -- END Oracle Exception -- BEGIN Oracle Exception update CONTACTS_USERS set DELETED = 1 , DATE_MODIFIED = getdate() , DATE_MODIFIED_UTC= getutcdate() , MODIFIED_USER_ID = @MODIFIED_USER_ID where USER_ID = @ID and DELETED = 0; -- END Oracle Exception /* -- BEGIN Oracle Exception -- 11/13/2005 Paul. Not sure if it makes sense to delete email relationships as they amount to a log. update EMAILMAN set DELETED = 1 , DATE_MODIFIED = getdate() , DATE_MODIFIED_UTC= getutcdate() , MODIFIED_USER_ID = @MODIFIED_USER_ID where USER_ID = @ID and DELETED = 0; -- END Oracle Exception -- BEGIN Oracle Exception update EMAILMAN_SENT set DELETED = 1 , DATE_MODIFIED = getdate() , DATE_MODIFIED_UTC= getutcdate() , MODIFIED_USER_ID = @MODIFIED_USER_ID where USER_ID = @ID and DELETED = 0; -- END Oracle Exception -- BEGIN Oracle Exception update EMAILS_USERS set DELETED = 1 , DATE_MODIFIED = getdate() , DATE_MODIFIED_UTC= getutcdate() , MODIFIED_USER_ID = @MODIFIED_USER_ID where USER_ID = @ID and DELETED = 0; -- END Oracle Exception */ -- BEGIN Oracle Exception update MEETINGS_USERS set DELETED = 1 , DATE_MODIFIED = getdate() , DATE_MODIFIED_UTC= getutcdate() , MODIFIED_USER_ID = @MODIFIED_USER_ID where USER_ID = @ID and DELETED = 0; -- END Oracle Exception -- BEGIN Oracle Exception update USERS_FEEDS set DELETED = 1 , DATE_MODIFIED = getdate() , DATE_MODIFIED_UTC= getutcdate() , MODIFIED_USER_ID = @MODIFIED_USER_ID where USER_ID = @ID and DELETED = 0; -- END Oracle Exception -- BEGIN Oracle Exception delete from TRACKER where ITEM_ID = @ID and USER_ID = @MODIFIED_USER_ID; -- END Oracle Exception exec dbo.spPARENT_Delete @ID, @MODIFIED_USER_ID; -- 11/18/2006 Paul. Only use team procedures when team management has been enabled. if dbo.fnCONFIG_Boolean(N'enable_team_management') = 1 begin -- then exec dbo.spTEAM_MEMBERSHIPS_DeleteUser @MODIFIED_USER_ID, @ID; end -- if; -- BEGIN Oracle Exception update USERS set DELETED = 1 , DATE_MODIFIED = getdate() , DATE_MODIFIED_UTC= getutcdate() , MODIFIED_USER_ID = @MODIFIED_USER_ID where ID = @ID and DELETED = 0; -- 01/30/2019 Paul. Trigger audit record so delete workflow will have access to custom fields. update USERS_CSTM set ID_C = ID_C where ID_C = @ID; -- END Oracle Exception end GO Grant Execute on dbo.spUSERS_Delete to public; GO
37.96732
132
0.616285
46e9396d93eb5cc810707277fbbcdfe88cf293e3
2,154
py
Python
src/lib/pytornado/fileio/cpacs/results.py
aarondettmann/pytornado
d9f7341f118a5033596d94dce7786912e1ff535f
[ "Apache-2.0" ]
null
null
null
src/lib/pytornado/fileio/cpacs/results.py
aarondettmann/pytornado
d9f7341f118a5033596d94dce7786912e1ff535f
[ "Apache-2.0" ]
null
null
null
src/lib/pytornado/fileio/cpacs/results.py
aarondettmann/pytornado
d9f7341f118a5033596d94dce7786912e1ff535f
[ "Apache-2.0" ]
1
2021-01-21T19:10:45.000Z
2021-01-21T19:10:45.000Z
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # Copyright 2017-2019 Airinnova AB and the PyTornado 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. # ---------------------------------------------------------------------- # Authors: # * Aaron Dettmann """ Write VLM results back to CPACS Developed at Airinnova AB, Stockholm, Sweden. """ import logging from commonlibs.logger import truncate_filepath from pytornado.fileio.cpacs.utils import XPATHS, add_vector, modify_cpacs logger = logging.getLogger(__name__) def save_aeroperformance_map(state, settings): """ Write aeroperformance map results back to CPACS Args: :state: (object) data structure for operating conditions :settings: (object) data structure for execution settings """ state.results cpacs_file = settings.paths('f_aircraft') logger.info(f"Writing aeroperformance map results to '{truncate_filepath(cpacs_file)}'") cpacs_mappings = { ('cl', 'CL'), # Lift coefficient in aerodynamic coordinates ('cd', 'CD'), # Drag coefficient in aerodynamic coordinates ('cs', 'CC'), # Coefficient of the side force vector in aerodynamic coordinates ('cmd', 'Cl'), # Moment coefficient about x ('cms', 'Cm'), # Moment coefficient about y ('cml', 'Cn'), # Moment coefficient about z } with modify_cpacs(cpacs_file) as tixi: for key_cpacs, key_native in cpacs_mappings: xpath = XPATHS.APM(tixi) + "/" + key_cpacs add_vector(tixi, xpath, vector=state.results[key_native])
33.138462
92
0.652739
25a7edbf81f2f14cf38c93da39b0880ea04cc5cf
494
cs
C#
source/Extensibility.Authentication/HostServices/AuthorizationResult.cs
OctopusDeploy/AuthenticationExtensibility
ef9753e4be1275b3f7f5592f9b93a1498ef9322a
[ "Apache-2.0" ]
2
2017-10-17T20:36:22.000Z
2021-07-07T05:12:16.000Z
source/Extensibility.Authentication/HostServices/AuthorizationResult.cs
OctopusDeploy/AuthenticationExtensibility
ef9753e4be1275b3f7f5592f9b93a1498ef9322a
[ "Apache-2.0" ]
10
2018-09-14T06:20:07.000Z
2022-03-21T05:10:49.000Z
source/Extensibility.Authentication/HostServices/AuthorizationResult.cs
OctopusDeploy/AuthenticationExtensibility
ef9753e4be1275b3f7f5592f9b93a1498ef9322a
[ "Apache-2.0" ]
null
null
null
using System; namespace Octopus.Server.Extensibility.Authentication.HostServices { public class AuthorizationResult { readonly Lazy<string> helpText; public AuthorizationResult(bool isAuthorized, Lazy<string>? helpText = null) { IsAuthorized = isAuthorized; this.helpText = helpText ?? new Lazy<string>(() => string.Empty); } public bool IsAuthorized { get; } public string? HelpText => helpText.Value; } }
26
84
0.6417
bcfd0808e120a119b2435eb10d4603cfbbbde5aa
1,202
lua
Lua
entities/weapons/prop_remover/shared.lua
LegendofRobbo/Fortwars-3
34a11be973dc7d568474634b2e1ecf0c26f1d86a
[ "Unlicense" ]
1
2022-02-03T20:27:40.000Z
2022-02-03T20:27:40.000Z
entities/weapons/prop_remover/shared.lua
LegendofRobbo/Fortwars-3
34a11be973dc7d568474634b2e1ecf0c26f1d86a
[ "Unlicense" ]
null
null
null
entities/weapons/prop_remover/shared.lua
LegendofRobbo/Fortwars-3
34a11be973dc7d568474634b2e1ecf0c26f1d86a
[ "Unlicense" ]
null
null
null
if SERVER then AddCSLuaFile("shared.lua") end SWEP.Author = "Darkspider" SWEP.Contact = "" SWEP.Purpose = "Removes Props" SWEP.Instructions = "Shoot to remove props" SWEP.PrintName = "Prop Remover" SWEP.Slot = 1 SWEP.SlotPos = 3 SWEP.ViewModelFOV = 60 SWEP.ViewModelFlip = false SWEP.ViewModel = "models/weapons/v_crossbow.mdl" SWEP.WorldModel = "models/weapons/w_crossbow.mdl" SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.Primary.ClipSize = -1 // Size of a clip SWEP.Primary.DefaultClip = -1 // Default number of bullets in a clip SWEP.Primary.Automatic = false // Automatic/Semi Auto SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 // Size of a clip SWEP.Secondary.DefaultClip = -1 // Default number of bullets in a clip SWEP.Secondary.Automatic = false // Automatic/Semi Auto SWEP.Secondary.Ammo = "none" function SWEP:PrimaryAttack() if CLIENT then return end tr = self.Owner:GetEyeTrace() if !tr.Entity:IsValid() then return end if tr.Entity:GetClass() == "prop" && (tr.Entity.Spawner == self.Owner || self.Owner:IsAdmin()) then tr.Entity:Remove() end end function SWEP:SecondaryAttack() end
30.820513
102
0.698003
7ecd9208463411e92e25db3f1b5ef41047e86aab
344
dart
Dart
packages/devtools_app/lib/src/http/http.dart
gmoothart/devtools
3600b12d12818c51e6ceb5dcc62997973209e3da
[ "BSD-3-Clause" ]
1,179
2018-08-20T07:10:48.000Z
2022-03-29T07:33:11.000Z
packages/devtools_app/lib/src/http/http.dart
gmoothart/devtools
3600b12d12818c51e6ceb5dcc62997973209e3da
[ "BSD-3-Clause" ]
2,353
2018-08-22T16:12:59.000Z
2022-03-31T19:45:28.000Z
packages/devtools_app/lib/src/http/http.dart
jmewes/devtools
30e2b3637dd7ecd1d8f032dbffe7187329145e66
[ "BSD-3-Clause" ]
191
2018-08-06T20:37:41.000Z
2022-03-31T15:18:59.000Z
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /// This library contains code pulled from dart:io that is not platform specific. library http; part '_http_cookies.dart'; part '_http_date.dart'; part '_http_exception.dart';
28.666667
81
0.761628
da807b99bdbf89211373617024aba1d01bc3c63c
748
php
PHP
backend/package/Adapter/Presenter/User/UserCreateJsonPresenter.php
yutatuy/anking
c477c3ad2a59c6ecf6ae3d8805dd4059e25f69b1
[ "MIT" ]
null
null
null
backend/package/Adapter/Presenter/User/UserCreateJsonPresenter.php
yutatuy/anking
c477c3ad2a59c6ecf6ae3d8805dd4059e25f69b1
[ "MIT" ]
1
2022-02-06T12:20:56.000Z
2022-02-06T12:20:56.000Z
backend/package/Adapter/Presenter/User/UserCreateJsonPresenter.php
yutatuy/anking
c477c3ad2a59c6ecf6ae3d8805dd4059e25f69b1
[ "MIT" ]
null
null
null
<?php namespace Package\Adapter\Presenter\User; use Illuminate\Http\JsonResponse; use Package\Adapter\Presenter\JsonPresenter; use Package\Adapter\ViewModel\User\UserViewModel; use Package\Application\User\Create\UserCreateOutput; class UserCreateJsonPresenter extends JsonPresenter { public function exec(UserCreateOutput $output): JsonResponse { $view_model = new UserViewModel($output->getUser()); return $this->jsonResponse( [ 'status' => 'success', 'user' => [ 'id' => $view_model->getId(), 'name' => $view_model->getName(), 'email' => $view_model->getEamil() ] ] ); } }
26.714286
64
0.582888
7f9a02c84bcd639808363548b87179a890e19562
4,752
php
PHP
app/Http/Controllers/Apis/Controllers/editNovel/editNovelRules.php
Mostafaramdan/rewayaty
8a393f3920c0425490c178f41e8c7605219d9337
[ "MIT" ]
null
null
null
app/Http/Controllers/Apis/Controllers/editNovel/editNovelRules.php
Mostafaramdan/rewayaty
8a393f3920c0425490c178f41e8c7605219d9337
[ "MIT" ]
null
null
null
app/Http/Controllers/Apis/Controllers/editNovel/editNovelRules.php
Mostafaramdan/rewayaty
8a393f3920c0425490c178f41e8c7605219d9337
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers\Apis\Controllers\editNovel; use App\Http\Controllers\Apis\Controllers\index; use App\Http\Controllers\Apis\Resources\objects; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Http\Controllers\Apis\Helper\helper; class editNovelRules extends index { public static function rules () { $rules=[ "apiToken" =>"required|exists:users,apiToken", "novelId" =>"required|exists:novels,id", "isDraft" =>"in:0,1", "novel.backgroundId" =>"exists:backgrounds,id", "novel.fontId" =>"exists:fonts,id", "novel.musicId" =>"exists:musics,id", "novel.effectId" =>"exists:effects,id", "novel.name" =>"nullable", "novel.description" =>"nullable", "novel.keywords" =>"nullable", "novel.cover_image" =>"nullable", "novel.categoryId" =>"exists:categories,id", "novel.id" =>"exists:novels,id", "novel.isDraft" =>"in:0,1", ]; $messages=[ "apiToken.required" =>400, "apiToken.exists" =>405, "isDraft" =>405, "novelId.required" =>400, "novelId.exists" =>405, "novel.backgroundId.required" =>400, "novel.backgroundId.exists" =>405, "novel.fontId.required" =>400, "novel.fontId.exists" =>405, "novel.musicId.required" =>400, "novel.musicId.exists" =>405, "novel.effectId.required" =>400, "novel.effectId.exists" =>405, "novel.backgroundId.required" =>400, "novel.backgroundId.exists" =>405, "novel.name.required" =>400, "novel.description.required" =>400, "novel.keywords.required" =>400, "novel.cover_image.required" =>400, "novel.categoryId.required" =>400, "novel.categoryId.exists" =>405, "novel.id.required" =>400, "novel.id.exists" =>405, "novel.isDraft.required" =>400, "novel.isDraft.in" =>405, ]; $messagesAr=[ "apiToken.required" =>"يجب إدخال التوكن", "apiToken.exists" =>"توكن غير موجود", "apiToken.required" =>"يجب إدخال رقم الرواية", "apiToken.exists" =>"رقم الرواية غير موجود", "novel.backgroundId.required" =>"يجب ادخال رقم خلفية الرواية", "novel.backgroundId.exists" =>"novel.backgroundId", "novel.fontId.required" =>"novel.fontId", "novel.fontId.exists" =>"novel.fontId.exists", "novel.musicId.required" =>"novel.musicId.required", "novel.musicId.exists" =>"novel.musicId.exists", "novel.effectId.required" =>"novel.effectId.required", "novel.effectId.exists" =>"novel.effectId.exists", "novel.backgroundId.required" =>"novel.backgroundId.required", "novel.backgroundId.exists" =>"novel.backgroundId.exists", "novel.name.required" =>"novel.name.required", "novel.description.required" =>"novel.description.required", "novel.keywords.required" =>"novel.keywords.required", "novel.cover_image.required" =>"cover_image.required", "novel.categoryId.required" =>"categoryId.required", "novel.categoryId.exists" =>"categoryId.exists", "novel.id.required" =>"id.required", "novel.id.exists" =>"id.exists", "novel.isDraft.required" =>"isDraft.required", "novel.isDraft.in" =>"isDraft.in", ]; $messagesEn=[ ]; $ValidationFunction=self::$request->showAllErrors==1?"showAllErrors":"Validator"; $Validation = helper::{$ValidationFunction}(self::$request->all(), $rules, $messages,self::$lang=="ar"?$messagesAr:$messagesEn); if ($Validation !== null) { return $Validation; } return helper::validateAccount()??null; } }
37.125
136
0.483586
6d1d800bf51d203c3f31540056a19c3ea2cc850b
10,894
tsx
TypeScript
src/components/Toolbox/ToolboxTerrainPanel.tsx
riknoll/pxt-level-editor
ee1eae9b6064b71dc32553ad0999b7e7d09c1192
[ "MIT" ]
4
2019-07-22T18:03:01.000Z
2019-12-06T15:09:12.000Z
src/components/Toolbox/ToolboxTerrainPanel.tsx
riknoll/pxt-level-editor
ee1eae9b6064b71dc32553ad0999b7e7d09c1192
[ "MIT" ]
46
2019-07-22T18:05:35.000Z
2019-08-20T18:27:41.000Z
src/components/Toolbox/ToolboxTerrainPanel.tsx
riknoll/pxt-level-editor
ee1eae9b6064b71dc32553ad0999b7e7d09c1192
[ "MIT" ]
11
2019-07-22T18:20:35.000Z
2020-06-19T20:50:18.000Z
import * as React from 'react'; import { ToolboxPanel } from './ToolboxPanel'; import { GestureTarget, ClientCoordinates, clientCoord, bindGestureEvents } from '../../util'; import { MapRect, Layer } from '../../map'; import { Project, ProjectSprite, isSpriteSheetReference, SpriteSheetReference } from '../../project'; import { dispatchChangeActiveLayer } from '../../actions/dispatch'; import { IStore } from '../../store/reducer'; import { connect } from 'react-redux'; interface TerrainPanelProps { project: Project; onChange: (selection: number[][]) => void; activeLayer: Layer; dispatchChangeActiveLayer: (layer: Layer) => void; } interface TilesetReference { index: number; sprite: ProjectSprite; } export class ToolboxTerrainPanelImpl extends React.Component<TerrainPanelProps, {}> implements GestureTarget { protected canvas: HTMLCanvasElement; protected selectedTile: number; protected scale: number; protected selectionStart: {row: number, col: number}; protected selectedArea: MapRect; protected rows: number; protected grid: TilesetReference[][]; get columns(): number { return this.grid ? this.grid.length : 0; } constructor(props: TerrainPanelProps) { super(props); this.selectedArea = { top: 0, right: 0, bottom: 0, left: 0, width: 1, height: 1, }; this.props.onChange(this.getTileSelection()); this.scale = 2; } render() { const { activeLayer } = this.props; return ( <ToolboxPanel showHeader={activeLayer === null} expanded={activeLayer === Layer.Terrain} onTitleClick={this.onTitleClick} title="Terrain"> {/* <ToolboxPanelGrid tiles={this.state.tiles} ></ToolboxPanelGrid> */} <canvas ref={this.handleCanvasRef}/> </ToolboxPanel> ); } protected onTitleClick = () => { const { dispatchChangeActiveLayer, activeLayer } = this.props; dispatchChangeActiveLayer(Layer.Terrain === activeLayer ? null : Layer.Terrain); } componentDidMount() { this.setTiles(); } componentDidUpdate() { this.setTiles(); } handleCanvasRef = (ref: HTMLCanvasElement) => { if (ref) { this.canvas = ref; bindGestureEvents(this.canvas, this); } } redraw() { if (!this.grid) return; const proj = this.props.project; this.canvas.width = proj.tileSize * this.scale * 7; this.canvas.height = proj.tileSize * this.scale * this.rows; const ctx = this.canvas.getContext("2d"); ctx.imageSmoothingEnabled = false; ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); for (let c = 0; c < this.columns; c++) { for (let r = 0; r < this.rows; r++) { if (this.grid[c] && this.grid[c][r]) { this.drawTile(this.grid[c][r].sprite, c * proj.tileSize * this.scale, r * proj.tileSize * this.scale); } } } ctx.strokeStyle = "#9e9e9e"; ctx.setLineDash([1, 2]); for (let c = 1; c < 7; c++) { ctx.beginPath(); ctx.moveTo(this.scale * proj.tileSize * c, 0); ctx.lineTo(this.scale * proj.tileSize * c, this.canvas.height); ctx.stroke(); } for (let r = 0; r < this.rows; r++) { ctx.beginPath(); ctx.moveTo(0, this.scale * proj.tileSize * r); ctx.lineTo(this.canvas.width, this.scale * proj.tileSize * r); ctx.stroke(); } // for (let i = 0; i < proj.tiles.length; i++) { // this.drawTile(proj.tiles[i], proj.tileSize, i); // } ctx.setLineDash([]); ctx.strokeStyle = "red" let tileSize = this.props.project.tileSize * this.scale ctx.strokeRect( this.selectedArea.left * tileSize, this.selectedArea.top * tileSize, this.selectedArea.width * tileSize, this.selectedArea.height * tileSize ); } protected getTilePos(coord: ClientCoordinates) { // Convert local coordinates, to position (row, col) in the tileset return { row: Math.floor( coord.clientY / this.props.project.tileSize / this.scale), col: Math.floor( coord.clientX / this.props.project.tileSize / this.scale), } } protected getTileSelection() { const selection: number[][] = []; if (this.grid) { for (let c = 0; c < this.selectedArea.width; c++) { selection.push([]); for (let r = 0; r < this.selectedArea.height; r++) { const gc = c + this.selectedArea.left; const gr = r + this.selectedArea.top; selection[c][r] = (this.grid[gc] && this.grid[gc][gr]) ? this.grid[gc][gr].index : -1; } } } return selection; } protected setTiles() { if (this.props.project && this.canvas) { this.grid = layoutTiles(this.props.project.tiles); this.rows = 0; for (const column of this.grid) { if (column) this.rows = Math.max(column.length, this.rows); } this.redraw(); } } onClick(coord: ClientCoordinates) { let tilePos = this.getTilePos( this.coordGlobalToLocal(coord, this.canvas)); this.selectedArea = { top: tilePos.row, bottom: tilePos.row, left: tilePos.col, right: tilePos.col, width: 1, height: 1, }; this.props.onChange(this.getTileSelection()); this.redraw(); }; onDragStart(coord: ClientCoordinates) { this.selectionStart = this.getTilePos( this.coordGlobalToLocal(coord, this.canvas)); this.onDragMove(coord) }; onDragMove(coord: ClientCoordinates) { let tilePos = this.getTilePos( this.coordGlobalToLocal(coord, this.canvas)); this.selectedArea.right = Math.min( Math.max(this.selectionStart.col, tilePos.col), this.columns - 1 ); this.selectedArea.bottom = Math.min( Math.max(this.selectionStart.row, tilePos.row), this.rows - 1 ); this.selectedArea.left = Math.max( Math.min(this.selectionStart.col, tilePos.col), 0 ); this.selectedArea.top = Math.max( Math.min(this.selectionStart.row, tilePos.row), 0 ); this.selectedArea.width = this.selectedArea.right - this.selectedArea.left + 1; this.selectedArea.height = this.selectedArea.bottom - this.selectedArea.top + 1; this.props.onChange(this.getTileSelection()); this.redraw(); }; onDragEnd(coord: ClientCoordinates) {}; protected coordGlobalToLocal( coord: ClientCoordinates, local: HTMLElement): ClientCoordinates { let rect = local.getBoundingClientRect() return { clientX: coord.clientX - rect.left, clientY: coord.clientY - rect.top, } } protected drawTile(sprite: ProjectSprite, x: number, y: number) { const ctx = this.canvas.getContext("2d"); ctx.imageSmoothingEnabled = false; if (isSpriteSheetReference(sprite)) { ctx.drawImage( sprite.sheet.loaded, sprite.x, sprite.y, sprite.width, sprite.height, x, y, sprite.width * this.scale, sprite.height * this.scale ); } else { ctx.drawImage(sprite.loaded, x, y); } } } class TileGroup { tiles: TilesetReference[]; columns: number; rows: number; originX: number; originY: number; constructor(public group: string, public tileSize: number) { this.tiles = []; } calculateDimensions() { if (!this.tiles.length) return; let minX = (this.tiles[0].sprite as SpriteSheetReference).x; let minY = (this.tiles[0].sprite as SpriteSheetReference).y; let maxX = (this.tiles[0].sprite as SpriteSheetReference).x; let maxY = (this.tiles[0].sprite as SpriteSheetReference).y; for (const sprite of this.tiles) { minX = Math.min((sprite.sprite as SpriteSheetReference).x, minX); minY = Math.min((sprite.sprite as SpriteSheetReference).y, minY); maxX = Math.max((sprite.sprite as SpriteSheetReference).x + this.tileSize, maxX); maxY = Math.max((sprite.sprite as SpriteSheetReference).y + this.tileSize, maxY); } this.originX = minX; this.originY = minY; this.columns = Math.ceil((maxX - minX) / this.tileSize); this.rows = Math.ceil((maxY - minY) / this.tileSize); } } function layoutTiles(refs: ProjectSprite[]): TilesetReference[][] { const groups: {[index: string]: TileGroup} = {}; const unsorted: TilesetReference[] = []; for (let i = 0; i < refs.length; i++) { const ref = refs[i]; if (isSpriteSheetReference(ref) && ref.group) { if (!groups[ref.group]) groups[ref.group] = new TileGroup(ref.group, ref.width); groups[ref.group].tiles.push({ index: i, sprite: ref}); } else { unsorted.push({ index: i, sprite: ref }); } } const groupList = Object.keys(groups).map(k => groups[k]); groupList.forEach(g => g.calculateDimensions()); const spriteGrid: TilesetReference[][] = []; let top = 0; for (const group of groupList) { for (const tile of group.tiles) { const col = ((tile.sprite as SpriteSheetReference).x - group.originX) / group.tileSize; const row = ((tile.sprite as SpriteSheetReference).y - group.originY) / group.tileSize; if (!spriteGrid[col]) spriteGrid[col] = []; spriteGrid[col][top + row] = tile; } top += group.rows; } for (let i = 0; i < unsorted.length; i++) { const col = i % spriteGrid.length; const row = Math.floor(i / spriteGrid.length); spriteGrid[col][top + row] = unsorted[i]; } return spriteGrid; } function mapStateToProps(state: IStore) { if (!state) return {}; return { activeLayer: state.activeLayer }; } const mapDispatchToProps = { dispatchChangeActiveLayer }; export const ToolboxTerrainPanel = connect(mapStateToProps, mapDispatchToProps)(ToolboxTerrainPanelImpl);
30.515406
150
0.564164
d99bba035158c1888834fef0fcd1f8ba02b65298
2,240
swift
Swift
demo/Sources/ConcurrencyWithGCD/main.swift
taka1068/iOSDC-2020-demo
ace489cc960632484a1307d89a267d1038682b64
[ "Unlicense" ]
2
2020-09-20T03:22:11.000Z
2022-02-17T05:13:08.000Z
demo/Sources/ConcurrencyWithGCD/main.swift
taka1068/iOSDC-2020-demo
ace489cc960632484a1307d89a267d1038682b64
[ "Unlicense" ]
null
null
null
demo/Sources/ConcurrencyWithGCD/main.swift
taka1068/iOSDC-2020-demo
ace489cc960632484a1307d89a267d1038682b64
[ "Unlicense" ]
null
null
null
import Foundation concurrentMapBenchmark() let array = createIntArray(count: 1_0000_0000, upperBound: nil) let swiftSort = benchmark(array: array, title: "swift sort") { array in array.sort() } let quicksort = benchmark(array: array, title: "quick sort") { array in array.withContiguousMutableStorageIfAvailable { buffer in quickSort(buffer, low: 0, high: buffer.count - 1) } } let parallel1 = benchmark(array: array, title: "parallel quick sort 1") { array in let queue = DispatchQueue(label: "quicksort1", attributes: .concurrent) let group = DispatchGroup() array.withContiguousMutableStorageIfAvailable { buffer in parallelQuickSort1(buffer, low: 0, high: buffer.count - 1, queue: queue, group: group) group.wait() } } let parallel2 = benchmark(array: array, title: "parallel quick sort 2") { array in let queue = DispatchQueue(label: "quicksort2", attributes: .concurrent) let group = DispatchGroup() let semaphore = DispatchSemaphore(value: 8) // ProcessInfo().activeProcessorCount / 2 など array.withContiguousMutableStorageIfAvailable { buffer in parallelQuickSort2(buffer, low: 0, high: buffer.count - 1, queue: queue, group: group, semaphore: semaphore) group.wait() } } let performFurtherBenchmarkTests = false guard performFurtherBenchmarkTests else { exit(0) } let semCountUpperBound = ProcessInfo().activeProcessorCount * 2 var results = [[Int]]() for sem in 1..<semCountUpperBound { let result = benchmark(array: array, title: "parallel quick sort 2 with semaphore \(sem)") { array in let queue = DispatchQueue(label: "quicksort2", attributes: .concurrent) let group = DispatchGroup() let semaphore = DispatchSemaphore(value: sem) array.withContiguousMutableStorageIfAvailable { buffer in parallelQuickSort2(buffer, low: 0, high: buffer.count - 1, queue: queue, group: group, semaphore: semaphore) group.wait() } } results.append(result) } print(results.allSatisfy {$0 == swiftSort}) benchmark(title: "false sharing1", f: { falseSharing1() }) benchmark(title: "false sharing2", f: { falseSharing2() })
29.866667
120
0.686161
dadaad9759e83fd438ba1932433a8caa707f8674
5,640
swift
Swift
Ahobsu/MotiViews/Main/AnswerQuestion/AnswerInsertViews/AnswerInsertEssayCameraView.swift
mash-up-kr/Ahobsu_iOS
8d7542cb0320ede7eee25923f280b1d781bd5c25
[ "MIT" ]
9
2019-12-16T14:23:28.000Z
2020-05-03T01:00:10.000Z
Ahobsu/MotiViews/Main/AnswerQuestion/AnswerInsertViews/AnswerInsertEssayCameraView.swift
mash-up-kr/Ahobsu_iOS
8d7542cb0320ede7eee25923f280b1d781bd5c25
[ "MIT" ]
39
2019-11-23T07:05:10.000Z
2020-11-14T17:32:27.000Z
Ahobsu/MotiViews/Main/AnswerQuestion/AnswerInsertViews/AnswerInsertEssayCameraView.swift
mash-up-kr/Ahobsu_iOS
8d7542cb0320ede7eee25923f280b1d781bd5c25
[ "MIT" ]
1
2021-12-23T09:01:37.000Z
2021-12-23T09:01:37.000Z
// // AnswerInsertEssayCameraView.swift // Ahobsu // // Created by 이호찬 on 2020/02/09. // Copyright © 2020 ahobsu. All rights reserved. // import SwiftUI struct AnswerInsertEssayCameraView: View { @Binding var image: UIImage? @ObservedObject var keyboard: Keyboard = Keyboard() @ObservedObject var answerQuestion = AnswerQuestion() @State var text = "" var missionData: Mission @State var isNetworking: Bool = false @State var answerRegisteredActive: Bool = false var body: some View { NavigationMaskingView(titleItem: Text("답변하기"), trailingItem: EmptyView()) { ZStack { BackgroundView() .edgesIgnoringSafeArea([.vertical]) ZStack { VStack { HStack { Text(missionData.title) .font(.custom("IropkeBatangOTFM", size: 24.0)) .lineSpacing(6) .foregroundColor(Color(.rosegold)) .multilineTextAlignment(.leading) Spacer() } Spacer() ZStack { CardView(innerLine: true) .padding([.horizontal], 12) .offset(x: 0, y: 60) VStack { Image(uiImage: image ?? UIImage()) .resizable() .aspectRatio(1, contentMode: .fill) .cornerRadius(6) .padding(.horizontal, 34) // .padding(.vertical, 22) // ZStack { if text == "" && keyboard.state.height == 0 { VStack { Text("여기를 눌러 질문에 대한\n답을 적어주세요.") .font(.custom("IropkeBatangOTFM", size: 16.0)) .lineSpacing(8.0) .foregroundColor(Color(.placeholderblack)) .multilineTextAlignment(.center) .padding(EdgeInsets(top: 100 + (keyboard.state.height == 0 ? 100 : -100 + keyboard.state.height), leading: 28, bottom: 32, trailing: 28)) Spacer() } } TextView(text: $text) .padding(EdgeInsets(top: 100 + (keyboard.state.height == 0 ? 100 : -100 + keyboard.state.height), leading: 28, bottom: 32, trailing: 28)) // } Spacer() NavigationLink(destination: AnswerRegisteredView(), isActive: $answerRegisteredActive) { MainButton(action: { self.requestAnswer() }, title: "제출하기") } Spacer().frame(height: 32) } } } .padding([.horizontal], 20) } .offset(x: 0, y: keyboard.state.height == 0 ? keyboard.state.height : -keyboard.state.height) .edgesIgnoringSafeArea((keyboard.state.height > 0) ? [.bottom] : []) .animation(.easeOut(duration: keyboard.state.animationDuration)) } .onTapGesture { self.endEditing() } } } private func requestAnswer() { guard let image = image else { return } self.isNetworking = true AhobsuProvider.registerAnswer(missionId: missionData.id, contentOrNil: text, imageOrNil: image, completion: { wrapper in if let _ = wrapper?.data { self.answerRegisteredActive = true } else { // print(wrapper?.message ?? "None") } self.isNetworking = false }, error: { _ in self.isNetworking = false }, expireTokenAction: { }, filteredStatusCode: nil) } private func endEditing() { UIApplication.shared.endEditing() } } //struct AnswerInsertEssayCameraView_Previews: PreviewProvider { // static var previews: some View { // AnswerInsertEssayCameraView() // } //}
44.0625
145
0.360284
7f6cd2bcd925724cc3f4db9b96172da63616b6c1
200
lua
Lua
Blizzlike/ArcEmu/Scripts/Zones/Outland/Shadowmoon Valley/ISoldier.lua
499453466/Lua-Other
43fd2b72405faf3f2074fd2a2706ef115d16faa6
[ "Unlicense" ]
2
2015-06-23T16:26:32.000Z
2019-06-27T07:45:59.000Z
Blizzlike/ArcEmu/Scripts/Zones/Outland/Shadowmoon Valley/ISoldier.lua
Eduardo-Silla/Lua-Other
db610f946dbcaf81b3de9801f758e11a7bf2753f
[ "Unlicense" ]
null
null
null
Blizzlike/ArcEmu/Scripts/Zones/Outland/Shadowmoon Valley/ISoldier.lua
Eduardo-Silla/Lua-Other
db610f946dbcaf81b3de9801f758e11a7bf2753f
[ "Unlicense" ]
3
2015-01-10T18:22:59.000Z
2021-04-27T21:28:28.000Z
function ISoldier_OnEnterCombat(Unit,Event) if Unit:GetHealthPct() == 92 then Unit:FullCastSpellOnTarget(35871,Unit:GetClosestPlayer()) end end RegisterUnitEvent(22075, 1, "ISoldier_OnEnterCombat")
28.571429
58
0.82
0df5349f3994f8f7511a6b04ca743c6738f5784b
773
swift
Swift
Code/Shared/Station.swift
yannikbloscheck/Abfahrten
81303aab1edc01ea6cf0e12dfea835e8da948072
[ "MIT" ]
2
2018-07-14T00:11:25.000Z
2020-05-11T08:39:54.000Z
Code/Shared/Station.swift
yannikbloscheck/Abfahrten
81303aab1edc01ea6cf0e12dfea835e8da948072
[ "MIT" ]
1
2021-07-24T17:04:43.000Z
2021-07-25T08:28:57.000Z
Code/Shared/Station.swift
yannikbloscheck/Abfahrten
81303aab1edc01ea6cf0e12dfea835e8da948072
[ "MIT" ]
null
null
null
import Foundation /// A station /// - Copyright: © Yannik Bloscheck - All rights reserved /// - Since: 2018-06-18 struct Station: Equatable, Codable { // MARK: Properties /// The name of the station let name: String /// The creation date of the data let date: Date /// The departures from the station let departures: [Departure] // MARK: Initialization /// Initalize a departure /// - Parameter name: A name for the station /// - Parameter date: A creation date of the data /// - Parameter departures: Departures from the station init(name: String, date: Date, departures: [Departure]) { self.name = name self.date = date self.departures = departures } }
20.342105
61
0.610608
c9f29e3a66fdb4897ab03cad07b1f89c5b21c25f
617
tsx
TypeScript
src/components/badge/index.tsx
draekien/draekien-ui
3f0f2c84cd0a0c91229f7067eb05c69fdefdad49
[ "MIT" ]
2
2020-11-21T14:44:17.000Z
2020-12-17T02:51:17.000Z
src/components/badge/index.tsx
draekien/draekien-ui
3f0f2c84cd0a0c91229f7067eb05c69fdefdad49
[ "MIT" ]
26
2020-11-21T12:50:05.000Z
2021-01-09T01:22:02.000Z
src/components/badge/index.tsx
draekien/draekien-ui
3f0f2c84cd0a0c91229f7067eb05c69fdefdad49
[ "MIT" ]
null
null
null
/** @jsxImportSource theme-ui */ import { Box } from 'theme-ui'; import * as React from 'react'; import * as styles from './index.styles'; import { colors } from '../theme/colors'; export type BadgeProps = { /** color of the badge * @default 'primary' */ color?: keyof typeof colors | string; /** the position of the badge * @example { 'right' : 0 } */ position?: styles.BadgePosition; children?: React.ReactNode; }; export const Badge: React.FC<BadgeProps> = ({ color, position, children }) => { return <Box sx={styles.badgeCss(color, position)}>{children}</Box>; }; export default Badge;
25.708333
79
0.649919
c3e0aa0368f4029775bb98bf281cfe3f9df48431
1,357
cs
C#
Seal.Platform.Direct2D/Engine.cs
denismaster/Seal
13d84c6605b8964ea4ef46fdfdef5d6800dc3177
[ "MIT" ]
null
null
null
Seal.Platform.Direct2D/Engine.cs
denismaster/Seal
13d84c6605b8964ea4ef46fdfdef5d6800dc3177
[ "MIT" ]
3
2016-01-19T22:54:25.000Z
2016-09-22T21:41:37.000Z
Seal.Platform.Direct2D/Engine.cs
denismaster/Seal
13d84c6605b8964ea4ef46fdfdef5d6800dc3177
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Seal.Platform; using D2D = SharpDX.Direct2D1; using DW = SharpDX.DirectWrite; using WIC = SharpDX.WIC; namespace Seal.Platform.Direct2D { public class Engine:IEngine { private readonly D2D.Factory s_d2D1Factory = new D2D.Factory(); private readonly DW.Factory s_dwfactory = new DW.Factory(); private readonly WIC.ImagingFactory s_imagingFactory = new WIC.ImagingFactory(); public IRenderTarget CreateRenderTarget(IPlatformHandle handle, int width, int height) { if (handle.Type == PlatformType.D2D) return new Direct2D.RenderTarget(s_d2D1Factory, handle.Handle,width, height); else throw new NotSupportedException(String.Format("Cannot create {0} target with D2D Engine",handle.Type)); } public Seal.Geometries.IGeometryManager CreateGeometryManager() { return new Geometries.GeometryManager(this.s_d2D1Factory); } public Images.IBitmapProvider CreateBitmapProvider() { throw new NotImplementedException(); } public Seal.Geometries.IPath CreateStreamGeometry() { return new Path(this.s_d2D1Factory); } } }
32.309524
119
0.672808
dc04c6d66cb0d2c520002bc18e6050df84e568bf
481
rb
Ruby
lib/test_kitchen_chef_minitest_matchers.rb
promisedlandt/test_kitchen_chef_minitest_matchers
333e736a2d13d04c1b0e23293a14ba233da1b86a
[ "MIT" ]
null
null
null
lib/test_kitchen_chef_minitest_matchers.rb
promisedlandt/test_kitchen_chef_minitest_matchers
333e736a2d13d04c1b0e23293a14ba233da1b86a
[ "MIT" ]
null
null
null
lib/test_kitchen_chef_minitest_matchers.rb
promisedlandt/test_kitchen_chef_minitest_matchers
333e736a2d13d04c1b0e23293a14ba233da1b86a
[ "MIT" ]
null
null
null
# Specified in Gemfile require "mixlib/shellout" # Internal stuff require "test_kitchen_chef_minitest_matchers/version" require "test_kitchen_chef_minitest_matchers/chef_gem" # rubocop:disable HandleExceptions # Development stuff, can't be loaded in production, but that's fine %w(byebug).each do |development_gem| begin require development_gem rescue LoadError end end # rubocop:enable HandleExceptions # @author Nils Landt module TestKitchenChefMinitestMatchers end
22.904762
67
0.817048
e4ef8349fafd0025f506afd459c62f3dc5a63774
153
c
C
CourseWork/networks/MA61010/semaphore/client1.c
ank247/ComputerNetworks
b8e7185b2c436de6df00c95dbdc1ef9a231c9056
[ "MIT" ]
2
2018-02-17T12:50:57.000Z
2019-04-03T07:41:51.000Z
CourseWork/networks/MA61010/semaphore/client1.c
ank247/IITKGP
b8e7185b2c436de6df00c95dbdc1ef9a231c9056
[ "MIT" ]
null
null
null
CourseWork/networks/MA61010/semaphore/client1.c
ank247/IITKGP
b8e7185b2c436de6df00c95dbdc1ef9a231c9056
[ "MIT" ]
null
null
null
#include<stdio.h> #include<sys/sem.h> main() { int q,y; printf("Give semaphore no"); scanf("%d",&q); y=semctl(q,0,GETVAL,0); printf("%d",y); }
9.5625
29
0.575163
14dc515705a09f251494a6a59a180bd3dcb47812
307
ts
TypeScript
api/services/ChatService/getChatMembers.ts
v2land/v2land-redstone
4c408c83290229e1f8aef32a7ff6d99efef112c5
[ "MIT" ]
13
2017-12-11T02:11:52.000Z
2019-08-13T09:04:02.000Z
api/services/ChatService/getChatMembers.ts
v2land/v2land-redstone
4c408c83290229e1f8aef32a7ff6d99efef112c5
[ "MIT" ]
64
2017-12-09T19:30:18.000Z
2020-05-19T03:52:32.000Z
api/services/ChatService/getChatMembers.ts
v2land/v2land-redstone
4c408c83290229e1f8aef32a7ff6d99efef112c5
[ "MIT" ]
5
2018-02-03T05:33:26.000Z
2020-05-01T09:06:49.000Z
import { ChatMember } from '@Models'; import { getChatId } from './utils'; export const getChatMembers = async (type: 'client' | 'newsroom', ids: number | number[]) => { const chatId = getChatId(type, ids); const members = await ChatMember.findAll({ where: { chatId }, }); return members; };
23.615385
94
0.644951
dbe0cf71f11ccc41a2131d8683ad90dcb6c15649
1,170
cs
C#
Biz.Morsink.CodeGeneration.CSharp/SyntaxBuilder.BlockBuilder.cs
joost-morsink/Biz.Morsink.CodeGeneration.CSharp
fccf557a00fa8d789832eb691a7016d8cf0688d0
[ "MIT" ]
null
null
null
Biz.Morsink.CodeGeneration.CSharp/SyntaxBuilder.BlockBuilder.cs
joost-morsink/Biz.Morsink.CodeGeneration.CSharp
fccf557a00fa8d789832eb691a7016d8cf0688d0
[ "MIT" ]
6
2020-05-29T18:02:08.000Z
2020-05-30T03:57:32.000Z
Biz.Morsink.CodeGeneration.CSharp/SyntaxBuilder.BlockBuilder.cs
joost-morsink/Biz.Morsink.CodeGeneration.CSharp
fccf557a00fa8d789832eb691a7016d8cf0688d0
[ "MIT" ]
1
2020-05-22T13:56:08.000Z
2020-05-22T13:56:08.000Z
using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis.CSharp.Syntax; using SF = Microsoft.CodeAnalysis.CSharp.SyntaxFactory; namespace Biz.Morsink.CodeGeneration.CSharp { public static partial class SyntaxBuilder { public struct BlockBuilder : IStatementBuilder { private ImmutableList<IStatementBuilder> _statements; public static BlockBuilder Create() => new BlockBuilder(ImmutableList<IStatementBuilder>.Empty); private BlockBuilder(ImmutableList<IStatementBuilder> statements) { _statements = statements; } public BlockBuilder Add(params IStatementBuilder[] statements) => Add(statements.AsEnumerable()); public BlockBuilder Add(IEnumerable<IStatementBuilder> statements) => new BlockBuilder(_statements.AddRange(statements)); public BlockSyntax Build() => SF.Block(SF.List(_statements.Select(s => s.Build()))); StatementSyntax IStatementBuilder.Build() => Build(); } } }
34.411765
108
0.65641
2cb925922e5aab8253a8ee29367255f1a2b29f6b
8,461
cpp
C++
CocosWidget/Slider.cpp
LingJiJian/Tui-x
e00e79109db466143ed2b399a8991be4e5fea28f
[ "MIT" ]
67
2015-02-09T03:20:59.000Z
2022-01-17T05:53:07.000Z
CocosWidget/Slider.cpp
fuhongxue/Tui-x
9b288540a36942dd7f3518dc3e12eb2112bd93b0
[ "MIT" ]
3
2015-04-14T01:47:27.000Z
2016-03-15T06:56:04.000Z
CocosWidget/Slider.cpp
fuhongxue/Tui-x
9b288540a36942dd7f3518dc3e12eb2112bd93b0
[ "MIT" ]
34
2015-02-18T04:42:07.000Z
2019-08-15T05:34:46.000Z
/**************************************************************************** Copyright (c) 2014 Lijunlin - Jason lee Created by Lijunlin - Jason lee on 2014 jason.lee.c@foxmail.com http://www.cocos2d-x.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "Slider.h" NS_CC_WIDGET_BEGIN CSlider::CSlider() : m_pSlider(NULL) , m_bDrag(false) { setThisObject(this); } CSlider::~CSlider() { } CSlider* CSlider::create() { CSlider* pRet = new CSlider(); if( pRet && pRet->init() ) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; } CSlider* CSlider::create(const char* pSlider, const char* pProgress) { CSlider* pRet = new CSlider(); if( pRet && pRet->initWithSlider(pSlider, pProgress) ) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; } bool CSlider::initWithSlider(const char* pSlider, const char* pProgress) { setSliderImage(pSlider); if( initWithFile(pProgress) ) { return true; } return false; } CSlider* CSlider::createSpriteFrame(const char* pSlider, const char* pProgress) { CSlider* pRet = new CSlider(); if (pRet && pRet->initWithSliderSpriteFrame(pSlider, pProgress)) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; } bool CSlider::initWithSliderSpriteFrame(const char* pSlider, const char* pProgress) { setSliderSpriteFrameName(pSlider); if (initWithFileSpriteFrame(pProgress)) { return true; } return false; } void CSlider::setContentSize(const Size& tSize) { if( m_pSlider && m_pProgressSprite ) { const Size& tSliderSize = m_pSlider->getContentSize(); Size tTargetSize; tTargetSize.width = m_tProgressSize.width + tSliderSize.width; tTargetSize.height = m_tProgressSize.height + tSliderSize.height; CProgressBar::setContentSize(tTargetSize); return; } CProgressBar::setContentSize(tSize); } int CSlider::valueFromPercent(float fPercentage) { return (int)(fPercentage * m_nMaxValue); } int CSlider::valueFromPoint(const Vec2& tPoint) { int nRet = 0; switch( m_eDirection ) { case eProgressBarDirectionLeftToRight: { float fHalfWidth = m_tProgressSize.width / 2; if( tPoint.x < m_tCenterPoint.x - fHalfWidth ) { nRet = m_nMinValue; break; } if( tPoint.x > m_tCenterPoint.x + fHalfWidth ) { nRet = m_nMaxValue; break; } float fStartPoint = tPoint.x - (m_tCenterPoint.x - fHalfWidth); float fPercentage = fStartPoint / m_tProgressSize.width; nRet = valueFromPercent(fPercentage); } break; case eProgressBarDirectionRightToLeft: { float fHalfWidth = m_tProgressSize.width / 2; if( tPoint.x < m_tCenterPoint.x - fHalfWidth ) { nRet = m_nMaxValue; break; } if( tPoint.x > m_tCenterPoint.x + fHalfWidth ) { nRet = m_nMinValue; break; } float fStartPoint = tPoint.x - (m_tCenterPoint.x - fHalfWidth); float fPercentage = (m_tProgressSize.width - fStartPoint) / m_tProgressSize.width; nRet = valueFromPercent(fPercentage); } break; case eProgressBarDirectionBottomToTop: { float fHalfHeight = m_tProgressSize.height / 2; if( tPoint.y < m_tCenterPoint.y - fHalfHeight ) { nRet = m_nMinValue; break; } if( tPoint.y > m_tCenterPoint.y + fHalfHeight ) { nRet = m_nMaxValue; break; } float fStartPoint = tPoint.y - (m_tCenterPoint.y - fHalfHeight); float fPercentage = fStartPoint / m_tProgressSize.height; nRet = valueFromPercent(fPercentage); } break; case eProgressBarDirectionTopToBottom: { float fHalfHeight = m_tProgressSize.height / 2; if( tPoint.y < m_tCenterPoint.y - fHalfHeight ) { nRet = m_nMaxValue; break; } if( tPoint.y > m_tCenterPoint.y + fHalfHeight ) { nRet = m_nMinValue; break; } float fStartPoint = tPoint.y - (m_tCenterPoint.y - fHalfHeight); float fPercentage = (m_tProgressSize.height - fStartPoint) / m_tProgressSize.height; nRet = valueFromPercent(fPercentage); } break; default: break; } return nRet; } CWidgetTouchModel CSlider::onTouchBegan(Touch *pTouch) { m_bDrag = m_pSlider->getBoundingBox().containsPoint( convertToNodeSpace(pTouch->getLocation()) ); if( m_bDrag ) { changeValueAndExecuteEvent(valueFromPoint(convertToNodeSpace(pTouch->getLocation())), true); return eWidgetTouchSustained; } return eWidgetTouchNone; } void CSlider::onTouchMoved(Touch *pTouch, float fDuration) { if( m_bDrag ) { changeValueAndExecuteEvent(valueFromPoint(convertToNodeSpace(pTouch->getLocation())), true); } } void CSlider::onTouchEnded(Touch *pTouch, float fDuration) { if( m_bDrag ) { changeValueAndExecuteEvent(valueFromPoint(convertToNodeSpace(pTouch->getLocation())), true); } } void CSlider::onTouchCancelled(Touch *pTouch, float fDuration) { if( m_bDrag ) { changeValueAndExecuteEvent(valueFromPoint(convertToNodeSpace(pTouch->getLocation())), true); } } void CSlider::pointFromValue(int nValue, Vec2& tOutPoint) { float fPercentage = getPercentage(); switch( m_eDirection ) { case eProgressBarDirectionLeftToRight: { tOutPoint.x = m_tProgressSize.width * fPercentage + (m_tCenterPoint.x - m_tProgressSize.width / 2); tOutPoint.y = m_tCenterPoint.y; } break; case eProgressBarDirectionRightToLeft: { tOutPoint.x = m_tProgressSize.width - (m_tProgressSize.width * fPercentage) + (m_tCenterPoint.x - m_tProgressSize.width / 2); tOutPoint.y = m_tCenterPoint.y; } break; case eProgressBarDirectionBottomToTop: { tOutPoint.x = m_tCenterPoint.x; tOutPoint.y = m_tProgressSize.height * fPercentage + (m_tCenterPoint.y - m_tProgressSize.height / 2); } break; case eProgressBarDirectionTopToBottom: { tOutPoint.x = m_tCenterPoint.x; tOutPoint.y = m_tProgressSize.height - (m_tProgressSize.height * fPercentage) + (m_tCenterPoint.y - m_tProgressSize.height / 2); } break; default: break; } } void CSlider::changeValueAndExecuteEvent(int nValue, bool bExeEvent) { CProgressBar::changeValueAndExecuteEvent(nValue, bExeEvent); if( m_pSlider ) { Vec2 tOutPoint; pointFromValue(m_nValue, tOutPoint); m_pSlider->setPosition(tOutPoint); } } void CSlider::setSliderImage(const char* pFile) { if( pFile && strlen(pFile) ) { Texture2D* pTexture = Director::getInstance()->getTextureCache()->addImage(pFile); setSliderTexture(pTexture); } } void CSlider::setSliderTexture(Texture2D* pTexture) { if( m_pSlider ) { m_pSlider->setTexture(pTexture); Rect tRect = Rect::ZERO; tRect.size = pTexture->getContentSize(); m_pSlider->setTextureRect(tRect); } else { m_pSlider = Sprite::createWithTexture(pTexture); addChild(m_pSlider, 2); } setContentSize(_contentSize); } void CSlider::setSliderSpriteFrame(SpriteFrame* pFrame) { if( pFrame ) { if( m_pSlider ) { m_pSlider->setSpriteFrame(pFrame); } else { m_pSlider = Sprite::createWithSpriteFrame(pFrame); addChild(m_pSlider,2); } } setContentSize(_contentSize); } void CSlider::setValue( int nValue ) { changeValueAndExecuteEvent(nValue, true); } void CSlider::setSliderSpriteFrameName(const char* pSpriteName) { SpriteFrame *pFrame = SpriteFrameCache::getInstance()->getSpriteFrameByName(pSpriteName); #if COCOS2D_DEBUG > 0 char msg[256] = {0}; sprintf(msg, "Invalid spriteFrameName: %s", pSpriteName); CCAssert(pFrame != NULL, msg); #endif return setSliderSpriteFrame(pFrame); } NS_CC_WIDGET_END
23.372928
131
0.714336
8cce7e9cb29bfc6757e22bb2ebbfd0e02e75686d
515
go
Go
central/sensor/service/connection/upgradecontroller/stateutils/matchers.go
embeddery/stackrox
d653406651df4331a714839ec2c0a23a93425c64
[ "Apache-2.0" ]
22
2022-03-31T14:32:18.000Z
2022-03-31T22:11:30.000Z
central/sensor/service/connection/upgradecontroller/stateutils/matchers.go
embeddery/stackrox
d653406651df4331a714839ec2c0a23a93425c64
[ "Apache-2.0" ]
5
2022-03-31T14:35:28.000Z
2022-03-31T22:40:13.000Z
central/sensor/service/connection/upgradecontroller/stateutils/matchers.go
embeddery/stackrox
d653406651df4331a714839ec2c0a23a93425c64
[ "Apache-2.0" ]
4
2022-03-31T16:33:58.000Z
2022-03-31T22:19:26.000Z
package stateutils import ( "github.com/stackrox/rox/generated/set" "github.com/stackrox/rox/generated/storage" "github.com/stackrox/rox/pkg/sensorupgrader" ) func anyStateFrom(desiredStates ...storage.UpgradeProgress_UpgradeState) *set.StorageUpgradeProgress_UpgradeStateSet { s := set.NewStorageUpgradeProgress_UpgradeStateSet(desiredStates...) return &s } func anyStageFrom(desiredStages ...sensorupgrader.Stage) *sensorupgrader.StageSet { s := sensorupgrader.NewStageSet(desiredStages...) return &s }
28.611111
118
0.803883
ddb911cc9b98bc330e914d2b3774e864a1b4febd
5,408
java
Java
model/src/main/java/com/baidu/rigel/biplatform/ac/model/Level.java
lxqfirst/bi-platform
803eda1875796743d335e167b9068d578bd75b0b
[ "Apache-2.0" ]
3
2015-09-29T09:18:58.000Z
2015-11-24T11:03:03.000Z
model/src/main/java/com/baidu/rigel/biplatform/ac/model/Level.java
lxqfirst/bi-platform
803eda1875796743d335e167b9068d578bd75b0b
[ "Apache-2.0" ]
null
null
null
model/src/main/java/com/baidu/rigel/biplatform/ac/model/Level.java
lxqfirst/bi-platform
803eda1875796743d335e167b9068d578bd75b0b
[ "Apache-2.0" ]
null
null
null
/** * Copyright (c) 2014 Baidu, Inc. All Rights Reserved. * * 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 com.baidu.rigel.biplatform.ac.model; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import com.baidu.rigel.biplatform.ac.exception.MiniCubeQueryException; import com.baidu.rigel.biplatform.ac.query.MiniCubeConnection; import com.baidu.rigel.biplatform.ac.query.data.DataSourceInfo; import com.baidu.rigel.biplatform.ac.query.data.vo.MetaJsonDataInfo; import com.baidu.rigel.biplatform.ac.query.model.ConfigQuestionModel; import com.baidu.rigel.biplatform.ac.query.model.DimensionCondition; import com.baidu.rigel.biplatform.ac.query.model.QueryData; import com.baidu.rigel.biplatform.ac.util.AnswerCoreConstant; import com.baidu.rigel.biplatform.ac.util.ConfigInfoUtils; import com.baidu.rigel.biplatform.ac.util.HttpRequest; import com.baidu.rigel.biplatform.ac.util.JsonUnSeriallizableUtils; import com.baidu.rigel.biplatform.ac.util.MetaNameUtil; import com.baidu.rigel.biplatform.ac.util.ResponseResult; import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.gson.reflect.TypeToken; /** * 维度的level定义:Level是指对同一维度的不同描述角度。如: 时间维度可以从年、季度、月份的角度进行描述。 需要注意的是:各个描述角度不在模型层面不存在父子关系。 而在存储方面,是存在父子关系的。 * 拿时间维度为例,把维度(时间)看作向量的起点,描述角度(年、季度、月份)看作向量的终点, 则年、季度、月份对应向量的长度均相等,只不过向量的方向不同。但是在业务处理过程中,通常统计 * 季度、月份会增加定语:哪一年的哪个季度、哪个月份,从而确定了物理存储模型中的父子关系。 * * @author xiaoming.chen * @see java.lang.Cloneable */ public interface Level extends OlapElement, Cloneable { /** * Level type * * @return level type */ LevelType getType(); /** * level belongs to dimension * * @return level dimension */ Dimension getDimension(); /** * 手动设置维度的Dimension * * @param dimension level所属的维度 */ void setDimension(Dimension dimension); /** * 取得level和事实表关联字段 * * @return 关联字段 */ String getFactTableColumn(); /** * levels members * * @return level members * @throws MiniCubeQueryException */ @JsonIgnore default List<Member> getMembers(Cube cube, DataSourceInfo dataSourceInfo, Map<String, String> params) throws MiniCubeQueryException { long current = System.currentTimeMillis(); ConfigQuestionModel questionModel = new ConfigQuestionModel(); questionModel.setCube(cube); questionModel.setDataSourceInfo(dataSourceInfo); questionModel.setRequestParams(params); DimensionCondition dimCondition = new DimensionCondition(this.getDimension().getName()); dimCondition.getQueryDataNodes().add(new QueryData(getUniqueName())); questionModel.getQueryConditions().put(dimCondition.getMetaName(), dimCondition); Map<String,String> requestParams = new HashMap<String, String>(); requestParams.put(MiniCubeConnection.QUESTIONMODEL_PARAM_KEY, AnswerCoreConstant.GSON.toJson(questionModel)); String response = HttpRequest.sendPost(ConfigInfoUtils.getServerAddress() + "/meta/getMembers", requestParams); ResponseResult responseResult = AnswerCoreConstant.GSON.fromJson(response, ResponseResult.class); if (StringUtils.isNotBlank(responseResult.getData())) { String memberListJson = responseResult.getData().replace("\\", ""); // memberListJson = memberListJson.substring(1, memberListJson.length() - 1); List<MetaJsonDataInfo> metaJsons = AnswerCoreConstant.GSON.fromJson(memberListJson, new TypeToken<List<MetaJsonDataInfo>>(){}.getType()); List<Member> members = new ArrayList<Member>(metaJsons.size()); if(CollectionUtils.isNotEmpty(metaJsons)){ metaJsons.forEach((metaJson) -> { members.add(JsonUnSeriallizableUtils.parseMetaJson2Member(cube, metaJson)); }); } StringBuilder sb = new StringBuilder(); sb.append("execute query questionModel:").append(questionModel).append(" cost:") .append(System.currentTimeMillis() - current).append("ms"); return members; } throw new MiniCubeQueryException("query occur error,msg:" + responseResult.getStatusInfo()); } /** * 维度表 * * @return 维度表表名 */ String getDimTable(); /** * 维度表与事实表关联的外键列 * * @return 维度表与事实表关联外键列 */ String getPrimaryKey(); @Override default public String getUniqueName() { return MetaNameUtil.makeUniqueName(getDimension(), getName()); } }
37.296552
150
0.680473
30eb571b711d5e5cc6004b7c1a998215b603a950
26,839
swift
Swift
Sources/BigNum/GenericMath.swift
WilsonGramer/swift-bignum
fac80dc46e0d99346c067b2ebb64a42b698bdec2
[ "MIT" ]
null
null
null
Sources/BigNum/GenericMath.swift
WilsonGramer/swift-bignum
fac80dc46e0d99346c067b2ebb64a42b698bdec2
[ "MIT" ]
null
null
null
Sources/BigNum/GenericMath.swift
WilsonGramer/swift-bignum
fac80dc46e0d99346c067b2ebb64a42b698bdec2
[ "MIT" ]
null
null
null
extension BigFloatingPoint { // constants /// √2 public static func SQRT2(precision px:Int=Self.precision, debug:Bool=false)->Self { let apx = Swift.abs(px) if apx <= SQRT2.precision { return SQRT2.value.truncated(width: apx) } SQRT2.precision = apx SQRT2.value = Self(2).squareRoot(precision: apx) return SQRT2.value } /// euler's constant public static func E(precision px:Int=Self.precision, debug:Bool=false)->Self { let apx = Swift.abs(px) if apx <= E.precision { return E.value.truncated(width: apx) } E.precision = apx E.value = E.value is BigRat ? { let epsilon = getEpsilon(precision: px) var (e, d) = (Self(1), Self(1)) for i in 1 ... apx { d *= Self(i) e += Self(1) / (d) if 1/d < epsilon { break } } return e.truncated(width: apx) }() : Self(BigRat.E(precision: apx)) return E.value } /// log(2) public static func LN2(precision px:Int=Self.precision, debug:Bool = false)->Self { let apx = Swift.abs(px) if apx <= LN2.precision { return LN2.value.truncated(width: apx) } LN2.precision = apx LN2.value = LN2.value is BigRat ? { let epsilon = getEpsilon(precision: px) var (t, r) = (Self(1)/Self(3), Self(1)/Self(3)) for i in 1...px { t *= Self(1)/Self(9) if debug { print("\(Self.self).LN2: i=\(i), r=~\(r)") } if t < epsilon { break } r = (r + t / Self(2 * i + 1)).truncated(width:px) } return (2*r).truncated(width: apx) }() : Self(BigRat.LN2(precision: apx)) return LN2.value } /// log(10) public static func LN10(precision px:Int=Self.precision, debug:Bool=false)->Self { let apx = Swift.abs(px) if apx <= LN10.precision { return LN10.value.truncated(width: apx) } LN10.precision = apx LN10.value = Self.log(10, precision:apx) return LN10.value } /// π/4 in precision `px`. Bellard's Formula public static func ATAN1(precision px:Int=Self.precision, debug:Bool=false)->Self { if leastNormalMagnitude != 0 { // FIXME: this trick is dirty return Self.pi / 4 } let apx = Swift.abs(px) if apx <= ATAN1.precision { return ATAN1.value.truncated(width: apx) } ATAN1.precision = apx ATAN1.value = ATAN1.value is BigRat ? { let epsilon = getEpsilon(precision: px) var p64 = Self(0) for i in 0..<Int(apx.magnitude) { var t = Self(0) t -= Self(1<<5) / Self( 4 * i + 1) t -= Self(1<<0) / Self( 4 * i + 3) t += Self(1<<8) / Self(10 * i + 1) t -= Self(1<<6) / Self(10 * i + 3) t -= Self(1<<2) / Self(10 * i + 5) t -= Self(1<<2) / Self(10 * i + 7) t += Self(1<<0) / Self(10 * i + 9) if 0 < i { t /= Self(IntType(1) << (10 * i)) } p64 += i & 1 == 1 ? -t : t // p64.truncate(px) if debug { print("\(Self.self).ATAN1(precision:\(px)):i=\(i),t.bits=\(t)") } // t.truncate(px) if t < epsilon { break } } p64 /= Self(1<<8) return p64.truncated(width: apx) }() : Self(BigRat.ATAN1(precision: apx)) return ATAN1.value } /// π in precision `px`. 4*atan(1) public static func PI(precision px:Int=Self.precision, debug:Bool=false)->Self { return ATAN1(precision: Swift.abs(px)) * 4 } } extension BigFloatingPoint { /// √x public static func sqrt(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { return x.squareRoot(precision: px) } /// sqrt(x*x + y*y) public static func hypot(_ x:Self, _ y:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { // return (x*x + y*y).squareRoot(precision: px) var (r, l) = (x < 0 ? -x : x, y < 0 ? -y : y) if r < l { (r, l) = (l, r) } if l == 0 { return r } let epsilon = getEpsilon(precision: px) while epsilon < l { var t = l / r t *= t t /= 4 + t r += 2 * r * t l *= t r.truncate(width:px) l.truncate(width:px) } return px < 0 ? r : r.truncated(width: px) } /// atan2 public static func atan2(y:Self, x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { // cf. https://en.wikipedia.org/wiki/Atan2 // https://www.freebsd.org/cgi/man.cgi?query=atan2 if x.isNaN || y.isNaN { return nan } let ysgn = Self(y.sign == .minus ? -1 : +1) let xsgn = Self(x.sign == .minus ? -1 : +1) let y_x = x.isInfinite && y.isInfinite ? ysgn * xsgn : y/x // avoid nan for ±inf/±inf if 0 < x { return atan(y_x, precision:px) } if x < 0 { return ysgn * (PI(precision:px) - atan(Swift.abs(y_x), precision:px)) } else { // x.isZero return ysgn * ( y.isZero ? (x.sign == .minus ? PI(precision:px) : 0) : PI(precision: px)/2 ) } } /// self ** n where n is an integer public func power(_ y:IntType, precision px:Int=Self.precision, debug:Bool=false)->Self { if self.isNaN || self.isInfinite || self.isZero { return Self(Double.pow(self.asDouble, Self(y).asDouble)) } if Self.expLimit < Swift.abs(Self.log(self) * Self(y)).asMixed.0 { return y < 0 ? 0 : +Self.infinity } if y == 0 { return 1 } if y < 0 { return 1/self.power(-y, precision:px) } var (i, r, x) = (y, Self(1), self) while i != 0 { if i & 1 == 1 { r *= x } x = (x * x).truncated(width: px*2) i >>= 1 } return r.truncated(width:px) } /// x ** y public static func pow(_ x:Self, _ y:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isNaN || x.isInfinite || x.isZero || y.isNaN || y.isInfinite || y.isZero { return Self(Double.pow(x.asDouble, y.asDouble)) } if Swift.abs(x) < 1 { return 1/pow(1/x, y, precision:px) } let (iy, fy) = y.asMixed if Int.max <= iy.magnitude { return iy < 0 ? 0 : infinity } let ir = x.power(iy, precision:px) if fy.isZero { return px < 0 ? ir : ir.truncated(width:px) } else { if x.isLess(than:0) { return nan } } let fr = exp(log(x, precision:px*2) * fy, precision:px*2) return px < 0 ? ir * fr : (ir * fr).truncated(width: px) } /// nth root of self public func nthroot(_ n:IntType, precision px:Int=Self.precision, debug:Bool=false)->Self { if self.isNaN { return Self.nan } if self.isZero { return self } if self == 1 { return 1 } if self < 0 { return -(-self).nthroot(n, precision:px) } return Self.pow(self, Self(1)/Self(n), precision:px) } /// cube root of self public static func cbrt(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { return x.nthroot(3, precision: px) } /// e ** x public static func exp(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isNaN { return nan } if x.isInfinite { return x.sign == .minus ? 0 : +infinity } if x.isZero { return 1 } if Self(expLimit) < Swift.abs(x) { return x.sign == .minus ? 0 : +Self.infinity } if x.isLess(than:0) { return 1/exp(-x, precision:px, debug:debug) } let e = E(precision: px * 2) let (ix, fx) = x.asMixed var (ir, fr) = (e.power(ix, precision:px), Self(1)) if !fr.isZero { let epsilon = getEpsilon(precision: px) var (n, d) = (Self(1), Self(1)) for i in 1 ... px.magnitude { n = (n * fx).truncated(width: px) d *= Self(i) let t = n / d if t < epsilon { break } fr = (fr + t).truncated(width: px) } } let r = ir * fr return 0 < px ? r : r.truncated(width:px) } /// exp(x) - 1 public static func expMinusOne(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isNaN { return nan } if x.isInfinite { return x.sign == .minus ? -1 : +infinity } if x.isZero { return x } if Self(expLimit) < Swift.abs(x) { return x.sign == .minus ? -1 : +Self.infinity } if LN2(precision: px) <= Swift.abs(x) { return exp(x, precision:px) - 1 } let epsilon = getEpsilon(precision: px) var (n, d, r) = (Self(1), Self(1), Self(0)) for i in 1 ... px.magnitude { n *= x d *= Self(i) let t = n / d r += t if t < epsilon { break } n.truncate(width: px * 2) r.truncate(width: px * 2) } return 0 < px ? r : r.truncated(width:px) } /// 2 ** x public static func exp2(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { // return exp(x * LN2(precision:px, debug:debug), precision:px, debug:debug) if x.isNaN { return nan } if x.isInfinite { return x.sign == .minus ? 0 : +infinity } if x.isZero { return 1 } if Self(expLimit) < Swift.abs(x) { return x.sign == .minus ? 0 : +Self.infinity } if x.isLess(than:0) { return 1/exp2(-x, precision:px, debug:debug) } let (ix, fx) = x.asMixed let (ir, fr) = ( Self(2.0).power(ix, precision:px), exp(fx * LN2(precision:px, debug:debug), precision:px, debug:debug) ) let r = ir * fr return 0 < px ? r : r.truncated(width:px) } /// binary log (base 2) -- steady but slow algorithm. use log2 public static func binaryLog(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isNaN { return nan } if x.isLess(than:0) { return nan } if x.isZero { return -infinity } if x.isInfinite { return +infinity } if x.isLess(than:1) { return -binaryLog(1/x, precision:px) } if x.isEqual(to:1) { return 0 } var (ilog, t) = (x.exponent, x.significand) if t < 1 { t *= Self(Self.radix); ilog -= 1 } var (offset, u) = (0, IntType(0)) for _ in offset+1 ..< Int(px.magnitude) { u <<= 1 t = (t * t).truncated(width: px) if 2 <= t { u += 1 t /= 2 } } let r = Self(IntType(ilog)) + Self(u) / Self(IntType(1) << Swift.abs(px)) return 0 < px ? r : r.truncated(width: px) } /// binary log public static func log2(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isNaN { return nan } if x.isLess(than:0) { return nan } if x.isZero { return -infinity } if x.isInfinite { return +infinity } let r = log(x, precision:px) / LN2(precision:px * 2) return 0 < px ? r : r.truncated(width: px) } /// natural log (base e) public static func log(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isNaN { return nan } if x.isLess(than:0) { return nan } if x.isZero { return -infinity } if x.isInfinite { return +infinity } if x.isLess(than:1) { return -log(1/x, precision:px) } if x.isEqual(to:1) { return 0 } let epsilon = getEpsilon(precision: px) let (_, ix, fx) = x.decomposed var t = (fx - 1) / (fx + 1) let t2 = t * t var fr = t for i in 1...px { t = (t * t2).truncated(width: px) if t < epsilon { break } fr = (fr + t / Self(2*i + 1)).truncated(width: px) } let r = Self(IntType(ix)) * LN2(precision: px) + 2 * fr return 0 < px ? r : r.truncated(width: px) } /// common log (base 10) public static func log10(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isNaN { return nan } if x.isLess(than:0) { return nan } if x.isZero { return -infinity } if x.isInfinite { return +infinity } let r = log(x, precision:px) / LN10(precision:px) return 0 < px ? r : r.truncated(width: px) } /// log(1 + x) public static func log1p(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isNaN { return nan } if x.isZero { return x } if x.isInfinite { return x.sign == .minus ? nan : +infinity } if (x + 1).isLess(than:0) { return nan } if (x + 1).isZero { return -infinity } let a = x/(x + 2) if debug { print("\(Self.self).log1p: x = ", x, "x/(x + 2) =", a) } if a.magnitude == 1 && !(x is BigRat) { // possible if Self is Fixed width Integer if debug { print("\(Self.self).log1p: resorting to BigRat") } return Self(BigRat.log1p(x.asBigRat, precision:px, debug:debug)) } return 2*atanh(a, precision:px, debug:debug) } /// normalize `x` to ±π public static func normalizeAngle(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { var theta = x let onepi = PI(precision:px) if theta < -2*onepi || +2*onepi < theta { let hp = px + Int(theta.exponent) if debug { print("\(Self.self).wrapAngle: precision =", hp) } let twopi = 2*PI(precision:hp) if debug { print("before:", theta) } theta = theta.remainder(dividingBy: twopi, precision:hp, round:Self.roundingRule) theta.truncate(width:px) if debug { print("after:", theta) } } if theta < -onepi { theta += 2*onepi } if +onepi < theta { theta -= 2*onepi } return theta } /// - returns: `(sin(x), cos(x))` public static func sincos(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->(sin:Self, cos:Self) { if x.isZero || x.isInfinite || x.isNaN { return (Self(Double.sin(x.asDouble)), Self(Double.cos(x.asDouble))) } let epsilon = getEpsilon(precision: px) if x * x <= epsilon { return (x, 1) // sin(x) == x below this point } func inner(_ x:Self)->(Self, Self) { if 1 < Swift.abs(x) { var (s, c) = inner(x/2) // use double-angle formula to reduce x if c == s { return (0, 1) } // prevent error accumulation (s, c) = (2*s*c, c*c - s*s) return (s.truncated(width:px*2), c.truncated(width:px*2)) } var (c, s) = (Self(0), Self(0)) var (n, d) = (Self(1), Self(1)) for i in 0...px { let t = n / d if debug { print("\(Self.self).sincos: i=\(i),t=\(t)") } if i & 1 == 0 { c += i & 2 == 2 ? -t : +t } else { s += i & 2 == 2 ? -t : +t } if Swift.abs(t) < epsilon { break } n = (n * x).truncated(width: px) d *= Self(i+1) } return (s, c) } let (s, c) = inner(Swift.abs(x) < 8 ? x : normalizeAngle(x, precision:px, debug:debug)) return 0 < px ? (s, c) : (s.truncated(width: px), c.truncated(width: px)) } /// cos(x) public static func cos(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { return sincos(x, precision:px, debug:debug).cos } /// sin(x) public static func sin(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { return sincos(x, precision:px, debug:debug).sin } /// tan(x) public static func tan(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isZero || x.isInfinite || x.isNaN { return Self(Double.tan(x.asDouble)) } let (s, c) = sincos(x, precision:px, debug:debug) if s.isNaN || s.isInfinite || c.isNaN || c.isInfinite { return Self(Double.tan(x.asDouble)) } return s / c } // // cf. https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Infinite_series /// arctan public static func atan(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isNaN || x.isZero { return x } let atan1 = ATAN1(precision: px) if x.isInfinite { return x.sign == .minus ? -2*atan1 : +2*atan1 } let epsilon = getEpsilon(precision: px) if x * x < epsilon { return x } // atan(x) == x below this point let inner_atan:(Self)->Self = { x in let x2 = x*x let x2p1 = 1 + x2 var (t, r) = (Self(1), Self(1)) for i in 1...px { t *= 2 * (Self(i) * x2) / (Self(2 * i + 1) * x2p1) t.truncate(width:px * 2) r += t r.truncate(width:px * 2) if debug { print("\(Self.self).atan:i=\(i) r=\(r), t.sign=\(t.sign)") } if t < epsilon { break } } return r * x / x2p1 } let ax = Swift.abs(x) if ax == 1 { return x.sign == .minus ? -atan1 : atan1 } var r = ax < 1 ? inner_atan(ax) : 2 * atan1 - inner_atan(1/ax) if 0 < px { r.truncate(width: px) } return x.sign == .minus ? -r : +r } /// arccos public static func acos(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if (x - 1).isZero || 1 < Swift.abs(x) { return Self(Double.acos(x.asDouble)) } // print("acos:", x) return PI(precision: px)/2 - asin(x, precision:px) } /// arcsin public static func asin(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if let dx = x as? Double { return Self(Double.asin(dx)) } if x.isZero || 1 < Swift.abs(x) || x.isInfinite { return Self(Double.asin(x.asDouble)) } let a = x / (1 + sqrt(1 - x * x)) return 2 * atan(a, precision:px) } /// - returns: `(sinh(x), cosh(x))` public static func sinhcosh(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->(sinh:Self, cosh:Self) { if x.isZero || x.isInfinite || x.isNaN { return (Self(Double.sinh(x.asDouble)), Self(Double.cosh(x.asDouble))) } if 1 < x.magnitude { let ep = exp(x, precision:px) let em = 1/ep return ((ep - em)/2, (ep + em)/2) } let epsilon = getEpsilon(precision: px) if x * x <= epsilon { return (x, 1) // sinh(x) == x below this point } func inner(_ x:Self)->(Self, Self) { var (c, s) = (Self(0), Self(0)) var (n, d) = (Self(1), Self(1)) for i in 0...px { let t = n / d if debug { print("\(Self.self).sincos: i=\(i),t=:\(t)") } if i & 1 == 0 { c += t } else { s += t } if Swift.abs(t) < epsilon { break } n = (n * x).truncated(width: px) d *= Self(i+1) } return (s, c) } let (s, c) = inner(x) return 0 < px ? (s, c) : (s.truncated(width: px), c.truncated(width: px)) } /// hyperbolic cosine public static func cosh(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { return sinhcosh(x, precision:px).cosh } /// hyperbolic sine public static func sinh(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { return sinhcosh(x, precision:px).sinh } /// hyperbolic tangent public static func tanh(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isZero || x.isInfinite || x.isNaN { return Self(Double.tanh(x.asDouble)) } let (s, c) = sinhcosh(x, precision:px) if s.isInfinite { return x.sign == .minus ? -1 : +1 } return s / c } /// acosh public static func acosh(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isLess(than: 1) { return nan } let a = x + sqrt(x * x - 1, precision:px) return log(a, precision:px) } /// asinh public static func asinh(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isZero || x.isInfinite { return x } if x.isLess(than:0){ return -asinh(-x, precision:px) } let epsilon = getEpsilon(precision: px) if x * x <= epsilon { return x // asinh(x) == x blow this point } let a = sqrt(x * x + 1, precision:px) if debug { print("\(Self.self).asinh: x = ", x, "√(x*x + 1) = ", a) } if a.magnitude == 1 && !(x is BigRat) { // possible if Self is Fixed width Integer if debug { print("\(Self.self).asinh: resorting to BigRat") } return Self(BigRat.asinh(x.asBigRat, precision:px, debug:debug)) } return log(x + a, precision:px) } /// atanh public static func atanh(_ x:Self, precision px:Int=Self.precision, debug:Bool=false)->Self { if x.isZero { return x } if 1 < x.magnitude { return nan } if 1 == x.magnitude { return x.sign == .minus ? -infinity : +infinity } let a = (1 + x)/(1 - x) if debug { print("\(Self.self).atanh: x = ", x, "(1 + x)/(1 - x) =", a) } if a.magnitude == 1 && !(x is BigRat) { // possible if Self is Fixed width Integer if debug { print("\(Self.self).atanh: resorting to BigRat") } return Self(BigRat.atanh(x.asBigRat, precision:px, debug:debug)) } return log(a, precision:px) / 2 } } extension FloatingPoint where Self:DoubleConvertible { public var asBigRat : BigRat { return self as? BigRat ?? BigRat(self.asDouble) } public func toFloatingPointString(radix:Int = 10)->String { return self.asBigRat.toFloatingPointString(radix:radix) } } // make BigFloatingPoint conform to ElementaryFunction // above extention supposed to suffice but as of Swift 5 we need the shim below import RealModule extension BigFloatingPoint { public static func exp(_ x:Self) -> Self { return exp(x, precision:Self.precision, debug:false) } public static func expMinusOne(_ x:Self) -> Self { return expMinusOne(x, precision:Self.precision, debug:false) } public static func exp2(_ x: Self) -> Self { return exp2(x, precision:Self.precision, debug:false) } public static func cosh(_ x:Self) -> Self { return cosh(x, precision:Self.precision, debug:false) } public static func sinh(_ x:Self) -> Self { return sinh(x, precision:Self.precision, debug:false) } public static func tanh(_ x:Self) -> Self { return tanh(x, precision:Self.precision, debug:false) } public static func cos(_ x:Self) -> Self { return cos(x, precision:Self.precision, debug:false) } public static func sin(_ x:Self) -> Self { return sin(x, precision:Self.precision, debug:false) } public static func tan(_ x:Self) -> Self { return tan(x, precision:Self.precision, debug:false) } public static func log(_ x:Self) -> Self { return log(x, precision:Self.precision, debug:false) } public static func log(onePlus x:Self) -> Self { return log1p( x, precision:Self.precision, debug:false) } public static func log2(_ x:Self) -> Self { return log2(x, precision:Self.precision, debug:false) } public static func log10(_ x:Self) -> Self { return log10(x, precision:Self.precision, debug:false) } public static func acosh(_ x:Self) -> Self { return acosh(x, precision:Self.precision, debug:false) } public static func asinh(_ x:Self) -> Self { return asinh(x, precision:Self.precision, debug:false) } public static func atanh(_ x:Self) -> Self { return atanh(x, precision:Self.precision, debug:false) } public static func acos(_ x:Self) -> Self { return acos(x, precision:Self.precision, debug:false) } public static func asin(_ x:Self) -> Self { return asin(x, precision:Self.precision, debug:false) } public static func atan(_ x:Self) -> Self { return atan(x, precision:Self.precision, debug:false) } public static func pow(_ x: Self, _ y: Self) -> Self { return pow(x, y, precision:Self.precision, debug:false) } public static func pow(_ x:Self, _ n:Int) -> Self { return x.power(IntType(n), precision:Self.precision, debug:false) } public static func sqrt(_ x:Self) -> Self { return sqrt(x, precision:Self.precision, debug:false) } public static func root(_ x:Self, _ n:Int) -> Self { return x.nthroot(IntType(n), precision:Self.precision, debug:false) } public static func hypot(_ y: Self, _ x: Self) -> Self { return hypot(y, x, precision:Self.precision, debug:false); } public static func atan2(y: Self, x: Self) -> Self { // argument labels needed return atan2(y:y, x:x, precision:Self.precision, debug:false); } //: mark todo public static func erf(_ x: Self) -> Self { fatalError("yet to be implemented"); } public static func erfc(_ x: Self) -> Self { fatalError("yet to be implemented"); } public static func gamma(_ x: Self) -> Self { fatalError("yet to be implemented"); } public static func logGamma(_ x: Self) -> Self { fatalError("yet to be implemented"); } }
41.482226
118
0.516673
57c90c08a6aa45fb0858ab8488865c458102a91c
2,171
kt
Kotlin
app/src/main/java/com/dew/aihua/player/playback/PlaybackListener.kt
ed828a/Aihua
1896f46888b5a954b367e83f40b845ce174a2328
[ "Apache-2.0" ]
1
2019-03-11T08:18:17.000Z
2019-03-11T08:18:17.000Z
app/src/main/java/com/dew/aihua/player/playback/PlaybackListener.kt
ed828a/Aihua
1896f46888b5a954b367e83f40b845ce174a2328
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/dew/aihua/player/playback/PlaybackListener.kt
ed828a/Aihua
1896f46888b5a954b367e83f40b845ce174a2328
[ "Apache-2.0" ]
null
null
null
package com.dew.aihua.player.playback import com.dew.aihua.player.model.PlayQueueItem import com.google.android.exoplayer2.source.MediaSource import org.schabi.newpipe.extractor.stream.StreamInfo /** * Created by Edward on 3/2/2019. */ interface PlaybackListener { /** * Called to check if the currently playing stream is approaching the end of its playback. * Implementation should return true when the current playback position is progressing within * timeToEndMillis or less to its playback during. * * May be called at any time. */ fun isApproachingPlaybackEdge(timeToEndMillis: Long): Boolean /** * Called when the stream at the current queue index is not ready yet. * Signals to the listener to block the simpleExoPlayer From playing anything * and notify the source is now invalid. * * May be called at any time. */ fun onPlaybackBlock() /** * Called when the stream at the current queue index is ready. * Signals to the listener to resume the simpleExoPlayer by preparing a new source. * * May be called only when the simpleExoPlayer is blocked. */ fun onPlaybackUnblock(mediaSource: MediaSource) /** * Called when the queue index is refreshed. * Signals to the listener to synchronize the simpleExoPlayer's window to the manager's * window. * * May be called anytime at any amount once unblock is called. */ fun onPlaybackSynchronize(item: PlayQueueItem) /** * Requests the listener to resolve a stream info into a media source * according to the listener's implementation (background, popup or main video simpleExoPlayer). * so this function will be implemented in each those components * * May be called at any time. */ fun sourceOf(item: PlayQueueItem, info: StreamInfo): MediaSource? /** * Called when the play queue can no longer to played or used. * Currently, this means the play queue is empty and complete. * Signals to the listener that it should shutdown. * * May be called at any time. */ fun onPlaybackShutdown() }
33.4
100
0.693229
416928fe05f1e5e981fefbc60d8c49beffade48e
139
sql
SQL
Esame19092017/Domanda2.sql
vladbragoi/db_lab_exams
69e266cda69bb275471a7ed421aa71e9331ff485
[ "MIT" ]
1
2018-08-30T09:15:51.000Z
2018-08-30T09:15:51.000Z
Esame19092017/Domanda2.sql
vladbragoi/db_lab_exams
69e266cda69bb275471a7ed421aa71e9331ff485
[ "MIT" ]
null
null
null
Esame19092017/Domanda2.sql
vladbragoi/db_lab_exams
69e266cda69bb275471a7ed421aa71e9331ff485
[ "MIT" ]
null
null
null
create index c1 on corsostudi(id); create index c2 on inserogato(annoaccademico, id_corsostudi); -- si passa da 6095 accessi a 740 accessi
34.75
61
0.791367
df88631e5952ce8fff23b48ea168944e8c8513a9
1,425
cs
C#
SEV.Crm.Plugins/Business/BusinessConfiguratorFactory.cs
sev15/CrmPlugins
966c363b3bf2263a90d61c5688ce781c5d4f9608
[ "MIT" ]
null
null
null
SEV.Crm.Plugins/Business/BusinessConfiguratorFactory.cs
sev15/CrmPlugins
966c363b3bf2263a90d61c5688ce781c5d4f9608
[ "MIT" ]
null
null
null
SEV.Crm.Plugins/Business/BusinessConfiguratorFactory.cs
sev15/CrmPlugins
966c363b3bf2263a90d61c5688ce781c5d4f9608
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using SEV.Crm.Business.Configurators; using SEV.Crm.Plugins.Properties; namespace SEV.Crm.Business { public abstract class BusinessConfiguratorFactory : IBusinessConfiguratorFactory { private readonly Dictionary<CrmPluginEvent, BusinessConfigurator> m_configurators = new Dictionary<CrmPluginEvent, BusinessConfigurator>(); protected BusinessConfiguratorFactory() { InitializeFactoryDictionary(); } private void InitializeFactoryDictionary() { CreateConfiguratorEntries().ForEach(entry => m_configurators.Add(entry.Item1, entry.Item2)); } protected abstract List<Tuple<CrmPluginEvent, BusinessConfigurator>> CreateConfiguratorEntries(); public BusinessConfigurator GetConfigurator(CrmPluginEvent pluginEvent) { BusinessConfigurator configurator; if (m_configurators.TryGetValue(pluginEvent, out configurator)) { return configurator; } throw new InvalidOperationException(String.Format(Resources.BusinessConfiguratorFactoryError, GetFactoryName(), pluginEvent)); } protected abstract string GetFactoryName(); } }
36.538462
115
0.629474
7f9d58c0f54e06aef7ff31ca39476a45dad582be
650
php
PHP
resources/views/components/inputs/textarea.blade.php
THEJU781/serviceraju1
71295d48e10a79d748267ea757cf6b54cc3d40f0
[ "MIT" ]
null
null
null
resources/views/components/inputs/textarea.blade.php
THEJU781/serviceraju1
71295d48e10a79d748267ea757cf6b54cc3d40f0
[ "MIT" ]
null
null
null
resources/views/components/inputs/textarea.blade.php
THEJU781/serviceraju1
71295d48e10a79d748267ea757cf6b54cc3d40f0
[ "MIT" ]
null
null
null
@props([ 'name', 'label', 'space' => null, ]) <div class="w-full px-4 mb-4 md:mb-0 {{ $space ? $space : "md:w-1/2" }}"> <div class="mb-6"> @if($label ?? null) @include('components.inputs.partials.label') @endif <textarea id="{{ $name }}" name="{{ $name }}" {{ ($required ?? false) ? 'required' : '' }} autocomplete="off" {{ $attributes }} class="appearance-none w-full p-4 text-xs font-semibold leading-none bg-gray-50 rounded outline-none dark:bg-gray-700 dark:text-gray-300" >{{$slot}}</textarea> </div> </div>
30.952381
149
0.492308
d14b134d96afd31c7f645f0059447d89dea2c25e
343
kt
Kotlin
app/src/test/java/com/gsm/bee_assistant_android/RxTest.kt
Sonanda/Bee-Android
28457fdecdc1935e1d97b5a8ac0de6fdff7fbaf4
[ "Apache-2.0" ]
null
null
null
app/src/test/java/com/gsm/bee_assistant_android/RxTest.kt
Sonanda/Bee-Android
28457fdecdc1935e1d97b5a8ac0de6fdff7fbaf4
[ "Apache-2.0" ]
null
null
null
app/src/test/java/com/gsm/bee_assistant_android/RxTest.kt
Sonanda/Bee-Android
28457fdecdc1935e1d97b5a8ac0de6fdff7fbaf4
[ "Apache-2.0" ]
null
null
null
package com.gsm.bee_assistant_android import io.reactivex.Observable import org.junit.Test import java.util.concurrent.TimeUnit class RxTest { @Test fun splashTest() { println("start") Observable.interval(1000 * 3, TimeUnit.MILLISECONDS) .subscribe { println("end") } Thread.sleep(3000) } }
19.055556
60
0.664723
457176dab716140d0b88f006fd7db451315fd61d
7,551
py
Python
additional_evaluations/metrics_comparison_barplot.py
imsb-uke/ecarenet
ffbf24e740d9154312d02b9f775816ed4b3d4691
[ "MIT" ]
1
2022-01-25T09:49:45.000Z
2022-01-25T09:49:45.000Z
additional_evaluations/metrics_comparison_barplot.py
imsb-uke/ecarenet
ffbf24e740d9154312d02b9f775816ed4b3d4691
[ "MIT" ]
null
null
null
additional_evaluations/metrics_comparison_barplot.py
imsb-uke/ecarenet
ffbf24e740d9154312d02b9f775816ed4b3d4691
[ "MIT" ]
null
null
null
from matplotlib import pyplot as plt import pandas as pd import numpy as np import os from training_evaluation.evaluation_helpers import get_survival_curve from training_evaluation.model_metrics import cdauc_uno, brier_score_censored_core, concordance_td_core, d_calibration def compare_models_barplot(run_ids, evaluation_methods, df_info, model_directory, save_fig=False, limit=None, mode='valid'): """ For all models in run_ids, calculate the metrics defined in the list evaluation_methods, use df_info for color and name information :param run_ids: list of integers [1,35,564] :param evaluation_methods: list of strings ['auc','brier','c_index','d_calibration'] :param df_info: pandas dataframe with index column of run_id, column 'info' with string that gives information about run (for label in plot) column 'color' with string that has information about how to plot e.g. | info | color ----|--------------------------|---------- 923 | 'log input and loss xzf3 | 'steelblue' :param model_directory: path/to/folder where run_id folder is located :param save_fig: True/False save figure or not :param limit: None or list of lower and upper limit for plot, for comparability reasons :param mode: 'valid' or 'test': compare models on results.csv or on test_results.csv that is stored in folder :return: DataFrame with result per run DataFrame with mean result per model/experiment DataFrame with standard deviation of result per model/experiment """ # array with one row per evaluation, one column per id eval_df = pd.DataFrame(index=evaluation_methods, columns=run_ids) plot_width = 2 plot_height = int(np.ceil(len(run_ids) / plot_width)) fig = plt.figure(figsize=(10, 2.5 * plot_height)) # evaluate each run individually for run_idx, run_id in enumerate(run_ids): print(run_id, end=' ') surv_curve, df_results = get_survival_curve(False, run_id, mode=mode, experiments_path=model_directory) for method_idx, evaluation_method in enumerate(evaluation_methods): if 'auc' in evaluation_method: eval_df.rename(index={evaluation_method: 'auc'}, inplace=True) evaluation_method = 'auc' evaluation_methods[method_idx] = 'auc' if 'cindex' in evaluation_method: eval_df.rename(index={evaluation_method: 'c_index'}, inplace=True) evaluation_method = 'c_index' evaluation_methods[method_idx] = 'c_index' if 'dcal' in evaluation_method: eval_df.rename(index={evaluation_method: 'd_calibration'}, inplace=True) evaluation_method = 'd_calibration' evaluation_methods[method_idx] = 'd_calibration' f = getattr(evaluations, evaluation_method) mean_res = f(df_results, surv_curve) eval_df.loc[evaluation_method][run_idx] = mean_res plt.subplot(plot_height, plot_width, run_idx + 1) plt.subplots_adjust(left=0.1, right=0.35, bottom=0.5) plt.step(surv_curve.index, np.array(surv_curve), where='post') plt.title(' - '.join((run_id, df_info.loc[run_id]['info']))) plt.tight_layout() plt.show() eval_df = eval_df.astype('float32') # here, only name column after model/experiment type eval_results = eval_df.rename(columns={i: df_info.loc[i]['info'] for i in eval_df.columns}) # to run_id add model information as column description eval_df.rename(columns={i: '---'.join((i, df_info.loc[i]['info'])) for i in eval_df.columns}, inplace=True) print(eval_results) # find mean and std per model/experiment setting over multiple runs mean = eval_results.groupby(lambda x: x, axis=1, sort=False).mean() std = eval_results.groupby(lambda x: x, axis=1, sort=False).std() # in case only one run is available for a setting, std would be nan, should be 0 std.fillna(0, inplace=True) run_id_plus_info = list(eval_df.columns) # label for graph should be all run ids + information (e.g. '1+2+3---exp1' '4+5---exp2') ri = [run_id_plus_info[0]] for i in np.arange(1, len(run_id_plus_info)): if run_id_plus_info[i].split('---')[-1] == ri[-1].split('---')[-1]: ri[-1] = '+'.join((run_id_plus_info[i].split('---')[0], ri[-1])) else: ri.append(run_id_plus_info[i]) run_ids = ri eval_mean = np.array(mean) eval_std = np.array(std) # loop over each metric: single bar plot per metric to compare all run_ids / experiments/models for metric_mean, idx_metric, evaluation_method, error in zip(eval_mean, range(len(eval_mean)), evaluation_methods, eval_std): #f = plt.figure(figsize=(int(np.min((len(run_ids) * 1.5, 12))), len(run_ids) * 0.25)) f, ax = plt.subplots(1,1) f.set_tight_layout(True) #f.add_subplot(1,1,1) # bar plot plt.barh(range(len(run_ids) + 1, 1, -1), metric_mean, color=[df_info.loc[i.split('---')[0].split('+')[0]]['color'] for i in run_ids], xerr=error) plt.yticks(range(len(run_ids) + 1, 1, -1), run_ids) # [' - '.join((r,df_info.loc[r]['info'])) for r in run_ids]) plt.title(evaluation_method) if evaluation_method in ['cindex', 'brier', 'auc']: if limit is None: plt.xlim(np.min(metric_mean) - 0.005, np.max(metric_mean) + 0.005) else: plt.xlim(limit[0], limit[1]) if save_fig: plt.savefig(os.path.join(save_fig, '%s.png' % evaluation_method), bbox_inches='tight') plt.tight_layout() f.set_figwidth(np.max((f.get_figwidth(), int(np.min((len(run_ids) * 1.5, 12)))))) f.set_figheight( len(run_ids) * 0.25) plt.show() return eval_df, mean, std class evaluations(): """ Helper class that has all metrics for survival model """ def auc(df_results, surv_curve): tau_2 = surv_curve.columns[-1] overall_auc, all_aucs_unos = cdauc_uno(df_results[['event_month', 'is_censored']], surv_curve, tau_2=tau_2, event_time_col='event_month', censored_col='is_censored') return overall_auc def brier(df_results, surv_curve): b = brier_score_censored_core(np.concatenate( (np.array(df_results['event_month'])[:, np.newaxis], np.array(df_results['is_censored'])[:, np.newaxis]), 1), surv_curve, event_time_col='event_month', censored_col='is_censored')# return b def c_index(df_results, surv_curve): c = concordance_td_core( np.concatenate( (np.array(df_results['event_month'])[:, np.newaxis], np.array(df_results['is_censored'])[:, np.newaxis]), 1), surv_curve) return c def d_calibration(df_results, surv_curve): dc = d_calibration(df_results[['event_month', 'is_censored']], surv_curve, 10, event_time_col='event_month', censored_col='is_censored')[0] return dc
46.611111
118
0.609588
23074872610912e422c500666d7a7c976576093f
5,207
css
CSS
css/extremecold.css
justinhodev/Subzero
b94dd6a3c0a364b289a91388e622e2acc1611ed9
[ "MIT" ]
1
2022-03-10T05:24:13.000Z
2022-03-10T05:24:13.000Z
css/extremecold.css
justinhodev/Subzero
b94dd6a3c0a364b289a91388e622e2acc1611ed9
[ "MIT" ]
null
null
null
css/extremecold.css
justinhodev/Subzero
b94dd6a3c0a364b289a91388e622e2acc1611ed9
[ "MIT" ]
null
null
null
.extremecold { background-color: #ebeef3; } .extremecold .extremecold_content { margin: 0 auto; width: 100%; text-align: left; } .extremecold .extremecold_content figure { width: 100%; display: block; } .extremecold .extremecold_content figcaption { text-transform: capitalize; } .extremecold .extremecold_content h1 { text-align: center; } .extremecold .extremecold_content .center-align { width: 100%; } .extremecold .extremecold_content .center-align .learnmore { background: none; border-radius: 0.3125em; border: 0.125em solid #262626; text-align: center; width: 9.375em; padding: 0.2rem 0; } .extremecold .extremecold_content .center-align .learnmore a { color: #262626; } .extremecold .extremecold_content .center-align .learnmore h3 { -webkit-margin-before: 0; -webkit-margin-after: 0; } .extremecold .extremecold_content .center-align .learnmore:hover { border: 0.125em solid #f9fafc; background: #262626; } .extremecold .extremecold_content .center-align .learnmore:hover a { color:#f9fafc; } @media only screen and (min-width: 20em) { .extremecold { padding-top: 6rem; padding-bottom: 4rem; } .extremecold .extremecold_content { padding: 0 1.5rem; } .extremecold .extremecold_content h1 { font-size:1.3rem; } .extremecold .extremecold_content p { margin: 0; font-size: 0.8rem; } .extremecold .extremecold_content figure { margin: 2rem 0; } .extremecold .extremecold_content figure img { margin-left: 30%; width: 30%; } .extremecold .extremecold_content figcaption { font-weight: bold; padding: 1rem 0; font-size: 1rem; text-align: center; } .extremecold .extremecold_content .center-align { display: none; } .extremecold .extremecold_content .mobile-info { display: block; font-size: 0.8rem; margin: 2.5rem 0; } .extremecold .extremecold_content .mobile-info h2 { font-size: 0.9rem; margin: 1rem 2rem; } .extremecold .extremecold_content .mobile-info p { margin: 1em 3rem; } } @media only screen and (min-width: 30em) { .extremecold { padding-bottom: 4rem; } .extremecold .extremecold_content { padding: 0 3rem; } .extremecold .extremecold_content h1 { font-size:1.3rem; } .extremecold .extremecold_content p { margin: 0; font-size: 0.8rem; } .extremecold .extremecold_content figure { margin: 2rem 0; } .extremecold .extremecold_content figure img { width: 20%; margin-left: 40%; } .extremecold .extremecold_content figcaption { padding: 1.5rem 2rem; } } @media only screen and (min-width: 45em) { .extremecold { padding-bottom: 4rem; } .extremecold .extremecold_content { padding: 0 4rem; } .extremecold .extremecold_content h1 { font-size:1.5rem; } .extremecold .extremecold_content p { margin: 2rem 0.2rem 2rem 3rem; font-size: 0.9rem; } .extremecold .extremecold_content figure { margin: 1rem 0; display: block; } .extremecold .extremecold_content figure img { margin: 0; width: 35%; } .extremecold .extremecold_content figcaption { padding: 1.3rem 2rem; font-size: 0.9rem; font-weight: normal; } .extremecold .extremecold_content .center-align { display: block; padding-top: 2rem; padding-left: 37%; } .extremecold .extremecold_content .center-align .learnmore h3 { font-size: 1.1rem; } .extremecold .extremecold_content .mobile-info { display: none; } } @media only screen and (max-height:45em) { .extremecold .extremecold_content .center-align { display: none; } } @media only screen and (min-width: 56.25em) { .extremecold { padding-bottom: 4rem; } .extremecold .extremecold_content { padding: 0 10rem; } .extremecold .extremecold_content h1 { font-size:1.7rem; } .extremecold .extremecold_content p { margin: 2rem 0.2rem 2rem 3rem; font-size: 0.95rem; } .extremecold .extremecold_content .center-align .learnmore h3 { font-size: 1.2rem; } } @media only screen and (min-width: 75em) { .extremecold { padding-bottom: 6rem; } .extremecold .extremecold_content { padding: 0 18rem; } .extremecold .extremecold_content h1 { font-size:2rem; } .extremecold .extremecold_content p { margin: 2rem 0.2rem 2rem 3rem; font-size: 1rem; } .extremecold .extremecold_content .center-align { padding-top: 2rem; padding-left: 42%; } }
21.516529
69
0.582293
c992324d45ed408756e9f34639d5eee23c103a20
6,472
ts
TypeScript
packages/mock/test/mockMatchers.spec.ts
onyxjs/onyx
db642e958d75a0f65125a6a92107c2434a2c38ea
[ "MIT" ]
5
2019-07-08T07:31:34.000Z
2022-01-12T07:15:27.000Z
packages/mock/test/mockMatchers.spec.ts
onyxjs/onyx
db642e958d75a0f65125a6a92107c2434a2c38ea
[ "MIT" ]
36
2019-07-09T07:46:48.000Z
2022-01-14T06:47:22.000Z
packages/mock/test/mockMatchers.spec.ts
onyxjs/onyx
db642e958d75a0f65125a6a92107c2434a2c38ea
[ "MIT" ]
1
2020-02-21T19:08:20.000Z
2020-02-21T19:08:20.000Z
import $expect from '@onyx/matchers/src' import mock from '../src/mock' import '../src/mockMatchers' describe('Mock function matchers', () => { it('toHaveBeenCalled', () => { expect(() => $expect({}).toHaveBeenCalled()).toThrow(TypeError) const mockFn = mock((a: any, b: any) => a + b) mockFn(1, 2) expect(() => $expect(mockFn).toHaveBeenCalled()).not.toThrow() }) it('toHaveBeenCalledTimes', () => { expect(() => $expect({}).toHaveBeenCalledTimes(1)).toThrow(TypeError) const mockFn = mock((a: any, b: any) => a + b) mockFn(1, 2) expect(() => $expect(mockFn).toHaveBeenCalledTimes(1)).not.toThrow() expect(() => $expect(mockFn).toHaveBeenCalledTimes(2)).toThrow() mockFn(1, 2) expect(() => $expect(mockFn).toHaveBeenCalledTimes(1)).not.toThrow() expect(() => $expect(mockFn).toHaveBeenCalledTimes(2)).not.toThrow() }) it('toHaveBeenCalledWith', () => { expect(() => $expect({}).toHaveBeenCalledWith()).toThrow(TypeError) const mockFn = mock((a: any, b: any) => a + b) expect(() => $expect(mockFn).toHaveBeenCalledWith()).toThrow() mockFn(1, 2) expect(() => $expect(mockFn).toHaveBeenCalledWith(1)).not.toThrow() expect(() => $expect(mockFn).toHaveBeenCalledWith(1, 2)).not.toThrow() expect(() => $expect(mockFn).toHaveBeenCalledWith(2)).toThrow() mockFn(3, 4) expect(() => $expect(mockFn).toHaveBeenCalledWith(1)).not.toThrow() expect(() => $expect(mockFn).toHaveBeenCalledWith(1, 2)).not.toThrow() expect(() => $expect(mockFn).toHaveBeenCalledWith(2)).toThrow() }) it('toHaveBeenLastCalledWith', () => { expect(() => $expect({}).toHaveBeenLastCalledWith()).toThrow(TypeError) const mockFn = mock((a: any, b: any) => a + b) expect(() => $expect(mockFn).toHaveBeenLastCalledWith()).toThrow() mockFn(1, 2) expect(() => $expect(mockFn).toHaveBeenLastCalledWith(1, 2)).not.toThrow() expect(() => $expect(mockFn).toHaveBeenLastCalledWith(3, 4)).toThrow() mockFn(3, 4) expect(() => $expect(mockFn).toHaveBeenLastCalledWith(1, 2)).toThrow() expect(() => $expect(mockFn).toHaveBeenLastCalledWith(3)).not.toThrow() }) it('toHaveBeenNthCalledWith', () => { expect(() => $expect({}).toHaveBeenNthCalledWith(1)).toThrow(TypeError) const mockFn = mock((a: any, b: any) => a + b) expect(() => $expect(mockFn).toHaveBeenNthCalledWith(1, 1, 2)).toThrow() expect(() => $expect(mockFn).toHaveBeenNthCalledWith(-1, 1, 2)).toThrow() mockFn(1, 2) expect(() => $expect(mockFn).toHaveBeenNthCalledWith(1, 1, 2)).not.toThrow() expect(() => $expect(mockFn).toHaveBeenNthCalledWith(1, 3, 4)).toThrow() mockFn(3, 4) expect(() => $expect(mockFn).toHaveBeenNthCalledWith(1, 1, 2)).not.toThrow() expect(() => $expect(mockFn).toHaveBeenNthCalledWith(1, 3, 4)).toThrow() expect(() => $expect(mockFn).toHaveBeenNthCalledWith(2, 1, 2)).toThrow() expect(() => $expect(mockFn).toHaveBeenNthCalledWith(2, 3)).not.toThrow() }) it('toHaveReturnedWith', () => { expect(() => $expect({}).toHaveReturnedWith(1)).toThrow(TypeError) const mockFn = mock((a: any, b: any) => a + b) const mockErr = mock(() => { throw new Error() }) mockFn(1, 2) expect(() => $expect(mockFn).toHaveReturnedWith(3)).not.toThrow() expect(() => $expect(mockFn).toHaveReturnedWith(1)).toThrow() try { mockErr() } catch { // } expect(() => $expect(mockErr).toHaveReturnedWith(typeof Error)).toThrow() }) it('toHaveLastReturnedWith', () => { expect(() => $expect({}).toHaveLastReturnedWith(2)).toThrow(TypeError) const mockFn = mock((a: any, b: any) => a + b) expect(() => $expect(mockFn).toHaveLastReturnedWith('string')).toThrow() expect(() => $expect(mockFn).toHaveLastReturnedWith(1)).toThrow() mockFn(1, 2) expect(() => $expect(mockFn).toHaveLastReturnedWith(3)).not.toThrow() expect(() => $expect(mockFn).toHaveLastReturnedWith(1)).toThrow() mockFn('hello ', 'world') expect(() => $expect(mockFn).toHaveLastReturnedWith('hello world')).not.toThrow() expect(() => $expect(mockFn).toHaveLastReturnedWith(5)).toThrow() }) it('toHaveNthReturnedWith', () => { expect(() => $expect({}).toHaveNthReturnedWith(1, 1)).toThrow(TypeError) const mockFn = mock((a: any, b: any) => a + b) expect(() => $expect(mockFn).toHaveNthReturnedWith(1, 1)).toThrow() expect(() => $expect(mockFn).toHaveNthReturnedWith(1, 'string')).toThrow() mockFn('hello ', 'world') expect(() => $expect(mockFn).toHaveNthReturnedWith(1, 'hello world')).not.toThrow() expect(() => $expect(mockFn).toHaveNthReturnedWith(1, 'world')).toThrow() mockFn(1, 5) expect(() => $expect(mockFn).toHaveNthReturnedWith(2, 6)).not.toThrow() expect(() => $expect(mockFn).toHaveNthReturnedWith(1, 1)).toThrow() mockFn.reset() mockFn(1, 5) expect(() => $expect(mockFn).toHaveNthReturnedWith(1, 6)).not.toThrow() expect(() => $expect(mockFn).toHaveNthReturnedWith(2, 6)).toThrow() }) it('toHaveReturnedTimes', () => { expect(() => $expect({}).toHaveReturnedTimes(1)).toThrow(TypeError) const mockFn = mock((a: any, b: any) => a + b) expect(() => $expect(mockFn).toHaveReturnedTimes(0)).not.toThrow() mockFn(1, 5) expect(() => $expect(mockFn).toHaveReturnedTimes(1)).not.toThrow() expect(() => $expect(mockFn).toHaveReturnedTimes(0)).toThrow() mockFn(2, 3) expect(() => $expect(mockFn).toHaveReturnedTimes(2)).not.toThrow() expect(() => $expect(mockFn).toHaveReturnedTimes(1)).toThrow() mockFn.reset() mockFn(1, 1) expect(() => $expect(mockFn).toHaveReturnedTimes(1)).not.toThrow() expect(() => $expect(mockFn).toHaveReturnedTimes(0)).toThrow() }) it('toHaveReturnedTimesWith', () => { expect(() => $expect({}).toHaveReturnedTimesWith(1, 1)).toThrow(TypeError) const mockFn = mock((a: any) => a.length) expect(() => $expect(mockFn).toHaveReturnedTimesWith(1, 1)).toThrow() mockFn('string') expect(() => $expect(mockFn).toHaveReturnedTimesWith(1, 6)).not.toThrow() mockFn('string') expect(() => $expect(mockFn).toHaveReturnedTimesWith(1, 6)).toThrow() expect(() => $expect(mockFn).toHaveReturnedTimesWith(2, 6)).not.toThrow() expect(() => $expect(mockFn).toHaveReturnedTimesWith(2, 3)).toThrow() mockFn.reset() expect(() => $expect(mockFn).toHaveReturnedTimesWith(2, 6)).toThrow() }) })
36.359551
87
0.631026
f19f42d19cbb35568593362e725d2267d940d8cb
375
sql
SQL
integration/src/main/resources/integration-1/server-config/sql/customer/customer.sql
davidboden/CommaCQ
0e361607a56fa8c9516154a607c9fc8eacdeaf89
[ "MIT" ]
1
2019-02-15T03:39:00.000Z
2019-02-15T03:39:00.000Z
integration/src/main/resources/integration-1/server-config/sql/proxyServer/customer.sql
davidboden/CommaCQ
0e361607a56fa8c9516154a607c9fc8eacdeaf89
[ "MIT" ]
null
null
null
integration/src/main/resources/integration-1/server-config/sql/proxyServer/customer.sql
davidboden/CommaCQ
0e361607a56fa8c9516154a607c9fc8eacdeaf89
[ "MIT" ]
null
null
null
select CODE as "id", DESCRIPTION as "description", ACTIVE as "active", /* case when ACTIVE = 1 then --Have to trim to 4 characters otherwise h2 --makes it a char(5) with a trailing space convert('true', varchar(5)) else convert('false', varchar(5)) end "active", */ accountOpeningDate as "accountOpeningDate", currentBalance as "currentBalance" from customer
26.785714
50
0.714667
b1c44afecfd08c07896036e7d13a15dc3415727b
16,777
lua
Lua
src/game/field_logic.lua
Ruin0x11/OpenNefia
548f1a1442eca704bb1c16b1a1591d982a34919f
[ "MIT" ]
109
2020-04-07T16:56:38.000Z
2022-02-17T04:05:40.000Z
src/game/field_logic.lua
Ruin0x11/OpenNefia
548f1a1442eca704bb1c16b1a1591d982a34919f
[ "MIT" ]
243
2020-04-07T08:25:15.000Z
2021-10-30T07:22:10.000Z
src/game/field_logic.lua
Ruin0x11/OpenNefia
548f1a1442eca704bb1c16b1a1591d982a34919f
[ "MIT" ]
15
2020-04-25T12:28:55.000Z
2022-02-23T03:20:43.000Z
local Mef = require("api.Mef") local Chara = require("api.Chara") local Event = require("api.Event") local I18N = require("api.I18N") local Gui = require("api.Gui") local Input = require("api.Input") local Map = require("api.Map") local World = require("api.World") local Log = require("api.Log") local Env = require("api.Env") local IChara = require("api.chara.IChara") local draw = require("internal.draw") local field = require("game.field") local config = require("internal.config") local data = require("internal.data") local save = require("internal.global.save") local chara_make = require("game.chara_make") local Save = require("api.Save") local state = require("internal.global.field_logic_state") local fs = require("util.fs") local SaveFs = require("api.SaveFs") local Rand = require("api.Rand") local main_state = require("internal.global.main_state") local DeathMenu = require("api.gui.menu.DeathMenu") local field_logic = {} local dt = 0 function field_logic.setup_new_game(player, save_id) main_state.is_in_game = true field.map = nil local scenario = data["base.scenario"]:ensure(save.base.scenario) assert(class.is_an(IChara, player)) Chara.set_player(player) if save_id == nil then save_id = ("%s_%d"):format(player.name, os.time()) end save_id = fs.sanitize(save_id, "_") if string.len(save_id) == 0 then error("Save ID must be greater than 0 characters in length.") end local path = SaveFs.save_path("", "save", save_id) if fs.exists(path) then error(("Save '%s' already exists."):format(save_id)) end config.base._save_id = fs.sanitize(save_id) scenario:on_game_start(player) assert(Map.current(), "Scenario must set the current map") assert(player:current_map() == Map.current(), "Player must exist in current map") save.base.home_map_uid = save.base.home_map_uid or Map.current().uid assert(save.base.home_map_uid) Env.update_play_time() Event.trigger("base.on_new_game") -- >>>>>>>> shade2/economy.hsp:20 snd seSave:gosub *game_save .. Save.save_game() -- <<<<<<<< shade2/economy.hsp:20 snd seSave:gosub *game_save .. end function field_logic.quickstart() field:init_global_data() save.base.scenario = config.base.quickstart_scenario assert(config.base.quickstart_scenario) assert(save.base.scenario) -- We will want to act as if the character making GUI is active, because that -- will force the player's equipment to be generated uncursed, along with -- some other special behaviors (search for CharaMake.is_active()). chara_make.set_is_active_override(true) local ok, err = xpcall(function() local me = Chara.create(config.base.quickstart_chara_id, nil, nil, {no_build=true, ownerless=true}) me.gender = Rand.choice { "female", "male" } -- HACK: We have to apply race/class ourselves as the charamake process -- will assume the GUI will do so local Skill = require("mod.elona_sys.api.Skill") Skill.apply_race_params(me, me.race) Skill.apply_class_params(me, me.class) me:emit("base.on_finalize_player") me:emit("base.on_initialize_player") me:build() return me end, debug.traceback) chara_make.set_is_active_override(false) if not ok then error(err) end local save_id = "quickstart" local path = SaveFs.save_path("", "save", save_id) if fs.exists(path) then fs.remove(path) end local me = err field_logic.setup_new_game(me, save_id) Gui.mes("Quickstarted game.") end function field_logic.setup() -- This function gets called again if field_logic.query() throws an -- error, so don't rerun base.on_game_initialize. if not field.repl then field:setup_repl() end if not main_state.is_in_game then Event.trigger("base.on_game_initialize") end end function field_logic.update_chara_time_this_turn(time_this_turn) for _, chara in Chara.iter() do -- Ensure all characters (including the player) have a -- turn cost at least as much as the player's starting -- turn cost, since the player always goes first at the -- beginning of a turn. chara.time_this_turn = chara.time_this_turn + chara:emit("base.on_calc_speed") * time_this_turn end end local function update_mefs(map) for _, mef in Mef.iter(map) do mef:step_turn() end end function field_logic.turn_begin() local turn_result = Event.trigger("base.on_turn_begin", {}, nil) if turn_result then -- return turn_result end update_mefs(field.map) local player = Chara.player() if not Chara.is_alive(player) then -- NOTE: should be an internal event, separate from ones that -- event callbacks may return. return "player_died", player end if player:has_activity() and config.base.auto_turn_speed ~= "highest" then local anim_wait = player.activity:get_animation_wait() if anim_wait > 0 then dt = coroutine.yield() field:update(dt) end end -- In Elona, the player always goes first at the start of each -- turn, followed by allies, adventurers, then others. This was -- previously accomplished by simply iterating the cdata[] array by -- increasing index, since the player was always index 0, allies -- index 1-15, adventurers 15-56, and so on. state.player_finished_turn = false state.chara_iter, state.chara_iter_state, state.chara_iter_index = Chara.iter_all() local speed = player:emit("base.on_calc_speed") -- All characters will start with at least this much time during -- this turn. local starting_turn_time = (field:turn_cost() - player.time_this_turn) / speed + 1 -- TODO: world map continuous action local update_time_this_turn = true if update_time_this_turn then field_logic.update_chara_time_this_turn(starting_turn_time) end -- BUG: don't pass time if just loaded from save World.pass_time_in_seconds(starting_turn_time / 5 + 1) Event.trigger("base.on_hud_message", {action="new_turn"}) return "pass_turns" end function field_logic.determine_turn() local player = Chara.player() assert(player ~= nil) if state.chara_iter == nil then Log.warn("chara iter was nil, probably hotloaded.") return nil end -- TODO: check if player can go first, then allies, then others. if not state.player_finished_turn then state.player_finished_turn = true return player end -- HACK: use a better way that also orders allies first local found = nil local chara local going = true local any_moved = true while going do repeat state.chara_iter_index, chara = state.chara_iter(state.chara_iter_state, state.chara_iter_index) if chara ~= nil and chara.time_this_turn >= field:turn_cost() then found = chara any_moved = true end until found ~= nil or state.chara_iter_index == nil if found or any_moved == false then going = false end if state.chara_iter_index == nil then any_moved = false state.chara_iter, state.chara_iter_state, state.chara_iter_index = Chara.iter_all() end end return found end function field_logic.pass_turns() local chara = field_logic.determine_turn() if chara == nil then -- Start a new turn. return "turn_begin" end if config.base.anime_wait_type == "at_turn_start" then Gui.wait_for_draw_callbacks() end local is_first_turn = save.base.is_first_turn if is_first_turn then save.base.is_first_turn = false end chara.time_this_turn = chara.time_this_turn - field:turn_cost() chara.turns_alive = chara.turns_alive + 1 local result = chara:emit("base.before_chara_turn_start", {is_first_turn=is_first_turn}, {blocked=false}) if result.blocked then if result.wait then Gui.wait(result.wait, true) end return result.turn_result or "turn_end", chara end -- EVENT: before_chara_begin_turn -- wet if outdoors and rain -- BUILTIN: gain level -- if Chara.is_player(chara) then -- actually means beginning of all turns. -- refresh speed? -- prevent escape -- RETURN: potentially exit map here -- proc map events -- ether disease -- end if chara:is_player() and not Chara.is_alive(chara) then return "player_died", chara end -- proc mef -- proc buff local result = chara:emit("base.on_chara_pass_turn", {}, {blocked=false}) if result.blocked then return result.turn_result or "turn_end", chara end -- >>>>>>>> shade2/main.hsp:821 if cc=pc:if (cRowAct(cc)!rowActEat)&(cRowAct(cc) ... if chara:is_player() and chara:has_activity() then chara:_proc_activity_interrupted() end -- <<<<<<<< shade2/main.hsp:821 if cc=pc:if (cRowAct(cc)!rowActEat)&(cRowAct(cc) .. -- proc refresh if transferred if chara:has_activity() then local turn_result = chara:pass_activity_turn() if config.base.auto_turn_speed ~= "highest" and chara.activity and chara.activity:get_animation_wait() > 0 then Gui.update_screen() end if turn_result then return turn_result, chara end Log.warn("Activity '%s' on chara %d (%s) did not return turn result", chara:get_activity()._id, chara.uid, chara._id) return "pass_turns" end if Chara.is_alive(chara) then if chara:is_player() then return "player_turn", chara else return "npc_turn", chara end end return "pass_turns" end function field_logic.player_turn() local player = Chara.player() player.target_location = nil return "player_turn_query" end -- base.on_player_query_frame needs to be efficient as possible since it will -- get called on every frame, so don't allocate an event params table inside the -- loop. local EVENT_ARGS = {} function field_logic.player_turn_query() local result local going = true local player = Chara.player() if not Chara.is_alive(player) then return "player_died", player end if state.about_to_autosave then state.about_to_autosave = false Save.save_game() end Gui.update_screen(dt, true) -- Wait for draw callbacks if necessary. dt = coroutine.yield() while field:update_draw_callbacks(dt) do dt = coroutine.yield() end if config.base.anime_wait_type == "at_turn_start" then Gui.wait_for_draw_callbacks() end result = Event.trigger("base.on_player_turn") if result then field:update(dt) return result, player end while going do if field.map_changed then -- Game was loaded while we were querying for input; clear the list of -- characters to act and start again from "turn_begin". result = "player_turn_query" going = false break end local ran, turn_result = field:run_actions(dt, player) field:update(dt) if field.repl then local success, turn_result = field.repl:execute_all_deferred() if success and turn_result then result = turn_result going = false break end end if ran == true then result = turn_result or "player_turn_query" going = false break end field.no_scroll_this_update = false table.clear(EVENT_ARGS) Event.trigger("base.on_player_turn_query_frame", EVENT_ARGS) dt = coroutine.yield() end -- TODO: convert public to internal event return result, player end function field_logic.npc_turn(npc) assert(not npc:is_player()) local Ai = require("api.Ai") Ai.run(npc.ai, npc) return "turn_end", npc end function field_logic.turn_end(chara) if not Chara.is_alive(chara) then return "pass_turns" end local result = chara:emit("base.on_chara_turn_end", {}, {regeneration=true}) local regen = result.regeneration if Chara.is_player(chara) then -- hunger -- sleep else -- quest delivery flag end -- party time emoicon if regen then chara:emit("base.on_regenerate") end -- proc timestop return "pass_turns" end local function do_revive_player() local player = Chara.player() assert(player:revive()) local success, map = Map.load(save.base.home_map_uid) if success then Map.travel_to(map) else Log.error("Game has not been saved yet, reviving in current map instead. Scenarios should always save the game when first starting. (%s)", map) end player:emit("base.on_player_death_revival") end local function revive_player() state.player_about_to_respawn = true local ok, err = xpcall(do_revive_player, debug.traceback) state.player_about_to_respawn = false if not ok then error(err) end end function field_logic.player_died(player) Gui.play_sound("base.dead1") Gui.update_screen() local result = Event.trigger("base.on_player_death", {player = player}) if result then return result end Gui.mes("misc.death.good_bye") Gui.mes("misc.death.you_leave_dying_message") local last_words = Input.query_text(16, true) if last_words == nil or last_words == "" then last_words = I18N.get("misc.death.dying_message", "system.last_words") else last_words = I18N.get("misc.death.dying_message", last_words) end local bones = save.base.bones --[[ { title = "Elegant crimson", name = "Xero", last_words = "\"Gee, that smarts!\"", date = DateTime:new(), death_cause = "died from loss of blood", map_name = "Lesimas", score = 9999, image = "elona.human_male", color = {255, 255, 255} } --]] local map = Map.current() local bone = { title = player.title, name = player.name, last_words = last_words, date = table.deepcopy(save.base.date), death_cause = "TODO", map_name = map.name, score = World.calc_score(), image = player.image, color = player.color or {255, 255, 255} } local MAX_BONES = 80 if #bones >= MAX_BONES then -- Remove lowest scoring record. bones[#bones] = bone else bones[#bones+1] = bone end table.sort(bones, function(a, b) return a.score > b.score end) save.base.bones = bones local result, canceled = DeathMenu:new(bones, bone):query() if canceled or result.index == 1 then revive_player() return "turn_begin" end return "title_screen" end function field_logic.run_one_event(event, target_chara) local cb = nil Log.trace("Turn event: %s (%s)", event, target_chara) if Chara.player() == nil then -- Something went wrong; at least boot the game back to the -- title so it doesn't have to be restarted. Log.error("Player is nil, returning to title.") return false end if field.map_changed == true then event = "turn_begin" field.map_changed = false end if event == "turn_begin" then cb = field_logic.turn_begin elseif event == "turn_end" then cb = field_logic.turn_end elseif event == "player_died" then cb = field_logic.player_died elseif event == "player_turn" then cb = field_logic.player_turn elseif event == "player_turn_query" then cb = field_logic.player_turn_query elseif event == "npc_turn" then cb = field_logic.npc_turn elseif event == "pass_turns" then cb = field_logic.pass_turns elseif event == "title_screen" then return false, event elseif event == "quit" then return false, event end if type(cb) ~= "function" then error("Unknown turn event " .. inspect(event)) end local success success, event, target_chara = xpcall(function() return cb(target_chara) end, debug.traceback) if not success then -- pass the error up to the main loop so the error screen can be -- displayed coroutine.yield(event) event = "player_turn_query" target_chara = nil end return true, event, target_chara end function field_logic.query() Log.info("Entered main loop.") field_logic.setup() local event = "turn_begin" local going = true local target_chara main_state.is_in_game = true draw.push_layer(field.hud) draw.push_layer(field) field:reset_scrolling() Gui.update_screen() while going do going, event, target_chara = field_logic.run_one_event(event, target_chara) end draw.pop_layer() draw.pop_layer() field.map = nil main_state.is_in_game = false return event end return field_logic
26.630159
149
0.672885
96ec5a4ee3d0af70b95d95a35f1326ddada8c42c
1,306
cs
C#
Assets/LeapMotion/Core/Scripts/Utils/ProfilerSample.cs
Sacurose/SideScroller
76c2a5551ec6689e0481741c37fb1e51e0fc7719
[ "MIT" ]
11
2018-05-04T18:07:18.000Z
2021-04-19T09:17:25.000Z
Assets/LeapMotion/Core/Scripts/Utils/ProfilerSample.cs
Sacurose/SideScroller
76c2a5551ec6689e0481741c37fb1e51e0fc7719
[ "MIT" ]
1
2019-09-20T02:32:09.000Z
2019-09-23T02:53:27.000Z
Assets/LeapMotion/Core/Scripts/Utils/ProfilerSample.cs
Sacurose/SideScroller
76c2a5551ec6689e0481741c37fb1e51e0fc7719
[ "MIT" ]
4
2018-09-07T19:38:38.000Z
2021-06-18T05:36:55.000Z
/****************************************************************************** * Copyright (C) Leap Motion, Inc. 2011-2017. * * Leap Motion proprietary and confidential. * * * * Use subject to the terms of the Leap Motion SDK Agreement available at * * https://developer.leapmotion.com/sdk_agreement, or another agreement * * between Leap Motion and you, your company or other organization. * ******************************************************************************/ using System; using UnityEngine.Profiling; namespace Leap.Unity { /// <summary> /// A utility struct for ease of use when you want to wrap /// a piece of code in a Profiler.BeginSample/EndSample. /// Usage: /// /// using(new ProfilerSample("Sample Name")) { /// code you want to profile /// } /// </summary> public struct ProfilerSample : IDisposable { public ProfilerSample(string sampleName) { Profiler.BeginSample(sampleName); } public ProfilerSample(string sampleName, UnityEngine.Object obj) { Profiler.BeginSample(sampleName, obj); } public void Dispose() { Profiler.EndSample(); } } }
33.487179
80
0.513783
7d8bec23da301bb314ea22572c39690992bb0bcd
3,324
css
CSS
app/public/stylesheets/style.css
kevinsarsen/MyStudyNavigator
b331599f02d37e32b054320a73c11d3e3a8e445c
[ "Apache-2.0" ]
null
null
null
app/public/stylesheets/style.css
kevinsarsen/MyStudyNavigator
b331599f02d37e32b054320a73c11d3e3a8e445c
[ "Apache-2.0" ]
10
2017-02-23T18:10:48.000Z
2017-11-10T03:41:47.000Z
app/public/stylesheets/style.css
kevinsarsen/MyStudyNavigator
b331599f02d37e32b054320a73c11d3e3a8e445c
[ "Apache-2.0" ]
null
null
null
html{ height: 100%; } body { font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; margin: 0px; height: 100%; } a { color: #00B7FF; } h1, h2, h3 { margin-top: 0px; -webkit-margin-before: 0px; } #header { border-style: none; background-color: darkgrey; width: 100%; height: 75px; display: none; } .page-header { margin-top: 0px; } #page-footer { display: none; } #content { margin-left: 0px; padding: 0px; } #app-content { height: 100%; width: 92%; /*margin-left: 60px;*/ padding-left: 10px; padding-top: 18px; float: left; } #app-icon { height: 30px; /*background-image: url("../images/student.png");*/ background-size: contain; /*background-color: cadetblue;*/ /*margin-bottom: 20px;*/ margin: 8px 0px 0px 2px; } #left-nav { border-style: none; position: absolute; width: 60px; height: 100%; background-color: black; } .nav-item { /*margin-bottom: 20px;*/ text-align: center; } /*#content {*/ /*padding-left: 20px;*/ /*width: auto;*/ /*margin-left: 50px;*/ /*height: 100%;*/ /*padding-top: 15px;*/ /*}*/ /* Rules for sizing the icon. */ .material-icons.md-18 { font-size: 18px; } .material-icons.md-24 { font-size: 24px; } .material-icons.md-36 { font-size: 36px; } .material-icons.md-48 { font-size: 48px; } /* Rules for using icons as black on a light background. */ .material-icons.md-dark { color: rgba(0, 0, 0, 0.54); } .material-icons.md-dark.md-inactive { color: rgba(0, 0, 0, 0.26); } /* Rules for using icons as white on a dark background. */ .material-icons.md-light { color: rgba(255, 255, 255, 1); } .material-icons.md-light.md-inactive { color: rgba(255, 255, 255, 0.3); } .col-md-4{ border-right: none; /*min-height: 350px;*/ } @media (min-width: 768px) { .navbar-collapse { height: auto; border-top: 0; box-shadow: none; max-height: none; padding-left:0; padding-right:0; } .navbar-collapse.collapse { display: block !important; width: auto !important; padding-bottom: 0; overflow: visible !important; } .navbar-collapse.in { overflow-x: visible; } .navbar { max-width:65px; margin-right: 0; margin-left: 0; float: left; } .navbar-nav, .navbar-nav > li, .navbar-left, .navbar-right, .navbar-header {float:none !important;} .navbar-right .dropdown-menu {left:0;right:auto;} .navbar-collapse .navbar-nav.navbar-right:last-child { margin-right: 0; } .container-fluid { padding-right: 0px; padding-left: 0px; } .navbar-brand { margin-left: auto; margin-right: auto; padding: 0; float: none; } #app-icon { height: 50px; /*background-image: url("../images/student.png");*/ background-size: contain; /*background-color: cadetblue;*/ /*margin-bottom: 20px;*/ } #app-content { height: 100%; width: 92%; /*margin-left: 60px;*/ padding-left: 10px; padding-top: 18px; float: left; } #content { margin-left: 0px; padding: 10px; } .col-md-4{ border-right: none; /*min-height: 350px;*/ } } .navbar-brand { margin-left: auto; margin-right: auto; padding: 0; float: none; height: 30px; } @media (min-width: 992px){ .col-md-4{ border-right: 1px solid #eee; min-height: 350px; } }
17.3125
73
0.607401
280ad0008ea3d8e67519543e2a00b8989c565ee4
1,860
lua
Lua
tests/streams_spec.lua
vifino/lua-piper
027fd4cc5ae125dd5e6614caece94df048a93306
[ "MIT" ]
2
2017-11-17T12:39:25.000Z
2020-12-18T18:13:26.000Z
tests/streams_spec.lua
vifino/lua-piper
027fd4cc5ae125dd5e6614caece94df048a93306
[ "MIT" ]
null
null
null
tests/streams_spec.lua
vifino/lua-piper
027fd4cc5ae125dd5e6614caece94df048a93306
[ "MIT" ]
null
null
null
describe("streams", function() local streams = require("streams") it("can send into a stream", function() local stream = streams.new() stream:send("Test!") end) it("can send and receive from stream", function() local stream = streams.new() stream:send("Test!") assert.are_equals(stream:recv(), "Test!") end) it("can send and receive from stream multiple times", function() local stream = streams.new() stream:send("Test one!") stream:send("Test two!") assert.are_equals(stream:recv(), "Test one!") assert.are_equals(stream:recv(), "Test two!") end) it("can send and receive from stream, returning nil when the buffer is empty", function() local stream = streams.new() stream:send("Test!") assert.are_equals(stream:recv(), "Test!") assert.are_equals(stream:recv(), nil) end) it("can send and receive from stream, running a basic filler function when empty", function() local filler = function() return "Filler!" end local stream = streams.new(filler) stream:send("Test!") assert.are_equals(stream:recv(), "Test!") assert.are_equals(stream:recv(), "Filler!") end) it("can send and receive from stream, running a complex filler function when empty", function() local filler = function(stream) stream:send("Filler one!") stream:send("Filler two!") end local stream = streams.new(filler) stream:send("Test!") assert.are_equals(stream:recv(), "Test!") assert.are_equals(stream:recv(), "Filler one!") assert.are_equals(stream:recv(), "Filler two!") end) it("can receive using an iterator", function() local stream = streams.new() local testvals = {"Test one!", "Test two!", "Test three!", "Test four!", "Test five!"} for _, val in pairs(testvals) do stream:send(val) end local i = 0 for val in stream:iter() do i = i + 1 assert.are_equals(testvals[i], val) end end) end)
33.214286
96
0.684409
89a046e512212304cf25e97a71ea542ecc61ddd3
7,851
dart
Dart
deal_o_round/lib/settings/settings_page.dart
CsabaConsulting/Deal-O-Round
432b765de6372465eb12136a12cd85a1dae3d72a
[ "MIT" ]
1
2021-02-25T10:52:08.000Z
2021-02-25T10:52:08.000Z
deal_o_round/lib/settings/settings_page.dart
DealORound/Deal-O-Round
c8a1ce5a329a91adec625a9b88fda90389e86ce2
[ "MIT" ]
15
2020-08-31T01:55:36.000Z
2022-01-26T03:37:02.000Z
deal_o_round/lib/settings/settings_page.dart
DealORound/Deal-O-Round
c8a1ce5a329a91adec625a9b88fda90389e86ce2
[ "MIT" ]
null
null
null
import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../game/logic/game_constants.dart'; import '../services/settings_constants.dart'; import '../services/size.dart'; import '../background_gradient.dart'; import 'boolean_settings.dart'; import 'enum_settings.dart'; import 'spinner_settings.dart'; class SettingsPage extends StatefulWidget { SettingsPage({Key? key}) : super(key: key); @override _SettingsPageState createState() => _SettingsPageState(); } class _SettingsPageState extends State<SettingsPage> { @override Widget build(BuildContext context) { final radius = chipRadius(context); // ~40 final size = context.mediaQuerySize; final titleSize = radius * 1.2; // ~48 final titleStyle = TextStyle( fontSize: titleSize, // ~48 fontFamily: 'Roboto-Condensed', fontWeight: FontWeight.w400, color: Colors.lightGreenAccent, ); final textStyle = TextStyle( fontSize: radius * 0.6, // ~24 fontFamily: 'Roboto-Condensed', fontWeight: FontWeight.w400, color: Colors.white, ); final boxDecoration = BoxDecoration( color: Colors.green.shade900.withOpacity(0.5), borderRadius: BorderRadius.circular(5.0), border: Border.all(color: Colors.green.shade900, width: 3.0), ); final separatorSize = radius / 4; // ~ 10 final halfWidth = size.width / 2 - 2 * separatorSize; return Scaffold( backgroundColor: Colors.transparent, floatingActionButtonLocation: FloatingActionButtonLocation.startTop, floatingActionButton: Padding( padding: EdgeInsets.only(top: radius * 1.5), // ~60 child: SizedBox( width: titleSize, height: titleSize, child: FloatingActionButton( onPressed: () => Get.back(), child: Icon(Icons.arrow_back, size: radius), backgroundColor: Colors.green, ), ), ), body: Container( decoration: BoxDecoration(gradient: getBackgroundGradient()), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( decoration: boxDecoration, padding: const EdgeInsets.all(8.0), child: Text("Settings", style: titleStyle), ), SizedBox(height: separatorSize), Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: halfWidth, child: Container( decoration: boxDecoration, padding: const EdgeInsets.all(2.0), child: GridView.count( crossAxisCount: 2, physics: NeverScrollableScrollPhysics(), shrinkWrap: true, scrollDirection: Axis.vertical, childAspectRatio: 4.0, padding: const EdgeInsets.symmetric( vertical: 1.0, horizontal: 10.0, ), children: [ Align( alignment: Alignment.centerLeft, child: Text("Difficulty", style: textStyle), ), EnumSettings<Difficulty>( values: Difficulty.values, defaultValue: DIFFICULTY_DEFAULT_VALUE, valueTag: DIFFICULTY, textStyle: textStyle, ), Align( alignment: Alignment.centerLeft, child: Text("Layout", style: textStyle), ), EnumSettings<BoardLayout>( values: BoardLayout.values, defaultValue: BOARD_LAYOUT_DEFAULT_VALUE, valueTag: BOARD_LAYOUT, textStyle: textStyle, ), Align( alignment: Alignment.centerLeft, child: Text("Game Music", style: textStyle), ), Padding( padding: EdgeInsets.symmetric(vertical: 0, horizontal: separatorSize), child: BooleanSettings( defaultValue: GAME_MUSIC_DEFAULT, valueTag: GAME_MUSIC), ), Align( alignment: Alignment.centerLeft, child: Text("Sound Effects", style: textStyle), ), Padding( padding: EdgeInsets.symmetric(vertical: 0, horizontal: separatorSize), child: BooleanSettings( defaultValue: SOUND_EFFECTS_DEFAULT, valueTag: SOUND_EFFECTS), ), ], ), ), ), SizedBox(width: separatorSize), SizedBox( width: halfWidth, child: Container( decoration: boxDecoration, padding: const EdgeInsets.all(2.0), child: GridView.count( crossAxisCount: 2, physics: NeverScrollableScrollPhysics(), shrinkWrap: true, scrollDirection: Axis.vertical, childAspectRatio: 4.0, padding: const EdgeInsets.symmetric( vertical: 1.0, horizontal: 4.0, ), children: [ Align( alignment: Alignment.centerLeft, child: Text("Volume", style: textStyle), ), SpinnerSettings( minValue: 0, maxValue: 100, defaultValue: VOLUME_DEFAULT, valueTag: VOLUME, textStyle: textStyle, ), Align( alignment: Alignment.centerLeft, child: Text("Screen Scale", style: textStyle), ), SpinnerSettings( minValue: 0.2, maxValue: 4.0, stepValue: 0.05, fractionDigits: 2, defaultValue: SCREEN_SCALE_DEFAULT, valueTag: SCREEN_SCALE, textStyle: textStyle, ), Align( alignment: Alignment.centerLeft, child: Text("Anim. Speed", style: textStyle), ), SpinnerSettings( minValue: 50, maxValue: 500, stepValue: 10, defaultValue: ANIMATION_SPEED_DEFAULT, valueTag: ANIMATION_SPEED, textStyle: textStyle, ) ], ), ), ), ], ), ], ), ), ); } }
39.452261
96
0.457521
2d0972056d9ce9c81c43bea8bcafc685b586b86f
1,538
css
CSS
alecgalloway/css/projects.css
ConvertToInt/alecgalloway
240dfc5eedb37054fb8fc6105d2c0c00852b0e99
[ "MIT" ]
null
null
null
alecgalloway/css/projects.css
ConvertToInt/alecgalloway
240dfc5eedb37054fb8fc6105d2c0c00852b0e99
[ "MIT" ]
null
null
null
alecgalloway/css/projects.css
ConvertToInt/alecgalloway
240dfc5eedb37054fb8fc6105d2c0c00852b0e99
[ "MIT" ]
null
null
null
#top{ background-image:url(../img/projects.jpg); background-attachment:fixed; background-repeat: no-repeat; background-size: cover; height:24em; } .container{ padding:0 30px 0 30px } .card:hover{ -webkit-box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.5); -moz-box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.5); box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.5); transition: box-shadow 0.2s ease-in-out; } .card-title{ font-size: 23px; font-weight:700; letter-spacing:2.5px } .card-description{ font-size: 17px; letter-spacing: 2; font-weight: 500; } .card-date{ font-size: 15px; font-weight:600; letter-spacing:2px } /* collapse to 2 cards, hide description collapse to 1 card and padding to 0... remeber !important hide date/description!! */ /* * {box-sizing: border-box} .mySlides1, .mySlides2 {display: none} img { vertical-align: middle; } /* Slideshow container * .slideshow-container { max-width: 1000px; position: relative; margin: auto; float:right; width:50% } /* Next & previous buttons * .prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; padding: 16px; margin-top: -22px; color: white; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; user-select: none; } /* Position the "next button" to the right * .next { right: 0; border-radius: 3px 0 0 3px; } /* On hover, add a grey background color * .prev:hover, .next:hover { background-color: #f1f1f1; color: black; }
15.85567
57
0.657997
2d0442406c34e9eb4d92fcb20ef2a1c9ffbf73d7
801
css
CSS
demo/cleanroom/calculator/unsolved/style.css
AbhinavM2000/faculty
bf22a80d92a97fd8cea59a4d37b978f7f2179b8b
[ "CC0-1.0" ]
13
2020-03-30T01:55:36.000Z
2022-01-28T11:18:21.000Z
demo/cleanroom/calculator/unsolved/style.css
AbhinavM2000/faculty
bf22a80d92a97fd8cea59a4d37b978f7f2179b8b
[ "CC0-1.0" ]
129
2019-10-10T00:33:29.000Z
2022-03-26T15:31:09.000Z
demo/cleanroom/calculator/unsolved/style.css
AbhinavM2000/faculty
bf22a80d92a97fd8cea59a4d37b978f7f2179b8b
[ "CC0-1.0" ]
20
2019-10-04T19:56:06.000Z
2021-12-04T11:55:53.000Z
.calculatorBody { text-align: left; border-right: solid 1px rgb(50,50,50); border-bottom: solid 1px rgb(50,50,50); border-top: solid 1px rgb(250,250,250); border-left: solid 1px rgb(250,250,250); padding: 1em; background-color: rgb(200,200,200); } body { position:absolute; margin:auto; vertical-align: center; width:13em; top: 15%; left: 35%; right:35%; bottom:35%; } button { width:3em; height:3em; text-align: center; margin-right: .25em; margin-bottom: .25em; font-family: "Century Gothic"; font-size: 9pt; padding: 0em; } .display { background-color: rgb(100,255,0); height: 1.25em; border: 1px solid green; font-family: "Courier New"; font-size: x-large; margin-bottom: 1em; padding-top: .15em; padding-right: .25em; text-align: right; color: rgb(0,100,0); }
18.204545
41
0.6804
4bffd63700d0b81e671744fc3265e12eee20070f
1,659
h
C
plugins/2018.3326/iphone/MyTargetSDK.framework/Headers/MTRGConfig.h
solar2d/com.solar2d-plugin.applovinMax.MyTarget
5615c2de209212656ef59f9f8f3711c805ed426c
[ "Zlib" ]
null
null
null
plugins/2018.3326/iphone/MyTargetSDK.framework/Headers/MTRGConfig.h
solar2d/com.solar2d-plugin.applovinMax.MyTarget
5615c2de209212656ef59f9f8f3711c805ed426c
[ "Zlib" ]
null
null
null
plugins/2018.3326/iphone/MyTargetSDK.framework/Headers/MTRGConfig.h
solar2d/com.solar2d-plugin.applovinMax.MyTarget
5615c2de209212656ef59f9f8f3711c805ed426c
[ "Zlib" ]
null
null
null
// // MTRGConfig.h // myTargetSDK 5.15.0 // // Created by Andrey Seredkin on 19.01.2021. // Copyright © 2021 Mail.ru Group. All rights reserved. // #import <Foundation/Foundation.h> @class MTRGConfig; NS_ASSUME_NONNULL_BEGIN /** @discussion Builder for MTRGConfig */ @interface MTRGConfigBuilder : NSObject + (instancetype)new NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE; /** @discussion Method defines track location or not @param trackingLocation Flag for tracking location @return Instance of MTRGConfigBuilder */ - (instancetype)withTrackingLocation:(BOOL)trackingLocation NS_SWIFT_NAME(withTrackingLocation(_:)); /** @discussion Method adds test devices @param testDevices Array of devices identifiers @return Instance of MTRGConfigBuilder */ - (instancetype)withTestDevices:(nullable NSArray<NSString *> *)testDevices NS_SWIFT_NAME(withTestDevices(_:)); /** @discussion Method to build MTRGConfig instance @return Instance of MTRGConfig */ - (MTRGConfig *)build NS_SWIFT_NAME(build()); @end /** @discussion Class to store and manage configuration of SDK */ @interface MTRGConfig : NSObject /** @discussion Returns the location flag */ @property(nonatomic, readonly) BOOL isTrackLocationEnabled; /** @discussion Returns the array of test devices */ @property(nonatomic, readonly, nullable) NSArray<NSString *> *testDevices; /** @discussion Method creates builder of MTRGConfig instance @return Instance of MTRGConfigBuilder */ + (MTRGConfigBuilder *)newBuilder NS_SWIFT_NAME(newBuilder()); + (instancetype)new NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE; @end NS_ASSUME_NONNULL_END
20.7375
111
0.760699
105a0d4130987b49166cb166ad4ee1ab13bc169d
110
sql
SQL
src/test/resources/sql/select/951b8014.sql
Shuttl-Tech/antlr_psql
fcf83192300abe723f3fd3709aff5b0c8118ad12
[ "MIT" ]
66
2018-06-15T11:34:03.000Z
2022-03-16T09:24:49.000Z
src/test/resources/sql/select/951b8014.sql
Shuttl-Tech/antlr_psql
fcf83192300abe723f3fd3709aff5b0c8118ad12
[ "MIT" ]
13
2019-03-19T11:56:28.000Z
2020-08-05T04:20:50.000Z
src/test/resources/sql/select/951b8014.sql
Shuttl-Tech/antlr_psql
fcf83192300abe723f3fd3709aff5b0c8118ad12
[ "MIT" ]
28
2019-01-05T19:59:02.000Z
2022-03-24T11:55:50.000Z
-- file:rangetypes.sql ln:226 expect:true select count(*) from test_range_gist where ir >> int4range(100,500)
36.666667
67
0.763636
6fffd2c6fc6753e200055641ac36ce8b9778bf65
1,561
rb
Ruby
spec/views/to_json_spec.rb
domain808/activecouch
bebe639d41c00a007eccfa3f9e9ea0b0fadcfb01
[ "MIT" ]
1
2016-05-08T19:28:25.000Z
2016-05-08T19:28:25.000Z
spec/views/to_json_spec.rb
domain808/activecouch
bebe639d41c00a007eccfa3f9e9ea0b0fadcfb01
[ "MIT" ]
null
null
null
spec/views/to_json_spec.rb
domain808/activecouch
bebe639d41c00a007eccfa3f9e9ea0b0fadcfb01
[ "MIT" ]
null
null
null
require File.dirname(__FILE__) + '/../spec_helper.rb' describe "ActiveCouch::View #to_json method" do before(:each) do class ByName < ActiveCouch::View define :by_name, :for_db => 'people' do with_key 'name' end end end it "should generate the correct javascript to be used in the view" do (ByName.to_json =~ /emit\(doc\.name, doc\);/).should_not == nil end end describe "ActiveCouch::View #to_json method while calling the with_key and with_filter methods" do before(:each) do class ByLatitude < ActiveCouch::View define :for_db => 'hotels' do with_key 'latitude' with_filter 'doc.name == "Hilton"' end end end it "should generate the correct javascript to be used in the view" do (ByLatitude.to_json =~ /emit\(doc\.latitude, doc\);/).should_not == nil (ByLatitude.to_json =~ /if\(doc\.name == \\"Hilton\\"\)/).should_not == nil end end describe "A subclass of ActiveCouch::View while calling with_key and include_attributes method" do before(:each) do class ByLongitude < ActiveCouch::View define :for_db => 'hotels' do with_key 'latitude' include_attributes :name, :rating, :latitude, :longitude, :address end end end it "should generate the correct javascript which will be used in the permanent view" do (ByLongitude.to_json =~ /emit\(doc\.latitude, \{name: doc\.name , rating: doc\.rating , latitude: doc\.latitude , longitude: doc\.longitude , address: doc\.address\}\);/).should_not == nil end end
33.934783
198
0.66624
c964ab64c77a1f43e4be29fb14087cc65a552c22
865
ts
TypeScript
test/response/inspect_test.ts
ako-deno/ako
574e1c043119a3e108469243a31c33ac14ff8b1a
[ "MIT" ]
22
2020-05-15T15:43:27.000Z
2021-09-24T15:58:05.000Z
test/response/inspect_test.ts
ako-deno/ako
574e1c043119a3e108469243a31c33ac14ff8b1a
[ "MIT" ]
4
2020-05-26T09:33:59.000Z
2020-07-01T07:26:31.000Z
test/response/inspect_test.ts
ako-deno/ako
574e1c043119a3e108469243a31c33ac14ff8b1a
[ "MIT" ]
1
2020-06-17T14:00:24.000Z
2020-06-17T14:00:24.000Z
import { describe, it, assert, assertEquals } from "../deps.ts"; import { response } from "../helpers/context.ts"; describe("res.inspect()", () => { describe("with no response.res present", () => { it("should return null", () => { const res = response(); res.body = "hello"; delete res.res; assertEquals(res.inspect(), "undefined"); assertEquals(Deno.inspect(res), "undefined"); }); }); it("should return a json representation", () => { const res = response(); res.body = "hello"; const expected = { status: 200, message: "OK", header: { "content-type": "text/plain; charset=utf-8", "content-length": "5", }, body: "hello", }; assertEquals(res.inspect(), Deno.inspect(expected)); assertEquals(Deno.inspect(res), Deno.inspect(expected)); }); });
26.212121
64
0.566474
fdf99c5d8207c981b732c24a936393573749864c
101
css
CSS
Ejemplos Bootstrap/04_grid_columnas_responsive/css/style.css
estemontoya/DSWT
eef85b691c279ea7ce37a30c2c0539eecc383926
[ "MIT" ]
null
null
null
Ejemplos Bootstrap/04_grid_columnas_responsive/css/style.css
estemontoya/DSWT
eef85b691c279ea7ce37a30c2c0539eecc383926
[ "MIT" ]
4
2020-05-05T06:08:31.000Z
2021-05-11T12:48:14.000Z
Bootstrap-master/04_grid_columnas_responsive/css/style.css
ferdinandOoO/holamundo2
3dec46475ace206637894629657ad6831ba14628
[ "MIT" ]
null
null
null
.columna { background-color: #fc0; border:1px solid #333; } .columna2 { background-color: #fc0; }
12.625
24
0.673267
dfb823ebacecf44988f18303148a58c2c4fb876c
1,442
cs
C#
projects/Waypoint System/waypoints/ToolWindow.cs
Cabrra/Windows-Tools-Games
2d562bd570150c582e6e16218a83783773dc99d2
[ "MIT" ]
null
null
null
projects/Waypoint System/waypoints/ToolWindow.cs
Cabrra/Windows-Tools-Games
2d562bd570150c582e6e16218a83783773dc99d2
[ "MIT" ]
null
null
null
projects/Waypoint System/waypoints/ToolWindow.cs
Cabrra/Windows-Tools-Games
2d562bd570150c582e6e16218a83783773dc99d2
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace midterm { public partial class ToolWindow : Form { public event EventHandler ToolWindowUpdateClick; public ToolWindow() { InitializeComponent(); } public string ToolWindowLabelText { get { return labelTB.Text; } set { labelTB.Text = value; } } public decimal ToolWindowNumericXValue { get { return numericX.Value; } set { numericX.Value = value; } } public decimal ToolWindowNumericYValue { get { return numericY.Value; } set { numericY.Value = value; } } private void buttonAdd_Click(object sender, EventArgs e) { Form1 form1 = (Form1)this.Owner; // form1. = numericX.Value; if (ToolWindowUpdateClick != null) { ToolWindowUpdateClick(this, EventArgs.Empty); } } } }
19.753425
64
0.476422
38af4e626d6c6830f8f9d0e88ce31f01427ea4ca
1,412
php
PHP
catch/monitor/command/process/ParseTask.php
dsonghui/catch-admin
72bf97579bc422266f620ced36388e1e2ebf7ec6
[ "Apache-2.0" ]
263
2020-10-18T12:43:48.000Z
2022-03-25T14:42:07.000Z
catch/monitor/command/process/ParseTask.php
dsonghui/catch-admin
72bf97579bc422266f620ced36388e1e2ebf7ec6
[ "Apache-2.0" ]
10
2020-10-27T01:53:54.000Z
2021-11-15T00:36:14.000Z
catch/monitor/command/process/ParseTask.php
dsonghui/catch-admin
72bf97579bc422266f620ced36388e1e2ebf7ec6
[ "Apache-2.0" ]
59
2020-10-20T08:06:21.000Z
2022-03-16T13:14:59.000Z
<?php // +---------------------------------------------------------------------- // | CatchAdmin [Just Like ~ ] // +---------------------------------------------------------------------- // | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt ) // +---------------------------------------------------------------------- // | Author: JaguarJack [ njphper@gmail.com ] // +---------------------------------------------------------------------- namespace catchAdmin\monitor\command\process; use catcher\facade\FileSystem; use think\exception\ClassNotFoundException; use think\helper\Str; trait ParseTask { /** * 获取任务 * * @time 2020年09月15日 * @param $crontab * @return mixed */ protected function getTaskObject($crontab) { $class = $this->getTaskNamespace() . ucfirst(Str::camel($crontab['task'])); if (class_exists($class)) { return app()->make($class)->setCrontab($crontab); } throw new ClassNotFoundException('Task '. $crontab['task'] . ' not found'); } /** * 获取任务命名空间 * * @time 2020年09月15日 * @return mixed */ protected function getTaskNamespace() { return config('catch.crontab.task_namespace'); } }
30.042553
83
0.454674
20ef08b0594fd66380a1801f563a4fe840171d4e
1,443
py
Python
src/sentry/api/endpoints/organization_incident_suspects_index.py
learninto/sentry
4f9f564841498b3af49c1677d6b61f3e47b01923
[ "BSD-3-Clause" ]
1
2019-10-17T17:46:16.000Z
2019-10-17T17:46:16.000Z
src/sentry/api/endpoints/organization_incident_suspects_index.py
learninto/sentry
4f9f564841498b3af49c1677d6b61f3e47b01923
[ "BSD-3-Clause" ]
null
null
null
src/sentry/api/endpoints/organization_incident_suspects_index.py
learninto/sentry
4f9f564841498b3af49c1677d6b61f3e47b01923
[ "BSD-3-Clause" ]
null
null
null
from __future__ import absolute_import from sentry.api.bases.incident import IncidentEndpoint, IncidentPermission from sentry.api.serializers import serialize from sentry.api.serializers.models.commit import CommitSerializer from sentry.incidents.logic import get_incident_suspects class OrganizationIncidentSuspectsIndexEndpoint(IncidentEndpoint): permission_classes = (IncidentPermission,) def get(self, request, organization, incident): """ Fetches potential causes of an Incident. ```````````````````````````````````````` Fetches potential causes of an Incident. Currently this is just suspect commits for all related Groups. :auth: required """ # Only fetch suspects for projects that the user has access to projects = [ project for project in incident.projects.all() if request.access.has_project_access(project) ] commits = list(get_incident_suspects(incident, projects)) # These are just commits for the moment, just serialize them directly serialized_suspects = serialize(commits, request.user, serializer=CommitSerializer()) # TODO: For now just hard coding this format. As we add in more formats # we'll handle this in a more robust way. return self.respond( [{"type": "commit", "data": suspect} for suspect in serialized_suspects] )
40.083333
93
0.679834
c56001cfbeea2b662c9b0c8c7dac4a892033d27b
717
css
CSS
public/stylesheets/main.css
jacksylam/playresponsivecastlehigh
6c4e824327d9c358dd5a99ba0765e1c77c8b59e3
[ "Apache-2.0" ]
null
null
null
public/stylesheets/main.css
jacksylam/playresponsivecastlehigh
6c4e824327d9c358dd5a99ba0765e1c77c8b59e3
[ "Apache-2.0" ]
null
null
null
public/stylesheets/main.css
jacksylam/playresponsivecastlehigh
6c4e824327d9c358dd5a99ba0765e1c77c8b59e3
[ "Apache-2.0" ]
null
null
null
body { font-family: "Open Sans", sans-serif; color: #999; background-color: #999; } .page-content { padding:20px; text-align: center; } img { display: block; margin-left: auto; margin-right: auto } .header-image{ background-image: url("../images/header.jpg"); height: 180px; background-size: cover; } .navbar-inverse{ color: #999; background-color: #710C0C; } .nav>li>a{ font-size: 16px; } .well{ background-color: #710C0C; border: 0px; } .well>li{ list-style: none; } .well>li>a{ color: #999; } .frontpicture{ height: 400px; background-size: contain; background-repeat: no-repeat; background-position: center } h2{ font-size: 24px; } h3{ font-size: 18px; }
11.95
48
0.641562
1b1371a330dff0bb81f5beaca3af1e84da17a201
474
cs
C#
src/Core/InvalidSortingFieldException.cs
lucnascimento98/Paginator
f94fa9325dace3d6e341cd51263b36fac477ea68
[ "Unlicense" ]
1
2021-02-22T14:16:02.000Z
2021-02-22T14:16:02.000Z
src/Core/InvalidSortingFieldException.cs
lucnascimento98/Paginator
f94fa9325dace3d6e341cd51263b36fac477ea68
[ "Unlicense" ]
1
2021-07-08T19:30:10.000Z
2022-02-16T17:49:37.000Z
src/Core/InvalidSortingFieldException.cs
lucnascimento98/Paginator
f94fa9325dace3d6e341cd51263b36fac477ea68
[ "Unlicense" ]
1
2022-02-16T17:03:28.000Z
2022-02-16T17:03:28.000Z
using System; namespace Nudes.Paginator.Core { public class InvalidSortingFieldException : Exception { public string Field { get; set; } public InvalidSortingFieldException(string field) :base($"Invalid sorting field {field}") { Field = field; } public InvalidSortingFieldException(string field, Exception ex) : base($"Invalid sorting field {field}", ex) { Field = field; } } }
23.7
116
0.607595
df20b66f07049642eb5a71248e799f11a1497db5
5,599
cs
C#
Assets/Scripts/RythmGame/TimingSound.cs
Beefstyles/LudumDare41
ff226e8c7aaaa20e2e50bf5f03a152eae8ee994f
[ "MIT" ]
null
null
null
Assets/Scripts/RythmGame/TimingSound.cs
Beefstyles/LudumDare41
ff226e8c7aaaa20e2e50bf5f03a152eae8ee994f
[ "MIT" ]
null
null
null
Assets/Scripts/RythmGame/TimingSound.cs
Beefstyles/LudumDare41
ff226e8c7aaaa20e2e50bf5f03a152eae8ee994f
[ "MIT" ]
null
null
null
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TimingSound : MonoBehaviour { public NoteNumbers note; AudioSource sound; public GameObject Note1, Note2, Note3, Note4, Beat; private GameObject _noteSoundLoc; public Material Note1Mat, Note2Mat, Note3Mat, Note4Mat; private Material _noteMaterial; private bool _noteToBeHit; RythmSounds _rythmSounds; GameController _gameController; StreakCounter _streakCounter; void Awake() { _gameController = FindObjectOfType<GameController>(); _rythmSounds = FindObjectOfType<RythmSounds>(); _streakCounter = FindObjectOfType<StreakCounter>(); Note1 = gameObject.transform.Find("Note1").gameObject; Note2 = gameObject.transform.Find("Note2").gameObject; Note3 = gameObject.transform.Find("Note3").gameObject; Note4 = gameObject.transform.Find("Note4").gameObject; Beat = gameObject.transform.Find("Beat").gameObject; Note1Mat = (Material)Resources.Load("Note1Mat", typeof(Material)); Note2Mat = (Material)Resources.Load("Note2Mat", typeof(Material)); Note3Mat = (Material)Resources.Load("Note3Mat", typeof(Material)); Note4Mat = (Material)Resources.Load("Note4Mat", typeof(Material)); switch (note) { case (NoteNumbers.Note1): _noteSoundLoc = Note1; _noteMaterial = Note1Mat; break; case (NoteNumbers.Note2): _noteSoundLoc = Note2; _noteMaterial = Note2Mat; break; case (NoteNumbers.Note3): _noteSoundLoc = Note3; _noteMaterial = Note3Mat; break; case (NoteNumbers.Note4): _noteSoundLoc = Note4; _noteMaterial = Note4Mat; break; case (NoteNumbers.Beat): _noteSoundLoc = Beat; _noteMaterial = Note1Mat; break; } sound = _noteSoundLoc.GetComponent<AudioSource>(); gameObject.GetComponent<MeshRenderer>().material = _noteMaterial; } void Update() { CheckForErrenousNoteHits(); } void OnTriggerEnter(Collider coll) { if (coll.gameObject.tag == "SoundBar") { _noteToBeHit = true; } } void OnTriggerStay(Collider coll) { if(coll.gameObject.tag == "SoundBar") { switch (note) { case (NoteNumbers.Note1): if (Input.GetButton("Note1") && _noteToBeHit) { SuccesfulNoteHit(); } break; case (NoteNumbers.Note2): if (Input.GetButton("Note2") && _noteToBeHit) { SuccesfulNoteHit(); } break; case (NoteNumbers.Note3): if (Input.GetButton("Note3") && _noteToBeHit) { SuccesfulNoteHit(); } break; case (NoteNumbers.Note4): if (Input.GetButton("Note4") && _noteToBeHit) { SuccesfulNoteHit(); } break; case (NoteNumbers.Beat): break; } if (!_noteToBeHit) { //Debug.Log("Tick"); if (!sound.isPlaying) { sound.Stop(); sound.Play(); } } } } void SuccesfulNoteHit() { _noteToBeHit = false; _rythmSounds.CorrectNoteHit.Play(); NotifyTurrets(); _streakCounter.StreakCounterVal++; } void CheckForErrenousNoteHits() { if (!_noteToBeHit && (Input.GetButtonDown("Note1") || Input.GetButtonDown("Note2") || Input.GetButtonDown("Note3") || Input.GetButtonDown("Note4"))) { _rythmSounds.MissedNoteHit.Play(); } } void NotifyTurrets() { foreach (var turret in _gameController.TurretControllers) { turret.SetIfCanFire(note); } } void OnTriggerExit(Collider coll) { if (coll.gameObject.tag == "SoundBar") { if (_noteToBeHit && !note.Equals(NoteNumbers.Beat)) { Debug.Log("Missed note"); _rythmSounds.MissedNoteEntirely.Play(); _noteToBeHit = false; _streakCounter.StreakCounterVal = 0; _streakCounter.DamageMultiplierVal = 1; } switch (note) { case (NoteNumbers.Note1): _gameController.FireTurretsCanFire = false; break; case (NoteNumbers.Note2): _gameController.IceTurretsCanFire = false; break; case (NoteNumbers.Note3): _gameController.PoisonTurretsCanFire = false; break; case (NoteNumbers.Note4): _gameController.EarthTurretsCanFire = false; break; } //Debug.Log("Tock"); if (sound.isPlaying) { sound.Stop(); } } } }
30.763736
156
0.50134
bda8f1de2614afaf99faff1b9c69e0f1e1e22f21
1,665
rb
Ruby
attributes/default.rb
fusco/exim4-cookbook
b86401c73927988d566eff04b3c99d97b8c9d410
[ "Apache-2.0" ]
1
2017-03-12T21:28:42.000Z
2017-03-12T21:28:42.000Z
attributes/default.rb
fusco/exim4-cookbook
b86401c73927988d566eff04b3c99d97b8c9d410
[ "Apache-2.0" ]
null
null
null
attributes/default.rb
fusco/exim4-cookbook
b86401c73927988d566eff04b3c99d97b8c9d410
[ "Apache-2.0" ]
null
null
null
# # Cookbook Name:: exim4 # Attributes:: default # # Author:: Michael Weinrich <micxer@micxer.de> # License:: Apache License, Version 2.0 # # 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. # # main default['exim4']['local_domains'] = [ 'localhost', '@' ] default['exim4']['relay_to_domains'] = [ ] default['exim4']['relay_from_hosts'] = [ '127.0.0.1', '::1' ] default['exim4']['daemon_smtp_ports'] = [ 25, 465, 587 ] default['exim4']['use_tls'] = true default['exim4']['tls_certificate'] = '/etc/ssl/exim.crt' default['exim4']['tls_privatekey'] = '/etc/ssl/exim.pem' default['exim4']['host_lookup'] = [ '*' ] default['exim4']['ignore_bounce_errors_after'] = '2d' default['exim4']['timeout_frozen_after'] = '7d' default['exim4']['split_spool_directory'] = false default['exim4']['check_rfc2047_length'] = true default['exim4']['accept_8bitmime'] = true # acl default['exim4']['dns_blacklists'] = [ 'zen.spamhaus.org' ] # routers default['exim4']['use_userforward'] = true default['exim4']['local_delivery'] = true # additional default['exim4']['use_clamav'] = false default['exim4']['use_spamassassin'] = false default['exim4']['spam']['spam_found_action'] = 'warn'
35.425532
74
0.705105
d442fadc4abcadb588b30e95c71f100a32c917c9
1,309
rs
Rust
crates/shared/src/color.rs
murtyjones/purdy
84b8aa12532f644670780e5edc6c1a3f722314e7
[ "Apache-2.0", "MIT" ]
122
2022-02-01T17:33:12.000Z
2022-03-21T00:22:55.000Z
crates/shared/src/color.rs
murtyjones/purdy
84b8aa12532f644670780e5edc6c1a3f722314e7
[ "Apache-2.0", "MIT" ]
8
2022-02-02T19:56:17.000Z
2022-02-06T12:18:08.000Z
crates/shared/src/color.rs
murtyjones/purdy
84b8aa12532f644670780e5edc6c1a3f722314e7
[ "Apache-2.0", "MIT" ]
null
null
null
use anyhow::{Error, Result}; use std::str::FromStr; use thiserror::Error; use crate::{Cmyk, Gray, Rgb}; #[derive(Debug, Clone, Copy, PartialEq)] pub enum ColorSpace { DeviceRGB, DeviceGray, DeviceCMYK, } #[derive(Debug, Clone, Copy, PartialEq)] pub enum ColorSpaceWithColor { DeviceRGB(Rgb), DeviceGray(Gray), DeviceCMYK(Cmyk), } #[derive(Error, Debug)] pub enum ColorSpaceError { #[error("Unrecognized color space: {0}")] UnrecognizedColorSpace(String), } impl FromStr for ColorSpace { type Err = Error; fn from_str(input: &str) -> Result<ColorSpace, Self::Err> { match input { "DeviceRGB" => Ok(ColorSpace::DeviceRGB), "DeviceGray" => Ok(ColorSpace::DeviceGray), "DeviceCMYK" => Ok(ColorSpace::DeviceCMYK), s => Err(ColorSpaceError::UnrecognizedColorSpace(s.to_owned()).into()), } } } #[derive(Error, Debug)] pub enum ColorError { #[error("Received {0} params for color. Max is four")] TooManyParams(usize), #[error("Received 0 params for color. At least one is required.")] TooFewParams, } pub trait Color { fn set_color_space(&mut self, c: ColorSpace); fn set_color(&mut self, c: Vec<f32>) -> Result<()>; fn get_current_color(&self) -> ColorSpaceWithColor; }
23.8
83
0.641711
20db4aa84f7f8e3d9eaa2432a963d669845ca4fb
6,713
py
Python
kale/embed/attention_cnn.py
Be-Secure/pykale
f8d479e9861639773de603ffaa20127a0ce66e58
[ "MIT" ]
324
2020-11-05T19:07:11.000Z
2022-03-16T21:31:39.000Z
kale/embed/attention_cnn.py
Be-Secure/pykale
f8d479e9861639773de603ffaa20127a0ce66e58
[ "MIT" ]
212
2020-10-31T15:18:59.000Z
2022-03-25T14:13:09.000Z
kale/embed/attention_cnn.py
Be-Secure/pykale
f8d479e9861639773de603ffaa20127a0ce66e58
[ "MIT" ]
52
2020-10-28T15:43:48.000Z
2022-02-24T02:29:52.000Z
from typing import Tuple import torch import torch.nn as nn from kale.embed.positional_encoding import PositionalEncoding from kale.prepdata.tensor_reshape import seq_to_spatial, spatial_to_seq class ContextCNNGeneric(nn.Module): """ A template to construct a feature extractor consisting of a CNN followed by a sequence-to-sequence contextualizer like a Transformer-Encoder. Before inputting the CNN output tensor to the contextualizer, the tensor's spatial dimensions are unrolled into a sequence. Args: cnn: any convolutional neural network that takes in batches of images of shape (batch_size, channels, height, width) and outputs tensor representations of shape (batch_size, out_channels, out_height, out_width). cnn_output_shape: A tuple of shape (batch_size, num_channels, height, width) describing the output shape of the given CNN (required). contextualizer: A sequence-to-sequence model that takes inputs of shape (num_timesteps, batch_size, num_features) and uses attention to contextualize the sequence and returns a sequence of the exact same shape. This will mainly be a Transformer-Encoder (required). output_type: One of 'sequence' or 'spatial'. If Spatial then the final output of the model, which is a sequence, will be reshaped to resemble the image-batch shape of the output of the CNN. If Sequence then the output sequence is returned as is (required). Examples: >>> cnn = nn.Sequential(nn.Conv2d(3, 32, kernel_size=3), >>> nn.Conv2d(32, 64, kernel_size=3), >>> nn.MaxPool2d(2)) >>> cnn_output_shape = (-1, 64, 8, 8) >>> contextualizer = nn.TransformerEncoderLayer(...) >>> output_type = 'spatial' >>> >>> attention_cnn = ContextCNNGeneric(cnn, cnn_output_shape, contextualizer, output_type) >>> output = attention_cnn(torch.randn((32,3,16,16))) >>> >>> output.size() == cnn_output_shape # True """ def __init__( self, cnn: nn.Module, cnn_output_shape: Tuple[int, int, int, int], contextualizer: nn.Module, output_type: str ): super(ContextCNNGeneric, self).__init__() assert output_type in ["spatial", "sequence"], ( "parameter 'output_type' must be one of ('spatial', 'sequence')" + f" but is {output_type}" ) self.cnn = cnn self.cnn_output_shape = cnn_output_shape self.contextualizer = contextualizer self.output_type = output_type def forward(self, x: torch.Tensor): """ Pass the input through the cnn and then the contextualizer. Args: x: input image batch exactly as for CNNs (required). """ cnn_rep = self.cnn(x) seq_rep = spatial_to_seq(cnn_rep) seq_rep = self.contextualizer(seq_rep) output = seq_rep if self.output_type == "spatial": desired_height = self.cnn_output_shape[2] desired_width = self.cnn_output_shape[3] output = seq_to_spatial(output, desired_height, desired_width) return output class CNNTransformer(ContextCNNGeneric): """ A feature extractor consisting of a given CNN backbone followed by a standard Transformer-Encoder. See documentation of "ContextCNNGeneric" for more information. Args: cnn: any convolutional neural network that takes in batches of images of shape (batch_size, channels, height, width) and outputs tensor representations of shape (batch_size, out_channels, out_height, out_width) (required). cnn_output_shape: a tuple of shape (batch_size, num_channels, height, width) describing the output shape of the given CNN (required). num_layers: number of attention layers in the Transformer-Encoder (required). num_heads: number of attention heads in each transformer block (required). dim_feedforward: number of neurons in the intermediate dense layer of each transformer feedforward block (required). dropout: dropout rate of the transformer layers (required). output_type: one of 'sequence' or 'spatial'. If Spatial then the final output of the model, which is the sequence output of the Transformer-Encoder, will be reshaped to resemble the image-batch shape of the output of the CNN (required). positional_encoder: None or a nn.Module that expects inputs of shape (sequence_length, batch_size, embedding_dim) and returns the same input after adding some positional information to the embeddings. If `None`, then the default and fixed sin-cos positional encodings of base transformers are applied (optional). Examples: See pykale/examples/cifar_cnntransformer/model.py """ def __init__( self, cnn: nn.Module, cnn_output_shape: Tuple[int, int, int, int], num_layers: int, num_heads: int, dim_feedforward: int, dropout: float, output_type: str, positional_encoder: nn.Module = None, ): num_channels = cnn_output_shape[1] height = cnn_output_shape[2] width = cnn_output_shape[3] encoder_layer = nn.TransformerEncoderLayer(num_channels, num_heads, dim_feedforward, dropout) encoder_normalizer = nn.LayerNorm(num_channels) encoder = nn.TransformerEncoder(encoder_layer, num_layers, encoder_normalizer) if positional_encoder is None: positional_encoder = PositionalEncoding(d_model=num_channels, max_len=height * width) else: # allows for passing the identity block to skip this step # or chosing a different encoding positional_encoder = positional_encoder transformer_input_dropout = nn.Dropout(dropout) contextualizer = nn.Sequential(positional_encoder, transformer_input_dropout, encoder) super(CNNTransformer, self).__init__(cnn, cnn_output_shape, contextualizer, output_type) # Copied from https://pytorch.org/docs/stable/_modules/torch/nn/modules/transformer.html#Transformer for p in encoder.parameters(): if p.dim() > 1: nn.init.xavier_uniform_(p)
45.358108
118
0.641889
562d62cdbd219d2ddf1ae07bcf92220834b35ecf
1,632
rs
Rust
old-katas-iteration-01/src/lexer_sql_kata/day_3.rs
alex-dukhno/rust-tdd-katas
003c463fea2dec90a01330c73a8f2235dda0f748
[ "MIT" ]
null
null
null
old-katas-iteration-01/src/lexer_sql_kata/day_3.rs
alex-dukhno/rust-tdd-katas
003c463fea2dec90a01330c73a8f2235dda0f748
[ "MIT" ]
null
null
null
old-katas-iteration-01/src/lexer_sql_kata/day_3.rs
alex-dukhno/rust-tdd-katas
003c463fea2dec90a01330c73a8f2235dda0f748
[ "MIT" ]
null
null
null
use std::iter::Peekable; use std::str::Chars; #[derive(PartialEq)] enum SymbolGroup { AlphaNumeric, WhiteSpace, Dot, LeftParenthesis, RightParenthesis, SemiColon, SingleQuote, Else } pub struct Lexer<'a> { iter: Peekable<Chars<'a>> } impl <'a> Lexer<'a> { pub fn new(line: &'a str) -> Lexer { Lexer { iter: line.chars().peekable() } } pub fn next_lexem(&mut self) -> Option<String> { let mut value = vec![]; let expected = self.define_symbol_group(); if expected == SymbolGroup::Else { return None; } loop { let actual = self.define_symbol_group(); if expected == actual { value.push(self.iter.next().unwrap()); } else { break; } } Some(value.iter().cloned().collect::<String>()) } fn define_symbol_group(&mut self) -> SymbolGroup { let symbol = self.peek_next_symbol(); match symbol { Some('a'...'z') | Some('A'...'Z') | Some('0'...'9') | Some('_') => SymbolGroup::AlphaNumeric, Some('.') => SymbolGroup::Dot, Some('(') => SymbolGroup::LeftParenthesis, Some(')') => SymbolGroup::RightParenthesis, Some(';') => SymbolGroup::SemiColon, Some('\'') => SymbolGroup::SingleQuote, Some(' ') | Some('\t') => SymbolGroup::WhiteSpace, Some(_) | None => SymbolGroup::Else, } } fn peek_next_symbol(&mut self) -> Option<char> { self.iter.peek().cloned() } }
26.322581
69
0.509191
4041b849c663d54525f8d3380122a3d51a70fc89
796
rb
Ruby
spec/features/following_spec.rb
marijanbrvar/Opinioner
e6227a4db5469933f853945363db2b2148a3ccad
[ "MIT" ]
1
2021-05-04T07:32:13.000Z
2021-05-04T07:32:13.000Z
spec/features/following_spec.rb
marijanbrvar/Opinioner
e6227a4db5469933f853945363db2b2148a3ccad
[ "MIT" ]
null
null
null
spec/features/following_spec.rb
marijanbrvar/Opinioner
e6227a4db5469933f853945363db2b2148a3ccad
[ "MIT" ]
null
null
null
require 'rails_helper' RSpec.feature 'Followings', type: :feature do before :each do @user = User.create(full_name: 'User Primo', username: 'Primo') @second_user = User.create(full_name: 'User Secondo', username: 'Secondo') visit root_path page.fill_in 'username', with: 'Primo' click_button 'Login!' end scenario 'Following a user', type: :feature do have_link 'User Secondo', href: profile_path(@second_user.id) click_link 'Follow' have_link 'Profile', href: profile_path(@user.id) visit profile_path(@user.id) expect(page).to have_content('Primo') expect(page).to have_text 'User Primo' expect(page).to have_text '@Primo' have_link 'Follow', href: follow_path(@second_user.id) expect(page).to have_text @user.full_name end end
33.166667
78
0.701005
75dd4531d0069e0eedc7847ba493545a40308d74
210
css
CSS
static/styles/header.css
lhjok/Rust-Yew
81d000089df8e48426da2afa731ae33f37020d87
[ "MIT" ]
null
null
null
static/styles/header.css
lhjok/Rust-Yew
81d000089df8e48426da2afa731ae33f37020d87
[ "MIT" ]
null
null
null
static/styles/header.css
lhjok/Rust-Yew
81d000089df8e48426da2afa731ae33f37020d87
[ "MIT" ]
null
null
null
& { position: fixed; width: 100%; height: 60px; font-size: 12px; color: #fff; font-weight: bold; background-color: #00d1b2; border-bottom: 1px solid #009781; z-index: 9999; }
19.090909
37
0.580952
47d02068d9135902ec28397fb177b4befa9f3fe6
52
rb
Ruby
test/fixtures/cookbooks/test/metadata.rb
chris-carr-bose/push-jobs
db9f66cb3f5c32a1a031839e0f9ef2346eeed45f
[ "Apache-2.0" ]
16
2015-10-21T16:27:15.000Z
2018-10-29T02:51:25.000Z
test/fixtures/cookbooks/test/metadata.rb
chris-carr-bose/push-jobs
db9f66cb3f5c32a1a031839e0f9ef2346eeed45f
[ "Apache-2.0" ]
85
2015-09-17T18:18:41.000Z
2020-04-10T17:10:45.000Z
test/fixtures/cookbooks/test/metadata.rb
chris-carr-bose/push-jobs
db9f66cb3f5c32a1a031839e0f9ef2346eeed45f
[ "Apache-2.0" ]
49
2015-11-14T05:50:29.000Z
2020-03-12T17:31:14.000Z
name 'test' version '1.0.0' depends 'push-jobs'
10.4
19
0.634615
af7fd524b0e46b7ff4c1b2d866179e74bde84c16
853
py
Python
src/bdbd/src/bdbd/analysis/motion/scratch.py
rkent/BDBD
c5d391da84faf5607c443078781f8b4e1c017dd5
[ "MIT" ]
null
null
null
src/bdbd/src/bdbd/analysis/motion/scratch.py
rkent/BDBD
c5d391da84faf5607c443078781f8b4e1c017dd5
[ "MIT" ]
null
null
null
src/bdbd/src/bdbd/analysis/motion/scratch.py
rkent/BDBD
c5d391da84faf5607c443078781f8b4e1c017dd5
[ "MIT" ]
null
null
null
# just a scratchpad for test calculations from numpy.lib.financial import nper import numpy as np from numpy.random import default_rng import time from math import sin, cos from bdbd_common.utils import fstr, gstr tp = -0.00111230739817 tc = -0.00106991938304 tm = -0.0010275313679 print((-tp -tm +2*tc)/(1.e-3)**2) print('tp-tc', tp-tc, 'tc-tm', tc-tm) alpha = [0.0122518596654208, 0.0212410881855422, 0.0368257423466405, 0.0638449069809995, 0.110688118899098, 0.191900344832, 0.33269824, 0.5768, 1 ] bmotor = [0.00292872850023364, -0.00116699925899113, -0.000150659061121022, -0.000102798320922463, -0.000324244574766243, -0.000441262410214323, -0.000181578006905556, -0.00152929510021145, -5.82561059489067e-06 ] sum = 0.0 for i in range(len(alpha)): sum += alpha[i] * bmotor[i] print('omegan', sum)
38.772727
213
0.711606
443d3cb99dbf172343d1a772ccf722fe13e6b4b8
3,287
py
Python
data/process_data.py
sahikabetul/Disaster-Response-Pipeline
7bed8206f53449f6775cdce724e15a04f98d0774
[ "MIT" ]
1
2022-01-04T09:24:40.000Z
2022-01-04T09:24:40.000Z
data/process_data.py
sahikabetul/Disaster-Response-Pipeline
7bed8206f53449f6775cdce724e15a04f98d0774
[ "MIT" ]
null
null
null
data/process_data.py
sahikabetul/Disaster-Response-Pipeline
7bed8206f53449f6775cdce724e15a04f98d0774
[ "MIT" ]
null
null
null
import sys import pandas as pd from sqlalchemy import create_engine def load_data(messages_filepath, categories_filepath): """ Load data from two .csv file and then merge them by "id" column Args: messages_filepath: str. the file path of id and messages .csv file categories_filepath: str. the file path of id and categories .csv file Returns: df (DataFrame): A dataframe of messages and categories """ #reading messages and categories from .csv and merging them by 'id' messages = pd.read_csv(messages_filepath) categories = pd.read_csv(categories_filepath) # merge to df by 'id' column and return return pd.merge(messages, categories, on="id") def clean_data(df): """ Load dataframe and split "categories" column to seperate category columns Args: df: dataframe. the raw dataframe Returns: df (DataFrame): A dataframe of splitted categories """ # taking category names from first row of dataframe categories = df["categories"].str.split(";", expand = True) row = categories.loc[0, :] category_colnames = row.apply(lambda x: x[:-2]) categories.columns = category_colnames # Convert category values to just numbers 0 or 1 for column in categories: # set each value to be the last character of the string categories[column] = categories[column].apply(lambda x: x[-1]) # convert column from string to numeric categories[column] = categories[column].apply(lambda x: 0 if int(x) == 0 else 1) # drop 'related' column values other than '1, 0' (only different value is '2') categories = categories[categories.related != 2] #drop raw categories column df.drop(['categories'], axis=1, inplace=True) #concatenate created catories dataframe with original dataframe df = pd.concat([df, categories], axis=1, join='inner') df=df.drop_duplicates(subset='id') return df def save_data(df, database_filename): """save data to sql database""" engine = create_engine('sqlite:///{}'.format(database_filename)) df.to_sql("MessagesCategories", engine, if_exists='replace', index=False) def main(): if len(sys.argv) == 4: messages_filepath, categories_filepath, database_filepath = sys.argv[1:] print('Loading data...\n MESSAGES: {}\n CATEGORIES: {}' .format(messages_filepath, categories_filepath)) df = load_data(messages_filepath, categories_filepath) print('Cleaning data...') df = clean_data(df) print('Saving data...\n DATABASE: {}'.format(database_filepath)) save_data(df, database_filepath) print('Cleaned data saved to database!') print(len(df)) else: print('Please provide the filepaths of the messages and categories '\ 'datasets as the first and second argument respectively, as '\ 'well as the filepath of the database to save the cleaned data '\ 'to as the third argument. \n\nExample: python process_data.py '\ 'disaster_messages.csv disaster_categories.csv '\ 'DisasterResponse.db') if __name__ == '__main__': main()
34.239583
88
0.652267
2d69cc78eb7f44261e66875ec0c60568bd4a7628
7,733
css
CSS
assets/button-file.css
shahnazsyifaa/E-LANG
adbe6e9c4d308eaacc958454bb12ace565c2f7fd
[ "MIT" ]
null
null
null
assets/button-file.css
shahnazsyifaa/E-LANG
adbe6e9c4d308eaacc958454bb12ace565c2f7fd
[ "MIT" ]
null
null
null
assets/button-file.css
shahnazsyifaa/E-LANG
adbe6e9c4d308eaacc958454bb12ace565c2f7fd
[ "MIT" ]
null
null
null
/* UNGGAH */ .imageThumb { max-height: 75px; object-fit: cover; padding: 1px; cursor: pointer; } .remove { display: block; color: red; border: none; text-align: center; cursor: pointer; } .remove:hover { background-color: none; color: black; } /* UNGGAH */ #custom-button { padding-top: 10px; padding-bottom: 10px; padding-left: 40px; padding-right: 40px; color: #6F6F6F; background-color: #f2f2f2; border: none; border-radius: 5px; cursor: pointer; box-shadow: 0 0px 0px 0px rgba(0,0,0,0.2), 0px 1px 2px 1px rgba(0,0,0,0.19); } #custom-button:hover { background-color: #ffffff !important; } .buttonSub{ background-color: #11212E; } #custom-text { margin-left: 10px; font-family: sans-serif; color: #aaa; } * { box-sizing: border-box; } input[type=text], input[type=date], select, textarea { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 4px; } label { padding: 12px 12px 12px 0; display: inline-block; } input[type=submit] { background-color: #4CAF50; color: white; padding: 12px 20px; border: none; border-radius: 4px; cursor: pointer; float: right; } input[type=submit]:hover { background-color: #45a049; } .container { border-radius: 5px; background-color: #ffffff !important; box-shadow: 0 .125rem .25rem rgba(0,0,0,.075)!important; padding: 40px; } /* .container1{ display: flex; justify-content: space-between; } */ .col-25 { float: left; width: 25%; margin-top: 6px; } .col-50 { float: left; width: 50%; margin-top: 6px; } .col-75 { float: left; width: 75%; margin-top: 6px; } /* btton add ciri */ .addBtn{ padding-left: 10px; } .addBtn:hover{ cursor: pointer; color: #6f6f6f; } /* button upload 2 */ input[type="file"] { display: block; } .imageThumb { max-height: 125px; border: 2px solid; border-color: #ccc; padding: 1px; cursor: pointer; } .pip { display: inline-block; margin: 10px 10px 0 0; } .remove { display: block; background: #444; border: 1px solid black; color: white; text-align: center; cursor: pointer; } .remove:hover { background: white; color: black; } /* Clear floats after the columns */ .row:after { content: ""; display: table; clear: both; } .isi{ padding-top: 100px; position: relative; width: 100%; overflow-y: auto; } #image1{ padding-right: 20px; max-width: 200px; margin-right: 10px !important; } /* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */ @media screen and (max-width: 600px) { .col-25, .col-75, input[type=submit] { width: 100%; margin-top: 0; } } /* PAGE SEARCH RES */ .btn-lgt{ border-radius: 15px; box-shadow: 0 0px 0px 0px rgba(0,0,0,0.2), 0px 1px 2px 1px rgba(0,0,0,0.19); border: none !important; } /* */ /* NAVBAR PUNYA DEDE*/ .navbar { /* position: fixed !important; */ width: 100%; } .nav-right{ position: absolute; margin-left: 1000px; width: 33px; height: 22px; top: 12px; } .items{ padding-right: 15px; padding-left: 25px; } /* .container img{ position: absolute; right: 0px; height: 605px; width:1373px; } */ .dropdown{ margin-left: 110px; } /* body */ body{ background-color: white; } /* container */ .container{ display: flex; justify-content: space-between; } /* main */ .main{ width: 100%; margin-left: -50px; } .txt{ text-align: center; color: #11212E; padding-left: 20px; padding-top: 70px; } .d-flex{ display: flex; justify-content: space-between; } .detailprof{ display: flex; justify-content: space-between; } .detailprof img{ position: absolute; border-radius: 100px; border: 5px solid; width: 130px; height: 124px; left: 1170px; margin-top: -50px; } .detailprof h4{ position: absolute; margin-left: -400px; } .tabel{ padding-top: 90px; } ul{list-style-type:none; } /* css maya */ @import url('https://fonts.googleapis.com/css?family=Roboto&display=swap'); /*NAVBAR*/ .img-card{ object-fit: cover; object-position: 80% 0; width: 300px; height: 250px; border-top-left-radius: 15px !important; border-top-right-radius: 15px !important; padding:0px !important; } .nav-o{ padding-left: 70px; padding-right: 70px; } a:link, a:visited, a:hover{ color: #212529; text-decoration: none; cursor: hand; } a:link:active, a:visited:active { color: #212529; } .logo-o{ position: absolute; width: 90px; height: 40px; top: 9px; } .font-of{ font-family: 'Roboto', sans-serif; } .fontc-of{ color: #90A0B7; } .bg-of{ background-color: #F9FAFB; padding-top: 150px; height: 580px; } .bg-loginregist-of{ height: 1000px; background-image: url('../img/bg-login-register.svg'); } .box-loginregist-of{ font-size: 14px; } .fonttitle-lr-of{ font-size: 60px; color: #334D6E; /* font-weight: bold; */ } .font-lr-of{ font-size: 14px; color: #90A0B7; line-height: 16px; } .btn-lr-of{ width: 124px; height: 48px; left: 642px; top: 660px; background: #109CF1; box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.24); border-radius: 5px; } /*tabel*/ .table-of{ width: 95%; } .cb-of{ width: 16px; height: 16px; left: 1363px; top: 412px; } .bg2-of{ background-color: #F9FAFB; height: 1000px; } .btn-border-of{ border: 1px solid #90A0B7; } .langding-of{ padding-top: 60px; padding-left: 10%; } .borderr-of{ border-radius: 100px; } .fontt-landing-of{ font-size: 40px; } .fotoimg-of{ width: 50px; height: 50px; } .userimg-of{ width: 35px; height: 35px; border-radius: 100px; } .sidebar-of{ height: 1000px; } .fontc-1-of{ color: #90A0B7; font-size: 14px; } .fontc-2-of{ font-weight: bold; font-size: 16px; } .fontc-3-of{ color: #707683; } .fontc-4-of{ color: #334D6E; } .fontc-5-of{ color: #90A0B7; font-size: 18px; } .fontc-6-of{ color: #848A9A; } .fontc-7-of{ color: #C24447; } .fontc-8-of{ color: #334D6E; font-size: 30px; text-align: center; } .fontc-9-of{ color: #334D6F; text-align: center; } .font14-of{ font-size: 14px; } .font18-of{ font-size: 18px; } .btns-1-of{ border: 1px solid #90A0B7; } .btns-2-of{ background: #3DB39E; border-radius: 5px; color: white; margin-left: 200px; } .icon-1-of{ height: 120px; width: 120px; margin-left: 165px; } .input-group-append{ max-width: 16px; max-height: 16px; margin-right: 4px;margin-top:5px;margin-bottom:4px; } .alert-of{ height: 70px; } .box-of{ box-shadow: 0px 1px 26px rgba(0, 0, 0, 0.2); border-radius: 30px; height: auto !important; width: auto; } /* .row{ margin-right: 0px !important; margin-left: 0px !important; padding: 0px !important; } */ .pickantin-of{ width : 100%; } hr{ margin: 20px 130px 0 350px; } .search-field{ margin-left:320px; margin-top: 100px; margin-right: 100px; padding-top: 20px;padding-bottom: 20px; } .fil{ background-color: #109CF1; margin-left: 250px !important; width: 100px !important; } .footer-of{ background: #109CF1; height: 55px; } .pd1-of{ margin-left: 230px; } /* <img src="../assets/img/bg-login-register.svg" class="bg-of"> .nav-o{ width: 1440px; height: 105px; left: 0px; top: 0px; } .nav-brand-o{ margin-right: 9px; } .nav-btn-o{ width: 120px; height: 48px; top: 28px; background: #FFFFFF; border: 1px solid rgba(0, 0, 0, 0.25); box-sizing: border-box; border-radius: 5px; margin-right: 10px; } */
14.481273
144
0.616837
f467799ccc2935576bc7c926921c0f71e4e25beb
2,398
cs
C#
LoginSB/FormLogin.cs
Roberth17/6B-RobertoCarlosRmz
32c854c29ad9908043e0afeaf8eb9d9fa42a2481
[ "MIT" ]
null
null
null
LoginSB/FormLogin.cs
Roberth17/6B-RobertoCarlosRmz
32c854c29ad9908043e0afeaf8eb9d9fa42a2481
[ "MIT" ]
null
null
null
LoginSB/FormLogin.cs
Roberth17/6B-RobertoCarlosRmz
32c854c29ad9908043e0afeaf8eb9d9fa42a2481
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace LoginSB { public partial class FormLogin : Form { public FormLogin() { InitializeComponent(); } private void Btn_Iniciar_Click_1(object sender, EventArgs e) { Login lg = new Login(); lg.Usuario = txt_user.Text; lg.Contraseña = txt_pass.Text; if (lg.ValidarLogin(lg.Usuario, lg.Contraseña)) { Menu_ppal_Forma mp = new Menu_ppal_Forma(); mp.Show(); this.Hide(); } } private void Btn_Salir_Click_1(object sender, EventArgs e) { Application.Exit(); } private void PbxCualEs_Click(object sender, EventArgs e) { MessageBox.Show("Los Usuarios son: \n Admin & Empleado"); } private void btn_Salir_MouseEnter(object sender, EventArgs e) { btn_Salir.BackColor = Color.Red; btn_Salir.ForeColor = Color.White; } private void btn_Salir_MouseLeave(object sender, EventArgs e) { btn_Salir.BackColor = Color.Silver; btn_Salir.ForeColor = Color.Black; } private void btn_Iniciar_MouseEnter(object sender, EventArgs e) { btn_Iniciar.BackColor = Color.LightYellow; } private void btn_Iniciar_MouseLeave(object sender, EventArgs e) { btn_Iniciar.BackColor = Color.Silver; } private void txt_pass_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar==Convert.ToChar(Keys.Enter)) { Login lg = new Login(); lg.Usuario = txt_user.Text; lg.Contraseña = txt_pass.Text; if (lg.ValidarLogin(lg.Usuario, lg.Contraseña)) { Menu_ppal_Forma mp = new Menu_ppal_Forma(); mp.Show(); this.Hide(); } } } private void FormLogin_FormClosing(object sender, FormClosingEventArgs e) { Application.Exit(); } } }
26.94382
81
0.550459
141ac6eb41157d478b32fc9d6a581b8725740d9a
997
ts
TypeScript
packages/core/src/domain/codecs.ts
katsuroinoue/ccx
92a903789dfd8de36597d8b31a97f081ec8db1c0
[ "MIT" ]
2
2021-02-05T04:56:12.000Z
2021-02-10T04:07:01.000Z
packages/core/src/domain/codecs.ts
kk-mats/ccx
7ca29f7d6b767e7493e5804690b53a1e4973f648
[ "MIT" ]
null
null
null
packages/core/src/domain/codecs.ts
kk-mats/ccx
7ca29f7d6b767e7493e5804690b53a1e4973f648
[ "MIT" ]
1
2021-06-28T01:19:54.000Z
2021-06-28T01:19:54.000Z
import * as t from "io-ts"; import { brand, detectRequest } from "common/all/codecs"; import { internalJobEntityId } from "common/server-only/codecs"; export const artifactPath = brand(t.string, "ArtifactPath"); export const detectorServerRequest = t.type({ id: internalJobEntityId, query: detectRequest }); export const rawFragment = t.type({ file: t.string, begin: t.number, end: t.number }); export const rawClonePair = t.intersection([ t.type({ f1: rawFragment, f2: rawFragment }), t.partial({ similarity: t.number }) ]); export const rawCloneSet = t.type({ fragments: t.array(rawFragment) }); export const rawDetectionResult = t.intersection([ t.partial({ extensions: t.UnknownRecord }), t.union([ t.intersection([ t.type({ clonePairs: t.array(rawClonePair) }), t.partial({ cloneSets: t.undefined }) ]), t.intersection([ t.partial({ clonePairs: t.undefined }), t.type({ cloneSets: t.array(rawCloneSet) }) ]) ]) ]);
17.803571
64
0.665998
e29dc5ec99d0d156a71910bba3286fd40b367770
1,359
py
Python
insec.py
Echo-sense/Echosense-App
35e31c3d6ab12c49ea8499b627779aa3aaeeaa40
[ "Apache-2.0" ]
null
null
null
insec.py
Echo-sense/Echosense-App
35e31c3d6ab12c49ea8499b627779aa3aaeeaa40
[ "Apache-2.0" ]
null
null
null
insec.py
Echo-sense/Echosense-App
35e31c3d6ab12c49ea8499b627779aa3aaeeaa40
[ "Apache-2.0" ]
1
2019-10-23T20:53:11.000Z
2019-10-23T20:53:11.000Z
def intersects(line1, line2): def onSeg(p, q, r): if (q[0] <= max(p[0],r[0]) and q[0] >= min(p[0],r[0]) and q[0] <= max(p[1],r[1]) and q[1] >= min(p[1],r[1])): return True return False #0 -> colinear, 1 -> clockwise, 2 -> ccw def orientation(p,q,r): val = (q[1]-p[1]) * (r[0] - q[0]) - (q[0]-p[0]) * (r[1] - q[1]) if val == 0: return 0 if val > 0: return 1 return 2 p1 , q1 = line1 p2 , q2 = line2 o1 = orientation(p1, q1, p2) o2 = orientation(p1, q1, q2) o3 = orientation(p2, q2, p1) o4 = orientation(p2, q2, q1) x1, y1 = p1 x2, y2 = q1 x3, y3 = p2 x4, y4 = q2 if (o1 != o2 and o3 != o4): #general xd = (x1*y2 - y1*x2)*(x3-x4)-(x1-x2)*(x3*y4-y3*x4) xn = (x1-x2)*(y3-y4) - (y1-y2)*(x3-x4) yd = (x1*y2 - y1*x2)*(y3-y4)-(y1-y2)*(x3*y4-y3*x4) yn = (x1-x2)*(y3-y4) - (y1-y2)*(x3-x4) return (xd/xn , yd/yn) if (o1 == 0 and onSeg(p1,p2,q1)): #p2 lies on p1q1 return p2 if (o2 == 0 and onSeg(p1,q2,q1)): #q2 lies on p1q1 return q2 if (o3 == 0 and onSeg(p2,p1,q2)): #p1 lies on p2q2 return p1 if (o4 == 0 and onSeg(p2,q1,q2)): #q1 lies on p2q2 return q1 return (-1,-1)
31.604651
72
0.440029
da325061e679d557e5260afa6c5630c6faf66f52
1,145
php
PHP
tests/Symfony/Tests/Component/Security/Core/Authorization/Voter/RoleHierarchyVoterTest.php
bcremer/symfony
42fe9fc35fc7821f585379afe67d4a8bec7c2c5e
[ "MIT" ]
1
2018-09-08T16:47:38.000Z
2018-09-08T16:47:38.000Z
tests/Symfony/Tests/Component/Security/Core/Authorization/Voter/RoleHierarchyVoterTest.php
bcremer/symfony
42fe9fc35fc7821f585379afe67d4a8bec7c2c5e
[ "MIT" ]
17
2018-05-11T12:16:08.000Z
2019-01-15T21:44:51.000Z
tests/Symfony/Tests/Component/Security/Core/Authorization/Voter/RoleHierarchyVoterTest.php
bcremer/symfony
42fe9fc35fc7821f585379afe67d4a8bec7c2c5e
[ "MIT" ]
1
2022-03-29T01:14:21.000Z
2022-03-29T01:14:21.000Z
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Tests\Component\Security\Core\Authorization\Voter; use Symfony\Component\Security\Core\Authorization\Voter\RoleHierarchyVoter; use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; use Symfony\Component\Security\Core\Role\RoleHierarchy; require_once __DIR__.'/RoleVoterTest.php'; class RoleHierarchyVoterTest extends RoleVoterTest { /** * @dataProvider getVoteTests */ public function testVote($roles, $attributes, $expected) { $voter = new RoleHierarchyVoter(new RoleHierarchy(array('ROLE_FOO' => array('ROLE_FOOBAR')))); $this->assertSame($expected, $voter->vote($this->getToken($roles), null, $attributes)); } public function getVoteTests() { return array_merge(parent::getVoteTests(), array( array(array('ROLE_FOO'), array('ROLE_FOOBAR'), VoterInterface::ACCESS_GRANTED), )); } }
29.358974
102
0.71441
742b534851c59c23dc7c449910602461852d2e25
1,638
css
CSS
main.css
tomwalsh-home/zoom-mirror
e6200a609f67152ddd47808bc5954305f144672d
[ "MIT" ]
null
null
null
main.css
tomwalsh-home/zoom-mirror
e6200a609f67152ddd47808bc5954305f144672d
[ "MIT" ]
null
null
null
main.css
tomwalsh-home/zoom-mirror
e6200a609f67152ddd47808bc5954305f144672d
[ "MIT" ]
null
null
null
html, body { height: 100%; } body { display: flex; justify-content: center; align-items: center; height: 100%; background: #1D1F20; } #subtitle { color: #eee; font-family: 'Raleway'; display: flex; align-items: center; justify-content: center; padding-top: 20px; } #camera { display: flex; align-items: center; justify-content: center; color: #eee; font-family: 'Raleway'; font-size: 2.5rem; } /* Gradient credit: https://codepen.io/mike-schultz */ .gradient-border { --borderWidth: 8px; background: #1D1F20; position: relative; border-radius: var(--borderWidth); } .gradient-border:after { content: ''; position: absolute; top: calc(-1 * var(--borderWidth)); left: calc(-1 * var(--borderWidth)); height: calc(100% + var(--borderWidth) * 2); width: calc(100% + var(--borderWidth) * 2); background: linear-gradient(60deg, #f79533, #f37055, #ef4e7b, #a166ab, #5073b8, #1098ad, #07b39b, #6fba82); border-radius: calc(2 * var(--borderWidth)); z-index: -1; animation: animatedgradient 3s ease alternate infinite; background-size: 300% 300%; animation-delay: 2s; } @keyframes animatedgradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } } .loader { border: 16px solid #f3f3f3; /* Light grey */ border-top: 16px solid limegreen; /* Blue */ border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin: 20px auto; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
20.475
109
0.634921
be3b5e6a967d04bb4473e633ea2131d6ad098a7e
173
ts
TypeScript
Code/RepairShop/wwwroot/app/login.init.ts
AymanGaafar/RepairShop
5f9f1852e9838a11a3be6117ba921709228cbbdf
[ "Apache-2.0" ]
null
null
null
Code/RepairShop/wwwroot/app/login.init.ts
AymanGaafar/RepairShop
5f9f1852e9838a11a3be6117ba921709228cbbdf
[ "Apache-2.0" ]
null
null
null
Code/RepairShop/wwwroot/app/login.init.ts
AymanGaafar/RepairShop
5f9f1852e9838a11a3be6117ba921709228cbbdf
[ "Apache-2.0" ]
null
null
null
module App { angular.module(Config.appName, []); angular.element(document).ready(function () { angular.bootstrap(document, [Config.appName]); }); }
19.222222
54
0.618497
ba9315789594106df2b7ae5ec1f0e6f5b9a91185
457
go
Go
golang/buildings_with_an_ocean_view/find_buildings.go
lee-hen/leetcode
d1045d4dd168af743fc36c1244accb8091c892da
[ "MIT" ]
1
2022-01-26T20:25:15.000Z
2022-01-26T20:25:15.000Z
golang/buildings_with_an_ocean_view/find_buildings.go
lee-hen/leetcode
d1045d4dd168af743fc36c1244accb8091c892da
[ "MIT" ]
null
null
null
golang/buildings_with_an_ocean_view/find_buildings.go
lee-hen/leetcode
d1045d4dd168af743fc36c1244accb8091c892da
[ "MIT" ]
null
null
null
package buildings_with_an_ocean_view func FindBuildings(heights []int) []int { oceanView := make([]int, 0) oceanView = append(oceanView, len(heights)-1) max := heights[len(heights)-1] for i := len(heights)-2; i >= 0; i-- { if heights[i] > max { max = heights[i] oceanView = append(oceanView, i) } } for i, j := 0, len(oceanView)-1; i < j; i, j = i+1, j-1 { oceanView[i], oceanView[j] = oceanView[j], oceanView[i] } return oceanView }
22.85
58
0.628009
14d038e8c68e42c53321e546f13cc380df3697d2
973
ts
TypeScript
src/bots/bots.service.ts
trungtranthanh93/bot--telegram-backend
0ea0db399771573e2584b6e41f6b19ff7298022d
[ "MIT" ]
null
null
null
src/bots/bots.service.ts
trungtranthanh93/bot--telegram-backend
0ea0db399771573e2584b6e41f6b19ff7298022d
[ "MIT" ]
null
null
null
src/bots/bots.service.ts
trungtranthanh93/bot--telegram-backend
0ea0db399771573e2584b6e41f6b19ff7298022d
[ "MIT" ]
null
null
null
import { HttpException, HttpStatus, Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Repository } from 'typeorm'; import { CreateBotDto } from './dto/create-bot.dto'; import { UpdateBotDto } from './dto/update-bot.dto'; import { Bot } from './entities/bot.entity'; @Injectable() export class BotsService { constructor( @InjectRepository(Bot) private readonly botRepository: Repository<Bot>, ) {} async create(createBotDto: CreateBotDto) { try { return await this.botRepository.save(createBotDto); } catch (err) { throw new HttpException(err, HttpStatus.BAD_REQUEST); } } findAll() { return this.botRepository.find(); } findOne(id: number) { return `This action returns a #${id} bot`; } update(id: number, updateBotDto: UpdateBotDto) { return `This action updates a #${id} bot`; } remove(id: number) { return `This action removes a #${id} bot`; } }
25.605263
71
0.669065