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
75231b6bd1a47ea274c433041bf05a5784de2502
1,265
h
C
glthread/glthread.h
ancor1369/NetworkingImplementations
a8faca58bf472ea2ab660585afb470df140c56a1
[ "MIT" ]
null
null
null
glthread/glthread.h
ancor1369/NetworkingImplementations
a8faca58bf472ea2ab660585afb470df140c56a1
[ "MIT" ]
null
null
null
glthread/glthread.h
ancor1369/NetworkingImplementations
a8faca58bf472ea2ab660585afb470df140c56a1
[ "MIT" ]
1
2020-08-10T19:15:27.000Z
2020-08-10T19:15:27.000Z
/* * glthread.h * * Created on: May 10, 2020 * Author: andres */ #ifndef __GLTHREADS__ #define __GLTHREADS__ //Glued Doubled Linked list as a glued library //Definition of a node, it does not have information about application info //as a regular double linked list has. typedef struct glthread_node_{ struct glthread_node_ *left; struct glthread_node_ *right; }glthread_node_t; typedef struct glthread_{ glthread_node_t *head; unsigned int offset; }glthread_t; void glthread_add(glthread_t *lst, glthread_node_t *glnode); void glthread_remove(glthread_t *lst, glthread_node_t *glnode); #define ITERATE_GL_THREADS_BEGIN(lstptr, struct_type, ptr) \ { \ glthread_node_t * _glnode = NULL, *_next = NULL; \ for(_glnode = lstptr->head; _glnode;_glnode = _next ){ \ _next=_glnode->right; \ ptr = (struct_type *)((char *)_glnode - lstptr->offset); #define ITERATE_GL_THREADS_ENDS}} #define glthread_node_init(glnode) \ glnode->left = NULL; \ glnode->right = NULL; void init_glthread(glthread_t *glthread, unsigned int offset); #define offsetof(struct_name, field_name) \ ((unsigned int)&((struct_name *)0)->field_name) #endif
20.737705
75
0.67747
1d7656bf064d8ec48baec1c74de82c6dfb19d17c
4,520
swift
Swift
src/interactions/TransitionSpring.swift
huangboju/material-motion-swift
61c382aad4b70196aa16648a77d38039008aa594
[ "Apache-2.0" ]
1,500
2017-03-17T20:13:38.000Z
2022-03-16T09:29:32.000Z
src/interactions/TransitionSpring.swift
huangboju/material-motion-swift
61c382aad4b70196aa16648a77d38039008aa594
[ "Apache-2.0" ]
76
2017-03-16T19:33:41.000Z
2020-02-04T07:05:03.000Z
src/interactions/TransitionSpring.swift
material-motion/reactive-motion-swift
fae8c59f53066e1d3fe6c5d39192e0c51303a656
[ "Apache-2.0" ]
103
2017-03-28T21:12:37.000Z
2021-02-04T18:43:36.000Z
/* Copyright 2016-present The Material Motion Authors. 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. */ import Foundation import UIKit /** The default transition spring stiffness configuration. */ public let defaultTransitionSpringStiffness: CGFloat = 1000 /** The default transition spring damping configuration. */ public let defaultTransitionSpringDamping: CGFloat = 500 /** The default transition spring mass configuration. */ public let defaultTransitionSpringMass: CGFloat = 3 /** The default transition spring suggested duration. */ public let defaultTransitionSpringSuggestedDuration: CGFloat = 0.5 /** A transition spring pulls a value from one side of a transition to another. A transition spring can be associated with many properties. Each property receives its own distinct simulator that reads the property as the initial value and pulls the value towards the destination. Configuration values are shared across all running instances. **Directionality** The terms `back` and `fore` are used here to refer to the backward and forward destinations, respectively. View controller transitions move *forward* when being presented, and *backward* when being dismissed. This consistency of directionality makes it easy to describe the goal states for a transition in a consistent manner, regardless of the direction. **Initial value** When associated with a property, this interaction will assign an initial value to the property corresponding to the initial direction's oposite destination. E.g. if transitioning forward, the property will be initialized with the `back` value. **Constraints** T-value constraints may be applied to this interaction. */ public final class TransitionSpring<T>: Spring<T> where T: ZeroableAndSubtractable { /** The destination when the transition is moving backward. */ public let backwardDestination: T /** The destination when the transition is moving forward. */ public let forwardDestination: T /** Creates a transition spring with a given threshold and system. - parameter back: The destination to which the spring will pull the view when transitioning backward. - parameter fore: The destination to which the spring will pull the view when transitioning forward. - parameter direction: The spring will change its destination in reaction to this property's changes. - parameter threshold: The threshold of movement defining the completion of the spring simulation. This parameter is not used by the Core Animation system and can be left as a default value. - parameter system: The system that should be used to drive this spring. */ public init(back backwardDestination: T, fore forwardDestination: T, direction: ReactiveProperty<TransitionDirection>, threshold: CGFloat = 1, system: @escaping SpringToStream<T> = coreAnimation) { self.backwardDestination = backwardDestination self.forwardDestination = forwardDestination self.initialValue = direction == .forward ? backwardDestination : forwardDestination self.toggledDestination = direction.rewrite([.backward: backwardDestination, .forward: forwardDestination]) super.init(threshold: threshold, system: system) // Apply Core Animation transition spring defaults. damping.value = defaultTransitionSpringDamping stiffness.value = defaultTransitionSpringStiffness mass.value = defaultTransitionSpringMass suggestedDuration.value = defaultTransitionSpringSuggestedDuration } public override func add(to property: ReactiveProperty<T>, withRuntime runtime: MotionRuntime, constraints: ConstraintApplicator<T>? = nil) { property.value = initialValue runtime.connect(toggledDestination, to: destination) super.add(to: property, withRuntime: runtime, constraints: constraints) } private let initialValue: T private let toggledDestination: MotionObservable<T> }
38.965517
193
0.763053
bc133e5572f000f9f8cebf53a358f5cf1aa3f3c8
2,596
swift
Swift
JetBeepExample/JetBeepExample/NotificationController.swift
jetbeep/ios-sdk
ba917b256741755f1946b7b83f57336fb40e2cd7
[ "MIT" ]
1
2020-06-17T08:35:59.000Z
2020-06-17T08:35:59.000Z
JetBeepExample/JetBeepExample/NotificationController.swift
jetbeep/ios-sdk
ba917b256741755f1946b7b83f57336fb40e2cd7
[ "MIT" ]
null
null
null
JetBeepExample/JetBeepExample/NotificationController.swift
jetbeep/ios-sdk
ba917b256741755f1946b7b83f57336fb40e2cd7
[ "MIT" ]
null
null
null
// // NotificationController.swift // JetBeepExample // // Created by Max Tymchii on 3/5/19. // Copyright © 2019 Max Tymchii. All rights reserved. // import Foundation import UserNotifications import JetBeepFramework import Promises final class NotificationController { static let shared = NotificationController() private init() {} private var callbackID = defaultEventSubscribeID func subscribeOnPushNotifications() { let center = UNUserNotificationCenter.current() center.requestAuthorization(options: [.alert, .sound]) { granted, error in // Enable or disable features based on authorization. if let e = error { Log.i("Request push notification authorization failed! \(e)") } else { Log.i("Request push notification authorization succeed!") } self.execute() } } func execute() { callbackID = NotificationDispatcher.shared.subscribe { event in switch event { case .ready(let model, let merchant, let shop): let logMessage = "Show notification for merchant \(model.merchantId)" Log.i(logMessage) all(model.merchant, model.info) .then{ result, info in guard let merchant = result else { Log.i("Didn't parse") return } Log.i("\(merchant) + \(info)") self.entered(merchant: merchant, info: info) } case .cancel(let model): UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [model.id]) let logMessage = "Exit from merchant \(model.merchantId) modelId\(model.id)" Log.i(logMessage) } } } private func exit(from notification: NotificationModel) { UNUserNotificationCenter.current().removeDeliveredNotifications(withIdentifiers: [notification.id]) } private func entered(merchant: Merchant, info: NotificationInfo) { let sound = info.isSilentPush ? nil : "default" BaseNotification(withIdentifier: info.id, withCategoryId: "Test", withTitle: info.title, withMessage: info.subtitle, withCustomSound: sound).show() } deinit { NotificationDispatcher.shared.unsubscribe(callbackID) } }
37.085714
155
0.571263
20dc1a534e929fbb7d9aa116776be3b5178368fa
267
lua
Lua
MMOCoreORB/bin/scripts/object/custom_content/tangible/storyteller/prop/pr_item_burning_man.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/tangible/storyteller/prop/pr_item_burning_man.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/tangible/storyteller/prop/pr_item_burning_man.lua
V-Fib/FlurryClone
40e0ca7245ec31b3815eb6459329fd9e70f88936
[ "Zlib", "OpenSSL" ]
71
2017-01-01T05:34:38.000Z
2022-03-29T01:04:00.000Z
object_tangible_storyteller_prop_pr_item_burning_man = object_tangible_storyteller_prop_shared_pr_item_burning_man:new { } ObjectTemplates:addTemplate(object_tangible_storyteller_prop_pr_item_burning_man, "object/tangible/storyteller/prop/pr_item_burning_man.iff")
44.5
141
0.910112
03a1912e3be22267fc20513bfb316cd630de7b5b
348
sql
SQL
openGaussBase/testcase/KEYWORDS/like/Opengauss_Function_Keyword_Like_Case0019.sql
opengauss-mirror/Yat
aef107a8304b94e5d99b4f1f36eb46755eb8919e
[ "MulanPSL-1.0" ]
null
null
null
openGaussBase/testcase/KEYWORDS/like/Opengauss_Function_Keyword_Like_Case0019.sql
opengauss-mirror/Yat
aef107a8304b94e5d99b4f1f36eb46755eb8919e
[ "MulanPSL-1.0" ]
null
null
null
openGaussBase/testcase/KEYWORDS/like/Opengauss_Function_Keyword_Like_Case0019.sql
opengauss-mirror/Yat
aef107a8304b94e5d99b4f1f36eb46755eb8919e
[ "MulanPSL-1.0" ]
null
null
null
-- @testpoint: opengauss关键字like(保留),作为外部数据源名 合理报错 --关键字不带引号-合理报错 create data source like; --关键字带双引号-成功 drop data source if exists "like"; create data source "like"; drop data source "like"; --关键字带单引号-合理报错 drop data source if exists 'like'; create data source 'like'; --关键字带反引号-合理报错 drop data source if exists `like`; create data source `like`;
19.333333
49
0.738506
29225c29c0ef2d078b1a85a1638923973d360a26
3,772
py
Python
pandas_ta/volatility/rvi.py
codesutras/pandas-ta
78598df9cfd2f165553262e85ae4c0392598d48c
[ "MIT" ]
1
2021-11-07T19:09:01.000Z
2021-11-07T19:09:01.000Z
pandas_ta/volatility/rvi.py
codesutras/pandas-ta
78598df9cfd2f165553262e85ae4c0392598d48c
[ "MIT" ]
null
null
null
pandas_ta/volatility/rvi.py
codesutras/pandas-ta
78598df9cfd2f165553262e85ae4c0392598d48c
[ "MIT" ]
1
2022-02-16T12:46:32.000Z
2022-02-16T12:46:32.000Z
# -*- coding: utf-8 -*- from pandas_ta.overlap import ma from pandas_ta.statistics import stdev from pandas_ta.utils import get_drift, get_offset from pandas_ta.utils import unsigned_differences, verify_series def rvi(close, high=None, low=None, length=None, scalar=None, refined=None, thirds=None, mamode=None, drift=None, offset=None, **kwargs): """Indicator: Relative Volatility Index (RVI)""" # Validate arguments length = int(length) if length and length > 0 else 14 scalar = float(scalar) if scalar and scalar > 0 else 100 refined = False if refined is None else refined thirds = False if thirds is None else thirds mamode = mamode if isinstance(mamode, str) else "ema" close = verify_series(close, length) drift = get_drift(drift) offset = get_offset(offset) if close is None: return if refined or thirds: high = verify_series(high) low = verify_series(low) # Calculate Result def _rvi(source, length, scalar, mode, drift): """RVI""" std = stdev(source, length) pos, neg = unsigned_differences(source, amount=drift) pos_std = pos * std neg_std = neg * std pos_avg = ma(mode, pos_std, length=length) neg_avg = ma(mode, neg_std, length=length) result = scalar * pos_avg result /= pos_avg + neg_avg return result _mode = "" if refined: high_rvi = _rvi(high, length, scalar, mamode, drift) low_rvi = _rvi(low, length, scalar, mamode, drift) rvi = 0.5 * (high_rvi + low_rvi) _mode = "r" elif thirds: high_rvi = _rvi(high, length, scalar, mamode, drift) low_rvi = _rvi(low, length, scalar, mamode, drift) close_rvi = _rvi(close, length, scalar, mamode, drift) rvi = (high_rvi + low_rvi + close_rvi) / 3.0 _mode = "t" else: rvi = _rvi(close, length, scalar, mamode, drift) # Offset if offset != 0: rvi = rvi.shift(offset) # Handle fills if "fillna" in kwargs: rvi.fillna(kwargs["fillna"], inplace=True) if "fill_method" in kwargs: rvi.fillna(method=kwargs["fill_method"], inplace=True) # Name and Categorize it rvi.name = f"RVI{_mode}_{length}" rvi.category = "volatility" return rvi rvi.__doc__ = \ """Relative Volatility Index (RVI) The Relative Volatility Index (RVI) was created in 1993 and revised in 1995. Instead of adding up price changes like RSI based on price direction, the RVI adds up standard deviations based on price direction. Sources: https://www.tradingview.com/wiki/Keltner_Channels_(KC) Calculation: Default Inputs: length=14, scalar=100, refined=None, thirds=None EMA = Exponential Moving Average STDEV = Standard Deviation UP = STDEV(src, length) IF src.diff() > 0 ELSE 0 DOWN = STDEV(src, length) IF src.diff() <= 0 ELSE 0 UPSUM = EMA(UP, length) DOWNSUM = EMA(DOWN, length RVI = scalar * (UPSUM / (UPSUM + DOWNSUM)) Args: high (pd.Series): Series of 'high's low (pd.Series): Series of 'low's close (pd.Series): Series of 'close's length (int): The short period. Default: 14 scalar (float): A positive float to scale the bands. Default: 100 mamode (str): Options: 'sma' or 'ema'. Default: 'sma' refined (bool): Use 'refined' calculation which is the average of RVI(high) and RVI(low) instead of RVI(close). Default: False thirds (bool): Average of high, low and close. Default: False offset (int): How many periods to offset the result. Default: 0 Kwargs: fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method Returns: pd.DataFrame: lower, basis, upper columns. """
32.239316
137
0.655355
5a07c54ec76d12852364b712e4eff5e83d6ea957
2,855
rs
Rust
src/interfaces/websocket.rs
felipeZ/flusso
c41520b7c9fdede4c34eb8a510a89d57e318e824
[ "Apache-2.0" ]
null
null
null
src/interfaces/websocket.rs
felipeZ/flusso
c41520b7c9fdede4c34eb8a510a89d57e318e824
[ "Apache-2.0" ]
null
null
null
src/interfaces/websocket.rs
felipeZ/flusso
c41520b7c9fdede4c34eb8a510a89d57e318e824
[ "Apache-2.0" ]
null
null
null
/*! ## Websocket consumer */ use async_channel; use async_tungstenite::async_std::{connect_async, ConnectStream}; use async_tungstenite::tungstenite::protocol::Message; use async_tungstenite::WebSocketStream; use crate::pipe::Pipe; use crate::utils; use async_std::task; use futures::stream::{SplitSink, SplitStream}; use futures::{try_join, SinkExt, StreamExt}; use serde_json::Value; use std::time::Duration; #[derive(Debug)] pub struct WebsocketConsumer { pub url: String, pub subscription_message: String, pub heartbeat_msg: String, pub heartbeat_freq: Duration, } impl WebsocketConsumer { pub fn new( url: String, heartbeat_msg: String, subscription_message: String, heartbeat_freq: Duration, ) -> Self { Self { url, subscription_message, heartbeat_msg, heartbeat_freq, } } pub async fn consume<P: 'static + Pipe>( &self, channel_sender: async_channel::Sender<Value>, ops: P, ) -> utils::GenericResult<()> { let (websocket, _) = connect_async(&self.url).await.unwrap(); let (mut websocket_sender, websocket_receiver) = websocket.split(); Self::subscribe(&mut websocket_sender, self.subscription_message.clone()).await?; try_join!( task::spawn(Self::listen(websocket_receiver, channel_sender, ops)), self.send_heartbeat(websocket_sender) )?; Ok(()) } async fn subscribe( sender: &mut SplitSink<WebSocketStream<ConnectStream>, Message>, msg: String, ) -> utils::GenericResult<()> { sender.send(Message::Text(msg)).await?; Ok(()) } async fn listen<P: 'static + Pipe>( mut receiver: SplitStream<WebSocketStream<ConnectStream>>, mut channel_sender: async_channel::Sender<Value>, ops: P, ) -> utils::GenericResult<()> { while let Some(msg) = receiver.next().await { let event = msg.unwrap().into_text().unwrap(); Self::send_data_to_channel(&event, &mut channel_sender, &ops).await?; } Ok(()) } async fn send_data_to_channel<P: 'static + Pipe>( event: &str, channel_sender: &mut async_channel::Sender<Value>, ops: &P, ) -> utils::GenericResult<()> { let dict: Value = serde_json::from_str(event)?; if ops.filter(&dict) { channel_sender.send(dict).await? }; Ok(()) } async fn send_heartbeat( &self, mut sender: SplitSink<WebSocketStream<ConnectStream>, Message>, ) -> utils::GenericResult<()> { loop { let msg = self.heartbeat_msg.clone(); sender.send(Message::Text(msg)).await?; task::sleep(self.heartbeat_freq).await; } } }
27.990196
89
0.603503
c7b81308c39af95731bac254109d7297e0ab46e4
10,569
py
Python
geotrek/altimetry/helpers.py
Cynthia-Borot-PNE/Geotrek-admin
abd9ca8569a7e35ef7473f5b52731b1c78668754
[ "BSD-2-Clause" ]
null
null
null
geotrek/altimetry/helpers.py
Cynthia-Borot-PNE/Geotrek-admin
abd9ca8569a7e35ef7473f5b52731b1c78668754
[ "BSD-2-Clause" ]
null
null
null
geotrek/altimetry/helpers.py
Cynthia-Borot-PNE/Geotrek-admin
abd9ca8569a7e35ef7473f5b52731b1c78668754
[ "BSD-2-Clause" ]
null
null
null
import logging from django.contrib.gis.geos import GEOSGeometry from django.utils.translation import ugettext as _ from django.contrib.gis.geos import LineString from django.conf import settings from django.db import connection import pygal from pygal.style import LightSolarizedStyle logger = logging.getLogger(__name__) class AltimetryHelper(object): @classmethod def elevation_profile(cls, geometry3d, precision=None, offset=0): """Extract elevation profile from a 3D geometry. :precision: geometry sampling in meters """ precision = precision or settings.ALTIMETRIC_PROFILE_PRECISION if geometry3d.geom_type == 'MultiLineString': profile = [] for subcoords in geometry3d.coords: subline = LineString(subcoords, srid=geometry3d.srid) offset += subline.length subprofile = AltimetryHelper.elevation_profile(subline, precision, offset) profile.extend(subprofile) return profile # Add measure to 2D version of geometry3d # Get distance from origin for each vertex sql = """ WITH line2d AS (SELECT ST_Force2D('%(ewkt)s'::geometry) AS geom), line_measure AS (SELECT ST_Addmeasure(geom, 0, ST_length(geom)) AS geom FROM line2d), points2dm AS (SELECT (ST_DumpPoints(geom)).geom AS point FROM line_measure) SELECT (%(offset)s + ST_M(point)) FROM points2dm; """ % {'offset': offset, 'ewkt': geometry3d.ewkt} cursor = connection.cursor() cursor.execute(sql) pointsm = cursor.fetchall() # Join (offset+distance, x, y, z) together geom3dapi = geometry3d.transform(settings.API_SRID, clone=True) assert len(pointsm) == len(geom3dapi.coords), 'Cannot map distance to xyz' dxyz = [pointsm[i] + v for i, v in enumerate(geom3dapi.coords)] return dxyz @classmethod def altimetry_limits(cls, profile): elevations = [int(v[3]) for v in profile] min_elevation = int(min(elevations)) max_elevation = int(max(elevations)) floor_elevation = round(min_elevation, 100) - 100 ceil_elevation = round(max_elevation, 100) + 100 if ceil_elevation < floor_elevation + settings.ALTIMETRIC_PROFILE_MIN_YSCALE: ceil_elevation = floor_elevation + settings.ALTIMETRIC_PROFILE_MIN_YSCALE return ceil_elevation, floor_elevation @classmethod def profile_svg(cls, profile): """ Plot the altimetric graph in SVG using PyGal. Most of the job done here is dedicated to preparing nice labels scales. """ ceil_elevation, floor_elevation = cls.altimetry_limits(profile) config = dict(show_legend=False, print_values=False, show_dots=False, zero=floor_elevation, value_formatter=lambda v: '%d' % v, margin=settings.ALTIMETRIC_PROFILE_FONTSIZE, width=settings.ALTIMETRIC_PROFILE_WIDTH, height=settings.ALTIMETRIC_PROFILE_HEIGHT, title_font_size=settings.ALTIMETRIC_PROFILE_FONTSIZE, label_font_size=0.8 * settings.ALTIMETRIC_PROFILE_FONTSIZE, major_label_font_size=settings.ALTIMETRIC_PROFILE_FONTSIZE, js=[]) style = LightSolarizedStyle style.background = settings.ALTIMETRIC_PROFILE_BACKGROUND style.colors = (settings.ALTIMETRIC_PROFILE_COLOR,) style.font_family = settings.ALTIMETRIC_PROFILE_FONT line_chart = pygal.XY(fill=True, style=style, **config) line_chart.x_title = _("Distance (m)") line_chart.y_title = _("Altitude (m)") line_chart.show_minor_x_labels = False line_chart.x_labels_major_count = 5 line_chart.show_minor_y_labels = False line_chart.truncate_label = 50 line_chart.range = [floor_elevation, ceil_elevation] line_chart.no_data_text = _(u"Altimetry data not available") line_chart.add('', [(int(v[0]), int(v[3])) for v in profile]) return line_chart.render() @classmethod def _nice_extent(cls, geom): xmin, ymin, xmax, ymax = geom.extent amplitude = max(xmax - xmin, ymax - ymin) geom_buffer = geom.envelope.buffer(amplitude * settings.ALTIMETRIC_AREA_MARGIN) xmin, ymin, xmax, ymax = geom_buffer.extent width = xmax - xmin height = ymax - ymin xcenter = xmin + width / 2.0 ycenter = ymin + height / 2.0 min_ratio = 1 / 1.618 # golden ratio if width > height: height = max(width * min_ratio, height) else: width = max(height * min_ratio, width) xmin, ymin, xmax, ymax = (int(xcenter - width / 2.0), int(ycenter - height / 2.0), int(xcenter + width / 2.0), int(ycenter + height / 2.0)) return (xmin, ymin, xmax, ymax) @classmethod def elevation_area(cls, geom): xmin, ymin, xmax, ymax = cls._nice_extent(geom) width = xmax - xmin height = ymax - ymin precision = settings.ALTIMETRIC_PROFILE_PRECISION max_resolution = settings.ALTIMETRIC_AREA_MAX_RESOLUTION if width / precision > max_resolution: precision = int(width / max_resolution) if height / precision > 10000: precision = int(width / max_resolution) cursor = connection.cursor() cursor.execute("SELECT 1 FROM information_schema.tables WHERE table_name='mnt'") if cursor.rowcount == 0: logger.warn("No DEM present") return {} sql = """ -- Author: Celian Garcia WITH columns AS ( SELECT generate_series({xmin}::int, {xmax}::int, {precision}) AS x ), lines AS ( SELECT generate_series({ymin}::int, {ymax}::int, {precision}) AS y ), resolution AS ( SELECT x, y FROM (SELECT COUNT(x) AS x FROM columns) AS col, (SELECT COUNT(y) AS y FROM lines) AS lin ), points2d AS ( SELECT row_number() OVER () AS id, ST_SetSRID(ST_MakePoint(x, y), {srid}) AS geom, ST_Transform(ST_SetSRID(ST_MakePoint(x, y), {srid}), 4326) AS geomll FROM lines, columns ), draped AS ( SELECT id, ST_Value(mnt.rast, p.geom)::int AS altitude FROM mnt, points2d AS p WHERE ST_Intersects(mnt.rast, p.geom) ), all_draped AS ( SELECT geomll, geom, altitude FROM points2d LEFT JOIN draped ON (points2d.id = draped.id) ORDER BY points2d.id ), extent_latlng AS ( SELECT ST_Envelope(ST_Union(geom)) AS extent, MIN(altitude) AS min_z, MAX(altitude) AS max_z, AVG(altitude) AS center_z FROM all_draped ) SELECT extent, ST_transform(extent, 4326), center_z, min_z, max_z, resolution.x AS resolution_w, resolution.y AS resolution_h, altitude FROM extent_latlng, resolution, all_draped; """.format(xmin=xmin, ymin=ymin, xmax=xmax, ymax=ymax, srid=settings.SRID, precision=precision) cursor.execute(sql) result = cursor.fetchall() first = result[0] envelop_native, envelop, center_z, min_z, max_z, resolution_w, resolution_h, a = first envelop = GEOSGeometry(envelop, srid=4326) envelop_native = GEOSGeometry(envelop_native, srid=settings.SRID) altitudes = [] row = [] for i, record in enumerate(result): if i > 0 and i % resolution_w == 0: altitudes.append(row) row = [] elevation = (record[7] or 0.0) - min_z row.append(elevation) altitudes.append(row) area = { 'center': { 'x': envelop_native.centroid.x, 'y': envelop_native.centroid.y, 'lat': envelop.centroid.y, 'lng': envelop.centroid.x, 'z': int(center_z) }, 'resolution': { 'x': resolution_w, 'y': resolution_h, 'step': precision }, 'size': { 'x': envelop_native.coords[0][2][0] - envelop_native.coords[0][0][0], 'y': envelop_native.coords[0][2][1] - envelop_native.coords[0][0][1], 'lat': envelop.coords[0][2][0] - envelop.coords[0][0][0], 'lng': envelop.coords[0][2][1] - envelop.coords[0][0][1] }, 'extent': { 'altitudes': { 'min': min_z, 'max': max_z }, 'southwest': {'lat': envelop.coords[0][0][1], 'lng': envelop.coords[0][0][0], 'x': envelop_native.coords[0][0][0], 'y': envelop_native.coords[0][0][1]}, 'northwest': {'lat': envelop.coords[0][1][1], 'lng': envelop.coords[0][1][0], 'x': envelop_native.coords[0][1][0], 'y': envelop_native.coords[0][1][1]}, 'northeast': {'lat': envelop.coords[0][2][1], 'lng': envelop.coords[0][2][0], 'x': envelop_native.coords[0][2][0], 'y': envelop_native.coords[0][2][1]}, 'southeast': {'lat': envelop.coords[0][3][1], 'lng': envelop.coords[0][3][0], 'x': envelop_native.coords[0][3][0], 'y': envelop_native.coords[0][3][1]} }, 'altitudes': altitudes } return area
42.789474
98
0.536002
0ba40eb83c69821a416e50be4bddb8886aa2cb30
578
py
Python
tests/test_codecs.py
reece/et
41977444a95ac8b8af7a73706f1e18634914d37f
[ "MIT" ]
null
null
null
tests/test_codecs.py
reece/et
41977444a95ac8b8af7a73706f1e18634914d37f
[ "MIT" ]
null
null
null
tests/test_codecs.py
reece/et
41977444a95ac8b8af7a73706f1e18634914d37f
[ "MIT" ]
null
null
null
import et.codecs tests = [ { "data": 0, "e_data": { 1: b'\x00\x010', 2: b'\x00\x02x\x9c3\x00\x00\x001\x001' } }, { "data": {}, "e_data": { 1: b'\x00\x01{}', 2: b'\x00\x02x\x9c\xab\xae\x05\x00\x01u\x00\xf9' } }, ] def test_all(): for test in tests: for fmt in sorted(test["e_data"].keys()): assert test["e_data"][fmt] == et.codecs.encode(test["data"], fmt) assert (test["data"], fmt) == et.codecs.decode(test["e_data"][fmt])
19.931034
79
0.448097
d25a244fb38f5825ac31d4981382c7c64b375fa0
261
php
PHP
src/Models/AttributeType.php
pwrdk/laravel-custom-attributes
832a63836f847cc4dc000ce598935222488d6de1
[ "MIT" ]
3
2020-07-08T22:07:38.000Z
2020-12-21T19:37:11.000Z
src/Models/AttributeType.php
pwrdk/laravel-custom-attributes
832a63836f847cc4dc000ce598935222488d6de1
[ "MIT" ]
1
2021-03-10T20:02:11.000Z
2021-03-10T20:02:11.000Z
src/Models/AttributeType.php
pwrdk/laravel-custom-attributes
832a63836f847cc4dc000ce598935222488d6de1
[ "MIT" ]
null
null
null
<?php namespace PWRDK\CustomAttributes\Models; use Illuminate\Database\Eloquent\Model; class AttributeType extends Model { protected $guarded = []; public function keys() { return $this->hasMany(AttributeKey::class, 'type_id'); } }
15.352941
62
0.681992
98a3b74d69c5985eae702511153d8c0b361be119
1,404
html
HTML
Solutions/MyLife/day.html
NorrskenFoundation/Unsolved19
bfd1a2b9ec64bbf3d8adf3c50713c8b0bb46ff77
[ "ADSL" ]
2
2019-09-13T14:21:49.000Z
2019-09-19T20:05:09.000Z
Solutions/MyLife/day.html
NorrskenFoundation/Unsolved19
bfd1a2b9ec64bbf3d8adf3c50713c8b0bb46ff77
[ "ADSL" ]
36
2020-02-29T04:55:50.000Z
2022-03-30T23:48:19.000Z
Solutions/MyLife/day.html
NorrskenFoundation/Unsolved19
bfd1a2b9ec64bbf3d8adf3c50713c8b0bb46ff77
[ "ADSL" ]
2
2019-09-16T15:37:38.000Z
2019-09-17T16:45:47.000Z
<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="styles.css"> <link href="https://fonts.googleapis.com/css?family=DM+Sans&display=swap" rel="stylesheet"> <title>Today</title> </head> <body> <a class="back" href="calender.html"></a> <header> <h1>Today</h1> </header> <section class="today"> <h1>17 September 2019</h1> <div class="question q1"> <p>Over all feeling today</p> <div class="answerbox"> </div> </div> <div class="question q2"> <p>Any pain?</p> <div class="answerbox"> </div> </div> <div class="question q3"> <p>For how long?</p> <div class="answerbox"> </div> </div> <div class="question q4"> <p>What symptoms?</p> <div class="answerbox"> </div> </div> <div class="question q5"> <p>The cause</p> <div class="answerbox"> </div> </div> <div class="question q6"> <p>Notes</p> <div class="answerbox"> </div> </div> </section> <a href="chat.html" class="button"><div></div></a> <script src="script.js"></script> </body> </html>
24.206897
96
0.494302
6524ddc76b9d96636b484cb312a74bd2db7d7c66
12,593
rs
Rust
jni-android-sys/src/generated/api-level-29/android/view/WindowInsets_Builder.rs
sjeohp/jni-bindgen
848121402484f114fa978e8d4b4c19379f9e22a8
[ "Apache-2.0", "MIT" ]
null
null
null
jni-android-sys/src/generated/api-level-29/android/view/WindowInsets_Builder.rs
sjeohp/jni-bindgen
848121402484f114fa978e8d4b4c19379f9e22a8
[ "Apache-2.0", "MIT" ]
null
null
null
jni-android-sys/src/generated/api-level-29/android/view/WindowInsets_Builder.rs
sjeohp/jni-bindgen
848121402484f114fa978e8d4b4c19379f9e22a8
[ "Apache-2.0", "MIT" ]
null
null
null
// WARNING: This file was autogenerated by jni-bindgen. Any changes to this file may be lost!!! #[cfg(any(feature = "all", feature = "android-view-WindowInsets_Builder"))] __jni_bindgen! { /// public final class [WindowInsets.Builder](https://developer.android.com/reference/android/view/WindowInsets.Builder.html) /// /// Required feature: android-view-WindowInsets_Builder public final class WindowInsets_Builder ("android/view/WindowInsets$Builder") extends crate::java::lang::Object { /// [Builder](https://developer.android.com/reference/android/view/WindowInsets.Builder.html#Builder()) pub fn new<'env>(__jni_env: &'env __jni_bindgen::Env) -> __jni_bindgen::std::result::Result<__jni_bindgen::Local<'env, crate::android::view::WindowInsets_Builder>, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // class.path == "android/view/WindowInsets$Builder", java.flags == PUBLIC, .name == "<init>", .descriptor == "()V" unsafe { let __jni_args = []; let (__jni_class, __jni_method) = __jni_env.require_class_method("android/view/WindowInsets$Builder\0", "<init>\0", "()V\0"); __jni_env.new_object_a(__jni_class, __jni_method, __jni_args.as_ptr()) } } /// [Builder](https://developer.android.com/reference/android/view/WindowInsets.Builder.html#Builder(android.view.WindowInsets)) /// /// Required features: "android-view-WindowInsets" #[cfg(any(feature = "all", all(feature = "android-view-WindowInsets")))] pub fn new_WindowInsets<'env>(__jni_env: &'env __jni_bindgen::Env, arg0: impl __jni_bindgen::std::convert::Into<__jni_bindgen::std::option::Option<&'env crate::android::view::WindowInsets>>) -> __jni_bindgen::std::result::Result<__jni_bindgen::Local<'env, crate::android::view::WindowInsets_Builder>, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // class.path == "android/view/WindowInsets$Builder", java.flags == PUBLIC, .name == "<init>", .descriptor == "(Landroid/view/WindowInsets;)V" unsafe { let __jni_args = [__jni_bindgen::AsJValue::as_jvalue(&arg0.into())]; let (__jni_class, __jni_method) = __jni_env.require_class_method("android/view/WindowInsets$Builder\0", "<init>\0", "(Landroid/view/WindowInsets;)V\0"); __jni_env.new_object_a(__jni_class, __jni_method, __jni_args.as_ptr()) } } /// [setSystemWindowInsets](https://developer.android.com/reference/android/view/WindowInsets.Builder.html#setSystemWindowInsets(android.graphics.Insets)) /// /// Required features: "android-graphics-Insets", "android-view-WindowInsets_Builder" #[cfg(any(feature = "all", all(feature = "android-graphics-Insets", feature = "android-view-WindowInsets_Builder")))] pub fn setSystemWindowInsets<'env>(&'env self, arg0: impl __jni_bindgen::std::convert::Into<__jni_bindgen::std::option::Option<&'env crate::android::graphics::Insets>>) -> __jni_bindgen::std::result::Result<__jni_bindgen::std::option::Option<__jni_bindgen::Local<'env, crate::android::view::WindowInsets_Builder>>, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // class.path == "android/view/WindowInsets$Builder", java.flags == PUBLIC, .name == "setSystemWindowInsets", .descriptor == "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;" unsafe { let __jni_args = [__jni_bindgen::AsJValue::as_jvalue(&arg0.into())]; let __jni_env = __jni_bindgen::Env::from_ptr(self.0.env); let (__jni_class, __jni_method) = __jni_env.require_class_method("android/view/WindowInsets$Builder\0", "setSystemWindowInsets\0", "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;\0"); __jni_env.call_object_method_a(self.0.object, __jni_method, __jni_args.as_ptr()) } } /// [setSystemGestureInsets](https://developer.android.com/reference/android/view/WindowInsets.Builder.html#setSystemGestureInsets(android.graphics.Insets)) /// /// Required features: "android-graphics-Insets", "android-view-WindowInsets_Builder" #[cfg(any(feature = "all", all(feature = "android-graphics-Insets", feature = "android-view-WindowInsets_Builder")))] pub fn setSystemGestureInsets<'env>(&'env self, arg0: impl __jni_bindgen::std::convert::Into<__jni_bindgen::std::option::Option<&'env crate::android::graphics::Insets>>) -> __jni_bindgen::std::result::Result<__jni_bindgen::std::option::Option<__jni_bindgen::Local<'env, crate::android::view::WindowInsets_Builder>>, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // class.path == "android/view/WindowInsets$Builder", java.flags == PUBLIC, .name == "setSystemGestureInsets", .descriptor == "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;" unsafe { let __jni_args = [__jni_bindgen::AsJValue::as_jvalue(&arg0.into())]; let __jni_env = __jni_bindgen::Env::from_ptr(self.0.env); let (__jni_class, __jni_method) = __jni_env.require_class_method("android/view/WindowInsets$Builder\0", "setSystemGestureInsets\0", "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;\0"); __jni_env.call_object_method_a(self.0.object, __jni_method, __jni_args.as_ptr()) } } /// [setMandatorySystemGestureInsets](https://developer.android.com/reference/android/view/WindowInsets.Builder.html#setMandatorySystemGestureInsets(android.graphics.Insets)) /// /// Required features: "android-graphics-Insets", "android-view-WindowInsets_Builder" #[cfg(any(feature = "all", all(feature = "android-graphics-Insets", feature = "android-view-WindowInsets_Builder")))] pub fn setMandatorySystemGestureInsets<'env>(&'env self, arg0: impl __jni_bindgen::std::convert::Into<__jni_bindgen::std::option::Option<&'env crate::android::graphics::Insets>>) -> __jni_bindgen::std::result::Result<__jni_bindgen::std::option::Option<__jni_bindgen::Local<'env, crate::android::view::WindowInsets_Builder>>, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // class.path == "android/view/WindowInsets$Builder", java.flags == PUBLIC, .name == "setMandatorySystemGestureInsets", .descriptor == "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;" unsafe { let __jni_args = [__jni_bindgen::AsJValue::as_jvalue(&arg0.into())]; let __jni_env = __jni_bindgen::Env::from_ptr(self.0.env); let (__jni_class, __jni_method) = __jni_env.require_class_method("android/view/WindowInsets$Builder\0", "setMandatorySystemGestureInsets\0", "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;\0"); __jni_env.call_object_method_a(self.0.object, __jni_method, __jni_args.as_ptr()) } } /// [setTappableElementInsets](https://developer.android.com/reference/android/view/WindowInsets.Builder.html#setTappableElementInsets(android.graphics.Insets)) /// /// Required features: "android-graphics-Insets", "android-view-WindowInsets_Builder" #[cfg(any(feature = "all", all(feature = "android-graphics-Insets", feature = "android-view-WindowInsets_Builder")))] pub fn setTappableElementInsets<'env>(&'env self, arg0: impl __jni_bindgen::std::convert::Into<__jni_bindgen::std::option::Option<&'env crate::android::graphics::Insets>>) -> __jni_bindgen::std::result::Result<__jni_bindgen::std::option::Option<__jni_bindgen::Local<'env, crate::android::view::WindowInsets_Builder>>, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // class.path == "android/view/WindowInsets$Builder", java.flags == PUBLIC, .name == "setTappableElementInsets", .descriptor == "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;" unsafe { let __jni_args = [__jni_bindgen::AsJValue::as_jvalue(&arg0.into())]; let __jni_env = __jni_bindgen::Env::from_ptr(self.0.env); let (__jni_class, __jni_method) = __jni_env.require_class_method("android/view/WindowInsets$Builder\0", "setTappableElementInsets\0", "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;\0"); __jni_env.call_object_method_a(self.0.object, __jni_method, __jni_args.as_ptr()) } } /// [setStableInsets](https://developer.android.com/reference/android/view/WindowInsets.Builder.html#setStableInsets(android.graphics.Insets)) /// /// Required features: "android-graphics-Insets", "android-view-WindowInsets_Builder" #[cfg(any(feature = "all", all(feature = "android-graphics-Insets", feature = "android-view-WindowInsets_Builder")))] pub fn setStableInsets<'env>(&'env self, arg0: impl __jni_bindgen::std::convert::Into<__jni_bindgen::std::option::Option<&'env crate::android::graphics::Insets>>) -> __jni_bindgen::std::result::Result<__jni_bindgen::std::option::Option<__jni_bindgen::Local<'env, crate::android::view::WindowInsets_Builder>>, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // class.path == "android/view/WindowInsets$Builder", java.flags == PUBLIC, .name == "setStableInsets", .descriptor == "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;" unsafe { let __jni_args = [__jni_bindgen::AsJValue::as_jvalue(&arg0.into())]; let __jni_env = __jni_bindgen::Env::from_ptr(self.0.env); let (__jni_class, __jni_method) = __jni_env.require_class_method("android/view/WindowInsets$Builder\0", "setStableInsets\0", "(Landroid/graphics/Insets;)Landroid/view/WindowInsets$Builder;\0"); __jni_env.call_object_method_a(self.0.object, __jni_method, __jni_args.as_ptr()) } } /// [setDisplayCutout](https://developer.android.com/reference/android/view/WindowInsets.Builder.html#setDisplayCutout(android.view.DisplayCutout)) /// /// Required features: "android-view-DisplayCutout", "android-view-WindowInsets_Builder" #[cfg(any(feature = "all", all(feature = "android-view-DisplayCutout", feature = "android-view-WindowInsets_Builder")))] pub fn setDisplayCutout<'env>(&'env self, arg0: impl __jni_bindgen::std::convert::Into<__jni_bindgen::std::option::Option<&'env crate::android::view::DisplayCutout>>) -> __jni_bindgen::std::result::Result<__jni_bindgen::std::option::Option<__jni_bindgen::Local<'env, crate::android::view::WindowInsets_Builder>>, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // class.path == "android/view/WindowInsets$Builder", java.flags == PUBLIC, .name == "setDisplayCutout", .descriptor == "(Landroid/view/DisplayCutout;)Landroid/view/WindowInsets$Builder;" unsafe { let __jni_args = [__jni_bindgen::AsJValue::as_jvalue(&arg0.into())]; let __jni_env = __jni_bindgen::Env::from_ptr(self.0.env); let (__jni_class, __jni_method) = __jni_env.require_class_method("android/view/WindowInsets$Builder\0", "setDisplayCutout\0", "(Landroid/view/DisplayCutout;)Landroid/view/WindowInsets$Builder;\0"); __jni_env.call_object_method_a(self.0.object, __jni_method, __jni_args.as_ptr()) } } /// [build](https://developer.android.com/reference/android/view/WindowInsets.Builder.html#build()) /// /// Required features: "android-view-WindowInsets" #[cfg(any(feature = "all", all(feature = "android-view-WindowInsets")))] pub fn build<'env>(&'env self) -> __jni_bindgen::std::result::Result<__jni_bindgen::std::option::Option<__jni_bindgen::Local<'env, crate::android::view::WindowInsets>>, __jni_bindgen::Local<'env, crate::java::lang::Throwable>> { // class.path == "android/view/WindowInsets$Builder", java.flags == PUBLIC, .name == "build", .descriptor == "()Landroid/view/WindowInsets;" unsafe { let __jni_args = []; let __jni_env = __jni_bindgen::Env::from_ptr(self.0.env); let (__jni_class, __jni_method) = __jni_env.require_class_method("android/view/WindowInsets$Builder\0", "build\0", "()Landroid/view/WindowInsets;\0"); __jni_env.call_object_method_a(self.0.object, __jni_method, __jni_args.as_ptr()) } } } }
94.684211
392
0.684507
4219ad92f49df2067e755aaad2763de7ca3ba2c7
2,241
sql
SQL
chapter_007/src/main/java/ru/job4j/uml/uml.sql
AlekseySidorenko/aleksey_sidorenko
31a737273421a1b40fc97dde4e15ad76e56be149
[ "Apache-2.0" ]
null
null
null
chapter_007/src/main/java/ru/job4j/uml/uml.sql
AlekseySidorenko/aleksey_sidorenko
31a737273421a1b40fc97dde4e15ad76e56be149
[ "Apache-2.0" ]
2
2021-12-10T01:12:25.000Z
2021-12-14T21:18:10.000Z
chapter_007/src/main/java/ru/job4j/uml/uml.sql
AlekseySidorenko/aleksey_sidorenko
31a737273421a1b40fc97dde4e15ad76e56be149
[ "Apache-2.0" ]
null
null
null
CREATE TABLE rules ( id SERIAL PRIMARY KEY, name VARCHAR(50), description VARCHAR(200) ); CREATE TABLE roles ( id SERIAL PRIMARY KEY, name VARCHAR(50), description VARCHAR(200), rule_id INT REFERENCES rules(id) ); CREATE TABLE users ( id SERIAL PRIMARY KEY, name VARCHAR(120), login VARCHAR(30), password VARCHAR(30), role_id INT REFERENCES roles(id) ); CREATE TABLE requests_states ( id SERIAL PRIMARY KEY, name VARCHAR(50), description VARCHAR(200) ); CREATE TABLE requests_categories ( id SERIAL PRIMARY KEY, name VARCHAR(50), description VARCHAR(200) ); CREATE TABLE requests ( id SERIAL PRIMARY KEY, name VARCHAR(100), user_id INT REFERENCES users(id), state_id INT REFERENCES requests_states(id), category_id INT REFERENCES requests_categories ); CREATE TABLE requests_files ( id SERIAL PRIMARY KEY, link_to_file VARCHAR(200), request_id INT REFERENCES requests(id) ); CREATE TABLE requests_comments ( id SERIAL PRIMARY KEY, comment VARCHAR, request_id INT REFERENCES requests(id) ); INSERT INTO rules (name, description) VALUES ('rwx', 'full access'), ('r', 'read-only access'); INSERT INTO roles (name, description, rule_id) VALUES ('root', 'god of the system', 1), ('user', 'standard user account', 2); INSERT INTO users (name, login, password, role_id) VALUES ('Fedor Ivanov', 'ivanov_f', 'passw0rd', 1), ('Oleg Petrov', 'petrov_o', 'qwerty', 2); INSERT INTO requests_states (name, description) VALUES ('open', 'Request is open'), ('closed', 'Request is closed'); INSERT INTO requests_categories (name, description) VALUES ('fix', 'Request for fix something'), ('access', 'Request for change or add access to system'); INSERT INTO requests (name, user_id, state_id, category_id) VALUES ('Fix the logs problem', 2, 1, 1), ('Get full access to system', 2, 2, 2); INSERT INTO requests_files (link_to_file, request_id) VALUES ('link1', 1), ('link2', 1); INSERT INTO requests_comments (comment, request_id) VALUES ('System log does not work yet', 1), ('Access was granted', 2);
26.364706
66
0.660419
966d1131f0480d7389a76aca994643e6a2f35fb5
988
php
PHP
app/Book.php
macghriogair/book-library
dc04509f926ccf1e723beb573eaaf8970e61e726
[ "MIT" ]
null
null
null
app/Book.php
macghriogair/book-library
dc04509f926ccf1e723beb573eaaf8970e61e726
[ "MIT" ]
null
null
null
app/Book.php
macghriogair/book-library
dc04509f926ccf1e723beb573eaaf8970e61e726
[ "MIT" ]
null
null
null
<?php namespace App; use App\Borrow; use Illuminate\Database\Eloquent\Model; use DB; class Book extends Model { public function users() { return $this->belongsTo(User::class); } public function isAvailable() { return $this->available; } public function scopeAvailable($query) { return $query->where('available', true); } public function checkout() { $this->available = false; return $this; } public function checkin() { $this->available = true; return $this; } public function borrows() { return $this->hasMany(Borrow::class); } public static function popular() { return self::select(DB::raw('books.*, count(*) as `aggregate`')) ->join('book_user', 'books.id', '=', 'book_user.book_id') ->groupBy('book_id') ->orderBy('aggregate', 'desc') ->paginate(10); } }
19
73
0.54251
48f1b4d644d20e65f7ffe9f5d173f79af952029d
301
kt
Kotlin
app/src/main/java/com/tipchou/sunshineboxiii/entity/local/DownloadLocal.kt
chenyuey/SunshineBoxIII
39dd2dcace5f6f3bf48f2cf96ad0e5e998e8596b
[ "MIT" ]
null
null
null
app/src/main/java/com/tipchou/sunshineboxiii/entity/local/DownloadLocal.kt
chenyuey/SunshineBoxIII
39dd2dcace5f6f3bf48f2cf96ad0e5e998e8596b
[ "MIT" ]
null
null
null
app/src/main/java/com/tipchou/sunshineboxiii/entity/local/DownloadLocal.kt
chenyuey/SunshineBoxIII
39dd2dcace5f6f3bf48f2cf96ad0e5e998e8596b
[ "MIT" ]
2
2018-06-19T07:42:33.000Z
2018-07-18T10:00:50.000Z
package com.tipchou.sunshineboxiii.entity.local import io.objectbox.annotation.Entity import io.objectbox.annotation.Id /** * Created by 邵励治 on 2018/5/2. * Perfect Code */ @Entity class DownloadLocal(@Id var id: Long = 0, val objectId: String, var publishedUrl: String?, var stagingUrl: String?)
25.083333
115
0.757475
d758a13df089ffe868a9ff323211dfecc837fbef
674
asm
Assembly
programs/oeis/020/A020873.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/020/A020873.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
programs/oeis/020/A020873.asm
karttu/loda
9c3b0fc57b810302220c044a9d17db733c76a598
[ "Apache-2.0" ]
null
null
null
; A020873: a(n) = number of cycles in Moebius ladder M_n. ; 2,3,7,15,29,53,95,171,313,585,1115,2159,4229,8349,16567,32979,65777,131345,262451,524631,1048957,2097573,4194767,8389115,16777769,33555033,67109515,134218431,268436213,536871725,1073742695,2147484579,4294968289,8589935649,17179870307,34359739559,68719477997,137438954805,274877908351,549755815371,1099511629337,2199023257193,4398046512827,8796093024015,17592186046309,35184372090813,70368744179735,140737488357491,281474976712913,562949953423665,1125899906845075,2251799813687799,4503599627373149,9007199254743749 mov $1,2 mov $2,1 mov $4,$0 lpb $0,1 sub $0,1 add $1,$4 mov $3,$2 mul $2,2 add $4,$3 lpe
48.142857
515
0.81454
27fec5ad6511dfedd3979f4fc79aa6e9893f4142
2,154
kt
Kotlin
provider/src/main/kotlin/de/qhun/declaration_provider/provider/github/GithubFileDownloader.kt
wartoshika/wow-declaration-provider
bc26206f36ae06bdc9cb3e206b4baa22e8bcaf82
[ "MIT" ]
null
null
null
provider/src/main/kotlin/de/qhun/declaration_provider/provider/github/GithubFileDownloader.kt
wartoshika/wow-declaration-provider
bc26206f36ae06bdc9cb3e206b4baa22e8bcaf82
[ "MIT" ]
null
null
null
provider/src/main/kotlin/de/qhun/declaration_provider/provider/github/GithubFileDownloader.kt
wartoshika/wow-declaration-provider
bc26206f36ae06bdc9cb3e206b4baa22e8bcaf82
[ "MIT" ]
null
null
null
package de.qhun.declaration_provider.provider.github import de.qhun.declaration_provider.domain.WowVersion import de.qhun.declaration_provider.domain.helper.mapChunked import kotlinx.coroutines.coroutineScope import okhttp3.OkHttpClient import okhttp3.Request import org.json.JSONArray import org.json.JSONObject @Suppress("BlockingMethodInNonBlockingContext") internal object GithubFileDownloader { private val httpClient = OkHttpClient() suspend fun downloadDocumentation(version: WowVersion): Map<String, String> = coroutineScope { provideFileList(version) .entries .mapChunked(25) { entry -> val fileRequest = Request.Builder() .url(entry.value) .build() val response = httpClient.newCall(fileRequest).execute() if (response.isSuccessful && response.body != null) { Pair(entry.key, response.body!!.string()) } else { throw IllegalStateException("" + response.code + ": " + response.message) } }.toMap() } private fun provideFileList(version: WowVersion): Map<String, String> { val request = Request.Builder() .url( listOf( GithubConstants.GIT_API_URL, "?ref=", GithubConstants.BRANCH_NAME_BY_VERSION[version] ).joinToString("") ) .build() val response = httpClient.newCall(request).execute() return if (!response.isSuccessful || response.body == null) { throw IllegalStateException("" + response.code + ": " + response.message) } else { val jsonString = response.body!!.string() val json = JSONArray(jsonString) val fileList = mutableListOf<JSONObject>() for (index in 0 until json.length()) { fileList.add(json.getJSONObject(index)) } fileList.map { it.getString("name") to it.getString("download_url") }.toMap() } } }
34.190476
98
0.58403
3da675e2562cf076290bda885834cfb25ec424f1
580
rs
Rust
src/utils/value_util.rs
insanebaba/rbatis
bc615e6f5aab7e3773c8f554f8125e0f808aa169
[ "Apache-2.0" ]
null
null
null
src/utils/value_util.rs
insanebaba/rbatis
bc615e6f5aab7e3773c8f554f8125e0f808aa169
[ "Apache-2.0" ]
1
2020-08-29T01:15:14.000Z
2020-08-29T01:15:14.000Z
src/utils/value_util.rs
insanebaba/rbatis
bc615e6f5aab7e3773c8f554f8125e0f808aa169
[ "Apache-2.0" ]
null
null
null
use serde_json::json; use serde_json::Value; //深度取值。例如a.b.c 最终得到c.如果不存在返回Value::Null pub fn get_deep_value(arg: &str, value: &Value) -> Value { let splits: Vec<&str> = arg.split(".").collect(); let mut v = value; for item in splits { if item.is_empty() { continue; } v = v.get(item).unwrap_or(&Value::Null); } return v.clone(); } #[test] pub fn test_get_deep_value() { let john = json!({ "a": { "name":"job", }, }); let v = get_deep_value("a.name", &john); println!("{}", v); }
20.714286
58
0.525862
e3a52ce1355b4fb63db14eee2ae345daa2a32f74
9,656
kt
Kotlin
src/main/kotlin/tel/schich/kognigy/protocol/SocketIoPacket.kt
pschichtel/Kognigy
46b6d888a33fabf2e8b0bd23b678dd12cec74099
[ "MIT" ]
null
null
null
src/main/kotlin/tel/schich/kognigy/protocol/SocketIoPacket.kt
pschichtel/Kognigy
46b6d888a33fabf2e8b0bd23b678dd12cec74099
[ "MIT" ]
9
2021-07-17T12:26:21.000Z
2021-07-29T18:01:23.000Z
src/main/kotlin/tel/schich/kognigy/protocol/SocketIoPacket.kt
pschichtel/Kognigy
46b6d888a33fabf2e8b0bd23b678dd12cec74099
[ "MIT" ]
null
null
null
package tel.schich.kognigy.protocol import kotlinx.serialization.SerializationException import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonArray import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonNull import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonPrimitive import kotlinx.serialization.json.decodeFromJsonElement import kotlinx.serialization.json.encodeToJsonElement import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonObject import java.nio.ByteBuffer /** * Based on: [github.com/socketio/socket.io-protocol](https://github.com/socketio/socket.io-protocol) */ sealed interface SocketIoPacket { sealed interface Namespaced { val namespace: String? } data class Connect( override val namespace: String?, val data: JsonObject?, ) : SocketIoPacket, Namespaced { companion object { val Format = """^(?:([^,]+),)?(\{.*})?$""".toRegex() } } data class Disconnect( override val namespace: String?, ) : SocketIoPacket, Namespaced { companion object { val Format = """^(?:([^,]+),)?""".toRegex() } } data class Event( override val namespace: String?, val acknowledgeId: Int?, val name: String, val arguments: List<JsonElement>, ) : SocketIoPacket, Namespaced { companion object { val Format = """^(?:([^,]+),)?(\d+)?(\[.*])$""".toRegex() } } data class Acknowledge( override val namespace: String?, val acknowledgeId: Int, val data: JsonArray?, ) : SocketIoPacket, Namespaced { companion object { val Format = """^(?:([^,]+),)?(\d+)(\[.*])?$""".toRegex() } } data class ConnectError( override val namespace: String?, val data: Data?, ) : SocketIoPacket, Namespaced { data class Data(val message: String, val data: JsonElement?) companion object { val Format = """^(?:([^,]+),)?(.+)?$""".toRegex() } } data class BinaryEvent( override val namespace: String?, val acknowledgeId: Int?, val name: String, val data: ByteBuffer, ) : SocketIoPacket, Namespaced { companion object { val Format = """^(?:([^,]+),)?(\d+)?(\[.*])?$""".toRegex() } } data class BinaryAcknowledge( override val namespace: String?, val acknowledgeId: Int, val data: ByteBuffer?, ) : SocketIoPacket, Namespaced { companion object { val Format = """^(?:([^,]+),)?(\d+)?(\[.*])?$""".toRegex() } } data class BrokenPacket( val packet: String, val reason: String, val t: Throwable?, ) : SocketIoPacket companion object { fun decode(json: Json, packet: EngineIoPacket.TextMessage): SocketIoPacket { val message = packet.message if (message.isEmpty()) { return BrokenPacket(message, "empty message", null) } return when (val type = message[0]) { '0' -> decodeConnect(message, json) '1' -> decodeDisconnect(message) '2' -> decodeEvent(message, json) '3' -> decodeAck(message, json) '4' -> decodeConnectError(message, json) '5' -> TODO("currently not needed") '6' -> TODO("currently not needed") else -> BrokenPacket(message, "unknown packet type: $type", null) } } fun encode(json: Json, packet: SocketIoPacket): EngineIoPacket.TextMessage { return when (packet) { is Connect -> encodePacket( json, type = 0, namespace = packet.namespace, acknowledgeId = null, data = null, ) is Disconnect -> encodePacket( json, type = 1, namespace = packet.namespace, acknowledgeId = null, data = null, ) is Event -> encodePacket( json, type = 2, namespace = packet.namespace, acknowledgeId = packet.acknowledgeId, data = JsonArray(listOf(JsonPrimitive(packet.name)) + packet.arguments), ) is Acknowledge -> encodePacket( json, type = 3, namespace = packet.namespace, acknowledgeId = packet.acknowledgeId, data = packet.data, ) is ConnectError -> encodePacket( json, type = 4, namespace = packet.namespace, acknowledgeId = null, data = json.encodeToJsonElement(packet.data), ) is BinaryEvent -> TODO("currently not needed") is BinaryAcknowledge -> TODO("currently not needed") is BrokenPacket -> EngineIoPacket.TextMessage(packet.packet) } } } } private fun encodePacket( json: Json, type: Int, namespace: String?, acknowledgeId: Int?, data: JsonElement?, ): EngineIoPacket.TextMessage { // TODO binary support // val binaryAttachmentCountPart = binaryAttachmentCount?.let { "$it-" } ?: "" val binaryAttachmentCountPart = "" val namespacePart = if (namespace == null || namespace == "/") "" else "$namespace," val acknowledgeIdPart = acknowledgeId?.toString() ?: "" val payload = if (data == null || data is JsonNull) "" else json.encodeToString(data) val message = "$type$binaryAttachmentCountPart$namespacePart$acknowledgeIdPart$payload" return EngineIoPacket.TextMessage(message) } private fun matchFormat( message: String, format: Regex, block: (MatchResult.Destructured) -> SocketIoPacket, ): SocketIoPacket { val match = format.matchEntire(message.substring(1)) return if (match == null) SocketIoPacket.BrokenPacket(message, "did not match packet format", null) else try { block(match.destructured) } catch (e: SerializationException) { SocketIoPacket.BrokenPacket(message, "data failed to parse as JSON", e) } } private fun decodeConnect( message: String, json: Json, ) = matchFormat(message, SocketIoPacket.Connect.Format) { (namespaceStr, dataStr) -> val namespace = namespaceStr.ifEmpty { null } // directly accessing the JSON as an object is safe here, since the regex makes sure this is // an object if it actually parses val data = if (dataStr.isEmpty()) null else json.parseToJsonElement(dataStr).jsonObject SocketIoPacket.Connect(namespace, data) } private fun decodeDisconnect( message: String, ) = matchFormat(message, SocketIoPacket.Disconnect.Format) { (namespaceStr) -> val namespace = namespaceStr.ifEmpty { null } SocketIoPacket.Disconnect(namespace) } private fun decodeEvent( message: String, json: Json, ) = matchFormat(message, SocketIoPacket.Event.Format) { (namespaceStr, acknowledgeIdStr, dataStr) -> val namespace = namespaceStr.ifEmpty { null } val acknowledgeId = acknowledgeIdStr.ifEmpty { null }?.toInt() // directly accessing the JSON as an array is safe here, since the regex makes sure this is an // array if it actually parses val data = json.parseToJsonElement(dataStr).jsonArray val name = data.firstOrNull() when { name == null -> { SocketIoPacket.BrokenPacket(message, "events needs at least the event name in the data", null) } name is JsonPrimitive && name.isString -> { SocketIoPacket.Event(namespace, acknowledgeId, name.content, data.drop(1)) } else -> { SocketIoPacket.BrokenPacket(message, "event name is not a string: $name", null) } } } private fun decodeAck( message: String, json: Json, ) = matchFormat(message, SocketIoPacket.Acknowledge.Format) { (namespaceStr, acknowledgeIdStr, dataStr) -> val namespace = namespaceStr.ifEmpty { null } val acknowledgeId = acknowledgeIdStr.toInt() // directly accessing the JSON as an array is safe here, since the regex makes sure this is an // array if it actually parses val data = dataStr.ifEmpty { null }?.let { json.parseToJsonElement(it).jsonArray } SocketIoPacket.Acknowledge(namespace, acknowledgeId, data) } private fun decodeConnectError( message: String, json: Json, ) = matchFormat(message, SocketIoPacket.ConnectError.Format) { (namespaceStr, dataStr) -> val namespace = namespaceStr.ifEmpty { null } val data = dataStr.ifEmpty { null }?.let(json::parseToJsonElement) when { data == null -> { SocketIoPacket.ConnectError(namespace, null) } data is JsonObject -> { SocketIoPacket.ConnectError(namespace, json.decodeFromJsonElement(data)) } data is JsonPrimitive && data.isString -> { SocketIoPacket.ConnectError(namespace, SocketIoPacket.ConnectError.Data(data.content, null)) } else -> { SocketIoPacket.BrokenPacket(message, "error data is neither an object nor a string", null) } } }
34.120141
106
0.593103
70dfb228b649e0925a92da5c79ce1fa0aa23d1b3
8,852
h
C
motioncorr_v2.1/src/SP++3/include/linequs1-impl.h
cianfrocco-lab/Motion-correction
c77ee034bba2ef184837e070dde43f75d8a4e1e7
[ "MIT" ]
11
2016-09-05T21:14:25.000Z
2022-02-18T21:31:34.000Z
src/SP++3/include/linequs1-impl.h
wjiang/motioncorr
14ed37d1cc72e55d1592e78e3dda758cd46a3698
[ "Naumen", "Condor-1.1", "MS-PL" ]
5
2017-04-24T12:26:42.000Z
2020-06-29T11:43:34.000Z
src/SP++3/include/linequs1-impl.h
wjiang/motioncorr
14ed37d1cc72e55d1592e78e3dda758cd46a3698
[ "Naumen", "Condor-1.1", "MS-PL" ]
9
2016-04-26T10:14:20.000Z
2020-10-14T07:34:59.000Z
/* * Copyright (c) 2008-2011 Zhang Ming (M. Zhang), zmjerry@163.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 2 or any later version. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. A copy of the GNU General Public License is available at: * http://www.fsf.org/licensing/licenses */ /***************************************************************************** * linequs1-impl.h * * Implementation for deterministic linear equations. * * Zhang Ming, 2010-07 (revised 2010-12), Xi'an Jiaotong University. *****************************************************************************/ /** * Linear equations solution by Gauss-Jordan elimination, Ax=B. * A ---> The n-by-n coefficient matrix(Full Rank); * b ---> The n-by-1 right-hand side vector; * x ---> The n-by-1 solution vector. */ template <typename Type> Vector<Type> gaussSolver( const Matrix<Type> &A, const Vector<Type> &b ) { assert( A.rows() == b.size() ); int rows = b.size(); Vector<Type> x( rows ); Matrix<Type> C(A); Matrix<Type> B( rows, 1 ); for( int i=0; i<rows; ++i ) B[i][0] = b[i]; gaussSolver( C, B ); for( int i=0; i<rows; ++i ) x[i] = B[i][0]; return x; } /** * Linear equations solution by Gauss-Jordan elimination, AX=B. * A ---> The n-by-n coefficient matrix(Full Rank); * B ---> The n-by-m right-hand side vectors; * When solving is completion, A is replaced by its inverse and * B is replaced by the corresponding set of solution vectors. * Adapted from Numerical Recipes. */ template <typename Type> void gaussSolver( Matrix<Type> &A, Matrix<Type> &B ) { assert( A.rows() == B.rows() ); int i, j, k, l, ll, icol, irow, n=A.rows(), m=B.cols(); Type big, dum, pivinv; Vector<int> indxc(n), indxr(n), ipiv(n); for( j=0; j<n; j++ ) ipiv[j]=0; for( i=0; i<n; ++i ) { big = 0.0; for( j=0; j<n; ++j ) if( ipiv[j] != 1 ) for( k=0; k<n; ++k ) if( ipiv[k] == 0 ) if( abs(A[j][k]) >= abs(big) ) { big = abs(A[j][k]); irow = j; icol = k; } ++(ipiv[icol]); if( irow != icol ) { for( l=0; l<n; ++l ) swap( A[irow][l], A[icol][l] ); for( l=0; l<m; ++l ) swap( B[irow][l], B[icol][l] ); } indxr[i] = irow; indxc[i] = icol; if( abs(A[icol][icol]) == 0.0 ) { cerr << "Singular Matrix!" << endl; return; } pivinv = Type(1) / A[icol][icol]; A[icol][icol] = Type(1); for( l=0; l<n; ++l ) A[icol][l] *= pivinv; for( l=0; l<m; ++l ) B[icol][l] *= pivinv; for( ll=0; ll<n; ++ll ) if( ll != icol ) { dum = A[ll][icol]; A[ll][icol] = 0; for( l=0; l<n; ++l ) A[ll][l] -= A[icol][l]*dum; for( l=0; l<m; ++l ) B[ll][l] -= B[icol][l]*dum; } } for( l=n-1; l>=0; --l ) if( indxr[l] != indxc[l] ) for( k=0; k<n; k++ ) swap( A[k][indxr[l]], A[k][indxc[l]] ); } /** * Linear equations solution by LU decomposition, Ax=b. * A ---> The n-by-n coefficient matrix(Full Rank); * b ---> The n-by-1 right-hand side vector; * x ---> The n-by-1 solution vector. */ template <typename Type> Vector<Type> luSolver( const Matrix<Type> &A, const Vector<Type> &b ) { assert( A.rows() == b.size() ); LUD<Type> lu; lu.dec( A ); return lu.solve( b ); } /** * Linear equations solution by LU decomposition, AX=B. * A ---> The n-by-n coefficient matrix(Full Rank); * B ---> The n-by-m right-hand side vector; * X ---> The n-by-m solution vectors. */ template <typename Type> Matrix<Type> luSolver( const Matrix<Type> &A, const Matrix<Type> &B ) { assert( A.rows() == B.rows() ); LUD<Type> lu; lu.dec( A ); return lu.solve( B ); } /** * Linear equations solution by Cholesky decomposition, Ax=b. * A ---> The n-by-n coefficient matrix(Full Rank); * b ---> The n-by-1 right-hand side vector; * x ---> The n-by-1 solution vector. */ template <typename Type> Vector<Type> choleskySolver( const Matrix<Type> &A, const Vector<Type> &b ) { assert( A.rows() == b.size() ); Cholesky<Type> cho; cho.dec(A); if( cho.isSpd() ) return cho.solve( b ); else { cerr << "Factorization was not complete!" << endl; return Vector<Type>(0); } } /** * Linear equations solution by Cholesky decomposition, AX=B. * A ---> The n-by-n coefficient matrix(Full Rank); * B ---> The n-by-m right-hand side vector; * X ---> The n-by-m solution vectors. */ template <typename Type> Matrix<Type> choleskySolver( const Matrix<Type> &A, const Matrix<Type> &B ) { assert( A.rows() == B.rows() ); Cholesky<Type> cho; cho.dec(A); if( cho.isSpd() ) return cho.solve( B ); else { cerr << "Factorization was not complete!" << endl; return Matrix<Type>(0,0); } } /** * Solve the upper triangular system U*x = b. * U ---> The n-by-n upper triangular matrix(Full Rank); * b ---> The n-by-1 right-hand side vector; * x ---> The n-by-1 solution vector. */ template <typename Type> Vector<Type> utSolver( const Matrix<Type> &U, const Vector<Type> &b ) { int n = b.dim(); assert( U.rows() == n ); assert( U.rows() == U.cols() ); Vector<Type> x(b); for( int k=n; k >= 1; --k ) { x(k) /= U(k,k); for( int i=1; i<k; ++i ) x(i) -= x(k) * U(i,k); } return x; } /** * Solve the lower triangular system L*x = b. * L ---> The n-by-n lower triangular matrix(Full Rank); * b ---> The n-by-1 right-hand side vector; * x ---> The n-by-1 solution vector. */ template <typename Type> Vector<Type> ltSolver( const Matrix<Type> &L, const Vector<Type> &b ) { int n = b.dim(); assert( L.rows() == n ); assert( L.rows() == L.cols() ); Vector<Type> x(b); for( int k=1; k <= n; ++k ) { x(k) /= L(k,k); for( int i=k+1; i<= n; ++i ) x(i) -= x(k) * L(i,k); } return x; } /** * Tridiagonal equations solution by Forward Elimination and Backward Substitution. * a ---> The n-1-by-1 main(0th) diagonal vector; * b ---> The n-by-1 -1th(above main) diagonal vector; * c ---> The n-1-by-1 +1th(below main) diagonal vector; * d ---> The right-hand side vector; * x ---> The n-by-1 solution vector. */ template <typename Type> Vector<Type> febsSolver( const Vector<Type> &a, const Vector<Type> &b, const Vector<Type> &c, const Vector<Type> &d ) { int n = b.size(); assert( a.size() == n-1 ); assert( c.size() == n-1 ); assert( d.size() == n ); Type mu = 0; Vector<Type> x(d), bb(b); for( int i=0; i<n-1; ++i ) { mu = a[i] / bb[i]; bb[i+1] = bb[i+1] - mu*c[i]; x[i+1] = x[i+1] - mu*x[i]; } x[n-1] = x[n-1] / bb[n-1]; for( int i=n-2; i>=0; --i ) x[i] = ( x[i]-c[i]*x[i+1] ) / bb[i]; // for( int j=1; j<n; ++j ) // { // mu = a(j) / bb(j); // bb(j+1) = bb(j+1) - mu*c(j); // x(j+1) = x(j+1) - mu*x(j); // } // // x(n) = x(n) / bb(n); // for( int j=n-1; j>0; --j ) // x(j) = ( x(j)-c(j)*x(j+1) ) / bb(j); return x; }
27.749216
84
0.492318
2651b89ebd8b89c5529be10be55b659c99d49d60
488
java
Java
delivery/app-release_source_from_JADX/com/paypal/android/sdk/payments/bs.java
ANDROFAST/delivery_articulos
ddcc8b06d7ea2895ccda2e13c179c658703fec96
[ "Apache-2.0" ]
null
null
null
delivery/app-release_source_from_JADX/com/paypal/android/sdk/payments/bs.java
ANDROFAST/delivery_articulos
ddcc8b06d7ea2895ccda2e13c179c658703fec96
[ "Apache-2.0" ]
null
null
null
delivery/app-release_source_from_JADX/com/paypal/android/sdk/payments/bs.java
ANDROFAST/delivery_articulos
ddcc8b06d7ea2895ccda2e13c179c658703fec96
[ "Apache-2.0" ]
null
null
null
package com.paypal.android.sdk.payments; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; final class bs implements OnClickListener { private /* synthetic */ PaymentMethodActivity f977a; bs(PaymentMethodActivity paymentMethodActivity) { this.f977a = paymentMethodActivity; } public final void onClick(DialogInterface dialogInterface, int i) { this.f977a.f861i.m653t(); this.f977a.m711c(); } }
27.111111
71
0.739754
7204efbd1422f45f259e7f777b50b267baa79f8f
3,418
swift
Swift
OperationKit/Networking/NetworkOperation.swift
floschliep/OperationKit
3da52561c75f2d80b3a469af5460d0202b8337a2
[ "MIT" ]
1
2019-03-30T11:04:18.000Z
2019-03-30T11:04:18.000Z
OperationKit/Networking/NetworkOperation.swift
floschliep/OperationKit
3da52561c75f2d80b3a469af5460d0202b8337a2
[ "MIT" ]
1
2018-07-16T20:43:32.000Z
2018-07-16T20:44:38.000Z
OperationKit/Networking/NetworkOperation.swift
floschliep/OperationKit
3da52561c75f2d80b3a469af5460d0202b8337a2
[ "MIT" ]
null
null
null
// // NetworkOperation.swift // OperationKit // // Created by Florian Schliep on 22.01.18. // Copyright © 2018 Florian Schliep. All rights reserved. // import Foundation open class NetworkOperation<ResultType, TaskResultType>: AsyncOperation<ResultType, NSError> { public typealias NetworkResponseEvaluation = (TaskResultType, HTTPURLResponse) throws -> ResultType // MARK: - Properties open let url: URL open let urlSession: URLSession private var task: URLSessionTask? private var evaluate: NetworkResponseEvaluation // MARK: - Instantiation public override init() { fatalError("NetworkOperation is an abstract class! You must provide an implementation of init in your subclass!") } public required init(url: URL, urlSession: URLSession, evaluate: @escaping NetworkResponseEvaluation) { self.url = url self.urlSession = urlSession self.evaluate = evaluate super.init() } // MARK: - Abstract Logic open func prepareRequest(_ request: inout URLRequest) throws { } open func createTask(with request: URLRequest, using session: URLSession) -> URLSessionTask { fatalError("NetworkOperation is an abstract class! You must provide an implementation of createTask(with:using:) in your subclass.") } public final func evaluate(result: TaskResultType, response: HTTPURLResponse) throws -> ResultType { return try self.evaluate(result, response) } // MARK: - NSOperation open override func cancel() { self.task?.cancel() super.cancel() } // MARK: - Execution public final override func main() { // prepare request var request = URLRequest(url: self.url) do { try self.prepareRequest(&request) } catch let error as NSErrorConvertible { self.finish(withError: error.nsError) return } catch { let nsError = NSError(domain: "com.floschliep.OperationKit.UnknownError", code: 1, userInfo: [ NSLocalizedDescriptionKey: error.localizedDescription ]) self.finish(withError: nsError) return } // start task self.task = self.createTask(with: request, using: self.urlSession) self.task!.resume() } } public protocol NSErrorConvertible: Error { var nsError: NSError { get } } extension NSError: NSErrorConvertible { public var nsError: NSError { return self } } enum NetworkOperationError: NSErrorConvertible { case emptyResponse case invalidResponse var message: String { switch self { case .emptyResponse: return NSLocalizedString("Received Empty Response", comment: "") case .invalidResponse: return NSLocalizedString("Received Invalid Response", comment: "") } } var code: Int { switch self { case .emptyResponse: return 11 case .invalidResponse: return 12 } } var nsError: NSError { return NSError(domain: "com.floschliep.OperationKit.NetworkOperationError", code: self.code, userInfo: [NSLocalizedDescriptionKey: self.message]) } }
29.213675
140
0.619661
5c96acacbffdf15fd0d543110e682e3d75e70ed0
1,182
h
C
src/crypto/sha256/sha256.h
sga001/vex
fb4e8890ebb307ce35f6d38ef0dc15f0bb046b54
[ "CC0-1.0" ]
null
null
null
src/crypto/sha256/sha256.h
sga001/vex
fb4e8890ebb307ce35f6d38ef0dc15f0bb046b54
[ "CC0-1.0" ]
null
null
null
src/crypto/sha256/sha256.h
sga001/vex
fb4e8890ebb307ce35f6d38ef0dc15f0bb046b54
[ "CC0-1.0" ]
null
null
null
#ifndef _VEX_SHA256_H #define _VEX_SHA256_H #include <stdint.h> #include <stddef.h> #include <endian.h> #define SHA256_DIGEST_SIZE 32 #define SHA256_WORDS 8 #define SHA_TYPE 1 // 1 = AVX, 2 = SSE4, 3 = RORX, 4 = RORX8 typedef struct { uint64_t totalLength; uint64_t blocks; uint32_t hash[SHA256_WORDS]; uint32_t bufferLength; union { uint32_t words[16]; uint8_t bytes[64]; } buffer; } SHA256_Context; #ifdef __cplusplus extern "C" { #endif /* Public API */ void SHA256_hash(const void* data, size_t len, uint8_t digest[SHA256_DIGEST_SIZE]); /* Utility functions */ void SHA256_init(SHA256_Context *sc); void SHA256_update(SHA256_Context* sc, const void* data, size_t len); void SHA256_final(SHA256_Context* sc, uint8_t hash[SHA256_DIGEST_SIZE]); /* Intel optimized update functions */ extern void sha256_sse4(void* input_data, uint32_t digest[8], uint64_t num_blks); extern void sha256_avx(void* input_data, uint32_t digest[8], uint64_t num_blks); extern void sha256_rorx(void* input_data, uint32_t digest[8], uint64_t num_blks); extern void sha256_rorx_x8ms(void* input_data, uint32_t digest[8], uint64_t num_blks); #ifdef __cplusplus } #endif #endif
25.695652
86
0.757191
74e0927cbb782e19975fb2133a14996f693ce24c
546
kt
Kotlin
idea/testData/completion/smart/EmptyPrefix.kt
chashnikov/kotlin
88a261234860ff0014e3c2dd8e64072c685d442d
[ "Apache-2.0" ]
1
2017-09-10T07:15:28.000Z
2017-09-10T07:15:28.000Z
idea/testData/completion/smart/EmptyPrefix.kt
hhariri/kotlin
d150bfbce0e2e47d687f39e2fd233ea55b2ccd26
[ "Apache-2.0" ]
null
null
null
idea/testData/completion/smart/EmptyPrefix.kt
hhariri/kotlin
d150bfbce0e2e47d687f39e2fd233ea55b2ccd26
[ "Apache-2.0" ]
null
null
null
open class Foo class Bar : Foo() val foo = Foo() val bar = Bar() val o : Any = "" fun f(p1 : Foo, p2 : Bar, p3 : String, p4 : Foo?) { var a : Foo a = <caret> } fun f1() : Foo{} fun f2() : Bar{} fun f3() : String{} // EXIST: foo // EXIST: bar // ABSENT: o // EXIST: p1 // EXIST: p2 // ABSENT: p3 // ABSENT: { lookupString:"p4", itemText:"p4" } // EXIST: { lookupString:"p4", itemText:"!! p4" } // EXIST: { lookupString:"p4", itemText:"?: p4" } // EXIST: f1 // EXIST: f2 // ABSENT: f3 // EXIST: { lookupString:"Foo", itemText:"Foo()" }
18.2
51
0.551282
fb0716d2ee5fa752f230f8a4ad66d911647c6199
428
php
PHP
app/PressReleasesModel.php
ourworkspace/omniyat
19985aa74553216e6fd8b81be4212e383b14c82f
[ "MIT" ]
null
null
null
app/PressReleasesModel.php
ourworkspace/omniyat
19985aa74553216e6fd8b81be4212e383b14c82f
[ "MIT" ]
null
null
null
app/PressReleasesModel.php
ourworkspace/omniyat
19985aa74553216e6fd8b81be4212e383b14c82f
[ "MIT" ]
null
null
null
<?php namespace App; use Illuminate\Database\Eloquent\Model; class PressReleasesModel extends Model { protected $table = 'press_releases'; protected $fillable = ['category_id','title','short_description','long_description','thumb_image','large_image','pdf_file','date','status']; public function category() { return $this->belongsTo(PressReleasesCategoriesModel::class, 'category_id', 'id'); } }
25.176471
144
0.712617
42091ed0deaa085287d705fbcef3b5b1091ed8de
101
lua
Lua
cocos2d/cocos/scripting/lua-bindings/auto/api/PhysicsDebugDraw.lua
weiDDD/particleSystem
32652b09da35e025956999227f08be83b5d79cb1
[ "Apache-2.0" ]
34
2017-08-16T13:58:24.000Z
2022-03-31T11:50:25.000Z
cocos2d/cocos/scripting/lua-bindings/auto/api/PhysicsDebugDraw.lua
weiDDD/particleSystem
32652b09da35e025956999227f08be83b5d79cb1
[ "Apache-2.0" ]
null
null
null
cocos2d/cocos/scripting/lua-bindings/auto/api/PhysicsDebugDraw.lua
weiDDD/particleSystem
32652b09da35e025956999227f08be83b5d79cb1
[ "Apache-2.0" ]
17
2017-08-18T07:42:44.000Z
2022-01-02T02:43:06.000Z
-------------------------------- -- @module PhysicsDebugDraw -- @parent_module cc return nil
14.428571
33
0.455446
c7f4d4871ed25632563eb91b4441d716c68c2909
4,174
java
Java
src/test/java/com/basistech/tclre/osgitest/OsgiBundleIT.java
basis-technology-corp/tcl-regex-java
dc5651a570f4b84779b13f5e1901cc589c5fc1df
[ "Apache-2.0" ]
24
2015-01-20T22:55:55.000Z
2021-05-29T00:09:42.000Z
src/test/java/com/basistech/tclre/osgitest/OsgiBundleIT.java
basis-technology-corp/tcl-regex-java
dc5651a570f4b84779b13f5e1901cc589c5fc1df
[ "Apache-2.0" ]
8
2015-01-02T17:39:28.000Z
2022-03-03T13:08:54.000Z
src/test/java/com/basistech/tclre/osgitest/OsgiBundleIT.java
basis-technology-corp/tcl-regex-java
dc5651a570f4b84779b13f5e1901cc589c5fc1df
[ "Apache-2.0" ]
9
2015-01-02T17:40:35.000Z
2022-01-12T14:27:21.000Z
/* * Copyright 2014 Basis Technology Corp. * * 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.basistech.tclre.osgitest; import com.basistech.tclre.HsrePattern; import com.basistech.tclre.PatternFlags; import com.basistech.tclre.RePattern; import com.basistech.tclre.Utils; import com.google.common.collect.Lists; import com.google.common.io.Resources; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; import org.ops4j.pax.exam.spi.reactors.PerClass; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.List; import java.util.Properties; import static org.junit.Assert.assertTrue; import static org.ops4j.pax.exam.CoreOptions.junitBundles; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.CoreOptions.provision; import static org.ops4j.pax.exam.CoreOptions.systemPackages; import static org.ops4j.pax.exam.CoreOptions.systemProperty; /** * Test that the OSGi bundle works. */ @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) public class OsgiBundleIT extends Utils { private String getDependencyVersion(String groupId, String artifactId) { URL depPropsUrl = Resources.getResource("META-INF/maven/dependencies.properties"); Properties depProps = new Properties(); try { depProps.load(Resources.asByteSource(depPropsUrl).openStream()); } catch (IOException e) { throw new RuntimeException(e); } return (String)depProps.get(String.format("%s/%s/version", groupId, artifactId)); } @Configuration public Option[] config() { String projectBuildDirectory = System.getProperty("project.build.directory"); String projectVersion = System.getProperty("project.version"); List<String> bundleUrls = Lists.newArrayList(); File bundleDir = new File(projectBuildDirectory, "bundles"); File[] bundleFiles = bundleDir.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".jar"); } }); for (File bundleFile : bundleFiles) { try { bundleUrls.add(bundleFile.toURI().toURL().toExternalForm()); } catch (MalformedURLException e) { throw new RuntimeException(e); } } bundleUrls.add(String.format("file:%s/tcl-regex-%s.jar", projectBuildDirectory, projectVersion)); String[] bundles = bundleUrls.toArray(new String[0]); return options( provision(bundles), systemPackages( // These are needed for guava. "sun.misc", "javax.annotation", String.format("org.slf4j;version=\"%s\"", getDependencyVersion("org.slf4j", "slf4j-api")) ), junitBundles(), systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN") ); } @Test public void onceOver() throws Exception { // using ranges ensures that the ICU4J connection works right. RePattern exp = HsrePattern.compile("[^a][\u4e00-\uf000][[:upper:]][^\ufeff][\u4e00-\u4e10]b.c.d", PatternFlags.ADVANCED, PatternFlags.EXPANDED); assertTrue(exp.matcher("Q\u4e01A$\u4e09bGcHd").matches()); } }
37.267857
113
0.678246
81b1953c347469567c8314fdf740f839c715f457
235
rs
Rust
src/common/mod.rs
sesam/wallet713
92d5aa22292eba385fe0440512d10ee682e739d6
[ "Apache-2.0" ]
1
2019-07-08T04:07:06.000Z
2019-07-08T04:07:06.000Z
src/common/mod.rs
sesam/wallet713
92d5aa22292eba385fe0440512d10ee682e739d6
[ "Apache-2.0" ]
null
null
null
src/common/mod.rs
sesam/wallet713
92d5aa22292eba385fe0440512d10ee682e739d6
[ "Apache-2.0" ]
null
null
null
#[macro_use] pub mod macros; pub mod error; pub mod config; pub mod base58; pub mod crypto; pub use self::error::Error; pub use self::error::Wallet713Error; pub use self::macros::*; pub type Result<T> = std::result::Result<T, Error>;
21.363636
51
0.714894
6b5deebab0d36b77d24e02b2242bf973ef27cfc5
2,353
h
C
Pods/Headers/Public/AliyunOSSiOS/OSSNetworkingRequestDelegate.h
lbrjms/SCXCheYouHui
d2dcf8cd0874db290e851dbc0e404e31b98ec052
[ "MIT" ]
3
2019-12-24T01:10:39.000Z
2020-04-19T09:37:46.000Z
Pods/Headers/Public/AliyunOSSiOS/OSSNetworkingRequestDelegate.h
lbrjms/SCXCheYouHui
d2dcf8cd0874db290e851dbc0e404e31b98ec052
[ "MIT" ]
null
null
null
Pods/Headers/Public/AliyunOSSiOS/OSSNetworkingRequestDelegate.h
lbrjms/SCXCheYouHui
d2dcf8cd0874db290e851dbc0e404e31b98ec052
[ "MIT" ]
2
2018-10-26T02:29:06.000Z
2018-11-29T02:00:54.000Z
// // OSSNetworkingRequestDelegate.h // AliyunOSSSDK // // Created by huaixu on 2018/1/22. // Copyright © 2018年 aliyun. All rights reserved. // #import <Foundation/Foundation.h> #import "OSSConstants.h" #import "OSSTask.h" @class OSSAllRequestNeededMessage; @class OSSURLRequestRetryHandler; @class OSSHttpResponseParser; /** The proxy object class for each OSS request. */ @interface OSSNetworkingRequestDelegate : NSObject @property (nonatomic, strong) NSMutableArray * interceptors; @property (nonatomic, strong) NSMutableURLRequest *internalRequest; @property (nonatomic, assign) OSSOperationType operType; @property (nonatomic, assign) BOOL isAccessViaProxy; @property (nonatomic, assign) BOOL isRequestCancelled; @property (nonatomic, strong) OSSAllRequestNeededMessage *allNeededMessage; @property (nonatomic, strong) OSSURLRequestRetryHandler *retryHandler; @property (nonatomic, strong) OSSHttpResponseParser *responseParser; @property (nonatomic, strong) NSData * uploadingData; @property (nonatomic, strong) NSURL * uploadingFileURL; @property (nonatomic, assign) int64_t payloadTotalBytesWritten; @property (nonatomic, assign) BOOL isBackgroundUploadFileTask; @property (nonatomic, assign) BOOL isHttpdnsEnable; @property (nonatomic, assign) uint32_t currentRetryCount; @property (nonatomic, strong) NSError * error; @property (nonatomic, assign) BOOL isHttpRequestNotSuccessResponse; @property (nonatomic, strong) NSMutableData *httpRequestNotSuccessResponseBody; @property (atomic, strong) NSURLSessionDataTask *currentSessionTask; @property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress; @property (nonatomic, copy) OSSNetworkingDownloadProgressBlock downloadProgress; @property (nonatomic, copy) OSSNetworkingRetryBlock retryCallback; @property (nonatomic, copy) OSSNetworkingCompletionHandlerBlock completionHandler; @property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveData; /** * when put object to server,client caculate crc64 code and assigns it to * this property. */ @property (nonatomic, copy) NSString *contentCRC; /** last crc64 code */ @property (nonatomic, copy) NSString *lastCRC; /** * determine whether to verify crc64 code */ @property (nonatomic, assign) BOOL crc64Verifiable; - (OSSTask *)buildInternalHttpRequest; - (void)reset; - (void)cancel; @end
30.558442
82
0.79728
611a1cca7afefeb8f40312ac27cbde4e9ceebe21
3,142
css
CSS
clients/src/main/resources/static/css/test.css
asvarma1993/CordaProject
155d5032fff3842be43fd51e2e11c153545b6031
[ "Apache-2.0" ]
null
null
null
clients/src/main/resources/static/css/test.css
asvarma1993/CordaProject
155d5032fff3842be43fd51e2e11c153545b6031
[ "Apache-2.0" ]
null
null
null
clients/src/main/resources/static/css/test.css
asvarma1993/CordaProject
155d5032fff3842be43fd51e2e11c153545b6031
[ "Apache-2.0" ]
null
null
null
body{ margin: 0; } .header{ padding-top: 10PX; padding-bottom: 10PX; width: 100%; height:100%; background-size: cover; background-color: rgb(146, 183, 252);; text-align: center; } .topnav { overflow: hidden; height: 60px; padding-top: 20PX; background-color: white; } .topnav a { float: none; color: black; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px; } .topnav a:hover { background-color: rgb(146, 183, 252);; color: white; } .topnav a.active { background-color: grey; color: white; padding-bottom: 5px; } .topnav-right { float: right; } .image { padding: 0; width: 100%; height: 325px; background-image: url(../images/import2.jpg); background-position: 10px 0px; background-size: 1353px; } .form-control{ width:max-content; height: 35px; text-align: left; background-color: rgb(146, 183, 252); } .login_btn{ background-color: rgb(146, 183, 252); width: max-content; height: 30px; box-align: center; } .card{ background-color: #EAEAEA; float: right; border-radius: 23px; height: 250px; width: 450px; margin-right: 150px; margin-top: 40px; padding-top: 2px; } .footer-main-div{ width: 100%; height: 120%; background: white; padding: 1px 0px; } .footer-social-icons{ width: 50%; height: auto; margin: auto; padding: 0px; } .footer-social-icons ul{ text-align: center; } .footer-social-icons ul li.fb{ display: inline-block; width: 50px; height: 50px; background-image: url('../images/facebook.png'); background-size: 55px; margin: 0px 5px; } .footer-social-icons ul li.insta{ background-image: url('../images/insta.png'); display: inline-block; width: 50px; height: 50px; background-size: 50px; margin: 0px 5px; } .footer-social-icons ul li.youtube{ background-image: url('../images/youtube.png'); display: inline-block; width: 50px; height: 50px; background-size: 50px; margin: 0px 5px; } .footer-social-icons ul li.twt{ background-image: url('../images/twitter.png'); display: inline-block; width: 50px; height: 50px; background-size: 56px; margin: 0px 5px; } .footer-social-icons ul li.link{ background-image: url('../images/link.png'); display: inline-block; width: 50px; height: 50px; background-size: 50px; margin: 0px 5px; } .footer-social-icons ul li.pint{ background-image: url('../images/pint.png'); display: inline-block; width: 50px; height: 50px; background-size: 50px; margin: 0px 5px; } .footer-menu-one{ width: 100%; height: 10px; margin: 20px; padding: 0px 0px; } .footer-menu-one ul{ margin: 0px; padding: 0px; text-align: center; } .footer-menu-one ul li{ display: inline-block; margin: 0px 10px; color: black; } .footer-menu-one ul li a{ color: black; text-decoration: none; }
17.852273
52
0.5993
7ff7cbb143439303f713eddf76e6a71800bc3b52
8,706
swift
Swift
HotChat/Dating/Controller/DatingViewController.swift
ilumanxi/HotChat
ab8cfdf83a3cc40bbb57232f19fbe261c972f367
[ "MIT" ]
1
2021-01-11T03:44:02.000Z
2021-01-11T03:44:02.000Z
HotChat/Dating/Controller/DatingViewController.swift
ilumanxi/HotChat
ab8cfdf83a3cc40bbb57232f19fbe261c972f367
[ "MIT" ]
null
null
null
HotChat/Dating/Controller/DatingViewController.swift
ilumanxi/HotChat
ab8cfdf83a3cc40bbb57232f19fbe261c972f367
[ "MIT" ]
null
null
null
// // EngagementViewController.swift // HotChat // // Created by 风起兮 on 2021/4/15. // Copyright © 2021 风起兮. All rights reserved. // import UIKit import Kingfisher import RxCocoa import RxSwift import MJRefresh import MagazineLayout class DatingViewController: UIViewController, LoadingStateType, IndicatorDisplay, StoryboardCreate { static var storyboardNamed: String { return "Dating" } var state: LoadingState = .initial { didSet { showOrHideIndicator(loadingState: state) } } @IBOutlet weak var backgroundImageView: UIImageView! @IBOutlet weak var collectionView: UICollectionView! let layout = MagazineLayout() var pageIndex: Int = 1 let refreshPageIndex: Int = 1 let loadSignal = PublishSubject<Int>() let videoDatingAPI = Request<VideoDatingAPI>() var dynamics: [Dynamic] = [] override func viewDidLoad() { super.viewDidLoad() if self.navigationController!.viewControllers.count > 1 { navigationItem.title = "在线视频" let backItem = UIBarButtonItem(image: UIImage(named: "circle-back-white"), style: .done, target: self, action: #selector(back)) navigationItem.leftBarButtonItem = backItem } else { let titleItem = UIBarButtonItem(title: "在线视频", style: .done, target: nil, action: nil) titleItem.setTitleTextAttributes(UINavigationBar.appearance().titleTextAttributes, for: .normal) self.navigationItem.leftBarButtonItem = titleItem } collectionView.setCollectionViewLayout(layout, animated: false) navigationBarAlpha = 0 // let url = Bundle.main.url(forResource: "dating", withExtension: "webp") // // backgroundImageView.kf.setImage(with: url) collectionView.register(UINib(nibName: "DatingViewCell", bundle: nil), forCellWithReuseIdentifier: "DatingViewCell") view.backgroundColor = .white collectionView.backgroundColor = UIColor.clear loadSignal .subscribe(onNext: requestData) .disposed(by: rx.disposeBag) collectionView.mj_header = MJRefreshNormalHeader { [weak self] in self?.refreshData() } collectionView.mj_footer = MJRefreshAutoNormalFooter{ [weak self] in self?.loadMoreData() } refreshData() } @objc func back() { navigationController?.popViewController(animated: true) } func endRefreshing(noContent: Bool = false) { collectionView.reloadData() collectionView.mj_header?.endRefreshing() if noContent { collectionView.mj_footer?.endRefreshingWithNoMoreData() } else { collectionView.mj_footer?.endRefreshing() } } func refreshData() { loadSignal.onNext(refreshPageIndex) } func loadMoreData() { loadSignal.onNext(pageIndex) } func requestData(_ page: Int) { if dynamics.isEmpty { state = .refreshingContent } loadData(page) .verifyResponse() .subscribe(onSuccess: handlerReponse, onFailure: handlerError) .disposed(by: rx.disposeBag) } func loadData(_ page: Int) -> Single<Response<Pagination<Dynamic>>> { return videoDatingAPI.request(.videoList(page)) } func handlerReponse(_ response: Response<Pagination<Dynamic>>){ guard let page = response.data, let data = page.list else { return } if page.page == 1 { refreshData(data) } else { appendData(data) } state = dynamics.isEmpty ? .noContent : .contentLoaded if !data.isEmpty { pageIndex = page.page + 1 } endRefreshing(noContent: !page.hasNext) } func refreshData(_ data: [Dynamic]) { if !data.isEmpty { dynamics = data } } func appendData(_ data: [Dynamic]) { dynamics = dynamics + data } func handlerError(_ error: Error) { if dynamics.isEmpty { state = .error } endRefreshing() } } extension DatingViewController: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return self.dynamics.count } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(for: indexPath, cellType: DatingViewCell.self) cell.set(dynamics[indexPath.item]) return cell } func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { let vc = DatingDetailViewController() vc.dynamic = self.dynamics[indexPath.item] self.navigationController?.pushViewController(vc, animated: true) } } // MARK: UICollectionViewDelegateMagazineLayout extension DatingViewController: UICollectionViewDelegateMagazineLayout { var itemsPerRow: CGFloat { return 2 } var minimumInteritemSpacing: CGFloat { return 5 } var minimumLineSpacing: CGFloat { return 12 } var sectionInsets: UIEdgeInsets { return UIEdgeInsets(top: 10, left: 10, bottom: 0, right: 12) } func layoutCellCalculatedSize(forItemAt indexPath: IndexPath) -> CGSize { let cellWidth = widthForCellInCurrentLayout() return CGSize(width: cellWidth, height: cellWidth + 65) } func widthForCellInCurrentLayout() -> CGFloat { var cellWidth = collectionView.frame.size.width - (sectionInsets.left + sectionInsets.right) if itemsPerRow > 1 { cellWidth -= minimumInteritemSpacing * (itemsPerRow - 1) } return floor(cellWidth / itemsPerRow) } func collectionView( _ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeModeForItemAt indexPath: IndexPath) -> MagazineLayoutItemSizeMode { let size = layoutCellCalculatedSize(forItemAt: indexPath) return MagazineLayoutItemSizeMode(widthMode: .halfWidth, heightMode: .static(height: size.height)) } func collectionView( _ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, visibilityModeForHeaderInSectionAtIndex index: Int) -> MagazineLayoutHeaderVisibilityMode { return .hidden } func collectionView( _ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, visibilityModeForFooterInSectionAtIndex index: Int) -> MagazineLayoutFooterVisibilityMode { return .hidden } func collectionView( _ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, visibilityModeForBackgroundInSectionAtIndex index: Int) -> MagazineLayoutBackgroundVisibilityMode { return .hidden } func collectionView( _ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, horizontalSpacingForItemsInSectionAtIndex index: Int) -> CGFloat { return minimumInteritemSpacing } func collectionView( _ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, verticalSpacingForElementsInSectionAtIndex index: Int) -> CGFloat { return minimumLineSpacing } func collectionView( _ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetsForSectionAtIndex index: Int) -> UIEdgeInsets { return sectionInsets } func collectionView( _ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetsForItemsInSectionAtIndex index: Int) -> UIEdgeInsets { return .zero } func collectionView( _ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, finalLayoutAttributesForRemovedItemAt indexPath: IndexPath, byModifying finalLayoutAttributes: UICollectionViewLayoutAttributes) { // Fade and drop out finalLayoutAttributes.alpha = 0 finalLayoutAttributes.transform = .init(scaleX: 0.2, y: 0.2) } }
27.121495
139
0.657018
0bc0b1a713ee07a7da22300f41d7eef91e9cf3f3
1,621
py
Python
games/migrations/0004_auto_20150726_1430.py
rnelson/library
5f327c188f2847151dcfc92de0dc4f43f24096bf
[ "MIT" ]
null
null
null
games/migrations/0004_auto_20150726_1430.py
rnelson/library
5f327c188f2847151dcfc92de0dc4f43f24096bf
[ "MIT" ]
null
null
null
games/migrations/0004_auto_20150726_1430.py
rnelson/library
5f327c188f2847151dcfc92de0dc4f43f24096bf
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('games', '0003_auto_20150725_1737'), ] operations = [ migrations.AlterField( model_name='game', name='description', field=models.TextField(null=True), ), migrations.AlterField( model_name='game', name='max_players', field=models.IntegerField(null=True), ), migrations.AlterField( model_name='game', name='max_time', field=models.IntegerField(null=True), ), migrations.AlterField( model_name='game', name='min_players', field=models.IntegerField(null=True), ), migrations.AlterField( model_name='game', name='min_time', field=models.IntegerField(null=True), ), migrations.AlterField( model_name='game', name='name', field=models.CharField(max_length=255), ), migrations.AlterField( model_name='game', name='url', field=models.URLField(null=True), ), migrations.AlterField( model_name='publisher', name='country', field=models.CharField(max_length=2, null=True), ), migrations.AlterField( model_name='publisher', name='url', field=models.URLField(null=True), ), ]
27.016667
60
0.52992
b173f83e78cb014061d838f61889111715bd993d
385
sql
SQL
content-resources/src/main/resources/sql/upgrade/1.25/05-create-maplayer-metadata-table.sql
okauppinen/oskari-server
ddad60aef9f75bf549d2857149a45e68e0ce6e39
[ "MIT" ]
null
null
null
content-resources/src/main/resources/sql/upgrade/1.25/05-create-maplayer-metadata-table.sql
okauppinen/oskari-server
ddad60aef9f75bf549d2857149a45e68e0ce6e39
[ "MIT" ]
null
null
null
content-resources/src/main/resources/sql/upgrade/1.25/05-create-maplayer-metadata-table.sql
okauppinen/oskari-server
ddad60aef9f75bf549d2857149a45e68e0ce6e39
[ "MIT" ]
null
null
null
-- CSW metadata is now saved to a new table, old one can be dropped; CREATE TABLE oskari_maplayer_metadata ( id serial NOT NULL, metadataid character varying(256), wkt character varying(512) default '', json text default '', ts timestamp DEFAULT CURRENT_TIMESTAMP, CONSTRAINT oskari_maplayer_metadata_pkey PRIMARY KEY (id) ); DROP TABLE IF EXISTS portti_maplayer_metadata;
32.083333
68
0.779221
83d7248ede625009368ab1fdbd8d4c2557ca2e60
220
sql
SQL
forms6i/sql/tablas/tablas_sri.sql
allku/eSRI
8ba19794d96e76f0e7513ea7adccb5a60c6c3488
[ "BSD-2-Clause" ]
null
null
null
forms6i/sql/tablas/tablas_sri.sql
allku/eSRI
8ba19794d96e76f0e7513ea7adccb5a60c6c3488
[ "BSD-2-Clause" ]
null
null
null
forms6i/sql/tablas/tablas_sri.sql
allku/eSRI
8ba19794d96e76f0e7513ea7adccb5a60c6c3488
[ "BSD-2-Clause" ]
null
null
null
@SRI_INFORMANTE; @SRI_VENTA_ESTABLECIMIENTO; @SRI_DETALLE_RETENCION; @SRI_RETENCION; @SRI_FORMA_PAGO_VENTA; @SRI_FORMA_PAGO_COMPRA; @SRI_PAGO_EXTERIOR; @SRI_DETALLE_VENTA; @SRI_DETALLE_COMPRA; @ELE_DOCUMENTO_ELECTRONICO;
22
27
0.868182
c0b1051d7a6ad9631973085e889484296e26cd5e
2,883
swift
Swift
VoiceAnalyzer/src/UI/Views/AppView.swift
voice-analyzer/voice-analyzer-ios
4f45bca98991ee55d81d1353a0d2e30d26be18bb
[ "MIT" ]
2
2021-10-21T23:07:18.000Z
2022-02-24T00:43:17.000Z
VoiceAnalyzer/src/UI/Views/AppView.swift
voice-analyzer/voice-analyzer-ios
4f45bca98991ee55d81d1353a0d2e30d26be18bb
[ "MIT" ]
10
2021-10-15T06:33:24.000Z
2022-02-10T20:59:51.000Z
VoiceAnalyzer/src/UI/Views/AppView.swift
voice-analyzer/voice-analyzer-ios
4f45bca98991ee55d81d1353a0d2e30d26be18bb
[ "MIT" ]
null
null
null
import Foundation import SwiftUI struct AppView: View { @Environment(\.colorScheme) private var colorScheme: ColorScheme @Environment(\.env) var env: AppEnvironment @State private var livePitchChartIsPresented = true @State private var recordingsVisible = false @State private var recordingsEditMode: EditMode = .inactive @StateObject private var voiceRecorder = VoiceRecorderModel() @StateObject private var voiceRecording = VoiceRecordingModel() @StateObject private var analysis: PitchChartAnalysisFrames = PitchChartAnalysisFrames() @State private var tentativeAnalysisFrames: [AnalysisFrame] = [] var body: some View { NavigationView { HStack { NavigationLink(destination: livePitchChart, isActive: $livePitchChartIsPresented) { EmptyView() } // prevent recordings view flashing up on app start by hiding it before livePitchChart is presented (tested on iOS 14.5) if recordingsVisible { recordingsView .environment(\.editMode, $recordingsEditMode) } } } } var livePitchChart: some View { LivePitchChart( isPresented: $livePitchChartIsPresented, voiceRecorder: voiceRecorder, voiceRecording: voiceRecording, analysis: analysis ) .onAppear { recordingsVisible = true } } var recordingsView: some View { GeometryReader { geometry in VStack(spacing: 0) { RecordingsView() if recordingsEditMode != .active { ZStack(alignment: .top) { livePitchChartButtonBar } .padding(.bottom, geometry.safeAreaInsets.bottom) .background(Color(UIColor.secondarySystemBackground)) .clipShape(RoundedRectangle(cornerRadius: 10)) .transition(.move(edge: .bottom)) } } .ignoresSafeArea(.all, edges: .bottom) } } var livePitchChartButtonBar: some View { HStack { Spacer() livePitchChartButton Spacer() } .padding(.vertical, 20) } var livePitchChartButton: some View { Button { livePitchChartIsPresented = true } label: { ZStack { Circle() .stroke(lineWidth: 3) .frame(width: 56, height: 56) .foregroundColor(colorScheme == .light ? .secondary : .primary) Circle() .frame(width: 47, height: 47) .foregroundColor(.red) } } } }
33.137931
136
0.547
442e3ea369a9ae93114313c74014920627c7afa3
8,393
swift
Swift
ios/Runner/AppSyncAPI.swift
andrewlwest/tracer
8831ceec67bf849bd01c9ffd92ab6da52dbe4be2
[ "Apache-2.0" ]
null
null
null
ios/Runner/AppSyncAPI.swift
andrewlwest/tracer
8831ceec67bf849bd01c9ffd92ab6da52dbe4be2
[ "Apache-2.0" ]
null
null
null
ios/Runner/AppSyncAPI.swift
andrewlwest/tracer
8831ceec67bf849bd01c9ffd92ab6da52dbe4be2
[ "Apache-2.0" ]
null
null
null
// This file was automatically generated and should not be edited. import AWSAppSync public final class GetMessagesQuery: GraphQLQuery { public static let operationString = "query GetMessages {\n getMessages {\n __typename\n id\n content\n sender\n }\n}" public init() { } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Query"] public static let selections: [GraphQLSelection] = [ GraphQLField("getMessages", type: .list(.object(GetMessage.selections))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(getMessages: [GetMessage?]? = nil) { self.init(snapshot: ["__typename": "Query", "getMessages": getMessages.flatMap { $0.map { $0.flatMap { $0.snapshot } } }]) } public var getMessages: [GetMessage?]? { get { return (snapshot["getMessages"] as? [Snapshot?]).flatMap { $0.map { $0.flatMap { GetMessage(snapshot: $0) } } } } set { snapshot.updateValue(newValue.flatMap { $0.map { $0.flatMap { $0.snapshot } } }, forKey: "getMessages") } } public struct GetMessage: GraphQLSelectionSet { public static let possibleTypes = ["Message"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("content", type: .nonNull(.scalar(String.self))), GraphQLField("sender", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, content: String, sender: String) { self.init(snapshot: ["__typename": "Message", "id": id, "content": content, "sender": sender]) } public var __typename: String { get { return snapshot["__typename"]! as! String } set { snapshot.updateValue(newValue, forKey: "__typename") } } public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID } set { snapshot.updateValue(newValue, forKey: "id") } } public var content: String { get { return snapshot["content"]! as! String } set { snapshot.updateValue(newValue, forKey: "content") } } public var sender: String { get { return snapshot["sender"]! as! String } set { snapshot.updateValue(newValue, forKey: "sender") } } } } } public final class NewMessageMutation: GraphQLMutation { public static let operationString = "mutation NewMessage($content: String!, $sender: String!) {\n newMessage(content: $content, sender: $sender) {\n __typename\n id\n content\n sender\n }\n}" public var content: String public var sender: String public init(content: String, sender: String) { self.content = content self.sender = sender } public var variables: GraphQLMap? { return ["content": content, "sender": sender] } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Mutation"] public static let selections: [GraphQLSelection] = [ GraphQLField("newMessage", arguments: ["content": GraphQLVariable("content"), "sender": GraphQLVariable("sender")], type: .object(NewMessage.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(newMessage: NewMessage? = nil) { self.init(snapshot: ["__typename": "Mutation", "newMessage": newMessage.flatMap { $0.snapshot }]) } public var newMessage: NewMessage? { get { return (snapshot["newMessage"] as? Snapshot).flatMap { NewMessage(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "newMessage") } } public struct NewMessage: GraphQLSelectionSet { public static let possibleTypes = ["Message"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("content", type: .nonNull(.scalar(String.self))), GraphQLField("sender", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, content: String, sender: String) { self.init(snapshot: ["__typename": "Message", "id": id, "content": content, "sender": sender]) } public var __typename: String { get { return snapshot["__typename"]! as! String } set { snapshot.updateValue(newValue, forKey: "__typename") } } public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID } set { snapshot.updateValue(newValue, forKey: "id") } } public var content: String { get { return snapshot["content"]! as! String } set { snapshot.updateValue(newValue, forKey: "content") } } public var sender: String { get { return snapshot["sender"]! as! String } set { snapshot.updateValue(newValue, forKey: "sender") } } } } } public final class SubscribeToNewMessageSubscription: GraphQLSubscription { public static let operationString = "subscription SubscribeToNewMessage {\n subscribeToNewMessage {\n __typename\n id\n content\n sender\n }\n}" public init() { } public struct Data: GraphQLSelectionSet { public static let possibleTypes = ["Subscription"] public static let selections: [GraphQLSelection] = [ GraphQLField("subscribeToNewMessage", type: .object(SubscribeToNewMessage.selections)), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(subscribeToNewMessage: SubscribeToNewMessage? = nil) { self.init(snapshot: ["__typename": "Subscription", "subscribeToNewMessage": subscribeToNewMessage.flatMap { $0.snapshot }]) } public var subscribeToNewMessage: SubscribeToNewMessage? { get { return (snapshot["subscribeToNewMessage"] as? Snapshot).flatMap { SubscribeToNewMessage(snapshot: $0) } } set { snapshot.updateValue(newValue?.snapshot, forKey: "subscribeToNewMessage") } } public struct SubscribeToNewMessage: GraphQLSelectionSet { public static let possibleTypes = ["Message"] public static let selections: [GraphQLSelection] = [ GraphQLField("__typename", type: .nonNull(.scalar(String.self))), GraphQLField("id", type: .nonNull(.scalar(GraphQLID.self))), GraphQLField("content", type: .nonNull(.scalar(String.self))), GraphQLField("sender", type: .nonNull(.scalar(String.self))), ] public var snapshot: Snapshot public init(snapshot: Snapshot) { self.snapshot = snapshot } public init(id: GraphQLID, content: String, sender: String) { self.init(snapshot: ["__typename": "Message", "id": id, "content": content, "sender": sender]) } public var __typename: String { get { return snapshot["__typename"]! as! String } set { snapshot.updateValue(newValue, forKey: "__typename") } } public var id: GraphQLID { get { return snapshot["id"]! as! GraphQLID } set { snapshot.updateValue(newValue, forKey: "id") } } public var content: String { get { return snapshot["content"]! as! String } set { snapshot.updateValue(newValue, forKey: "content") } } public var sender: String { get { return snapshot["sender"]! as! String } set { snapshot.updateValue(newValue, forKey: "sender") } } } } }
29.142361
173
0.604313
a010559d98f2f6159ae306123f79a3b831345d3c
16,471
swift
Swift
SHRichTextEditorTools/Source/Core/ToolBarItem/ToolBarButtonExtensions.swift
hsusmita/SHRichTextEditorTools
e836969ad532fe74e71bd2f2b1c14f6d43fe8a0b
[ "MIT" ]
3
2019-04-03T11:21:22.000Z
2020-01-27T20:58:42.000Z
SHRichTextEditorTools/Source/Core/ToolBarItem/ToolBarButtonExtensions.swift
mohsinalimat/SHRichTextEditorTools
e836969ad532fe74e71bd2f2b1c14f6d43fe8a0b
[ "MIT" ]
1
2021-01-25T06:31:40.000Z
2021-01-25T06:31:40.000Z
SHRichTextEditorTools/Source/Core/ToolBarItem/ToolBarButtonExtensions.swift
mohsinalimat/SHRichTextEditorTools
e836969ad532fe74e71bd2f2b1c14f6d43fe8a0b
[ "MIT" ]
3
2019-04-03T11:21:22.000Z
2020-06-28T11:28:03.000Z
// // TToolBarButtonExtensions.swift // SHRichTextEditorTools // // Created by Susmita Horrow on 27/09/18. // Copyright © 2018 hsusmita. All rights reserved. // import UIKit public extension ToolBarButton { static func configureBoldToolBarButton( type: ToolBarButton.ButtonType, actionOnSelection: @escaping ((ToolBarButton, Bool) -> Void), textView: UITextView, textViewDelegate: TextViewDelegate, shouldHideOnNoSelection: Bool) -> ToolBarButton { let toolBarButton = ToolBarButton( type: type, actionOnTap: { item in textView.toggleBoldface(textView) textViewDelegate.textViewDidApplyTextFormatting(textView) }, actionOnSelection: actionOnSelection ) textViewDelegate.registerDidChangeSelection { textView in if (textView.selectedRange.length > 0) { toolBarButton.isSelected = textView.isCharacterBold(for: textView.currentCursorPosition ?? textView.selectedRange.location) toolBarButton.barButtonItem.isEnabled = true } else if (shouldHideOnNoSelection) { toolBarButton.barButtonItem.tintColor = UIColor.clear toolBarButton.barButtonItem.isEnabled = textView.selectedRange.length > 0 } } textViewDelegate.registerShouldChangeText { (textView, range, text) -> (Bool) in if text == "\n" { if let index = textView.currentCursorPosition, index - 1 >= 0, textView.isCharacterBold(for: index - 1) { textView.toggleBoldface(textView) textViewDelegate.textViewDidApplyTextFormatting(textView) toolBarButton.isSelected = false } } return true } if (!shouldHideOnNoSelection) { textViewDelegate.registerDidChangeText { textView in guard let index = textView.currentCursorPosition, index - 1 > 0 else { return } toolBarButton.isSelected = textView.isCharacterBold(for: index - 1) || textView.isCharacterBold(for: index) } textViewDelegate.registerDidTapChange { textView in guard let index = textView.currentCursorPosition, index - 1 > 0 else { return } toolBarButton.isSelected = textView.isCharacterBold(for: index - 1) || textView.isCharacterBold(for: index) } } else { toolBarButton.barButtonItem.tintColor = UIColor.clear toolBarButton.barButtonItem.isEnabled = textView.selectedRange.length > 0 } return toolBarButton } static func configureItalicToolBarButton( type: ToolBarButton.ButtonType, actionOnSelection: @escaping ((ToolBarButton, Bool) -> Void), textView: UITextView, textViewDelegate: TextViewDelegate, shouldHideOnNoSelection: Bool) -> ToolBarButton { let toolBarButton = ToolBarButton( type: type, actionOnTap: { item in textView.toggleItalics(textView) textViewDelegate.textViewDidApplyTextFormatting(textView) }, actionOnSelection: actionOnSelection ) textViewDelegate.registerDidChangeSelection { textView in if (textView.selectedRange.length > 0) { toolBarButton.isSelected = textView.isCharacterItalic(for: textView.currentCursorPosition ?? textView.selectedRange.location) toolBarButton.barButtonItem.isEnabled = true } else if (shouldHideOnNoSelection) { toolBarButton.barButtonItem.tintColor = UIColor.clear toolBarButton.barButtonItem.isEnabled = textView.selectedRange.length > 0 } } textViewDelegate.registerShouldChangeText { (textView, range, text) -> (Bool) in if text == "\n" { if let index = textView.currentCursorPosition, index - 1 >= 0, textView.isCharacterItalic(for: index - 1) { textView.toggleItalics(textView) textViewDelegate.textViewDidApplyTextFormatting(textView) toolBarButton.isSelected = false } } return true } if (!shouldHideOnNoSelection) { textViewDelegate.registerDidChangeText { textView in guard let index = textView.currentCursorPosition, index - 1 > 0 else { return } toolBarButton.isSelected = textView.isCharacterItalic(for: index - 1) || textView.isCharacterItalic(for: index) } textViewDelegate.registerDidTapChange { textView in guard let index = textView.currentCursorPosition, index - 1 > 0 else { return } toolBarButton.isSelected = textView.isCharacterItalic(for: index - 1) || textView.isCharacterItalic(for: index) } } else { toolBarButton.barButtonItem.tintColor = UIColor.clear toolBarButton.barButtonItem.isEnabled = textView.selectedRange.length > 0 } return toolBarButton } static func configureWordCountToolBarButton( countTextColor: UIColor, textView: UITextView, textViewDelegate: TextViewDelegate) -> ToolBarButton { let toolBarButton = ToolBarButton( type: ToolBarButton.ButtonType.attributed(title: String(textView.attributedText.length), attributes: [UIControl.State.disabled.rawValue: [NSAttributedString.Key.foregroundColor: countTextColor]]), actionOnTap: { _ in }, actionOnSelection: { _,_ in } ) toolBarButton.barButtonItem.tintColor = countTextColor toolBarButton.barButtonItem.isEnabled = false toolBarButton.barButtonItem.title = String(textView.attributedText.length) textViewDelegate.registerDidChangeText { (textView) in toolBarButton.barButtonItem.title = String(textView.attributedText.length) } return toolBarButton } static func configureRemainingCharacterCountToolBarButton(maximumCharacterCount: Int, textAttributes: [NSAttributedString.Key: Any], textView: UITextView, textViewDelegate: TextViewDelegate) -> ToolBarButton { let toolBarButton = ToolBarButton( type: ToolBarButton.ButtonType.attributed( title: String(textView.attributedText.length), attributes: [UIControl.State.disabled.rawValue: textAttributes]), actionOnTap: { _ in }, actionOnSelection: { _,_ in } ) toolBarButton.barButtonItem.setTitleTextAttributes(textAttributes, for: .normal) toolBarButton.barButtonItem.isEnabled = false toolBarButton.barButtonItem.title = String(max(0, maximumCharacterCount - textView.attributedText.length)) textViewDelegate.registerDidChangeText { (textView) in let count = max(0, maximumCharacterCount - textView.attributedText.length) toolBarButton.barButtonItem.title = String(count) } textViewDelegate.registerShouldChangeText { (textView, range, text) -> (Bool) in return textView.text.count + (text.count - range.length) <= maximumCharacterCount } return toolBarButton } static func configureLinkToolBarButton( type: ToolBarButton.ButtonType, actionOnSelection: @escaping ((ToolBarButton, Bool) -> Void), linkInputHandler: LinkInputHandler, linkTapHandler: @escaping ((URL) -> ()), textView: UITextView, textViewDelegate: TextViewDelegate, shouldHideOnNoSelection: Bool) -> ToolBarButton { let actionOnTap: (ToolBarButton) -> Void = { item in if textView.selectedRange.location == NSNotFound || textView.selectedRange.length == 0 { return } let range = textView.selectedRange linkInputHandler.showLinkInputView { url in if let url = url { if UIApplication.shared.canOpenURL(url) { textView.addLink(link: url, for: range, linkAttributes: linkInputHandler.linkAttributes) if let startPosition = textView.position(from: textView.beginningOfDocument, offset: range.location), let endPosition = textView.position(from: textView.beginningOfDocument, offset: range.location + range.length) { textView.selectedTextRange = textView.textRange(from: startPosition, to: endPosition) } textViewDelegate.textViewDidApplyTextFormatting(textView) } } } } let toolBarButton = ToolBarButton(type: type, actionOnTap: actionOnTap, actionOnSelection: actionOnSelection) let currentTypingAttributes = textView.typingAttributes textViewDelegate.registerShouldChangeText { (textView, range, text) -> (Bool) in guard (range.location - 1) >= 0 else { return true } if (text == " " || text == "\n") && textView.attributedText.linkPresent(at: range.location - 1) { let attributedString = NSMutableAttributedString(string: text, attributes: currentTypingAttributes) textView.textStorage.insert(attributedString, at: range.location) let cursor = NSRange(location: textView.selectedRange.location + 1, length: 0) textView.selectedRange = cursor return false } return true } textViewDelegate.registerShouldInteractURL { (textView, url, range, _) -> Bool in linkTapHandler(url) return false } if (shouldHideOnNoSelection) { textViewDelegate.registerDidChangeSelection { textView in toolBarButton.barButtonItem.isEnabled = textView.selectedRange.length > 0 toolBarButton.barButtonItem.tintColor = textView.selectedRange.length > 0 ? textView.tintColor : UIColor.clear } toolBarButton.barButtonItem.tintColor = textView.selectedRange.length > 0 ? textView.tintColor : UIColor.clear toolBarButton.barButtonItem.isEnabled = textView.selectedRange.length > 0 } return toolBarButton } static func configureImageToolBarButton( type: ToolBarButton.ButtonType, actionOnSelection: @escaping ((ToolBarButton, Bool) -> Void), imageAttachmentBounds: CGRect, imageInputHandler: ImageInputHandler, textView: UITextView, textViewDelegate: TextViewDelegate) -> ToolBarButton { let actionOnTap: (ToolBarButton) -> Void = { item in imageInputHandler.showImageInputView(completion: { image in if let image = image, let index = textView.currentCursorPosition { textView.insertImage(image: image, at: index, attachmentBounds: imageAttachmentBounds) textViewDelegate.textViewDidInsertImage(textView, index: index, image: image) } }) } let toolBarButton = ToolBarButton(type: type, actionOnTap: actionOnTap, actionOnSelection: actionOnSelection) let updateState: (UITextView) -> () = { (textView) in guard let index = textView.currentTappedIndex else { return } if textView.attributedText.imagePresent(at: index) { if let selectionView = imageInputHandler.imageSelectionView { textView.selectImage(at: index, selectionView: selectionView) } toolBarButton.isSelected = true } else { if let selectionView = imageInputHandler.imageSelectionView { textView.deselectImage(at: index, selectionView: selectionView) } toolBarButton.isSelected = false } } textViewDelegate.registerDidChangeText(with: updateState) textViewDelegate.registerDidTapChange(with: updateState) return toolBarButton } static func configureToggleTextAndImageInputToolBarButton( textInputIcon: UIImage, imageInputIcon: UIImage, tintColor: UIColor, imageAttachmentBounds: CGRect, imageInputHandler: ImageInputHandler, textView: UITextView, textViewDelegate: TextViewDelegate) -> ToolBarButton { let actionOnTap: (ToolBarButton) -> Void = { item in if textView.inputView != nil { textView.inputView = nil textView.reloadInputViews() item.barButtonItem.image = imageInputIcon } else { imageInputHandler.showImageInputView(completion: { image in if let image = image, let index = textView.currentCursorPosition { textView.insertImage(image: image, at: index, attachmentBounds: imageAttachmentBounds) textViewDelegate.textViewDidInsertImage(textView, index: index, image: image) } }) item.barButtonItem.image = textInputIcon } } let toolBarButton = ToolBarButton(type: ToolBarButton.ButtonType.image(image: imageInputIcon), actionOnTap: actionOnTap, actionOnSelection: { _, _ in }) toolBarButton.barButtonItem.tintColor = tintColor let updateState: (UITextView) -> () = { (textView) in guard let index = textView.currentTappedIndex else { return } if textView.attributedText.imagePresent(at: index) { if let selectionView = imageInputHandler.imageSelectionView { textView.selectImage(at: index, selectionView: selectionView) } } else { if let selectionView = imageInputHandler.imageSelectionView { textView.deselectImage(at: index, selectionView: selectionView) } } } textViewDelegate.registerDidChangeText(with: { (textView) in if let selectionView = imageInputHandler.imageSelectionView { textView.clearImageSelection(selectionView: selectionView) } }) textViewDelegate.registerDidBeginEditing(with: { (textView) in if textView.inputView != nil { textView.inputView = nil textView.reloadInputViews() toolBarButton.barButtonItem.image = imageInputIcon } }) textViewDelegate.registerDidTapChange(with: updateState) return toolBarButton } static func configureIndentationToolBarButton( type: ToolBarButton.ButtonType, actionOnSelection: @escaping ((ToolBarButton, Bool) -> Void), textView: UITextView, textViewDelegate: TextViewDelegate) -> ToolBarButton { let toolBarButton = ToolBarButton( type: type, actionOnTap: { _ in textView.toggleIndentation() }, actionOnSelection: actionOnSelection ) let updateState: (UITextView) -> () = { (textView) in guard let index = textView.currentTappedIndex else { return } toolBarButton.isSelected = textView.indentationPresent(at: index) } textViewDelegate.registerShouldChangeText { (textView, range, replacementText) -> (Bool) in guard replacementText == "\n" && range.location >= 0 && textView.indentationPresent(at: range.location - 1) else { return true } textView.addIndentation(at: range.location) return false } textViewDelegate.registerDidTapChange(with: updateState) return toolBarButton } }
48.160819
208
0.611803
04f9eef34bdebbdd4803ef0c6b184440734800a5
91
kt
Kotlin
compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantCallOfConversionMethod/long.kt
jiqimaogou/kotlin
ab6607f5304373223dc519b8beff4e8c7aaf6260
[ "ECL-2.0", "Apache-2.0" ]
45,293
2015-01-01T06:23:46.000Z
2022-03-31T21:55:51.000Z
compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantCallOfConversionMethod/long.kt
Seantheprogrammer93/kotlin
f7aabf03f89bdd39d9847572cf9e0051ea42c247
[ "ECL-2.0", "Apache-2.0" ]
3,386
2015-01-12T13:28:50.000Z
2022-03-31T17:48:15.000Z
compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantCallOfConversionMethod/long.kt
Seantheprogrammer93/kotlin
f7aabf03f89bdd39d9847572cf9e0051ea42c247
[ "ECL-2.0", "Apache-2.0" ]
6,351
2015-01-03T12:30:09.000Z
2022-03-31T20:46:54.000Z
// WITH_RUNTIME val foo = Long.MAX_VALUE.<!REDUNDANT_CALL_OF_CONVERSION_METHOD!>toLong()<!>
45.5
75
0.791209
72ed26b9165747497a64d5015e81acba0721b47e
10,617
html
HTML
demo-docs/flockerwrapper.html
edgaryau/Sifteo-SDK.NET
6abf260a510b0dcc55dcd7e3a08374667f6a34f1
[ "Info-ZIP", "OpenSSL" ]
null
null
null
demo-docs/flockerwrapper.html
edgaryau/Sifteo-SDK.NET
6abf260a510b0dcc55dcd7e3a08374667f6a34f1
[ "Info-ZIP", "OpenSSL" ]
null
null
null
demo-docs/flockerwrapper.html
edgaryau/Sifteo-SDK.NET
6abf260a510b0dcc55dcd7e3a08374667f6a34f1
[ "Info-ZIP", "OpenSSL" ]
1
2021-05-29T07:28:01.000Z
2021-05-29T07:28:01.000Z
<!DOCTYPE html /> <html> <head> <title>FlockerWrapper.cs</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <link href="nocco.css" rel="stylesheet" media="all" type="text/css" /> <script src="prettify.js" type="text/javascript"></script> </head> <body onload="prettyPrint()"> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="./index.html"> index.cs </a> <a class="source" href="./hellosifteoapp.html"> HelloSifteoApp.cs </a> <a class="source" href="./slideshowapp.html"> SlideShowApp.cs </a> <a class="source" href="./sorterapp.html"> SorterApp.cs </a> <a class="source" href="./flockerapp.html"> FlockerApp.cs </a> <a class="source" href="./flockerwrapper.html"> FlockerWrapper.cs </a> <a class="source" href="./flockershape.html"> FlockerShape.cs </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1>FlockerWrapper.cs</h1> </th> <th class="code"></th> </tr> </thead> <tbody> <tr id="section_1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_1">&#182;</a> </div> <p>This class is part of the Flocker demo app. See <a href="flockerapp.html">FlockerApp.cs</a>.</p> </td> <td class="code"> <pre><code class='prettyprint'> </code></pre> </td> </tr> <tr id="section_2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_2">&#182;</a> </div> <hr /> </td> <td class="code"> <pre><code class='prettyprint'> using System; using System.Collections.Generic; using Sifteo; using Sifteo.MathExt; namespace Flocker { </code></pre> </td> </tr> <tr id="section_3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_3">&#182;</a> </div> <p>The FlockerWrapper class encapsulates the simulation of a collection of FlockerShape class game objects for a Cube.</p> </td> <td class="code"> <pre><code class='prettyprint'> class FlockerWrapper { </code></pre> </td> </tr> <tr id="section_4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_4">&#182;</a> </div> <p>These are constants that tune the behavior of the game. Try changing some values.</p> </td> <td class="code"> <pre><code class='prettyprint'> internal const int NumStartingShapes = 4; internal const float RadiusMinShape = 3f; internal const float RadiusMaxShape = 5f; internal const float RadiusMinUnscaledShape = 0.65f; internal const float RadiusMaxUnscaledShape = 1.35f; internal const float VelocityMax = 60f; internal const float AccelSeparate = 48f; internal const float AccelCohere = 24f; internal const float AccelAlign = 1.4f; internal const float AccelTilt = 90f; internal const float AccelBounce = -1.5f; internal const float AccelCenter = 360f; internal const float DistanceMaxFlockAttract = 48f; internal const float DistanceMaxFlockSeparate = 12f; internal static readonly Color BackgroundColor = new Color(36, 182, 255); internal static readonly Color BorderColor = new Color(255, 145, 0); internal static readonly Color ShapeColor = new Color(255, 255, 255); private List&lt;FlockerShape&gt; mShapes = new List&lt;FlockerShape&gt;(); internal Cube mCube { get; private set; } </code></pre> </td> </tr> <tr id="section_5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_5">&#182;</a> </div> <p>Here we initialize the wrapper by associating it with a cube and seeding it with some shapes.</p> </td> <td class="code"> <pre><code class='prettyprint'> internal FlockerWrapper(Cube cube) { this.mCube = cube; for (int i = 0; i &lt; FlockerWrapper.NumStartingShapes; ++i) { AddShape(new FlockerShape(this)); } } internal void OnLostCube() { mShapes.Clear(); } internal void AddShape(FlockerShape s) { s.TransferToCube(this.mCube); mShapes.Add(s); } </code></pre> </td> </tr> <tr id="section_6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_6">&#182;</a> </div> <p>Here we simulate each game object for the time that has passed.</p> </td> <td class="code"> <pre><code class='prettyprint'> internal void Tick(float dt) { foreach (FlockerShape s in mShapes) { s.Tick(dt, mShapes); } </code></pre> </td> </tr> <tr id="section_7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_7">&#182;</a> </div> <p>Transfer shapes from one cube to another, if they are on the border. See FlockerShape for details about Cube.Neighbors.</p> </td> <td class="code"> <pre><code class='prettyprint'> List&lt;FlockerShape&gt; toRemove = new List&lt;FlockerShape&gt;(); foreach (FlockerShape s in mShapes) { List&lt;Cube.Side&gt; boundarySides = CalcBoundarySides(s.Position, s.Radius); foreach (Cube.Side side in boundarySides) { Cube neighbor = this.mCube.Neighbors[side]; if (neighbor != null &amp;&amp; neighbor.userData != null) { FlockerWrapper fw = (FlockerWrapper)neighbor.userData; fw.AddShape(s); </code></pre> </td> </tr> <tr id="section_8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_8">&#182;</a> </div> <p>It's usually a bad idea to remove items from a collection while iterating over it, so let's wait until this loop is done.</p> </td> <td class="code"> <pre><code class='prettyprint'> toRemove.Add(s); </code></pre> </td> </tr> <tr id="section_9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_9">&#182;</a> </div> <p>We only need to remove the shape once, so break out of the inner loop when removing a shape.</p> </td> <td class="code"> <pre><code class='prettyprint'> break; } } } foreach (FlockerShape s in toRemove) { mShapes.Remove(s); } } </code></pre> </td> </tr> <tr id="section_10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_10">&#182;</a> </div> <p>Here we paint this wrapper's shapes to the cube.</p> </td> <td class="code"> <pre><code class='prettyprint'> internal void Paint() { this.mCube.FillScreen(BackgroundColor); </code></pre> </td> </tr> <tr id="section_11"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_11">&#182;</a> </div> <p>Paint borders when a cube is neighbored to this one.</p> </td> <td class="code"> <pre><code class='prettyprint'> for (Cube.Side side = Cube.Side.TOP; side &lt;= Cube.Side.RIGHT; ++side) { Cube neighbor = this.mCube.Neighbors[side]; if (neighbor != null &amp;&amp; neighbor.userData != null) { const int BorderSize = 4; switch (side) { case Cube.Side.TOP: this.mCube.FillRect(BorderColor, 0, 0, Cube.SCREEN_WIDTH, BorderSize); break; case Cube.Side.LEFT: this.mCube.FillRect(BorderColor, 0, 0, BorderSize, Cube.SCREEN_HEIGHT); break; case Cube.Side.BOTTOM: this.mCube.FillRect(BorderColor, 0, Cube.SCREEN_HEIGHT - BorderSize, Cube.SCREEN_WIDTH, BorderSize); break; case Cube.Side.RIGHT: this.mCube.FillRect(BorderColor, Cube.SCREEN_WIDTH - BorderSize, 0, BorderSize, Cube.SCREEN_HEIGHT); break; } } } </code></pre> </td> </tr> <tr id="section_12"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_12">&#182;</a> </div> <p>Paint each shape.</p> </td> <td class="code"> <pre><code class='prettyprint'> foreach (FlockerShape s in mShapes) { s.Paint(this.mCube); } this.mCube.Paint(); } </code></pre> </td> </tr> <tr id="section_13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_13">&#182;</a> </div> <p>This method returns a list of the Cube.Sides that the argument circle is on the wrong side of, and thus is considered "out of bounds."</p> </td> <td class="code"> <pre><code class='prettyprint'> static internal List&lt;Cube.Side&gt; CalcBoundarySides(Float2 center, float radius) { List&lt;Cube.Side&gt; sides = new List&lt;Cube.Side&gt;(); if (Mathf.Round(center.x - radius) &lt; 0f) { sides.Add(Cube.Side.LEFT); } else if (Mathf.Round(center.x + radius) &gt; Cube.SCREEN_MAX_X) { sides.Add(Cube.Side.RIGHT); } if (Mathf.Round(center.y - radius) &lt; 0f) { sides.Add(Cube.Side.TOP); } else if (Mathf.Round(center.y + radius) &gt; Cube.SCREEN_MAX_Y) { sides.Add(Cube.Side.BOTTOM); } return sides; } } } </code></pre> </td> </tr> <tr id="section_14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section_14">&#182;</a> </div> <hr /> <p>FlockerWrapper.cs</p> <p>Copyright &copy; 2011 Sifteo Inc.</p> <p>This program is "Sample Code" as defined in the Sifteo Software Development Kit License Agreement. By adapting or linking to this program, you agree to the terms of the License Agreement.</p> <p>If this program was distributed without the full License Agreement, a copy can be obtained by contacting support@sifteo.com.</p> </td> <td class="code"> <pre><code class='prettyprint'> </code></pre> </td> </tr> </tbody> </table> </div> </body> </html>
28.772358
128
0.570218
b387caf9ca05d6dc445c9348ce9334541e3fcb8e
1,625
swift
Swift
UnstoppableWallet/UnstoppableWallet/Modules/Settings/BaseCurrency/BaseCurrencySettingsService.swift
shieldwallets/unstoppable-wallet-ios
56dbf872f132c3ab76aa3c73869e4a75e3c804f4
[ "MIT" ]
272
2019-05-13T10:35:34.000Z
2022-03-27T12:00:50.000Z
UnstoppableWallet/UnstoppableWallet/Modules/Settings/BaseCurrency/BaseCurrencySettingsService.swift
shieldwallets/unstoppable-wallet-ios
56dbf872f132c3ab76aa3c73869e4a75e3c804f4
[ "MIT" ]
1,286
2019-05-13T05:57:32.000Z
2022-03-31T14:42:27.000Z
UnstoppableWallet/UnstoppableWallet/Modules/Settings/BaseCurrency/BaseCurrencySettingsService.swift
shieldwallets/unstoppable-wallet-ios
56dbf872f132c3ab76aa3c73869e4a75e3c804f4
[ "MIT" ]
115
2019-05-14T09:59:31.000Z
2022-03-11T10:40:12.000Z
import RxSwift import RxRelay import CurrencyKit class BaseCurrencySettingsService { private static let popularCurrencyCodes = ["USD", "EUR", "GBP", "JPY"] private static let cryptoCurrencyCodes = ["BTC", "ETH", "BNB"] private let currencyKit: CurrencyKit.Kit let popularCurrencies: [Currency] let cryptoCurrencies: [Currency] let otherCurrencies: [Currency] init(currencyKit: CurrencyKit.Kit) { self.currencyKit = currencyKit var popularCurrencies = [Currency]() let cryptoCurrencies = [Currency]() var currencies = currencyKit.currencies for code in BaseCurrencySettingsService.popularCurrencyCodes { if let index = currencies.firstIndex(where: { $0.code == code }) { popularCurrencies.append(currencies.remove(at: index)) } } for code in BaseCurrencySettingsService.cryptoCurrencyCodes { if let index = currencies.firstIndex(where: { $0.code == code }) { // cryptoCurrencies.append(currencies.remove(at: index)) _ = currencies.remove(at: index) } } self.popularCurrencies = popularCurrencies self.cryptoCurrencies = cryptoCurrencies otherCurrencies = currencies } } extension BaseCurrencySettingsService { var baseCurrency: Currency { currencyKit.baseCurrency } func setBaseCurrency(code: String) { guard let currency = currencyKit.currencies.first(where: { $0.code == code }) else { return } currencyKit.baseCurrency = currency } }
28.508772
92
0.644923
2761048b2496ad39c396ec36a5de46879dd305e2
431
css
CSS
src/main/webapp/resources/mobile/shop/css/consultation.css
yangge0301/jfinalshop-b2b2c
869483d9fd549e090a7f2d976e0b4de45f52be2a
[ "Apache-2.0" ]
3
2019-09-07T12:22:58.000Z
2020-02-25T10:17:03.000Z
src/main/webapp/resources/mobile/shop/css/consultation.css
yangge0301/jfinalshop-b2b2c
869483d9fd549e090a7f2d976e0b4de45f52be2a
[ "Apache-2.0" ]
null
null
null
src/main/webapp/resources/mobile/shop/css/consultation.css
yangge0301/jfinalshop-b2b2c
869483d9fd549e090a7f2d976e0b4de45f52be2a
[ "Apache-2.0" ]
5
2019-03-21T07:08:11.000Z
2020-10-08T02:36:39.000Z
@charset "utf-8"; /* ---------- AddConsultation ---------- */ .add-consultation main { padding: 50px 10px 0px 10px; } .add-consultation main .media { line-height: 30px; margin-bottom: 20px; } .add-consultation main .media .media-left a img { width: 80px; height: 80px; padding: 2px; border: solid 1px #e8e8e8; white-space: nowrap; overflow: hidden; } .add-consultation main .media .media-body span { display: block; }
17.958333
49
0.663573
c3f4a20564a64523bd56ec87e1d9a0f34e0add84
3,387
rs
Rust
src/lib.rs
AudioSceneDescriptionFormat/asdfspline-rust
0cc46f9fc2979c8bd924f2de15dc4a24fe080a1a
[ "Apache-2.0", "MIT-0", "MIT" ]
2
2020-04-01T16:16:18.000Z
2020-12-17T00:00:59.000Z
src/lib.rs
AudioSceneDescriptionFormat/asdfspline-rust
0cc46f9fc2979c8bd924f2de15dc4a24fe080a1a
[ "Apache-2.0", "MIT-0", "MIT" ]
2
2020-03-28T10:38:41.000Z
2020-04-01T16:16:20.000Z
src/lib.rs
AudioSceneDescriptionFormat/asdfspline-rust
0cc46f9fc2979c8bd924f2de15dc4a24fe080a1a
[ "Apache-2.0", "MIT-0", "MIT" ]
2
2019-10-07T19:32:17.000Z
2020-12-17T00:01:00.000Z
/*! Rust implementation of the spline type that's used in the Audio Scene Description Format (ASDF), see <https://AudioSceneDescriptionFormat.readthedocs.io/>. # Requirements * Rust compiler, Cargo (<https://rustup.rs/>) The required Rust packages (a.k.a. "crates") are listed in the file `Cargo.toml`. # Tests ```text cargo test --workspace ``` There are further tests (using Python) in the `python/` directory. # API Documentation Run `cargo doc --workspace` in the main directory to create the documentation. The generated HTML documentation can be accessed via [target/doc/asdfspline/index.html](index.html) and [target/doc/asdfspline_ffi/index.html](../asdfspline_ffi/index.html). # Updating `README.md` Using [cargo-readme](https://github.com/livioribeiro/cargo-readme) (`cargo install cargo-readme`): ```text cargo readme -o README.md ``` */ #![deny(unsafe_code)] // NB: A lot of unsafe code is in the "ffi" sub-crate #![warn(rust_2018_idioms)] use std::ops::{Add, Div, DivAssign, Mul, Sub}; use superslice::Ext; // for slice::upper_bound_by() pub mod adapters; pub mod asdfposspline; pub mod asdfrotspline; pub mod centripetalkochanekbartelsspline; pub mod cubichermitespline; pub mod monotonecubicspline; pub mod piecewisecubiccurve; pub mod quaternion; pub mod shapepreservingcubicspline; pub mod utilities; pub use crate::asdfposspline::AsdfPosSpline; pub use crate::asdfrotspline::AsdfRotSpline; pub use crate::monotonecubicspline::MonotoneCubicSpline; pub use crate::piecewisecubiccurve::PiecewiseCubicCurve; use crate::utilities::gauss_legendre13; /// A trait that is automatically implemented for all types that can be used as positions, /// polynomial coefficients, tangent vectors etc. pub trait Vector where Self: Copy, Self: Add<Output = Self> + Sub<Output = Self>, Self: Mul<f32, Output = Self> + Div<f32, Output = Self>, Self: DivAssign<f32>, { } impl<T> Vector for T where Self: Copy, Self: Add<Output = Self> + Sub<Output = Self>, Self: Mul<f32, Output = Self> + Div<f32, Output = Self>, Self: DivAssign<f32>, { } pub trait Spline<Value> { fn evaluate(&self, t: f32) -> Value; fn grid(&self) -> &[f32]; /// There must be at least two grid values! /// This doesn't work if there are NaNs fn clamp_parameter_and_find_index(&self, t: f32) -> (f32, usize) { let first = *self.grid().first().unwrap(); let last = *self.grid().last().unwrap(); if t < first { (first, 0) } else if t < last { ( t, // NB: This doesn't work if a value is NaN self.grid().upper_bound_by(|x| x.partial_cmp(&t).unwrap()) - 1, ) } else { (last, self.grid().len() - 2) } } } /// To work around Rust's orphan rules, see https://blog.mgattozzi.dev/orphan-rules/ pub trait NormWrapper<U> { fn norm(&self) -> f32; } pub trait SplineWithVelocity<Value, Velocity>: Spline<Value> where Velocity: Vector, { fn evaluate_velocity(&self, t: f32) -> Velocity; fn integrated_speed<U>(&self, index: usize, a: f32, b: f32) -> f32 where Velocity: NormWrapper<U>, { assert!(a <= b); assert!(self.grid()[index] <= a); assert!(b <= self.grid()[index + 1]); gauss_legendre13(|t| self.evaluate_velocity(t).norm(), a, b) } }
26.880952
98
0.659581
dd8d55c81a8cb0137df945ffe8a4011bd72cb3db
3,362
php
PHP
src/ObservationBundle/Entity/Message.php
flosteve/Ornithologie
c5102f754c0965844ca1bbf886705b9b6fdfca74
[ "MIT" ]
null
null
null
src/ObservationBundle/Entity/Message.php
flosteve/Ornithologie
c5102f754c0965844ca1bbf886705b9b6fdfca74
[ "MIT" ]
null
null
null
src/ObservationBundle/Entity/Message.php
flosteve/Ornithologie
c5102f754c0965844ca1bbf886705b9b6fdfca74
[ "MIT" ]
null
null
null
<?php namespace ObservationBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Class Message * @package ObservationBundle\Entity * * @ORM\Entity(repositoryClass="ObservationBundle\Repository\MessageRepository") */ class Message { /** * @ORM\Column(type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="string") */ protected $title; /** * @ORM\Column(type="text", length=9999999) */ protected $message; /** * @ORM\Column(type="string") */ protected $email; /** * @ORM\Column(type="datetime") */ protected $postedAt; /** * @ORM\Column(type="boolean") */ protected $received = false; /** * @ORM\Column(type="boolean") */ protected $answered = false; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Get message * * @return string */ public function getMessage() { return $this->message; } /** * Set message * * @param string $message * * @return Message */ public function setMessage($message) { $this->message = $message; return $this; } /** * Get email * * @return string */ public function getEmail() { return $this->email; } /** * Set email * * @param string $email * * @return Message */ public function setEmail($email) { $this->email = $email; return $this; } /** * Get postedAt * * @return \DateTime */ public function getPostedAt() { return $this->postedAt; } /** * Set postedAt * * @param \DateTime $postedAt * * @return Message */ public function setPostedAt($postedAt) { $this->postedAt = $postedAt; return $this; } /** * Get received * * @return boolean */ public function getReceived() { return $this->received; } /** * Set received * * @param boolean $received * * @return Message */ public function setReceived($received) { $this->received = $received; return $this; } /** * Get answered * * @return boolean */ public function getAnswered() { return $this->answered; } /** * Set answered * * @param boolean $answered * * @return Message */ public function setAnswered($answered) { $this->answered = $answered; return $this; } public function getSlugTitle() { return strtr( $this->getTitle(), '@ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ', 'aAAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy' ); } /** * Get title * * @return string */ public function getTitle() { return $this->title; } /** * Set title * * @param string $title * * @return Message */ public function setTitle($title) { $this->title = $title; return $this; } }
15.564815
80
0.494349
41db3ab617cb3767d4ac741a4d64647d2a6304b3
171
h
C
cegui/src/ScriptModules/Lua/support/tolua++bin/toluabind.h
OpenTechEngine-Libraries/CEGUI
6f00952d31f318f9482766d1ad2206cb540a78b9
[ "MIT" ]
257
2020-01-03T10:13:29.000Z
2022-03-26T14:55:12.000Z
cegui/src/ScriptModules/Lua/support/tolua++bin/toluabind.h
OpenTechEngine-Libraries/CEGUI
6f00952d31f318f9482766d1ad2206cb540a78b9
[ "MIT" ]
116
2020-01-09T18:13:13.000Z
2022-03-15T18:32:02.000Z
cegui/src/ScriptModules/Lua/support/tolua++bin/toluabind.h
OpenTechEngine-Libraries/CEGUI
6f00952d31f318f9482766d1ad2206cb540a78b9
[ "MIT" ]
58
2020-01-09T03:07:02.000Z
2022-03-22T17:21:36.000Z
/* ** Lua binding: tolua ** Generated automatically by tolua++-1.0.93 on Sun Jun 15 09:20:27 2014. */ /* Exported function */ int tolua_tolua_open (lua_State* tolua_S);
19
73
0.695906
61614d5ac1d7c171afddc4be54a260e60f458587
12,271
sql
SQL
database/typeform.sql
sandip-zerobuck/typeform
fbec2637149b896d5ee6a47ac2736321d230a75b
[ "MIT" ]
null
null
null
database/typeform.sql
sandip-zerobuck/typeform
fbec2637149b896d5ee6a47ac2736321d230a75b
[ "MIT" ]
null
null
null
database/typeform.sql
sandip-zerobuck/typeform
fbec2637149b896d5ee6a47ac2736321d230a75b
[ "MIT" ]
null
null
null
-- phpMyAdmin SQL Dump -- version 5.1.0 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Apr 08, 2021 at 01:27 PM -- Server version: 10.4.18-MariaDB -- PHP Version: 7.3.27 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `typeform` -- -- -------------------------------------------------------- -- -- Table structure for table `checkbox_text` -- CREATE TABLE `checkbox_text` ( `id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `value` varchar(255) DEFAULT NULL, `required_field` enum('yes','no') NOT NULL DEFAULT 'no', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `checkbox_text` -- INSERT INTO `checkbox_text` (`id`, `name`, `value`, `required_field`, `created_at`, `updated_at`) VALUES (1, 'Are you use mobile brands', 'Mi=&Vivo=&Oppo=&Samsung=&One Plus=&Apple=&Honor', 'yes', '0000-00-00 00:00:00', '2021-04-08 16:42:13'); -- -------------------------------------------------------- -- -- Table structure for table `end_screen` -- CREATE TABLE `end_screen` ( `id` int(11) NOT NULL, `form_master_id` int(11) NOT NULL, `details` text DEFAULT NULL, `button_text` varchar(255) DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `end_screen` -- INSERT INTO `end_screen` (`id`, `form_master_id`, `details`, `button_text`, `created_at`, `updated_at`) VALUES (1, 1, 'Tanks you.', 'Submit', '0000-00-00 00:00:00', '2021-04-08 16:42:13'); -- -------------------------------------------------------- -- -- Table structure for table `form_create` -- CREATE TABLE `form_create` ( `id` int(11) NOT NULL, `form_master_id` int(11) NOT NULL, `type` enum('short_text','long_text','yesorno_text','checkbox_text') NOT NULL, `content_id` int(11) NOT NULL, `short_text_id` int(11) NOT NULL, `long_text_id` int(11) NOT NULL, `yesorno_text_id` int(11) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `form_create` -- INSERT INTO `form_create` (`id`, `form_master_id`, `type`, `content_id`, `short_text_id`, `long_text_id`, `yesorno_text_id`, `created_at`, `updated_at`) VALUES (1, 1, 'short_text', 1, 0, 0, 0, '0000-00-00 00:00:00', '2021-04-08 16:42:13'), (2, 1, 'yesorno_text', 1, 0, 0, 0, '0000-00-00 00:00:00', '2021-04-08 16:42:13'), (3, 1, 'long_text', 1, 0, 0, 0, '0000-00-00 00:00:00', '2021-04-08 16:42:13'), (4, 1, 'checkbox_text', 1, 0, 0, 0, '0000-00-00 00:00:00', '2021-04-08 16:42:13'); -- -------------------------------------------------------- -- -- Table structure for table `form_master` -- CREATE TABLE `form_master` ( `id` int(11) NOT NULL, `access_token` varchar(255) DEFAULT NULL, `name` varchar(255) DEFAULT NULL, `user_id` int(11) NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `form_master` -- INSERT INTO `form_master` (`id`, `access_token`, `name`, `user_id`, `created_at`, `updated_at`) VALUES (1, 'c4ca4238a0b923820dcc509a6f75849b', 'Contact Form', 1, '2021-04-08 13:12:13', '2021-04-08 16:42:13'); -- -------------------------------------------------------- -- -- Table structure for table `long_text` -- CREATE TABLE `long_text` ( `id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `value` varchar(255) DEFAULT NULL, `required_field` enum('yes','no') NOT NULL DEFAULT 'no', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `long_text` -- INSERT INTO `long_text` (`id`, `name`, `value`, `required_field`, `created_at`, `updated_at`) VALUES (1, 'Address', 'Type your address', 'yes', '0000-00-00 00:00:00', '2021-04-08 16:42:13'); -- -------------------------------------------------------- -- -- Table structure for table `response_master` -- CREATE TABLE `response_master` ( `id` int(11) NOT NULL, `form_master_id` int(11) NOT NULL, `access_token` varchar(255) NOT NULL, `read_mark` enum('read','not_read') NOT NULL DEFAULT 'not_read', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `response_master` -- INSERT INTO `response_master` (`id`, `form_master_id`, `access_token`, `read_mark`, `created_at`, `updated_at`) VALUES (1, 1, 'c4ca4238a0b923820dcc509a6f75849b', 'read', '2021-04-08 13:12:52', '2021-04-08 16:42:52'); -- -------------------------------------------------------- -- -- Table structure for table `short_text` -- CREATE TABLE `short_text` ( `id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `value` varchar(255) DEFAULT NULL, `required_field` enum('yes','no') NOT NULL DEFAULT 'no', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `short_text` -- INSERT INTO `short_text` (`id`, `name`, `value`, `required_field`, `created_at`, `updated_at`) VALUES (1, 'Name', 'Type your name', 'yes', '0000-00-00 00:00:00', '2021-04-08 16:42:13'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `username` varchar(255) DEFAULT NULL, `email` varchar(255) DEFAULT NULL, `password` varchar(255) DEFAULT NULL, `status` int(11) NOT NULL DEFAULT 1, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `username`, `email`, `password`, `status`, `created_at`, `updated_at`) VALUES (1, 'sandip', 'sandip.zerobuck@gmail.com', '202cb962ac59075b964b07152d234b70', 1, '2021-04-02 12:32:20', '2021-04-02 16:02:20'); -- -------------------------------------------------------- -- -- Table structure for table `user_response` -- CREATE TABLE `user_response` ( `id` int(11) NOT NULL, `response_master_id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `value` longtext DEFAULT NULL, `type` enum('short_text','long_text','yesorno_text','checkbox_text') DEFAULT NULL, `status` int(11) NOT NULL DEFAULT 1, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `user_response` -- INSERT INTO `user_response` (`id`, `response_master_id`, `name`, `value`, `type`, `status`, `created_at`, `updated_at`) VALUES (1, 1, 'Name', 'Sandip', 'short_text', 1, '0000-00-00 00:00:00', '2021-04-08 16:42:52'), (2, 1, 'Are you old 18+?', 'yes', 'yesorno_text', 1, '0000-00-00 00:00:00', '2021-04-08 16:42:52'), (3, 1, 'Address', 'Vangadhra', 'long_text', 1, '0000-00-00 00:00:00', '2021-04-08 16:42:52'), (4, 1, 'Are you use mobile brands', 'Mi=&Oppo=&One Plus=&Honor', 'checkbox_text', 1, '0000-00-00 00:00:00', '2021-04-08 16:42:52'); -- -------------------------------------------------------- -- -- Table structure for table `welcome_screen` -- CREATE TABLE `welcome_screen` ( `id` int(11) NOT NULL, `form_master_id` int(11) NOT NULL, `details` text DEFAULT NULL, `button_text` varchar(255) DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `welcome_screen` -- INSERT INTO `welcome_screen` (`id`, `form_master_id`, `details`, `button_text`, `created_at`, `updated_at`) VALUES (1, 1, 'Welcome to Zerobuck', 'Start', '0000-00-00 00:00:00', '2021-04-08 16:42:13'); -- -------------------------------------------------------- -- -- Table structure for table `yesorno_text` -- CREATE TABLE `yesorno_text` ( `id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `value` varchar(255) DEFAULT NULL, `required_field` enum('yes','no') NOT NULL DEFAULT 'no', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL DEFAULT current_timestamp() ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `yesorno_text` -- INSERT INTO `yesorno_text` (`id`, `name`, `value`, `required_field`, `created_at`, `updated_at`) VALUES (1, 'Are you old 18+?', 'Select any one Yes or No', 'yes', '0000-00-00 00:00:00', '2021-04-08 16:42:13'); -- -- Indexes for dumped tables -- -- -- Indexes for table `checkbox_text` -- ALTER TABLE `checkbox_text` ADD PRIMARY KEY (`id`); -- -- Indexes for table `end_screen` -- ALTER TABLE `end_screen` ADD PRIMARY KEY (`id`), ADD KEY `form_create_id` (`form_master_id`); -- -- Indexes for table `form_create` -- ALTER TABLE `form_create` ADD PRIMARY KEY (`id`), ADD KEY `form_master_id` (`form_master_id`), ADD KEY `short_text_id` (`short_text_id`), ADD KEY `long_text_id` (`long_text_id`), ADD KEY `yesorno_text_id` (`yesorno_text_id`), ADD KEY `content_id` (`content_id`); -- -- Indexes for table `form_master` -- ALTER TABLE `form_master` ADD PRIMARY KEY (`id`), ADD KEY `user_id` (`user_id`); -- -- Indexes for table `long_text` -- ALTER TABLE `long_text` ADD PRIMARY KEY (`id`); -- -- Indexes for table `response_master` -- ALTER TABLE `response_master` ADD PRIMARY KEY (`id`), ADD KEY `form_master_id` (`form_master_id`); -- -- Indexes for table `short_text` -- ALTER TABLE `short_text` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`); -- -- Indexes for table `user_response` -- ALTER TABLE `user_response` ADD PRIMARY KEY (`id`), ADD KEY `form_master` (`response_master_id`); -- -- Indexes for table `welcome_screen` -- ALTER TABLE `welcome_screen` ADD PRIMARY KEY (`id`), ADD KEY `form_create_id` (`form_master_id`); -- -- Indexes for table `yesorno_text` -- ALTER TABLE `yesorno_text` ADD PRIMARY KEY (`id`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `checkbox_text` -- ALTER TABLE `checkbox_text` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `end_screen` -- ALTER TABLE `end_screen` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `form_create` -- ALTER TABLE `form_create` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `form_master` -- ALTER TABLE `form_master` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `long_text` -- ALTER TABLE `long_text` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `response_master` -- ALTER TABLE `response_master` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `short_text` -- ALTER TABLE `short_text` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `user_response` -- ALTER TABLE `user_response` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; -- -- AUTO_INCREMENT for table `welcome_screen` -- ALTER TABLE `welcome_screen` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; -- -- AUTO_INCREMENT for table `yesorno_text` -- ALTER TABLE `yesorno_text` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
28.405093
159
0.656915
26480faefb04742100392b5ff2a4ef94a98a8267
2,021
java
Java
examples/full-api-edge-cases/src/main/java/com/webcohesion/enunciate/examples/jaxwsrijersey/genealogy/cite/Repository.java
ripdajacker/enunciate
4cffb49ad8e37be394f2f01f388eba44ec8f5711
[ "Apache-2.0" ]
431
2015-01-05T06:27:54.000Z
2022-03-29T22:01:03.000Z
examples/full-api-edge-cases/src/main/java/com/webcohesion/enunciate/examples/jaxwsrijersey/genealogy/cite/Repository.java
ripdajacker/enunciate
4cffb49ad8e37be394f2f01f388eba44ec8f5711
[ "Apache-2.0" ]
1,020
2015-01-17T17:44:54.000Z
2022-03-30T14:11:06.000Z
examples/full-api-edge-cases/src/main/java/com/webcohesion/enunciate/examples/jaxwsrijersey/genealogy/cite/Repository.java
ripdajacker/enunciate
4cffb49ad8e37be394f2f01f388eba44ec8f5711
[ "Apache-2.0" ]
180
2015-02-02T17:12:44.000Z
2022-03-05T10:51:47.000Z
/** * Copyright © 2006-2016 Web Cohesion (info@webcohesion.com) * * 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.webcohesion.enunciate.examples.jaxwsrijersey.genealogy.cite; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlID; import javax.xml.bind.annotation.XmlAttribute; /** * A repository for sources. * * @author Ryan Heaton */ @XmlRootElement public class Repository { private String id; private String location; private EMail email; /** * The id of the repository. * * @return The id of the repository. */ @XmlID @XmlAttribute public String getId() { return id; } /** * The id of the repository. * * @param id The id of the repository. */ public void setId(String id) { this.id = id; } /** * The location for this repository. * * @return The location for this repository. */ public String getLocation() { return location; } /** * The location for this repository. * * @param location The location for this repository. */ public void setLocation(String location) { this.location = location; } /** * An e-mail address for this repository. * * @return An e-mail address for this repository. */ public EMail getEmail() { return email; } /** * An e-mail address for this repository. * * @param email An e-mail address for this repository. */ public void setEmail(EMail email) { this.email = email; } }
22.455556
75
0.676398
0bcf3894899c549fa09e5594967fe84caaa91290
1,686
js
JavaScript
src/env.js
RagnarHal/FreemanBot
a8542a86e656f5b0b234e85ff27f344e2166845b
[ "MIT" ]
null
null
null
src/env.js
RagnarHal/FreemanBot
a8542a86e656f5b0b234e85ff27f344e2166845b
[ "MIT" ]
6
2018-02-01T21:22:41.000Z
2022-01-22T03:45:52.000Z
src/env.js
RagnarHal/FreemanBot
a8542a86e656f5b0b234e85ff27f344e2166845b
[ "MIT" ]
1
2018-01-24T22:36:10.000Z
2018-01-24T22:36:10.000Z
import "dotenv/config"; import { stripIndent } from "common-tags"; import logger from "./logger"; function setupEnv() { const environment = process.env.NODE_ENV || "development"; const isProduction = environment === "production"; const isDevelopment = environment === "development"; validateEnvironment(); return { environment, isProduction, isDevelopment, ownerId: process.env.OWNER_ID, botToken: process.env.BOT_TOKEN, google: { apiKey: process.env.GOOGLE_API_KEY }, firebase: { databaseUrl: process.env.FIREBASE_DATABASE_URL, projectId: process.env.FIREBASE_PROJECT_ID, privateKey: JSON.parse(`"${process.env.FIREBASE_PRIVATE_KEY}"`), clientEmail: process.env.FIREBASE_CLIENT_EMAIL }, words: { baseUrl: process.env.WORDS_API_URL, key: process.env.WORDS_API_KEY }, news: { baseUrl: process.env.NEWS_API_URL, key: process.env.NEWS_API_KEY } }; } function validateEnvironment() { const requiredEnvKeys = [ "FIREBASE_DATABASE_URL", "FIREBASE_PROJECT_ID", "FIREBASE_PRIVATE_KEY", "FIREBASE_CLIENT_EMAIL", "BOT_TOKEN", "OWNER_ID", "GOOGLE_API_KEY", "WORDS_API_URL", "WORDS_API_KEY" ]; const missingKeys = requiredEnvKeys.reduce((missing, key) => { if (!process.env[key]) { missing.push(key); } return missing; }, []); if (missingKeys.length) { logger.error(stripIndent` The following environment variables are missing but are required: --- ${missingKeys.join("\n")} --- exiting... `); throw new Error("Environment validation failed"); } } export default setupEnv();
23.746479
70
0.659549
0bf570be556f0ef11d28f4837dba7678569a3013
1,295
js
JavaScript
src/renderer/components/AdminPanelsComponents/UsersList.js
qve1t/websocket-tv-logger
53f3bb1d161b5e1b234d85cc7c73bf90b4d25e6d
[ "MIT" ]
null
null
null
src/renderer/components/AdminPanelsComponents/UsersList.js
qve1t/websocket-tv-logger
53f3bb1d161b5e1b234d85cc7c73bf90b4d25e6d
[ "MIT" ]
null
null
null
src/renderer/components/AdminPanelsComponents/UsersList.js
qve1t/websocket-tv-logger
53f3bb1d161b5e1b234d85cc7c73bf90b4d25e6d
[ "MIT" ]
null
null
null
import React from "react"; import { TagButton } from "@components/Reusable/ButtonsTag"; import { TableHeader } from "@components/Reusable/Headers"; import style from "@styles/components/AdminPanels/index.scss"; const UsersList = ({ rolesList = [], usersList = [], selectedUser, setSelectedUser, }) => { const onPersonClick = (person) => () => { if (selectedUser._id === person._id) { return setSelectedUser({}); } setSelectedUser(person); }; return ( <div className={style.elements_wrapper}> {rolesList.map((type, index) => ( <div key={type + "usersAdmin"} className={style.elements_section}> <TableHeader>{type}</TableHeader> <div className={style.elements_section_wrapper}> {usersList .filter((elem) => elem.role === type) .map((person) => ( <TagButton key={person._id} isActive={selectedUser._id === person._id ? true : false} show={true} color="#004ba0" onClick={onPersonClick(person)} > {person.name} </TagButton> ))} </div> </div> ))} </div> ); }; export default UsersList;
26.979167
75
0.532046
90d7fe10aeb70963477192585a9a24b4c7be7f5c
6,413
py
Python
app/endpoints/auth.py
a283910020/yummy-rest
066f48e0219ac2c64daea0b393f62d921be4394d
[ "MIT" ]
4
2018-11-16T21:43:25.000Z
2020-11-23T08:26:05.000Z
app/endpoints/auth.py
a283910020/yummy-rest
066f48e0219ac2c64daea0b393f62d921be4394d
[ "MIT" ]
12
2017-12-22T09:10:51.000Z
2018-06-17T17:16:16.000Z
app/endpoints/auth.py
a283910020/yummy-rest
066f48e0219ac2c64daea0b393f62d921be4394d
[ "MIT" ]
5
2018-03-02T08:03:28.000Z
2020-05-25T14:59:59.000Z
"""The API routes""" from datetime import datetime, timedelta from werkzeug.security import check_password_hash, generate_password_hash from flask import jsonify, request, make_response from flask_restplus import Resource from flask_jwt import jwt from app import APP from app.helpers import decode_access_token from app.helpers.validators import UserSchema from app.restplus import API from app.models import db, User, BlacklistToken from app.serializers import add_user, login_user, password_reset # Linting exceptions # pylint: disable=C0103 # pylint: disable=W0702 # pylint: disable=W0703 # pylint: disable=E1101 # pylint: disable=R0201 auth_ns = API.namespace('auth', description="Authentication/Authorization operations.") @auth_ns.route('/register') class RegisterHandler(Resource): """ This class handles user account creation. """ @API.expect(add_user) def post(self): """ Registers a new user account. """ data = request.get_json() # Instanciate user schema user_schema = UserSchema() data, errors = user_schema.load(data) if errors: response_obj = dict( errors=errors ) return make_response(jsonify(response_obj), 422) # Check if user exists email = data['email'].lower() user = User.query.filter_by(email=email).first() if not user: try: new_user = User( email=data['email'], username=data['username'], password=data['password'] ) db.session.add(new_user) db.session.commit() return make_response(jsonify({'message': 'Registered successfully!'}), 201) except: response = {"message": "Username already taken, please choose another."} return make_response(jsonify(response), 401) else: response = jsonify({'message': 'User already exists. Please Log in instead.'}) return make_response(response, 400) @auth_ns.route('/login') class LoginHandler(Resource): """ This class handles user login """ @API.expect(login_user) def post(self): """ User Login/SignIn route """ login_info = request.get_json() if not login_info: return make_response(jsonify({'message': 'Input payload validation failed'}), 400) try: user = User.query.filter_by(email=login_info['email']).first() if not user: return make_response(jsonify({"message": 'User does not exist!'}), 404) if check_password_hash(user.password, login_info['password']): payload = { 'exp': datetime.utcnow() + timedelta(weeks=3), 'iat': datetime.utcnow(), 'sub': user.public_id } token = jwt.encode( payload, APP.config['SECRET_KEY'], algorithm='HS256' ) print(user.username) return jsonify({"message": "Logged in successfully.", "access_token": token.decode('UTF-8'), "username": user.username }) return make_response(jsonify({"message": "Incorrect credentials."}), 401) except Exception as e: print(e) return make_response(jsonify({"message": "An error occurred. Please try again."}), 501) @auth_ns.route('/logout') class LogoutHandler(Resource): """ This class handles user logout """ def post(self): """ Logout route """ access_token = request.headers.get('Authorization') if access_token: result = decode_access_token(access_token) if not isinstance(result, str): # mark the token as blacklisted blacklisted_token = BlacklistToken(access_token) try: # insert the token db.session.add(blacklisted_token) db.session.commit() response_obj = dict( status="success", message="Logged out successfully." ) return make_response(jsonify(response_obj), 200) except Exception as e: resp_obj = { 'status': 'fail', 'message': e } return make_response(jsonify(resp_obj), 200) else: resp_obj = dict( status="fail", message=result ) return make_response(jsonify(resp_obj), 401) else: response_obj = { 'status': 'fail', 'message': 'Provide a valid auth token.' } return make_response(jsonify(response_obj), 403) @auth_ns.route('/reset-password') class PasswordResetResource(Resource): """ This class handles the user password reset request """ @API.expect(password_reset) def post(self): """ Reset user password """ # Request data data = request.get_json() # Get specified user user = User.query.filter_by(public_id=data['public_id']).first() if user: if check_password_hash(user.password, data['current_password']): user.password = generate_password_hash(data['new_password']) db.session.commit() resp_obj = dict( status="Success!", message="Password reset successfully!" ) resp_obj = jsonify(resp_obj) return make_response(resp_obj, 200) resp_obj = dict( status="Fail!", message="Wrong current password. Try again." ) resp_obj = jsonify(resp_obj) return make_response(resp_obj, 401) resp_obj = dict( status="Fail!", message="User doesn't exist, check the Public ID provided!" ) resp_obj = jsonify(resp_obj) return make_response(resp_obj, 403)
34.111702
99
0.545143
2d983df9d8393db516d9d4082ce095662e424de7
106
html
HTML
ConnectorWebService/Web/index.html
FindMeRoomOSS/Connector
de13525bb84c9664634284d53e307e8d99831fca
[ "MIT" ]
null
null
null
ConnectorWebService/Web/index.html
FindMeRoomOSS/Connector
de13525bb84c9664634284d53e307e8d99831fca
[ "MIT" ]
null
null
null
ConnectorWebService/Web/index.html
FindMeRoomOSS/Connector
de13525bb84c9664634284d53e307e8d99831fca
[ "MIT" ]
null
null
null
<html> <head> <title>Webapp stub</title> </head> <body> <h1>It works!</h1> </body> </html>
13.25
31
0.518868
2a2d2a0de7c0dc0849044c847a02511034239abd
2,806
java
Java
src/java/org/xiph/libvorbis/codec_setup_info.java
dubenju/javay
29284c847c2ab62048538c3973a9fb10090155aa
[ "Apache-2.0" ]
7
2015-12-05T09:18:48.000Z
2021-03-03T09:00:46.000Z
src/java/org/xiph/libvorbis/codec_setup_info.java
dubenju/javay
29284c847c2ab62048538c3973a9fb10090155aa
[ "Apache-2.0" ]
null
null
null
src/java/org/xiph/libvorbis/codec_setup_info.java
dubenju/javay
29284c847c2ab62048538c3973a9fb10090155aa
[ "Apache-2.0" ]
null
null
null
/* * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * by the Xiph.Org Foundation http://www.xiph.org/ */ package org.xiph.libvorbis; // NOTE - class updated to VorbisLib 1.1.2 class codec_setup_info { // Vorbis supports only short and long blocks, but allows the encoder to choose the sizes int[] blocksizes; // long blocksizes[2] // modes are the primary means of supporting on-the-fly different blocksizes, different channel mappings (LR or M/A), // different residue backends, etc. Each mode consists of a blocksize flag and a mapping (along with the mapping setup int modes; int maps; int floors; int residues; int books; int psys; // encode only vorbis_info_mode[] mode_param; // codec_setup *mode_param[64] // TODO - Abstract classes // vorbis_info_mapping // vorbis_info_floor // vorbis_info_residue int[] map_type; // int map_type[64] - will always be map0 vorbis_info_mapping0[] map_param; // vorbis_info_mapping *map_param[64] int[] floor_type; // int floor_type[64] - will always be floor1 vorbis_info_floor1[] floor_param; // vorbis_info_floor *floor_param[64] int[] residue_type; // int residue_type[64] - this guy might change from 0,1,2 for functions vorbis_info_residue0[] residue_param; // vorbis_info_residue *residue_param[64] - data will always fit into res0 static_codebook[] book_param; // static_codebook *book_param[256] codebook[] fullbooks; // codebook *fullbooks vorbis_info_psy[] psy_param; // encode only // psy_param[4] vorbis_info_psy_global psy_g_param; bitrate_manager_info bi; highlevel_encode_setup hi; // used only by vorbisenc.c - Redundant int halfrate_flag; // painless downsample for decode public codec_setup_info() { blocksizes = new int[2]; mode_param = new vorbis_info_mode[64]; map_type = new int[64]; map_param = new vorbis_info_mapping0[64]; floor_type = new int[64]; floor_param = new vorbis_info_floor1[64]; residue_type = new int[64]; residue_param = new vorbis_info_residue0[64]; book_param = new static_codebook[256]; psy_param = new vorbis_info_psy[4]; bi = new bitrate_manager_info(); hi = new highlevel_encode_setup(); } }
35.075
123
0.645403
b16e0996328d16035c973bfe036d26d0afdb91a3
237
asm
Assembly
cemu/examples/x86_64_sys_exec_bin_sh_null_free.asm
MatejKastak/cemu
c6f93239a5901ce00d2f739a3913d0ba7d0ed4e4
[ "MIT" ]
823
2016-05-15T08:55:57.000Z
2022-03-23T01:06:44.000Z
cemu/examples/x86_64_sys_exec_bin_sh_null_free.asm
MatejKastak/cemu
c6f93239a5901ce00d2f739a3913d0ba7d0ed4e4
[ "MIT" ]
57
2016-05-16T20:09:17.000Z
2022-03-13T14:11:51.000Z
cemu/examples/x86_64_sys_exec_bin_sh_null_free.asm
MatejKastak/cemu
c6f93239a5901ce00d2f739a3913d0ba7d0ed4e4
[ "MIT" ]
118
2016-05-16T18:10:25.000Z
2022-03-02T15:02:18.000Z
# rax = sys_execve xor rax, rax mov al, 59 # write /bin/sh @rsp mov rsi, 0x0168732f6e69622f shl rsi, 8 shr rsi, 8 mov [rsp], rsi # rdi = @/bin/sh mov rdi, rsp # nullify the other args xor rsi, rsi xor rdx, rdx # trigger interrupt syscall
15.8
27
0.700422
76ffa23983f7e782ead224a40a093d40e4d3a1ff
1,160
sql
SQL
text/Instagrarn.sql
yoonwooseong/Airdnd_scraper
93260753820924aadba43d03d2f969150c1cdffc
[ "MIT" ]
1
2021-02-06T00:20:52.000Z
2021-02-06T00:20:52.000Z
text/Instagrarn.sql
yoonwooseong/Airdnd_scraper
93260753820924aadba43d03d2f969150c1cdffc
[ "MIT" ]
3
2020-10-16T10:11:23.000Z
2021-08-29T13:18:03.000Z
text/Instagrarn.sql
yoonwooseong/Airdnd_scraper
93260753820924aadba43d03d2f969150c1cdffc
[ "MIT" ]
1
2021-08-30T23:47:07.000Z
2021-08-30T23:47:07.000Z
use InstagrarnDB; create table Insta_user( idx int(9) NOT NULL auto_increment, email VARCHAR(300), phone VARCHAR(300), full_name VARCHAR(300), id VARCHAR(300), pwd VARCHAR(300), PRIMARY KEY(idx) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; create table Insta_likes( idx int(9) NOT NULL auto_increment, user_idx int(9) NOT NULL, board_idx int(9) NOT NULL, PRIMARY KEY(idx) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; create table Insta_reply( idx int(9) NOT NULL auto_increment, board_idx int(9) NOT NULL, user_idx int(9) NOT NULL, reply int(9) NOT NULL, PRIMARY KEY(idx) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; create table Insta_alert( idx int(9) NOT NULL auto_increment, from_user_idx int(9) NOT NULL, to_user_idx int(9) NOT NULL, alert_type int(9) NOT NULL, PRIMARY KEY(idx) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; create view Insta_reply_view as select u.id, r.board_idx, r.reply from Insta_reply as r, Insta_user as u where r.user_idx = u.idx; create view Insta_alert_view as select u.id, a.from_user_idx, a.to_user_idx, a.alert_type from Insta_alert as a, Insta_user as u where a.from_user_idx = u.idx;
29
89
0.733621
98d6cc8bce6517c0ac32fb08fc459d22a45d2b0a
1,540
swift
Swift
Bement/ATCClassicWalkthroughViewController.swift
1105420698/Bement
7fba5c596669184680d6d4238d9527617a9c80e5
[ "MIT" ]
1
2020-01-25T14:17:47.000Z
2020-01-25T14:17:47.000Z
Bement/ATCClassicWalkthroughViewController.swift
1105420698/Bement
7fba5c596669184680d6d4238d9527617a9c80e5
[ "MIT" ]
null
null
null
Bement/ATCClassicWalkthroughViewController.swift
1105420698/Bement
7fba5c596669184680d6d4238d9527617a9c80e5
[ "MIT" ]
null
null
null
// // ATCClassicWalkthroughViewController.swift // DashboardApp // // Created by Florian Marcu on 8/13/18. // Copyright © 2018 Instamobile. All rights reserved. // import UIKit class ATCClassicWalkthroughViewController: UIViewController { @IBOutlet var containerView: UIView! @IBOutlet var imageContainerView: UIView! @IBOutlet var imageView: UIImageView! @IBOutlet var titleLabel: UILabel! @IBOutlet var subtitleLabel: UILabel! let model: ATCWalkthroughModel init(model: ATCWalkthroughModel, nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { self.model = model super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func viewDidLoad() { super.viewDidLoad() imageView.image = UIImage.localImage(model.icon, template: true) imageView.contentMode = .scaleAspectFill imageView.clipsToBounds = true imageView.tintColor = .white imageContainerView.backgroundColor = .clear titleLabel.text = model.title titleLabel.font = UIFont.boldSystemFont(ofSize: 20.0) titleLabel.textColor = .white subtitleLabel.attributedText = NSAttributedString(string: model.subtitle) subtitleLabel.font = UIFont.systemFont(ofSize: 14.0) subtitleLabel.textColor = .white containerView.backgroundColor = UIColor(hexString: "#3068CC") } }
30.8
81
0.694805
a8eded59c192c5218579b3b07094b8da8c566063
16,956
rs
Rust
src/access_point.rs
resin-io-modules/libnm-rs
0183a43fc26506895868aaa3921bb38fb7a5b2bf
[ "Apache-2.0" ]
1
2018-04-17T15:27:43.000Z
2018-04-17T15:27:43.000Z
src/access_point.rs
resin-io-playground/libnm-rs
0183a43fc26506895868aaa3921bb38fb7a5b2bf
[ "Apache-2.0" ]
null
null
null
src/access_point.rs
resin-io-playground/libnm-rs
0183a43fc26506895868aaa3921bb38fb7a5b2bf
[ "Apache-2.0" ]
null
null
null
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files // DO NOT EDIT use crate::Connection; use crate::Object; use crate::_80211ApFlags; use crate::_80211ApSecurityFlags; use crate::_80211Mode; use glib::object::IsA; use glib::object::ObjectType as ObjectType_; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use std::boxed::Box as Box_; use std::fmt; use std::mem::transmute; glib::wrapper! { #[doc(alias = "NMAccessPoint")] pub struct AccessPoint(Object<ffi::NMAccessPoint, ffi::NMAccessPointClass>) @extends Object; match fn { type_ => || ffi::nm_access_point_get_type(), } } impl AccessPoint { /// Validates a given connection against a given Wi-Fi access point to ensure that /// the connection may be activated with that AP. The connection must match the /// `self`'s SSID, (if given) BSSID, and other attributes like security settings, /// channel, band, etc. /// ## `connection` /// an [`Connection`][crate::Connection] to validate against `self` /// /// # Returns /// /// [`true`] if the connection may be activated with this Wi-Fi AP, /// [`false`] if it cannot be. #[doc(alias = "nm_access_point_connection_valid")] pub fn connection_valid(&self, connection: &impl IsA<Connection>) -> bool { unsafe { from_glib(ffi::nm_access_point_connection_valid( self.to_glib_none().0, connection.as_ref().to_glib_none().0, )) } } /// Filters a given array of connections for a given [`AccessPoint`][crate::AccessPoint] object and /// returns connections which may be activated with the access point. Any /// returned connections will match the `self`'s SSID and (if given) BSSID and /// other attributes like security settings, channel, etc. /// /// To obtain the list of connections that are compatible with this access point, /// use [`Client::connections()`][crate::Client::connections()] and then filter the returned list for a given /// [`Device`][crate::Device] using [`DeviceExt::filter_connections()`][crate::prelude::DeviceExt::filter_connections()] and finally filter that list /// with this function. /// ## `connections` /// an array of `NMConnections` to /// filter /// /// # Returns /// /// an array of /// `NMConnections` that could be activated with the given `self`. The array should /// be freed with `g_ptr_array_unref()` when it is no longer required. /// /// WARNING: the transfer annotation for this function may not work correctly /// with bindings. See https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/305. /// You can filter the list yourself with [`connection_valid()`][Self::connection_valid()]. #[doc(alias = "nm_access_point_filter_connections")] pub fn filter_connections(&self, connections: &[Connection]) -> Vec<Connection> { unsafe { FromGlibPtrContainer::from_glib_full(ffi::nm_access_point_filter_connections( self.to_glib_none().0, connections.to_glib_none().0, )) } } /// Gets the Basic Service Set ID (BSSID) of the Wi-Fi access point. /// /// # Returns /// /// the BSSID of the access point. This is an internal string and must /// not be modified or freed. #[doc(alias = "nm_access_point_get_bssid")] #[doc(alias = "get_bssid")] pub fn bssid(&self) -> Option<glib::GString> { unsafe { from_glib_none(ffi::nm_access_point_get_bssid(self.to_glib_none().0)) } } /// Gets the flags of the access point. /// /// # Returns /// /// the flags #[doc(alias = "nm_access_point_get_flags")] #[doc(alias = "get_flags")] pub fn flags(&self) -> _80211ApFlags { unsafe { from_glib(ffi::nm_access_point_get_flags(self.to_glib_none().0)) } } /// Gets the frequency of the access point in MHz. /// /// # Returns /// /// the frequency in MHz #[doc(alias = "nm_access_point_get_frequency")] #[doc(alias = "get_frequency")] pub fn frequency(&self) -> u32 { unsafe { ffi::nm_access_point_get_frequency(self.to_glib_none().0) } } /// Returns the timestamp (in CLOCK_BOOTTIME seconds) for the last time the /// access point was found in scan results. A value of -1 means the access /// point has not been found in a scan. /// /// # Returns /// /// the last seen time in seconds #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "nm_access_point_get_last_seen")] #[doc(alias = "get_last_seen")] pub fn last_seen(&self) -> i32 { unsafe { ffi::nm_access_point_get_last_seen(self.to_glib_none().0) } } /// Gets the maximum bit rate of the access point in kbit/s. /// /// # Returns /// /// the maximum bit rate (kbit/s) #[doc(alias = "nm_access_point_get_max_bitrate")] #[doc(alias = "get_max_bitrate")] pub fn max_bitrate(&self) -> u32 { unsafe { ffi::nm_access_point_get_max_bitrate(self.to_glib_none().0) } } /// Gets the mode of the access point. /// /// # Returns /// /// the mode #[doc(alias = "nm_access_point_get_mode")] #[doc(alias = "get_mode")] pub fn mode(&self) -> _80211Mode { unsafe { from_glib(ffi::nm_access_point_get_mode(self.to_glib_none().0)) } } /// Gets the RSN (Robust Secure Network, ie WPA version 2) flags of the access /// point. /// /// # Returns /// /// the RSN flags #[doc(alias = "nm_access_point_get_rsn_flags")] #[doc(alias = "get_rsn_flags")] pub fn rsn_flags(&self) -> _80211ApSecurityFlags { unsafe { from_glib(ffi::nm_access_point_get_rsn_flags(self.to_glib_none().0)) } } /// Gets the SSID of the access point. /// /// # Returns /// /// the [`glib::Bytes`][crate::glib::Bytes] containing the SSID, or [`None`] if the /// SSID is unknown. #[doc(alias = "nm_access_point_get_ssid")] #[doc(alias = "get_ssid")] pub fn ssid(&self) -> Option<glib::Bytes> { unsafe { from_glib_none(ffi::nm_access_point_get_ssid(self.to_glib_none().0)) } } /// Gets the current signal strength of the access point as a percentage. /// /// # Returns /// /// the signal strength (0 to 100) #[doc(alias = "nm_access_point_get_strength")] #[doc(alias = "get_strength")] pub fn strength(&self) -> u8 { unsafe { ffi::nm_access_point_get_strength(self.to_glib_none().0) } } /// Gets the WPA (version 1) flags of the access point. /// /// # Returns /// /// the WPA flags #[doc(alias = "nm_access_point_get_wpa_flags")] #[doc(alias = "get_wpa_flags")] pub fn wpa_flags(&self) -> _80211ApSecurityFlags { unsafe { from_glib(ffi::nm_access_point_get_wpa_flags(self.to_glib_none().0)) } } /// Alias for `property::AccessPoint::bssid`. /// /// # Deprecated since 1 /// /// Use `property::AccessPoint::bssid`. #[cfg_attr(feature = "v1", deprecated = "Since 1")] #[doc(alias = "hw-address")] pub fn hw_address(&self) -> Option<glib::GString> { glib::ObjectExt::property(self, "hw-address") } #[doc(alias = "bssid")] pub fn connect_bssid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_bssid_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::bssid\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_bssid_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "flags")] pub fn connect_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_flags_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::flags\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_flags_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "frequency")] pub fn connect_frequency_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_frequency_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::frequency\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_frequency_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[cfg_attr(feature = "v1", deprecated = "Since 1")] #[doc(alias = "hw-address")] pub fn connect_hw_address_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_hw_address_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::hw-address\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_hw_address_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[cfg(any(feature = "v1_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))] #[doc(alias = "last-seen")] pub fn connect_last_seen_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_last_seen_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::last-seen\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_last_seen_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "max-bitrate")] pub fn connect_max_bitrate_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_max_bitrate_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::max-bitrate\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_max_bitrate_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "mode")] pub fn connect_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_mode_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::mode\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_mode_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "rsn-flags")] pub fn connect_rsn_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_rsn_flags_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::rsn-flags\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_rsn_flags_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "ssid")] pub fn connect_ssid_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_ssid_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::ssid\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_ssid_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "strength")] pub fn connect_strength_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_strength_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::strength\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_strength_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "wpa-flags")] pub fn connect_wpa_flags_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_wpa_flags_trampoline<F: Fn(&AccessPoint) + 'static>( this: *mut ffi::NMAccessPoint, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::wpa-flags\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_wpa_flags_trampoline::<F> as *const (), )), Box_::into_raw(f), ) } } } impl fmt::Display for AccessPoint { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("AccessPoint") } }
35.84778
153
0.538865
858ad35a9bf862d59691716fa83aba569e385366
2,003
js
JavaScript
home/httpd/public/js/menu.js
Anime4000/DFP-34G-2C2
9a49498fca78389170e2d5992c5b99f0fa25a550
[ "Unlicense" ]
16
2020-10-26T05:33:06.000Z
2022-02-15T12:02:33.000Z
home/httpd/public/js/menu.js
Anime4000/DFP-34G-2C2
9a49498fca78389170e2d5992c5b99f0fa25a550
[ "Unlicense" ]
null
null
null
home/httpd/public/js/menu.js
Anime4000/DFP-34G-2C2
9a49498fca78389170e2d5992c5b99f0fa25a550
[ "Unlicense" ]
4
2021-01-06T18:52:41.000Z
2021-12-26T13:40:07.000Z
function getURL() { var ret = "getpage.gch?pid=1002&nextpage="; var len = arguments.length; if ( 0 != (len-1)%2 ) { ShowErrorForCom(null, null, "arguments len err of getURL!"); return; } for (var i=0; i<len; i++) { if ( i%2 == 1 ) { ret += "&" + arguments[i] + "="; } else { ret += arguments[i]; } } return ret; } function menuURLGen() { for ( var supId in meta_menu ) { meta_menu[supId]['URL'] = getURL(meta_menu[supId]['page']); for ( var midId in menu_items[supId] ) { menu_items[supId][midId]['URL'] = getURL(menu_items[supId][midId]['page']); for ( var subId in menu_subitems[supId][midId] ) { menu_subitems[supId][midId][subId]['URL'] = getURL(menu_subitems[supId][midId][subId]['page']); } } } } function menuURLGen_Top() { for ( var supId in meta_menu ) { meta_menu[supId]['URL'] = getURL(meta_menu[supId]['page']); } } function menuDisp() { menuURLGen(); menuUpdate(); } function ReplaceDemo(ss) { var r, re; re = / /g; r = ss.replace(re, "&nbsp;"); return r; } function openLink(pageurl) { var tag = getObj("IF_UPLOADING").value; if (tag == "1") { top.mainFrame.location.href = "#"; } else { if(getObj("temClickURL").value == "") { getObj("temClickURL").value = pageurl; top.mainFrame.location.href = ReplaceDemo(pageurl); } else { if(getObj("temClickURL").value != pageurl) { getObj("temClickURL").value = pageurl; top.mainFrame.location.href = ReplaceDemo(pageurl); } else { top.mainFrame.location.href = "#"; } } } } function getMidMenuStat(supId, midId) { var len = 0; for ( var i in menu_subitems[supId][midId] ) { len++; } if ( 0 == len ) { return "single"; } for (var subId in menu_subitems[supId][midId] ) { if ( selectPage == menu_subitems[supId][midId][subId]['page'] ) { return "open"; } } return "closed"; } function isMetaMenuWithChild(supId) { var len = 0; for ( var i in menu_items[supId] ) { len++; } if ( 0 == len ) { return false; } return true; } function OnMenuItemClick(supId, midId) { selectPage = menu_items[supId][midId]['page']; selectSupId = supId; menuUpdate(); }
16.024
95
0.658512
402a8e59bde5f2ebb1083f7dbdab57fb5d9c5514
1,125
py
Python
Ch04/test/maximum_subarray_test.py
Ryuichi-Sasaki/CLRS
3ae6f2c9554d2dffff0ea8f6f6e162fcdcf8f7e9
[ "MIT" ]
null
null
null
Ch04/test/maximum_subarray_test.py
Ryuichi-Sasaki/CLRS
3ae6f2c9554d2dffff0ea8f6f6e162fcdcf8f7e9
[ "MIT" ]
null
null
null
Ch04/test/maximum_subarray_test.py
Ryuichi-Sasaki/CLRS
3ae6f2c9554d2dffff0ea8f6f6e162fcdcf8f7e9
[ "MIT" ]
null
null
null
import unittest import sys sys.path.append("../src/") from maximum_subarray import maximum_diff_brute_force from maximum_subarray import maximum_diff_divide_and_conquer from maximum_subarray import maximum_diff_dynamic_programming from random import randint class TestMaximumSubarray(unittest.TestCase): def test_maximum_diff_divide_and_conquer(self): """ 分割統治法の結果が総当たり法の結果と一致することを確認する。 最大部分配列は複数存在するかもしれないので、部分和だけ確認する。 """ A = [randint(0, 100) for _ in range(100)] (_, _, max_diff1) = maximum_diff_brute_force(A) (_, _, max_diff2) = maximum_diff_divide_and_conquer(A) self.assertEqual(max_diff1, max_diff2) def test_maximum_diff_dynamic_programming(self): """ kadaneのアルゴリズムの結果が総当たり法の結果と一致することを確認する。 最大部分配列は複数存在するかもしれないが、どちらも最も左に存在するものの情報を 返すので、結果が全て一致するか確認できる。 """ A = [randint(0, 100) for _ in range(100)] result1 = maximum_diff_brute_force(A) result2 = maximum_diff_dynamic_programming(A) self.assertEqual(result1, result2) if __name__ == "__main__": unittest.main()
34.090909
62
0.712889
0bb85be9403c1308f076ef0d9f8f803e7a8eca9b
3,018
js
JavaScript
public/sys/js/controller/config-controller.js
quanbka/evn
e50da087b0997c194347f8693b1236d58d564ed2
[ "MIT" ]
null
null
null
public/sys/js/controller/config-controller.js
quanbka/evn
e50da087b0997c194347f8693b1236d58d564ed2
[ "MIT" ]
null
null
null
public/sys/js/controller/config-controller.js
quanbka/evn
e50da087b0997c194347f8693b1236d58d564ed2
[ "MIT" ]
null
null
null
system.controller("ConfigController", ConfigController); /** * * @param {type} $scope * @param {type} $http * @param {type} $rootScope * @returns {undefined} */ function ConfigController($scope, $http, $rootScope, $timeout, Upload) { $scope.controllerName = "ConfigController"; $scope.options = { language: 'en', allowedContent: true, entities: false, filebrowserBrowseUrl: '/laravel-filemanager?type=Files', height:500 } this.__proto__ = new BaseController($scope, $http, $rootScope, Upload); $scope.config = config; if ($scope.config.type == 'slide') { $scope.config.value = JSON.parse($scope.config.value); } $scope.fileds = [ { 'field': 'id', 'editable': false, 'label': "ID", 'type': 'text' }, { 'field': 'page', 'editable': false, 'label': "Trang", 'type': 'text' }, { 'field': 'key', 'editable': false, 'label': "Key", 'type': 'text' }, { 'field': 'value', 'editable': true, 'label': "Giá trị", 'type': 'textarea' }, ]; $scope.uploadSlideImage = async function (file, item) { if (file) { var image = await $scope.upload(file); if (image) { $scope.$applyAsync(function () { item.image_url = image; }); } } }; $scope.uploadImage = async function (file) { if (file) { var image = await $scope.upload(file); if (image) { $scope.$applyAsync(function () { $scope.config.value = image; }); } } }; $scope.addSlide = function () { $scope.config.value.push({ image_url: '', text: '', url: '' }); } $scope.removeSlide = function ($index) { $scope.config.value.splice($index, 1); } $scope.thumbnail = function (config) { let img = config.image_url; if (img) { ext = (img.substr(img.length - 3)) if (ext == 'pdf') { return '/pdf.png'; } } return config.image_url; } $scope.save = function () { let data = angular.copy($scope.config); if ($scope.config.type == 'slide') { data.value = JSON.stringify($scope.config.value); } $http.put($scope.buildApiUrl('/api/config/' + $scope.config.id), data) .then(function (res) { if (res.data.status == 'success') { toastr.success('Thành công'); } else { toastr.error('Đã có lỗi xảy ra'); } }, function (error) { toastr.error('Đã có lỗi xảy ra'); }) } }
26.707965
78
0.45063
2707f628b000dcaf34a1783120654373a54d3a5b
2,826
css
CSS
doc/UserManual/html/include/TSTool-UserManual.css
OpenCDSS/cdss-app-tstool-doc
bf7552cf5c5c1330e5f3dd28836018e4fc07f8d9
[ "CC-BY-4.0" ]
null
null
null
doc/UserManual/html/include/TSTool-UserManual.css
OpenCDSS/cdss-app-tstool-doc
bf7552cf5c5c1330e5f3dd28836018e4fc07f8d9
[ "CC-BY-4.0" ]
1
2019-02-04T08:31:54.000Z
2019-02-08T08:36:45.000Z
doc/UserManual/html/include/TSTool-UserManual.css
OpenCDSS/cdss-app-tstool-doc
bf7552cf5c5c1330e5f3dd28836018e4fc07f8d9
[ "CC-BY-4.0" ]
null
null
null
/* Styles for TSTool User Manual - Put html defaults at top - Override with additional styles below */ /* font-family: "Arial", Helvetica, sans-serif; font-family: Palatino, 'Palatino Linotype', serif; font-family: "Tahoma", Geneva, sans-serif; */ html * { font-family: 'Times New Roman', Times, serif; } code { font-family: "Courier New", Courier, monospace; } h1 { font-family: "Arial", Helvetica, sans-serif; } h2 { font-family: "Tahoma", Geneva, sans-serif; } p { font-family: 'Times New Roman', Times, serif; } ul { list-style-type: "square"; } /* Styles for specific classes. */ /* Font to use for commands, such as command names referenced in text */ .command { font-family: "Courier New", Courier, monospace; } /* Titles for figures and tables */ .figure-title { font-family: "Arial", Helvetica, sans-serif; font-size: larger; font-weight: bold; text-align: center; } /* Highight text with yellow background */ .highlight { background-color: yellow; } /* Small notes indicating figure image source text-align: right; */ .image-source { font-family: "Arial", Helvetica, sans-serif; font-size: 8pt; align: right; } /* Styles for command parameter table */ .table-command-parameter { border-collapse: collapse; border: solid; } /* Styles for command parameter table "Parameter" column */ .table-th-command-parameter-name { font-family: "Arial", Helvetica, sans-serif; font-weight: bold; text-align: left; background-color: lightgray; width: 15%; border: solid; border-width: 1px; padding-top: 0in; padding-right: 5.4pt; padding-bottom: 0in; padding-left: 5.4pt; } /* Styles for command parameter table "Description" column */ .table-th-command-parameter-description { font-family: "Arial", Helvetica, sans-serif; font-weight: bold; text-align: left; background-color: lightgray; width: 70%; border: solid; border-width: 1px; padding-top: 0in; padding-right: 5.4pt; padding-bottom: 0in; padding-left: 5.4pt; } /* Styles for command parameter table "Default" column */ .table-th-command-parameter-default { font-family: "Arial", Helvetica, sans-serif; font-weight: bold; text-align: left; background-color: lightgray; width: 15%; border: solid; border-width: 1px; padding-top: 0in; padding-right: 5.4pt; padding-bottom: 0in; padding-left: 5.4pt; } /* Styles for command parameter table cells */ .table-td-command-parameter { text-align: left; border: solid; border-width: 1px; padding-top: 0in; padding-right: 5.4pt; padding-bottom: 0in; padding-left: 5.4pt; } /* References to UI components like menus, buttons, etc. */ .ui { font-family: "Arial", Helvetica, sans-serif; font-style: italic; font-weight: bold; } /* Small notes indicating TSTool version */ .version-note { font-family: "Arial", Helvetica, sans-serif; font-size: 8pt; }
19.901408
72
0.700991
594ab2a01e183595e393c834be00df18aa3fd51b
4,529
h
C
src/base/gui/widget.h
namica/vizzu-lib
4d9473147ff0082e811234ad4c17c95e2eb0bdd7
[ "Apache-2.0" ]
1
2021-12-25T02:03:41.000Z
2021-12-25T02:03:41.000Z
src/base/gui/widget.h
davgit/vizzu-lib
ceae26520f85f745cc41c3bc1bcd44cff0deb6b1
[ "Apache-2.0" ]
null
null
null
src/base/gui/widget.h
davgit/vizzu-lib
ceae26520f85f745cc41c3bc1bcd44cff0deb6b1
[ "Apache-2.0" ]
null
null
null
#ifndef GUI_WIDGET #define GUI_WIDGET #include <memory> #include <functional> #include <iterator> #include <list> #include <string> #include "accessories.h" #include "base/geom/affinetransform.h" #include "base/geom/rect.h" #include "base/gfx/canvas.h" #include "keys.h" #include "mouse.h" namespace GUI { class DragObject; typedef std::shared_ptr<DragObject> DragObjectPtr; class Widget : public std::enable_shared_from_this<Widget> { public: Widget(const Widget *parent); virtual ~Widget(); virtual DragObjectPtr onMouseDown(const Geom::Point &pos); virtual bool onMouseUp(const Geom::Point &pos, DragObjectPtr dragObject); virtual bool onMouseMove(const Geom::Point &pos, DragObjectPtr &dragObject); virtual bool onKeyPress(const Key &key, const KeyModifiers &modifiers); virtual void dragLeft(const DragObjectPtr &dragObject); virtual void onChanged() const; virtual std::string getHint(const Geom::Point &pos); void updateSize(Gfx::ICanvas &canvas, Geom::Size &size); void draw(Gfx::ICanvas&canvas); virtual void setPos(const Geom::Point &pos); Geom::Point getPos() const; void setMargin(const Margin &value); void setExpand(const Directions &enable); void setEnabled(bool enable); void setMinSize(const Geom::Size &size); void setMaxSize(const Geom::Size &size); void setName(const std::string &name); void setEventTransparent(bool transparent); Directions isExpand() const; virtual bool isEnabled() const; virtual bool isPaintable() const; virtual bool isInteractive() const; Gfx::Color getBgColor() const; void setBgColor(const Gfx::Color &color); Geom::Rect getBoundary() const; Geom::Rect getContentRect() const; Geom::AffineTransform getTransform() const; std::string getName() const; std::string getQualifiedName() const; Margin getMargin() const; virtual void clear(); const Widget *getParent() const; protected: template<typename W> std::shared_ptr<W> getAs(const W* = nullptr) { auto res = std::dynamic_pointer_cast<W>(shared_from_this()); if (!res) throw std::logic_error("internal error: invalid widget conversion"); return res; } template<typename W, typename... T> std::weak_ptr<W> emplaceChild(T... params) { children.push_back(std::make_shared<W>(params..., this)); return std::dynamic_pointer_cast<W>(children.back()); } template<typename W, typename... T> std::weak_ptr<W> emplaceChildAt(size_t position, T... params) { auto pos = children.begin(); if (position < children.size()) std::advance(pos, position); else pos = children.end(); auto it = children.insert(pos, std::make_shared<W>(params..., this)); return std::dynamic_pointer_cast<W>(*it); } template <typename W = Widget> void visitChildren(std::function<void(const std::shared_ptr<W>&)> visit, bool recursive) { for (auto child: children) { auto w = std::dynamic_pointer_cast<W>(child); if (w) visit(w); if (recursive) child->visitChildren<W>(visit, recursive); } } const Widget *parent; std::string objName; bool enabled; bool interactive; bool paintable; bool eventTransparent; std::list<std::shared_ptr<Widget>> children; Geom::Rect boundary; Geom::Size minSize; Geom::Size maxSize; Margin margin; Directions expand; Gfx::Color backgroundColor; virtual void setCursor(Cursor cursor) const; virtual void onDraw(Gfx::ICanvas&); virtual void onUpdateSize(Gfx::ICanvas&, Geom::Size &); virtual Geom::AffineTransform getSelfTransform() const; bool isChild(const std::shared_ptr<Widget> &widget); void removeChild(const std::shared_ptr<Widget> &widget); bool swapChild(const std::shared_ptr<Widget> &toRemove, const std::shared_ptr<Widget> &toAdd); void moveToTop(const std::weak_ptr<Widget> &widget); void updateBoundary(); Geom::Rect childrenBoundary() const; std::weak_ptr<Widget> widgetAt(const Geom::Point &pos) const; const Widget *findRoot() const; }; class ContainerWidget : public Widget { public: using Widget::Widget; using Widget::emplaceChild; using Widget::emplaceChildAt; using Widget::removeChild; using Widget::swapChild; using Widget::visitChildren; void moveAfter(const std::shared_ptr<Widget> &child, const std::shared_ptr<Widget> &posChild); }; class WrapperWidget : public Widget { public: using Widget::Widget; template<typename W, typename... T> std::weak_ptr<W> emplaceOnlyChild(T... params) { clear(); onlyChild = this->emplaceChild<W>(params...); return std::dynamic_pointer_cast<W>(onlyChild.lock()); } protected: std::weak_ptr<Widget> onlyChild; }; } #endif
27.785276
89
0.735482
3b97a3643a024f5c708cae45d5ea0f49f4d55b72
592
swift
Swift
GitTest/Scenes/Home/HomeModels.swift
marcosbarbosa1987/GitConsultApi
a71c29583d81c09ee01cd7c4e5d96efffa34860d
[ "MIT" ]
2
2018-10-26T21:52:20.000Z
2019-02-14T18:29:54.000Z
GitTest/Scenes/Home/HomeModels.swift
marcosbarbosa1987/GitConsultApi
a71c29583d81c09ee01cd7c4e5d96efffa34860d
[ "MIT" ]
null
null
null
GitTest/Scenes/Home/HomeModels.swift
marcosbarbosa1987/GitConsultApi
a71c29583d81c09ee01cd7c4e5d96efffa34860d
[ "MIT" ]
null
null
null
// // HomeModels.swift // GitTest // // Created by Marcos Barbosa on 26/07/2018. // Copyright © 2018 n/a. All rights reserved. // import Foundation struct HomeModels{ struct Fetch{ struct Request{ var url: String } struct Response{ var isError: Bool var message: String? var repositories: [Repository]? } struct ViewModel{ var isError: Bool var message: String? var repositories: [Repository]? } } }
17.411765
46
0.494932
166ed3a483b346714b038d03d74eb016920c4eb8
85
ts
TypeScript
build/governance/dictionary/blockchain-nodes-types-dictionary.d.ts
UOSnetwork/ucom.libs.common
f24fecae61a23ba436152ca3b51bcd4752e67ee3
[ "MIT" ]
null
null
null
build/governance/dictionary/blockchain-nodes-types-dictionary.d.ts
UOSnetwork/ucom.libs.common
f24fecae61a23ba436152ca3b51bcd4752e67ee3
[ "MIT" ]
2
2020-06-15T11:28:58.000Z
2021-05-08T21:16:01.000Z
build/governance/dictionary/blockchain-nodes-types-dictionary.d.ts
UOSnetwork/ucom.libs.common
f24fecae61a23ba436152ca3b51bcd4752e67ee3
[ "MIT" ]
1
2020-01-06T18:25:45.000Z
2020-01-06T18:25:45.000Z
export declare const BLOCK_PRODUCERS = 1; export declare const CALCULATOR_NODES = 2;
28.333333
42
0.811765
e8dd9680732e2d43b71a4834c51c94a4f70393dd
4,521
py
Python
displacy_service_tests/test_server.py
mjfox3/spacy-api-docker
8622ae1cc3e18835d4675432f9d286794dd380f5
[ "MIT" ]
null
null
null
displacy_service_tests/test_server.py
mjfox3/spacy-api-docker
8622ae1cc3e18835d4675432f9d286794dd380f5
[ "MIT" ]
1
2019-11-08T14:39:55.000Z
2019-11-08T14:39:55.000Z
displacy_service_tests/test_server.py
mjfox3/spacy-api-docker
8622ae1cc3e18835d4675432f9d286794dd380f5
[ "MIT" ]
1
2019-11-07T14:15:37.000Z
2019-11-07T14:15:37.000Z
import falcon.testing import pytest import json from displacy_service.server import APP, MODELS model = MODELS[0] @pytest.fixture() def api(): return falcon.testing.TestClient(APP) def test_deps(api): result = api.simulate_post( path='/dep', body='{{"text": "This is a test.", "model": "{model}", "collapse_punctuation": false, "collapse_phrases": false}}'.format(model=model) ) result = json.loads(result.text) words = [w['text'] for w in result['words']] assert words == ["This", "is", "a", "test", "."] def test_ents(api): result = api.simulate_post( path='/ent', body='{{"text": "What a great company Google is.", "model": "{model}"}}'.format(model=model)) ents = json.loads(result.text) assert ents == [ {"start": 21, "end": 27, "type": "ORG", "text": "Google"}] def test_sents(api): sentences = api.simulate_post( path='/sents', body='{{"text": "This a test that should split into sentences! This is the second. Is this the third?", "model": "{model}"}}'.format(model=model) ) assert sentences.json == ['This a test that should split into sentences!', 'This is the second.', 'Is this the third?'] def test_sents_dep(api): sentence_parse = api.simulate_post( path='/sents_dep', body='{{"text": "This a test that should split into sentences! This is the second. Is this the third?", "model": "{model}", "collapse_punctuation": false, "collapse_phrases": false}}'.format(model=model) ) sentences = [sp["sentence"] for sp in sentence_parse.json] assert sentences == [ "This a test that should split into sentences!", "This is the second.", "Is this the third?", ] words = [[w["text"] for w in sp["dep_parse"]["words"]] for sp in sentence_parse.json] assert words == [ ["This", "a", "test", "that", "should", "split", "into", "sentences", "!"], ["This", "is", "the", "second", "."], ["Is", "this", "the", "third", "?"], ] arcs = [[arc for arc in sp['dep_parse']['arcs']] for sp in sentence_parse.json] assert arcs == [[{'start': 0, 'end': 2, 'label': 'det', 'text': 'This', 'dir': 'left'}, {'start': 1, 'end': 2, 'label': 'det', 'text': 'a', 'dir': 'left'}, {'start': 2, 'end': 2, 'label': 'ROOT', 'text': 'test', 'dir': 'root'}, {'start': 3, 'end': 5, 'label': 'nsubj', 'text': 'that', 'dir': 'left'}, {'start': 4, 'end': 5, 'label': 'aux', 'text': 'should', 'dir': 'left'}, {'start': 2, 'end': 5, 'label': 'relcl', 'text': 'split', 'dir': 'right'}, {'start': 5, 'end': 6, 'label': 'prep', 'text': 'into', 'dir': 'right'}, {'start': 6, 'end': 7, 'label': 'pobj', 'text': 'sentences', 'dir': 'right'}, {'start': 2, 'end': 8, 'label': 'punct', 'text': '!', 'dir': 'right'}], [{'start': 9, 'end': 10, 'label': 'nsubj', 'text': 'This', 'dir': 'left'}, {'start': 10, 'end': 10, 'label': 'ROOT', 'text': 'is', 'dir': 'root'}, {'start': 11, 'end': 12, 'label': 'det', 'text': 'the', 'dir': 'left'}, {'start': 10, 'end': 12, 'label': 'attr', 'text': 'second', 'dir': 'right'}, {'start': 10, 'end': 13, 'label': 'punct', 'text': '.', 'dir': 'right'}], [{'start': 14, 'end': 14, 'label': 'ROOT', 'text': 'Is', 'dir': 'root'}, {'start': 14, 'end': 15, 'label': 'nsubj', 'text': 'this', 'dir': 'right'}, {'start': 16, 'end': 17, 'label': 'det', 'text': 'the', 'dir': 'left'}, {'start': 14, 'end': 17, 'label': 'attr', 'text': 'third', 'dir': 'right'}, {'start': 14, 'end': 18, 'label': 'punct', 'text': '?', 'dir': 'right'}]] @pytest.mark.parametrize('endpoint, expected_message', [ ('/dep', 'Dependency parsing failed'), ('/ent', 'Text parsing failed'), ('/sents', 'Sentence tokenization failed'), ('/sents_dep', 'Sentence tokenization and Dependency parsing failed'), ]) def test_bad_model_error_handling(endpoint, expected_message, api): response = api.simulate_post( path=endpoint, body='{"text": "Here is some text for testing.", "model": "fake_model"}' ) assert expected_message == response.json['title'] assert "Can't find model 'fake_model'." in response.json["description"]
47.09375
211
0.523114
11d460cb27bfeeb87a1d0753fb781e36b7b95aa8
612
html
HTML
foiamachine/templates/doccloud/detail.html
dwillis/foiamachine
26d3b02870227696cdaab639c39d47b2a7a42ae5
[ "Unlicense", "MIT" ]
9
2017-08-02T16:28:10.000Z
2021-07-19T09:51:46.000Z
foiamachine/templates/doccloud/detail.html
dwillis/foiamachine
26d3b02870227696cdaab639c39d47b2a7a42ae5
[ "Unlicense", "MIT" ]
null
null
null
foiamachine/templates/doccloud/detail.html
dwillis/foiamachine
26d3b02870227696cdaab639c39d47b2a7a42ae5
[ "Unlicense", "MIT" ]
5
2017-10-10T23:15:02.000Z
2021-07-19T09:51:48.000Z
{% extends "base.html" %} {% load url from future %} {% block content %} <div class="body-content"> <!-- TODO: embed private document??? --> <script type="text/javascript" src="http://s3.documentcloud.org/viewer/loader.js"></script> <script type="text/javascript"> DV.load('http://www.documentcloud.org/documents/{{document.dc_properties.dc_id}}.js', { container : 'div#doc' }); </script> <a class="btn btn-large" href="{% url 'docs_list' %}">Return to Docs Listing</a> <hr> <div id="doc" style="height: 1000px;overflow:scroll;"></div> </div> {% endblock %}
36
95
0.612745
c7fae57f341c7f36c0448cee09f8ad16c799b76d
1,112
java
Java
src/main/java/redis/clients/jedis/resps/KeyedZSetElement.java
phambryan/jedis
71cd5f1d13a24b4592ce356ce9ca92ea54a5ea0f
[ "MIT" ]
1,180
2020-10-21T07:30:00.000Z
2022-03-31T08:09:50.000Z
src/main/java/redis/clients/jedis/resps/KeyedZSetElement.java
adedayoominiyi/jedis
52a8ad1379952daa60b59a1cc1992f2ba937d0e0
[ "MIT" ]
587
2020-10-26T07:18:20.000Z
2022-03-31T07:13:49.000Z
src/main/java/redis/clients/jedis/resps/KeyedZSetElement.java
adedayoominiyi/jedis
52a8ad1379952daa60b59a1cc1992f2ba937d0e0
[ "MIT" ]
549
2020-10-22T06:03:11.000Z
2022-03-30T07:16:09.000Z
package redis.clients.jedis.resps; import redis.clients.jedis.Tuple; import redis.clients.jedis.util.SafeEncoder; /** * This class is used to represent a SortedSet element when it is returned with respective key name. */ public class KeyedZSetElement extends Tuple { private final String key; public KeyedZSetElement(byte[] key, byte[] element, Double score) { super(element, score); this.key = SafeEncoder.encode(key); } public KeyedZSetElement(String key, String element, Double score) { super(element, score); this.key = key; } public String getKey() { return key; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof KeyedZSetElement)) return false; if (!key.equals(((KeyedZSetElement) o).key)) return false; return super.equals(o); } @Override public int hashCode() { return 31 * key.hashCode() + super.hashCode(); } @Override public String toString() { return "KeyedZSetElement{" + "key=" + key + ", element='" + getElement() + "'" + ", score=" + getScore() + "} "; } }
23.659574
100
0.659173
409bbe5f2fa7500ff5d95888494977970ae92bc5
1,212
py
Python
key_bot/win32_connectors/screenshotter.py
Jinaz/Py_datascraping
e3f1f8819fe98b257cba356b7378cb6cf90b5d62
[ "Apache-2.0" ]
null
null
null
key_bot/win32_connectors/screenshotter.py
Jinaz/Py_datascraping
e3f1f8819fe98b257cba356b7378cb6cf90b5d62
[ "Apache-2.0" ]
null
null
null
key_bot/win32_connectors/screenshotter.py
Jinaz/Py_datascraping
e3f1f8819fe98b257cba356b7378cb6cf90b5d62
[ "Apache-2.0" ]
null
null
null
import numpy as np import pyautogui import time import cv2 as cv from time import sleep from win32api import GetCursorPos from win32_connectors.VirtualKeycodeLookups import description2keycode as d2k from win32_connectors.KeyBoardLogger import keyIsUp, keyIsDown def demo2(): """Demonstration 2: If the user presses the left mouse button, print the word clicked along with the screen coordinates that were clicked. Then sleep until the key is released.""" left_mouse = d2k['Left mouse button'] quit_key = d2k['Q key'] while keyIsUp(quit_key): sleep(.01) if keyIsDown(d2k['Left mouse button']): x, y = GetCursorPos() print( 'CLICKED {} {}'.format(x, y)) while keyIsDown(d2k['Left mouse button']): sleep(.01) def screenshot(): while keyIsUp(81): if keyIsDown(189): image = pyautogui.screenshot() image = np.array(image) cv.imwrite("../GTA/DATA/{}.png".format(time.time()), image) print("screenshotted") while keyIsDown(189): sleep(.1) def screenshot_to_numpyarray(): image = pyautogui.screenshot() return image
30.3
183
0.637789
3e743ac508be7312fcef80de9de88784fc1a217a
13,531
h
C
Headers/java/lang/reflect/Array.h
tcak76/j2objc
bb9415df98c3fdd1e5e3f4b9e27049d0b2e42633
[ "MIT" ]
11
2015-12-10T13:23:54.000Z
2019-04-23T02:41:13.000Z
Headers/java/lang/reflect/Array.h
tcak76/j2objc
bb9415df98c3fdd1e5e3f4b9e27049d0b2e42633
[ "MIT" ]
7
2015-11-05T22:45:53.000Z
2017-11-05T14:36:36.000Z
Headers/java/lang/reflect/Array.h
tcak76/j2objc
bb9415df98c3fdd1e5e3f4b9e27049d0b2e42633
[ "MIT" ]
40
2015-12-10T07:30:58.000Z
2022-03-15T02:50:10.000Z
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: android/libcore/luni/src/main/java/java/lang/reflect/Array.java // #include "../../../J2ObjC_header.h" #pragma push_macro("INCLUDE_ALL_JavaLangReflectArray") #ifdef RESTRICT_JavaLangReflectArray #define INCLUDE_ALL_JavaLangReflectArray 0 #else #define INCLUDE_ALL_JavaLangReflectArray 1 #endif #undef RESTRICT_JavaLangReflectArray #pragma clang diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #if !defined (JavaLangReflectArray_) && (INCLUDE_ALL_JavaLangReflectArray || defined(INCLUDE_JavaLangReflectArray)) #define JavaLangReflectArray_ @class IOSClass; @class IOSIntArray; /*! @brief Provides static methods to create and access arrays dynamically. */ @interface JavaLangReflectArray : NSObject #pragma mark Public /*! @brief Returns the element of the array at the specified index. Equivalent to <code>array[index]</code>. If the array component is a primitive type, the result is automatically boxed. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (id)getWithId:(id)array withInt:(jint)index; /*! @brief Returns the boolean at the given index in the given boolean array. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array or the element at the index position can not be converted to the return type @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (jboolean)getBooleanWithId:(id)array withInt:(jint)index; /*! @brief Returns the byte at the given index in the given byte array. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array or the element at the index position can not be converted to the return type @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (jbyte)getByteWithId:(id)array withInt:(jint)index; /*! @brief Returns the char at the given index in the given char array. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array or the element at the index position can not be converted to the return type @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (jchar)getCharWithId:(id)array withInt:(jint)index; /*! @brief Returns the double at the given index in the given array. Applies to byte, char, float, double, int, long, and short arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array or the element at the index position can not be converted to the return type @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (jdouble)getDoubleWithId:(id)array withInt:(jint)index; /*! @brief Returns the float at the given index in the given array. Applies to byte, char, float, int, long, and short arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array or the element at the index position can not be converted to the return type @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (jfloat)getFloatWithId:(id)array withInt:(jint)index; /*! @brief Returns the int at the given index in the given array. Applies to byte, char, int, and short arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array or the element at the index position can not be converted to the return type @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (jint)getIntWithId:(id)array withInt:(jint)index; /*! @brief Returns the length of the array. Equivalent to <code>array.length</code>. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array */ + (jint)getLengthWithId:(id)array; /*! @brief Returns the long at the given index in the given array. Applies to byte, char, int, long, and short arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array or the element at the index position can not be converted to the return type @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (jlong)getLongWithId:(id)array withInt:(jint)index; /*! @brief Returns the short at the given index in the given array. Applies to byte and short arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array or the element at the index position can not be converted to the return type @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (jshort)getShortWithId:(id)array withInt:(jint)index; /*! @brief Returns a new multidimensional array of the specified component type and dimensions. Equivalent to <code>new componentType[d0][d1]...[dn]</code> for a dimensions array of { d0, d1, ... , dn }. @throws NullPointerException if <code>array == null</code> @throws NegativeArraySizeException if any of the dimensions are negative @throws IllegalArgumentException if the array of dimensions is of size zero, or exceeds the limit of the number of dimension for an array (currently 255) */ + (id)newInstanceWithIOSClass:(IOSClass *)componentType withIntArray:(IOSIntArray *)dimensions OBJC_METHOD_FAMILY_NONE; /*! @brief Returns a new array of the specified component type and length. Equivalent to <code>new componentType[size]</code>. @throws NullPointerException if the component type is null @throws NegativeArraySizeException if <code>size < 0</code> */ + (id)newInstanceWithIOSClass:(IOSClass *)componentType withInt:(jint)size OBJC_METHOD_FAMILY_NONE; /*! @brief Sets the element of the array at the specified index to the value. Equivalent to <code>array[index] = value</code>. If the array component is a primitive type, the value is automatically unboxed. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if <code>array</code> is not an array or the value cannot be converted to the array type by a widening conversion @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (void)setWithId:(id)array withInt:(jint)index withId:(id)value; /*! @brief Sets <code>array[index] = value</code>. Applies to boolean arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if the <code>array</code> is not an array or the value cannot be converted to the array type by a widening conversion @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (void)setBooleanWithId:(id)array withInt:(jint)index withBoolean:(jboolean)value; /*! @brief Sets <code>array[index] = value</code>. Applies to byte, double, float, int, long, and short arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if the <code>array</code> is not an array or the value cannot be converted to the array type by a widening conversion @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (void)setByteWithId:(id)array withInt:(jint)index withByte:(jbyte)value; /*! @brief Sets <code>array[index] = value</code>. Applies to char, double, float, int, and long arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if the <code>array</code> is not an array or the value cannot be converted to the array type by a widening conversion @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (void)setCharWithId:(id)array withInt:(jint)index withChar:(jchar)value; /*! @brief Sets <code>array[index] = value</code>. Applies to double arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if the <code>array</code> is not an array or the value cannot be converted to the array type by a widening conversion @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (void)setDoubleWithId:(id)array withInt:(jint)index withDouble:(jdouble)value; /*! @brief Sets <code>array[index] = value</code>. Applies to double and float arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if the <code>array</code> is not an array or the value cannot be converted to the array type by a widening conversion @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (void)setFloatWithId:(id)array withInt:(jint)index withFloat:(jfloat)value; /*! @brief Sets <code>array[index] = value</code>. Applies to double, float, int, and long arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if the <code>array</code> is not an array or the value cannot be converted to the array type by a widening conversion @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (void)setIntWithId:(id)array withInt:(jint)index withInt:(jint)value; /*! @brief Sets <code>array[index] = value</code>. Applies to double, float, and long arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if the <code>array</code> is not an array or the value cannot be converted to the array type by a widening conversion @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (void)setLongWithId:(id)array withInt:(jint)index withLong:(jlong)value; /*! @brief Sets <code>array[index] = value</code>. Applies to double, float, int, long, and short arrays. @throws NullPointerException if <code>array == null</code> @throws IllegalArgumentException if the <code>array</code> is not an array or the value cannot be converted to the array type by a widening conversion @throws ArrayIndexOutOfBoundsException if <code>index < 0 || index >= array.length</code> */ + (void)setShortWithId:(id)array withInt:(jint)index withShort:(jshort)value; @end J2OBJC_EMPTY_STATIC_INIT(JavaLangReflectArray) FOUNDATION_EXPORT id JavaLangReflectArray_getWithId_withInt_(id array, jint index); FOUNDATION_EXPORT jboolean JavaLangReflectArray_getBooleanWithId_withInt_(id array, jint index); FOUNDATION_EXPORT jbyte JavaLangReflectArray_getByteWithId_withInt_(id array, jint index); FOUNDATION_EXPORT jchar JavaLangReflectArray_getCharWithId_withInt_(id array, jint index); FOUNDATION_EXPORT jdouble JavaLangReflectArray_getDoubleWithId_withInt_(id array, jint index); FOUNDATION_EXPORT jfloat JavaLangReflectArray_getFloatWithId_withInt_(id array, jint index); FOUNDATION_EXPORT jint JavaLangReflectArray_getIntWithId_withInt_(id array, jint index); FOUNDATION_EXPORT jint JavaLangReflectArray_getLengthWithId_(id array); FOUNDATION_EXPORT jlong JavaLangReflectArray_getLongWithId_withInt_(id array, jint index); FOUNDATION_EXPORT jshort JavaLangReflectArray_getShortWithId_withInt_(id array, jint index); FOUNDATION_EXPORT id JavaLangReflectArray_newInstanceWithIOSClass_withIntArray_(IOSClass *componentType, IOSIntArray *dimensions); FOUNDATION_EXPORT id JavaLangReflectArray_newInstanceWithIOSClass_withInt_(IOSClass *componentType, jint size); FOUNDATION_EXPORT void JavaLangReflectArray_setWithId_withInt_withId_(id array, jint index, id value); FOUNDATION_EXPORT void JavaLangReflectArray_setBooleanWithId_withInt_withBoolean_(id array, jint index, jboolean value); FOUNDATION_EXPORT void JavaLangReflectArray_setByteWithId_withInt_withByte_(id array, jint index, jbyte value); FOUNDATION_EXPORT void JavaLangReflectArray_setCharWithId_withInt_withChar_(id array, jint index, jchar value); FOUNDATION_EXPORT void JavaLangReflectArray_setDoubleWithId_withInt_withDouble_(id array, jint index, jdouble value); FOUNDATION_EXPORT void JavaLangReflectArray_setFloatWithId_withInt_withFloat_(id array, jint index, jfloat value); FOUNDATION_EXPORT void JavaLangReflectArray_setIntWithId_withInt_withInt_(id array, jint index, jint value); FOUNDATION_EXPORT void JavaLangReflectArray_setLongWithId_withInt_withLong_(id array, jint index, jlong value); FOUNDATION_EXPORT void JavaLangReflectArray_setShortWithId_withInt_withShort_(id array, jint index, jshort value); J2OBJC_TYPE_LITERAL_HEADER(JavaLangReflectArray) #endif #pragma clang diagnostic pop #pragma pop_macro("INCLUDE_ALL_JavaLangReflectArray")
37.481994
130
0.751755
40c424b55d9a8898cfadc429ac6a40260e9fc0f8
2,163
py
Python
tsdf/utils.py
changgyhub/semantic-tsdf
4767d92a768af577f75ab05229c9fc87dda9681e
[ "BSD-2-Clause" ]
9
2020-05-07T14:50:20.000Z
2021-12-03T16:20:34.000Z
tsdf/utils.py
irsisyphus/semantic-tsdf
4767d92a768af577f75ab05229c9fc87dda9681e
[ "BSD-2-Clause" ]
1
2020-11-16T02:10:30.000Z
2020-11-17T06:40:03.000Z
tsdf/utils.py
irsisyphus/semantic-tsdf
4767d92a768af577f75ab05229c9fc87dda9681e
[ "BSD-2-Clause" ]
1
2020-11-15T18:30:02.000Z
2020-11-15T18:30:02.000Z
''' TSDF utility functions. ''' import numpy as np # Get corners of 3D camera view frustum of depth image. def get_view_frustum(depth_im, cam_intr, cam_pose): im_h = depth_im.shape[0] im_w = depth_im.shape[1] max_depth = np.max(depth_im) view_frust_pts = np.array([(np.array([0, 0, 0, im_w, im_w]) - cam_intr[0, 2]) * np.array([0, max_depth, max_depth, max_depth, max_depth]) / cam_intr[0, 0], (np.array([0, 0, im_h, 0, im_h]) - cam_intr[1, 2]) * np.array([0, max_depth, max_depth, max_depth, max_depth]) / cam_intr[1, 1], np.array([0, max_depth, max_depth, max_depth, max_depth])]) view_frust_pts = np.dot(cam_pose[:3, :3], view_frust_pts) + np.tile(cam_pose[:3, 3].reshape(3, 1), (1, view_frust_pts.shape[1])) # from camera to world coordinates return view_frust_pts # Save 3D mesh to a polygon .ply file. def meshwrite(filename, verts, faces, norms, colors): # Write header. ply_file = open(filename,'w') ply_file.write("ply\n") ply_file.write("format ascii 1.0\n") ply_file.write("element vertex {:d}\n".format(verts.shape[0])) ply_file.write("property float x\n") ply_file.write("property float y\n") ply_file.write("property float z\n") ply_file.write("property float nx\n") ply_file.write("property float ny\n") ply_file.write("property float nz\n") ply_file.write("property uchar red\n") ply_file.write("property uchar green\n") ply_file.write("property uchar blue\n") ply_file.write("element face {:d}\n".format(faces.shape[0])) ply_file.write("property list uchar int vertex_index\n") ply_file.write("end_header\n") # Write vertex list. for i in range(verts.shape[0]): ply_file.write("{:f} {:f} {:f} {:f} {:f} {:f} {:d} {:d} {:d}\n".format( verts[i, 0], verts[i, 1], verts[i, 2], norms[i, 0], norms[i, 1], norms[i, 2], colors[i, 0], colors[i, 1], colors[i, 2])) # Write face list. for i in range(faces.shape[0]): ply_file.write("3 {:d} {:d} {:d}\n".format(faces[i, 0], faces[i, 1], faces[i, 2])) ply_file.close()
41.596154
168
0.617661
3821ca861ad15d6653c82d3351789b8e27df54b6
3,908
swift
Swift
firebase_restaurant_assignment/firebase_restaurant_assignment/viewcontrollers/AddItemViewController.swift
suwinphyu/iOS_Firebase
d8bab1da85eb4ba7bef39de216a88d86333a4369
[ "MIT" ]
null
null
null
firebase_restaurant_assignment/firebase_restaurant_assignment/viewcontrollers/AddItemViewController.swift
suwinphyu/iOS_Firebase
d8bab1da85eb4ba7bef39de216a88d86333a4369
[ "MIT" ]
null
null
null
firebase_restaurant_assignment/firebase_restaurant_assignment/viewcontrollers/AddItemViewController.swift
suwinphyu/iOS_Firebase
d8bab1da85eb4ba7bef39de216a88d86333a4369
[ "MIT" ]
null
null
null
// // AddItemViewController.swift // firebase_restaurant_assignment // // Created by Su Win Phyu on 10/24/19. // Copyright © 2019 swp. All rights reserved. // import UIKit import Firebase import SDWebImage import FirebaseFirestore class AddItemViewController: UIViewController { static let identifier = "AddItemViewController" static var dataPath : String = "" var imageReference : StorageReference! var imageUrl : String = "" @IBOutlet weak var imgViewUploadImage: UIImageView! @IBOutlet weak var txtAmount: UITextField! @IBOutlet weak var txtFoodName: UITextField! @IBOutlet weak var txtWaitingTime: UITextField! @IBOutlet weak var txtRating: UITextField! @IBOutlet weak var lblFoodItemName: UILabel! var data : String! { didSet{ if let data = data { switch data { case "entress": AddItemViewController.dataPath = Sharedconstants.DB_COLLECTION_PATH_ENTREES break case "drinks": AddItemViewController.dataPath = Sharedconstants.DB_COLLECTION_PATH_DRINKS break case "mains": AddItemViewController.dataPath = Sharedconstants.DB_COLLECTION_PATH_MAINS break case "desserts": AddItemViewController.dataPath = Sharedconstants.DB_COLLECTION_PATH_DESSERTS break default: AddItemViewController.dataPath = Sharedconstants.DB_COLLECTION_PATH_ENTREES break } } } } override func viewDidLoad() { super.viewDidLoad() } @IBAction func btnBack(_ sender: Any) { UIApplication.shared.keyWindow?.rootViewController?.dismiss(animated: true, completion: nil) } @IBAction func btnUploadImage(_ sender: Any) { // to define unique image name let imageName = UUID().uuidString //to build folder and image reference imageReference = Storage.storage().reference().child("images").child(imageName) ImagePickerManager().pickImage(self){(image) in self.imgViewUploadImage.image = image // compress quaity= 0.0 to 1.0 guard let image = self.imgViewUploadImage.image , let data = image.jpegData(compressionQuality: 0.8) else { return } //to upload image to cloud self.imageReference.putData(data, metadata: nil) { (metadata, error) in if let error = error { print(error.localizedDescription) return } } Dialog.showAlert(viewController: self, title: "Success", message: "Image is uploaded successfully") } } func getImageUrl(){ imageReference.downloadURL { (url, error) in if let error = error { print(error.localizedDescription) return } self.imageUrl = url?.path ?? "" // print(self.imageUrl) } } @IBAction func btnCreate(_ sender: Any) { getImageUrl() let db = Firestore.firestore() db.collection(AddItemViewController.dataPath).addDocument(data: [ "amount" :txtAmount.text ?? "" , "food_name" : txtFoodName.text ?? "", "imageUrl" : imageUrl , "rating" : txtRating.text ?? "" , "waiting_time ": txtWaitingTime.text ?? "" ]) Dialog.showAlert(viewController: self, title: "Success", message: "Your item is added successfully.") } }
32.032787
119
0.557574
87667152b5ddbe52b0e4367981677e54f486e77b
6,686
html
HTML
app/content/texts/english_niv/GL1.html
binu-alexander/thevachanonlineproject
33c318bfc8b37de035d9c8e6b2a9bf8dea153b98
[ "MIT" ]
5
2019-12-18T05:17:19.000Z
2020-04-04T07:07:21.000Z
app/content/texts/english_niv/GL1.html
binu-alexander/thevachanonlineproject
33c318bfc8b37de035d9c8e6b2a9bf8dea153b98
[ "MIT" ]
1
2020-04-30T01:25:38.000Z
2020-04-30T01:25:38.000Z
app/content/texts/english_niv/GL1.html
binu-alexander/thevachanonlineproject
33c318bfc8b37de035d9c8e6b2a9bf8dea153b98
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html><head><meta charset='UTF-8' /> <meta name='viewport' content='width=device-width, initial-scale=1.0, user-scalable=no' /> <title>New International Version Galatians 1</title> <link href='latin.css' rel='stylesheet' /> <link href='fallback.css' rel='stylesheet' /> </head><body dir='ltr' class='section-document'> <div class='header'><div class='nav'> <a class='home' href='index.html'> &#9776; </a><a class='location latin' href='GL.html'> Galatians 1 </a> <a class='prev' href='C213.html'> &#9664; </a> <a class='next' href='GL2.html'> &#9654; </a> </div></div> <div class='chapter section GL1 engNIV11 eng GL latin' dir='ltr' data-id='GL1' data-nextid='GL2' data-previd='C213' lang='en-US'><br><div class='mt'>Galatians </div> <div class='c'>1</div> <div class='p'> <span class='v GL1_1' data-id='GL1_1'><span class='verse1 v-num v-1'>1&nbsp;</span>Paul, an apostle—sent not from men nor by a man, but by Jesus Christ and God the Father, who raised him from the dead— </span> <span class='v GL1_2' data-id='GL1_2'><span class='v-num v-2'>2&nbsp;</span>and all the brothers and sisters<span class='note' id='footnote-3037'><a href='#note-3037' class='key'>*</a></span> with me, </span></div> <div class='p'> <span class='v GL1_2' data-id='GL1_2'>To the churches in Galatia: </span></div> <div class='p'> <span class='v GL1_3' data-id='GL1_3'><span class='v-num v-3'>3&nbsp;</span>Grace and peace to you from God our Father and the Lord Jesus Christ, </span> <span class='v GL1_4' data-id='GL1_4'><span class='v-num v-4'>4&nbsp;</span>who gave himself for our sins to rescue us from the present evil age, according to the will of our God and Father, </span> <span class='v GL1_5' data-id='GL1_5'><span class='v-num v-5'>5&nbsp;</span>to whom be glory for ever and ever. Amen. </span></div> <div class='s'>No Other Gospel </div> <div class='p'> <span class='v GL1_6' data-id='GL1_6'><span class='v-num v-6'>6&nbsp;</span>I am astonished that you are so quickly deserting the one who called you to live in the grace of Christ and are turning to a different gospel— </span> <span class='v GL1_7' data-id='GL1_7'><span class='v-num v-7'>7&nbsp;</span>which is really no gospel at all. Evidently some people are throwing you into confusion and are trying to pervert the gospel of Christ. </span> <span class='v GL1_8' data-id='GL1_8'><span class='v-num v-8'>8&nbsp;</span>But even if we or an angel from heaven should preach a gospel other than the one we preached to you, let them be under God’s curse! </span> <span class='v GL1_9' data-id='GL1_9'><span class='v-num v-9'>9&nbsp;</span>As we have already said, so now I say again: If anybody is preaching to you a gospel other than what you accepted, let them be under God’s curse! </span></div> <div class='p'> <span class='v GL1_10' data-id='GL1_10'><span class='v-num v-10'>10&nbsp;</span>Am I now trying to win the approval of human beings, or of God? Or am I trying to please people? If I were still trying to please people, I would not be a servant of Christ. </span></div> <div class='s'>Paul Called by God </div> <div class='p'> <span class='v GL1_11' data-id='GL1_11'><span class='v-num v-11'>11&nbsp;</span>I want you to know, brothers and sisters, that the gospel I preached is not of human origin. </span> <span class='v GL1_12' data-id='GL1_12'><span class='v-num v-12'>12&nbsp;</span>I did not receive it from any man, nor was I taught it; rather, I received it by revelation from Jesus Christ. </span></div> <div class='p'> <span class='v GL1_13' data-id='GL1_13'><span class='v-num v-13'>13&nbsp;</span>For you have heard of my previous way of life in Judaism, how intensely I persecuted the church of God and tried to destroy it. </span> <span class='v GL1_14' data-id='GL1_14'><span class='v-num v-14'>14&nbsp;</span>I was advancing in Judaism beyond many of my own age among my people and was extremely zealous for the traditions of my fathers. </span> <span class='v GL1_15' data-id='GL1_15'><span class='v-num v-15'>15&nbsp;</span>But when God, who set me apart from my mother’s womb and called me by his grace, was pleased </span> <span class='v GL1_16' data-id='GL1_16'><span class='v-num v-16'>16&nbsp;</span>to reveal his Son in me so that I might preach him among the Gentiles, my immediate response was not to consult any human being. </span> <span class='v GL1_17' data-id='GL1_17'><span class='v-num v-17'>17&nbsp;</span>I did not go up to Jerusalem to see those who were apostles before I was, but I went into Arabia. Later I returned to Damascus. </span></div> <div class='p'> <span class='v GL1_18' data-id='GL1_18'><span class='v-num v-18'>18&nbsp;</span>Then after three years, I went up to Jerusalem to get acquainted with Cephas<span class='note' id='footnote-3038'><a href='#note-3038' class='key'>†</a></span> and stayed with him fifteen days. </span> <span class='v GL1_19' data-id='GL1_19'><span class='v-num v-19'>19&nbsp;</span>I saw none of the other apostles—only James, the Lord’s brother. </span> <span class='v GL1_20' data-id='GL1_20'><span class='v-num v-20'>20&nbsp;</span>I assure you before God that what I am writing you is no lie. </span></div> <div class='p'> <span class='v GL1_21' data-id='GL1_21'><span class='v-num v-21'>21&nbsp;</span>Then I went to Syria and Cilicia. </span> <span class='v GL1_22' data-id='GL1_22'><span class='v-num v-22'>22&nbsp;</span>I was personally unknown to the churches of Judea that are in Christ. </span> <span class='v GL1_23' data-id='GL1_23'><span class='v-num v-23'>23&nbsp;</span>They only heard the report: “The man who formerly persecuted us is now preaching the faith he once tried to destroy.” </span> <span class='v GL1_24' data-id='GL1_24'><span class='v-num v-24'>24&nbsp;</span>And they praised God because of me. </span></div></div> <div class='footnotes'> <span class='footnote' id='note-3037'><span class='key'>* </span><a href='#footnote-3037' class='backref'>1:2</a> <span class='text'><span class="ft"> The Greek word for </span><span class="fqa">brothers and sisters </span><span class="ft"> (</span><span class="fqa">adelphoi</span><span class="ft">) refers here to believers, both men and women, as part of God’s family; also in verse 11; and in 3:15; 4:12, 28, 31; 5:11, 13; 6:1, 18.</span></span></span> <span class='footnote' id='note-3038'><span class='key'>† </span><a href='#footnote-3038' class='backref'>1:18</a> <span class='text'><span class="ft"> That is, Peter</span></span></span> </div> <div class='footer'><div class='nav'> <a class='prev' href='C213.html'>&#9664;</a> <a class='home' href='index.html'>&#9776;</a> <a class='next' href='GL2.html'>&#9654;</a> </div></div> </body></html>
106.126984
456
0.697577
04fbf28e66f4777dc9f098dded8a85c758784ceb
1,383
kt
Kotlin
unlockable/core/src/main/kotlin/com/rarible/protocol/unlockable/configuration/CoreConfiguration.kt
NFTDroppr/ethereum-indexer
b1efdaceab8be95429befe80ce1092fab3004d18
[ "MIT" ]
1
2021-10-20T19:57:06.000Z
2021-10-20T19:57:06.000Z
unlockable/core/src/main/kotlin/com/rarible/protocol/unlockable/configuration/CoreConfiguration.kt
NFTDroppr/ethereum-indexer
b1efdaceab8be95429befe80ce1092fab3004d18
[ "MIT" ]
null
null
null
unlockable/core/src/main/kotlin/com/rarible/protocol/unlockable/configuration/CoreConfiguration.kt
NFTDroppr/ethereum-indexer
b1efdaceab8be95429befe80ce1092fab3004d18
[ "MIT" ]
null
null
null
package com.rarible.protocol.unlockable.configuration import com.rarible.core.mongo.configuration.EnableRaribleMongo import com.rarible.ethereum.converters.EnableScaletherMongoConversions import com.rarible.ethereum.domain.Blockchain import com.rarible.protocol.unlockable.converter.LockDtoConverter import com.rarible.protocol.unlockable.event.LockEventListener import com.rarible.protocol.unlockable.repository.LockRepository import org.springframework.beans.factory.annotation.Value import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.annotation.Bean import org.springframework.context.annotation.ComponentScan import org.springframework.context.annotation.Configuration import org.springframework.data.mongodb.repository.config.EnableReactiveMongoRepositories @Configuration @EnableRaribleMongo @EnableScaletherMongoConversions @EnableReactiveMongoRepositories(basePackageClasses = [LockRepository::class]) @EnableConfigurationProperties(LockEventProducerProperties::class) @ComponentScan( basePackageClasses = [ LockDtoConverter::class, LockEventListener::class, LockRepository::class ] ) class CoreConfiguration { @Value("\${common.blockchain}") private lateinit var blockchain: Blockchain @Bean fun blockchain(): Blockchain { return blockchain } }
36.394737
89
0.831526
fba2bb25fce2e675e4a601393227abed2c0da852
566
h
C
RenderUI/common/Encoding.h
gubaojian/LayoutCore
061d38059c461f1cff604920b3d9357a08884b13
[ "MIT" ]
null
null
null
RenderUI/common/Encoding.h
gubaojian/LayoutCore
061d38059c461f1cff604920b3d9357a08884b13
[ "MIT" ]
null
null
null
RenderUI/common/Encoding.h
gubaojian/LayoutCore
061d38059c461f1cff604920b3d9357a08884b13
[ "MIT" ]
null
null
null
// // Created by furture on 2018/6/1. // #ifndef RENDERUI_ENCODING_H #define RENDERUI_ENCODING_H #include <unitypes.h> #include <set> namespace RenderUI { namespace Encoding{ /** * */ static std::set<uint32_t> breakCodePoints = {':', ' ', '=', ','}; bool isBreak(uint32_t codePoint); /*** * return codePoint length, put codePoint value in codePoint * */ short next_utf32_code_point_len(const char* utf8, int offset, int end, uint32_t* codePoint); }; } #endif //RENDERUI_ENCODING_H
18.258065
100
0.609541
e50f2558ec72efc9c61292b07195f14d342938d4
42,512
html
HTML
ida/218375.html
depctg/mhgu_attack
d3d063d2507a3157d97028d818355b97c44b5037
[ "MIT" ]
null
null
null
ida/218375.html
depctg/mhgu_attack
d3d063d2507a3157d97028d818355b97c44b5037
[ "MIT" ]
null
null
null
ida/218375.html
depctg/mhgu_attack
d3d063d2507a3157d97028d818355b97c44b5037
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=Edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0,shrink-to-fit=no"> <meta name="description" content="石子的入手方法、使い道を掲載。入手は任务报酬、怪物剥ぎ取り、フィールド采集之ど。用途は武器、防具、装饰品之ど。"> <meta name="keywords" content="石子,入手方法,MHXX,怪物猎人,怪物猎人双十字"> <title> 石子 | 【MHXX】怪物猎人双十字攻略大全 </title> <link rel="stylesheet" media="all" href="../index.css"> <script src="../assets/application-53ee482db9501c259f1cd8e29154fa3f.js"></script> <!--[if lt IE 9]> <script src="../js/html5shiv.js"></script> <script src="../js/respond.js"></script> <![endif]--> <script> $('body').on('contextmenu selectstart copy cut', false); </script> </head> <body id="body_game" > <!-- suc_gen --> <div id="main_1"> <div class="data1"> <h2 class="c_black">石子 - 【MHXX】怪物猎人双十字</h2> <ul id="bread"> <li><a href="../index.html">【MHXX】怪物猎人双十字攻略</a></li> <li class="active">道具</li> <li class="active"><a href="../data/2101.html">あ行的道具</a></li> </ul> <div id="navi1"> <h3>道具相关数据</h3> <div style="background-color:#EFF3FA;padding:5px;margin-bottom:20px;"> <span style="font-weight:bold;color:#666;">[全表示]</span><br> <a href="../data/2100.html">道具一览表</a>&ensp; <br> <span style="font-weight:bold;color:#666;">[50音別]</span><br> <span class="select_page"><a href="../data/2101.html">あ行的道具</a></span>&ensp; <a href="../data/2102.html">か行的道具</a>&ensp; <a href="../data/2103.html">さ行的道具</a>&ensp; <a href="../data/2104.html">た行的道具</a>&ensp; <a href="../data/2105.html">之行的道具</a>&ensp; <a href="../data/2106.html">は行的道具</a>&ensp; <a href="../data/2107.html">ま行的道具</a>&ensp; <a href="../data/2108.html">や行的道具</a>&ensp; <a href="../data/2109.html">ら行的道具</a>&ensp; <a href="../data/2110.html">わ行的道具</a>&ensp; <br> <span style="font-weight:bold;color:#666;">[种类別]</span><br> <a href="../data/2114.html">虫</a>&ensp; <a href="../data/2111.html">虫饵</a>&ensp; <a href="../data/2115.html">魚</a>&ensp; <a href="../data/2984.html">植物</a>&ensp; <a href="../data/2112.html">矿石・块</a>&ensp; <a href="../data/2113.html">护身符・铠玉・珠</a>&ensp; <a href="../data/2985.html">消耗品</a>&ensp; <a href="../data/2119.html">精算道具</a>&ensp; <a href="../data/2118.html">券・币</a>&ensp; <a href="../data/2117.html">配信</a>&ensp; <a href="../data/2959.html">狩猎证</a>&ensp; <a href="../data/2116.html">端材</a>&ensp; </div> </div> <div class="row_x"> <div class="col-md-10"> <table class="t2"> <tr id="id218375"> <th>名称</th> <td colspan="5"> <span class="b">石子</span> <br> <span style="font-size:90%;">いしころ</span> <br> </td> </tr> <tr> <th width="16%">稀有度度</th> <td width="16%" class="c_g b">1</td> <th width="16%">所持</th> <td width="16%" class="c_g b">99</td> <th width="16%">売値</th> <td width="16%" class="c_g b"><span class="cpg1_1"></span></td> </tr> <tr> <th>説明</th> <td class="left" colspan="5"> 小さ之石子。投げるこ与がで色る。 </td> </tr> </table> <div style="text-align:center;margin-bottom:5px;"> <style type="text/css"> .adslot_middle1r { display:inline-block; width: 320px; height: 100px; } @media (min-width:500px) { .adslot_middle1r { display:inline-block; width: 468px; height: 60px; } } @media (min-width:760px) { .adslot_middle1r { display:inline-block; width: 728px; height: 90px; } } @media (min-width:992px) { .adslot_middle1r { display: none; } } </style> <!-- data中央ビッグバナー1 --> </div> <table class="t1 t_sp"> <tr> <td class="get_item1"><span class="c_g">[入手]</span><br>ふらっ与<br>猎人</td> <td class="left get_item2"> <span style="color:#999;">[ふら]</span> <a href="../ida/265874.html">【下位】旧沙漠</a> 2个 <span class="gb">15%</span><br> <span style="color:#999;">[ふら]</span> <a href="../ida/265876.html">【下位】雪山</a> 2个 <span class="gb">15%</span><br> <span style="color:#999;">[ふら]</span> <a href="../ida/265939.html">【上位】雪山</a> 4个 <span class="gb">10%</span><br> <span style="color:#999;">[ふら]</span> <a href="../ida/341444.html">【G级】雪山</a> 4个 <span class="gb">10%</span><br> </td> </tr> <tr> <td class="get_item1"><span class="c_g">[入手]</span><br>随从猫任务<br>区域报酬</td> <td class="left get_item2"> <span style="color:#999;">[モン]</span> <a href="../ida/265191.html">【下位】随从猫任务-沙漠-共通</a> <span style="color:#999;">通常</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265191.html">【下位】随从猫任务-沙漠-共通</a> <span style="color:#ffbb00;">稀有度</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265191.html">【下位】随从猫任务-沙漠-共通</a> <span style="color:#ffbb00;">稀有度</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265202.html">【下位】随从猫任务-寒冷-共通</a> <span style="color:#999;">通常</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265202.html">【下位】随从猫任务-寒冷-共通</a> <span style="color:#ffbb00;">稀有度</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265212.html">【下位】随从猫任务-湿原-共通</a> <span style="color:#999;">通常</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265212.html">【下位】随从猫任务-湿原-共通</a> <span style="color:#ffbb00;">稀有度</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265251.html">【上位】随从猫任务-沙漠-共通</a> <span style="color:#999;">通常</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265251.html">【上位】随从猫任务-沙漠-共通</a> <span style="color:#ffbb00;">稀有度</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265262.html">【上位】随从猫任务-寒冷-共通</a> <span style="color:#999;">通常</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265262.html">【上位】随从猫任务-寒冷-共通</a> <span style="color:#ffbb00;">稀有度</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265272.html">【上位】随从猫任务-湿原-共通</a> <span style="color:#999;">通常</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/265272.html">【上位】随从猫任务-湿原-共通</a> <span style="color:#ffbb00;">稀有度</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/343174.html">【G级】随从猫任务-沙漠-共通</a> <span style="color:#999;">通常</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/343174.html">【G级】随从猫任务-沙漠-共通</a> <span style="color:#ffbb00;">稀有度</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/343185.html">【G级】随从猫任务-寒冷-共通</a> <span style="color:#999;">通常</span> <br> <span style="color:#999;">[モン]</span> <a href="../ida/343185.html">【G级】随从猫任务-寒冷-共通</a> <span style="color:#ffbb00;">稀有度</span> <br> </td> </tr> <tr> <td class="get_item1"><span class="c_g">[入手]</span><br>交易</td> <td class="left get_item2"> <a href="../data/2827.html#id267247">交易【ぽかぽかファーム】</a> <span class="gb">ハズレ</span> <br> </td> </tr> <tr> <td class="get_item1"><span class="c_g">[入手]</span><br>地图</td> <td class="left get_item2"> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271183">1-2 采取</a> 8-10回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271184">1-2 采取</a> 8-10回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271260">3-2 采掘</a> 3-5回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271272">3-5 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271280">3-6 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271340">5-3 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271425">7-4 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271446">8-1 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271494">9-3 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★古代林] <a href="../data/2400.html#id271562">11-3 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★古代林] <a href="../data/2400.html#id271597">1-2 采取</a> 8-10回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★古代林] <a href="../data/2400.html#id271598">1-2 采取</a> 8-10回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★古代林] <a href="../data/2400.html#id346740">1-2 采取</a> 8-10回 <span class="gb">20%</span> <br> [<span style="color:#cc33cc;">G级</span>★古代林] <a href="../data/2400.html#id346741">1-2 采取</a> 8-10回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★旧沙漠] <a href="../data/2412.html#id272130">1-1 采掘</a> 2-3回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★旧沙漠] <a href="../data/2412.html#id272174">3-1 采掘</a> 3-4回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★旧沙漠] <a href="../data/2412.html#id272217">4-2 采掘</a> 2-3回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★旧沙漠] <a href="../data/2412.html#id272287">6-4 采取</a> 5-7回 <span class="gb">8%</span> <br> [<span style="color:green;">下位</span>★旧沙漠] <a href="../data/2412.html#id272320">7-1 采掘</a> 2-3回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★旧沙漠] <a href="../data/2412.html#id272325">7-2 采掘</a> 2-3回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★旧沙漠] <a href="../data/2412.html#id272501">1-1 采掘</a> 2-3回 <span class="gb">15%</span> <br> [<span style="color:red;">上位</span>★旧沙漠] <a href="../data/2412.html#id272548">3-1 采掘</a> 3-4回 <span class="gb">15%</span> <br> [<span style="color:red;">上位</span>★旧沙漠] <a href="../data/2412.html#id272599">4-2 采掘</a> 2-3回 <span class="gb">15%</span> <br> [<span style="color:red;">上位</span>★旧沙漠] <a href="../data/2412.html#id272689">6-4 采取</a> 5-7回 <span class="gb">8%</span> <br> [<span style="color:red;">上位</span>★旧沙漠] <a href="../data/2412.html#id272727">7-1 采掘</a> 2-3回 <span class="gb">15%</span> <br> [<span style="color:red;">上位</span>★旧沙漠] <a href="../data/2412.html#id272734">7-2 采掘</a> 3-4回 <span class="gb">15%</span> <br> [<span style="color:#cc33cc;">G级</span>★旧沙漠] <a href="../data/2412.html#id348150">6-4 采取</a> 5-7回 <span class="gb">8%</span> <br> [<span style="color:green;">下位</span>★森丘] <a href="../data/2404.html#id273055">5-1 采掘</a> 3-5回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★森丘] <a href="../data/2404.html#id273092">6-1 采掘</a> 3-5回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★森丘] <a href="../data/2404.html#id273255">11-3 采取</a> 8-12回 <span class="gb">40%</span> <br> [<span style="color:green;">下位</span>★森丘] <a href="../data/2404.html#id273258">11-3 采取</a> 8-12回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★森丘] <a href="../data/2404.html#id273262">11-5 采取</a> ∞回 <span class="gb">15%</span> <br> [<span style="color:red;">上位</span>★森丘] <a href="../data/2404.html#id273660">11-3 采取</a> 8-12回 <span class="gb">40%</span> <br> [<span style="color:red;">上位</span>★森丘] <a href="../data/2404.html#id273663">11-3 采取</a> 8-12回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★森丘] <a href="../data/2404.html#id273667">11-5 采取</a> ∞回 <span class="gb">15%</span> <br> [<span style="color:#cc33cc;">G级</span>★森丘] <a href="../data/2404.html#id348752">11-3 采取</a> 8-12回 <span class="gb">40%</span> <br> [<span style="color:#cc33cc;">G级</span>★森丘] <a href="../data/2404.html#id348755">11-3 采取</a> 8-12回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★森丘] <a href="../data/2404.html#id348759">11-5 采取</a> ∞回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273748">2-1 采掘</a> 4-6回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273763">2-5 采掘</a> <span class="b" style="color:#999;">変</span> 4-6回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273813">4-2 采取</a> 4-6回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273814">4-2 采取</a> 4-6回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273844">5-5 采掘</a> <span class="b" style="color:#999;">変</span> 4-6回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273859">6-2 采取</a> 2-4回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273861">6-2 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273891">7-3 采取</a> 2-4回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273893">7-3 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273917">8-2 采取</a> 2-4回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★雪山] <a href="../data/2406.html#id273919">8-2 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★雪山] <a href="../data/2406.html#id274078">4-2 采取</a> 4-6回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★雪山] <a href="../data/2406.html#id274080">4-2 采取</a> 4-6回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★雪山] <a href="../data/2406.html#id274139">6-2 采取</a> 2-4回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★雪山] <a href="../data/2406.html#id274141">6-2 采取</a> 2-4回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★雪山] <a href="../data/2406.html#id274180">7-3 采取</a> 2-4回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★雪山] <a href="../data/2406.html#id274182">7-3 采取</a> 2-4回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★雪山] <a href="../data/2406.html#id274209">8-2 采取</a> 2-4回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★雪山] <a href="../data/2406.html#id274211">8-2 采取</a> 2-4回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★雪山] <a href="../data/2406.html#id347382">4-2 采取</a> 4-6回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★雪山] <a href="../data/2406.html#id347384">4-2 采取</a> 4-6回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★雪山] <a href="../data/2406.html#id347443">6-2 采取</a> 2-4回 <span class="gb">20%</span> <br> [<span style="color:#cc33cc;">G级</span>★雪山] <a href="../data/2406.html#id347445">6-2 采取</a> 2-4回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★雪山] <a href="../data/2406.html#id347484">7-3 采取</a> 2-4回 <span class="gb">20%</span> <br> [<span style="color:#cc33cc;">G级</span>★雪山] <a href="../data/2406.html#id347486">7-3 采取</a> 2-4回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★雪山] <a href="../data/2406.html#id347514">8-2 采取</a> 2-4回 <span class="gb">20%</span> <br> [<span style="color:#cc33cc;">G级</span>★雪山] <a href="../data/2406.html#id347516">8-2 采取</a> 2-4回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★溪流] <a href="../data/2403.html#id274257">1-2 采取</a> 6-8回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★溪流] <a href="../data/2403.html#id274258">1-2 采取</a> 6-8回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★溪流] <a href="../data/2403.html#id274393">6-2 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★溪流] <a href="../data/2403.html#id274469">8-2 采取</a> 6-8回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★溪流] <a href="../data/2403.html#id274470">8-2 采取</a> 6-8回 <span class="gb">15%</span> <br> [<span style="color:red;">上位</span>★溪流] <a href="../data/2403.html#id274534">1-2 采取</a> 6-8回 <span class="gb">25%</span> <br> [<span style="color:red;">上位</span>★溪流] <a href="../data/2403.html#id274535">1-2 采取</a> 6-8回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★溪流] <a href="../data/2403.html#id274721">6-2 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★溪流] <a href="../data/2403.html#id274819">8-2 采取</a> 6-8回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★溪流] <a href="../data/2403.html#id274820">8-2 采取</a> 6-8回 <span class="gb">15%</span> <br> [<span style="color:#cc33cc;">G级</span>★溪流] <a href="../data/2403.html#id348807">1-2 采取</a> 6-8回 <span class="gb">25%</span> <br> [<span style="color:#cc33cc;">G级</span>★溪流] <a href="../data/2403.html#id348808">1-2 采取</a> 6-8回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★溪流] <a href="../data/2403.html#id348976">6-2 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★溪流] <a href="../data/2403.html#id349079">8-2 采取</a> 6-8回 <span class="gb">25%</span> <br> [<span style="color:#cc33cc;">G级</span>★溪流] <a href="../data/2403.html#id349080">8-2 采取</a> 6-8回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★孤岛] <a href="../data/2402.html#id274903">1-2 采取</a> 6-8回 <span class="gb">25%</span> <br> [<span style="color:green;">下位</span>★孤岛] <a href="../data/2402.html#id274904">1-2 采取</a> 6-8回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★孤岛] <a href="../data/2402.html#id275131">7-2 采取</a> 3-5回 <span class="gb">25%</span> <br> [<span style="color:green;">下位</span>★孤岛] <a href="../data/2402.html#id275132">7-2 采取</a> 3-5回 <span class="gb">20%</span> <br> [<span style="color:green;">下位</span>★孤岛] <a href="../data/2402.html#id275229">10-4 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★孤岛] <a href="../data/2402.html#id275258">1-2 采取</a> 6-8回 <span class="gb">30%</span> <br> [<span style="color:red;">上位</span>★孤岛] <a href="../data/2402.html#id275259">1-2 采取</a> 6-8回 <span class="gb">15%</span> <br> [<span style="color:red;">上位</span>★孤岛] <a href="../data/2402.html#id275549">7-2 采取</a> 3-5回 <span class="gb">30%</span> <br> [<span style="color:red;">上位</span>★孤岛] <a href="../data/2402.html#id275550">7-2 采取</a> 3-5回 <span class="gb">15%</span> <br> [<span style="color:red;">上位</span>★孤岛] <a href="../data/2402.html#id275678">10-4 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★孤岛] <a href="../data/2402.html#id349171">1-2 采取</a> 6-8回 <span class="gb">30%</span> <br> [<span style="color:#cc33cc;">G级</span>★孤岛] <a href="../data/2402.html#id349172">1-2 采取</a> 6-8回 <span class="gb">15%</span> <br> [<span style="color:#cc33cc;">G级</span>★孤岛] <a href="../data/2402.html#id349445">7-2 采取</a> 3-5回 <span class="gb">30%</span> <br> [<span style="color:#cc33cc;">G级</span>★孤岛] <a href="../data/2402.html#id349446">7-2 采取</a> 3-5回 <span class="gb">15%</span> <br> [<span style="color:#cc33cc;">G级</span>★孤岛] <a href="../data/2402.html#id349561">10-4 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★沼地] <a href="../data/2405.html#id275731">1-5 采取</a> 4-6回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★沼地] <a href="../data/2405.html#id275752">2-1 采取</a> 4-6回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★沼地] <a href="../data/2405.html#id275948">7-2 采取</a> 4-6回 <span class="gb">25%</span> <br> [<span style="color:green;">下位</span>★沼地] <a href="../data/2405.html#id275965">7-4 采掘</a> <span class="b" style="color:#999;">変</span> 4-6回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★沼地] <a href="../data/2405.html#id276024">9-1 采掘</a> ∞回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★沼地] <a href="../data/2405.html#id276033">9-3 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★沼地] <a href="../data/2405.html#id276035">9-4 采取</a> 8-10回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★沼地] <a href="../data/2405.html#id276036">9-4 采取</a> 8-10回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★沼地] <a href="../data/2405.html#id276042">9-5 采掘</a> <span class="b" style="color:#999;">変</span> 4-6回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★沼地] <a href="../data/2405.html#id276079">1-5 采取</a> 4-6回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★沼地] <a href="../data/2405.html#id276102">2-1 采取</a> 4-6回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★沼地] <a href="../data/2405.html#id276323">7-2 采取</a> 4-6回 <span class="gb">25%</span> <br> [<span style="color:red;">上位</span>★沼地] <a href="../data/2405.html#id276418">9-1 采掘</a> ∞回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★沼地] <a href="../data/2405.html#id276432">9-3 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★沼地] <a href="../data/2405.html#id276434">9-4 采取</a> 8-10回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★沼地] <a href="../data/2405.html#id276435">9-4 采取</a> 8-10回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★沼地] <a href="../data/2405.html#id349629">1-5 采取</a> 4-6回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★沼地] <a href="../data/2405.html#id349649">2-1 采取</a> 4-6回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★沼地] <a href="../data/2405.html#id349863">7-2 采取</a> 4-6回 <span class="gb">25%</span> <br> [<span style="color:#cc33cc;">G级</span>★沼地] <a href="../data/2405.html#id349953">9-1 采掘</a> ∞回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★沼地] <a href="../data/2405.html#id349967">9-3 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★沼地] <a href="../data/2405.html#id349969">9-4 采取</a> 8-10回 <span class="gb">20%</span> <br> [<span style="color:#cc33cc;">G级</span>★沼地] <a href="../data/2405.html#id349970">9-4 采取</a> 8-10回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276547">3-1 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276548">3-1 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276590">4-2 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276591">4-2 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276663">6-2 采取</a> ∞回 <span class="gb">15%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276664">6-2 采取</a> ∞回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276685">7-1 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276686">7-1 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276760">9-2 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276761">9-2 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276763">9-3 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:green;">下位</span>★火山] <a href="../data/2407.html#id276764">9-3 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id276898">3-1 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id276899">3-1 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id276950">4-2 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id276951">4-2 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id277040">6-2 采取</a> ∞回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id277041">6-2 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id277066">7-1 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id277067">7-1 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id277158">9-2 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id277159">9-2 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id277161">9-3 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:red;">上位</span>★火山] <a href="../data/2407.html#id277162">9-3 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id345979">3-1 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id345980">3-1 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346031">4-2 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346032">4-2 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346117">6-2 采取</a> ∞回 <span class="gb">20%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346118">6-2 采取</a> ∞回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346144">7-1 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346145">7-1 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346234">9-2 采取</a> 2-4回 <span class="gb">30%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346235">9-2 采取</a> 2-4回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346237">9-3 采取</a> 3-5回 <span class="gb">30%</span> <br> [<span style="color:#cc33cc;">G级</span>★火山] <a href="../data/2407.html#id346238">9-3 采取</a> 3-5回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★遗迹平原] <a href="../data/2408.html#id277386">3-4 采取</a> 5-7回 <span class="gb">25%</span> <br> [<span style="color:red;">上位</span>★遗迹平原] <a href="../data/2408.html#id277387">3-4 采取</a> 5-7回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★遗迹平原] <a href="../data/2408.html#id350195">3-4 采取</a> 5-7回 <span class="gb">25%</span> <br> [<span style="color:#cc33cc;">G级</span>★遗迹平原] <a href="../data/2408.html#id350196">3-4 采取</a> 5-7回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★原生林] <a href="../data/2409.html#id277789">2-5 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★原生林] <a href="../data/2409.html#id277839">3-5 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★原生林] <a href="../data/2409.html#id277886">5-1 采掘</a> 3-5回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★原生林] <a href="../data/2409.html#id278033">8-3 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★原生林] <a href="../data/2409.html#id278059">9-1 采掘</a> 3-5回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★原生林] <a href="../data/2409.html#id278099">10-2 采取</a> 5-8回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★原生林] <a href="../data/2409.html#id350594">2-5 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★原生林] <a href="../data/2409.html#id350646">3-5 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★原生林] <a href="../data/2409.html#id350695">5-1 采掘</a> 3-5回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★原生林] <a href="../data/2409.html#id350817">8-3 采掘</a> <span class="b" style="color:#999;">変</span> 3-5回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★原生林] <a href="../data/2409.html#id350856">9-1 采掘</a> 3-5回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★原生林] <a href="../data/2409.html#id350895">10-2 采取</a> 5-8回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★冰海] <a href="../data/2410.html#id278132">2-2 采取</a> 7-10回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★冰海] <a href="../data/2410.html#id347578">2-2 采取</a> 7-10回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★地底火山] <a href="../data/2411.html#id278751">9-4 采取</a> ∞回 <span class="gb">8%</span> <br> [<span style="color:red;">上位</span>★地底火山] <a href="../data/2411.html#id278799">10-1 采取</a> 5-7回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★地底火山] <a href="../data/2411.html#id346684">9-4 采取</a> ∞回 <span class="gb">8%</span> <br> [<span style="color:#cc33cc;">G级</span>★地底火山] <a href="../data/2411.html#id346715">10-1 采取</a> 5-7回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★沙漠] <a href="../data/2969.html#id351673">1-5 采取</a> 6-8回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★沙漠] <a href="../data/2969.html#id351674">1-5 采取</a> 6-8回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★沙漠] <a href="../data/2969.html#id352009">1-5 采取</a> 6-8回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★沙漠] <a href="../data/2969.html#id352010">1-5 采取</a> 6-8回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★密林] <a href="../data/2975.html#id352338">BC-3 采取</a> 6-8回 <span class="gb">20%</span> <br> [<span style="color:red;">上位</span>★密林] <a href="../data/2975.html#id352339">BC-3 采取</a> 6-8回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★密林] <a href="../data/2975.html#id352731">BC-3 采取</a> 6-8回 <span class="gb">20%</span> <br> [<span style="color:#cc33cc;">G级</span>★密林] <a href="../data/2975.html#id352732">BC-3 采取</a> 6-8回 <span class="gb">10%</span> <br> [<span style="color:red;">上位</span>★遗群岭] <a href="../data/2968.html#id350920">BC-3 采取</a> 10-12回 <span class="gb">10%</span> <br> [<span style="color:#cc33cc;">G级</span>★遗群岭] <a href="../data/2968.html#id351290">BC-3 采取</a> 10-12回 <span class="gb">10%</span> <br> [<span style="color:green;">下位</span>★禁足地] <a href="../data/2845.html#id278847">1-1 采取</a> 5-7回 <span class="gb">5%</span> <br> [<span style="color:green;">下位</span>★禁足地] <a href="../data/2845.html#id278848">1-1 采取</a> 5-7回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★禁足地] <a href="../data/2845.html#id278853">1-1 采取</a> 5-7回 <span class="gb">5%</span> <br> [<span style="color:red;">上位</span>★禁足地] <a href="../data/2845.html#id278854">1-1 采取</a> 5-7回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★禁足地] <a href="../data/2845.html#id350039">1-1 采取</a> 5-7回 <span class="gb">5%</span> <br> [<span style="color:#cc33cc;">G级</span>★禁足地] <a href="../data/2845.html#id350040">1-1 采取</a> 5-7回 <span class="gb">5%</span> <br> </td> </tr> <tr> <td class="get_item1"><span class="c_g">[入手]</span><br>任务报酬</td> <td class="left get_item2"> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219134.html">村★1历史悠久的龙琥珀</a> 2个 <span class="gb">20%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219134.html">村★1历史悠久的龙琥珀</a> 3个 <span class="gb">15%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/218317.html">村★2狩猎黄速龙王!</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/218318.html">村★2遨游与大地的怪物</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/218319.html">村★2讨伐黄速龙作战!</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/218320.html">村★2迫近的小盾蟹包围网</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/218321.html">村★2沙漠恩惠的交纳委托</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/218322.html">村★2追寻幻之肝!</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/218323.html">村★2交纳旧沙漠的精算道具</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220159.html">村★2雪山的闹事者</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220160.html">村★2讨伐白速龙群!</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220161.html">村★2小雪狮群</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220162.html">村★2摘取雪山草</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220163.html">村★2交纳雪山的精算道具</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220175.html">村★3盾虫的行动研究</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220176.html">村★3在旧沙漠争夺地盘喵!!</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220177.html">村★3流行倾向・药效的肝</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220183.html">村★3挑战雪山鹿料理喵!</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220185.html">村★3悄悄靠近的气息</a> <span class="gb">12%</span><br> [<span style="color:green;">副任务</span>] <a href="../ida/218332.html">村★3野性满满的皇家甲虫</a> 4个 <span class="gb">10%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/218335.html">村★3香气四溢的溪流矿石</a> 4个 <span class="gb">10%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220203.html">村★4挖掘未知的矿石</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220210.html">村★4行商修行</a> 4个 <span class="gb">10%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/238192.html">村★4雪山的点数捜索队!</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/285984.html">村★7给行商捣乱的白速龙王</a> 4个 <span class="gb">8%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/288246.html">村★9旧沙漠的招财猫</a> 2个 <span class="gb">10%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219147.html">集★1狩猎黄速龙王!</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219148.html">集★1追踪沙龙!</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219149.html">集★1铁壁的盾蟹</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219150.html">集★1盾蟹们的集合</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220241.html">集★1新的食材猎人诞生!?</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219155.html">集★1雪之白兔兽</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219156.html">集★1肉食龙的讨伐!</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219157.html">集★1寻找雪山草!</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219162.html">集★1挖掘花香</a> 4个 <span class="gb">10%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/219164.html">集★1药膳汤需要雪山草</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220250.html">集★2盾虫的行动研究</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220251.html">集★2追寻幻之肝!</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/220255.html">集★2小雪狮讨伐作战</a> <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/314981.html">集★4強敵、白速龙王出现!</a> 4个 <span class="gb">8%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/238228.html">集★4魚龙的肝最重要的就是新鲜</a> 2个 <span class="gb">10%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/238252.html">集★6好工作</a> 2个 <span class="gb">10%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/278945.html">配信★ユニクロ・新た之る挑战</a> 2个 <span class="gb">12%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/268856.html">配信★マリオ・白いドン关键コング?</a> 4个 <span class="gb">8%</span><br> [<span style="color:#ff9000;">主任务</span>] <a href="../ida/322463.html">配信★サンリオ・ひ与ぐでしようニャ</a> 4个 <span class="gb">8%</span><br> </td> </tr> <tr> <td class="use_item1"><span class="c_r">[用途]</span><br>武器</td> <td class="left use_item2"> <img style="vertical-align:-5px;" src="../images/weapon/w897-1.gif"> <a href="../ida/219234.html">贝尔达バレット</a> <span class="c_g">[生产] 2个</span> <br> <img style="vertical-align:-5px;" src="../images/weapon/w898-1.gif"> <a href="../ida/219235.html">贝尔达キャノン</a> <span class="c_g">[生产] 2个</span> <br> </td> </tr> <tr> <td class="use_item1"><span class="c_r">[用途]</span><br>防具生产</td> <td class="left use_item2"> <img style="vertical-align:-5px;" src="../images/armour/b3-3.gif"> <a href="../ida/226278.html">神秘腕甲</a> <span class="c_g">[生产] 16个</span> <br> </td> </tr> <tr> <td class="use_item1"><span class="c_r">[用途]</span><br>调合</td> <td class="left use_item2"> [<a href="../data/2503.html#id210097">调合033</a>] <a href="../ida/218400.html">粘着草</a> × <a href="../ida/218375.html">石子</a> = <a href="../ida/189138.html">素材玉</a> 1个 <span class="gb">95%</span><br> [<a href="../data/2503.html#id210087">调合054</a>] <a href="../ida/218398.html">谜之骨</a> × <a href="../ida/218375.html">石子</a> = <a href="../ida/218408.html">破铁镐</a> 1个 <span class="gb">95%</span><br> </td> </tr> </table> </div> </div> </div> </div> <script> $('.cpg1_1').html('1'); </script> </body> </html>
16.401235
198
0.562735
8ff1583d0016a073659906cec7f41187669aa2af
3,641
swift
Swift
Time to Budget/Time to Budget Tests/Time_Tests.swift
roblkenn/Time2Budget-iOS
f238a9b6785597748e24da0777b9263b68291560
[ "MIT" ]
null
null
null
Time to Budget/Time to Budget Tests/Time_Tests.swift
roblkenn/Time2Budget-iOS
f238a9b6785597748e24da0777b9263b68291560
[ "MIT" ]
4
2017-07-25T15:09:11.000Z
2017-07-25T15:10:59.000Z
Time to Budget/Time to Budget Tests/Time_Tests.swift
MartinVanBuren/Time2Budget-iOS
f238a9b6785597748e24da0777b9263b68291560
[ "MIT" ]
null
null
null
// // Time_Tests.swift // Time to Budget // // Created by Robert Kennedy on 1/24/15. // Copyright (c) 2015 Arrken Games, LLC. All rights reserved. // import XCTest @testable import Time_to_Budget class Time_Tests: XCTestCase { override func setUp() { super.setUp() } override func tearDown() { super.tearDown() } func test_cleanTime() { let time = Time() time.hours = 5 time.minutes = 75 time.cleanTime() time.minutes = -135 time.cleanTime() let results = (time.hours == 3 && time.minutes == 45) XCTAssert(results, "Failed to Clean Time") } func test_cleanTimeNegative() { let time = Time() time.hours = -6 time.minutes = 60 time.cleanTime() time.minutes = -45 time.cleanTime() let results = (time.hours == -6 && time.minutes == 15) XCTAssert(results, "Failed to Clean Negative Time") } func test_setByDouble() { let time = Time() time.setByDouble(3.75) XCTAssert((time.hours == 3 && time.minutes == 45), "Failed to Set Value from a Double") } func test_toDouble() { var time = Time() time.hours = 5 time.minutes = 15 time.cleanTime() var testTime = time.toDouble() let posTest = (testTime == 5.25) time = Time() time.hours = -6 time.minutes = 30 time.cleanTime() testTime = time.toDouble() let negTest = (testTime == -6.5) time = Time() time.hours = 7 time.minutes = 45 time.cleanTime() testTime = time.toDouble() let otherTest = (testTime == 7.75) time = Time() time.hours = 0 time.minutes = 15 time.cleanTime() testTime = time.toDouble() let zeroTest = (testTime == 0.25) XCTAssert((posTest && negTest && otherTest && zeroTest), "Failed to Convert to Double") } func test_toString() { let time = Time() time.hours = 5 time.minutes = 0 let zeroMinTest = (time.toString() == "5:00") time.hours = 0 time.minutes = 30 let zeroHrTest = (time.toString() == "00:30") time.hours = 2 time.minutes = 15 let noZeroTest = (time.toString() == "2:15") time.hours = -2 time.minutes = 15 let negTest = (time.toString() == "-2:15") XCTAssert((zeroMinTest && zeroHrTest && noZeroTest && negTest), "Failed to Convert to String") } func test_doubleToString() { let neg = Time(newTime: -5.25).toString() let pos = Time(newTime: 4.50).toString() let other = Time(newTime: 3.75).toString() let zero = Time(newTime: 6.0).toString() let negTest = (neg == "-5:15") let posTest = (pos == "4:30") let otherTest = (other == "3:45") let zeroTest = (zero == "6:00") XCTAssert((negTest && posTest && otherTest && zeroTest), "Failed to Convert Double to String") } func test_doubleToTime() { var time = Time() time = Time(newTime: 6.25) XCTAssert((time.hours == 6 && time.minutes == 15), "Failed to Convert Double to Time") } }
23.797386
102
0.488327
565d3fd4f8bf4d2bbb0f0ddac73eed3e399ee2be
1,100
asm
Assembly
If else programming exercises and solutions in C/3- C program to check whether a number is positive, negative or zero/project.asm
MahmoudFawzy01/C-solutions-Code4win-
491d86770895ec4c31a69c7e3d47a88dedc4427a
[ "Apache-2.0" ]
null
null
null
If else programming exercises and solutions in C/3- C program to check whether a number is positive, negative or zero/project.asm
MahmoudFawzy01/C-solutions-Code4win-
491d86770895ec4c31a69c7e3d47a88dedc4427a
[ "Apache-2.0" ]
null
null
null
If else programming exercises and solutions in C/3- C program to check whether a number is positive, negative or zero/project.asm
MahmoudFawzy01/C-solutions-Code4win-
491d86770895ec4c31a69c7e3d47a88dedc4427a
[ "Apache-2.0" ]
null
null
null
.file "project.c" .def __main; .scl 2; .type 32; .endef .section .rdata,"dr" .LC0: .ascii "\12Input num1: \0" .LC1: .ascii "%d\0" .LC2: .ascii "Number is positive.\0" .LC3: .ascii "Number is negative.\0" .LC4: .ascii "Number is zero.\0" .text .globl main .def main; .scl 2; .type 32; .endef .seh_proc main main: pushq %rbp .seh_pushreg %rbp movq %rsp, %rbp .seh_setframe %rbp, 0 subq $48, %rsp .seh_stackalloc 48 .seh_endprologue call __main leaq .LC0(%rip), %rcx call printf leaq -4(%rbp), %rax movq %rax, %rdx leaq .LC1(%rip), %rcx call scanf movl -4(%rbp), %eax testl %eax, %eax jle .L2 leaq .LC2(%rip), %rcx call puts jmp .L3 .L2: movl -4(%rbp), %eax testl %eax, %eax jns .L4 leaq .LC3(%rip), %rcx call puts jmp .L3 .L4: leaq .LC4(%rip), %rcx call puts .L3: call getch movl $0, %eax addq $48, %rsp popq %rbp ret .seh_endproc .ident "GCC: (x86_64-posix-seh-rev1, Built by MinGW-W64 project) 6.2.0" .def printf; .scl 2; .type 32; .endef .def scanf; .scl 2; .type 32; .endef .def puts; .scl 2; .type 32; .endef .def getch; .scl 2; .type 32; .endef
18.032787
72
0.626364
1be95da92fbfbcabd1764739cee2be91afc2a46c
18,811
py
Python
seleniumwire/storage.py
SeriyVol4ishe/selenium-wire
4e9af6a5d98f1ca7033a14bdf9d9f560fa461882
[ "MIT" ]
null
null
null
seleniumwire/storage.py
SeriyVol4ishe/selenium-wire
4e9af6a5d98f1ca7033a14bdf9d9f560fa461882
[ "MIT" ]
null
null
null
seleniumwire/storage.py
SeriyVol4ishe/selenium-wire
4e9af6a5d98f1ca7033a14bdf9d9f560fa461882
[ "MIT" ]
null
null
null
import logging import os import pickle import re import shutil import sys import tempfile import threading import uuid from collections import OrderedDict, defaultdict from datetime import datetime, timedelta from typing import DefaultDict, Iterator, List, Optional, Union from seleniumwire.request import Request, Response, WebSocketMessage log = logging.getLogger(__name__) # Storage folders older than this are cleaned up. REMOVE_DATA_OLDER_THAN_DAYS = 1 def create(*, memory_only: bool = False, **kwargs): """Create a new storage instance. Args: memory_only: When True, an in-memory implementation will be used which stores request data in memory only and nothing on disk. Default False. kwargs: Any arguments to initialise the storage with: - base_dir: The base directory under which requests are stored - maxsize: The maximum number of requests the storage can hold Returns: A request storage implementation, currently either RequestStorage (default) or InMemoryRequestStorage when memory_only is set to True. """ if memory_only: log.info('Using in-memory request storage') return InMemoryRequestStorage(base_dir=kwargs.get('base_dir'), maxsize=kwargs.get('maxsize')) log.info('Using default request storage') return RequestStorage(base_dir=kwargs.get('base_dir')) class _IndexedRequest: def __init__(self, id: str, url: str, has_response: bool): self.id = id self.url = url self.has_response = has_response class RequestStorage: """Responsible for persistence of request and response data to disk. This implementation writes the request and response data to disk, but keeps an in-memory index for sequencing and fast retrieval. Instances are designed to be threadsafe. """ def __init__(self, base_dir: Optional[str] = None): """Initialises a new RequestStorage using an optional base directory. Args: base_dir: The directory where request and response data is stored. If not specified, the system temp folder is used. """ if base_dir is None: base_dir = tempfile.gettempdir() self.home_dir: str = os.path.join(base_dir, '.seleniumwire') self.session_dir: str = os.path.join(self.home_dir, 'storage-{}'.format(str(uuid.uuid4()))) os.makedirs(self.session_dir, exist_ok=True) self._cleanup_old_dirs() # Index of requests received. self._index: List[_IndexedRequest] = [] # Sequences of websocket messages held against the # id of the originating websocket request. self._ws_messages: DefaultDict[str, List] = defaultdict(list) self._lock = threading.Lock() def save_request(self, request: Request) -> None: """Save a request to storage. Args: request: The request to save. """ request_id = str(uuid.uuid4()) request_dir = self._get_request_dir(request_id) os.mkdir(request_dir) request.id = request_id self._save(request, request_dir, 'request') with self._lock: self._index.append(_IndexedRequest(id=request_id, url=request.url, has_response=False)) def _save(self, obj: Union[Request, Response, dict], dirname: str, filename: str) -> None: with open(os.path.join(dirname, filename), 'wb') as out: pickle.dump(obj, out) def save_response(self, request_id: str, response: Response) -> None: """Save a response to storage against a request with the specified id. Args: request_id: The id of the original request. response: The response to save. """ indexed_request = self._get_indexed_request(request_id) if indexed_request is None: log.debug('Cannot save response as request %s is no longer stored', request_id) return request_dir = self._get_request_dir(request_id) self._save(response, request_dir, 'response') indexed_request.has_response = True def _get_indexed_request(self, request_id: str) -> Optional[_IndexedRequest]: with self._lock: index = self._index[:] for indexed_request in index: if indexed_request.id == request_id: return indexed_request return None def save_ws_message(self, request_id: str, message: WebSocketMessage) -> None: """Save a websocket message against a request with the specified id. Args: request_id: The id of the original handshake request. message: The websocket message to save. """ with self._lock: self._ws_messages[request_id].append(message) def save_har_entry(self, request_id: str, entry: dict) -> None: """Save a HAR entry to storage against a request with the specified id. Args: request_id: The id of the original request. entry: The HAR entry to save. """ indexed_request = self._get_indexed_request(request_id) if indexed_request is None: log.debug('Cannot save HAR entry as request %s is no longer stored', request_id) return request_dir = self._get_request_dir(request_id) self._save(entry, request_dir, 'har_entry') def load_requests(self) -> List[Request]: """Load all previously saved requests known to the storage (known to its index). The requests are returned as a list of request objects in the order in which they were saved. Each request will have any associated response and websocket messages attached if they exist. Returns: A list of request objects. """ with self._lock: index = self._index[:] loaded = [] for indexed_request in index: request = self._load_request(indexed_request.id) if request is not None: loaded.append(request) return loaded def _load_request(self, request_id: str) -> Optional[Request]: request_dir = self._get_request_dir(request_id) with open(os.path.join(request_dir, 'request'), 'rb') as req: request = self._unpickle(req) if request is None: return None ws_messages = self._ws_messages.get(request.id) if ws_messages: # Attach any websocket messages for this request if we have them request.ws_messages = ws_messages try: # Attach the response if there is one. with open(os.path.join(request_dir, 'response'), 'rb') as res: response = self._unpickle(res) if response is not None: request.response = response # The certificate data has been stored on the response but we make # it available on the request which is a more logical location. if hasattr(response, 'cert'): request.cert = response.cert del response.cert except (FileNotFoundError, EOFError): pass return request def _unpickle(self, f): """Unpickle the object specified by the file f. If unpickling fails return None. """ try: return pickle.load(f) except Exception: # Errors may sometimes occur with unpickling - e.g. # sometimes data hasn't been fully flushed to disk # by the OS by the time we come to unpickle it. if log.isEnabledFor(logging.DEBUG): log.exception('Error unpickling object') return None def load_last_request(self) -> Optional[Request]: """Load the last saved request. Returns: The last saved request or None if no requests have yet been stored. """ with self._lock: if self._index: last_request = self._index[-1] else: return None return self._load_request(last_request.id) def load_har_entries(self) -> List[dict]: """Load all HAR entries known to this storage. Returns: A list of HAR entries. """ with self._lock: index = self._index[:] entries = [] for indexed_request in index: request_dir = self._get_request_dir(indexed_request.id) try: with open(os.path.join(request_dir, 'har_entry'), 'rb') as f: entry = self._unpickle(f) if entry is not None: entries.append(entry) except FileNotFoundError: # HAR entries aren't necessarily saved with each request. pass return entries def iter_requests(self) -> Iterator[Request]: """Return an iterator of requests known to the storage. Returns: An iterator of request objects. """ with self._lock: index = self._index[:] for indexed_request in index: yield self._load_request(indexed_request.id) def clear_requests(self) -> None: """Clear all requests currently known to this storage.""" with self._lock: index = self._index[:] self._index.clear() self._ws_messages.clear() for indexed_request in index: shutil.rmtree(self._get_request_dir(indexed_request.id), ignore_errors=True) def find(self, pat: str, check_response: bool = True) -> Optional[Request]: """Find the first request that matches the specified pattern. Requests are searched in chronological order. Args: pat: A pattern that will be searched in the request URL. check_response: When a match is found, whether to check that the request has a corresponding response. Where check_response=True and no response has been received, this method will skip the request and continue searching. Returns: The first request in the storage that matches the pattern, or None if no requests match. """ with self._lock: index = self._index[:] for indexed_request in index: if re.search(pat, indexed_request.url): if (check_response and indexed_request.has_response) or not check_response: return self._load_request(indexed_request.id) return None def _get_request_dir(self, request_id: str) -> str: return os.path.join(self.session_dir, 'request-{}'.format(request_id)) def cleanup(self) -> None: """Remove all stored requests, the storage directory containing those requests, and if that is the only storage directory, also the top level parent directory. """ log.debug('Cleaning up %s', self.session_dir) self.clear_requests() shutil.rmtree(self.session_dir, ignore_errors=True) try: # Attempt to remove the parent folder if it is empty os.rmdir(os.path.dirname(self.session_dir)) except OSError: # Parent folder not empty pass def _cleanup_old_dirs(self) -> None: """Clean up and remove any old storage directories that were not previously cleaned up properly by cleanup(). """ parent_dir = os.path.dirname(self.session_dir) for storage_dir in os.listdir(parent_dir): storage_dir = os.path.join(parent_dir, storage_dir) try: if ( os.path.getmtime(storage_dir) < (datetime.now() - timedelta(days=REMOVE_DATA_OLDER_THAN_DAYS)).timestamp() ): shutil.rmtree(storage_dir, ignore_errors=True) except FileNotFoundError: # Can happen if multiple instances are run concurrently pass class InMemoryRequestStorage: """Keeps request and response data in memory only. By default there is no limit on the number of requests that will be stored. This can be adjusted with the 'maxsize' attribute when creating a new instance. Instances are designed to be threadsafe. """ def __init__(self, base_dir: Optional[str] = None, maxsize: Optional[int] = None): """Initialise a new InMemoryRequestStorage. Args: base_dir: The directory where certificate data is stored. If not specified, the system temp folder is used. maxsize: The maximum number of requests to store. Default no limit. When this attribute is set and the storage reaches the specified maximum size, old requests are discarded sequentially as new requests arrive. """ if base_dir is None: base_dir = tempfile.gettempdir() self.home_dir: str = os.path.join(base_dir, '.seleniumwire') self._maxsize = sys.maxsize if maxsize is None else maxsize # OrderedDict doesn't support type hints before 3.7.2 self._requests = OrderedDict() # type: ignore self._lock = threading.Lock() def save_request(self, request: Request) -> None: """Save a request to storage. Args: request: The request to save. """ request.id = str(uuid.uuid4()) with self._lock: if self._maxsize > 0: while len(self._requests) >= self._maxsize: self._requests.popitem(last=False) self._requests[request.id] = { 'request': request, } def save_response(self, request_id: str, response: Response) -> None: """Save a response to storage against a request with the specified id. Any certificate information will be attached to the original request against the request.cert attribute. Args: request_id: The id of the original request. response: The response to save. """ request = self._get_request(request_id) if request is not None: request.response = response # The certificate data has been stored on the response but we make # it available on the request which is a more logical location. if hasattr(response, 'cert'): request.cert = response.cert del response.cert else: log.debug('Cannot save response as request %s is no longer stored' % request_id) def save_ws_message(self, request_id: str, message: WebSocketMessage) -> None: """Save a websocket message against a request with the specified id. Args: request_id: The id of the original handshake request. message: The websocket message to save. """ request = self._get_request(request_id) if request is not None: request.ws_messages.append(message) def save_har_entry(self, request_id: str, entry: dict) -> None: """Save a HAR entry to storage against a request with the specified id. Args: request_id: The id of the original request. entry: The HAR entry to save. """ with self._lock: try: v = self._requests[request_id] v['har_entry'] = entry except KeyError: log.debug('Cannot save HAR entry as request %s is no longer stored', request_id) def _get_request(self, request_id: str) -> Optional[Request]: """Get a request with the specified id or None if no request found.""" with self._lock: try: return self._requests[request_id]['request'] except KeyError: return None def load_requests(self) -> List[Request]: """Load all previously saved requests. The requests are returned as a list of request objects in the order in which they were saved. Note that for efficiency request objects are not copied when returned, so any change made to a request will also affect the stored version. Returns: A list of request objects. """ with self._lock: return [v['request'] for v in self._requests.values()] def load_last_request(self) -> Optional[Request]: """Load the last saved request. Returns: The last saved request or None if no requests have yet been stored. """ with self._lock: try: return next(reversed(self._requests.values()))['request'] except (StopIteration, KeyError): return None def load_har_entries(self) -> List[dict]: """Load all previously saved HAR entries. Returns: A list of HAR entries. """ with self._lock: return [v['har_entry'] for v in self._requests.values() if 'har_entry' in v] def iter_requests(self) -> Iterator[Request]: """Return an iterator over the saved requests. Returns: An iterator of request objects. """ with self._lock: values = list(self._requests.values()) for v in values: yield v['request'] def clear_requests(self) -> None: """Clear all previously saved requests.""" with self._lock: self._requests.clear() def find(self, pat: str, check_response: bool = True) -> Optional[Request]: """Find the first request that matches the specified pattern. Requests are searched in chronological order. Args: pat: A pattern that will be searched in the request URL. check_response: When a match is found, whether to check that the request has a corresponding response. Where check_response=True and no response has been received, this method will skip the request and continue searching. Returns: The first request in the storage that matches the pattern, or None if no requests match. """ with self._lock: for v in self._requests.values(): request = v['request'] if re.search(pat, request.url): if (check_response and request.response) or not check_response: return request return None def cleanup(self) -> None: """Clear all previously saved requests.""" self.clear_requests()
35.626894
101
0.614002
3969816d6a1a36f50ed7c5186e848b69be5fb961
200
html
HTML
test_js.html
mukunda-/steamidparser
a60307721ad852749cca51ec64fa5b03f92ae7ea
[ "MIT" ]
18
2015-02-25T02:08:54.000Z
2021-05-18T13:13:48.000Z
test_js.html
mukunda-/steamidparser
a60307721ad852749cca51ec64fa5b03f92ae7ea
[ "MIT" ]
2
2015-05-26T08:33:05.000Z
2015-09-21T16:22:46.000Z
test_js.html
mukunda-/steamidparser
a60307721ad852749cca51ec64fa5b03f92ae7ea
[ "MIT" ]
13
2015-06-20T11:47:09.000Z
2022-02-26T18:54:09.000Z
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="lib/steamid.js"></script> <script src="test.js"></script> </head> <body> <p>See console for output.</p> </body> </html>
16.666667
40
0.595
d9bc3fd84ecf6f3f255dec3ae8e205e03a267300
1,146
rs
Rust
examples/pidof.rs
GuillaumeGomez/heim
7327b6d7097c5595d5121d48bd801bc016707e18
[ "Apache-2.0", "MIT" ]
null
null
null
examples/pidof.rs
GuillaumeGomez/heim
7327b6d7097c5595d5121d48bd801bc016707e18
[ "Apache-2.0", "MIT" ]
null
null
null
examples/pidof.rs
GuillaumeGomez/heim
7327b6d7097c5595d5121d48bd801bc016707e18
[ "Apache-2.0", "MIT" ]
null
null
null
//! Naive clone of the `pidof` utility use std::env; use std::ffi::OsStr; use std::io; use tokio::stream::StreamExt as _; use heim::{ process::{self, Process, ProcessResult}, Result, }; async fn compare(process: ProcessResult<Process>, needle: &str) -> Option<process::Pid> { let process = process.ok()?; if needle == process.name().await.ok()? { return Some(process.pid()); } let command = process.command().await.ok()?; if Some(&OsStr::new(needle)) == command.into_iter().next().as_ref() { return Some(process.pid()); } None } #[tokio::main] async fn main() -> Result<()> { let needle = match env::args().skip(1).next() { Some(arg) => arg, None => { return Err( io::Error::new(io::ErrorKind::InvalidData, "Program name is missing").into(), ) } }; let processes = process::processes(); tokio::pin!(processes); while let Some(process) = processes.next().await { if let Some(pid) = compare(process, &needle).await { print!("{} ", pid); } } println!(); Ok(()) }
22.470588
93
0.550611
3114ea5e7d0fe130e8485da5283212eca6dc7905
1,437
kt
Kotlin
ldb/kodein-leveldb-inmemory/src/commonMain/kotlin/org/kodein/db/leveldb/inmemory/inMemoryLevelDBFactory.kt
jakobkmar/Kodein-DB
3f9913d7a864ba18b16a4f5e0dc760d9fa846888
[ "MIT" ]
291
2018-09-04T10:45:39.000Z
2022-03-27T02:48:19.000Z
ldb/kodein-leveldb-inmemory/src/commonMain/kotlin/org/kodein/db/leveldb/inmemory/inMemoryLevelDBFactory.kt
jakobkmar/Kodein-DB
3f9913d7a864ba18b16a4f5e0dc760d9fa846888
[ "MIT" ]
41
2019-06-08T12:11:56.000Z
2022-02-07T18:23:59.000Z
ldb/kodein-leveldb-inmemory/src/commonMain/kotlin/org/kodein/db/leveldb/inmemory/inMemoryLevelDBFactory.kt
jakobkmar/Kodein-DB
3f9913d7a864ba18b16a4f5e0dc760d9fa846888
[ "MIT" ]
25
2019-06-16T17:51:05.000Z
2022-03-19T15:36:21.000Z
package org.kodein.db.leveldb.inmemory import org.kodein.db.leveldb.LevelDB import org.kodein.db.leveldb.LevelDBException import org.kodein.db.leveldb.LevelDBFactory import org.kodein.memory.io.ReadMemory import kotlin.native.concurrent.ThreadLocal @ThreadLocal public object LevelDBInMemory : LevelDBFactory { private class IMData { val data = HashMap<ReadMemory, ByteArray>() var isOpen: Boolean = false } private val dbs = HashMap<String, IMData>() override fun open(path: String, options: LevelDB.Options): LevelDB { val data = when (options.openPolicy) { LevelDB.OpenPolicy.OPEN_OR_CREATE -> dbs.getOrPut(path) { IMData() } LevelDB.OpenPolicy.OPEN -> dbs[path] ?: throw LevelDBException("No db at path $path") LevelDB.OpenPolicy.CREATE -> { if (path in dbs) throw LevelDBException("Db already exist at path $path") IMData().also { dbs[path] = it } } } if (data.isOpen) throw LevelDBException("Db at path $path is already open") data.isOpen = true return InMemoryLevelDB( data = data.data, options = options, onClose = { data.isOpen = false } ) } override fun destroy(path: String, options: LevelDB.Options) { dbs.remove(path) } } public val LevelDB.Companion.inMemory: LevelDBFactory get() = LevelDBInMemory
32.659091
97
0.648573
e31705ced856f92452547c1561b168e4e87d1626
337
kt
Kotlin
src/moria/objetos/Carcaj.kt
joseluisgs/MoriaKotlin2020
e07c3e152842c58f2241aaa87d2b1fd7f5f61b78
[ "MIT" ]
7
2020-10-08T11:01:02.000Z
2022-03-12T19:00:16.000Z
src/moria/objetos/Carcaj.kt
joseluisgs/MoriaKotlin2020
e07c3e152842c58f2241aaa87d2b1fd7f5f61b78
[ "MIT" ]
null
null
null
src/moria/objetos/Carcaj.kt
joseluisgs/MoriaKotlin2020
e07c3e152842c58f2241aaa87d2b1fd7f5f61b78
[ "MIT" ]
3
2020-10-10T10:10:36.000Z
2022-03-12T18:59:04.000Z
package moria.objetos /** * Carcaj para almacenar flechas * @property cantidad Int Cantidad de flechas que tiene * @constructor */ class Carcaj(tipo: String = "Carcaj", var cantidad: Int = 1) : Objeto(tipo) { // override fun test() { // println("Soy el objeto $tipo y mis caracteristica es cantidad: $cantidad") // } }
25.923077
84
0.667656
cb9ede24fee9e66bb282851d54743a9f3bdda0b5
1,769
go
Go
graphview_test.go
jimsmart/store4
790fe3b3c59148bd844236c65000aa24a636190d
[ "MIT" ]
6
2017-01-16T21:26:50.000Z
2021-05-19T22:57:38.000Z
graphview_test.go
jimsmart/store4
790fe3b3c59148bd844236c65000aa24a636190d
[ "MIT" ]
null
null
null
graphview_test.go
jimsmart/store4
790fe3b3c59148bd844236c65000aa24a636190d
[ "MIT" ]
1
2017-12-22T21:15:27.000Z
2017-12-22T21:15:27.000Z
package store4_test import ( . "github.com/jimsmart/store4" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) type Triple struct { S string P string O interface{} } func (t Triple) Subject() string { return t.S } func (t Triple) Predicate() string { return t.P } func (t Triple) Object() interface{} { return t.O } var _ = Describe("GraphView", func() { Describe("Creating a new GraphView", func() { Context("from [][3]string", func() { graph := NewGraph([][3]string{ {"s1", "p1", "o1"}, {"s1", "p1", "o2"}, {"s1", "p2", "o2"}, {"s2", "p1", "o1"}, {"s1", "p2", "o3"}, }) It("should have size 5", func() { Expect(graph.Size()).To(Equal(uint64(5))) }) It("should contain the correct triples", func() { var resultsList []*Triple graph.ForEach(func(s, p string, o interface{}) { resultsList = append(resultsList, &Triple{s, p, o}) }) Expect(resultsList).To(ConsistOf([]*Triple{ {"s1", "p1", "o1"}, {"s1", "p1", "o2"}, {"s1", "p2", "o2"}, {"s2", "p1", "o1"}, {"s1", "p2", "o3"}, })) }) }) Context("from a single [3]string", func() { graph := NewGraph([3]string{"s1", "p1", "o1"}) It("should have size 1", func() { Expect(graph.Size()).To(Equal(uint64(1))) }) It("should contain the correct triple", func() { var resultsList []*Triple graph.ForEach(func(s, p string, o interface{}) { resultsList = append(resultsList, &Triple{s, p, o}) }) Expect(resultsList).To(ConsistOf([]*Triple{ {"s1", "p1", "o1"}, })) }) }) Context("from an unknown type", func() { shouldPanic := func() { NewGraph(true) } It("should panic", func() { Expect(shouldPanic).To(Panic()) }) }) }) })
21.573171
56
0.544375
90e6f8636ffb87afc7509f41092ba9330cfc347b
1,339
py
Python
snippets/simple_json_parse.py
boisde/Greed_Island
9c4f0195fb7bfaeb6c29e8e9638c7b0ffd9ad90b
[ "MIT" ]
null
null
null
snippets/simple_json_parse.py
boisde/Greed_Island
9c4f0195fb7bfaeb6c29e8e9638c7b0ffd9ad90b
[ "MIT" ]
null
null
null
snippets/simple_json_parse.py
boisde/Greed_Island
9c4f0195fb7bfaeb6c29e8e9638c7b0ffd9ad90b
[ "MIT" ]
2
2016-09-10T08:13:06.000Z
2021-05-12T18:57:05.000Z
#!/usr/bin/env python # coding:utf-8 from __future__ import unicode_literals import sys # '{A:B,C:{D:E},F:G}' # { # 'a': 'b', # 'c':{ # 'd': 'e' # }, # 'f': 'g' # } def dumps(a): t = '\t' n = '\n' t_cnt = 0 for c in a: if c == '{': t_cnt += 1 s = '%s%s%s' % (c, n, (t * t_cnt)) sys.stdout.write(s), elif c == ',': s = '%s%s%s' % (c, n, (t * t_cnt)) sys.stdout.write(s) elif c == '}': t_cnt -= 1 s = '%s%s%s' % (n, (t * t_cnt), c) sys.stdout.write(s) else: sys.stdout.write(c) def recur_dumps(a, _indent_cnt): t = '\t' n = '\n' if not a: return elif a.startswith('{'): _indent_cnt += 1 sys.stdout.write('{' + n + t * _indent_cnt) recur_dumps(a[1:], _indent_cnt) elif a.startswith('}'): _indent_cnt -= 1 sys.stdout.write(n + t * _indent_cnt + '}') recur_dumps(a[1:], _indent_cnt) elif a.startswith(','): sys.stdout.write(',' + n + t * _indent_cnt) recur_dumps(a[1:], _indent_cnt) else: sys.stdout.write(a[0]) recur_dumps(a[1:], _indent_cnt) if __name__ == '__main__': s = '{A:B,C:{D:E},F:G}' dumps(s) recur_dumps(s, 0)
22.316667
51
0.439134
1fb3910613e6875f81875deb876065e74b257fad
681
css
CSS
priv/static/css/app.css
CMcDonald82/phoenix-starter
757e91326f7c82813dfb22a6eaa24147689b6dc8
[ "MIT" ]
1
2018-05-29T11:50:17.000Z
2018-05-29T11:50:17.000Z
priv/static/css/app.css
CMcDonald82/phoenix-starter
757e91326f7c82813dfb22a6eaa24147689b6dc8
[ "MIT" ]
null
null
null
priv/static/css/app.css
CMcDonald82/phoenix-starter
757e91326f7c82813dfb22a6eaa24147689b6dc8
[ "MIT" ]
null
null
null
body,form,table,ul{margin-top:20px;margin-bottom:20px}.alert:empty{display:none}.header{border-bottom:1px solid #e5e5e5}.logo{width:519px;height:71px;display:inline-block;margin-bottom:1em;background-image:url("/images/phoenix.png");background-size:519px 71px}.header,.marketing{padding-right:15px;padding-left:15px}@media (min-width:768px){.container{max-width:730px}}.container-narrow>hr{margin:30px 0}.jumbotron{text-align:center;border-bottom:1px solid #e5e5e5}.marketing{margin:35px 0}@media screen and (min-width:768px){.header,.marketing{padding-right:0;padding-left:0}.header{margin-bottom:30px}.jumbotron{border-bottom:0}}h2{color:green} /*# sourceMappingURL=app.css.map*/
340.5
646
0.797357
90cbac22a2f512510b8aee3ff21a3918bfc1d657
3,234
py
Python
app/models/__init__.py
namuan/crypto-rider
f5b47ada60a7cef07e66609e2e92993619c6bfbe
[ "MIT" ]
1
2022-01-18T19:06:20.000Z
2022-01-18T19:06:20.000Z
app/models/__init__.py
namuan/crypto-rider
f5b47ada60a7cef07e66609e2e92993619c6bfbe
[ "MIT" ]
null
null
null
app/models/__init__.py
namuan/crypto-rider
f5b47ada60a7cef07e66609e2e92993619c6bfbe
[ "MIT" ]
null
null
null
import os from peewee import * from app.common import uuid_gen home_dir = os.getenv("HOME") db = SqliteDatabase(home_dir + "/crypto_rider_candles.db") class CandleStick(Model): id = UUIDField(primary_key=True) exchange = CharField() timestamp = BigIntegerField() market = CharField() open = FloatField() high = FloatField() low = FloatField() close = FloatField() volume = FloatField() class Meta: database = db indexes = ((("timestamp", "exchange", "market"), True),) @staticmethod def event(exchange, market, ts, op, hi, lo, cl, vol): return dict( exchange=exchange, market=market, timestamp=ts, open=op, high=hi, low=lo, close=cl, volume=vol, ) @staticmethod def save_from(event): event["id"] = uuid_gen() CandleStick.insert(event).on_conflict_ignore().execute() @staticmethod def save_multiple(events): with db.atomic(): CandleStick.insert_many(events).execute() class SignalAlert(Model): id = UUIDField(primary_key=True) strategy = CharField() timestamp = BigIntegerField() market = CharField() alert_type = CharField() message = CharField() close_price = FloatField() class Meta: database = db @staticmethod def event(timestamp, strategy, market, alert_type, message, close_price): return dict( timestamp=timestamp, strategy=strategy, market=market, alert_type=alert_type, message=message, close_price=close_price, ) @staticmethod def save_from(event): event["id"] = uuid_gen() SignalAlert.insert(event).execute() class TradeOrder(Model): id = UUIDField(primary_key=True) strategy = CharField() buy_timestamp = BigIntegerField() market = CharField() buy_price = FloatField() is_open = BooleanField() sell_timestamp = BigIntegerField(null=True) sell_price = FloatField(null=True) sell_reason = CharField(null=True) class Meta: database = db @staticmethod def event( strategy, buy_timestamp, sell_timestamp, market, buy_price, sell_price, is_open, sell_reason, ): return dict( strategy=strategy, buy_timestamp=float(buy_timestamp), sell_timestamp=float(sell_timestamp), market=market, buy_price=float(buy_price), sell_price=float(sell_price), is_open=is_open, sell_reason=sell_reason, ) def to_event(self): return TradeOrder.event( self.strategy, self.buy_timestamp, self.sell_timestamp, self.market, self.buy_price, self.sell_price, self.is_open, self.sell_reason, ) @staticmethod def save_from(event): event["id"] = uuid_gen() TradeOrder.insert(event).execute() CandleStick.create_table() SignalAlert.create_table() TradeOrder.create_table()
23.779412
77
0.589363
f04086aec7d639cfabfbb17f42cceb44dff1f5e8
2,797
js
JavaScript
js/filters/kuwahara.js
daelsepara/PixelFilterJS
5711bc6818adfd4823d24db316a48a4ed9e126b3
[ "MIT" ]
3
2019-06-27T14:17:39.000Z
2022-02-16T15:19:11.000Z
js/filters/kuwahara.js
daelsepara/PixelFilterJS
5711bc6818adfd4823d24db316a48a4ed9e126b3
[ "MIT" ]
null
null
null
js/filters/kuwahara.js
daelsepara/PixelFilterJS
5711bc6818adfd4823d24db316a48a4ed9e126b3
[ "MIT" ]
null
null
null
// Kuwahara Filter (nxn window) var Filter = class { varmin(varr, srcx, srcy, min, dstx, dsty) { if (varr < min) { min = varr; dstx = srcx; dsty = srcy; } return { min: min, dstx: dstx, dsty: dsty }; } Kuwahara(Input, srcx, srcy, win) { var Channels = 4; var pad = (win + 1) / 2; var ofs = (win - 1) / 2; var fx = srcx + ofs; var fy = srcy + ofs; var fxy = fx * fy; var mean = new Array(fxy); var variance = new Array(fxy); var sum, varr; var n; var ys, xs; var total = 2 * srcy + ofs; var current = 0; for (ys = -ofs; ys < srcy; ys++) { for (xs = -ofs; xs < srcx; xs++) { sum = 0.0; varr = 0.0; n = 0; for (var xf = xs; xf < xs + pad; xf++) { for (var yf = ys; yf < ys + pad; yf++) { var val = parseFloat(Common.Luminance(Common.CLR(Input, srcx, srcy, xf, yf, 0, 0))); sum += val; varr += val * val; n++; } } var index = (ys + ofs) * fx + xs + ofs; mean[index] = sum / n; variance[index] = varr - sum * mean[index]; } current++; notify({ ScalingProgress: current / total }); } var xc = 0, yc = 0; var min, result; for (var y = 0; y < srcy; y++) { var yy = y * srcx; for (var x = 0; x < srcx; x++) { min = Number.MAX_VALUE; var yo = y + ofs; var xo = x + ofs; var yx1 = y * fx + x; var yx2 = yo * fx + x; result = this.varmin(variance[yx1], x, y, min, xc, yc); min = result.min, xc = result.dstx, yc = result.dsty; result = this.varmin(variance[yx2], x, yo, min, xc, yc); min = result.min, xc = result.dstx, yc = result.dsty; result = this.varmin(variance[yx1 + ofs], xo, y, min, xc, yc); min = result.min, xc = result.dstx, yc = result.dsty; result = this.varmin(variance[yx2 + ofs], xo, yo, min, xc, yc); min = result.min, xc = result.dstx, yc = result.dsty; var dst = (yy + x) * Channels; // YUV to RGB (ITU-R) see https://en.wikipedia.org/wiki/YUV var pixel = Common.CLR(Input, srcx, srcy, x, y, 0, 0); var luminance = mean[yc * fx + xc] + 0.5; var cr = parseFloat(Common.ChromaU(pixel)); var cb = parseFloat(Common.ChromaV(pixel)); var crr = (cr - 127.5); var cbb = (cb - 127.5); Common.ScaledImage[dst] = Common._Clip8(parseInt(luminance + 1.042 * crr)); Common.ScaledImage[dst + 1] = Common._Clip8(parseInt(luminance - 0.344 * cbb - 0.714 * crr)); Common.ScaledImage[dst + 2] = Common._Clip8(parseInt(luminance + 1.772 * cbb)); Common.ScaledImage[dst + 3] = Common.Alpha(pixel); } current++; notify({ ScalingProgress: current / total }); } } Apply(Input, srcx, srcy, win, threshold) { win = Math.max(3, win); Init.Init(srcx, srcy, 1, 1, threshold); this.Kuwahara(Input, srcx, srcy, win); } }
22.198413
97
0.55059
5869ed5a51975b2e8907024755446cb271e629b5
7,017
rs
Rust
influxdb/src/client/client_v2.rs
hank121314/influxdb-rust
29be69e6ee720b3b0dfe6bbc3e2ceb33ba28fd11
[ "MIT" ]
null
null
null
influxdb/src/client/client_v2.rs
hank121314/influxdb-rust
29be69e6ee720b3b0dfe6bbc3e2ceb33ba28fd11
[ "MIT" ]
null
null
null
influxdb/src/client/client_v2.rs
hank121314/influxdb-rust
29be69e6ee720b3b0dfe6bbc3e2ceb33ba28fd11
[ "MIT" ]
null
null
null
//! Client which can read and write data from InfluxDBv2. //! //! # Arguments //! //! * `url`: The URL where InfluxDB is running (ex. `http://localhost:8086`). //! * `bucket`: The Bucket against which queries and writes will be run. //! //! # Examples //! //! ```rust //! use influxdb::ClientV2; //! //! let client = ClientV2::new("http://localhost:8086", "test"); //! //! assert_eq!(client.database_name(), "test"); //! ``` use reqwest::{Client as ReqwestClient, StatusCode, header::{HeaderMap, HeaderValue}}; use crate::query::QueryTypes; use crate::Error; use crate::Query; use std::collections::HashMap; use std::sync::Arc; #[derive(Clone, Debug)] /// Internal Representation of a Client pub struct ClientV2 { pub(crate) url: Arc<String>, pub(crate) headers: Arc<HeaderMap<HeaderValue>>, pub(crate) parameters: Arc<HashMap<&'static str, String>>, } impl ClientV2 { /// Instantiates a new [`ClientV2`](crate::ClientV2) /// /// # Arguments /// /// * `url`: The URL where InfluxDB is running (ex. `http://localhost:8086`). /// * `database`: The Database against which queries and writes will be run. /// /// # Examples /// /// ```rust /// use influxdb::ClientV2; /// /// let _client = ClientV2::new("http://localhost:8086", "YOURAUTHTOKEN"); /// ``` pub fn new<S1, S2, S3>(url: S1, token: &str, org: S2, bucket: S3) -> Self where S1: Into<String>, S2: Into<String>, S3: Into<String>, { let mut headers = HeaderMap::new(); let mut parameters = HashMap::<&str, String>::new(); parameters.insert("org", org.into()); parameters.insert("bucket", bucket.into()); headers.insert("Authorization", HeaderValue::from_str(&format!("Token {}", token)).unwrap()); ClientV2 { url: Arc::new(url.into()), headers: Arc::new(headers), parameters: Arc::new(parameters) } } /// Returns the name of the bucket the client is using pub fn token(&self) -> &str { self.get_header_by_name("Authorization") } fn get_header_by_name(&self, name: &str) -> &str { // safe to unwrap: we always set the organization name in `Self::new` if let Ok(value) = self.headers.get(name).unwrap().to_str() { return value; } "" } /// Returns the URL of the InfluxDB installation the client is using pub fn database_url(&self) -> &str { &self.url } /// Pings the InfluxDB Server /// /// Returns a tuple of build type and version number pub async fn ping(&self) -> Result<(String, String), Error> { let url = &format!("{}/ping", self.url); let client = ReqwestClient::new(); let res = client .get(url) .send() .await .map_err(|err| Error::ProtocolError { error: format!("{}", err), })?; let headers = res.headers(); let build = headers["X-Influxdb-Build"].to_str().unwrap(); let version = headers["X-Influxdb-Version"].to_str().unwrap(); Ok((build.to_owned(), version.to_owned())) } /// Sends a [`ReadQuery`](crate::ReadQuery) or [`WriteQuery`](crate::WriteQuery) to the InfluxDB Server. /// /// A version capable of parsing the returned string is available under the [serde_integration](crate::integrations::serde_integration) /// /// # Arguments /// /// * `q`: Query of type [`ReadQuery`](crate::ReadQuery) or [`WriteQuery`](crate::WriteQuery) /// /// # Examples /// /// ```rust,no_run /// use influxdb::{Client, Query, Timestamp}; /// use influxdb::InfluxDbWriteable; /// use std::time::{SystemTime, UNIX_EPOCH}; /// /// # #[async_std::main] /// # async fn main() -> Result<(), influxdb::Error> { /// let start = SystemTime::now(); /// let since_the_epoch = start /// .duration_since(UNIX_EPOCH) /// .expect("Time went backwards") /// .as_millis(); /// /// let client = Client::new("http://localhost:8086", "test"); /// let query = Timestamp::Milliseconds(since_the_epoch) /// .into_query("weather") /// .add_field("temperature", 82); /// let results = client.query(&query).await?; /// /// # Ok(()) /// # } /// ``` /// # Errors /// /// If the function can not finish the query, /// a [`Error`] variant will be returned. /// /// [`Error`]: enum.Error.html pub async fn query<'q, Q>(&self, q: &'q Q) -> Result<String, Error> where Q: Query, &'q Q: Into<QueryTypes<'q>>, { let client = ReqwestClient::new(); let query = q.build().map_err(|err| Error::InvalidQueryError { error: err.to_string(), })?; let request_builder = match q.into() { QueryTypes::Read(_) => { let read_query = query.get(); let headers = self.headers.as_ref().clone(); let parameters = self.parameters.as_ref().clone(); let url = &format!("{}/query", &self.url); if read_query.contains("SELECT") || read_query.contains("SHOW") { client.get(url).headers(headers).query(&parameters) } else { client.post(url).headers(headers).query(&parameters) } } QueryTypes::Write(write_query) => { let url = &format!("{}/api/v2/write", &self.url); let headers = self.headers.as_ref().clone(); let mut parameters = self.parameters.as_ref().clone(); parameters.insert("precision", write_query.get_precision()); client.post(url).headers(headers).body(query.get()).query(&parameters) } }.build(); let request = request_builder.map_err(|err| Error::UrlConstructionError { error: err.to_string(), })?; let res = client .execute(request) .await .map_err(|err| Error::ConnectionError { error: err.to_string(), })?; match res.status() { StatusCode::UNAUTHORIZED => return Err(Error::AuthorizationError), StatusCode::FORBIDDEN => return Err(Error::AuthenticationError), _ => {} } let s = res .text() .await .map_err(|_| Error::DeserializationError { error: "response could not be converted to UTF-8".to_string(), })?; // todo: improve error parsing without serde if s.contains("\"error\"") { return Err(Error::DatabaseError { error: format!("influxdb error: \"{}\"", s), }); } Ok(s) } } #[cfg(test)] mod tests { use super::ClientV2; #[test] fn test_fn_database() { let client = ClientV2::new("http://localhost:8068", "YOURAUTHTOKEN", "org", "bucket"); assert_eq!(client.token(), "Token YOURAUTHTOKEN"); let parameters = client.parameters; assert_eq!(parameters.len(), 2); assert_eq!(parameters.get("org").unwrap(), "org"); assert_eq!(parameters.get("bucket").unwrap(), "bucket"); } }
31.048673
139
0.573037
5be57eb372e88ab0c59e57df9a725cb542d4f4bf
913
h
C
OfflineComfirmOrderCell.h
yihongmingfeng/Fruitday
981f6ecdb03a42d95210b249590505db18195dfd
[ "MIT" ]
null
null
null
OfflineComfirmOrderCell.h
yihongmingfeng/Fruitday
981f6ecdb03a42d95210b249590505db18195dfd
[ "MIT" ]
null
null
null
OfflineComfirmOrderCell.h
yihongmingfeng/Fruitday
981f6ecdb03a42d95210b249590505db18195dfd
[ "MIT" ]
null
null
null
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "UITableViewCell.h" @class UILabel; @interface OfflineComfirmOrderCell : UITableViewCell { UILabel *_contentLabel; UILabel *_titleLabel; CDUnknownBlockType _selectBuildingBlock; } + (id)cellForRowsAtIndexPath:(id)arg1 tableView:(id)arg2 dataSource:(id)arg3 target:(id)arg4; + (double)heightForRowsAtIndexPath:(id)arg1 dataSource:(id)arg2; @property(copy, nonatomic) CDUnknownBlockType selectBuildingBlock; // @synthesize selectBuildingBlock=_selectBuildingBlock; @property(nonatomic) __weak UILabel *titleLabel; // @synthesize titleLabel=_titleLabel; @property(nonatomic) __weak UILabel *contentLabel; // @synthesize contentLabel=_contentLabel; - (void).cxx_destruct; - (void)setSelected:(_Bool)arg1 animated:(_Bool)arg2; - (void)awakeFromNib; @end
31.482759
123
0.764513
229256e8fa5b1fb402ef77daaa3d58a5afb426d7
340
html
HTML
pyconcz_2016/templates/admin/proposals/change_form.html
pyvec/cz.pycon.org-2016
b4affabcf2b1cdd629a2dc67dba671b3414b3682
[ "MIT" ]
10
2016-01-27T08:37:41.000Z
2018-04-26T08:33:44.000Z
pyconcz_2016/templates/admin/proposals/change_form.html
pyvec/cz.pycon.org-2016
b4affabcf2b1cdd629a2dc67dba671b3414b3682
[ "MIT" ]
101
2015-11-15T11:20:33.000Z
2019-04-03T15:17:47.000Z
pyconcz_2016/templates/admin/proposals/change_form.html
pyvec/cz.pycon.org-2016
b4affabcf2b1cdd629a2dc67dba671b3414b3682
[ "MIT" ]
10
2015-11-15T21:35:53.000Z
2017-01-25T14:30:27.000Z
{% extends "admin/change_form.html" %} {% load i18n admin_urls admin_static admin_modify %} {% block object-tools-items %} {{ block.super }} <li> {% url opts|admin_urlname:'add_score' original.pk|admin_urlquote as score_url %} <a href="{% add_preserved_filters score_url %}">{% trans "Add Score" %}</a> </li> {% endblock %}
28.333333
84
0.661765
b0f5c7aafa916411ee79cf4517596fd6034b7788
3,113
sql
SQL
Code/SCRD_BRE/src/sql/calculation_version.sql
nasa/SCRD
569d063b7df4b2a9e9054bea37edaa6455f1293e
[ "Apache-2.0" ]
1
2015-03-10T08:58:40.000Z
2015-03-10T08:58:40.000Z
Code/SCRD_BRE/src/sql/calculation_version.sql
nasa/SCRD
569d063b7df4b2a9e9054bea37edaa6455f1293e
[ "Apache-2.0" ]
null
null
null
Code/SCRD_BRE/src/sql/calculation_version.sql
nasa/SCRD
569d063b7df4b2a9e9054bea37edaa6455f1293e
[ "Apache-2.0" ]
null
null
null
INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(1, false, 'scenario1', '2013-07-30', 1, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(2, false, 'scenario2', '2009-12-09', 2, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(3, false, 'scenario3', '2013-08-08', 3, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(4, false, 'scenario4', '2013-08-06', 4, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(5, false, 'scenario5', '2013-07-30', 5, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(6, false, 'scenario6', '2013-08-01', 6, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(7, false, 'scenario7', '2013-07-31', 7, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(8, false, 'scenario8', '2013-08-09', 8, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(9, false, 'scenario9', '2013-08-02', 9, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(10, false, 'scenario10', '2013-08-08', 10, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(11, false, 'scenario11', '2013-07-10', 11, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(12, false, 'scenario12', '2013-07-01', 12, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(13, false, 'scenario13', '2008-09-01', 13, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(14, false, 'scenario14', '2013-08-09', 14, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(15, false, 'scenario15', '2013-08-06', 15, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(16, false, 'scenario16', '2013-08-06', 16, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(17, false, 'scenario17', '2013-08-06', 17, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(18, false, 'scenario18', '2013-08-07', 18, 1); INSERT INTO opm.calculation_version(id, deleted, name, calculation_date, calculation_result_id, account_id) VALUES(19, false, 'scenario19', '2013-07-30', 19, 1); ALTER SEQUENCE opm.calculation_version_id_seq RESTART WITH 20;
155.65
161
0.778028
cb74581a31bbc5d6fce9017cff1183e9e18b4d74
7,274
html
HTML
sdk/boost_1_30_0/libs/date_time/doc/class_ptime.html
acidicMercury8/xray-1.0
65e85c0e31e82d612c793d980dc4b73fa186c76c
[ "Linux-OpenIB" ]
2
2020-01-30T12:51:49.000Z
2020-08-31T08:36:49.000Z
sdk/boost_1_30_0/libs/date_time/doc/class_ptime.html
acidicMercury8/xray-1.0
65e85c0e31e82d612c793d980dc4b73fa186c76c
[ "Linux-OpenIB" ]
null
null
null
sdk/boost_1_30_0/libs/date_time/doc/class_ptime.html
acidicMercury8/xray-1.0
65e85c0e31e82d612c793d980dc4b73fa186c76c
[ "Linux-OpenIB" ]
null
null
null
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>posix_time::ptime Documentation</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head> <body> <a href="../../../index.htm"> <img align="left" src="../../../c++boost.gif" alt="C++ Boost"> </a> <h1>posix_time::ptime Documentation</h1> <p>&nbsp;<p> <hr> <a href="index.html">Overall Index</a> -- <a href="gregorian.html">Gregorian Index</a> -- <a href="posix_time.html">Posix Time Index</a> <p> <font class="bold">ptime Documentation</font> <p> <a href="class_ptime.html#header">Header</a> -- <a href="class_ptime.html#construct">Construction</a> -- <a href="class_ptime.html#constructfromstring">Construct from String</a> -- <a href="class_ptime.html#constructfromclock">Construct from Clock</a> -- <a href="class_ptime.html#accessors">Accessors</a> -- <a href="class_ptime.html#conversiontostring">Conversion To String</a> -- <a href="class_ptime.html#operators">Operators</a> <p> <h2><a name="intro">Introduction</a></h2> <p> The class boost::posix_time::ptime is the primary interface for time point manipulation. In general, the ptime class is immutable once constructed although it does allow assignment. <p> Class ptime is dependent on <a href="class_date.html">gregorian::date</a> for the interface to the date portion of a time point. <p> Other techniques for creating times include <a href="time_iterators.html">time iterators</a>. <p> <p> <h2><a name="header">Header</a></h2> <pre> #include "boost/date_time/posix_time/posix_time.hpp" //include all types plus i/o or #include "boost/date_time/posix_time/posix_time_types.hpp" //no i/o just types </pre> <p> <h2><a name="construct">Construction</a></h2> <p> <table border=1 cellspacing=3 cellpadding=3> <tr><td><b>Syntax</b></td><td><b>Description</b></td><td><b>Example</b></td></tr> <tr><td>ptime(date,time_duration)</td> <td>Construct from a date and offset </td> <td>ptime t1(date(2002,Jan,10), time_duration(1,2,3));<br> ptime t2(date(2002,Jan,10), hours(1)+nanosec(5));</td></tr> <tr><td>ptime(ptime)</td> <td>Copy constructor</td> <td>ptime t3(t1)</td></tr> </table> <p> <h2><a name="constructfromstring">Construction From String</a></h2> <p> <table border=1 cellspacing=3 cellpadding=3> <tr><td><b>Syntax</b></td><td><b>Description</b></td><td><b>Example</b></td></tr> <tr><td>ptime <font class="func">time_from_string</font>(const std::string&)</td> <td>From delimited string.</td> <td>std::string ts("2002-01-20 23:59:59.000"); <br> ptime t(time_from_string(ts))</td></tr> <tr><td>ptime <font class="func">from_iso_string</font>(const std::string&)</td> <td>From non delimited iso form string.</td> <td>std::string ts("20020131T235959"); <br> ptime t(from_iso_string(ts))</td></tr> </table> <p> <h2><a name="constructfromclock">Construction From Clock</a></h2> <p> <table border=1 cellspacing=3 cellpadding=3> <tr><td><b>Syntax</b></td><td><b>Description</b></td><td><b>Example</b></td></tr> <tr><td>static ptime second_clock::local_time();</td> <td>Get the local time, second level resolution, based on the time zone settings of the computer.</td> <td>ptime t(second_clock::local_time())</td></tr> <tr><td>static ptime second_clock::universal_time()</td> <td>Get the UTC time.</td> <td>ptime t(second_clock::universal_day())</td></tr> </table> <p> <h2><a name="accessors">Accessors</a></h2> <p> <table border=1 cellspacing=3 cellpadding=3> <tr><td><b>Syntax</b></td><td><b>Description</b></td><td><b>Example</b></td></tr> <tr><td>date <font class="func">date</font>() const</td> <td>Get the date part of a time.</td> <td>date d(2002,Jan,10);<br> ptime t(d, hour(1));<br> t.date() --> 2002-Jan-10;</td></tr> <tr><td>time_duration <font class="func">time_of_day</font>() const</td> <td>Get the time offset in the day.</td> <td>date d(2002,Jan,10);<br> ptime t(d, hour(1));<br> t.time_of_day() --> 01:00:00;</td></tr> </table> <p> <h2><a name="conversiontostring">Conversion To String</a></h2> <p> <table border=1 cellspacing=3 cellpadding=3> <tr><td><b>Syntax</b></td><td><b>Description</b></td><td><b>Example</b></td></tr> <tr><td>std::string <font class="func">to_simple_string</font>(ptime)</td> <td>To YYYY-mmm-DD HH:MM:SS.fffffffff string where mmm 3 char month name. Fractional seconds only included if non-zero.</td> <td>2002-Jan-01 10:00:01.123456789</td></tr> <tr><td>std::string <font class="func">to_iso_string</font>(ptime)</td> <td>Convert to form YYYYMMDDTHHMMSS,fffffffff where T is the date-time separator</td> <td>20020131T100001,123456789</td></tr> <tr><td>std::string <font class="func">to_iso_extended_string</font>(ptime)</td> <td>Convert to form YYYY-MM-DDTHH:MM:SS,fffffffff where T is the date-time separator</td> <td>2002-01-31T10:00:01,123456789</td></tr> </table> <p> <h2><a name="operators">Operators</a></h2> <p> <table border=1 cellspacing=3 cellpadding=3> <tr><td><b>Syntax</b></td><td><b>Description</b></td><td><b>Example</b></td></tr> <tr><td>operator==, operator!=,<br> operator&gt;, operator&lt; <br> operator&gt;=, operator&lt;=</td> <td>A full complement of comparison operators</td> <td>t1 == t2, etc</td></tr> <tr><td>ptime <font class="func">operator+</font>(date_duration) const</td> <td>Return a ptime adding a day offset</td> <td>date d(2002,Jan,1);<br> ptime t(d,minutes(5));<br> date_duration dd(1); <br> ptime t2 = t + dd;</td></tr> <tr><td>ptime <font class="func">operator-</font>(date_duration) const</td> <td>Return a ptime subtracting a day offset</td> <td>date d(2002,Jan,1);<br> ptime t(d,minutes(5));<br> date_duration dd(1); <br> ptime t2 = t - dd;</td></tr> <tr><td>ptime <font class="func">operator+</font>(time_duration) const</td> <td>Return a ptime adding a time duration</td> <td>date d(2002,Jan,1);<br> ptime t(d,minutes(5));<br> ptime t2 = t + hours(1) + minutes(2);</td></tr> <tr><td>ptime <font class="func">operator-</font>(time_duration) const</td> <td>Return a ptime subtracting a time duration</td> <td>date d(2002,Jan,1);<br> ptime t(d,minutes(5));<br> ptime t2 = t - minutes(2);</td></tr> <tr><td>time_duration <font class="func">operator-</font>(ptime) const</td> <td>Take the difference between two times.</td> <td>date d(2002,Jan,1);<br> ptime t1(d,minutes(5));<br> ptime t2(d,seconds(5));<br> time_duration t3 = t2 - t1;//negative result</td></tr> </table> <p> <hr> <address><small> <!-- hhmts start --> Last modified: Sun Oct 13 10:52:41 MST 2002 <!-- hhmts end --> by <a href="mailto:jeff&#64;crystalclearsoftware.com">Jeff Garland</a> &copy; 2000-2002 </small></address> </body> </html>
37.494845
134
0.622903
98a072604c4380c111158d5ce457335bb23c2cfd
2,236
html
HTML
home/templates/home/visitor_in.html
Shrinidhi1904/AtlasCopco
3116d8f7bdff9635952c3db741adc8abe93bfb72
[ "MIT" ]
null
null
null
home/templates/home/visitor_in.html
Shrinidhi1904/AtlasCopco
3116d8f7bdff9635952c3db741adc8abe93bfb72
[ "MIT" ]
null
null
null
home/templates/home/visitor_in.html
Shrinidhi1904/AtlasCopco
3116d8f7bdff9635952c3db741adc8abe93bfb72
[ "MIT" ]
null
null
null
{% extends 'home/base.html' %} {% block content %} <main style="margin-top: 30px;"> <div class="container-fluid"> <!-- DataTales Example --> <div class="card shadow mb-4"> <div class="card-body"> <div class="table-responsive"> <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0"> <thead> <tr> <th> Name </th> <th> Email </th> <th> No.of Visitors </th> <th> Purpose </th> <th> Time </th> <th> Qr Code </th> </tr> </thead> <tbody> {% for visitor in visitor_list %} <tr> <td>{{ visitor.name }}</td> <td>{{ visitor.email }}</td> <td>{{ visitor.no_of_people }}</td> <td>{{ visitor.purpose }}</td> <td>{{ visitor.in_time }}</td> <td> {% if visitor.visit_token %} <form action="{% url 'entry:scanQR' visitor.id %}" method="post"> <input type="hidden" name="scan_id" value=""> <button type="submit" name="scan_btn" class="btn btn-danger">Scan</button> </form> {% else %} Visiting Token<br>Not Assigned {% endif %} </td> </tr> {% endfor %} </tbody> </table> </div> </div> </div> </div> </main> {% endblock content %}
49.688889
118
0.289803
965d0b8295d8afc8214b83c93ff3367e46cf588b
1,051
swift
Swift
Tests/ViewInspectorTests/SwiftUI/AnyViewTests.swift
nrivard/ViewInspector
660ec4d18388e9d45fb25b3ac33df92319914a02
[ "MIT" ]
1
2020-04-27T08:30:10.000Z
2020-04-27T08:30:10.000Z
Tests/ViewInspectorTests/SwiftUI/AnyViewTests.swift
nrivard/ViewInspector
660ec4d18388e9d45fb25b3ac33df92319914a02
[ "MIT" ]
null
null
null
Tests/ViewInspectorTests/SwiftUI/AnyViewTests.swift
nrivard/ViewInspector
660ec4d18388e9d45fb25b3ac33df92319914a02
[ "MIT" ]
1
2020-03-16T15:41:11.000Z
2020-03-16T15:41:11.000Z
import XCTest import SwiftUI @testable import ViewInspector final class AnyViewTests: XCTestCase { func testEnclosedView() throws { let sampleView = Text("Test") let view = AnyView(sampleView) let sut = try view.inspect().anyView().text().content.view as? Text XCTAssertEqual(sut, sampleView) } func testResetsModifiers() throws { let view = AnyView(Text("")).padding() let sut = try view.inspect().anyView().text() XCTAssertEqual(sut.content.modifiers.count, 0) } func testExtractionFromSingleViewContainer() throws { let view = Button(action: { }, label: { AnyView(Text("")) }) XCTAssertNoThrow(try view.inspect().button().anyView()) } func testExtractionFromMultipleViewContainer() throws { let view = HStack { AnyView(Text("")) AnyView(Text("")) } XCTAssertNoThrow(try view.inspect().hStack().anyView(0)) XCTAssertNoThrow(try view.inspect().hStack().anyView(1)) } }
30.911765
75
0.61941
7560d3131007ac2470abfc046dba93d35b043ee8
561
h
C
source/pkgsrc/devel/libfirm/patches/patch-ir_adt_bitfiddle.h
Scottx86-64/dotfiles-1
51004b1e2b032664cce6b553d2052757c286087d
[ "Unlicense" ]
1
2021-11-20T22:46:39.000Z
2021-11-20T22:46:39.000Z
source/pkgsrc/devel/libfirm/patches/patch-ir_adt_bitfiddle.h
Scottx86-64/dotfiles-1
51004b1e2b032664cce6b553d2052757c286087d
[ "Unlicense" ]
null
null
null
source/pkgsrc/devel/libfirm/patches/patch-ir_adt_bitfiddle.h
Scottx86-64/dotfiles-1
51004b1e2b032664cce6b553d2052757c286087d
[ "Unlicense" ]
null
null
null
$NetBSD: patch-ir_adt_bitfiddle.h,v 1.1 2014/11/06 20:46:01 asau Exp $ --- ir/adt/bitfiddle.h.orig 2012-11-16 15:49:24.000000000 +0000 +++ ir/adt/bitfiddle.h @@ -72,6 +72,7 @@ static inline int add_saturated(int x, i * @param x A 32-bit word. * @return The number of bits set in x. */ +#if !defined(__NetBSD__) static inline unsigned popcount(unsigned x) { #if defined(__GNUC__) && __GNUC__ >= 4 @@ -85,6 +86,7 @@ static inline unsigned popcount(unsigned return x & 0x3f; #endif } +#endif /** * Compute the number of leading zeros in a word.
26.714286
70
0.672014
878b523093f9156c79054bdd28c6bc7caa080d79
18,199
html
HTML
doc/html/azx__utils_8h.html
telit/IoT-AppZone-AZX
33df6f3c65545fe94d65d52f5450a5d678739f2c
[ "MIT" ]
1
2021-08-18T03:43:19.000Z
2021-08-18T03:43:19.000Z
doc/html/azx__utils_8h.html
telit/IoT-AppZone-AZX
33df6f3c65545fe94d65d52f5450a5d678739f2c
[ "MIT" ]
null
null
null
doc/html/azx__utils_8h.html
telit/IoT-AppZone-AZX
33df6f3c65545fe94d65d52f5450a5d678739f2c
[ "MIT" ]
null
null
null
<!-- HTML header for doxygen 1.8.15--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.16"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>AZ Extension Libraries: stage/azx/core/hdr/azx_utils.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(document).ready(initResizable); /* @license-end */</script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="telit_style.css" rel="stylesheet" type="text/css"/> <link href="telit_navtree.css" rel="stylesheet" type="text/css"/> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 100px;"> <td id="projectlogo"><img alt="Logo" src="telit-logo.png"/></td> <td id="projectalign" style="padding-left: 2em;"> <div id="projectname">AZ Extension Libraries &#160;<span id="projectnumber">1.1.7.57e4a7a</span> </div> <div id="projectbrief">A set of companion libraries that make AZ development easier</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.16 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('azx__utils_8h.html','');}); /* @license-end */ </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="summary"> <a href="#define-members">Macros</a> &#124; <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">azx_utils.h File Reference</div> </div> </div><!--header--> <div class="contents"> <p>Various helpful utilities. <a href="#details">More...</a></p> <div class="textblock"><code>#include &quot;m2mb_types.h&quot;</code><br /> <code>#include &quot;<a class="el" href="azx__log_8h_source.html">azx_log.h</a>&quot;</code><br /> </div><div class="textblock"><div class="dynheader"> Include dependency graph for azx_utils.h:</div> <div class="dyncontent"> <div class="center"><img src="azx__utils_8h__incl.png" border="0" usemap="#stage_2azx_2core_2hdr_2azx__utils_8h" alt=""/></div> <map name="stage_2azx_2core_2hdr_2azx__utils_8h" id="stage_2azx_2core_2hdr_2azx__utils_8h"> <area shape="rect" title="Various helpful utilities." alt="" coords="33,5,163,47"/> <area shape="rect" title=" " alt="" coords="5,169,113,196"/> <area shape="rect" href="azx__log_8h.html" title="Logging utilities to print on available output channels." alt="" coords="97,95,176,121"/> <area shape="rect" title=" " alt="" coords="137,169,243,196"/> </map> </div> </div><div class="textblock"><div class="dynheader"> This graph shows which files directly or indirectly include this file:</div> <div class="dyncontent"> <div class="center"><img src="azx__utils_8h__dep__incl.png" border="0" usemap="#stage_2azx_2core_2hdr_2azx__utils_8hdep" alt=""/></div> <map name="stage_2azx_2core_2hdr_2azx__utils_8hdep" id="stage_2azx_2core_2hdr_2azx__utils_8hdep"> <area shape="rect" title="Various helpful utilities." alt="" coords="313,5,444,47"/> <area shape="rect" href="azx__ati_8h.html" title="Sending AT commands and handling URCs." alt="" coords="160,95,291,136"/> <area shape="rect" href="azx__connectivity_8h.html" title="Establish network and data connection synchronously and provide info." alt="" coords="261,273,395,315"/> <area shape="rect" href="azx__timer_8h.html" title="A better way to use timers." alt="" coords="365,184,496,225"/> <area shape="rect" href="azx__gpio_8h.html" title="Interact with the modem&#39;s GPIO pins." alt="" coords="416,95,547,136"/> <area shape="rect" href="azx__watchdog_8h.html" title="Software watchdog to detects stalling tasks." alt="" coords="571,95,701,136"/> <area shape="rect" href="azx__adc_8h.html" title="Read from and write to a peripheral via ADC." alt="" coords="5,184,136,225"/> <area shape="rect" href="azx__apn_8h.html" title="Automatically setting APN based on the ICCID of the SIM." alt="" coords="160,184,291,225"/> </map> </div> </div> <p><a href="azx__utils_8h_source.html">Go to the source code of this file.</a></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> Macros</h2></td></tr> <tr class="memitem:ae63391c8b40ed84ad60e84ed2386d1f9"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9">AZX_LIMIT</a>(val, min, max)&#160;&#160;&#160;(val = (val &lt; (min) ? (min) : (val &gt; (max) ? (max) : val)))</td></tr> <tr class="memdesc:ae63391c8b40ed84ad60e84ed2386d1f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Limits a value to a certain interval. <a href="azx__utils_8h.html#ae63391c8b40ed84ad60e84ed2386d1f9">More...</a><br /></td></tr> <tr class="separator:ae63391c8b40ed84ad60e84ed2386d1f9"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a8c7358115439ddd523797f3d027df1f2"><td class="memItemLeft" align="right" valign="top"><a id="a8c7358115439ddd523797f3d027df1f2"></a> #define&#160;</td><td class="memItemRight" valign="bottom"><b>AZX_UTILS_HEX_DUMP_BUFFER_SIZE</b>&#160;&#160;&#160;250</td></tr> <tr class="separator:a8c7358115439ddd523797f3d027df1f2"><td class="memSeparator" colspan="2">&#160;</td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> Functions</h2></td></tr> <tr class="memitem:adf8be666cb37d5c4d1c9c4b9694e2de5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5">azx_sleep_ms</a> (UINT32 ms)</td></tr> <tr class="memdesc:adf8be666cb37d5c4d1c9c4b9694e2de5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Puts the task to sleep for a specified time. <a href="azx__utils_8h.html#adf8be666cb37d5c4d1c9c4b9694e2de5">More...</a><br /></td></tr> <tr class="separator:adf8be666cb37d5c4d1c9c4b9694e2de5"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a079fc61e9774e7c7b178ddcc67617a0f"><td class="memItemLeft" align="right" valign="top">const CHAR *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f">azx_hex_dump</a> (const void *data, UINT32 len)</td></tr> <tr class="memdesc:a079fc61e9774e7c7b178ddcc67617a0f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Dumps HEX data to string. <a href="azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f">More...</a><br /></td></tr> <tr class="separator:a079fc61e9774e7c7b178ddcc67617a0f"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:a75795b5fabfb2be85fc105df383a82bf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf">azx_reboot_now</a> (void)</td></tr> <tr class="memdesc:a75795b5fabfb2be85fc105df383a82bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reboots the modem straight away. <a href="azx__utils_8h.html#a75795b5fabfb2be85fc105df383a82bf">More...</a><br /></td></tr> <tr class="separator:a75795b5fabfb2be85fc105df383a82bf"><td class="memSeparator" colspan="2">&#160;</td></tr> <tr class="memitem:aeaea36b3c4e80ad8a22f172aa36542df"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df">azx_shutdown_now</a> (void)</td></tr> <tr class="memdesc:aeaea36b3c4e80ad8a22f172aa36542df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Shuts the modem down straight away. <a href="azx__utils_8h.html#aeaea36b3c4e80ad8a22f172aa36542df">More...</a><br /></td></tr> <tr class="separator:aeaea36b3c4e80ad8a22f172aa36542df"><td class="memSeparator" colspan="2">&#160;</td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Various helpful utilities. </p> <dl class="section version"><dt>Version</dt><dd>1.0.2 </dd></dl> <dl class="section user"><dt>Dependencies</dt><dd>core/azx_log </dd></dl> <dl class="section author"><dt>Author</dt><dd>Ioannis Demetriou </dd> <dd> Sorin Basca </dd></dl> <dl class="section date"><dt>Date</dt><dd>10/02/2019 </dd></dl> </div><h2 class="groupheader">Macro Definition Documentation</h2> <a id="ae63391c8b40ed84ad60e84ed2386d1f9"></a> <h2 class="memtitle"><span class="permalink"><a href="#ae63391c8b40ed84ad60e84ed2386d1f9">&#9670;&nbsp;</a></span>AZX_LIMIT</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">#define AZX_LIMIT</td> <td>(</td> <td class="paramtype">&#160;</td> <td class="paramname">val, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">min, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">&#160;</td> <td class="paramname">max&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td>&#160;&#160;&#160;(val = (val &lt; (min) ? (min) : (val &gt; (max) ? (max) : val)))</td> </tr> </table> </div><div class="memdoc"> <p>Limits a value to a certain interval. </p> <p>This is defined as a macro so it works with any types that support ordering.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">val</td><td>The value to limit </td></tr> <tr><td class="paramname">min</td><td>The minimum allowed value </td></tr> <tr><td class="paramname">max</td><td>The maximum allowed value</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>The original value if it was inside the limits, or min, or max, if it was less than, or greater than the limits. </dd></dl> </div> </div> <h2 class="groupheader">Function Documentation</h2> <a id="a079fc61e9774e7c7b178ddcc67617a0f"></a> <h2 class="memtitle"><span class="permalink"><a href="#a079fc61e9774e7c7b178ddcc67617a0f">&#9670;&nbsp;</a></span>azx_hex_dump()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const CHAR* azx_hex_dump </td> <td>(</td> <td class="paramtype">const void *&#160;</td> <td class="paramname"><em>data</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">UINT32&#160;</td> <td class="paramname"><em>len</em>&#160;</td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Dumps HEX data to string. </p> <p>Useful for logging binary data. If the data gets trimmed, adjust AZX_UTILS_HEX_DUMP_BUFFER_SIZE in the c file.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>The data to print in hex format </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">len</td><td>The number of bytes</td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>A string with the hex data. The string is valid until the subsequent call to <a class="el" href="azx__utils_8h.html#a079fc61e9774e7c7b178ddcc67617a0f" title="Dumps HEX data to string.">azx_hex_dump()</a>. </dd></dl> </div> </div> <a id="a75795b5fabfb2be85fc105df383a82bf"></a> <h2 class="memtitle"><span class="permalink"><a href="#a75795b5fabfb2be85fc105df383a82bf">&#9670;&nbsp;</a></span>azx_reboot_now()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void azx_reboot_now </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Reboots the modem straight away. </p> <p>This utility will ask the module to reboot. It will not be executed immediately, so code flow must take care of instructions after this one.</p> <dl class="section return"><dt>Returns</dt><dd>None </dd></dl> </div> </div> <a id="aeaea36b3c4e80ad8a22f172aa36542df"></a> <h2 class="memtitle"><span class="permalink"><a href="#aeaea36b3c4e80ad8a22f172aa36542df">&#9670;&nbsp;</a></span>azx_shutdown_now()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void azx_shutdown_now </td> <td>(</td> <td class="paramtype">void&#160;</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Shuts the modem down straight away. </p> <p>This utility will ask the module to shutdown. It will not be executed immediately, so code flow must take care of instructions after this one.</p> <dl class="section return"><dt>Returns</dt><dd>None </dd></dl> </div> </div> <a id="adf8be666cb37d5c4d1c9c4b9694e2de5"></a> <h2 class="memtitle"><span class="permalink"><a href="#adf8be666cb37d5c4d1c9c4b9694e2de5">&#9670;&nbsp;</a></span>azx_sleep_ms()</h2> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void azx_sleep_ms </td> <td>(</td> <td class="paramtype">UINT32&#160;</td> <td class="paramname"><em>ms</em></td><td>)</td> <td></td> </tr> </table> </div><div class="memdoc"> <p>Puts the task to sleep for a specified time. </p> <p>This function returns once the specified number of milliseconds elapses.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">ms</td><td>The number of milliseconds to wait before returning. </td></tr> </table> </dd> </dl> </div> </div> </div><!-- contents --> </div><!-- doc-content --> <!-- HTML footer for doxygen 1.8.15--> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="dir_a451d24824756e59bc0ab465137a1721.html">stage</a></li><li class="navelem"><a class="el" href="dir_159a56f2f375d6f48b3d40b3fd23d10a.html">azx</a></li><li class="navelem"><a class="el" href="dir_3e7d3f5cdeaa0d2916b9c57d66c8d865.html">core</a></li><li class="navelem"><a class="el" href="dir_df95525600129d8bfad6c42108ff5419.html">hdr</a></li><li class="navelem"><a class="el" href="azx__utils_8h.html">azx_utils.h</a></li> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.16 </li> <li class="footer"> © Telit 2019 All rights reserved. <a href="https://telit.com/copyright-policy/">Copyright Policy</a> | <a href="https://www.telit.com/editorial-policy-and-process/">Editorial Policy</a> | <a href="https://telit.com/eu-privacy-policy/">EU Privacy Policy</a> | <a href="https://telit.com/privacy-policy/">Global Privacy Policy</a> | <a href="https://www.telit.com/modern-slavery-statement/">Modern Slavery Statement</a> | <a href="https://telit.com/terms-of-use/">Terms of Use</a> </li> </ul> </div> </body> </html>
52.295977
467
0.674762
2678decda4acfa4c63da54b7b5789f39f4654be4
709
java
Java
src/main/java/net/earthcomputer/multiconnect/transformer/StringCustomPayload.java
barraIhsan/multiconnect
fd91bc8d5c6cdf52308550a4e534f698c7893332
[ "MIT" ]
394
2019-08-15T17:13:48.000Z
2022-03-28T23:10:01.000Z
src/main/java/net/earthcomputer/multiconnect/transformer/StringCustomPayload.java
barraIhsan/multiconnect
fd91bc8d5c6cdf52308550a4e534f698c7893332
[ "MIT" ]
306
2019-08-22T03:35:37.000Z
2022-03-27T23:18:33.000Z
src/main/java/net/earthcomputer/multiconnect/transformer/StringCustomPayload.java
barraIhsan/multiconnect
fd91bc8d5c6cdf52308550a4e534f698c7893332
[ "MIT" ]
84
2019-12-21T19:33:37.000Z
2022-03-27T17:18:55.000Z
package net.earthcomputer.multiconnect.transformer; public final class StringCustomPayload { private final String value; public StringCustomPayload(String value) { this.value = value; } @Override public int hashCode() { return value.hashCode(); } @Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null) return false; if (obj.getClass() != StringCustomPayload.class) return false; StringCustomPayload that = (StringCustomPayload) obj; return value.equals(that.value); } @Override public String toString() { return "StringCustomPayload{" + value + "}"; } }
24.448276
70
0.634697
90caba5121367a1340c3775edf920c9488258bc1
3,195
py
Python
redash/settings.py
slachiewicz/redash
84d95272f31885be00fbeef0cdbf6ddae6037f5d
[ "BSD-2-Clause-FreeBSD" ]
1
2019-06-27T07:40:51.000Z
2019-06-27T07:40:51.000Z
redash/settings.py
slachiewicz/redash
84d95272f31885be00fbeef0cdbf6ddae6037f5d
[ "BSD-2-Clause-FreeBSD" ]
1
2021-03-20T05:38:23.000Z
2021-03-20T05:38:23.000Z
redash/settings.py
slachiewicz/redash
84d95272f31885be00fbeef0cdbf6ddae6037f5d
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
import json import os import urlparse def parse_db_url(url): url_parts = urlparse.urlparse(url) connection = {'threadlocals': True} if url_parts.hostname and not url_parts.path: connection['name'] = url_parts.hostname else: connection['name'] = url_parts.path[1:] connection['host'] = url_parts.hostname connection['port'] = url_parts.port connection['user'] = url_parts.username connection['password'] = url_parts.password return connection def fix_assets_path(path): fullpath = os.path.join(os.path.dirname(__file__), path) return fullpath def array_from_string(str): array = str.split(',') if "" in array: array.remove("") return array def parse_boolean(str): return json.loads(str.lower()) NAME = os.environ.get('REDASH_NAME', 're:dash') REDIS_URL = os.environ.get('REDASH_REDIS_URL', "redis://localhost:6379/0") STATSD_HOST = os.environ.get('REDASH_STATSD_HOST', "127.0.0.1") STATSD_PORT = int(os.environ.get('REDASH_STATSD_PORT', "8125")) STATSD_PREFIX = os.environ.get('REDASH_STATSD_PREFIX', "redash") # Connection settings for re:dash's own database (where we store the queries, results, etc) DATABASE_CONFIG = parse_db_url(os.environ.get("REDASH_DATABASE_URL", "postgresql://postgres")) # Celery related settings CELERY_BROKER = os.environ.get("REDASH_CELERY_BROKER", REDIS_URL) CELERY_BACKEND = os.environ.get("REDASH_CELERY_BACKEND", REDIS_URL) # The following enables periodic job (every 5 minutes) of removing unused query results. Behind this "feature flag" until # proved to be "safe". QUERY_RESULTS_CLEANUP_ENABLED = parse_boolean(os.environ.get("REDASH_QUERY_RESULTS_CLEANUP_ENABLED", "false")) AUTH_TYPE = os.environ.get("REDASH_AUTH_TYPE", "hmac") PASSWORD_LOGIN_ENABLED = parse_boolean(os.environ.get("REDASH_PASSWORD_LOGIN_ENABLED", "true")) # Google Apps domain to allow access from; any user with email in this Google Apps will be allowed # access GOOGLE_APPS_DOMAIN = os.environ.get("REDASH_GOOGLE_APPS_DOMAIN", "") GOOGLE_CLIENT_ID = os.environ.get("REDASH_GOOGLE_CLIENT_ID", "") GOOGLE_CLIENT_SECRET = os.environ.get("REDASH_GOOGLE_CLIENT_SECRET", "") GOOGLE_OAUTH_ENABLED = GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET STATIC_ASSETS_PATH = fix_assets_path(os.environ.get("REDASH_STATIC_ASSETS_PATH", "../rd_ui/app/")) JOB_EXPIRY_TIME = int(os.environ.get("REDASH_JOB_EXPIRY_TIME", 3600 * 6)) COOKIE_SECRET = os.environ.get("REDASH_COOKIE_SECRET", "c292a0a3aa32397cdb050e233733900f") LOG_LEVEL = os.environ.get("REDASH_LOG_LEVEL", "INFO") CLIENT_SIDE_METRICS = parse_boolean(os.environ.get("REDASH_CLIENT_SIDE_METRICS", "false")) ANALYTICS = os.environ.get("REDASH_ANALYTICS", "") # Query Runners QUERY_RUNNERS = array_from_string(os.environ.get("REDASH_ENABLED_QUERY_RUNNERS", ",".join([ 'redash.query_runner.big_query', 'redash.query_runner.graphite', 'redash.query_runner.mongodb', 'redash.query_runner.mysql', 'redash.query_runner.pg', 'redash.query_runner.script', 'redash.query_runner.url', ]))) # Features: FEATURE_TABLES_PERMISSIONS = parse_boolean(os.environ.get("REDASH_FEATURE_TABLES_PERMISSIONS", "false"))
35.898876
121
0.749609
3d0ce0e21d28382fe28481fe0d484508877225e6
1,764
rs
Rust
src/lib.rs
crumblingstatue/x11-screenshot-rs
67ce80740232166443cb3d9eb3b2e4d9d935d7ae
[ "MIT" ]
1
2019-12-03T19:30:00.000Z
2019-12-03T19:30:00.000Z
src/lib.rs
crumblingstatue/x11-screenshot-rs
67ce80740232166443cb3d9eb3b2e4d9d935d7ae
[ "MIT" ]
1
2021-02-04T09:04:26.000Z
2021-02-04T09:09:49.000Z
src/lib.rs
crumblingstatue/x11-screenshot-rs
67ce80740232166443cb3d9eb3b2e4d9d935d7ae
[ "MIT" ]
1
2021-02-04T07:59:02.000Z
2021-02-04T07:59:02.000Z
#![allow(dead_code)] extern crate x11; extern crate libc; extern crate image; use self::libc::{c_int, c_ulong}; use std::ffi::CString; use x11::xlib; use std::{slice, ptr}; use self::image::{RgbImage, Rgb, Pixel}; pub struct Screen { display: *mut xlib::Display, window: xlib::Window } #[derive(Debug)] pub struct bgr { b: u8, g: u8, r: u8, _pad: u8, } impl Screen { pub fn new() -> Screen{ unsafe { let display = xlib::XOpenDisplay(ptr::null()); let screen = xlib::XDefaultScreen(display); let root = xlib::XRootWindow(display, screen); Screen{ display: display, window: root } } } pub fn cap_frame(&self, w: u32, h: u32, x: i32, y: i32) -> image::ImageBuffer<image::Rgb<u8>, Vec<u8>>{ let mut img = unsafe { xlib::XGetImage(self.display, self.window, x, y, w, h, !1 as c_ulong, 2 as c_int) }; let mut fullimg = RgbImage::new(w, h); if(!img.is_null()){ let image = unsafe { &mut *img }; let sl: &[bgr] = unsafe { slice::from_raw_parts((image).data as *const _, (image).width as usize * (image).height as usize)}; let clone = fullimg.clone(); let mut pixs = clone.enumerate_pixels(); for mut x in sl{ let (xc,yc,p) = pixs.next().unwrap(); fullimg.put_pixel(xc,yc,*Rgb::from_slice(&[x.r,x.g,x.b])); } } unsafe {xlib::XDestroyImage(img as *mut _);} fullimg } }
27.138462
107
0.477891
2a69e61017679ec29a209949735344de33ca3f42
4,841
java
Java
src/io/github/gronnmann/coinflipper/history/HistoryManager.java
gronnmann/CoinFlipper
848df65adf5668cc8f5c92f6bdc77b4b8a716669
[ "MIT" ]
5
2017-03-20T14:29:57.000Z
2020-06-14T17:00:24.000Z
src/io/github/gronnmann/coinflipper/history/HistoryManager.java
gronnmann/CoinFlipper
848df65adf5668cc8f5c92f6bdc77b4b8a716669
[ "MIT" ]
21
2017-07-28T15:28:27.000Z
2022-02-27T09:17:01.000Z
src/io/github/gronnmann/coinflipper/history/HistoryManager.java
gronnmann/CoinFlipper
848df65adf5668cc8f5c92f6bdc77b4b8a716669
[ "MIT" ]
13
2017-03-30T04:04:34.000Z
2022-02-11T20:28:52.000Z
package io.github.gronnmann.coinflipper.history; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Date; import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; import io.github.gronnmann.coinflipper.CoinFlipper; import io.github.gronnmann.coinflipper.SQLManager; import io.github.gronnmann.coinflipper.customizable.CustomMaterial; import io.github.gronnmann.coinflipper.customizable.Message; import io.github.gronnmann.utils.coinflipper.ItemUtils; import io.github.gronnmann.utils.pagedinventory.coinflipper.PagedInventory; public class HistoryManager{ private HistoryManager() {} private static HistoryManager logger = new HistoryManager(); public static HistoryManager getLogger() {return logger;} public void logGame(String winner, String loser, double money, double moneyPot, double tax) { Connection conn = SQLManager.getManager().getSQLConnection(); new BukkitRunnable() { public void run() { try { PreparedStatement log = conn.prepareStatement( "INSERT INTO coinflipper_history(time, winner, loser, moneyWon,moneyPot, tax) VALUES (?,?,?,?,?,?)"); log.setLong(1, System.currentTimeMillis()); log.setString(2, winner); log.setString(3, loser); log.setDouble(4, money); log.setDouble(5, moneyPot); log.setDouble(6, tax); log.execute(); } catch (SQLException e) { System.out.println("Failed logging game..."); e.printStackTrace(); } } }.runTaskAsynchronously(CoinFlipper.getMain()); } public Inventory getHistory(Player p) { PagedInventory gonnaBeHistory = new PagedInventory(Message.HISTORY_INVENTORY.getMessage().replaceAll("%player%", p.getName()), ItemUtils.createItem(Material.ARROW, Message.NEXT.getMessage()), ItemUtils.createItem(Material.ARROW, Message.PREVIOUS.getMessage()), ItemUtils.createItem(CustomMaterial.BACK.getMaterial(), Message.BACK.getMessage()), "coinflipper_history_" + p.getName(), null, true); BukkitRunnable historyGetter = new BukkitRunnable() { String uuid = p.getUniqueId().toString(); @Override public void run() { try { PreparedStatement getHistory = SQLManager.getManager().getSQLConnection().prepareStatement( "SELECT * FROM coinflipper_history WHERE ? IN (winner, loser) ORDER BY time DESC" ); getHistory.setString(1, uuid); ResultSet rs = getHistory.executeQuery(); while(rs.next()) { String winner = rs.getString("winner"); String loser = rs.getString("loser"); int id = rs.getInt("id"); long time = rs.getLong("time"); double moneyWon = rs.getDouble("moneyWon"); double moneyPot = rs.getDouble("moneyPot"); double tax = rs.getDouble("tax"); boolean won = winner.equals(uuid) ? true : false; int colorId = won ? 5 : 14; ItemStack historyId = ItemUtils.createItem(Material.STAINED_GLASS_PANE, Message.HISTORY_GAME.getMessage().replaceAll("%id%", id+""), colorId); Date timeDate = new Date(time); ItemUtils.addToLore(historyId, Message.HISTORY_TIME.getMessage().replace("%time%", timeDate.toLocaleString())); String opponent = won ? loser : winner; if (!opponent.equals(SQLManager.convertedUUID)) { opponent = Bukkit.getOfflinePlayer(UUID.fromString(opponent)).getName(); ItemUtils.addToLore(historyId, Message.HISTORY_OPPONENT.getMessage().replace("%opponent%", opponent)); } ItemUtils.addToLore(historyId, ""); String status = won ? Message.HISTORY_VICTORY.getMessage() : Message.HISTORY_LOSS.getMessage(); ItemUtils.addToLore(historyId, status); ItemUtils.addToLore(historyId, Message.HISTORY_IN_POT.getMessage().replace("%money%", moneyPot+"")); double moneyReplace = won ? moneyWon : moneyPot/2; String moneyStatus = won ? Message.HISTORY_MONEY_WON.getMessage().replace("%money%", moneyReplace+"") : Message.HISTORY_MONEY_LOST.getMessage().replace("%money%", moneyReplace+""); ItemUtils.addToLore(historyId, moneyStatus); ItemUtils.addToLore(historyId, Message.HISTORY_TAX.getMessage().replace("%tax%", tax+"")); gonnaBeHistory.addItem(historyId); } }catch(Exception e) { e.printStackTrace(); System.out.println("[CoinFlipper] Failed fetching game history for " + p.getName()); } } }; historyGetter.runTaskAsynchronously(CoinFlipper.getMain()); return gonnaBeHistory.getPage(0); } }
34.091549
148
0.69056
3d742b01fe3a2c69eb4ff321ff459b3f97ad9013
445
rs
Rust
FRENCH/listings/ch10-generic-types-traits-and-lifetimes/listing-10-24/src/main.rs
frytos/rust-book-fr
1e06c1fbc82923a7896ba3834b95c1195b7df6e1
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
104
2019-08-03T12:08:47.000Z
2022-03-26T00:47:27.000Z
FRENCH/listings/ch10-generic-types-traits-and-lifetimes/listing-10-24/src/main.rs
frytos/rust-book-fr
1e06c1fbc82923a7896ba3834b95c1195b7df6e1
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
172
2019-07-29T16:04:21.000Z
2022-03-29T08:43:06.000Z
FRENCH/listings/ch10-generic-types-traits-and-lifetimes/listing-10-24/src/main.rs
frytos/rust-book-fr
1e06c1fbc82923a7896ba3834b95c1195b7df6e1
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
39
2019-07-29T15:49:55.000Z
2022-03-28T12:28:42.000Z
// ANCHOR: here fn main() { let string1 = String::from("une longue chaîne est longue"); let resultat; { let string2 = String::from("xyz"); resultat = la_plus_longue(string1.as_str(), string2.as_str()); } println!("La chaîne la plus longue est {}", resultat); } // ANCHOR_END: here fn la_plus_longue<'a>(x: &'a str, y: &'a str) -> &'a str { if x.len() > y.len() { x } else { y } }
22.25
70
0.541573
7c6f2530ec35017efc9bd01e09ef89d093c6c458
8,060
swift
Swift
Caculator/CalculatorBrain.swift
mohakshah/graphing-calculator
c1c8218f52d7f7397a550970bb55f1e2ce2a046f
[ "MIT" ]
null
null
null
Caculator/CalculatorBrain.swift
mohakshah/graphing-calculator
c1c8218f52d7f7397a550970bb55f1e2ce2a046f
[ "MIT" ]
null
null
null
Caculator/CalculatorBrain.swift
mohakshah/graphing-calculator
c1c8218f52d7f7397a550970bb55f1e2ce2a046f
[ "MIT" ]
null
null
null
// // CalculatorBrain.swift // Caculator // // Created by Mohak Shah on 05/07/16. // Copyright © 2016 Mohak Shah. All rights reserved. // import Foundation class CalculatorBrain { private var accumulator = 0.0 private var internalProgram = [AnyObject]() func setOperand(operand: Double) { accumulator = operand internalProgram.append(operand) } private var operations: Dictionary<String, Operation> = [ "π" : Operation.Constant(M_PI), "e" : Operation.Constant(M_E), "sin" : Operation.UnaryOperation(sin), "tan" : Operation.UnaryOperation(tan), "log" : Operation.UnaryOperation(log10), "√" : Operation.UnaryOperation(sqrt), "±" : Operation.UnaryOperation { -$0 }, "+" : Operation.BinaryOperation {$0 + $1}, "−" : Operation.BinaryOperation {$0 - $1}, "×" : Operation.BinaryOperation {$0 * $1}, "÷" : Operation.BinaryOperation {$0 / $1}, "?" : Operation.Random { Double(arc4random_uniform(UINT32_MAX)) / Double(UINT32_MAX)}, "=" : Operation.Equals ] private enum Operation { case Constant(Double) case UnaryOperation((Double) -> Double) case BinaryOperation((Double, Double) -> Double) case Random(() -> Double) case Equals } func setOperand(variableName: String) { if let value = variableValues[variableName] { accumulator = value } else { accumulator = 0.0 } internalProgram.append(variableName) } var variableValues = [String: Double]() func performOperation(symbol: String) { internalProgram.append(symbol) if let operation = operations[symbol] { switch operation { case Operation.Constant(let value): accumulator = value case Operation.UnaryOperation(let function): accumulator = function(accumulator) case Operation.BinaryOperation(let function): executePendingBinaryOperation() pendingBinaryOperation = PendingBinaryOperationInfo(binaryOperation: function, firstOperand: accumulator) case Operation.Random(let function): accumulator = function() case Operation.Equals: executePendingBinaryOperation() } } } private var pendingBinaryOperation: PendingBinaryOperationInfo? = nil private struct PendingBinaryOperationInfo { var binaryOperation: (Double, Double) -> Double var firstOperand: Double } private func executePendingBinaryOperation() { if let pending = pendingBinaryOperation { accumulator = pending.binaryOperation(pending.firstOperand, accumulator) pendingBinaryOperation = nil } } var isPartialResult: Bool { get { return pendingBinaryOperation == nil ? false : true } } typealias PropertyList = AnyObject var program: PropertyList { get { return internalProgram } set { clear() if let arrayOfOps = newValue as? [AnyObject] { for op in arrayOfOps { if let operand = op as? Double { setOperand(operand) } else if let symbol = op as? String { if let _ = operations[symbol] { performOperation(symbol) } else { setOperand(symbol) } } } } } } func clear() { accumulator = 0.0 pendingBinaryOperation = nil internalProgram.removeAll() } func undo() { if let arrayOfOps = program as? [AnyObject] { program = Array(arrayOfOps.dropLast(1)) } } var description: String { var _description = [String]() var newEquation = false var needOperand = false for op in internalProgram { if let operand = op as? Double { // drop the old equation if newEquation { _description.removeAll() } _description.append("\(PrettyDoubles.prettyStringFrom(double: operand))") needOperand = false newEquation = false } else if let symbol = op as? String { if let operation = operations[symbol] { switch operation { case .UnaryOperation(_): var openBracketIndex, closeBracketIndex: Int if newEquation { openBracketIndex = 0 closeBracketIndex = _description.count + 1 } else { openBracketIndex = _description.count - 1 // happens when the stack's first element is an operation if openBracketIndex < 0 { openBracketIndex = 0 } closeBracketIndex = _description.count + 1 } _description.insert("\(symbol)(", atIndex: openBracketIndex) _description.insert(")", atIndex: closeBracketIndex) newEquation = true case .BinaryOperation(_): _description.append(" \(symbol) ") newEquation = false needOperand = true case .Equals: if needOperand { if let lastOperator = _description.popLast() { // add brackets around the equation if there are more than 1 operands if (_description.count > 1) { _description.insert("(", atIndex: 0) _description.append(")") } _description.appendContentsOf([lastOperator] + _description) } } newEquation = true case .Constant(_): fallthrough case .Random(_): if newEquation { _description.removeAll() } _description.append("\(symbol)") needOperand = false newEquation = false } } else { // assume that the symbol is a variable if newEquation { _description.removeAll() } _description.append("\(symbol)") needOperand = false newEquation = false } } } // return the array as a single string return _description.joinWithSeparator("") } var result: Double { // simple way to re-evaluate the program // by calling the setter of the program var let foo = program program = foo return accumulator } }
33.443983
121
0.459305