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
791c49a39658695c22ff021fc0fe1c491ae7033e
9,295
lua
Lua
Framework/EsoUi/libraries/utility/zo_treecontrol.lua
martin-repo/eso-addon-framework
5a0873e624abee2b560b47cdd8571bb24b526663
[ "MIT" ]
3
2021-09-19T00:31:05.000Z
2021-12-22T07:30:15.000Z
Framework/EsoUi/libraries/utility/zo_treecontrol.lua
martin-repo/eso-addon-framework
5a0873e624abee2b560b47cdd8571bb24b526663
[ "MIT" ]
null
null
null
Framework/EsoUi/libraries/utility/zo_treecontrol.lua
martin-repo/eso-addon-framework
5a0873e624abee2b560b47cdd8571bb24b526663
[ "MIT" ]
null
null
null
--[[ This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:28' using the latest game version. NOTE: This file should only be used as IDE support; it should NOT be distributed with addons! **************************************************************************** CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC. **************************************************************************** ]] --[[ The tree node --]] local ZO_TreeControlNode = ZO_Object:Subclass() function ZO_TreeControlNode:New(myTree, controlData, myParent, childIndent) local node = ZO_Object.New(self) node.m_OwningTree = myTree node.m_Control = controlData node.m_Expanded = true node.m_Showing = true node.m_Child = nil node.m_Sibling = nil node.m_Parent = myParent node.m_ExpandedCallback = nil node.m_ChildIndent = childIndent return node end function ZO_TreeControlNode:SetExpandedCallback(callback) self.m_ExpandedCallback = callback end local function DetermineVisibility(node) if(node) then local parentShowing = true local parentExpanded = true if(node.m_Parent) then parentShowing = node.m_Parent:IsShowing() parentExpanded = node.m_Parent:IsExpanded() end node.m_Showing = parentShowing and parentExpanded if(node.m_Child) then DetermineVisibility(node.m_Child) end if(node.m_Sibling) then DetermineVisibility(node.m_Sibling) end end end function ZO_TreeControlNode:ToggleExpanded(expanded) if(expanded == nil) then expanded = not self.m_Expanded end self.m_Expanded = expanded if(self.m_ExpandedCallback) then self.m_ExpandedCallback(self, expanded) end if(expanded) then --climb the tree opening un-expanded parents local lastChangedParent = self local curParent = self.m_Parent while(curParent ~= nil) do if(not curParent.m_Expanded) then curParent.m_Expanded = true if(curParent.m_ExpandedCallback) then curParent.m_ExpandedCallback(curParent, true) end lastChangedParent = curParent end curParent = curParent.m_Parent end --update visibility from the highest changed node DetermineVisibility(lastChangedParent) else DetermineVisibility(self) end -- Update the whole tree. self.m_OwningTree:Update() end function ZO_TreeControlNode:IsExpanded() return self.m_Expanded end function ZO_TreeControlNode:IsShowing() return self.m_Showing end function ZO_TreeControlNode:HasChildren() return (self.m_Child ~= nil) end function ZO_TreeControlNode:GetNestingLevel() local nestingLevel = 0 local ancestor = self.m_Parent while(ancestor ~= self.m_OwningTree.m_Root) do nestingLevel = nestingLevel + 1 ancestor = ancestor.m_Parent end return nestingLevel end function ZO_TreeControlNode:GetControl() return self.m_Control end function ZO_TreeControlNode:GetOwningTree() return self.m_OwningTree end function ZO_TreeControlNode:GetNextSibling() return self.m_Sibling end function ZO_TreeControlNode:GetParent() return self.m_Parent end function ZO_TreeControlNode:GetChildIndent() return self.m_ChildIndent end function ZO_TreeControlNode:SetOffsetY(offsetY) self.m_OffsetY = offsetY end --[[ The tree control --]] ZO_TreeControl = ZO_Object:Subclass() local DEFAULT_INDENT_OFFSET = 10 local DEFAULT_LINE_SPACING = 5 function ZO_TreeControl:New(initialAnchor, indentXOffset, verticalSpacing) local tree = ZO_Object.New(self) tree.m_Root = ZO_TreeControlNode:New(tree) tree.m_OffsetX = indentXOffset or DEFAULT_INDENT_OFFSET tree.m_OffsetY = verticalSpacing or DEFAULT_LINE_SPACING tree.m_InitialAnchor = initialAnchor return tree end function ZO_TreeControl:AddChild(atNode, insertedControl, childIndent) atNode = atNode or self.m_Root if(atNode == nil) then return nil end -- If root is the insertion point, and there is no child add the new node as Root's first child if((atNode == self.m_Root) and (self.m_Root.m_Child == nil)) then local newNode = ZO_TreeControlNode:New(self, insertedControl, self.m_Root, childIndent) self.m_Root.m_Child = newNode return newNode end -- Find the last sibling of atNode's first child and insert after that. if(atNode.m_Child == nil) then local newNode = ZO_TreeControlNode:New(self, insertedControl, atNode, childIndent) atNode.m_Child = newNode return newNode end return self:AddSibling(atNode.m_Child, insertedControl, childIndent) end local ADD_HERE = 1 local ADD_ON_END = 2 local function AddSiblingInternal(self, atNode, insertedControl, where, childIndent) atNode = atNode or self.m_Root.m_Child if((not atNode) or (atNode == self.m_Root)) then return nil end local newNode = ZO_TreeControlNode:New(self, insertedControl, atNode.m_Parent, childIndent) if(where == ADD_ON_END) then while(atNode.m_Sibling) do atNode = atNode.m_Sibling end atNode.m_Sibling = newNode else newNode.m_Sibling = atNode.m_Sibling atNode.m_Sibling = newNode end return newNode end function ZO_TreeControl:AddSibling(atNode, insertedControl, childIndent) return AddSiblingInternal(self, atNode, insertedControl, ADD_ON_END, childIndent) end function ZO_TreeControl:AddSiblingAfterNode(atNode, insertedControl, childIndent) return AddSiblingInternal(self, atNode, insertedControl, ADD_HERE, childIndent) end -- NOTE: This removes entire subtrees, but does not inform the controls in those subtrees that they have been -- removed. That needs to be handled by whatever is calling RemoveNode. function ZO_TreeControl:RemoveNode(node) if(node == self.m_Root) then self:Clear() return end if(node.m_Parent) then if(node.m_Parent.m_Child == node) then node.m_Parent.m_Child = node.m_Sibling return end local previousSibling = nil local currentSibling = node.m_Parent.m_Child if(currentSibling == nil) then d("ZO_TreeControl: Corrupted tree. Parent of: ", node, "...has no children.") return end while((currentSibling ~= node) and (currentSibling ~= nil)) do previousSibling = currentSibling currentSibling = currentSibling.m_Sibling end if(currentSibling == node) then previousSibling.m_Sibling = node.m_Sibling end end end function ZO_TreeControl:Clear() self.m_Root = ZO_TreeControlNode:New(self) end function ZO_TreeControl:Update(updateFromNode, indent, anchor, firstControl) local node = updateFromNode or self.m_Root indent = indent or 0 anchor = anchor or ZO_Anchor:New(self.m_InitialAnchor) if(firstControl == nil) then firstControl = true end if(node) then local hidden = not node:IsShowing() if(node.m_Control) then node.m_Control:SetHidden(hidden) if(not hidden) then if(firstControl) then self.m_InitialAnchor:Set(node.m_Control) firstControl = false else anchor:SetOffsets(indent, node.m_OffsetY or self.m_OffsetY) anchor:Set(node.m_Control) end anchor:SetTarget(node.m_Control) anchor:SetRelativePoint(self.m_relativePoint or BOTTOMLEFT) end end local backOffIndent = false if(node.m_Child) then if(node == self.m_Root) then indent = 0 else indent = node:GetChildIndent() or self.m_OffsetX end anchor, indent = self:Update(node.m_Child, indent, anchor, firstControl) backOffIndent = node.m_Child:IsShowing() end if(backOffIndent) then indent = indent - (node:GetChildIndent() or self.m_OffsetX) else indent = 0 end node = node.m_Sibling if(node) then return self:Update(node, indent, anchor, firstControl) end end return anchor, indent end function ZO_TreeControl:SetRelativePoint(relativePoint) self.m_relativePoint = relativePoint end function ZO_TreeControl:SetIndent(indentX) self.m_OffsetX = indentX end
27.099125
109
0.61915
145040a66d2db4d717eed0cd57d8dcb62ff4dec6
1,166
ts
TypeScript
src/employees/employees.service.ts
Ievgenii91/horeca-admin-api-server
688a166a26a2ffda9dc86620e430c11183c67290
[ "MIT" ]
1
2021-04-16T08:33:27.000Z
2021-04-16T08:33:27.000Z
src/employees/employees.service.ts
Ievgenii91/horeca-admin-api-server
688a166a26a2ffda9dc86620e430c11183c67290
[ "MIT" ]
null
null
null
src/employees/employees.service.ts
Ievgenii91/horeca-admin-api-server
688a166a26a2ffda9dc86620e430c11183c67290
[ "MIT" ]
null
null
null
import { Injectable } from '@nestjs/common'; import { InjectModel } from '@nestjs/mongoose'; import { Model, QueryOptions } from 'mongoose'; import { Employee, EmployeeDocument } from 'src/schemas/employee.schema'; import { CreateEmployeeDto } from './dto/create-employee.dto'; import { UpdateEmployeeDto } from './dto/update-employee.dto'; const options: Partial<QueryOptions> = { new: true, useFindAndModify: false, }; @Injectable() export class EmployeesService { constructor( @InjectModel(Employee.name) private employeeModel: Model<EmployeeDocument>, ) {} create(createEmployeeDto: CreateEmployeeDto) { const employee = new this.employeeModel(createEmployeeDto); return employee.save(); } findAll(clientId: string) { return this.employeeModel.find({ clientId }).exec(); } findOne(_id: string) { return this.employeeModel.find({ _id }).exec(); } update(_id: string, updateEmployeeDto: UpdateEmployeeDto) { return this.employeeModel .findOneAndUpdate({ _id }, { $set: updateEmployeeDto }, options) .exec(); } remove(_id: string) { return this.employeeModel.deleteOne({ _id }).exec(); } }
27.761905
79
0.702401
33cceda2904df13075f06ab26cdb79c0a62de474
3,764
h
C
three/cameras/perspective_camera.h
Graphics-Physics-Libraries/three-cpp-works-imported
9df305135187c5db9247a44537290e181350e26c
[ "MIT" ]
4
2016-08-09T21:56:43.000Z
2020-10-16T16:39:53.000Z
three/cameras/perspective_camera.h
Graphics-Physics-Libraries/three-cpp-works-imported
9df305135187c5db9247a44537290e181350e26c
[ "MIT" ]
1
2017-03-25T08:41:05.000Z
2017-03-25T08:41:05.000Z
three/cameras/perspective_camera.h
Graphics-Physics-Libraries/three-cpp-works-imported
9df305135187c5db9247a44537290e181350e26c
[ "MIT" ]
1
2019-09-07T06:45:35.000Z
2019-09-07T06:45:35.000Z
#ifndef THREE_PERSPECTIVE_CAMERA_H #define THREE_PERSPECTIVE_CAMERA_H #include <three/common.h> #include <three/math/math.h> #include <three/cameras/camera.h> namespace three { class PerspectiveCamera : public Camera { public: THREE_IMPL_OBJECT(PerspectiveCamera); static Ptr create( float fov = 50.f, float aspect = 1.f, float near = 0.1f, float far = 2000.f ) { return make_shared<PerspectiveCamera>( fov, aspect, near, far ); } float fov, aspect; float fullWidth, fullHeight; float x, y; float width, height; void setLens( float focalLength, float frameHeight = 24.f ) { fov = 2.f * Math::radToDeg( Math::atan( frameHeight / ( focalLength * 2.f ) ) ); updateProjectionMatrix(); } /** * Sets an offset in a larger frustum. This is useful for multi-window or * multi-monitor/multi-machine setups. * * For example, if you have 3x2 monitors and each monitor is 1920x1080 and * the monitors are in grid like this * * +---+---+---+ * | A | B | C | * +---+---+---+ * | D | E | F | * +---+---+---+ * * then for each monitor you would call it like this * * var w = 1920; * var h = 1080; * var fullWidth = w * 3; * var fullHeight = h * 2; * * --A-- * camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h ); * --B-- * camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h ); * --C-- * camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h ); * --D-- * camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h ); * --E-- * camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h ); * --F-- * camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h ); * * Note there is no reason monitors have to be the same size or in a grid. */ void setViewOffset( float fullWidthIn, float fullHeightIn, float xIn, float yIn, float widthIn, float heightIn ) { fullWidth = fullWidthIn; fullHeight = fullHeightIn; x = xIn; y = yIn; width = widthIn; height = heightIn; updateProjectionMatrix(); } void updateProjectionMatrix() { if ( fullWidth != 0.f ) { auto aspect = fullWidth / fullHeight; auto top = Math::tan( Math::degToRad( fov * 0.5f ) ) * near; auto bottom = -top; auto left = aspect * bottom; auto right = aspect * top; auto width = Math::abs( right - left ); auto height = Math::abs( top - bottom ); projectionMatrix.makeFrustum( left + x * width / fullWidth, left + ( x + width ) * width / fullWidth, top - ( y + height ) * height / fullHeight, top - y * height / fullHeight, near, far ); } else { projectionMatrix.makePerspective( fov, aspect, near, far ); } } protected: PerspectiveCamera( float fov, float aspect, float near, float far ) : Camera( near, far ), fov( fov ), aspect( aspect ), fullWidth( 0 ), fullHeight( 0 ), x( 0 ), y( 0 ), width( 0 ), height( 0 ) { updateProjectionMatrix(); } virtual void __clone( Object3D::Ptr& cloned, bool recursive ) const THREE_OVERRIDE { if ( !cloned ) cloned = create(); Camera::__clone( cloned, recursive ); auto& camera = static_cast<PerspectiveCamera&>( *cloned ); camera.fov = fov; camera.aspect = aspect; camera.fullWidth = fullWidth; camera.fullHeight = fullHeight; camera.x = x; camera.y = y; camera.width = width; camera.height = height; } }; } // namespace three #endif // THREE_PERSPECTIVE_CAMERA_H
25.605442
116
0.565887
a36e4123c32e0b11f07943aebd017677bcc42efa
109
java
Java
src/test/java/lightningtalk/EventSource.java
seerhein-lab/jic
e3a3243ec8640cdfe9ab0c3eee662c260d2485cf
[ "Apache-2.0" ]
1
2020-02-18T23:23:37.000Z
2020-02-18T23:23:37.000Z
src/test/java/lightningtalk/EventSource.java
seerhein-lab/jic
e3a3243ec8640cdfe9ab0c3eee662c260d2485cf
[ "Apache-2.0" ]
null
null
null
src/test/java/lightningtalk/EventSource.java
seerhein-lab/jic
e3a3243ec8640cdfe9ab0c3eee662c260d2485cf
[ "Apache-2.0" ]
null
null
null
package lightningtalk; public interface EventSource { void registerListener(EventListener eventListener); }
21.8
52
0.844037
51c78d3118e111dbf9e2e8f907b01270c69200a2
5,283
sql
SQL
test/helpers/type.sql
BlueTreble/variant
527cb8b2a85bec118de157bcee46d83fa98ec45a
[ "BSD-2-Clause" ]
3
2015-08-04T09:47:09.000Z
2021-05-09T22:31:19.000Z
test/helpers/type.sql
BlueTreble/variant
527cb8b2a85bec118de157bcee46d83fa98ec45a
[ "BSD-2-Clause" ]
6
2015-03-20T17:32:36.000Z
2015-07-15T18:54:23.000Z
test/helpers/type.sql
BlueTreble/variant
527cb8b2a85bec118de157bcee46d83fa98ec45a
[ "BSD-2-Clause" ]
2
2015-07-15T22:31:08.000Z
2019-03-20T16:18:44.000Z
\set ECHO none /* For each type we want to test: text_in() text_out() type_out() comparators (variant to variant and variant to original) Actual storage and retrieval NULL original data (NULL variants should be tested separately) Overall plan: 1: Start with an original value in a "big" type (ie: numeric vs other number formats). 2: Create text representation of that casted to specific data type 3: Verify text representation is equal to original value when evaluated 4: Use text representation to insert into a variant field 5: SET variant_b = text_in( text_out( variant_a ) ) 6: Verify variant_b = variant_a 7: Verify variant.type works */ -- By this point, steps 1, 2 and 4 are done. SELECT is_empty( $$SELECT * FROM base_data WHERE base_variant IS NULL$$, 'No NULL variants' ); -- Step 3 SELECT is( base__casted, base__original, 'Verify result of cast ' || base_cast_string ) FROM base_data; -- Step 5 SELECT lives_ok( $$UPDATE base_data SET base_variant_b = variant.text_in( variant.text_out(base_variant), 'test variant' )$$ , 'SET base_variant_b' ); -- Step 6 SELECT is( base_variant_b, base_variant, 'Verify text_in(text_out()) works for ' || variant.text_out(base_variant) ) FROM base_data; -- Step 7 SELECT is( variant.original_type(base_variant) , formatted_type::regtype ) FROM base_data ; /* * Do the same tests with our compare data. * * s/base_/compare_/g */ SELECT is_empty( $$SELECT * FROM compare_data WHERE compare_variant IS NULL$$, 'No NULL variants' ); -- Step 3 SELECT is( compare__casted, compare__original, 'Verify result of cast ' || compare_cast_string ) FROM compare_data; -- Step 5 SELECT lives_ok( $$UPDATE compare_data SET compare_variant_b = variant.text_in( variant.text_out(compare_variant), 'test variant' )$$ , 'SET compare_variant_b' ); -- Step 6 SELECT is( compare_variant_b, compare_variant, 'Verify text_in(text_out()) works for ' || variant.text_out(compare_variant) ) FROM compare_data; /* * Operator testing. (Note that is() uses IS DISTINCT, so that's also tested.) * * For each operator and type combination: * * Calculate base value "op" original value * base value "op" variant * base value as variant "op" variant * * For each case, we dynamically build an is() test that looks like this: * is( * the results of applying operator to original compare and "base" values * , results of applying operator to a different compare and base value * , description * ) * * We generate that using a nested set of format() statements for clarity. The * format for the is() is several lines long, so we just stick that in a temp * table instead of repeating it everywhere. * * It's very important to keep in mind what replacement is being done where! * The is_format template is the query that ultimately runs the test, and it is * pulling all the test data from the op_test_data view. The * pg_temp.exec_text() calls provide the "istructions" to the is_format template * on what each test actually needs to be. * * An example will help clarify. Consider the first argument we're supplying to * the is_format template in the first test: , format( '%s %s %s', 'compare__casted', op, 'base__casted' ) * The output of that format() is replacing the first %s in the is_format * template. So in this example, we end up with a string of compare__casted < base_casted * where '<' is replaced by each operator in turn. * * If this is still unclear then uncomment the SET client_min_messages and * LIMIT 1 lines below and study the output. */ CREATE TEMP TABLE is_format AS SELECT $$SELECT is( %s , %s , %s ) FROM ( SELECT * FROM op_test_data $$ || :'op_test_order_by' || $$ ) ordered -- Need to order first otherwise our test numbers get re-arranged, which is confusing $$::text AS is_format; CREATE TEMP VIEW op_test AS SELECT * -- , format( '%L %s %L', compare_value, op, base_value ) AS original_condition FROM is_format, operator ; -- Note: This test isn't testing variant; it's a sanity-check that we did our casting correctly --SET client_min_messages = DEBUG; SELECT pg_temp.exec_text( is_format -- First argument to is(): apply operator op (from this query) to the columns compare__casted and base__casted , format( '%s %s %s', 'compare__casted', op, 'base__casted' ) , format( '%s %s %s', 'compare_value', op, 'base_value' ) , $$format( 'check casted vs uncasted for %s $$ || op || $$ %s', compare_cast_string, base_cast_string )$$ ) FROM op_test --LIMIT 1 ; SET client_min_messages = NOTICE; SELECT pg_temp.exec_text( is_format , format( '%s %s %s', 'compare_variant', op, 'base_variant' ) , format( '%s %s %s', 'compare_value', op, 'base_value' ) , $$format( 'check variant vs uncasted for %s $$ || op || $$ %s', compare_cast_string, base_cast_string )$$ ) FROM op_test ; SELECT pg_temp.exec_text( is_format , format( '%s %s %s', 'compare_variant', op, 'base_variant' ) , format( '%s %s %s', 'compare__casted', op, 'base__casted' ) , $$format( 'check variant vs casted for %L $$ || op || $$ %L', compare_cast_string, base_cast_string )$$ ) FROM op_test ; SELECT finish(); -- vi: expandtab sw=2 ts=2
31.446429
144
0.70036
2d2c41c29932911d6f46802a6f70f1b51638c79f
926
dart
Dart
ferry_test_graphql/lib/queries/variables/reviews.var.gql.dart
iscriptology/ferry
c42c4df363e153c8cd7f4311f398a482d4944509
[ "MIT" ]
null
null
null
ferry_test_graphql/lib/queries/variables/reviews.var.gql.dart
iscriptology/ferry
c42c4df363e153c8cd7f4311f398a482d4944509
[ "MIT" ]
null
null
null
ferry_test_graphql/lib/queries/variables/reviews.var.gql.dart
iscriptology/ferry
c42c4df363e153c8cd7f4311f398a482d4944509
[ "MIT" ]
null
null
null
// GENERATED CODE - DO NOT MODIFY BY HAND import 'package:built_value/built_value.dart'; import 'package:built_value/serializer.dart'; import 'package:ferry_test_graphql/schema/schema.schema.gql.dart' as _i1; import 'package:ferry_test_graphql/schema/serializers.gql.dart' as _i2; part 'reviews.var.gql.g.dart'; abstract class GReviewsVars implements Built<GReviewsVars, GReviewsVarsBuilder> { GReviewsVars._(); factory GReviewsVars([Function(GReviewsVarsBuilder b) updates]) = _$GReviewsVars; @nullable _i1.GEpisode get episode; @nullable int get first; @nullable int get offset; static Serializer<GReviewsVars> get serializer => _$gReviewsVarsSerializer; Map<String, dynamic> toJson() => _i2.serializers.serializeWith(GReviewsVars.serializer, this); static GReviewsVars fromJson(Map<String, dynamic> json) => _i2.serializers.deserializeWith(GReviewsVars.serializer, json); }
31.931034
77
0.765659
b60d32bc44bca25557bbfe7d1d6a09c28698bb87
613
rb
Ruby
app/controllers/application_controller.rb
tollycoast/transcript-editor
784c98c560a83c9bb9b292ae111ca5c3d7d0e959
[ "MIT" ]
2
2020-02-21T07:54:34.000Z
2021-10-04T01:11:54.000Z
app/controllers/application_controller.rb
abdojulari/transcript-editor
784c98c560a83c9bb9b292ae111ca5c3d7d0e959
[ "MIT" ]
1
2021-06-14T21:01:23.000Z
2021-06-14T21:01:23.000Z
app/controllers/application_controller.rb
abdojulari/transcript-editor
784c98c560a83c9bb9b292ae111ca5c3d7d0e959
[ "MIT" ]
null
null
null
class ApplicationController < ActionController::API include DeviseTokenAuth::Concerns::SetUserByToken # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. # protect_from_forgery with: :exception # Allow us to use JBuilder include ActionController::ImplicitRender # Allow us to cache # include ActionController::Caching # self.perform_caching = true # self.cache_store = ActionController::Base.cache_store before_filter :touch_session # Ensure a session id is available for all! def touch_session session[:touched] = 1 end end
27.863636
57
0.761827
58337cd75eaa3765e0339862fb3e8c1266b61ff8
2,571
css
CSS
data/usercss/126806.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
118
2020-08-28T19:59:28.000Z
2022-03-26T16:28:40.000Z
data/usercss/126806.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
38
2020-09-02T01:08:45.000Z
2022-01-23T02:47:24.000Z
data/usercss/126806.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
21
2020-08-19T01:12:43.000Z
2022-03-15T21:55:17.000Z
/* ==UserStyle== @name Compact Light For Thunderbird (DevEdition Theme) @namespace USO Archive @author Rayquaza01 @description `This style ports Firefox's <strike>Dev Edition</strike> Compact Light theme to Thunderbird.` @version 20160830.1.57 @license CC0-1.0 @preprocessor uso ==/UserStyle== */ /* AGENT_SHEET */ @namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul); /** * This is an adaptation for Thunderbird of my style 'Numix Tabs for Firefox 29+' * (https://userstyles.org/styles/117361/numix-tabs-for-firefox-29) * * based on 'Numix for Firefox' by @manicfold * (https://userstyles.org/styles/95159/numix-for-firefox) * @Author: Laron */ /** * This is an adaptation of Laron's 'Numix Tabs for Thunderbird 15+' * (https://userstyles.org/styles/117550/numix-tabs-for-thunderbird-15) * * Firefox's Dev Edition theme was used as inspiration * @Author: Rayquaza01 */ /*Remove curved tabs and default style*/ #tabs-toolbar .tab-background{ margin: 0 !important; background: transparent !important; } #tabs-toolbar .tab-background-start, #tabs-toolbar .tab-background-end{ display: none !important; } #tabs-toolbar .tab-background-middle{ margin: -4px -2px !important; background: transparent !important; } /*Fix tabs overlapping main part*/ #tabs-toolbar .tabmail-arrowscrollbox { margin: 0px !important; } #mail-toolbox{ box-shadow: 0px -1px 0px threedshadow inset !important; } #tabs-toolbar > * { background-color: #e3e4e6 !important; } #tabs-toolbar .tabmail-tab { padding: 7.5px !important; background-color: #e3e4e6 !important; } #tabs-toolbar .tabmail-tab:not([first-tab]) { padding: 5px !important; } #tabs-toolbar .tab-text[selected] { color: #ffffff !important; } #tabs-toolbar .tab-text[selected]:-moz-window-inactive { color: rgba(255,255,255,0.5) !important; } #tabs-toolbar .tab-text:not([selected]):-moz-window-inactive { color: rgba(0,0,0,0.5) !important; } #tabs-toolbar .tabmail-tab:hover:not([selected]) { background: #d7d8da !important; } #tabs-toolbar .tabmail-tab[selected]{ background: #4c9ed9 !important; border-style: none !important; } #mail-toolbox, sidebarheader { background-color: #f5f6f7 !important; } #messengerWindow[sizemode="normal"] #navigation-toolbox { background-color: #e3e4e6 !important; margin: -15px 0px 0px !important; } #messengerWindow[sizemode="maximized"] #navigation-toolbox { background-color: #e3e4e6 !important; }
29.551724
109
0.692338
757b061a17ccd9c7ba4f9c403ebd764c0ca289a3
6,654
swift
Swift
Tests/DJiRDataTests/Decoding/_JSONGenericUnkeyedDecodingContainerTests.swift
drjackyl/DJiRData
7442d45d9945524950c00153ac1f75dd20502201
[ "Unlicense" ]
1
2021-03-14T17:11:36.000Z
2021-03-14T17:11:36.000Z
Tests/DJiRDataTests/Decoding/_JSONGenericUnkeyedDecodingContainerTests.swift
drjackyl/DJiRData
7442d45d9945524950c00153ac1f75dd20502201
[ "Unlicense" ]
null
null
null
Tests/DJiRDataTests/Decoding/_JSONGenericUnkeyedDecodingContainerTests.swift
drjackyl/DJiRData
7442d45d9945524950c00153ac1f75dd20502201
[ "Unlicense" ]
null
null
null
import XCTest @testable import DJiRData class _JSONGenericUnkeyedDecodingContainerTests: XCTestCase { enum TwoKeys: String, CodingKey { case aKey = "1" case notherKey = "2" } var emptyModel: JSONGenericModel { .init(m: [:], d: []) } var notSupportedContainer: _JSONGenericUnkeyedDecodingContainer = { .init(data: .init(m: [:], d: []), codingPath: []) }() // MARK: - Init func testInit_CodingPath_IsSet() { let codingPath: [CodingKey] = [TwoKeys.aKey, TwoKeys.notherKey] let container = _JSONGenericUnkeyedDecodingContainer(data: emptyModel, codingPath: codingPath) let comparableCodingPath = codingPath.map { $0.stringValue } let comparableContainerCodingPath = container.codingPath.map { $0.stringValue } XCTAssertEqual(comparableContainerCodingPath, comparableCodingPath) } func testInit_Count_IsSet() { let data = JSONGenericModel( m: [TwoKeys.aKey.stringValue : "Irrelevant name of field"], d: [[TwoKeys.aKey.stringValue : JSONGenericModel.Value(stringValue: "A Value")]] ) let container = _JSONGenericUnkeyedDecodingContainer(data: data, codingPath: []) XCTAssertEqual(container.count, 1) } func testInit_IsAtEnd_IsFalse() { let data = JSONGenericModel( m: [TwoKeys.aKey.stringValue : "Irrelevant name of field"], d: [[TwoKeys.aKey.stringValue : JSONGenericModel.Value(stringValue: "A Value")]] ) let container = _JSONGenericUnkeyedDecodingContainer(data: data, codingPath: []) XCTAssertFalse(container.isAtEnd) } func testInit_IsAtEnd_IsTrueWithEmptyModel() { let container = _JSONGenericUnkeyedDecodingContainer(data: emptyModel, codingPath: []) XCTAssertTrue(container.isAtEnd) } func testInit_CurrentIndex_IsZero() { let container = _JSONGenericUnkeyedDecodingContainer(data: emptyModel, codingPath: []) XCTAssertEqual(container.currentIndex, 0) } // MARK: - Decode func testDecode_ArrayOfKeyed() throws { struct Keyed: Decodable { let aValue: String let notherValue: String enum CodingKeys: String, CodingKey { case aValue = "1" case notherValue = "2" } } let data = JSONGenericModel( m: [ TwoKeys.aKey.stringValue: "Irrelevant name of field", TwoKeys.notherKey.stringValue: "Irrelevant name of field" ], d: [ [ TwoKeys.aKey.stringValue: JSONGenericModel.Value(stringValue: "Hello"), TwoKeys.notherKey.stringValue: JSONGenericModel.Value(stringValue: "World!") ] ] ) var container = _JSONGenericUnkeyedDecodingContainer(data: data, codingPath: []) let result = try container.decode([Keyed].self) XCTAssertEqual(result.count, 1) XCTAssertEqual(result[0].aValue, "Hello") XCTAssertEqual(result[0].notherValue, "World!") } // MARK: - Not Suported func testNotSupported_DecodeNil() { XCTAssertThrowsError(try notSupportedContainer.decodeNil()) } func testNotSupported_DecodeBool() { XCTAssertThrowsError(try notSupportedContainer.decode(Bool.self)) } func testNotSupported_DecodeFloat() { XCTAssertThrowsError(try notSupportedContainer.decode(Float.self)) } func testNotSupported_DecodeInt8() { XCTAssertThrowsError(try notSupportedContainer.decode(Int8.self)) } func testNotSupported_DecodeInt16() { XCTAssertThrowsError(try notSupportedContainer.decode(Int16.self)) } func testNotSupported_DecodeInt32() { XCTAssertThrowsError(try notSupportedContainer.decode(Int32.self)) } func testNotSupported_DecodeInt64() { XCTAssertThrowsError(try notSupportedContainer.decode(Int64.self)) } func testNotSupported_DecodeUInt() { XCTAssertThrowsError(try notSupportedContainer.decode(UInt.self)) } func testNotSupported_DecodeUInt8() { XCTAssertThrowsError(try notSupportedContainer.decode(UInt8.self)) } func testNotSupported_DecodeUInt16() { XCTAssertThrowsError(try notSupportedContainer.decode(UInt16.self)) } func testNotSupported_DecodeUInt32() { XCTAssertThrowsError(try notSupportedContainer.decode(UInt32.self)) } func testNotSupported_DecodeUInt64() { XCTAssertThrowsError(try notSupportedContainer.decode(UInt64.self)) } func testNotSupported_DecodeIfPresentBool() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(Bool.self)) } func testNotSupported_DecodeIfPresentFloat() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(Float.self)) } func testNotSupported_DecodeIfPresentInt8() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(Int8.self)) } func testNotSupported_DecodeIfPresentInt16() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(Int16.self)) } func testNotSupported_DecodeIfPresentInt32() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(Int32.self)) } func testNotSupported_DecodeIfPresentInt64() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(Int64.self)) } func testNotSupported_DecodeIfPresentUInt() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(UInt.self)) } func testNotSupported_DecodeIfPresentUInt8() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(UInt8.self)) } func testNotSupported_DecodeIfPresentUInt16() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(UInt16.self)) } func testNotSupported_DecodeIfPresentUInt32() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(UInt32.self)) } func testNotSupported_DecodeIfPresentUInt64() { XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(UInt64.self)) } func testNotSupported_DecodeIfPresentT() { struct ADecodable: Decodable { let aValue: Int } XCTAssertThrowsError(try notSupportedContainer.decodeIfPresent(ADecodable.self)) } }
31.386792
102
0.664112
dd9b8de9cda3c26001a5dc2c10ca65009ba1e853
1,770
java
Java
src/main/java/info/gianlucacosta/historymark/storage/PinRepository.java
giancosta86/HistoryMark
58967c63a96cb0168de27838cce74dd0c766fec1
[ "Apache-2.0" ]
null
null
null
src/main/java/info/gianlucacosta/historymark/storage/PinRepository.java
giancosta86/HistoryMark
58967c63a96cb0168de27838cce74dd0c766fec1
[ "Apache-2.0" ]
null
null
null
src/main/java/info/gianlucacosta/historymark/storage/PinRepository.java
giancosta86/HistoryMark
58967c63a96cb0168de27838cce74dd0c766fec1
[ "Apache-2.0" ]
null
null
null
/*^ =========================================================================== HistoryMark =========================================================================== Copyright (C) 2017 Gianluca Costa =========================================================================== 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 info.gianlucacosta.historymark.storage; import info.gianlucacosta.historymark.model.Age; import info.gianlucacosta.historymark.model.Pin; import java.util.Collection; import java.util.Optional; import java.util.stream.Collectors; public interface PinRepository { Collection<Pin> findAll(); default Collection<Pin> findAllByAge(Age age) { return findAll() .stream() .filter(pin -> age.includes(pin.getDate()) ) .collect(Collectors.toSet()); } default Collection<Pin> findAllByAge(Optional<Age> ageOption) { return ageOption .map(this::findAllByAge) .orElseGet(this::findAll); } void save(Pin pin); void delete(Pin pin); }
32.777778
77
0.536158
b036cd71a269e078fad0cb3cf80cc057055758e6
699
py
Python
src/ralph/deployment/tests/utils.py
vi4m/ralph
2af767ee23d89be9e6cec0a537350a1ce8840bd1
[ "Apache-2.0" ]
1
2018-09-01T14:14:08.000Z
2018-09-01T14:14:08.000Z
src/ralph/deployment/tests/utils.py
srikanth4372/sample
127b5742ae464d42909a14d71e3c10c241ec3a23
[ "Apache-2.0" ]
1
2019-08-14T10:03:45.000Z
2019-08-14T10:03:45.000Z
src/ralph/deployment/tests/utils.py
srikanth4372/sample
127b5742ae464d42909a14d71e3c10c241ec3a23
[ "Apache-2.0" ]
1
2019-08-14T09:59:42.000Z
2019-08-14T09:59:42.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import factory from factory.django import DjangoModelFactory from ralph.deployment.models import MassDeployment, Preboot, Deployment from ralph.discovery.tests.util import DeviceFactory class DeploymentFactory(DjangoModelFactory): FACTORY_FOR = Deployment device = factory.SubFactory(DeviceFactory) mac = "000000000000" ip = "" class MassDeploymentFactory(DjangoModelFactory): FACTORY_FOR = MassDeployment class PrebootFactory(DjangoModelFactory): FACTORY_FOR = Preboot
23.3
71
0.798283
5df5298d3186ec5d2e696adea58960b14325d6cb
19,504
cpp
C++
src/mirrage/graphic/src/device_memory.cpp
lowkey42/mirrage
2527537989a548062d0bbca8370d063fc6b81a18
[ "MIT" ]
14
2017-10-26T08:45:54.000Z
2021-04-06T11:44:17.000Z
src/mirrage/graphic/src/device_memory.cpp
lowkey42/mirrage
2527537989a548062d0bbca8370d063fc6b81a18
[ "MIT" ]
17
2017-10-09T20:11:58.000Z
2018-11-08T22:05:14.000Z
src/mirrage/graphic/src/device_memory.cpp
lowkey42/mirrage
2527537989a548062d0bbca8370d063fc6b81a18
[ "MIT" ]
1
2018-09-26T23:10:06.000Z
2018-09-26T23:10:06.000Z
#include <mirrage/graphic/device_memory.hpp> #include <mirrage/utils/container_utils.hpp> #include <mirrage/utils/ranges.hpp> #include <gsl/gsl> #include <bitset> #include <cmath> #include <mutex> namespace mirrage::graphic { namespace { template <typename T> constexpr T log2(T n) { return (n < 2) ? 0 : 1 + log2(n / 2); } template <std::uint32_t MinSize, std::uint32_t MaxSize> class Buddy_block_alloc { public: Buddy_block_alloc(const vk::Device&, std::uint32_t type, bool mapable, std::mutex& free_mutex); Buddy_block_alloc(const Buddy_block_alloc&) = delete; Buddy_block_alloc(Buddy_block_alloc&&) = delete; Buddy_block_alloc& operator=(const Buddy_block_alloc&) = delete; Buddy_block_alloc& operator=(Buddy_block_alloc&&) = delete; ~Buddy_block_alloc() { if(_allocation_count > 0) { LOG(plog::error) << "Still " << _allocation_count << " unfreed GPU memory allocations left."; } } auto alloc(std::uint32_t size, std::uint32_t alignment) -> util::maybe<Device_memory>; void free(std::uint32_t index, std::uint32_t layer); auto free_memory() const -> std::uint32_t { auto free_memory = std::size_t(0); for(auto i = std::size_t(0); i < layers; i++) { auto free = _free_blocks[i].size(); free_memory = total_size / (1L << (i + 1)) * free; } return gsl::narrow<std::uint32_t>(free_memory); } auto empty() const noexcept { return !_free_blocks[0].empty(); } private: using Free_list = std::vector<std::uint32_t>; static constexpr auto layers = log2(MaxSize) - log2(MinSize) + 1; static constexpr auto total_size = (1 << layers) * MinSize; static constexpr auto blocks = (1 << layers) - 1; vk::UniqueDeviceMemory _memory; char* _mapped_addr; std::array<Free_list, layers> _free_blocks; std::bitset<blocks / 2> _free_buddies; std::int64_t _allocation_count = 0; std::mutex& _free_mutex; auto _index_to_offset(std::uint32_t layer, std::uint32_t idx) -> vk::DeviceSize; /// split given block, return index of one of the new blocks auto _split(std::uint32_t layer, std::uint32_t idx) -> std::uint32_t; /// tries to merge the given block with its buddy auto _merge(std::uint32_t layer, std::uint32_t idx) -> bool; auto _buddies_different(std::uint32_t layer, std::uint32_t idx) { auto abs_idx = (1L << layer) - 1 + idx; MIRRAGE_INVARIANT(abs_idx > 0, "_buddies_different() called for layer 0!"); return _free_buddies[gsl::narrow<std::size_t>((abs_idx - 1) / 2)]; } }; } // namespace template <std::uint32_t MinSize, std::uint32_t MaxSize> class Device_memory_pool { public: Device_memory_pool(const vk::Device&, std::uint32_t type, bool mapable); ~Device_memory_pool() = default; auto alloc(std::uint32_t size, std::uint32_t alignment) -> util::maybe<Device_memory>; auto shrink_to_fit() -> std::size_t { auto lock = std::scoped_lock{_mutex}; auto new_end = std::remove_if( _blocks.begin(), _blocks.end(), [](auto& block) { return block->empty(); }); auto deleted = std::distance(new_end, _blocks.end()); if(deleted > 0) { LOG(plog::debug) << "Freed " << deleted << "/" << _blocks.size() << " blocks in allocator for type " << _type; } _blocks.erase(new_end, _blocks.end()); return gsl::narrow<std::size_t>(deleted); } auto usage_statistic() const -> Device_memory_pool_usage { auto lock = std::scoped_lock{_mutex}; auto usage = Device_memory_pool_usage{0, 0, _blocks.size()}; for(auto& block : _blocks) { usage.reserved += MaxSize; usage.used += MaxSize - block->free_memory(); } return usage; } private: const vk::Device& _device; std::uint32_t _type; bool _mapable; mutable std::mutex _mutex; std::vector<std::unique_ptr<Buddy_block_alloc<MinSize, MaxSize>>> _blocks; }; class Device_heap { public: Device_heap(const vk::Device& device, std::uint32_t type, bool mapable) : _device(device) , _type(type) , _mapable(mapable) , _temporary_pool(device, type, mapable) , _normal_pool(device, type, mapable) , _persistent_pool(device, type, mapable) { } Device_heap(const Device_heap&) = delete; Device_heap(Device_heap&&) = delete; Device_heap& operator=(const Device_heap&) = delete; Device_heap& operator=(Device_heap&&) = delete; auto alloc(std::uint32_t size, std::uint32_t alignment, Memory_lifetime lifetime) -> util::maybe<Device_memory> { auto memory = [&] { switch(lifetime) { case Memory_lifetime::temporary: return _temporary_pool.alloc(size, alignment); case Memory_lifetime::normal: return _normal_pool.alloc(size, alignment); case Memory_lifetime::persistent: return _persistent_pool.alloc(size, alignment); } MIRRAGE_FAIL("Unreachable"); }(); if(memory.is_some()) return memory; // single allocation auto alloc_info = vk::MemoryAllocateInfo{size, _type}; auto m = _device.allocateMemoryUnique(alloc_info); auto mem_addr = _mapable ? static_cast<char*>(_device.mapMemory(*m, 0, VK_WHOLE_SIZE)) : nullptr; return Device_memory{this, +[](void* self, std::uint32_t, std::uint32_t, vk::DeviceMemory memory) { static_cast<Device_heap*>(self)->_device.freeMemory(memory); }, 0, size, m.release(), 0, mem_addr}; } auto shrink_to_fit() -> std::size_t { return _temporary_pool.shrink_to_fit() + _normal_pool.shrink_to_fit() + _persistent_pool.shrink_to_fit(); } auto usage_statistic() const -> Device_memory_type_usage { auto temporary_usage = _temporary_pool.usage_statistic(); auto normal_usage = _normal_pool.usage_statistic(); auto persistent_usage = _persistent_pool.usage_statistic(); return {temporary_usage.reserved + normal_usage.reserved + persistent_usage.reserved, temporary_usage.used + normal_usage.used + persistent_usage.used, temporary_usage, normal_usage, persistent_usage}; } private: friend class Device_memory_allocator; friend class Device_memory; const vk::Device& _device; std::uint32_t _type; bool _mapable; Device_memory_pool<1024L * 1024 * 4, 256L * 1024 * 1024> _temporary_pool; Device_memory_pool<1024L * 1024 * 1, 256L * 1024 * 1024> _normal_pool; Device_memory_pool<1024L * 1024 * 1, 256L * 1024 * 1024> _persistent_pool; }; Device_memory::Device_memory(Device_memory&& rhs) noexcept : _owner(rhs._owner) , _deleter(rhs._deleter) , _index(rhs._index) , _layer(rhs._layer) , _memory(std::move(rhs._memory)) , _offset(rhs._offset) , _mapped_addr(rhs._mapped_addr) { rhs._owner = nullptr; } Device_memory& Device_memory::operator=(Device_memory&& rhs) noexcept { if(&rhs == this) return *this; if(_owner) { _deleter(_owner, _index, _layer, _memory); } _owner = rhs._owner; _deleter = rhs._deleter; _index = rhs._index; _layer = rhs._layer; _memory = rhs._memory; _offset = rhs._offset; _mapped_addr = rhs._mapped_addr; rhs._owner = nullptr; return *this; } Device_memory::~Device_memory() { if(_owner) { _deleter(_owner, _index, _layer, _memory); } } Device_memory::Device_memory(void* owner, Deleter* deleter, std::uint32_t index, std::uint32_t layer, vk::DeviceMemory m, vk::DeviceSize o, char* mapped_addr) : _owner(owner) , _deleter(deleter) , _index(index) , _layer(layer) , _memory(m) , _offset(o) , _mapped_addr(mapped_addr) { } Device_memory_allocator::Device_memory_allocator(const vk::Device& device, vk::PhysicalDevice gpu, bool dedicated_alloc_supported) : _device(device) , _is_unified_memory_architecture(true) , _is_dedicated_allocations_supported(dedicated_alloc_supported) { auto memory_properties = gpu.getMemoryProperties(); const auto host_visible_flags = vk::MemoryPropertyFlagBits::eHostVisible | vk::MemoryPropertyFlagBits::eHostCoherent; const auto device_local_flags = vk::MemoryPropertyFlagBits::eDeviceLocal; _pools.reserve(memory_properties.memoryTypeCount); for(auto id : util::range(memory_properties.memoryTypeCount)) { auto host_visible = (memory_properties.memoryTypes[id].propertyFlags & host_visible_flags) == host_visible_flags; _pools.emplace_back(std::make_unique<Device_heap>(_device, id, host_visible)); } for(auto i : util::range(memory_properties.memoryTypeCount)) { auto host_visible = (memory_properties.memoryTypes[i].propertyFlags & host_visible_flags) == host_visible_flags; auto device_local = (memory_properties.memoryTypes[i].propertyFlags & device_local_flags) == device_local_flags; if(host_visible) { _host_visible_pools.emplace_back(i); } if(device_local) { _device_local_pools.emplace_back(i); } if(host_visible || device_local) { _is_unified_memory_architecture &= host_visible && device_local; } } if(_is_unified_memory_architecture) { LOG(plog::info) << "Detected a unified memory architecture."; } if(_is_dedicated_allocations_supported) { LOG(plog::info) << "VK_NV_dedicated_allocation enabled"; } } Device_memory_allocator::~Device_memory_allocator() = default; auto Device_memory_allocator::alloc(std::uint32_t size, std::uint32_t alignment, std::uint32_t type_mask, bool host_visible, Memory_lifetime lifetime) -> util::maybe<Device_memory> { const auto& pool_ids = host_visible ? _host_visible_pools : _device_local_pools; for(auto id : pool_ids) { if(type_mask & (1u << id)) { auto& pool = _pools[id]; try { return pool->alloc(size, alignment, lifetime); } catch(std::system_error& e) { auto usage = usage_statistic(); LOG(plog::error) << "Couldn't allocate block of size " << size << "\n Usage: " << usage.used << "/" << usage.reserved; // free memory and retry if(e.code() == vk::Result::eErrorOutOfDeviceMemory && shrink_to_fit() > 0) { return pool->alloc(size, alignment, lifetime); } } } } MIRRAGE_FAIL("No pool on the device matches the requirements. Type mask=" << type_mask << ", host visible=" << host_visible); } auto Device_memory_allocator::alloc_dedicated(vk::Image image, bool host_visible) -> util::maybe<Device_memory> { return alloc_dedicated({}, image, host_visible); } auto Device_memory_allocator::alloc_dedicated(vk::Buffer buffer, bool host_visible) -> util::maybe<Device_memory> { return alloc_dedicated(buffer, {}, host_visible); } auto Device_memory_allocator::alloc_dedicated(vk::Buffer buffer, vk::Image image, bool host_visible) -> util::maybe<Device_memory> { const auto& pool_ids = host_visible ? _host_visible_pools : _device_local_pools; auto requirements = buffer ? _device.getBufferMemoryRequirements(buffer) : _device.getImageMemoryRequirements(image); for(auto id : pool_ids) { if(requirements.memoryTypeBits & (1u << id)) { auto alloc_info = vk::MemoryAllocateInfo{requirements.size, id}; #ifdef VK_NV_dedicated_allocation auto dedicated_info = vk::DedicatedAllocationMemoryAllocateInfoNV{}; if(_is_dedicated_allocations_supported) { dedicated_info.buffer = buffer; dedicated_info.image = image; alloc_info.pNext = &dedicated_info; } #endif LOG(plog::debug) << "Alloc: " << (float(requirements.size) / 1024.f / 1024.f) << " MB"; auto mem = _device.allocateMemoryUnique(alloc_info); auto mem_addr = host_visible ? static_cast<char*>(_device.mapMemory(*mem, 0, VK_WHOLE_SIZE)) : nullptr; return Device_memory{ this, +[](void* self, std::uint32_t, std::uint32_t, vk::DeviceMemory memory) { static_cast<Device_memory_allocator*>(self)->_device.freeMemory(memory); }, 0, 0, mem.release(), 0, mem_addr}; } } MIRRAGE_FAIL("No pool on the device matches the requirements. Type mask=" << requirements.memoryTypeBits << ", host visible=" << host_visible); } auto Device_memory_allocator::shrink_to_fit() -> std::size_t { auto sum = std::size_t(0); for(auto& heap : _pools) { if(heap) { sum += heap->shrink_to_fit(); } } return sum; } auto Device_memory_allocator::usage_statistic() const -> Device_memory_usage { auto types = std::unordered_map<std::uint32_t, Device_memory_type_usage>(); auto reserved = std::size_t(0); auto used = std::size_t(0); auto type = std::uint32_t(0); for(auto& heap : _pools) { if(heap) { auto& t_usage = types[0]; t_usage = heap->usage_statistic(); reserved += t_usage.reserved; used += t_usage.used; } type++; } return {reserved, used, types}; } // POOL template <std::uint32_t MinSize, std::uint32_t MaxSize> Device_memory_pool<MinSize, MaxSize>::Device_memory_pool(const vk::Device& device, std::uint32_t type, bool mapable) : _device(device), _type(type), _mapable(mapable) { } template <std::uint32_t MinSize, std::uint32_t MaxSize> auto Device_memory_pool<MinSize, MaxSize>::alloc(std::uint32_t size, std::uint32_t alignment) -> util::maybe<Device_memory> { if(size > MaxSize) return util::nothing; auto lock = std::scoped_lock{_mutex}; for(auto& block : _blocks) { auto m = block->alloc(size, alignment); if(m.is_some()) return m; } _blocks.emplace_back( std::make_unique<Buddy_block_alloc<MinSize, MaxSize>>(_device, _type, _mapable, _mutex)); auto m = _blocks.back()->alloc(size, alignment); MIRRAGE_INVARIANT(m.is_some(), "Couldn't allocate " << size << " byte with allignment" << alignment << " from newly created block of size " << MaxSize); return m; } namespace { template <std::uint32_t MinSize, std::uint32_t MaxSize> Buddy_block_alloc<MinSize, MaxSize>::Buddy_block_alloc(const vk::Device& device, std::uint32_t type, bool mapable, std::mutex& free_mutex) : _memory(device.allocateMemoryUnique({MaxSize, type})) , _mapped_addr(mapable ? static_cast<char*>(device.mapMemory(*_memory, 0, VK_WHOLE_SIZE)) : nullptr) , _free_mutex(free_mutex) { LOG(plog::debug) << "Alloc: " << (MaxSize / 1024.f / 1024.f) << " MB"; _free_blocks[0].emplace_back(0); } template <std::uint32_t MinSize, std::uint32_t MaxSize> auto Buddy_block_alloc<MinSize, MaxSize>::alloc(std::uint32_t size, std::uint32_t alignment) -> util::maybe<Device_memory> { // protected by the mutex locked in Device_memory_pool::alloc, that is the same as _free_mutex if(size < alignment) { size = alignment; } else if(size % alignment != 0) { size += alignment - size % alignment; } if(size < MinSize) { size = MinSize; } auto layer = gsl::narrow<std::uint32_t>(std::ceil(std::log2(static_cast<float>(size))) - log2(MinSize)); layer = layer < layers ? layers - layer - 1 : 0; // find first layer with free block >= size auto current_layer = layer; while(_free_blocks[current_layer].empty()) { if(current_layer == 0) { return util::nothing; //< not enough free space } current_layer--; } // reserve found block auto index = _free_blocks[current_layer].back(); _free_blocks[current_layer].pop_back(); if(current_layer > 0) { _buddies_different(current_layer, index).flip(); } // unwinde and split all blocks an the way down for(; current_layer <= layer; current_layer++) { if(current_layer != layer) index = _split(current_layer, index); } auto offset = _index_to_offset(layer, index); MIRRAGE_INVARIANT(offset % alignment == 0, "Resulting offset is not aligned correctly. Expected:" << alignment << " Offset: " << offset); _allocation_count++; return Device_memory{this, +[](void* self, std::uint32_t i, std::uint32_t l, vk::DeviceMemory) { static_cast<Buddy_block_alloc*>(self)->free(l, i); }, index, layer, *_memory, offset, _mapped_addr ? _mapped_addr + offset : nullptr}; } template <std::uint32_t MinSize, std::uint32_t MaxSize> void Buddy_block_alloc<MinSize, MaxSize>::free(std::uint32_t layer, std::uint32_t index) { auto lock = std::scoped_lock{_free_mutex}; _allocation_count--; _free_blocks[layer].emplace_back(index); if(layer == 0) { MIRRAGE_INVARIANT(index == 0, "index overflow in layer 0, index=" << index); } else { _buddies_different(layer, index).flip(); _merge(layer, index); } } template <std::uint32_t MinSize, std::uint32_t MaxSize> auto Buddy_block_alloc<MinSize, MaxSize>::_index_to_offset(std::uint32_t layer, std::uint32_t idx) -> vk::DeviceSize { return total_size / (1L << (layer + 1)) * idx; } template <std::uint32_t MinSize, std::uint32_t MaxSize> auto Buddy_block_alloc<MinSize, MaxSize>::_split(std::uint32_t layer, std::uint32_t idx) -> std::uint32_t { _buddies_different(layer + 1, idx * 2 + 1) = true; _free_blocks[layer + 1].emplace_back(idx * 2 + 1); return idx * 2; } template <std::uint32_t MinSize, std::uint32_t MaxSize> auto Buddy_block_alloc<MinSize, MaxSize>::_merge(std::uint32_t layer, std::uint32_t index) -> bool { if(layer == 0) return false; auto diff = _buddies_different(layer, index); if(diff == false) { // both free // remove nodes from freelist and add parent auto parent_index = index / 2; util::erase_fast(_free_blocks[layer], parent_index * 2); util::erase_fast(_free_blocks[layer], parent_index * 2 + 1); _free_blocks[layer - 1].emplace_back(parent_index); if(layer > 1) { _buddies_different(layer - 1, parent_index).flip(); _merge(layer - 1, parent_index); } return true; } return false; } } // namespace } // namespace mirrage::graphic
31.559871
104
0.622488
f462bf81187f852842ba1d95b3d9cf9eafe6d815
707
cshtml
C#
CustomerApp/CustomerApp/Views/Customer/DisplayCustomer.cshtml
yeoweeliat/Capstone-Project-3
38b5cd46c92330832fda937fb1252f5d6c8ea559
[ "MIT" ]
null
null
null
CustomerApp/CustomerApp/Views/Customer/DisplayCustomer.cshtml
yeoweeliat/Capstone-Project-3
38b5cd46c92330832fda937fb1252f5d6c8ea559
[ "MIT" ]
null
null
null
CustomerApp/CustomerApp/Views/Customer/DisplayCustomer.cshtml
yeoweeliat/Capstone-Project-3
38b5cd46c92330832fda937fb1252f5d6c8ea559
[ "MIT" ]
null
null
null
 @model List<CustomerApp.Models.Customer> @* @model CustomerApp.Models.Customer *@ @* strongly typed tries to catch error during compile time *@ @{ Layout = null; } <h2>This is the DisplayCustomer page</h2> <form action="/Customer/Search" method="get"> Name: <input type="text" name="customerName" value="" /> <input type="submit" value="Search" /> </form> <table> <tr> <td>Name</td> <td>Address</td> </tr> @if (Model != null) // add safeguard logic { @foreach (var c in Model) // @ means c# { <tr> <td>@c.customerName</td> <td>@c.address</td> </tr> } } </table>
16.068182
61
0.526167
cdd9718ad84e35f74dca59b266c7d29ae676b12a
11,302
cs
C#
RavenChangesFailOver/Program.cs
tintoy/raven-changes-fail-over
976eadc133b80fef82a167945eb255322f239f97
[ "MIT" ]
null
null
null
RavenChangesFailOver/Program.cs
tintoy/raven-changes-fail-over
976eadc133b80fef82a167945eb255322f239f97
[ "MIT" ]
null
null
null
RavenChangesFailOver/Program.cs
tintoy/raven-changes-fail-over
976eadc133b80fef82a167945eb255322f239f97
[ "MIT" ]
null
null
null
using Raven.Abstractions.Data; using Raven.Abstractions.Replication; using Raven.Client; using Raven.Client.Changes; using Raven.Client.Document; using Raven.Imports.Newtonsoft.Json; using Raven.Json.Linq; using Serilog; using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Threading; namespace RavenChangesFailOver { /// <summary> /// Demonstration of how RavenDB's Changes API interacts with replication and fail-over. /// </summary> static class Program { /// <summary> /// The name of the replicated database to use. /// </summary> static readonly string DatabaseName = "FailOverTest"; /// <summary> /// The URL of the primary RavenDB server. /// </summary> static readonly string PrimaryServerUrl = "http://localhost:8080/"; /// <summary> /// The URLs of the secondary RavenDB servers. /// </summary> /// <remarks> /// Note that you will need at least 2 fail-over servers for this to work correctly when one of them goes down; probably because otherwise the system lacks a quorum. /// </remarks> static readonly IReadOnlyList<string> SecondaryServerUrls = new string[] { "http://localhost:8081/", "http://localhost:8082/" }; /// <summary> /// The Id of a document to load when polling the database to trigger fail-over. /// </summary> public static readonly string TestDocumentId = "TestDocuments/1"; /// <summary> /// RavenDB change notification APIs. /// </summary> static readonly List<ChangesApi> _changesApis = new List<ChangesApi>(); /// <summary> /// The subject used to aggregate connection events for change notification APIs. /// </summary> static readonly Subject<ChangesApi> _apiConnectionSubject = new Subject<ChangesApi>(); /// <summary> /// The main program entry-point. /// </summary> static void Main() { SynchronizationContext.SetSynchronizationContext( new SynchronizationContext() ); ConfigureLogging(); try { Log.Information("Initialising..."); // Monitor server connection status. // If the active server is disconnected, try to find another available server to connect to. MonitorChangesApis(); // The document store for the primary server. using (DocumentStore primaryDocumentStore = CreatePrimaryDocumentStore()) using (CompositeDisposable secondaryStoreDisposal = new CompositeDisposable()) { // Connect to the changes API for the primary server. ListenForChanges(primaryDocumentStore, changesApi => SubscribeToChangesApi(changesApi, primaryDocumentStore.Url) ); // Connect changes APIs for fail-over (secondary) servers. foreach (ReplicationDestination failoverDestination in primaryDocumentStore.FailoverServers.ForDefaultDatabase) { if (failoverDestination.Url == primaryDocumentStore.Url) continue; Log.Verbose("Will use server '{FailoverServerUrl}' for fail-over.", failoverDestination.Url ); // The document store for a fail-over (secondary) server. DocumentStore failoverDocumentStore = CreateSecondaryDocumentStore( failoverDestination.Url, failoverDestination.Database ); secondaryStoreDisposal.Add(failoverDocumentStore); // Connect to the changes API for a secondary primary server. ListenForChanges(failoverDocumentStore, changesApi => SubscribeToChangesApi(changesApi, failoverDestination.Url) ); } // Show us when we are failing over to another server. primaryDocumentStore .GetReplicationInformerForDatabase(primaryDocumentStore.DefaultDatabase) .FailoverStatusChanged += (sender, args) => { Log.Verbose("Fail-over status changed ({ServerUrl} is now {ServerStatus}).", args.Url, args.Failing ? "Down" : "Up" ); }; using (PollDatabaseForFailOver(primaryDocumentStore, TestDocumentId)) { Log.Information("Running (press enter to terminate)."); Console.ReadLine(); } } } catch (Exception eUnexpected) { Log.Error(eUnexpected, "Unexpected error: {ErrorMessage}", eUnexpected.Message); } } /// <summary> /// Monitor connection status for change-notification APIs. /// </summary> static void MonitorChangesApis() { _apiConnectionSubject.Subscribe(connectionChanged => { Log.Information("[{ServerUrl}] connection status changed: {ConnectionStatus}", connectionChanged.ServerUrl, connectionChanged.Api.Connected ? "Connected" : "Disconnected" ); TrySubscribeToChanges(); }); } /// <summary> /// Attempt to find and subscribe to a Connected change-notification API. /// </summary> static void TrySubscribeToChanges() { // Walk through servers in descending order of preference until we find one we can subscribe to. bool subscribed = false; foreach (ChangesApi changesApi in _changesApis) { if (changesApi.IsConnected) { // We only want to subscribe to the first connected API. if (!subscribed) { changesApi.Subscribe(); subscribed = true; continue; } } // All other change-notification APIs should be unsubscribed. changesApi.Unsubscribe(); } if (!subscribed) Log.Warning("No servers are currently available; change notifications are disabled."); } /// <summary> /// An example subscription to the change-notification API. /// </summary> /// <param name="changes"> /// The change-notification API. /// </param> /// <param name="serverUrl"> /// The URL of the server targeted by the API. /// </param> /// <returns> /// An <see cref="IDisposable"/> representing the subscription. /// </returns> static IDisposable SubscribeToChangesApi(IDatabaseChanges changes, string serverUrl) { if (changes == null) throw new ArgumentNullException(nameof(changes)); if (String.IsNullOrWhiteSpace(serverUrl)) throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'serverUrl'.", nameof(serverUrl)); return changes.ForAllDocuments() .Where( change => !change.Id.StartsWith("Raven/Replication") ) .Subscribe( change => Log.Information("{ServerUrl} {ChangeType}: {DocumentId} ({DocumentETag})", serverUrl, change.Type, change.Id, change.Etag), error => Log.Error(error, "{ServerUrl} subscription error: {ErrorMessage}", serverUrl, error.Message), () => Log.Information("[{ServerUrl}] subscription complete", serverUrl) ); } /// <summary> /// Listen for changes to documents (if any). /// </summary> /// <param name="documentStore"> /// The RavenDB document store on which to listen for changes. /// </param> /// <param name="subscribeToChangesApi"> /// A delegate that subscribes to the change-notification API, returning an <see cref="IDisposable"/> representing the subscription. /// </param> static void ListenForChanges(DocumentStore documentStore, Func<IDatabaseChanges, IDisposable> subscribeToChangesApi) { if (documentStore == null) throw new ArgumentNullException(nameof(documentStore)); if (subscribeToChangesApi == null) throw new ArgumentNullException(nameof(subscribeToChangesApi)); ChangesApi changesApi = new ChangesApi( serverUrl: documentStore.Url, databaseName: documentStore.DefaultDatabase, api: documentStore.Changes(documentStore.DefaultDatabase), subscribe: subscribeToChangesApi ); // The API connection subject aggregates connection status events from all servers. changesApi.ConnectionObservable.Subscribe(_apiConnectionSubject); _changesApis.Add(changesApi); } /// <summary> /// Create the RavenDB document store for the primary server. /// </summary> /// <returns> /// The configured document store. /// </returns> static DocumentStore CreatePrimaryDocumentStore() { DocumentStore documentStore = new DocumentStore { Url = PrimaryServerUrl, DefaultDatabase = DatabaseName, FailoverServers = new FailoverServers { ForDefaultDatabase = SecondaryServerUrls.Select(serverUrl => new ReplicationDestination { Url = serverUrl, Database = DatabaseName }) .ToArray() } }; documentStore.Initialize(); return documentStore; } /// <summary> /// Create the RavenDB document store for a secondary server. /// </summary> /// <returns> /// The configured document store. /// </returns> static DocumentStore CreateSecondaryDocumentStore(string serverUrl, string databaseName) { if (String.IsNullOrWhiteSpace(serverUrl)) throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'serverUrl'.", nameof(serverUrl)); if (String.IsNullOrWhiteSpace(databaseName)) throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'databaseName'.", nameof(databaseName)); DocumentStore documentStore = new DocumentStore { Url = serverUrl, DefaultDatabase = databaseName }; documentStore.Initialize(); return documentStore; } /// <summary> /// Periodically poll the database to trigger fail-over (if appropriate). /// </summary> /// <param name="primaryDocumentStore"> /// The primary document store. /// </param> /// <param name="documentId"> /// The Id of the document to load when polling the database. /// </param> /// <returns> /// An <see cref="IDisposable"/> that, when disposed, stops the polling. /// </returns> static IDisposable PollDatabaseForFailOver(DocumentStore primaryDocumentStore, string documentId) { if (primaryDocumentStore == null) throw new ArgumentNullException(nameof(primaryDocumentStore)); if (String.IsNullOrWhiteSpace(documentId)) throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'documentId'.", nameof(documentId)); // Periodically load a well-known document from the database to trigger replication fail-over (if required). return Observable.Interval(TimeSpan.FromSeconds(5)).Subscribe(_ => { try { using (IDocumentSession session = primaryDocumentStore.OpenSession()) { RavenJObject document = session.Load<RavenJObject>(documentId); if (document != null) { Log.Information("{DocumentId} = {DocumentJson}", documentId, document.ToString(Formatting.None) ); } else Log.Warning("{DocumentId} is missing", documentId); } } catch (Exception eLoadDocument) { Log.Error(eLoadDocument, "Unable to load {DocumentId}: {ErrorMessage}", documentId, eLoadDocument.Message); } }); } /// <summary> /// Configure logging. /// </summary> static void ConfigureLogging() { const string simpleLogOutputTemplate = "{Level}: {Message}{NewLine}{Exception}"; Log.Logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.ColoredConsole(outputTemplate: simpleLogOutputTemplate) .WriteTo.Trace(outputTemplate: simpleLogOutputTemplate) .CreateLogger(); } } }
31.747191
168
0.693594
059c92934e14ac5d982248a5716e9ff2d16213fa
343
py
Python
mrq-config.py
guillermosainz/instareplic
a4fb26269d54be1a140b1802a4d8013a6aa0ec70
[ "MIT" ]
53
2015-02-15T19:00:33.000Z
2022-02-08T09:58:54.000Z
mrq-config.py
guillermosainz/instareplic
a4fb26269d54be1a140b1802a4d8013a6aa0ec70
[ "MIT" ]
5
2016-06-03T13:12:50.000Z
2018-05-29T08:31:44.000Z
mrq-config.py
guillermosainz/instareplic
a4fb26269d54be1a140b1802a4d8013a6aa0ec70
[ "MIT" ]
15
2016-05-18T20:09:53.000Z
2020-06-01T04:06:00.000Z
import os MONGODB_JOBS = os.getenv("MONGOLAB_URI") MONGODB_LOGS = os.getenv("MONGOLAB_URI") MONGODB_LOGS_SIZE = 10 * 1024 * 1024 REDIS = os.getenv("REDISCLOUD_URL") if os.getenv("MRQ_DASHBOARD_HTTPAUTH"): DASHBOARD_HTTPAUTH = os.getenv("MRQ_DASHBOARD_HTTPAUTH") TASKS = { "mrq.basetasks.utils.JobAction": {"queue": "highpriority"} }
22.866667
62
0.740525
79a1735239142bc5800442b03fcaffb07abcea8e
21,849
php
PHP
app/vendor/soqrate/tcpdf/fonts/freeserifbi.php
tinapc/sortable
2efa02f069756fbdff27d9bc6ef712db41fb9fd9
[ "MIT" ]
216
2019-08-23T08:42:36.000Z
2022-03-12T14:58:57.000Z
app/vendor/soqrate/tcpdf/fonts/freeserifbi.php
tinapc/sortable
2efa02f069756fbdff27d9bc6ef712db41fb9fd9
[ "MIT" ]
117
2015-01-13T02:30:52.000Z
2021-04-21T18:23:07.000Z
app/vendor/soqrate/tcpdf/fonts/freeserifbi.php
tinapc/sortable
2efa02f069756fbdff27d9bc6ef712db41fb9fd9
[ "MIT" ]
93
2019-09-06T01:14:29.000Z
2022-03-27T05:18:27.000Z
<?php $type='TrueTypeUnicode'; $name='FreeSerifBoldItalic'; $desc=array('Ascent'=>900,'Descent'=>-300,'CapHeight'=>-24,'Flags'=>96,'FontBBox'=>'[-787 -1120 1867 1571]','ItalicAngle'=>-16.3,'StemV'=>120,'MissingWidth'=>600); $up=-125; $ut=50; $dw=600; $cw=array( 32=>250,33=>389,34=>555,35=>500,36=>500,37=>833,38=>778,39=>278,40=>333,41=>333, 42=>500,43=>570,44=>250,45=>333,46=>250,47=>278,48=>500,49=>500,50=>500,51=>500, 52=>500,53=>500,54=>500,55=>500,56=>500,57=>500,58=>333,59=>333,60=>570,61=>570, 62=>570,63=>500,64=>832,65=>667,66=>667,67=>667,68=>744,69=>670,70=>656,71=>722, 72=>778,73=>393,74=>500,75=>664,76=>609,77=>896,78=>722,79=>722,80=>614,81=>722, 82=>672,83=>556,84=>611,85=>722,86=>667,87=>889,88=>667,89=>611,90=>611,91=>333, 92=>278,93=>333,94=>570,95=>500,96=>333,97=>500,98=>500,99=>444,100=>500,101=>444, 102=>333,103=>500,104=>556,105=>278,106=>278,107=>500,108=>278,109=>778,110=>556,111=>500, 112=>500,113=>500,114=>389,115=>389,116=>278,117=>556,118=>444,119=>667,120=>500,121=>444, 122=>389,123=>348,124=>220,125=>348,126=>570,8364=>761,8218=>250,402=>333,8222=>500,8230=>1000, 8224=>500,8225=>500,710=>333,8240=>1000,352=>556,8249=>333,338=>944,381=>611,8216=>250,8217=>250, 8220=>500,8221=>500,8226=>350,8211=>500,8212=>1000,732=>333,8482=>1000,353=>389,8250=>333,339=>722, 382=>389,376=>611,160=>250,161=>389,162=>500,163=>500,164=>500,165=>500,166=>220,167=>500, 168=>333,169=>747,170=>266,171=>500,172=>606,173=>333,174=>747,175=>333,176=>400,177=>570, 178=>300,179=>300,180=>333,181=>576,182=>500,183=>250,184=>333,185=>272,186=>300,187=>500, 188=>750,189=>750,190=>750,191=>500,192=>667,193=>667,194=>667,195=>667,196=>667,197=>667, 198=>944,199=>667,200=>667,201=>667,202=>667,203=>667,204=>389,205=>389,206=>389,207=>389, 208=>722,209=>722,210=>722,211=>722,212=>722,213=>722,214=>722,215=>570,216=>722,217=>722, 218=>722,219=>722,220=>722,221=>611,222=>609,223=>500,224=>500,225=>500,226=>500,227=>500, 228=>500,229=>500,230=>722,231=>444,232=>444,233=>444,234=>444,235=>444,236=>278,237=>278, 238=>278,239=>278,240=>500,241=>556,242=>500,243=>500,244=>500,245=>500,246=>500,247=>570, 248=>500,249=>556,250=>556,251=>556,252=>556,253=>444,254=>500,255=>444,256=>667,257=>500, 258=>667,259=>500,260=>667,261=>500,262=>667,263=>444,264=>667,265=>444,266=>667,267=>444, 268=>667,269=>444,270=>722,271=>616,272=>722,273=>500,274=>667,275=>444,276=>667,277=>444, 278=>667,279=>444,280=>667,281=>444,282=>667,283=>444,284=>722,285=>500,286=>722,287=>500, 288=>722,289=>500,290=>722,291=>500,292=>778,293=>556,294=>778,295=>556,296=>389,297=>278, 298=>389,299=>278,300=>389,301=>278,302=>389,303=>278,304=>389,305=>278,306=>826,307=>547, 308=>500,309=>278,310=>667,311=>500,312=>534,313=>611,314=>278,315=>611,316=>278,317=>638, 318=>424,319=>611,320=>424,321=>611,322=>278,323=>722,324=>556,325=>722,326=>556,327=>722, 328=>556,329=>556,330=>722,331=>547,332=>722,333=>500,334=>722,335=>500,336=>722,337=>500, 340=>667,341=>389,342=>667,343=>389,344=>667,345=>389,346=>556,347=>389,348=>556,349=>389, 350=>556,351=>389,354=>611,355=>278,356=>611,357=>308,358=>611,359=>278,360=>722,361=>556, 362=>722,363=>556,364=>722,365=>556,366=>722,367=>556,368=>722,369=>556,370=>722,371=>556, 372=>889,373=>667,374=>611,375=>444,377=>611,378=>389,379=>611,380=>389,383=>333,384=>500, 385=>850,386=>667,387=>575,388=>630,389=>500,390=>722,391=>929,392=>654,393=>722,394=>864, 395=>684,396=>500,397=>546,398=>670,399=>722,400=>631,401=>769,403=>929,404=>716,405=>745, 406=>278,407=>389,408=>829,409=>500,410=>278,411=>495,412=>853,413=>919,414=>556,415=>722, 416=>908,417=>640,418=>1014,419=>778,420=>757,421=>500,422=>611,423=>556,424=>389,425=>730, 426=>455,427=>349,428=>611,429=>298,430=>611,431=>902,432=>714,433=>811,434=>678,435=>611, 436=>581,437=>611,438=>389,439=>619,440=>614,441=>461,442=>445,443=>500,444=>614,445=>500, 446=>389,447=>504,448=>220,449=>418,450=>570,451=>333,452=>1355,453=>1133,454=>889,455=>1109, 456=>887,457=>556,458=>1222,459=>1000,460=>834,461=>667,462=>500,463=>393,464=>278,465=>722, 466=>500,467=>722,468=>556,469=>722,470=>556,471=>722,472=>556,473=>722,474=>556,475=>722, 476=>556,477=>444,478=>667,479=>500,480=>667,481=>500,482=>944,483=>722,484=>722,485=>500, 486=>722,487=>500,488=>664,489=>500,490=>722,491=>500,492=>722,493=>500,494=>619,495=>513, 496=>278,497=>1355,498=>1133,499=>889,500=>722,501=>500,502=>944,503=>660,504=>722,505=>556, 506=>667,507=>500,508=>944,509=>722,510=>722,511=>500,512=>667,513=>500,514=>667,515=>500, 516=>670,517=>444,518=>670,519=>444,520=>393,521=>278,522=>393,523=>278,524=>722,525=>500, 526=>722,527=>500,528=>672,529=>389,530=>672,531=>389,532=>722,533=>556,534=>722,535=>556, 536=>556,537=>389,538=>611,539=>278,540=>424,541=>455,542=>778,543=>556,544=>731,545=>618, 546=>568,547=>500,548=>667,549=>444,550=>667,551=>500,552=>670,553=>444,554=>722,555=>500, 556=>722,557=>500,558=>722,559=>500,560=>722,561=>500,562=>611,563=>444,564=>422,565=>621, 566=>413,567=>278,568=>800,569=>784,570=>644,571=>667,572=>444,573=>664,574=>611,575=>389, 576=>451,577=>444,578=>444,579=>667,580=>722,581=>722,582=>670,583=>444,584=>500,585=>278, 586=>808,587=>608,588=>672,589=>389,590=>611,591=>444,592=>500,593=>590,594=>590,595=>500, 596=>444,599=>668,600=>444,601=>444,603=>430,608=>569,609=>500,613=>556,616=>278,617=>320, 618=>278,623=>778,629=>500,633=>389,643=>333,648=>278,649=>500,650=>557,651=>492,652=>444, 653=>667,654=>444,658=>513,670=>500,697=>250,698=>408,699=>250,700=>250,701=>250,702=>300, 703=>300,706=>333,707=>333,708=>333,709=>333,711=>333,712=>333,713=>333,714=>333,715=>333, 716=>300,717=>333,718=>333,719=>333,720=>278,721=>278,722=>300,723=>300,724=>333,725=>333, 726=>333,727=>333,728=>333,729=>333,730=>333,731=>333,733=>333,734=>333,735=>352,741=>526, 742=>526,743=>526,744=>526,745=>526,746=>519,747=>519,748=>333,749=>333,750=>480,751=>333, 752=>333,753=>333,754=>333,755=>327,756=>261,757=>437,758=>437,759=>400,760=>278,761=>175, 762=>175,763=>175,764=>175,765=>0,766=>337,767=>432,768=>0,769=>0,770=>0,771=>0, 772=>0,773=>0,774=>0,775=>0,776=>0,777=>0,778=>0,779=>0,780=>0,781=>0, 782=>0,783=>0,784=>0,785=>0,786=>0,787=>0,788=>0,789=>0,790=>0,791=>0, 792=>0,793=>0,794=>0,795=>0,796=>0,797=>0,798=>0,799=>0,800=>0,801=>0, 802=>0,803=>0,804=>0,805=>0,806=>0,807=>0,808=>0,809=>0,810=>0,811=>0, 812=>0,813=>0,814=>0,815=>0,816=>0,817=>0,818=>0,819=>0,820=>0,821=>0, 822=>0,823=>0,824=>0,825=>0,826=>0,827=>0,828=>0,829=>0,830=>0,831=>0, 832=>0,833=>0,834=>0,835=>0,836=>0,837=>0,838=>0,839=>0,840=>0,841=>0, 842=>0,843=>0,844=>0,845=>0,846=>0,847=>0,848=>0,849=>0,850=>0,851=>0, 852=>0,853=>0,854=>0,855=>0,856=>0,857=>0,858=>0,860=>0,861=>0,862=>0, 863=>0,864=>0,865=>0,884=>199,885=>199,890=>0,894=>333,900=>330,901=>333,902=>667, 903=>250,904=>819,905=>955,906=>539,908=>835,910=>961,911=>889,912=>320,913=>667,914=>667, 915=>637,916=>740,917=>667,918=>611,919=>778,920=>722,921=>389,922=>677,923=>667,924=>889, 925=>722,926=>650,927=>722,928=>778,929=>611,931=>730,932=>621,933=>722,934=>748,935=>667, 936=>858,937=>741,938=>389,939=>722,940=>590,941=>430,942=>548,943=>320,944=>536,945=>590, 946=>536,947=>548,948=>550,949=>430,950=>482,951=>548,952=>525,953=>320,954=>564,955=>510, 956=>589,957=>522,958=>482,959=>536,960=>629,961=>536,962=>470,963=>536,964=>464,965=>536, 966=>643,967=>482,968=>715,969=>715,970=>320,971=>536,972=>536,973=>536,974=>715,976=>508, 977=>589,978=>722,979=>931,980=>722,981=>660,982=>715,983=>536,984=>611,985=>536,986=>620, 987=>524,988=>667,989=>535,990=>708,991=>428,992=>671,993=>633,1008=>550,1009=>550,1010=>477, 1011=>278,1012=>722,1013=>411,1014=>411,1015=>609,1016=>500,1017=>667,1018=>896,1019=>769,1020=>536, 1021=>667,1022=>667,1023=>667,1024=>670,1025=>670,1026=>762,1027=>637,1028=>667,1029=>556,1030=>393, 1031=>393,1032=>500,1033=>1085,1034=>1049,1035=>747,1036=>736,1037=>778,1038=>746,1039=>778,1040=>667, 1041=>667,1042=>667,1043=>637,1044=>778,1045=>670,1046=>1044,1047=>650,1048=>778,1049=>778,1050=>736, 1051=>814,1052=>896,1053=>778,1054=>722,1055=>778,1056=>614,1057=>667,1058=>611,1059=>746,1060=>748, 1061=>667,1062=>778,1063=>742,1064=>1136,1065=>1135,1066=>779,1067=>984,1068=>664,1069=>732,1070=>1069, 1071=>779,1072=>500,1073=>508,1074=>486,1075=>414,1076=>486,1077=>444,1078=>982,1079=>476,1080=>556, 1081=>556,1082=>564,1083=>585,1084=>757,1085=>552,1086=>500,1087=>556,1088=>500,1089=>444,1090=>778, 1091=>532,1092=>764,1093=>500,1094=>556,1095=>556,1096=>806,1097=>806,1098=>644,1099=>744,1100=>470, 1101=>488,1102=>757,1103=>586,1104=>444,1105=>444,1106=>524,1107=>414,1108=>488,1109=>389,1110=>278, 1111=>278,1112=>278,1113=>772,1114=>745,1115=>556,1116=>564,1117=>556,1118=>532,1119=>556,1120=>990, 1121=>690,1122=>804,1123=>751,1124=>1017,1125=>752,1126=>900,1127=>728,1128=>1236,1129=>927,1130=>1044, 1131=>826,1132=>1401,1133=>1016,1134=>620,1135=>476,1136=>858,1137=>769,1138=>722,1139=>544,1140=>796, 1141=>584,1142=>796,1143=>584,1144=>1268,1145=>1023,1146=>895,1147=>612,1148=>990,1149=>690,1150=>990, 1151=>635,1152=>620,1153=>444,1154=>372,1155=>0,1156=>0,1157=>0,1158=>0,1159=>0,1160=>0, 1161=>0,1162=>778,1163=>556,1164=>664,1165=>470,1166=>614,1167=>473,1168=>624,1169=>448,1170=>624, 1171=>448,1172=>733,1173=>485,1174=>1080,1175=>982,1176=>650,1177=>476,1178=>772,1179=>564,1180=>772, 1181=>590,1182=>738,1183=>499,1184=>862,1185=>718,1186=>778,1187=>552,1188=>976,1189=>682,1190=>1085, 1191=>787,1192=>667,1193=>480,1194=>667,1195=>444,1196=>534,1197=>778,1198=>611,1199=>640,1200=>611, 1201=>640,1202=>694,1203=>500,1204=>1004,1205=>518,1206=>742,1207=>556,1208=>742,1209=>556,1210=>716, 1211=>556,1212=>844,1213=>530,1214=>844,1215=>530,1216=>393,1217=>1044,1218=>982,1219=>736,1220=>534, 1221=>814,1222=>585,1223=>778,1224=>552,1225=>778,1226=>552,1227=>742,1228=>556,1229=>896,1230=>757, 1231=>393,1232=>667,1233=>500,1234=>667,1235=>500,1236=>891,1237=>646,1238=>670,1239=>444,1240=>659, 1241=>372,1242=>619,1243=>372,1244=>1044,1245=>994,1246=>650,1247=>476,1248=>604,1249=>459,1250=>778, 1251=>539,1252=>778,1253=>539,1254=>722,1255=>500,1256=>722,1257=>500,1258=>722,1259=>500,1260=>732, 1261=>488,1262=>746,1263=>532,1264=>746,1265=>532,1266=>746,1267=>532,1268=>742,1269=>556,1270=>637, 1271=>448,1272=>984,1273=>744,1296=>652,1297=>452,1298=>814,1299=>585,1306=>722,1307=>500,1308=>889, 1309=>656,1310=>736,1311=>564,1425=>0,1426=>0,1427=>0,1428=>0,1429=>0,1430=>0,1431=>0, 1432=>0,1433=>0,1434=>0,1435=>0,1436=>0,1437=>0,1438=>0,1439=>0,1440=>0,1441=>0, 1442=>0,1443=>0,1444=>0,1445=>0,1446=>0,1447=>0,1448=>0,1449=>0,1450=>0,1451=>0, 1452=>0,1453=>0,1454=>0,1455=>0,1456=>0,1457=>0,1458=>0,1459=>0,1460=>0,1461=>0, 1462=>0,1463=>0,1464=>0,1465=>0,1466=>0,1467=>0,1468=>0,1469=>0,1470=>433,1471=>0, 1472=>155,1473=>0,1474=>0,1475=>400,1476=>0,1477=>0,1478=>347,1479=>0,1488=>593,1489=>498, 1490=>339,1491=>523,1492=>561,1493=>266,1494=>291,1495=>559,1496=>576,1497=>266,1498=>496,1499=>501, 1500=>510,1501=>542,1502=>581,1503=>273,1504=>347,1505=>512,1506=>552,1507=>493,1508=>491,1509=>537, 1510=>561,1511=>544,1512=>502,1513=>716,1514=>571,1520=>532,1521=>532,1522=>532,1523=>396,1524=>432, 3585=>590,3586=>578,3587=>661,3588=>592,3589=>592,3590=>699,3591=>447,3592=>534,3593=>692,3594=>578, 3595=>659,3596=>899,3597=>804,3598=>633,3599=>637,3600=>484,3601=>730,3602=>876,3603=>915,3604=>592, 3605=>592,3606=>578,3607=>670,3608=>542,3609=>671,3610=>621,3611=>618,3612=>621,3613=>617,3614=>708, 3615=>708,3616=>637,3617=>589,3618=>552,3619=>484,3620=>590,3621=>569,3622=>637,3623=>526,3624=>599, 3625=>802,3626=>579,3627=>668,3628=>778,3629=>560,3630=>514,3631=>510,3632=>442,3633=>0,3634=>423, 3635=>452,3636=>0,3637=>0,3638=>0,3639=>0,3640=>0,3641=>0,3642=>0,3647=>665,3648=>357, 3649=>624,3650=>529,3651=>486,3652=>475,3653=>423,3654=>500,3655=>0,3656=>0,3657=>0,3658=>0, 3659=>0,3660=>0,3661=>0,3662=>0,3663=>657,3664=>548,3665=>548,3666=>592,3667=>614,3668=>631, 3669=>643,3670=>508,3671=>744,3672=>622,3673=>585,3674=>721,3675=>1381,4256=>475,4257=>469,4258=>573, 4259=>650,4260=>502,4261=>506,4262=>481,4263=>746,4264=>491,4265=>495,4266=>888,4267=>488,4268=>464, 4269=>745,4270=>483,4271=>489,4272=>721,4273=>464,4274=>578,4275=>590,4276=>611,4277=>491,4278=>663, 4279=>489,4280=>544,4281=>479,4282=>527,4283=>488,4284=>560,4285=>461,4286=>467,4287=>546,4288=>483, 4289=>487,4290=>562,4291=>477,4292=>491,4293=>471,4304=>522,4305=>518,4306=>621,4307=>716,4308=>517, 4309=>519,4310=>518,4311=>796,4312=>518,4313=>518,4314=>934,4315=>517,4316=>519,4317=>787,4318=>515, 4319=>514,4320=>788,4321=>573,4322=>620,4323=>593,4324=>639,4325=>516,4326=>714,4327=>518,4328=>572, 4329=>518,4330=>555,4331=>518,4332=>562,4333=>509,4334=>572,4335=>677,4336=>523,4337=>517,4338=>595, 4339=>480,4340=>519,4341=>484,4345=>621,4347=>410,5024=>718,5025=>768,5026=>633,5027=>878,5028=>1001, 5029=>371,5030=>576,5031=>754,5032=>531,5033=>774,5034=>692,5035=>499,5036=>668,5037=>829,5038=>575, 5039=>681,5040=>485,5041=>607,5042=>885,5043=>974,5044=>588,5045=>583,5046=>726,5047=>947,5048=>558, 5049=>832,5050=>1096,5051=>780,5052=>595,5053=>869,5054=>752,5055=>710,5056=>761,5057=>802,5058=>760, 5059=>656,5060=>655,5061=>982,5062=>684,5063=>801,5064=>805,5065=>1042,5066=>755,5067=>612,5068=>707, 5069=>889,5070=>584,5071=>623,5072=>536,5073=>763,5074=>763,5075=>498,5076=>1052,5077=>600,5078=>730, 5079=>714,5080=>714,5081=>697,5082=>543,5083=>943,5084=>718,5085=>630,5086=>660,5087=>692,5088=>841, 5089=>861,5090=>617,5091=>733,5092=>898,5093=>896,5094=>781,5095=>612,5096=>830,5097=>948,5098=>886, 5099=>757,5100=>796,5101=>578,5102=>601,5103=>797,5104=>623,5105=>886,5106=>730,5107=>827,5108=>648, 7680=>667,7681=>500,7682=>667,7683=>500,7684=>667,7685=>500,7686=>667,7687=>500,7688=>667,7689=>444, 7690=>744,7691=>500,7692=>744,7693=>500,7694=>744,7695=>500,7696=>744,7697=>500,7698=>744,7699=>500, 7700=>667,7701=>444,7702=>667,7703=>444,7704=>670,7705=>444,7706=>670,7707=>444,7708=>670,7709=>444, 7710=>656,7711=>333,7712=>722,7713=>500,7714=>778,7715=>556,7716=>778,7717=>556,7718=>778,7719=>556, 7720=>778,7721=>556,7722=>778,7723=>556,7724=>393,7725=>278,7726=>389,7727=>278,7728=>664,7729=>500, 7730=>664,7731=>500,7732=>664,7733=>500,7734=>609,7735=>278,7736=>609,7737=>278,7738=>609,7739=>278, 7740=>609,7741=>278,7742=>896,7743=>778,7744=>896,7745=>778,7746=>896,7747=>778,7748=>722,7749=>556, 7750=>722,7751=>556,7752=>722,7753=>556,7754=>722,7755=>556,7756=>722,7757=>500,7758=>722,7759=>500, 7760=>722,7761=>500,7762=>722,7763=>500,7764=>614,7765=>500,7766=>614,7767=>500,7768=>672,7769=>389, 7770=>672,7771=>389,7772=>672,7773=>389,7774=>672,7775=>389,7776=>556,7777=>389,7778=>556,7779=>389, 7780=>556,7781=>389,7782=>556,7783=>389,7784=>556,7785=>389,7786=>611,7787=>278,7788=>611,7789=>278, 7790=>611,7791=>278,7792=>611,7793=>278,7794=>722,7795=>556,7796=>722,7797=>556,7798=>722,7799=>556, 7800=>722,7801=>556,7802=>722,7803=>556,7804=>667,7805=>444,7806=>667,7807=>444,7808=>889,7809=>667, 7810=>889,7811=>667,7812=>889,7813=>667,7814=>889,7815=>667,7816=>889,7817=>667,7818=>667,7819=>500, 7820=>667,7821=>500,7822=>611,7823=>444,7824=>611,7825=>389,7826=>611,7827=>389,7828=>611,7829=>389, 7830=>556,7831=>278,7832=>667,7833=>444,7834=>507,7835=>333,7840=>667,7841=>500,7842=>667,7843=>500, 7844=>667,7845=>500,7846=>667,7847=>500,7848=>667,7849=>500,7850=>667,7851=>500,7852=>667,7853=>500, 7854=>667,7855=>500,7856=>667,7857=>500,7858=>667,7859=>500,7860=>667,7861=>500,7862=>667,7863=>500, 7864=>670,7865=>444,7866=>670,7867=>444,7868=>670,7869=>444,7870=>667,7871=>444,7872=>667,7873=>444, 7874=>667,7875=>444,7876=>667,7877=>444,7878=>670,7879=>444,7880=>393,7881=>278,7882=>393,7883=>278, 7884=>722,7885=>500,7886=>722,7887=>500,7888=>722,7889=>500,7890=>722,7891=>500,7892=>722,7893=>500, 7894=>722,7895=>500,7896=>722,7897=>500,7898=>908,7899=>640,7900=>908,7901=>640,7902=>908,7903=>640, 7904=>908,7905=>640,7906=>908,7907=>640,7908=>722,7909=>556,7910=>722,7911=>556,7912=>902,7913=>714, 7914=>902,7915=>714,7916=>902,7917=>714,7918=>902,7919=>714,7920=>902,7921=>714,7922=>611,7923=>444, 7924=>611,7925=>444,7926=>611,7927=>444,7928=>611,7929=>444,7936=>590,7937=>590,7938=>590,7939=>590, 7940=>590,7941=>590,7942=>590,7943=>590,7944=>724,7945=>753,7946=>891,7947=>912,7948=>822,7949=>853, 7950=>796,7951=>787,7952=>430,7953=>430,7954=>430,7955=>430,7956=>430,7957=>430,7960=>864,7961=>905, 7962=>1034,7963=>1038,7964=>1031,7965=>1045,7968=>548,7969=>548,7970=>548,7971=>548,7972=>548,7973=>548, 7974=>548,7975=>548,7976=>976,7977=>1009,7978=>1132,7979=>1141,7980=>1138,7981=>1154,7982=>1079,7983=>1071, 7984=>320,7985=>320,7986=>320,7987=>320,7988=>320,7989=>320,7990=>320,7991=>320,7992=>593,7993=>620, 7994=>746,7995=>762,7996=>742,7997=>773,7998=>691,7999=>683,8000=>536,8001=>536,8002=>536,8003=>536, 8004=>536,8005=>536,8008=>899,8009=>928,8010=>1086,8011=>1118,8012=>1020,8013=>1028,8016=>536,8017=>536, 8018=>536,8019=>536,8020=>536,8021=>536,8022=>536,8023=>536,8025=>959,8027=>1085,8029=>1108,8031=>1027, 8032=>715,8033=>715,8034=>715,8035=>715,8036=>715,8037=>715,8038=>715,8039=>715,8040=>946,8041=>960, 8042=>1133,8043=>1148,8044=>1059,8045=>1081,8046=>1020,8047=>1016,8048=>590,8049=>590,8050=>430,8051=>430, 8052=>548,8053=>548,8054=>320,8055=>320,8056=>536,8057=>536,8058=>536,8059=>536,8060=>715,8061=>715, 8064=>590,8065=>590,8066=>590,8067=>590,8068=>590,8069=>590,8070=>590,8071=>590,8072=>842,8073=>877, 8074=>1011,8075=>1031,8076=>947,8077=>975,8078=>907,8079=>893,8080=>548,8081=>548,8082=>548,8083=>548, 8084=>548,8085=>548,8086=>548,8087=>548,8088=>1030,8089=>1066,8090=>1188,8091=>1199,8092=>1196,8093=>1211, 8094=>1134,8095=>1129,8096=>715,8097=>715,8098=>715,8099=>715,8100=>715,8101=>715,8102=>715,8103=>715, 8104=>1060,8105=>1076,8106=>1264,8107=>1287,8108=>1179,8109=>1204,8110=>1137,8111=>1135,8112=>590,8113=>590, 8114=>590,8115=>590,8116=>590,8118=>590,8119=>590,8120=>667,8121=>667,8122=>752,8123=>728,8124=>775, 8125=>250,8126=>0,8127=>500,8128=>500,8129=>550,8130=>548,8131=>548,8132=>548,8134=>548,8135=>548, 8136=>884,8137=>859,8138=>982,8139=>968,8140=>839,8141=>500,8142=>500,8143=>500,8144=>320,8145=>320, 8146=>320,8147=>320,8150=>320,8151=>320,8152=>389,8153=>389,8154=>599,8155=>592,8157=>500,8158=>500, 8159=>500,8160=>536,8161=>536,8162=>536,8163=>536,8164=>536,8165=>536,8166=>536,8167=>536,8168=>722, 8169=>722,8170=>1007,8171=>932,8172=>842,8173=>550,8174=>550,8175=>500,8178=>715,8179=>715,8180=>715, 8182=>715,8183=>715,8184=>971,8185=>853,8186=>1004,8187=>875,8188=>862,8189=>500,8190=>500,8192=>500, 8193=>1000,8194=>500,8195=>1000,8196=>333,8197=>250,8198=>167,8199=>500,8200=>250,8201=>200,8202=>100, 8203=>0,8204=>0,8205=>0,8206=>0,8207=>0,8208=>333,8209=>333,8210=>500,8213=>1000,8214=>333, 8215=>478,8219=>250,8223=>500,8227=>560,8228=>250,8229=>478,8231=>0,8232=>0,8233=>0,8234=>0, 8235=>0,8236=>0,8237=>0,8238=>250,8239=>0,8241=>1618,8242=>278,8243=>556,8244=>834,8245=>270, 8246=>468,8247=>630,8248=>469,8251=>727,8252=>778,8253=>733,8254=>500,8255=>953,8256=>953,8257=>338, 8258=>931,8259=>333,8260=>167,8261=>332,8262=>332,8263=>1000,8264=>889,8265=>889,8266=>500,8267=>453, 8268=>479,8269=>492,8270=>500,8271=>333,8272=>953,8273=>500,8274=>521,8275=>576,8276=>953,8277=>785, 8278=>410,8279=>881,8280=>620,8281=>620,8282=>179,8283=>621,8284=>569,8285=>179,8286=>179,8287=>111, 8288=>0,8289=>0,8290=>0,8291=>0,8292=>0,8304=>300,8305=>219,8308=>300,8309=>300,8310=>300, 8311=>300,8312=>300,8313=>300,8314=>300,8315=>300,8316=>300,8317=>216,8318=>216,8319=>300,8320=>300, 8321=>274,8322=>300,8323=>300,8324=>300,8325=>300,8326=>300,8327=>300,8328=>300,8329=>300,8330=>300, 8331=>300,8332=>300,8333=>216,8334=>216,8352=>667,8353=>667,8354=>667,8355=>667,8356=>500,8357=>742, 8358=>722,8359=>1008,8360=>953,8361=>889,8362=>889,8363=>532,8365=>742,8366=>631,8369=>609,8370=>639, 8371=>742,8372=>576,8373=>500,8448=>664,8449=>665,8451=>925,8453=>693,8454=>787,8455=>631,8457=>867, 8462=>556,8463=>556,8468=>778,8470=>806,8471=>747,8480=>879,8481=>1050,8483=>667,8486=>741,8487=>741, 8489=>320,8490=>664,8491=>667,8494=>551,8495=>444,8498=>667,8500=>500,8501=>537,8502=>537,8503=>350, 8504=>537,8506=>942,8507=>1050,8523=>698,8525=>856,8526=>462,8531=>750,8532=>750,8533=>750,8534=>750, 8535=>750,8536=>750,8537=>750,8538=>750,8539=>750,8540=>750,8541=>750,8542=>750,8543=>750,8544=>393, 8545=>786,8546=>1179,8547=>1060,8548=>667,8549=>1060,8550=>1453,8551=>1846,8552=>1060,8553=>667,8554=>1060, 8555=>1453,8556=>609,8557=>667,8558=>744,8559=>896,8560=>278,8561=>556,8562=>834,8563=>722,8564=>444, 8565=>722,8566=>1000,8567=>1278,8568=>778,8569=>500,8570=>778,8571=>1056,8572=>278,8573=>444,8574=>500, 8575=>778,8592=>964,8593=>964,8594=>964,8595=>964,8596=>964,8597=>964,8598=>964,8599=>964,8600=>964, 8601=>964,8602=>964,8603=>964,8606=>964,8607=>964,8608=>964,8609=>964,8610=>964,8611=>964,8612=>964, 8613=>964,8614=>964,8615=>964,8616=>964,8633=>964,8634=>964,8644=>964,8645=>964,8646=>964,8647=>964, 8648=>964,8649=>964,8650=>964,8676=>964,8677=>964,8706=>494,8710=>612,8721=>713,8722=>606,8725=>750, 8730=>549,8734=>752,8800=>570,8804=>570,8805=>570,9251=>500,9674=>494,9676=>732,9824=>618,9825=>645, 9826=>587,9827=>582,9828=>582,9829=>645,9830=>587,9831=>618,9833=>333,9834=>556,9835=>778,9836=>778, 9837=>556,9838=>556,9839=>556,11799=>333,64256=>583,64257=>558,64258=>551,64259=>822,64260=>818,64262=>662, 64285=>266,64286=>0,64287=>532,64288=>552,64297=>570,64298=>716,64299=>716,64300=>716,64301=>716,64302=>593, 64303=>593,64304=>593,64305=>498,64306=>339,64307=>523,64308=>561,64309=>266,64310=>291,64312=>576,64313=>266, 64314=>496,64315=>501,64316=>510,64318=>581,64320=>347,64321=>512,64323=>493,64324=>491,64326=>561,64327=>544, 64328=>502,64329=>716,64330=>571,64331=>266,64332=>498,64333=>501,64334=>491,64335=>593,65533=>788); $enc=''; $diff=''; $file='freeserifbi.z'; $ctg='freeserifbi.ctg.z'; $originalsize=452752; ?>
91.802521
163
0.676644
05d35d454a680f011fb0f6d5a66f5ed65ce0ef57
1,838
py
Python
perma_web/perma/migrations/0037_auto_20181004_1709.py
rachelaus/perma
36c05080520ea3ffce465dbc383795c060fa4112
[ "MIT", "Unlicense" ]
317
2015-02-12T16:53:34.000Z
2022-03-14T23:38:04.000Z
perma_web/perma/migrations/0037_auto_20181004_1709.py
rachelaus/perma
36c05080520ea3ffce465dbc383795c060fa4112
[ "MIT", "Unlicense" ]
2,069
2015-01-06T20:09:24.000Z
2022-03-31T15:44:36.000Z
perma_web/perma/migrations/0037_auto_20181004_1709.py
rachelaus/perma
36c05080520ea3ffce465dbc383795c060fa4112
[ "MIT", "Unlicense" ]
69
2015-01-12T18:56:07.000Z
2022-02-22T19:57:10.000Z
# -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-10-04 17:09 from __future__ import unicode_literals from django.db import migrations, models def change_private_reason(apps, schema_editor): # Links labeled 'Private by policy' created prior to this deployment # were made private because of an implicit `settings.PRIVATE_LINKS_IF_GENERIC_NOARCHIVE = True`. # With this release of Perma, we plan to toggle `PRIVATE_LINKS_IF_GENERIC_NOARCHIVE = False`. # We want to keep track of which Links were made before and after this change in policy, # using this data migration. Link = apps.get_model('perma', 'Link') private_by_policy = Link.objects.filter(private_reason='policy') private_by_policy.update(private_reason='old_policy') class Migration(migrations.Migration): dependencies = [ ('perma', '0036_auto_20180827_1623'), ] operations = [ migrations.AlterField( model_name='historicallink', name='private_reason', field=models.CharField(blank=True, choices=[('policy', 'Perma-specific robots.txt or meta tag'), ('old_policy', 'Generic robots.txt or meta tag'), ('user', 'At user direction'), ('takedown', 'At request of content owner'), ('failure', 'Analysis of meta tags failed')], max_length=10, null=True), ), migrations.AlterField( model_name='link', name='private_reason', field=models.CharField(blank=True, choices=[('policy', 'Perma-specific robots.txt or meta tag'), ('old_policy', 'Generic robots.txt or meta tag'), ('user', 'At user direction'), ('takedown', 'At request of content owner'), ('failure', 'Analysis of meta tags failed')], max_length=10, null=True), ), migrations.RunPython(change_private_reason, migrations.RunPython.noop), ]
47.128205
307
0.68716
b75d5f6b53407b02a3ed08c0106c12f45f591815
1,267
cs
C#
Rhino.Licensing.AdminTool/Dialogs/OpenFileDialog.cs
tpwalke2/rhino-licensing
27686da8c32e763185f6e0da62d9c3c8be5d434e
[ "BSD-3-Clause" ]
231
2015-01-06T22:10:34.000Z
2022-02-15T00:13:49.000Z
Rhino.Licensing.AdminTool/Dialogs/OpenFileDialog.cs
tpwalke2/rhino-licensing
27686da8c32e763185f6e0da62d9c3c8be5d434e
[ "BSD-3-Clause" ]
14
2015-02-10T19:18:26.000Z
2020-11-27T16:28:41.000Z
Rhino.Licensing.AdminTool/Dialogs/OpenFileDialog.cs
tpwalke2/rhino-licensing
27686da8c32e763185f6e0da62d9c3c8be5d434e
[ "BSD-3-Clause" ]
107
2015-01-27T19:01:36.000Z
2022-03-16T18:17:15.000Z
using System.Windows.Forms; using Rhino.Licensing.AdminTool.ViewModels; using OpenDialog = System.Windows.Forms.OpenFileDialog; namespace Rhino.Licensing.AdminTool.Dialogs { public class OpenFileDialog : FileDialog<IOpenFileDialogViewModel> { private readonly OpenDialog _openFileDialog; public OpenFileDialog() { _openFileDialog = new OpenDialog(); } protected override FileDialog Dialog { get { return _openFileDialog; } } protected override void BindDialogToViewModel() { base.BindDialogToViewModel(); _openFileDialog.AddExtension = ViewModel.AddExtension; _openFileDialog.CheckFileExists = ViewModel.CheckFileExists; _openFileDialog.CheckPathExists = ViewModel.CheckPathExists; _openFileDialog.DefaultExt = ViewModel.DefaultExtension; _openFileDialog.FileName = ViewModel.FileName; _openFileDialog.Filter = ViewModel.Filter; _openFileDialog.InitialDirectory = ViewModel.InitialDirectory; _openFileDialog.Multiselect = ViewModel.MultiSelect; _openFileDialog.Title = ViewModel.Title; } } }
35.194444
75
0.659826
91e2a9953147fc49000488cb7e93008b3ef7705d
42,668
html
HTML
lab2/BufMgr/docs/file_8cpp_source.html
Zhang-Qing-Yun/HIT-DB-Lab
2d0d9773c613e7d2af125012a4071b89f718227b
[ "Apache-2.0" ]
null
null
null
lab2/BufMgr/docs/file_8cpp_source.html
Zhang-Qing-Yun/HIT-DB-Lab
2d0d9773c613e7d2af125012a4071b89f718227b
[ "Apache-2.0" ]
null
null
null
lab2/BufMgr/docs/file_8cpp_source.html
Zhang-Qing-Yun/HIT-DB-Lab
2d0d9773c613e7d2af125012a4071b89f718227b
[ "Apache-2.0" ]
null
null
null
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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"/> <title>BadgerDB: bufmgr/src/file.cpp Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">BadgerDB </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.6.1 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File&#160;List</span></a></li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <div class="title">bufmgr/src/file.cpp</div> </div> </div><!--header--> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00008"></a>00008 <span class="preprocessor">#include &quot;file.h&quot;</span> <a name="l00009"></a>00009 <a name="l00010"></a>00010 <span class="preprocessor">#include &lt;fstream&gt;</span> <a name="l00011"></a>00011 <span class="preprocessor">#include &lt;iostream&gt;</span> <a name="l00012"></a>00012 <span class="preprocessor">#include &lt;memory&gt;</span> <a name="l00013"></a>00013 <span class="preprocessor">#include &lt;string&gt;</span> <a name="l00014"></a>00014 <span class="preprocessor">#include &lt;cstdio&gt;</span> <a name="l00015"></a>00015 <span class="preprocessor">#include &lt;cassert&gt;</span> <a name="l00016"></a>00016 <a name="l00017"></a>00017 <span class="preprocessor">#include &quot;exceptions/file_exists_exception.h&quot;</span> <a name="l00018"></a>00018 <span class="preprocessor">#include &quot;exceptions/file_not_found_exception.h&quot;</span> <a name="l00019"></a>00019 <span class="preprocessor">#include &quot;exceptions/file_open_exception.h&quot;</span> <a name="l00020"></a>00020 <span class="preprocessor">#include &quot;exceptions/invalid_page_exception.h&quot;</span> <a name="l00021"></a>00021 <span class="preprocessor">#include &quot;file_iterator.h&quot;</span> <a name="l00022"></a>00022 <span class="preprocessor">#include &quot;page.h&quot;</span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="keyword">namespace </span>badgerdb { <a name="l00025"></a>00025 <a name="l00026"></a>00026 File::StreamMap File::open_streams_; <a name="l00027"></a>00027 File::CountMap File::open_counts_; <a name="l00028"></a>00028 <a name="l00029"></a><a class="code" href="classbadgerdb_1_1_file.html#a1fb708b45103a606f189850d6bf83a0c">00029</a> <a class="code" href="classbadgerdb_1_1_file.html" title="Class which represents a file in the filesystem containing database pages.">File</a> <a class="code" href="classbadgerdb_1_1_file.html#a1fb708b45103a606f189850d6bf83a0c">File::create</a>(<span class="keyword">const</span> std::string&amp; filename) { <a name="l00030"></a>00030 <span class="keywordflow">return</span> <a class="code" href="classbadgerdb_1_1_file.html#a600baaf77d18f39e51ae7473eca633c4">File</a>(filename, <span class="keyword">true</span> <span class="comment">/* create_new */</span>); <a name="l00031"></a>00031 } <a name="l00032"></a>00032 <a name="l00033"></a><a class="code" href="classbadgerdb_1_1_file.html#a8462afdbd250c0a483ddfbde144c8732">00033</a> <a class="code" href="classbadgerdb_1_1_file.html" title="Class which represents a file in the filesystem containing database pages.">File</a> <a class="code" href="classbadgerdb_1_1_file.html#a8462afdbd250c0a483ddfbde144c8732">File::open</a>(<span class="keyword">const</span> std::string&amp; filename) { <a name="l00034"></a>00034 <span class="keywordflow">return</span> <a class="code" href="classbadgerdb_1_1_file.html#a600baaf77d18f39e51ae7473eca633c4">File</a>(filename, <span class="keyword">false</span> <span class="comment">/* create_new */</span>); <a name="l00035"></a>00035 } <a name="l00036"></a>00036 <a name="l00037"></a><a class="code" href="classbadgerdb_1_1_file.html#a1cc69467366badbd68021ac76a91190e">00037</a> <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a1cc69467366badbd68021ac76a91190e">File::remove</a>(<span class="keyword">const</span> std::string&amp; filename) { <a name="l00038"></a>00038 <span class="keywordflow">if</span> (!<a class="code" href="classbadgerdb_1_1_file.html#a864d59b12302c26b14967bd1d3e520bd">exists</a>(filename)) { <a name="l00039"></a>00039 <span class="keywordflow">throw</span> <a class="code" href="classbadgerdb_1_1_file_not_found_exception.html" title="An exception that is thrown when a file operation is requested for a filename that doesn&#39;t exist...">FileNotFoundException</a>(filename); <a name="l00040"></a>00040 } <a name="l00041"></a>00041 <span class="keywordflow">if</span> (<a class="code" href="classbadgerdb_1_1_file.html#a64836156a9bb5f81d2c2c4e6f3ada24d">isOpen</a>(filename)) { <a name="l00042"></a>00042 <span class="keywordflow">throw</span> <a class="code" href="classbadgerdb_1_1_file_open_exception.html" title="An exception that is thrown when a file deletion is requested for a filename that&#39;s currently open...">FileOpenException</a>(filename); <a name="l00043"></a>00043 } <a name="l00044"></a>00044 <a class="code" href="classbadgerdb_1_1_file.html#a1cc69467366badbd68021ac76a91190e">std::remove</a>(filename.c_str()); <a name="l00045"></a>00045 } <a name="l00046"></a>00046 <a name="l00047"></a><a class="code" href="classbadgerdb_1_1_file.html#a64836156a9bb5f81d2c2c4e6f3ada24d">00047</a> <span class="keywordtype">bool</span> <a class="code" href="classbadgerdb_1_1_file.html#a64836156a9bb5f81d2c2c4e6f3ada24d">File::isOpen</a>(<span class="keyword">const</span> std::string&amp; filename) { <a name="l00048"></a>00048 <span class="keywordflow">if</span> (!<a class="code" href="classbadgerdb_1_1_file.html#a864d59b12302c26b14967bd1d3e520bd">exists</a>(filename)) { <a name="l00049"></a>00049 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00050"></a>00050 } <a name="l00051"></a>00051 <span class="keywordflow">return</span> open_counts_.find(filename) != open_counts_.end(); <a name="l00052"></a>00052 } <a name="l00053"></a>00053 <a name="l00054"></a><a class="code" href="classbadgerdb_1_1_file.html#a864d59b12302c26b14967bd1d3e520bd">00054</a> <span class="keywordtype">bool</span> <a class="code" href="classbadgerdb_1_1_file.html#a864d59b12302c26b14967bd1d3e520bd">File::exists</a>(<span class="keyword">const</span> std::string&amp; filename) { <a name="l00055"></a>00055 std::fstream file(filename); <a name="l00056"></a>00056 <span class="keywordflow">if</span>(file) <a name="l00057"></a>00057 { <a name="l00058"></a>00058 file.close(); <a name="l00059"></a>00059 <span class="keywordflow">return</span> <span class="keyword">true</span>; <a name="l00060"></a>00060 } <a name="l00061"></a>00061 <a name="l00062"></a>00062 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00063"></a>00063 } <a name="l00064"></a>00064 <a name="l00065"></a><a class="code" href="classbadgerdb_1_1_file.html#a600baaf77d18f39e51ae7473eca633c4">00065</a> <a class="code" href="classbadgerdb_1_1_file.html#a600baaf77d18f39e51ae7473eca633c4">File::File</a>(<span class="keyword">const</span> <a class="code" href="classbadgerdb_1_1_file.html" title="Class which represents a file in the filesystem containing database pages.">File</a>&amp; other) <a name="l00066"></a>00066 : filename_(other.filename_), <a name="l00067"></a>00067 stream_(open_streams_[filename_]) { <a name="l00068"></a>00068 ++open_counts_[filename_]; <a name="l00069"></a>00069 } <a name="l00070"></a>00070 <a name="l00071"></a><a class="code" href="classbadgerdb_1_1_file.html#ac403c631aec085e9f12992f260a57155">00071</a> <a class="code" href="classbadgerdb_1_1_file.html" title="Class which represents a file in the filesystem containing database pages.">File</a>&amp; <a class="code" href="classbadgerdb_1_1_file.html#ac403c631aec085e9f12992f260a57155">File::operator=</a>(<span class="keyword">const</span> <a class="code" href="classbadgerdb_1_1_file.html" title="Class which represents a file in the filesystem containing database pages.">File</a>&amp; rhs) { <a name="l00072"></a>00072 <span class="comment">// This accounts for self-assignment and assignment of a File object for the</span> <a name="l00073"></a>00073 <span class="comment">// same file.</span> <a name="l00074"></a>00074 close(); <span class="comment">//close my file and associate me with the new one</span> <a name="l00075"></a>00075 filename_ = rhs.filename_; <a name="l00076"></a>00076 openIfNeeded(<span class="keyword">false</span> <span class="comment">/* create_new */</span>); <a name="l00077"></a>00077 <span class="keywordflow">return</span> *<span class="keyword">this</span>; <a name="l00078"></a>00078 } <a name="l00079"></a>00079 <a name="l00080"></a><a class="code" href="classbadgerdb_1_1_file.html#a97fd6e3ae8dd11be883289b69d560287">00080</a> <a class="code" href="classbadgerdb_1_1_file.html#a97fd6e3ae8dd11be883289b69d560287">File::~File</a>() { <a name="l00081"></a>00081 close(); <a name="l00082"></a>00082 } <a name="l00083"></a>00083 <a name="l00084"></a><a class="code" href="classbadgerdb_1_1_file.html#a7d0e047bcc8dc4cee36aac5b2060bbe3">00084</a> <a class="code" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a> <a class="code" href="classbadgerdb_1_1_file.html#a7d0e047bcc8dc4cee36aac5b2060bbe3">File::allocatePage</a>() { <a name="l00085"></a>00085 <a class="code" href="structbadgerdb_1_1_file_header.html" title="Header metadata for files on disk which contain pages.">FileHeader</a> header = readHeader(); <a name="l00086"></a>00086 <a class="code" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a> new_page; <a name="l00087"></a>00087 <a class="code" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a> existing_page; <a name="l00088"></a>00088 <span class="keywordflow">if</span> (header.<a class="code" href="structbadgerdb_1_1_file_header.html#a07ac20f98d6aced3eb5358e0d4830abc">num_free_pages</a> &gt; 0) { <a name="l00089"></a>00089 new_page = <a class="code" href="classbadgerdb_1_1_file.html#aba4762b533499b7b7cc0774192ead27c">readPage</a>(header.<a class="code" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">first_free_page</a>, <span class="keyword">true</span> <span class="comment">/* allow_free */</span>); <a name="l00090"></a>00090 new_page.set_page_number(header.<a class="code" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">first_free_page</a>); <a name="l00091"></a>00091 header.<a class="code" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">first_free_page</a> = new_page.<a class="code" href="classbadgerdb_1_1_page.html#a8050c219873e6b1d51aec2adbea8a507">next_page_number</a>(); <a name="l00092"></a>00092 --header.<a class="code" href="structbadgerdb_1_1_file_header.html#a07ac20f98d6aced3eb5358e0d4830abc">num_free_pages</a>; <a name="l00093"></a>00093 <a name="l00094"></a>00094 <span class="keywordflow">if</span> (header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a> == <a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a> || <a name="l00095"></a>00095 header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a> &gt; new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>()) { <a name="l00096"></a>00096 <span class="comment">// Either have no pages used or the head of the used list is a page later</span> <a name="l00097"></a>00097 <span class="comment">// than the one we just allocated, so add the new page to the head.</span> <a name="l00098"></a>00098 <span class="keywordflow">if</span> (header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a> &gt; new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>()) { <a name="l00099"></a>00099 new_page.set_next_page_number(header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a>); <a name="l00100"></a>00100 } <a name="l00101"></a>00101 header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a> = new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>(); <a name="l00102"></a>00102 } <span class="keywordflow">else</span> { <a name="l00103"></a>00103 <span class="comment">// New page is reused from somewhere after the beginning, so we need to</span> <a name="l00104"></a>00104 <span class="comment">// find where in the used list to insert it.</span> <a name="l00105"></a>00105 <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a" title="Identifier for a page in a file.">PageId</a> next_page_number = <a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a>; <a name="l00106"></a>00106 <span class="keywordflow">for</span> (<a class="code" href="classbadgerdb_1_1_file_iterator.html" title="Iterator for iterating over the pages in a file.">FileIterator</a> iter = <a class="code" href="classbadgerdb_1_1_file.html#a32e94f392eb3740dd9eb9101b9e09d47">begin</a>(); iter != <a class="code" href="classbadgerdb_1_1_file.html#a01e224676a67634f21d53fc4189b8f11">end</a>(); ++iter) { <a name="l00107"></a>00107 next_page_number = (*iter).next_page_number(); <a name="l00108"></a>00108 <span class="keywordflow">if</span> (next_page_number &gt; new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>() || <a name="l00109"></a>00109 next_page_number == <a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a>) { <a name="l00110"></a>00110 existing_page = *iter; <a name="l00111"></a>00111 <span class="keywordflow">break</span>; <a name="l00112"></a>00112 } <a name="l00113"></a>00113 } <a name="l00114"></a>00114 existing_page.set_next_page_number(new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>()); <a name="l00115"></a>00115 new_page.set_next_page_number(next_page_number); <a name="l00116"></a>00116 } <a name="l00117"></a>00117 <a name="l00118"></a>00118 assert((header.<a class="code" href="structbadgerdb_1_1_file_header.html#a07ac20f98d6aced3eb5358e0d4830abc">num_free_pages</a> == 0) == <a name="l00119"></a>00119 (header.<a class="code" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">first_free_page</a> == <a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a>)); <a name="l00120"></a>00120 } <span class="keywordflow">else</span> { <a name="l00121"></a>00121 new_page.set_page_number(header.<a class="code" href="structbadgerdb_1_1_file_header.html#aa1cfc5220c6795868c8301cec298c8a6">num_pages</a>); <a name="l00122"></a>00122 <span class="keywordflow">if</span> (header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a> == <a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a>) { <a name="l00123"></a>00123 header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a> = new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>(); <a name="l00124"></a>00124 } <span class="keywordflow">else</span> { <a name="l00125"></a>00125 <span class="comment">// If we have pages allocated, we need to add the new page to the tail</span> <a name="l00126"></a>00126 <span class="comment">// of the linked list.</span> <a name="l00127"></a>00127 <span class="keywordflow">for</span> (<a class="code" href="classbadgerdb_1_1_file_iterator.html" title="Iterator for iterating over the pages in a file.">FileIterator</a> iter = <a class="code" href="classbadgerdb_1_1_file.html#a32e94f392eb3740dd9eb9101b9e09d47">begin</a>(); iter != <a class="code" href="classbadgerdb_1_1_file.html#a01e224676a67634f21d53fc4189b8f11">end</a>(); ++iter) { <a name="l00128"></a>00128 <span class="keywordflow">if</span> ((*iter).next_page_number() == <a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a>) { <a name="l00129"></a>00129 existing_page = *iter; <a name="l00130"></a>00130 <span class="keywordflow">break</span>; <a name="l00131"></a>00131 } <a name="l00132"></a>00132 } <a name="l00133"></a>00133 assert(existing_page.isUsed()); <a name="l00134"></a>00134 existing_page.set_next_page_number(new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>()); <a name="l00135"></a>00135 } <a name="l00136"></a>00136 ++header.<a class="code" href="structbadgerdb_1_1_file_header.html#aa1cfc5220c6795868c8301cec298c8a6">num_pages</a>; <a name="l00137"></a>00137 } <a name="l00138"></a>00138 <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">writePage</a>(new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>(), new_page); <a name="l00139"></a>00139 <span class="keywordflow">if</span> (existing_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>() != <a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a>) { <a name="l00140"></a>00140 <span class="comment">// If we updated an existing page by inserting the new page into the</span> <a name="l00141"></a>00141 <span class="comment">// used list, we need to write it out.</span> <a name="l00142"></a>00142 <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">writePage</a>(existing_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>(), existing_page); <a name="l00143"></a>00143 } <a name="l00144"></a>00144 writeHeader(header); <a name="l00145"></a>00145 <a name="l00146"></a>00146 <span class="keywordflow">return</span> new_page; <a name="l00147"></a>00147 } <a name="l00148"></a>00148 <a name="l00149"></a><a class="code" href="classbadgerdb_1_1_file.html#aba4762b533499b7b7cc0774192ead27c">00149</a> <a class="code" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a> <a class="code" href="classbadgerdb_1_1_file.html#aba4762b533499b7b7cc0774192ead27c">File::readPage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a" title="Identifier for a page in a file.">PageId</a> page_number)<span class="keyword"> const </span>{ <a name="l00150"></a>00150 <a class="code" href="structbadgerdb_1_1_file_header.html" title="Header metadata for files on disk which contain pages.">FileHeader</a> header = readHeader(); <a name="l00151"></a>00151 <span class="keywordflow">if</span> (page_number &gt;= header.<a class="code" href="structbadgerdb_1_1_file_header.html#aa1cfc5220c6795868c8301cec298c8a6">num_pages</a>) { <a name="l00152"></a>00152 <span class="keywordflow">throw</span> <a class="code" href="classbadgerdb_1_1_invalid_page_exception.html" title="An exception that is thrown when an attempt is made to access an invalid page in a file...">InvalidPageException</a>(page_number, filename_); <a name="l00153"></a>00153 } <a name="l00154"></a>00154 <span class="keywordflow">return</span> <a class="code" href="classbadgerdb_1_1_file.html#aba4762b533499b7b7cc0774192ead27c">readPage</a>(page_number, <span class="keyword">false</span> <span class="comment">/* allow_free */</span>); <a name="l00155"></a>00155 } <a name="l00156"></a>00156 <a name="l00157"></a>00157 <a class="code" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a> <a class="code" href="classbadgerdb_1_1_file.html#aba4762b533499b7b7cc0774192ead27c">File::readPage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a" title="Identifier for a page in a file.">PageId</a> page_number, <span class="keyword">const</span> <span class="keywordtype">bool</span> allow_free)<span class="keyword"> const </span>{ <a name="l00158"></a>00158 <a class="code" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a> page; <a name="l00159"></a>00159 stream_-&gt;seekg(pagePosition(page_number), std::ios::beg); <a name="l00160"></a>00160 stream_-&gt;read(reinterpret_cast&lt;char*&gt;(&amp;page.header_), <span class="keyword">sizeof</span>(page.header_)); <a name="l00161"></a>00161 stream_-&gt;read(reinterpret_cast&lt;char*&gt;(&amp;page.data_[0]), <a class="code" href="classbadgerdb_1_1_page.html#a74057ec71412352ef0aa5913bbebed25">Page::DATA_SIZE</a>); <a name="l00162"></a>00162 <span class="keywordflow">if</span> (!allow_free &amp;&amp; !page.isUsed()) { <a name="l00163"></a>00163 <span class="keywordflow">throw</span> <a class="code" href="classbadgerdb_1_1_invalid_page_exception.html" title="An exception that is thrown when an attempt is made to access an invalid page in a file...">InvalidPageException</a>(page_number, filename_); <a name="l00164"></a>00164 } <a name="l00165"></a>00165 <a name="l00166"></a>00166 <span class="keywordflow">return</span> page; <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00169"></a><a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">00169</a> <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">File::writePage</a>(<span class="keyword">const</span> <a class="code" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a>&amp; new_page) { <a name="l00170"></a>00170 <a class="code" href="structbadgerdb_1_1_page_header.html" title="Header metadata in a page.">PageHeader</a> header = readPageHeader(new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>()); <a name="l00171"></a>00171 <span class="keywordflow">if</span> (header.<a class="code" href="structbadgerdb_1_1_page_header.html#a3f721c5ce9ef491fdc9d12292f2f4498">current_page_number</a> == <a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a>) { <a name="l00172"></a>00172 <span class="comment">// Page has been deleted since it was read.</span> <a name="l00173"></a>00173 <span class="keywordflow">throw</span> <a class="code" href="classbadgerdb_1_1_invalid_page_exception.html" title="An exception that is thrown when an attempt is made to access an invalid page in a file...">InvalidPageException</a>(new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>(), filename_); <a name="l00174"></a>00174 } <a name="l00175"></a>00175 <span class="comment">// Page on disk may have had its next page pointer updated since it was read;</span> <a name="l00176"></a>00176 <span class="comment">// we don&#39;t modify that, but we do keep all the other modifications to the</span> <a name="l00177"></a>00177 <span class="comment">// page header.</span> <a name="l00178"></a>00178 <span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a" title="Identifier for a page in a file.">PageId</a> next_page_number = header.<a class="code" href="structbadgerdb_1_1_page_header.html#a7cb8260dedb0748d3d75c4b1722dcf3c">next_page_number</a>; <a name="l00179"></a>00179 header = new_page.header_; <a name="l00180"></a>00180 header.<a class="code" href="structbadgerdb_1_1_page_header.html#a7cb8260dedb0748d3d75c4b1722dcf3c">next_page_number</a> = next_page_number; <a name="l00181"></a>00181 <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">writePage</a>(new_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>(), header, new_page); <a name="l00182"></a>00182 } <a name="l00183"></a>00183 <a name="l00184"></a><a class="code" href="classbadgerdb_1_1_file.html#a829a68ccfbeb0c9f66f3a2db7e0b99fe">00184</a> <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a829a68ccfbeb0c9f66f3a2db7e0b99fe">File::deletePage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a" title="Identifier for a page in a file.">PageId</a> page_number) { <a name="l00185"></a>00185 <a class="code" href="structbadgerdb_1_1_file_header.html" title="Header metadata for files on disk which contain pages.">FileHeader</a> header = readHeader(); <a name="l00186"></a>00186 <a class="code" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a> existing_page = <a class="code" href="classbadgerdb_1_1_file.html#aba4762b533499b7b7cc0774192ead27c">readPage</a>(page_number); <a name="l00187"></a>00187 <a class="code" href="classbadgerdb_1_1_page.html" title="Class which represents a fixed-size database page containing records.">Page</a> previous_page; <a name="l00188"></a>00188 <span class="comment">// If this page is the head of the used list, update the header to point to</span> <a name="l00189"></a>00189 <span class="comment">// the next page in line.</span> <a name="l00190"></a>00190 <span class="keywordflow">if</span> (page_number == header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a>) { <a name="l00191"></a>00191 header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a> = existing_page.<a class="code" href="classbadgerdb_1_1_page.html#a8050c219873e6b1d51aec2adbea8a507">next_page_number</a>(); <a name="l00192"></a>00192 } <span class="keywordflow">else</span> { <a name="l00193"></a>00193 <span class="comment">// Walk the used list so we can update the page that points to this one.</span> <a name="l00194"></a>00194 <span class="keywordflow">for</span> (<a class="code" href="classbadgerdb_1_1_file_iterator.html" title="Iterator for iterating over the pages in a file.">FileIterator</a> iter = <a class="code" href="classbadgerdb_1_1_file.html#a32e94f392eb3740dd9eb9101b9e09d47">begin</a>(); iter != <a class="code" href="classbadgerdb_1_1_file.html#a01e224676a67634f21d53fc4189b8f11">end</a>(); ++iter) { <a name="l00195"></a>00195 previous_page = *iter; <a name="l00196"></a>00196 <span class="keywordflow">if</span> (previous_page.<a class="code" href="classbadgerdb_1_1_page.html#a8050c219873e6b1d51aec2adbea8a507">next_page_number</a>() == existing_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>()) { <a name="l00197"></a>00197 previous_page.set_next_page_number(existing_page.<a class="code" href="classbadgerdb_1_1_page.html#a8050c219873e6b1d51aec2adbea8a507">next_page_number</a>()); <a name="l00198"></a>00198 <span class="keywordflow">break</span>; <a name="l00199"></a>00199 } <a name="l00200"></a>00200 } <a name="l00201"></a>00201 } <a name="l00202"></a>00202 <span class="comment">// Clear the page and add it to the head of the free list.</span> <a name="l00203"></a>00203 existing_page.initialize(); <a name="l00204"></a>00204 existing_page.set_next_page_number(header.<a class="code" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">first_free_page</a>); <a name="l00205"></a>00205 header.<a class="code" href="structbadgerdb_1_1_file_header.html#aa86917d8554a42318c795471f32ad006">first_free_page</a> = page_number; <a name="l00206"></a>00206 ++header.<a class="code" href="structbadgerdb_1_1_file_header.html#a07ac20f98d6aced3eb5358e0d4830abc">num_free_pages</a>; <a name="l00207"></a>00207 <span class="keywordflow">if</span> (previous_page.isUsed()) { <a name="l00208"></a>00208 <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">writePage</a>(previous_page.<a class="code" href="classbadgerdb_1_1_page.html#af55a0b44876bff4d513bdbed8bc8c5a3">page_number</a>(), previous_page); <a name="l00209"></a>00209 } <a name="l00210"></a>00210 <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">writePage</a>(page_number, existing_page); <a name="l00211"></a>00211 writeHeader(header); <a name="l00212"></a>00212 } <a name="l00213"></a>00213 <a name="l00214"></a><a class="code" href="classbadgerdb_1_1_file.html#a32e94f392eb3740dd9eb9101b9e09d47">00214</a> <a class="code" href="classbadgerdb_1_1_file_iterator.html" title="Iterator for iterating over the pages in a file.">FileIterator</a> <a class="code" href="classbadgerdb_1_1_file.html#a32e94f392eb3740dd9eb9101b9e09d47">File::begin</a>() { <a name="l00215"></a>00215 <span class="keyword">const</span> <a class="code" href="structbadgerdb_1_1_file_header.html" title="Header metadata for files on disk which contain pages.">FileHeader</a>&amp; header = readHeader(); <a name="l00216"></a>00216 <span class="keywordflow">return</span> <a class="code" href="classbadgerdb_1_1_file_iterator.html" title="Iterator for iterating over the pages in a file.">FileIterator</a>(<span class="keyword">this</span>, header.<a class="code" href="structbadgerdb_1_1_file_header.html#ad006b5b9d02b8c20e7ad5226680779c6">first_used_page</a>); <a name="l00217"></a>00217 } <a name="l00218"></a>00218 <a name="l00219"></a><a class="code" href="classbadgerdb_1_1_file.html#a01e224676a67634f21d53fc4189b8f11">00219</a> <a class="code" href="classbadgerdb_1_1_file_iterator.html" title="Iterator for iterating over the pages in a file.">FileIterator</a> <a class="code" href="classbadgerdb_1_1_file.html#a01e224676a67634f21d53fc4189b8f11">File::end</a>() { <a name="l00220"></a>00220 <span class="keywordflow">return</span> <a class="code" href="classbadgerdb_1_1_file_iterator.html" title="Iterator for iterating over the pages in a file.">FileIterator</a>(<span class="keyword">this</span>, <a class="code" href="classbadgerdb_1_1_page.html#a785a1e756d47fb7f8f3603a3fe8ffcef">Page::INVALID_NUMBER</a>); <a name="l00221"></a>00221 } <a name="l00222"></a>00222 <a name="l00223"></a>00223 <a class="code" href="classbadgerdb_1_1_file.html#a600baaf77d18f39e51ae7473eca633c4">File::File</a>(<span class="keyword">const</span> std::string&amp; name, <span class="keyword">const</span> <span class="keywordtype">bool</span> create_new) : filename_(name) { <a name="l00224"></a>00224 openIfNeeded(create_new); <a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="keywordflow">if</span> (create_new) { <a name="l00227"></a>00227 <span class="comment">// File starts with 1 page (the header).</span> <a name="l00228"></a>00228 <a class="code" href="structbadgerdb_1_1_file_header.html" title="Header metadata for files on disk which contain pages.">FileHeader</a> header = {1 <span class="comment">/* num_pages */</span>, 0 <span class="comment">/* first_used_page */</span>, <a name="l00229"></a>00229 0 <span class="comment">/* num_free_pages */</span>, 0 <span class="comment">/* first_free_page */</span>}; <a name="l00230"></a>00230 writeHeader(header); <a name="l00231"></a>00231 } <a name="l00232"></a>00232 } <a name="l00233"></a>00233 <a name="l00234"></a>00234 <span class="keywordtype">void</span> File::openIfNeeded(<span class="keyword">const</span> <span class="keywordtype">bool</span> create_new) { <a name="l00235"></a>00235 <span class="keywordflow">if</span> (open_counts_.find(filename_) != open_counts_.end()) { <span class="comment">//exists an entry already</span> <a name="l00236"></a>00236 ++open_counts_[filename_]; <a name="l00237"></a>00237 stream_ = open_streams_[filename_]; <a name="l00238"></a>00238 } <span class="keywordflow">else</span> { <a name="l00239"></a>00239 std::ios_base::openmode mode = <a name="l00240"></a>00240 std::fstream::in | std::fstream::out | std::fstream::binary; <a name="l00241"></a>00241 <span class="keyword">const</span> <span class="keywordtype">bool</span> already_exists = <a class="code" href="classbadgerdb_1_1_file.html#a864d59b12302c26b14967bd1d3e520bd">exists</a>(filename_); <a name="l00242"></a>00242 <span class="keywordflow">if</span> (create_new) { <a name="l00243"></a>00243 <span class="comment">// Error if we try to overwrite an existing file.</span> <a name="l00244"></a>00244 <span class="keywordflow">if</span> (already_exists) { <a name="l00245"></a>00245 <span class="keywordflow">throw</span> FileExistsException(filename_); <a name="l00246"></a>00246 } <a name="l00247"></a>00247 <span class="comment">// New files have to be truncated on open.</span> <a name="l00248"></a>00248 mode = mode | std::fstream::trunc; <a name="l00249"></a>00249 } <span class="keywordflow">else</span> { <a name="l00250"></a>00250 <span class="comment">// Error if we try to open a file that doesn&#39;t exist.</span> <a name="l00251"></a>00251 <span class="keywordflow">if</span> (!already_exists) { <a name="l00252"></a>00252 <span class="keywordflow">throw</span> FileNotFoundException(filename_); <a name="l00253"></a>00253 } <a name="l00254"></a>00254 } <a name="l00255"></a>00255 stream_.reset(<span class="keyword">new</span> std::fstream(filename_, mode)); <a name="l00256"></a>00256 open_streams_[filename_] = stream_; <a name="l00257"></a>00257 open_counts_[filename_] = 1; <a name="l00258"></a>00258 } <a name="l00259"></a>00259 } <a name="l00260"></a>00260 <a name="l00261"></a>00261 <span class="keywordtype">void</span> File::close() { <a name="l00262"></a>00262 --open_counts_[filename_]; <a name="l00263"></a>00263 stream_.reset(); <a name="l00264"></a>00264 <span class="keywordflow">if</span> (open_counts_[filename_] == 0) { <a name="l00265"></a>00265 open_streams_.erase(filename_); <a name="l00266"></a>00266 open_counts_.erase(filename_); <a name="l00267"></a>00267 } <a name="l00268"></a>00268 } <a name="l00269"></a>00269 <a name="l00270"></a>00270 <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">File::writePage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a" title="Identifier for a page in a file.">PageId</a> page_number, <span class="keyword">const</span> Page&amp; new_page) { <a name="l00271"></a>00271 <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">writePage</a>(page_number, new_page.header_, new_page); <a name="l00272"></a>00272 } <a name="l00273"></a>00273 <a name="l00274"></a>00274 <span class="keywordtype">void</span> <a class="code" href="classbadgerdb_1_1_file.html#a9a1b3cc43c4631bde58c1c4f670e1036">File::writePage</a>(<span class="keyword">const</span> <a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a" title="Identifier for a page in a file.">PageId</a> page_number, <span class="keyword">const</span> PageHeader&amp; header, <a name="l00275"></a>00275 <span class="keyword">const</span> Page&amp; new_page) { <a name="l00276"></a>00276 stream_-&gt;seekp(pagePosition(page_number), std::ios::beg); <a name="l00277"></a>00277 stream_-&gt;write(reinterpret_cast&lt;const char*&gt;(&amp;header), <span class="keyword">sizeof</span>(header)); <a name="l00278"></a>00278 stream_-&gt;write(reinterpret_cast&lt;const char*&gt;(&amp;new_page.data_[0]), <a name="l00279"></a>00279 <a class="code" href="classbadgerdb_1_1_page.html#a74057ec71412352ef0aa5913bbebed25">Page::DATA_SIZE</a>); <a name="l00280"></a>00280 stream_-&gt;flush(); <a name="l00281"></a>00281 } <a name="l00282"></a>00282 <a name="l00283"></a>00283 FileHeader File::readHeader()<span class="keyword"> const </span>{ <a name="l00284"></a>00284 FileHeader header; <a name="l00285"></a>00285 stream_-&gt;seekg(0 <span class="comment">/* pos */</span>, std::ios::beg); <a name="l00286"></a>00286 stream_-&gt;read(reinterpret_cast&lt;char*&gt;(&amp;header), <span class="keyword">sizeof</span>(header)); <a name="l00287"></a>00287 <a name="l00288"></a>00288 <span class="keywordflow">return</span> header; <a name="l00289"></a>00289 } <a name="l00290"></a>00290 <a name="l00291"></a>00291 <span class="keywordtype">void</span> File::writeHeader(<span class="keyword">const</span> FileHeader&amp; header) { <a name="l00292"></a>00292 stream_-&gt;seekp(0 <span class="comment">/* pos */</span>, std::ios::beg); <a name="l00293"></a>00293 stream_-&gt;write(reinterpret_cast&lt;const char*&gt;(&amp;header), <span class="keyword">sizeof</span>(header)); <a name="l00294"></a>00294 stream_-&gt;flush(); <a name="l00295"></a>00295 } <a name="l00296"></a>00296 <a name="l00297"></a>00297 PageHeader File::readPageHeader(<a class="code" href="namespacebadgerdb.html#a1f49e404293bf4240756b89b53b1587a" title="Identifier for a page in a file.">PageId</a> page_number)<span class="keyword"> const </span>{ <a name="l00298"></a>00298 PageHeader header; <a name="l00299"></a>00299 stream_-&gt;seekg(pagePosition(page_number), std::ios::beg); <a name="l00300"></a>00300 stream_-&gt;read(reinterpret_cast&lt;char*&gt;(&amp;header), <span class="keyword">sizeof</span>(header)); <a name="l00301"></a>00301 <a name="l00302"></a>00302 <span class="keywordflow">return</span> header; <a name="l00303"></a>00303 } <a name="l00304"></a>00304 <a name="l00305"></a>00305 } </pre></div></div><!-- contents --> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Friends</a></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> <hr class="footer"/><address class="footer"><small> Generated on Wed Jan 30 2013 14:17:52 for BadgerDB by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.7.6.1 </small></address> </body> </html>
105.093596
962
0.723095
8dc220e6ba2c05c3089bdf86cada15d3bfdd0bc2
190
js
JavaScript
src/components/email-popup/email-popup.stories.js
benjamingrobertson/remotefrontend
905a508631b1e286b65f7668bf8f011c81b4bca7
[ "MIT" ]
16
2018-07-24T19:06:31.000Z
2019-11-16T16:09:19.000Z
src/components/email-popup/email-popup.stories.js
benjamingrobertson/remotefrontend
905a508631b1e286b65f7668bf8f011c81b4bca7
[ "MIT" ]
17
2021-05-05T17:45:04.000Z
2022-02-12T05:04:37.000Z
src/components/email-popup/email-popup.stories.js
benrobertsonio/remotefrontend
905a508631b1e286b65f7668bf8f011c81b4bca7
[ "MIT" ]
5
2020-01-23T10:36:24.000Z
2020-10-23T06:36:54.000Z
import React from 'react'; import { storiesOf } from '@storybook/react'; import EmailPopup from './email-popup'; storiesOf('Email Popup', module).add('default', () => <EmailPopup open />);
31.666667
75
0.694737
815da0f8e7d3b9eac41fbebc1c10235a5db3fd23
7,500
php
PHP
app/Views/modal/ranting backup.php
oets-man/iass-bkl
94f0893a739106b7127766a1941a925764f839ee
[ "MIT" ]
null
null
null
app/Views/modal/ranting backup.php
oets-man/iass-bkl
94f0893a739106b7127766a1941a925764f839ee
[ "MIT" ]
null
null
null
app/Views/modal/ranting backup.php
oets-man/iass-bkl
94f0893a739106b7127766a1941a925764f839ee
[ "MIT" ]
null
null
null
<?php echo $this->extend('layout/template'); ?> <?php echo $this->section('content'); ?> <!-- Modal --> <script> $(document).ready(function() { $("#modalRanting").modal('show'); }); </script> <div class="modal fade" data-backdrop="static" id="modalRanting" tabindex="-1" role="dialog" aria-labelledby="modalRantingLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5>List Ranting</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-header form-group row my-0"> <label for="komisariat" class="col-sm-3 col-form-label text-primary font-weight-bold">Komisariat:</label> <div class="col-sm-9"> <select class="form-control" id="komisariat"> <option value="">Pilih Komisariat ...</option> <?php foreach ($komisariat as $key => $value) : ?> <option value="<?= $value->id; ?>"><?= $value->id; ?></option> <?php endforeach; ?> </select> </div> </div> <div class="modal-body"> <?= form_open('komisariat/insertRanting', ['class' => 'formInsertRanting']); ?> <table class="table"> <thead> <tr> <th>No</th> <th>Ranting</th> <th class="text-center"><i class="fas fa-trash"></i></th> </tr> </thead> <tbody id="listranting"> <tr> <td></td> <td class="text-info">Silakan tentukan komisariat...</td> <td></td> </tr> </tbody> <tbody class="form-add" style="display: none;"> </tbody> <tbody class="" style="display: none;"> <tr> <td colspan="3" class="text-right"> <button type="button" class="btn btn-danger btn-sm btn-add me-2" data-dismiss="modal">Tutup</button> <button type="button" class="btn btn-success btn-sm btn-add me-2">Tambah</button> <button type="submit" class="btn btn-primary btn-sm btn-ins">Simpan</button> </td> </tr> </tbody> </table> <?= form_close(); ?> </div> </div> </div> </div> <script type="text/javascript"> $(document).ready(function() { $('#komisariat').change(function() { var komisariat = $(this).val(); if (komisariat != '') { $('tbody').show(); $.ajax({ url: "<?= base_url('komisariat/getRanting') ?>", method: 'POST', data: { komisariat: komisariat, }, dataType: "JSON", success: function(data) { if (data.length > 0) { var html = ''; var i = 1; data.forEach(data => { // console.log(data.ranting); html += ` <tr> <td>` + i++ + `</td> <td>` + data.ranting + `</td> <td class='text-center'> <a class="text-danger" href="<?= site_url('komisariat/rantingdelete/'); ?>` + data.id + `"><i class="fas fa-trash"></a></i> </td> </tr>` }); } else { var html = ` <tr> <td></td> <td>Belum ada data. Silakan klik tambah!</td> <td></td> </tr>`; } $('#listranting').html(html); // console.log(data); }, error: function(xhr, thrownError) { alert(xhr.status + "\n" + xhr.responseText + "\n" + thrownError) } }); } else { $('tbody').hide(); } }); }); $(document).ready(function(e) { $('.btn-add').click(function(e) { var komisariat = $('#komisariat').val(); e.preventDefault(); $('.form-add').append(` <tr> <td id=""> <input type="text" name="komisariat[]" class="form-control-plaintext" value="` + komisariat + `" readonly> </td> <td id=""> <input type="text" name="ranting[]" class="form-control" placeholder="Masukkan ranting baru, lalu klik simpan!"> </td> <td class="text-danger text-center"> <button type="button" class="btn btn-danger btn-sm btn-del"><i class="fa fa-minus"></i></button> </td> </tr> `) }); //simpan/insert $('.formInsertRanting').submit(function(e) { e.preventDefault(); $.ajax({ type: "post", url: $(this).attr('action'), data: $(this).serialize(), dataType: "json", beforeSend: function() { $('.btn-ins').attr('disable', 'disabled'); $('.btn-ins').html('<i class="fa fa-spin fa-spinner"></i>'); }, complete: function() { $('.btn-ins').removeAttr('disable'); $('.btn-ins').html('Simpan'); }, success: function(response) { if (response == true) { alert("Data berhasil ditambahkan!"); // window.location.href = "<?= site_url('komisariat/ranting') ?>"; location.reload(); } else { alert("Tidak ada data yang ditambahkan!"); } }, // error: function(xhr, thrownError) { // alert(xhr.status + "\n" + xhr.responseText + "\n" + thrownError) // } }); return false; }); }); $(document).on('click', '.btn-del', function(e) { $(this).parents('tr').remove(); }); $('#modalRanting').on('hidden.bs.modal', function() { // window.alert('hidden event fired!'); parent.history.back(); return false; }); </script> <?php echo $this->endSection(); ?>
39.0625
163
0.375467
451797082b49b712bfd105311df289079b0b9cfa
4,429
swift
Swift
native_library/apple/WebViewANE/WebViewANE/SwiftController+FreSwift.swift
ylazy/WebViewANE
f37a1c439d0c0ce09601c12ac003b7b0e9ce1398
[ "Apache-2.0", "BSD-3-Clause" ]
199
2017-01-07T06:49:35.000Z
2022-02-17T10:59:01.000Z
native_library/apple/WebViewANE/WebViewANE/SwiftController+FreSwift.swift
ylazy/WebViewANE
f37a1c439d0c0ce09601c12ac003b7b0e9ce1398
[ "Apache-2.0", "BSD-3-Clause" ]
232
2017-01-13T02:09:19.000Z
2022-03-12T21:05:58.000Z
native_library/apple/WebViewANE/WebViewANE/SwiftController+FreSwift.swift
ylazy/WebViewANE
f37a1c439d0c0ce09601c12ac003b7b0e9ce1398
[ "Apache-2.0", "BSD-3-Clause" ]
54
2017-01-13T00:33:52.000Z
2022-03-07T01:44:40.000Z
// Copyright 2018 Tua Rua Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Additional Terms // No part, or derivative of this Air Native Extensions's code is permitted // to be sold as the basis of a commercially packaged Air Native Extension which // undertakes the same purpose as this software. That is, a WebView for Windows, // OSX and/or iOS and/or Android. // All Rights Reserved. Tua Rua Ltd. import Foundation import FreSwift extension SwiftController: FreSwiftMainController { // must have this function !! // Make sure these funcs match those in WebViewANE.m @objc public func getFunctions(prefix: String) -> [String] { functionsToSet["\(prefix)reload"] = reload functionsToSet["\(prefix)load"] = load functionsToSet["\(prefix)init"] = initController functionsToSet["\(prefix)clearCache"] = clearCache functionsToSet["\(prefix)isSupported"] = isSupported functionsToSet["\(prefix)setVisible"] = setVisible functionsToSet["\(prefix)loadHTMLString"] = loadHTMLString functionsToSet["\(prefix)loadFileURL"] = loadFileURL functionsToSet["\(prefix)clearRequestHeaders"] = clearRequestHeaders functionsToSet["\(prefix)onFullScreen"] = onFullScreen functionsToSet["\(prefix)reloadFromOrigin"] = reloadFromOrigin functionsToSet["\(prefix)stopLoading"] = stopLoading functionsToSet["\(prefix)backForwardList"] = backForwardList functionsToSet["\(prefix)go"] = go functionsToSet["\(prefix)goBack"] = goBack functionsToSet["\(prefix)goForward"] = goForward functionsToSet["\(prefix)allowsMagnification"] = allowsMagnification functionsToSet["\(prefix)zoomIn"] = zoomIn functionsToSet["\(prefix)zoomOut"] = zoomOut functionsToSet["\(prefix)setViewPort"] = setViewPort functionsToSet["\(prefix)showDevTools"] = showDevTools functionsToSet["\(prefix)closeDevTools"] = closeDevTools functionsToSet["\(prefix)callJavascriptFunction"] = callJavascriptFunction functionsToSet["\(prefix)evaluateJavaScript"] = evaluateJavaScript functionsToSet["\(prefix)injectScript"] = injectScript functionsToSet["\(prefix)focus"] = focusWebView functionsToSet["\(prefix)print"] = print functionsToSet["\(prefix)printToPdf"] = printToPdf functionsToSet["\(prefix)capture"] = capture functionsToSet["\(prefix)getCapturedBitmapData"] = getCapturedBitmapData functionsToSet["\(prefix)addTab"] = addTab functionsToSet["\(prefix)closeTab"] = closeTab functionsToSet["\(prefix)setCurrentTab"] = setCurrentTab functionsToSet["\(prefix)getCurrentTab"] = getCurrentTab functionsToSet["\(prefix)getTabDetails"] = getTabDetails functionsToSet["\(prefix)shutDown"] = shutDown functionsToSet["\(prefix)addEventListener"] = addEventListener functionsToSet["\(prefix)removeEventListener"] = removeEventListener functionsToSet["\(prefix)getOsVersion"] = getOsVersion functionsToSet["\(prefix)deleteCookies"] = deleteCookies var arr: [String] = [] for key in functionsToSet.keys { arr.append(key) } return arr } @objc public func dispose() { } // Must have this function. It exposes the methods to our entry ObjC. @objc public func callSwiftFunction(name: String, ctx: FREContext, argc: FREArgc, argv: FREArgv) -> FREObject? { if let fm = functionsToSet[name] { return fm(ctx, argc, argv) } return nil } @objc public func setFREContext(ctx: FREContext) { self.context = FreContextSwift.init(freContext: ctx) // Turn on FreSwift logging FreSwiftLogger.shared.context = context } @objc public func onLoad() { } }
44.29
116
0.680063
0f75355b64c1ff40496a599aa388a810400b7515
3,996
lua
Lua
spec/lua/tracebundler/doc.lua
notomo/tracebundler.nvim
64e212dceee49c30ad3e5aff35f8b00c976ba6ee
[ "MIT" ]
3
2022-02-07T18:55:18.000Z
2022-02-16T08:55:57.000Z
spec/lua/tracebundler/doc.lua
notomo/tracebundler.nvim
64e212dceee49c30ad3e5aff35f8b00c976ba6ee
[ "MIT" ]
null
null
null
spec/lua/tracebundler/doc.lua
notomo/tracebundler.nvim
64e212dceee49c30ad3e5aff35f8b00c976ba6ee
[ "MIT" ]
null
null
null
local util = require("genvdoc.util") local plugin_name = vim.env.PLUGIN_NAME local full_plugin_name = plugin_name .. ".nvim" local example_path = ("./spec/lua/%s/example.lua"):format(plugin_name) vim.o.runtimepath = vim.fn.getcwd() .. "," .. vim.o.runtimepath dofile(example_path) local example_lines = vim.api.nvim_buf_get_lines(0, 0, -1, false) local example_f, err = loadstring(table.concat(example_lines, "\n")) if err then error(err) end example_f() local example_result = table.concat(example_lines, "\n") require("genvdoc").generate(full_plugin_name, { chapters = { { name = function(group) return "Lua module: " .. group end, group = function(node) if not node.declaration then return nil end return node.declaration.module end, }, { name = "TYPES", body = function(ctx) local opts_text do local descriptions = { trace = [[(table): |tracebundler.nvim-trace-opts|]], bundle = [[(table): |tracebundler.nvim-bundle-opts|]], } local default = require("tracebundler.core.option").default local keys = vim.tbl_keys(default) local lines = util.each_keys_description(keys, descriptions, default) opts_text = table.concat(lines, "\n") end local trace_opts_text do local descriptions = { path_filter = [[(function): if return true, the chunk includes the file. default: `function(file_path) return true end`]], callback = [[(function): called after every trace. default: `function(traces) end`]], } local default = require("tracebundler.core.option").default.trace local keys = vim.tbl_keys(default) local lines = util.each_keys_description(keys, descriptions, default) trace_opts_text = table.concat(lines, "\n") end local bundle_opts_text do local descriptions = { enabled_file_loader = [[(boolean): if true, chunk supports dofile, loadfile. default: %s]], traced_marker = [[(string): if not empty, adds to traced line as comment. default: %s]], return_table = [[(boolean): if true, chunk returns {modules = {modules}, execute = {f}}, if false, chunk returns {f}(). default: %s]], } local default = require("tracebundler.core.option").default.bundle local keys = vim.tbl_keys(default) local lines = util.each_keys_description(keys, descriptions, default) bundle_opts_text = table.concat(lines, "\n") end local chunk_text = [[ - Bundled functions are not called if `require()` is called by Ex command. - Bundled `require()` is not influenced by `package.loaded[key] = nil`.]] return util.sections(ctx, { { name = "options", tag_name = "opts", text = opts_text }, { name = "bundle options", tag_name = "bundle-opts", text = bundle_opts_text }, { name = "trace options", tag_name = "trace-opts", text = trace_opts_text }, { name = "chunk limitation", tag_name = "chunk-limitation", text = chunk_text }, }) end, }, { name = "EXAMPLES", body = function() local f = io.open(example_path, "r") local content = f:read("*a") f:close() return ([[ %s The following is the bundled chunk. %s]]):format(util.help_code_block(vim.fn.trim(content, 2)), util.help_code_block(example_result)) end, }, }, }) local gen_readme = function() local f = io.open(example_path, "r") local exmaple = f:read("*a") f:close() local content = ([[ # %s bundles executed files as one lua chunk for debugging. ## Example ```lua %s``` ### Bundled chunk ```lua %s ```]]):format(full_plugin_name, exmaple, example_result) local readme = io.open("README.md", "w") readme:write(content) readme:close() end gen_readme()
30.738462
100
0.60986
7970d09281b7a25047540647b2926f5b8146ef43
3,034
php
PHP
resources/views/auth/register.blade.php
ibnushevayanto/learn-laravel
14f81e6348fc9c9c7c8405dbbb76aa9da28bb406
[ "MIT" ]
1
2020-05-21T18:49:26.000Z
2020-05-21T18:49:26.000Z
resources/views/auth/register.blade.php
ibnushevayanto/laravel-news-app
14f81e6348fc9c9c7c8405dbbb76aa9da28bb406
[ "MIT" ]
5
2020-06-18T03:59:46.000Z
2022-02-27T05:14:41.000Z
resources/views/auth/register.blade.php
ibnushevayanto/laravel-news-app
14f81e6348fc9c9c7c8405dbbb76aa9da28bb406
[ "MIT" ]
null
null
null
@extends('Layout.default') @section('title', 'Register Account') @section('content') <div class="container mt-4"> <div class="row justify-content-md-center"> <div class="col-md-7"> <div class="bg-white p-3"> <h3 class="text-center">Registering Your Account</h3> <form method="POST" action="{{ route('register') }}" class="mt-4"> @csrf <div class="mb-3"> <input type="text" name="name" value="{{ old('name') }}" class="form-control {{ $errors->has('name') ? 'is-invalid' : '' }}" placeholder="Enter your name"> @if ($errors->has('name')) <span class="invalid-feedback"> {{ $errors->first('name') }} </span> @endif </div> <div class="mb-3"> <input type="email" name="email" value="{{ old('email') }}" class="form-control {{ $errors->has('email') ? 'is-invalid' : '' }}" placeholder="Enter your email"> @if ($errors->has('email')) <span class="invalid-feedback"> {{ $errors->first('email') }} </span> @endif </div> <div class="mb-3"> <div class="row"> <div class="col-md-6"> <input type="password" name="password" class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}" placeholder="Enter your password"> </div> <div class="col-md-6"> {{-- Jika Ingin Membuat Validasi Password Gunakan Kata Kata confirmation diakhir dari nama field yang ingin diberi konfirmasi --}} <input type="password" name="password_confirmation" class="form-control {{ $errors->has('password') ? 'is-invalid' : '' }}" placeholder="Confirm password"> </div> </div> @if ($errors->has('password')) <div> <small class="text-danger">{{ $errors->first('password') }}</small> </div> @endif </div> <button class="btn btn-block btn-outline-primary my-3">Register</button> <div class="text-center">Sudah punya akun? Silahkan login <a href="{{ route('login') }}">disini</a> </div> </form> </div> </div> </div> </div> @endsection
48.15873
162
0.389914
884f155c9ada4b9ce1fed37cf7e91868d6d0e0a8
135
cs
C#
src/Kernel/Contracts/Terra/BPsiTerraTransactionMessage.cs
pylonboard/dotnet-pylonboard-monolith
9c64bcace110f4e6a1f88b149afa6d6a1ab0338d
[ "MIT" ]
null
null
null
src/Kernel/Contracts/Terra/BPsiTerraTransactionMessage.cs
pylonboard/dotnet-pylonboard-monolith
9c64bcace110f4e6a1f88b149afa6d6a1ab0338d
[ "MIT" ]
2
2022-02-21T19:57:45.000Z
2022-02-23T10:30:37.000Z
src/Kernel/Contracts/Terra/BPsiTerraTransactionMessage.cs
pylonboard/dotnet-pylonboard-monolith
9c64bcace110f4e6a1f88b149afa6d6a1ab0338d
[ "MIT" ]
null
null
null
namespace Pylonboard.Kernel.Contracts.Terra; public record BPsiTerraTransactionMessage { public long TransactionId { get; set; } }
22.5
44
0.792593
12f29a89fbce45f40f49d239b3ed3adc7479265b
8,014
cs
C#
ConsensusCore.Domain/Services/StateMachine.cs
xucito/consensus-core
0526dda7acee5fc44f2de882c55e605da53d4e37
[ "MIT" ]
3
2020-06-11T06:41:06.000Z
2021-04-23T11:25:33.000Z
ConsensusCore.Domain/Services/StateMachine.cs
xucito/consensus-core
0526dda7acee5fc44f2de882c55e605da53d4e37
[ "MIT" ]
1
2019-08-02T20:24:06.000Z
2019-08-02T20:24:06.000Z
ConsensusCore.Domain/Services/StateMachine.cs
xucito/consensus-core
0526dda7acee5fc44f2de882c55e605da53d4e37
[ "MIT" ]
null
null
null
using ConsensusCore.Domain.BaseClasses; using ConsensusCore.Domain.Interfaces; using ConsensusCore.Domain.Models; using ConsensusCore.Domain.Utility; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace ConsensusCore.Domain.Services { /// <summary> /// /// </summary> /// <typeparam name="T">Logs used to playback the state of the cluster</typeparam> /// <typeparam name="Z">Object representating the current state of the cluster</typeparam> public class StateMachine<Z> : IStateMachine<Z> where Z : BaseState, new() { public Z DefaultState { get; set; } public Z CurrentState{ get; set; } public int CommitIndex { get; set; } public int CurrentTerm { get; set; } public Guid Id { get; set; } private ILogger _logger; private bool _disabledLogging = true; private object currentStateLock = new object(); public StateMachine(ILogger<StateMachine<Z>> logger) { DefaultState = new Z(); CurrentState = DefaultState; _logger = logger; _disabledLogging = false; } public StateMachine() { DefaultState = new Z(); CurrentState = DefaultState; } public void ApplyLogToStateMachine(LogEntry entry) { foreach (var command in entry.DeepCopy().Commands) { try { lock (currentStateLock) { CurrentState.ApplyCommand(command); } } catch (Exception e) { if(!_disabledLogging) _logger.LogDebug("Failed to apply entry with message: " + e.Message + Environment.NewLine + e.StackTrace); } } } public void ApplyLogsToStateMachine(IEnumerable<LogEntry> entries) { List<string> FailedLogs = new List<string>(); var copy = entries.OrderBy(c => c.Index).Select(e => e.DeepCopy()); foreach (var entry in copy) { foreach (var command in entry.Commands) { try { if (!_disabledLogging) _logger.LogDebug("Applying command " + Environment.NewLine + JsonConvert.SerializeObject(command, Formatting.Indented)); lock (currentStateLock) { CurrentState.ApplyCommand(command); } if (!_disabledLogging) _logger.LogDebug("State " + Environment.NewLine + JsonConvert.SerializeObject(CurrentState, Formatting.Indented)); } catch (Exception e) { if (!_disabledLogging) _logger.LogDebug("Failed to apply entry with message: " + e.Message + Environment.NewLine + e.StackTrace); } } } /*if(FailedLogs.Count() > 0) { throw new Exception("Failed to apply all commands successfully, the following logs failed to apply to state" + Environment.NewLine + JsonConvert.SerializeObject(FailedLogs)); }*/ } public void ApplySnapshotToStateMachine(Z state) { this.CurrentState = state; } public Z GetCurrentState() { return CurrentState; } public bool IndexExists(string type) { return CurrentState.Indexes.ContainsKey(type); } public ShardAllocationMetadata[] GetShards(string type = null) { if (type == null) { return CurrentState.Indexes.SelectMany(i => i.Value.Shards).ToArray(); } return CurrentState.Indexes[type].Shards.ToArray(); } public ShardAllocationMetadata[] GetShards(Guid nodeId) { return CurrentState.Indexes.SelectMany(i => i.Value.Shards.Where(n => n.InsyncAllocations.Contains(nodeId) || n.StaleAllocations.Contains(nodeId))).ToArray(); } public ShardAllocationMetadata GetShard(string type, Guid shardId) { return CurrentState.Indexes[type].Shards.Where(s => s.Id == shardId).FirstOrDefault(); } public List<ShardAllocationMetadata> GetAllPrimaryShards(Guid nodeId) { return CurrentState.Indexes.SelectMany(i => i.Value.Shards.Where(s => s.PrimaryAllocation == nodeId)).ToList(); } public NodeInformation GetNode(Guid nodeId) { var nodes = CurrentState.Nodes.Where(n => n.Key == nodeId); if (nodes.Count() == 0) { return null; } else { return nodes.First().Value; } } public NodeInformation[] GetNodes() { return CurrentState.Nodes.Values.ToArray(); } public NodeInformation GetNode(string transportAddresss) { var nodes = CurrentState.Nodes.Where(n => n.Value.TransportAddress == transportAddresss); if (nodes.Count() == 0) { return null; } else { return nodes.First().Value; } } /// <summary> /// Get all the primary shards for a given type /// Id, allocation /// </summary> /// <param name="type"></param> /// <returns></returns> public Dictionary<Guid, Guid> GetAllPrimaryShards(string type) { return CurrentState.Indexes[type].Shards.ToDictionary(k => k.Id, v => v.PrimaryAllocation); } public ShardAllocationMetadata GetShardMetadata(Guid shardId, string type) { return CurrentState.Indexes[type].Shards.Where(s => s.Id == shardId).FirstOrDefault(); } public bool IsNodeContactable(Guid nodeId) { if (CurrentState.Nodes.ContainsKey(nodeId)) { return CurrentState.Nodes[nodeId].IsContactable; } return false; } public bool IsNodeContactable(string transportUrl) { var foundNodes = CurrentState.Nodes.Where(n => n.Value.TransportAddress == transportUrl); if (foundNodes.Count() == 1) { return foundNodes.First().Value.IsContactable; } return false; } public bool IsLocked(string name) { return CurrentState.Locks.ContainsKey(name); } public bool IsLockObtained(string name, Guid lockId) { return CurrentState.Locks.ContainsKey(name) && CurrentState.Locks[name].LockId == lockId; } /// <summary> /// List of shard ids and types that are out of sync for the given node /// </summary> public IEnumerable<ShardAllocationMetadata> GetAllOutOfSyncShards(Guid nodeId) { return CurrentState.Indexes.SelectMany(i => i.Value.Shards.Where(s => s.StaleAllocations.Contains(nodeId))); } public BaseTask GetRunningTask(string uniqueId) { return CurrentState.GetRunningTask(uniqueId); } public ConcurrentDictionary<string, Lock> GetLocks() { return new ConcurrentDictionary<string, Lock>(CurrentState.Locks); } public void ApplySnapshotToStateMachine(BaseState state) { throw new NotImplementedException(); } } }
33.115702
190
0.54592
8ec0f7a4c7d3323da09e2db615532b687c06b0ad
1,402
rs
Rust
contracts/rust/donatewithfeedback/src/lib.rs
avlo/wasp
fcb0d398625df9cef6899e5789720cd00f995b7e
[ "BSD-2-Clause" ]
null
null
null
contracts/rust/donatewithfeedback/src/lib.rs
avlo/wasp
fcb0d398625df9cef6899e5789720cd00f995b7e
[ "BSD-2-Clause" ]
null
null
null
contracts/rust/donatewithfeedback/src/lib.rs
avlo/wasp
fcb0d398625df9cef6899e5789720cd00f995b7e
[ "BSD-2-Clause" ]
null
null
null
// Copyright 2020 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 // (Re-)generated by schema tool //////// DO NOT CHANGE THIS FILE! //////// // Change the json schema instead use donatewithfeedback::*; use schema::*; use wasmlib::*; mod donatewithfeedback; mod schema; mod types; #[no_mangle] fn on_load() { let exports = ScExports::new(); exports.add_func(FUNC_DONATE, func_donate_thunk); exports.add_func(FUNC_WITHDRAW, func_withdraw_thunk); exports.add_view(VIEW_DONATIONS, view_donations_thunk); } pub struct FuncDonateParams { pub feedback: ScImmutableString, // feedback for the person you donate to } fn func_donate_thunk(ctx: &ScFuncContext) { let p = ctx.params(); let params = FuncDonateParams { feedback: p.get_string(PARAM_FEEDBACK), }; func_donate(ctx, &params); } pub struct FuncWithdrawParams { pub amount: ScImmutableInt, // amount to withdraw } fn func_withdraw_thunk(ctx: &ScFuncContext) { // only SC creator can withdraw donated funds ctx.require(ctx.caller() == ctx.contract_creator(), "no permission"); let p = ctx.params(); let params = FuncWithdrawParams { amount: p.get_int(PARAM_AMOUNT), }; func_withdraw(ctx, &params); } pub struct ViewDonationsParams {} fn view_donations_thunk(ctx: &ScViewContext) { let params = ViewDonationsParams {}; view_donations(ctx, &params); }
24.596491
77
0.701141
e2e5e2657cd08bd936fea7d67556029c9477dddd
2,043
py
Python
mistral/db/sqlalchemy/migration/alembic_migrations/versions/037_add_namespace_column_to_action_definitions.py
shubhamdang/mistral
3c83837f6ce1e4ab74fb519a63e82eaae70f9d2d
[ "Apache-2.0" ]
205
2015-06-21T11:51:47.000Z
2022-03-05T04:00:04.000Z
mistral/db/sqlalchemy/migration/alembic_migrations/versions/037_add_namespace_column_to_action_definitions.py
shubhamdang/mistral
3c83837f6ce1e4ab74fb519a63e82eaae70f9d2d
[ "Apache-2.0" ]
8
2015-06-23T14:47:58.000Z
2021-01-28T06:06:44.000Z
mistral/db/sqlalchemy/migration/alembic_migrations/versions/037_add_namespace_column_to_action_definitions.py
shubhamdang/mistral
3c83837f6ce1e4ab74fb519a63e82eaae70f9d2d
[ "Apache-2.0" ]
110
2015-06-14T03:34:38.000Z
2021-11-11T12:12:56.000Z
# Copyright 2020 Nokia Software. # # 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. """add namespace column to action definitions Revision ID: 037 Revises: 036 Create Date: 2020-1-6 10:22:20 """ # revision identifiers, used by Alembic. from alembic import op import sqlalchemy as sa from sqlalchemy.engine import reflection from sqlalchemy.sql import table, column revision = '037' down_revision = '036' def upgrade(): op.add_column( 'action_definitions_v2', sa.Column('namespace', sa.String(length=255), nullable=True) ) inspect = reflection.Inspector.from_engine(op.get_bind()) unique_constraints = [ unique_constraint['name'] for unique_constraint in inspect.get_unique_constraints('action_definitions_v2') ] if 'name' in unique_constraints: op.drop_index('name', table_name='action_definitions_v2') if 'action_definitions_v2_name_project_id_key' in unique_constraints: op.drop_constraint('action_definitions_v2_name_project_id_key', table_name='action_definitions_v2') op.create_unique_constraint( None, 'action_definitions_v2', ['name', 'namespace', 'project_id'] ) action_def = table('action_definitions_v2', column('namespace')) session = sa.orm.Session(bind=op.get_bind()) with session.begin(subtransactions=True): session.execute( action_def.update().values(namespace='').where( action_def.c.namespace is None)) # noqa session.commit()
30.044118
73
0.709741
a00e704b1ca4a815e1645d869dbdf5ba0758a7a0
869
ps1
PowerShell
Set-UPN-FLast.ps1
AndyFriar/Office-365-Scripts
4c8b8e8fd4b1ff9f6ba20157f3b91083f8d21afc
[ "MIT" ]
null
null
null
Set-UPN-FLast.ps1
AndyFriar/Office-365-Scripts
4c8b8e8fd4b1ff9f6ba20157f3b91083f8d21afc
[ "MIT" ]
null
null
null
Set-UPN-FLast.ps1
AndyFriar/Office-365-Scripts
4c8b8e8fd4b1ff9f6ba20157f3b91083f8d21afc
[ "MIT" ]
null
null
null
<# .SYNOPSIS Script to change UserPrincipalName to FSurname@domain.com .DESCRIPTION Use when not in a hybrid environment as there are better scripts available Ensure that OU is changed .EXAMPLE PS C:\> <example usage> Explanation of what the example does .INPUTS Inputs (if any) .OUTPUTS Output (if any) .NOTES Based on the original work from Brandon Marcus - brandon@brandonmarc.us Edited to just use first initial of Firstname. #> Get-ADUser -Filter * -SearchBase "OU=Test Accounts,OU=User Accounts,DC=domain,DC=com" | ForEach-Object { $fn = $_.givenName.replace(" ","") $ln = $_.surname.replace(" ","") $fn = $fn.Substring(0,1) $suffix = "domain.com" $upn = "$fn$ln@$suffix" Write-Host $fn$ln Write-Host $upn set-aduser $_ -UserPrincipalName $upn }
25.558824
110
0.638665
fa5f68bd119be7aae46a424a7fce80d94573cbae
551
cpp
C++
Sources/Pipeline/RenderPass.cpp
IvanPleshkov/RedLiliumEngine
5e7c14d9c750db8054bde53b772e30e3682c2f1d
[ "Apache-2.0" ]
null
null
null
Sources/Pipeline/RenderPass.cpp
IvanPleshkov/RedLiliumEngine
5e7c14d9c750db8054bde53b772e30e3682c2f1d
[ "Apache-2.0" ]
1
2019-02-09T09:53:01.000Z
2019-02-09T09:53:01.000Z
Sources/Pipeline/RenderPass.cpp
IvanPleshkov/RedLiliumEngine
5e7c14d9c750db8054bde53b772e30e3682c2f1d
[ "Apache-2.0" ]
null
null
null
#include "pch.h" #include "RenderPass.h" #include "RenderPipeline.h" using namespace RED_LILIUM_NAMESPACE; RenderPass::RenderPass(ptr<RenderPipeline> pipeline) : RedLiliumObject() , m_pipeline(pipeline) {} ptr<RenderDevice> RenderPass::GetRenderDevice() { return m_pipeline->m_renderDevice; } const std::vector<ptr<const CameraComponent>>& RenderPass::GetCameraComponents() const { return m_pipeline->m_cameraComponents; } const std::vector<RenderComponentsPair>& RenderPass::GetMeshRenderers() const { return m_pipeline->m_meshRenderers; }
21.192308
86
0.787659
6b210b4a8e4d21e3f438ba0353b32e93ec568087
1,285
js
JavaScript
website/src/parsers/js/esprima.js
Learn-form-Zakas/astexplorer
a786db682516280ec19a7dac61077ff107304c00
[ "MIT" ]
4,526
2015-12-08T06:26:24.000Z
2022-03-31T09:21:39.000Z
website/src/parsers/js/esprima.js
Learn-form-Zakas/astexplorer
a786db682516280ec19a7dac61077ff107304c00
[ "MIT" ]
476
2015-12-08T06:13:55.000Z
2022-03-27T08:04:15.000Z
website/src/parsers/js/esprima.js
Learn-form-Zakas/astexplorer
a786db682516280ec19a7dac61077ff107304c00
[ "MIT" ]
643
2015-12-12T18:38:51.000Z
2022-03-30T16:17:13.000Z
import defaultParserInterface from './utils/defaultESTreeParserInterface'; import pkg from 'esprima/package.json'; const ID = 'esprima'; export default { ...defaultParserInterface, id: ID, displayName: ID, version: pkg.version, homepage: pkg.homepage, locationProps: new Set(['range', 'loc']), loadParser(callback) { require(['esprima'], callback); }, parse(esprima, code, options) { return esprima.parse(code, options); }, *forEachProperty(node) { if (node && typeof node === 'object') { for (let prop in node) { if (typeof node[prop] === 'function') { continue; } yield { value: node[prop], key: prop, computed: false, }; } } }, getDefaultOptions() { return { sourceType: 'module', loc: false, range: true, tokens: false, comment: false, attachComment: false, tolerant: false, jsx: true, }; }, _getSettingsConfiguration() { return { fields: [ ['sourceType', ['script', 'module']], 'range', 'loc', 'attachComment', 'comment', 'tokens', 'tolerant', 'jsx', ], required: new Set(['range']), }; }, };
18.897059
74
0.532296
7d579637a0297b085705b5ee347378b84462c8b2
843
rb
Ruby
lib/abstractor/utility.rb
textractortechnologies/abstractor
368d0da87abbe8b171280764be273383b46c4a6a
[ "MIT" ]
1
2021-10-06T14:41:52.000Z
2021-10-06T14:41:52.000Z
lib/abstractor/utility.rb
textractortechnologies/abstractor
368d0da87abbe8b171280764be273383b46c4a6a
[ "MIT" ]
107
2019-11-09T11:04:05.000Z
2022-03-31T00:04:13.000Z
lib/abstractor/utility.rb
NUARIG/omop-abstractor
a9ae6fb82a98b0260c5087ef8b195583fe47d880
[ "MIT" ]
null
null
null
module Abstractor module Utility def self.dehumanize(target) result = target.to_s.dup result.downcase.gsub(/ +/,'_') end def self.uniquify_overlapping_match_values(match_values) match_values.sort! { |a,b| b.size <=> a.size } normalized_match_values = [] sub_match_values = [] match_values.each do |match_value| if !sub_match_values.include?(match_value) cached_match_values = match_values.dup cached_match_values.delete(match_value) cached_match_values.each do |cached_match_value| if match_value.include?(cached_match_value) sub_match_values << cached_match_value end end normalized_match_values << match_value end end normalized_match_values.compact.uniq end end end
29.068966
60
0.653618
ff7d08e89cea6e49a0894be34a34d52052a38353
3,503
py
Python
leds/jars/effects/holidaycolorwiper.py
FlamingLotusGirls/Serenity
c128182bfacc81ccc3782dc6a813bb30ba339d40
[ "MIT" ]
2
2019-05-26T03:30:22.000Z
2019-05-30T21:59:25.000Z
pier14/opc-client/effects/holidaycolorwiper.py
FlamingLotusGirls/soma
df0da411d5b4e1f3a37a09fd4bd3ec3407aec7b5
[ "Apache-2.0" ]
10
2019-05-27T06:20:04.000Z
2022-02-26T15:15:08.000Z
leds/jars/effects/holidaycolorwiper.py
FlamingLotusGirls/Serenity
c128182bfacc81ccc3782dc6a813bb30ba339d40
[ "MIT" ]
2
2019-05-22T16:11:37.000Z
2019-07-22T18:00:08.000Z
import time import numpy as np import random from util import randomColor, hsvColorAdd from effectlayer import EffectLayer from colorsys import hsv_to_rgb, rgb_to_hsv class HolidayColorWiper(EffectLayer): """ Wipes between some number of specific colors. Without the optional parameters, this behaves identically to the ColorWiper layer. Optional Constructor parameters: - colors: an array of three-element decimal color spefiers in the range 0-255). - timers: A timer parameter in seconds, which determines the time to wait before automatically switching colors """ def __init__(self, model, colors=None, timer=None): self.model = model self.wipeDuration = 1 self.hueDelta = .27 # add this to the hue on each transition self.buttonDown = False self.wipeStartTime = None # should be None if no wipe is in progress self.change_every = timer self.colorPalette = [np.array(color) / 255.0 for color in colors] self.color = self.getColor() self.resetTimer() self.oldColor = None # "" def resetTimer(self): self.changeTime = time.time() def time_since_change(self): return time.time() - self.changeTime def getColor(self): if self.colorPalette: idx = random.randrange(0, len(self.colorPalette)) self.color_idx = idx return self.colorPalette[idx] else: return randomColor() def nextColor(self): """ If a color palette is set, move to the next color in the palette, otherwise, move around the color wheel by self.hueDelta """ if self.colorPalette: self.color_idx = (self.color_idx + 1) % len(self.colorPalette) return self.colorPalette[self.color_idx] else: return hsvColorAdd(self.color, (self.hueDelta, 0, 0)) def startWipe(self): self.wipeStartTime = time.time() self.oldColor = self.color self.color = self.nextColor() def setWipeStateFromButtons(self, params): """ if we detect a new button-press and aren't already in the middle of a wipe, set a new color and make the current color the old color """ if (params.buttonState[0] or params.buttonState[1]): if not self.buttonDown and not self.wipeStartTime: self.buttonDown = True self.startWipe() else: self.buttonDown = False def setWipeStateFromTimer(self): if self.change_every: if self.time_since_change() >= self.change_every: self.startWipe() self.resetTimer() def wipePercentCompleted(self): if self.wipeStartTime is not None: return (time.time() - self.wipeStartTime) / self.wipeDuration else: return 1 def render(self, model, params, frame): self.setWipeStateFromButtons(params) self.setWipeStateFromTimer() percentDone = self.wipePercentCompleted() # if the wipe is complete, clear its state so another wipe can be initiated if percentDone >= 1: self.oldColor = None self.wipeStartTime = None for i in range(self.model.numLEDs): if self.oldColor is not None and 1-self.model.nodes[i,1] > percentDone: color = self.oldColor else: color = self.color frame[i] = color
35.03
87
0.626606
dd7be01c4d4e4fb45c7929a7c6292127af5b17e2
1,735
java
Java
src/com/geeksforgeeks/strings/ImprovedNaivePatternSearchingForDistinct.java
kmestry/PROBLEM_SOLVING_HACKERRANK_LEETCODE
2332ac6771ab9ebfa568a34104ff171400557503
[ "MIT" ]
null
null
null
src/com/geeksforgeeks/strings/ImprovedNaivePatternSearchingForDistinct.java
kmestry/PROBLEM_SOLVING_HACKERRANK_LEETCODE
2332ac6771ab9ebfa568a34104ff171400557503
[ "MIT" ]
null
null
null
src/com/geeksforgeeks/strings/ImprovedNaivePatternSearchingForDistinct.java
kmestry/PROBLEM_SOLVING_HACKERRANK_LEETCODE
2332ac6771ab9ebfa568a34104ff171400557503
[ "MIT" ]
null
null
null
package com.geeksforgeeks.strings; import java.util.ArrayList; import java.util.List; public class ImprovedNaivePatternSearchingForDistinct { public static void main(String[] args) { ImprovedNaivePatternSearchingForDistinct imp = new ImprovedNaivePatternSearchingForDistinct(); List<Integer> list_0 = imp.naivePatternSearch("ABCABCD", "ABCD"); List<Integer> list_1 = imp.naivePatternSearch("GEEKSFORGEEKS", "EKS"); List<Integer> list_4 = imp.naivePatternSearch("ABCEABEFABCD", "ABCD"); List<Integer> list_2 = imp.naivePatternSearch("ABCAAAD", "ABD"); List<Integer> list_3 = imp.naivePatternSearch("ABCABCDABCD", "ABCD"); System.out.println(list_0); System.out.println(list_1); System.out.println(list_4); System.out.println(list_2); System.out.println(list_3); } private List<Integer> naivePatternSearch(String s, String pattern) { List<Integer> list = new ArrayList<>(); int pointerS = 0; while (pointerS < s.length()) { int countP = 0; int loopIndex = pattern.length() + pointerS; int nextPointerS = pointerS; for (int i = pointerS; i < loopIndex; i++) { if (s.charAt(i) != pattern.charAt(countP)) { break; } countP++; nextPointerS++; } if (countP == pattern.length()) { list.add(pointerS); pointerS = loopIndex; } else if (nextPointerS > pointerS) { pointerS = nextPointerS; } else { pointerS++; } } return list; } }
29.40678
102
0.5683
f4f78eabc63abc803cb8911af07c1ada84d4d86b
1,389
ts
TypeScript
src/http-exception.filter.ts
Troublor/jasmine-restful
6fbecf6565bcc2e0a9e2a9eb98ab1d1e3a8b7a4e
[ "MIT" ]
null
null
null
src/http-exception.filter.ts
Troublor/jasmine-restful
6fbecf6565bcc2e0a9e2a9eb98ab1d1e3a8b7a4e
[ "MIT" ]
null
null
null
src/http-exception.filter.ts
Troublor/jasmine-restful
6fbecf6565bcc2e0a9e2a9eb98ab1d1e3a8b7a4e
[ "MIT" ]
null
null
null
import {ExceptionFilter, Catch, ArgumentsHost, HttpException} from "@nestjs/common"; import {Response} from "express"; import {ResponseGenerator} from "./modules/common/models/response.model"; @Catch(HttpException) export class HttpExceptionFilter implements ExceptionFilter { catch(exception: HttpException, host: ArgumentsHost) { const ctx = host.switchToHttp(); const response = ctx.getResponse<Response>(); const status = exception.getStatus(); switch (status) { case 400: response .status(status) // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore .json(ResponseGenerator.BadRequest(`${exception.getResponse()["message"]}: ${exception.getResponse()["error"]}`)); break; case 500: response .status(status) .json(ResponseGenerator.InternalError()); break; default: response .status(status) // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore .json(ResponseGenerator.Raw(status, `${exception.getResponse()["message"]}: ${exception.getResponse()["error"]}`, null)); } } }
39.685714
141
0.559395
3841d0020b469e420815e2faf4a88db38d4fb944
306
php
PHP
app/LimiteAmount.php
valeria2204/backend-sistema-cotizacion
5e745a81b2b0c2f86c24a6ade66062ef124447b7
[ "MIT" ]
null
null
null
app/LimiteAmount.php
valeria2204/backend-sistema-cotizacion
5e745a81b2b0c2f86c24a6ade66062ef124447b7
[ "MIT" ]
null
null
null
app/LimiteAmount.php
valeria2204/backend-sistema-cotizacion
5e745a81b2b0c2f86c24a6ade66062ef124447b7
[ "MIT" ]
1
2021-05-02T20:43:19.000Z
2021-05-02T20:43:19.000Z
<?php namespace App; use Illuminate\Database\Eloquent\Model; class LimiteAmount extends Model { protected $fillable = [ 'monto','dateStamp','steps','administrative_units_id' ]; public function AdministrativeUnit(){ return $this->belongsTo(AdministrativeUnit::class); } }
19.125
61
0.689542
9353523d2759289ca5211306080949c7e01d8c87
8,766
go
Go
azuredevops/internal/service/core/resource_project_features_test.go
JohannesMoersch/terraform-provider-azuredevops
6dfca17d91b92e9d101bc6fd2d2d8bbe9de9ca0f
[ "MIT" ]
352
2019-09-30T17:52:18.000Z
2022-03-24T17:57:40.000Z
azuredevops/internal/service/core/resource_project_features_test.go
JohannesMoersch/terraform-provider-azuredevops
6dfca17d91b92e9d101bc6fd2d2d8bbe9de9ca0f
[ "MIT" ]
639
2019-09-30T17:03:21.000Z
2022-03-31T22:16:16.000Z
azuredevops/internal/service/core/resource_project_features_test.go
JohannesMoersch/terraform-provider-azuredevops
6dfca17d91b92e9d101bc6fd2d2d8bbe9de9ca0f
[ "MIT" ]
203
2019-10-06T14:31:15.000Z
2022-03-22T08:46:30.000Z
// +build all core resource_project resource_project_features // +build !exclude_resource_project_features package core // The tests in this file use the mock clients in mock_client.go to mock out // the Azure DevOps client operations. import ( "context" "errors" "fmt" "testing" "github.com/microsoft/azure-devops-go-api/azuredevops/featuremanagement" "github.com/microsoft/terraform-provider-azuredevops/azdosdkmocks" "github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/client" "github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/utils/converter" "github.com/microsoft/terraform-provider-azuredevops/azuredevops/internal/utils/testhelper" "github.com/stretchr/testify/require" "github.com/golang/mock/gomock" ) /** * Begin unit tests */ const invalidFeatureID = "invalid.projectFeature" func TestProjectFeatures_ReadProjectFeatureStates_DontSwallowError(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() featureClient := azdosdkmocks.NewMockFeaturemanagementClient(ctrl) clients := &client.AggregatedClient{ FeatureManagementClient: featureClient, Ctx: context.Background(), } const projectID = "2efa4ede-32a3-4373-9703-1c3ed30faeab" const errMsg = "QueryFeatureStates() Failed" featureClient. EXPECT(). QueryFeatureStates(clients.Ctx, gomock.Any()). Return(nil, errors.New(errMsg)). Times(1) ret, err := readProjectFeatureStates(clients.Ctx, clients.FeatureManagementClient, projectID) require.Nil(t, ret) require.NotNil(t, err) require.Equal(t, errMsg, err.Error()) } func TestProjectFeatures_ReadProjectFeatureStates_OnlyReturnProjectFeatures(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() featureClient := azdosdkmocks.NewMockFeaturemanagementClient(ctrl) clients := &client.AggregatedClient{ FeatureManagementClient: featureClient, Ctx: context.Background(), } const projectID = "2123a037-b1e8-4917-864f-0d025d166a4e" const errMsg = "QueryFeatureStates() Failed" featureStates := map[string]featuremanagement.ContributedFeatureState{} for _, featureName := range *getProjectFeatureIDs() { featureStates[featureName] = featuremanagement.ContributedFeatureState{ FeatureId: converter.String(featureName), State: &featuremanagement.ContributedFeatureEnabledValueValues.Enabled, } } featureStates[invalidFeatureID] = featuremanagement.ContributedFeatureState{ FeatureId: converter.String(invalidFeatureID), State: &featuremanagement.ContributedFeatureEnabledValueValues.Enabled, } featureClient. EXPECT(). QueryFeatureStates(clients.Ctx, gomock.Any()). Return(&featuremanagement.ContributedFeatureStateQuery{ FeatureIds: nil, FeatureStates: &featureStates, ScopeValues: nil, }, nil). Times(1) ret, err := readProjectFeatureStates(clients.Ctx, clients.FeatureManagementClient, projectID) require.NotNil(t, ret) require.Nil(t, err) require.True(t, len(featureStates) > len(*ret)) if _, ok := (*ret)[invalidFeatureID]; ok { require.Fail(t, fmt.Sprintf("readProjectFeatureStates must not return state for feature %s", invalidFeatureID)) } featureNameMap := *getProjectFeatureNameMap() for k, v := range featureStates { if k == invalidFeatureID { continue } state, ok := (*ret)[featureNameMap[k]] if !ok { require.Fail(t, fmt.Sprintf("readProjectFeatureStates must return state for feature %s", k)) } if state != *v.State { require.Fail(t, fmt.Sprintf("readProjectFeatureStates must return state %s for feature %s", featuremanagement.ContributedFeatureEnabledValueValues.Enabled, k)) } } } func TestProjectFeatures_GetConfiguredProjectFeatureStates_DontSwallowError(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() featureClient := azdosdkmocks.NewMockFeaturemanagementClient(ctrl) clients := &client.AggregatedClient{ FeatureManagementClient: featureClient, Ctx: context.Background(), } const projectID = "f011627f-b25b-40ae-9f1f-309168f661b2" const errMsg = "QueryFeatureStates() Failed" featureClient. EXPECT(). QueryFeatureStates(clients.Ctx, gomock.Any()). Return(nil, errors.New(errMsg)). Times(1) ret, err := getConfiguredProjectFeatureStates(clients.Ctx, clients.FeatureManagementClient, &map[string]interface{}{}, projectID) require.Nil(t, ret) require.NotNil(t, err) require.Equal(t, errMsg, err.Error()) } func TestProjectFeatures_GetConfiguredProjectFeatureStates_ReturnsOnlyRelevantFeatures(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() featureClient := azdosdkmocks.NewMockFeaturemanagementClient(ctrl) clients := &client.AggregatedClient{ FeatureManagementClient: featureClient, Ctx: context.Background(), } const projectID = "f011627f-b25b-40ae-9f1f-309168f661b2" featureIDs := *getProjectFeatureIDs() featureStates := map[string]featuremanagement.ContributedFeatureState{} for _, featureName := range featureIDs { featureStates[featureName] = featuremanagement.ContributedFeatureState{ FeatureId: converter.String(featureName), State: &featuremanagement.ContributedFeatureEnabledValueValues.Enabled, } } featureClient. EXPECT(). QueryFeatureStates(clients.Ctx, gomock.Any()). Return(&featuremanagement.ContributedFeatureStateQuery{ FeatureIds: nil, FeatureStates: &featureStates, ScopeValues: nil, }, nil). Times(1) idx := testhelper.RandIntSlice(0, len(featureIDs)-1, len(featureIDs)/2) featureNameMap := *getProjectFeatureNameMap() relevantFeatures := make(map[string]interface{}, len(idx)) for i := range idx { relevantFeatures[string(featureNameMap[featureIDs[i]])] = string(*featureStates[featureIDs[i]].State) } ret, err := getConfiguredProjectFeatureStates(clients.Ctx, clients.FeatureManagementClient, &relevantFeatures, projectID) require.Nil(t, err) require.NotNil(t, ret) for k, v := range relevantFeatures { retVal, ok := (*ret)[ProjectFeatureType(k)] if !ok { require.Fail(t, fmt.Sprintf("getConfiguredProjectFeatureStates must return state for feature %s", k)) } if v.(string) != string(retVal) { require.Fail(t, fmt.Sprintf("getConfiguredProjectFeatureStates must return state % for feature %s", v, k)) } } } func TestProjectFeatures_SetProjectFeatureStates_HandleError(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() featureClient := azdosdkmocks.NewMockFeaturemanagementClient(ctrl) clients := &client.AggregatedClient{ FeatureManagementClient: featureClient, Ctx: context.Background(), } const projectID = "ab3abf46-a5ed-4f61-9bde-4fd8427ec54e" featureIDs := *getProjectFeatureIDs() featureMap := *getProjectFeatureNameMap() idx := testhelper.RandInt(0, len(featureIDs)-1) featureStates := make(map[string]interface{}, 1) featureStates[string(featureMap[featureIDs[idx]])] = string(featuremanagement.ContributedFeatureEnabledValueValues.Enabled) expectedSetFeatureStateForScopeArgs := featuremanagement.SetFeatureStateForScopeArgs{ Feature: &featuremanagement.ContributedFeatureState{ FeatureId: converter.String(featureIDs[idx]), State: &featuremanagement.ContributedFeatureEnabledValueValues.Enabled, Scope: &featuremanagement.ContributedFeatureSettingScope{ SettingScope: converter.String("project"), UserScoped: converter.Bool(false), }, }, FeatureId: converter.String(featureIDs[idx]), UserScope: converter.String("host"), ScopeName: converter.String("project"), ScopeValue: converter.String(projectID), } const errMsg = "SetFeatureStateForScope() Failed" featureClient. EXPECT(). SetFeatureStateForScope(clients.Ctx, expectedSetFeatureStateForScopeArgs). Return(nil, errors.New(errMsg)). Times(1) err := setProjectFeatureStates(clients.Ctx, clients.FeatureManagementClient, projectID, &featureStates) require.NotNil(t, err) require.Equal(t, errMsg, err.Error()) } func TestProjectFeatures_SetProjectFeatureStates_OnlyValidProjectFeatures(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() featureClient := azdosdkmocks.NewMockFeaturemanagementClient(ctrl) clients := &client.AggregatedClient{ FeatureManagementClient: featureClient, Ctx: context.Background(), } const projectID = "ab3abf46-a5ed-4f61-9bde-4fd8427ec54e" featureStates := map[string]interface{}{ invalidFeatureID: string(featuremanagement.ContributedFeatureEnabledValueValues.Enabled), } errMsg := fmt.Sprintf("unknown feature: %s", invalidFeatureID) err := setProjectFeatureStates(clients.Ctx, clients.FeatureManagementClient, projectID, &featureStates) require.NotNil(t, err) require.Equal(t, errMsg, err.Error()) }
35.064
162
0.76272
db9ba27d2123fb7c871770ca61aab455fdb7b96f
1,407
php
PHP
FormFactory/AbstractMessageFormFactory.php
Graceas/GrcsInternalMessagesBundle
7f46d6e3fa755664e23d197eab73723a76ee0d9f
[ "MIT" ]
1
2015-03-11T03:17:28.000Z
2015-03-11T03:17:28.000Z
FormFactory/AbstractMessageFormFactory.php
Graceas/GrcsInternalMessagesBundle
7f46d6e3fa755664e23d197eab73723a76ee0d9f
[ "MIT" ]
null
null
null
FormFactory/AbstractMessageFormFactory.php
Graceas/GrcsInternalMessagesBundle
7f46d6e3fa755664e23d197eab73723a76ee0d9f
[ "MIT" ]
null
null
null
<?php /* * This file is part of the Grcs package. * * (c) Alexander Gorelov <grac.ga@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Grcs\InternalMessagesBundle\FormFactory; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormFactoryInterface; /** * Instanciates message forms */ abstract class AbstractMessageFormFactory { /** * The Symfony form factory * * @var FormFactoryInterface */ protected $formFactory; /** * The message form type * * @var AbstractType */ protected $formType; /** * The name of the form * * @var string */ protected $formName; /** * The class of the message model * * @var string */ protected $messageClass; public function __construct(FormFactoryInterface $formFactory, AbstractType $formType, $formName, $messageClass) { $this->formFactory = $formFactory; $this->formType = $formType; $this->formName = $formName; $this->messageClass = $messageClass; } /** * Creates a new instance of the form model * * @return AbstractMessage */ protected function createModelInstance() { $class = $this->messageClass; return new $class(); } }
20.1
116
0.623312
6eefc6d6ac6a612fa33ef8ac47c7cf013626ef8d
1,447
dart
Dart
api_benchmark/lib/benchmarks/index.dart
jnstahl/protobuf.dart
25b6a78421fb330e5c02ebb836e3f1ba1ba9610f
[ "BSD-3-Clause" ]
null
null
null
api_benchmark/lib/benchmarks/index.dart
jnstahl/protobuf.dart
25b6a78421fb330e5c02ebb836e3f1ba1ba9610f
[ "BSD-3-Clause" ]
null
null
null
api_benchmark/lib/benchmarks/index.dart
jnstahl/protobuf.dart
25b6a78421fb330e5c02ebb836e3f1ba1ba9610f
[ "BSD-3-Clause" ]
1
2021-12-19T08:04:15.000Z
2021-12-19T08:04:15.000Z
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. import '../benchmark.dart'; import '../generated/benchmark.pb.dart' as pb; import 'get_strings.dart'; import 'has_strings.dart'; import 'int32_json.dart'; import 'int64_json.dart'; import 'repeated_int32_json.dart'; import 'repeated_int64_json.dart'; import 'repeated_string_json.dart'; import 'set_strings.dart'; import 'string_json.dart'; /// Creates the appropriate Benchmark instance for a protobuf. Benchmark createBenchmark(pb.Request r) { var type = allBenchmarks[r.id]; if (type == null) { throw ArgumentError('unknown benchmark: ${r.id.name}'); } return type.create(r); } final Map<pb.BenchmarkID, BenchmarkType> allBenchmarks = _makeTypeMap([ Int32Benchmark.$type, Int64Benchmark.$type, StringBenchmark.$type, RepeatedInt32Benchmark.$type, RepeatedInt64Benchmark.$type, RepeatedStringBenchmark.$type, GetStringsBenchmark.$type, SetStringsBenchmark.$type, HasStringsBenchmark.$type, ]); Map<pb.BenchmarkID, BenchmarkType> _makeTypeMap(List<BenchmarkType> types) { var out = <pb.BenchmarkID, BenchmarkType>{}; for (var type in types) { if (out.containsKey(type.id)) { throw 'already added: $type.id.name'; } out[type.id] = type; } return Map.unmodifiable(out); }
30.145833
77
0.733932
c9d08db4b58546024f41c742668c01661e39248a
2,457
ts
TypeScript
test/Arweave.service.test.ts
TheLoneRonin/SolanaArweaveBridge
f1877a0c4a594cc2302623712a6c974828cf8aa0
[ "MIT" ]
21
2020-07-30T23:51:54.000Z
2022-02-18T10:07:11.000Z
test/Arweave.service.test.ts
TheLoneRonin/SolanaArweaveBridge
f1877a0c4a594cc2302623712a6c974828cf8aa0
[ "MIT" ]
5
2021-01-10T19:10:10.000Z
2021-01-31T18:36:54.000Z
test/Arweave.service.test.ts
TheLoneRonin/SolanaArweaveBridge
f1877a0c4a594cc2302623712a6c974828cf8aa0
[ "MIT" ]
7
2020-09-16T09:19:24.000Z
2022-02-27T16:16:43.000Z
import Arweave = require('arweave'); import { equal } from 'assert'; import { SolarweaveConfig } from '../src/Config'; import { ArweaveTransaction } from '../src/interface/Arweave.interface'; import { LoadWallet, GetBalance, SubmitBlocksToArweave } from '../src/service/Arweave.service'; export const arweave = Arweave.init({ host: 'arweave.net', port: 443, protocol: 'https', timeout: 20000, logging: false, }); function PrepareTransaction(Block, Slot) { const transaction: ArweaveTransaction = { tags: { database: SolarweaveConfig.database, parentSlot: Block.parentSlot.toString(), slot: Slot.toString(), blockhash: Block.blockhash, transactions: [], }, payload: Block, }; for (let i = 0; i < Block.transactions.length; i++) { const tx = Block.transactions[i]; transaction.tags.transactions.push({ signatures: tx.transaction.signatures, accountKeys: tx.transaction.message.accountKeys, programIdIndex: tx.transaction.message.instructions.map(instruction => instruction.programIdIndex), numReadonlySignedAccounts: tx.transaction.message.header.numReadonlySignedAccounts, numReadonlyUnsignedAccounts: tx.transaction.message.header.numReadonlyUnsignedAccounts, numRequiredSignatures: tx.transaction.message.header.numRequiredSignatures, }) } return transaction; } describe('Arweave Service Tests', () => { const slot = 1025219; const blockhash = '34zRbXQZktKRZarTzP6NHVFncyw8LqHtat8sXd7rwWUb'; let SampleBlock = null; it('Should load the default wallet', async () => { const key = await LoadWallet(); equal(key !== null, true); }); it('Should get the appropriate address and balance', async () => { const { address, balance } = await GetBalance(); equal(typeof address, 'string'); equal(address.length > 1, true); equal(isNaN(Number(balance)), false); equal(Number(balance) > -1, true); }); it('Should submit a block to Arweave', async () => { equal(SampleBlock !== null, true); const key = await LoadWallet(); equal(key !== null, true); const transaction: ArweaveTransaction = PrepareTransaction(SampleBlock, slot); await SubmitBlocksToArweave([transaction]); }); });
31.909091
111
0.636142
df4f32cc70b73aabd878139df004497a6a1527c8
276
rb
Ruby
boy.rb
ymhuang0808/ruby-self-practice
67ce679669963061824ad41f39b46a6611a6389a
[ "Unlicense" ]
null
null
null
boy.rb
ymhuang0808/ruby-self-practice
67ce679669963061824ad41f39b46a6611a6389a
[ "Unlicense" ]
null
null
null
boy.rb
ymhuang0808/ruby-self-practice
67ce679669963061824ad41f39b46a6611a6389a
[ "Unlicense" ]
null
null
null
require_relative "access_control_blog" class Male < Person def introduce super talk my_sex end private def my_sex "My sex is male." end end male = Male.new "Johnson", 26 male.introduce puts male.send :my_age male.send :talk, "private method is called"
15.333333
43
0.713768
034e81772048149dbc3154e280b08309433d889b
1,002
rb
Ruby
test/test_stacks.rb
sunloverz/iron_worker_ruby_ng
6c80429096af337c2a560f1c17b35b508a91ec47
[ "BSD-2-Clause" ]
22
2015-01-17T15:43:46.000Z
2021-01-06T12:04:37.000Z
test/test_stacks.rb
sunloverz/iron_worker_ruby_ng
6c80429096af337c2a560f1c17b35b508a91ec47
[ "BSD-2-Clause" ]
22
2015-01-07T11:21:31.000Z
2017-03-03T18:56:17.000Z
test/test_stacks.rb
sunloverz/iron_worker_ruby_ng
6c80429096af337c2a560f1c17b35b508a91ec47
[ "BSD-2-Clause" ]
4
2015-04-29T08:10:46.000Z
2020-04-01T16:09:34.000Z
require_relative 'helpers' class CodeCreateTest < IWNGTest def self.startup puts 'Starting stack tests' puts 'Please, input cluster:' @@cluster = gets.chomp @@cluster = 'default' if @@cluster == '' end def test_create stacks_list = client.stacks_list assert stacks_list.is_a? Array assert stacks_list.count > 0 assert stacks_list.include? 'python-2.7' end def test_wrong_stack code = code_bundle(:exec => 'test/hello.rb',:name => 'sample') code.stack('none') assert_raise Rest::Wrappers::RestClientExceptionWrapper do client.codes_create code end end def test_stacks puts "Starting stack tests for \"#{@@cluster}\" cluster..." client.stacks_list.each do |stack| client.codes.create(IronWorkerNG::Code::Base.new("test/stacks/#{stack}/#{stack}")) id = client.tasks.create(stack, {}, {cluster: @@cluster}).id task = client.tasks.wait_for(id) assert_equal 'complete', task.status end end end
26.368421
88
0.671657
a498458162423baa814ac4ea63dda0cc203f6cdc
1,338
php
PHP
tests/RegexTests/MatchWithOffsetsTest.php
Seldaek/pcre
121c9ed9702c96500efb71b6406baae6a5ebdaae
[ "MIT" ]
null
null
null
tests/RegexTests/MatchWithOffsetsTest.php
Seldaek/pcre
121c9ed9702c96500efb71b6406baae6a5ebdaae
[ "MIT" ]
null
null
null
tests/RegexTests/MatchWithOffsetsTest.php
Seldaek/pcre
121c9ed9702c96500efb71b6406baae6a5ebdaae
[ "MIT" ]
null
null
null
<?php /* * This file is part of composer/pcre. * * (c) Composer <https://github.com/composer> * * For the full copyright and license information, please view * the LICENSE file that was distributed with this source code. */ namespace Composer\Pcre\RegexTests; use Composer\Pcre\BaseTestCase; use Composer\Pcre\Regex; class MatchWithOffsetsTest extends BaseTestCase { /** * This can be replaced with a setUp() method when appropriate * * @before * @return void */ public function registerFunctionName() { $this->pregFunction = 'preg_match()'; } /** * @return void */ public function testSuccess() { $result = Regex::matchWithOffsets('{(?P<m>[io])}', 'abcdefghijklmnopqrstuvwxyz'); self::assertInstanceOf('Composer\Pcre\MatchWithOffsetsResult', $result); self::assertTrue($result->matched); self::assertSame(array(0 => array('i', 8), 'm' => array('i', 8), 1 => array('i', 8)), $result->matches); } /** * @return void */ public function testFailure() { $result = Regex::matchWithOffsets('{abc}', 'def'); self::assertInstanceOf('Composer\Pcre\MatchWithOffsetsResult', $result); self::assertFalse($result->matched); self::assertSame(array(), $result->matches); } }
25.730769
112
0.621076
a44328f06bcb905c389302d005c8f745aeb6d2d8
1,723
php
PHP
database/migrations/2019_12_21_104243_create_books_table.php
ibrahimmina/bookmark_et
0328449b49e4431a51fe54d14fe2ea9b5efb4f87
[ "MIT" ]
null
null
null
database/migrations/2019_12_21_104243_create_books_table.php
ibrahimmina/bookmark_et
0328449b49e4431a51fe54d14fe2ea9b5efb4f87
[ "MIT" ]
null
null
null
database/migrations/2019_12_21_104243_create_books_table.php
ibrahimmina/bookmark_et
0328449b49e4431a51fe54d14fe2ea9b5efb4f87
[ "MIT" ]
null
null
null
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateBooksTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('books', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('goodreads_book_id')->nullable(); $table->text('title'); $table->text('isbn')->nullable(); $table->text('isbn13')->nullable(); $table->text('asin')->nullable(); $table->text('kindle_asin')->nullable(); $table->text('marketplace_id')->nullable(); $table->text('country_code')->nullable(); $table->text('image_url')->nullable(); $table->text('small_image_url')->nullable(); $table->integer('publication_year')->nullable(); $table->integer('publication_month')->nullable(); $table->integer('publication_day')->nullable(); $table->text('publisher')->nullable(); $table->text('language_code')->nullable(); $table->boolean('is_ebook')->nullable(); $table->longText('description')->nullable(); $table->integer('num_pages')->nullable(); $table->text('format')->nullable(); $table->text('edition_information')->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('books'); } }
26.507692
64
0.52989
6585f64592b7b60ccbdb834fecf444dd4c526872
319
swift
Swift
IDValidationSDK/IDValidationCVCell.swift
indama/validation
32df1dc2671a270783c45d8a1773fe632c4f910d
[ "MIT" ]
null
null
null
IDValidationSDK/IDValidationCVCell.swift
indama/validation
32df1dc2671a270783c45d8a1773fe632c4f910d
[ "MIT" ]
null
null
null
IDValidationSDK/IDValidationCVCell.swift
indama/validation
32df1dc2671a270783c45d8a1773fe632c4f910d
[ "MIT" ]
null
null
null
// // IDValidationCVCell.swift // Medyear // // Created by Bahrom Abdullaev on 10/17/19. // Copyright © 2019 Personiform. All rights reserved. // import UIKit class IDValidationCVCell: UICollectionViewCell { override func awakeFromNib() { super.awakeFromNib() // Initialization code } }
16.789474
54
0.677116
ae00d0ae9d1068b90bd39e67ba825c3f104d283b
6,343
swift
Swift
LDMainFramework/Managers/LDImagePicker.swift
lazar89nis/LDFramework
3f730c9c036bdedfe40902ace9f586d67c314f3e
[ "MIT" ]
null
null
null
LDMainFramework/Managers/LDImagePicker.swift
lazar89nis/LDFramework
3f730c9c036bdedfe40902ace9f586d67c314f3e
[ "MIT" ]
null
null
null
LDMainFramework/Managers/LDImagePicker.swift
lazar89nis/LDFramework
3f730c9c036bdedfe40902ace9f586d67c314f3e
[ "MIT" ]
null
null
null
// // LDImagePicker.swift // iOSTemplate // // Created by Lazar on 10/3/17. // Copyright © 2017 Lazar. All rights reserved. // import UIKit public typealias CompletionHandler = (_ success:Bool, _ res:AnyObject?) -> Void // NOTE: Add NSCameraUsageDescription to plist file open class LDImagePicker: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate { open var imageSelectionInProgress = false open var imageSelectCompletitionHandler:CompletionHandler? public static let shared: LDImagePicker = { let instance = LDImagePicker() return instance }() /// Open UIImagePickerController with Camera like source type with the possibility of setting Completition Handler Function. /// /// - Parameters: /// - completitionHandler: Completion Handler Function. By default it is not set. open func takePictureFromCamera(allowEditing: Bool = true, completitionHandler:CompletionHandler? = nil) { self.imageSelectCompletitionHandler = completitionHandler self.openCamera(allowEditing: allowEditing) } /// Open UIImagePickerController with PhotosAlbum like source type with the possibility of setting Completition Handler Function. /// /// - Parameters: /// - completitionHandler: Completion Handler Function. By default it is not set. open func getPictureFromGallery(allowEditing: Bool = true, completitionHandler:CompletionHandler? = nil) { self.imageSelectCompletitionHandler = completitionHandler self.openGallery(allowEditing: allowEditing) } /// Open dialog to choose the image source from where the image will be obtained. /// /// - Parameters: /// - title: Dialog title. Default value is "Select picture". /// - fromCameraButtonTitle: From camera button title. Default value is "From Camera". /// - fromGalleryButtonTitle: From gallery button title. Default value is "From Gallery". /// - cancelButtonTitle: Cancel button title. Default value is "Cancel". /// - completitionHandler: Completion Handler Function. By default it is not set. open func selectPicture(title:String = "Select picture", fromCameraButtonTitle:String = "From Camera", fromGalleryButtonTitle:String = "From Gallery", cancelButtonTitle:String = "Cancel", allowEditing: Bool = true, completitionHandler:CompletionHandler? = nil) { self.imageSelectCompletitionHandler = completitionHandler LDDialog.showDialogWithMultipleActions(message: "", title: title, alertButtonTitles: [ fromCameraButtonTitle, fromGalleryButtonTitle, cancelButtonTitle] , alertButtonActions: [ { (alert) in self.openCamera(allowEditing: allowEditing) }, { (alert) in self.openGallery(allowEditing: allowEditing) }, nil ], alertButtonStyles: [ .default, .default, .cancel ]) } /// Open UIImagePickerController with Camera like source type private func openCamera(allowEditing: Bool) { if UIImagePickerController.isSourceTypeAvailable(.camera) { let imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .camera imagePicker.allowsEditing = allowEditing imageSelectionInProgress = true UIApplication.shared.keyWindow?.rootViewController?.present(imagePicker, animated: true, completion: nil) } } /// Open UIImagePickerController with PhotosAlbum like source type private func openGallery(allowEditing: Bool) { if UIImagePickerController.isSourceTypeAvailable(.savedPhotosAlbum){ let imagePicker = UIImagePickerController() imagePicker.delegate = self imagePicker.sourceType = .savedPhotosAlbum; imagePicker.allowsEditing = allowEditing imageSelectionInProgress = true UIApplication.shared.keyWindow?.rootViewController?.present(imagePicker, animated: true, completion: nil) } } /// Fix orientation for image. This is useful in some cases, for example, when image taken from camera has wrong orientation after upload to server. /// /// - Parameter img: Image for which we need to fix orientation /// - Returns: Image with valid orientation private func fixOrientation(img: UIImage) -> UIImage { if (img.imageOrientation == .up) { return img } UIGraphicsBeginImageContextWithOptions(img.size, false, img.scale) let rect = CGRect(x: 0, y: 0, width: img.size.width, height: img.size.height) img.draw(in: rect) let normalizedImage = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext() return normalizedImage } public func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { picker.dismiss(animated: true) { if picker.allowsEditing { if let image = info[UIImagePickerController.InfoKey.editedImage.rawValue] as? UIImage { if let completion = self.imageSelectCompletitionHandler { completion(true, self.fixOrientation(img: image)) } } } else { if let image = info[UIImagePickerController.InfoKey.originalImage.rawValue] as? UIImage { if let completion = self.imageSelectCompletitionHandler { completion(true, self.fixOrientation(img: image)) } } } } } public func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { picker.dismiss(animated: true, completion: { if let completion = self.imageSelectCompletitionHandler { completion(false, nil) } }) } }
40.14557
264
0.633139
a00c9d5edca192667f1eb578e5b49861911c2dfc
789
ts
TypeScript
kenkoooo/src/RustSolver.ts
manarimo/ICFPC2021
f9a84a2ed312ac843056820db2349f97ac01c72c
[ "MIT" ]
null
null
null
kenkoooo/src/RustSolver.ts
manarimo/ICFPC2021
f9a84a2ed312ac843056820db2349f97ac01c72c
[ "MIT" ]
null
null
null
kenkoooo/src/RustSolver.ts
manarimo/ICFPC2021
f9a84a2ed312ac843056820db2349f97ac01c72c
[ "MIT" ]
null
null
null
import { Problem } from "./utils"; export const solveAnnealing = async (problem: Problem) => { const module = await import("./wasm-rust/build"); const ans = module.solve_annealing(JSON.stringify(problem)); return JSON.parse(ans) as { vertices: [number, number][] }; }; export const solvePartialBruteForce = async ( problem: Problem, pose: { vertices: [number, number][] }, fixed: number[], setPose: (pose: [number, number][]) => void ) => { const module = await import("./wasm-rust/build"); module.solve_brute_force( JSON.stringify(problem), JSON.stringify(pose), JSON.stringify(fixed), (poseStr: string) => { console.log("yo"); const pose: { vertices: [number, number][] } = JSON.parse(poseStr); setPose(pose.vertices); } ); };
29.222222
73
0.641318
d05726041161b0a56f6c0fcaf1a4fb75ec047fea
571
cpp
C++
src/ndhist/stats/mean.cpp
martwo/ndhist
193cef3585b5d0277f0721bb9c3a1e78cc67cf1f
[ "BSD-2-Clause" ]
null
null
null
src/ndhist/stats/mean.cpp
martwo/ndhist
193cef3585b5d0277f0721bb9c3a1e78cc67cf1f
[ "BSD-2-Clause" ]
null
null
null
src/ndhist/stats/mean.cpp
martwo/ndhist
193cef3585b5d0277f0721bb9c3a1e78cc67cf1f
[ "BSD-2-Clause" ]
null
null
null
/** * $Id$ * * Copyright (C) * 2015 - $Date$ * Martin Wolf <ndhist@martin-wolf.org> * * This file is distributed under the BSD 2-Clause Open Source License * (See LICENSE file). * */ #include <boost/python.hpp> #include <ndhist/stats/expectation.hpp> #include <ndhist/stats/mean.hpp> namespace bp = boost::python; namespace bn = boost::numpy; namespace ndhist { namespace stats { namespace py { bp::object mean(ndhist const & h, bp::object const & axis) { return expectation(h, 1, axis); } }// namespace py }// namespace stats }// namespace ndhist
17.30303
70
0.672504
cd52eca093940f983c0c27edb637e98be1eeff1d
2,319
cs
C#
Texxtoor/Solution/Texxtoor.BaseLibrary.Globalization/Resources/GlobalizationResources.cs
joergkrause/texxtoor
7fa126a3fcfa5fa783e1b64955c586b7ccb6f9da
[ "Apache-2.0" ]
null
null
null
Texxtoor/Solution/Texxtoor.BaseLibrary.Globalization/Resources/GlobalizationResources.cs
joergkrause/texxtoor
7fa126a3fcfa5fa783e1b64955c586b7ccb6f9da
[ "Apache-2.0" ]
null
null
null
Texxtoor/Solution/Texxtoor.BaseLibrary.Globalization/Resources/GlobalizationResources.cs
joergkrause/texxtoor
7fa126a3fcfa5fa783e1b64955c586b7ccb6f9da
[ "Apache-2.0" ]
1
2021-04-09T13:47:39.000Z
2021-04-09T13:47:39.000Z
using System.Web.UI; [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.editresources.png", "image/png")] [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.extractresources.png", "image/png")] [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.localize.gif", "image/gif")] [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.refresh.gif", "image/gif")] [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.recycle.gif", "image/gif")] [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.rename.gif", "image/gif")] [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.delete.gif", "image/gif")] [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.createtable.gif", "image/gif")] [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.backup.gif", "image/gif")] [assembly: WebResource("Texxtoor.BaseLibrary.Globalization.Resources.import.gif", "image/gif")] namespace Texxtoor.BaseLibrary.Globalization { /// <summary> /// Class is used as to consolidate access to resources /// </summary> public class GlobalizationResources { public const string INFO_ICON_EDITRESOURCES = "Texxtoor.BaseLibrary.Globalization.Resources.editresources.png"; public const string INFO_ICON_EXTRACTRESOURCES = "Texxtoor.BaseLibrary.Globalization.Resources.extractresources.png"; public const string INFO_ICON_LOCALIZE = "Texxtoor.BaseLibrary.Globalization.Resources.localize.gif"; public const string INFO_ICON_REFRESH = "Texxtoor.BaseLibrary.Globalization.Resources.refresh.gif"; public const string INFO_ICON_RECYCLE = "Texxtoor.BaseLibrary.Globalization.Resources.recycle.gif"; public const string INFO_ICON_DELETE = "Texxtoor.BaseLibrary.Globalization.Resources.delete.gif"; public const string INFO_ICON_RENAME = "Texxtoor.BaseLibrary.Globalization.Resources.rename.gif"; public const string INFO_ICON_CREATETABLE = "Texxtoor.BaseLibrary.Globalization.Resources.createtable.gif"; public const string INFO_ICON_IMPORT = "Texxtoor.BaseLibrary.Globalization.Resources.import.gif"; public const string INFO_ICON_BACKUP = "Texxtoor.BaseLibrary.Globalization.Resources.backup.gif"; } }
70.272727
125
0.786977
da822f7bccd74223ee3cf4dc66c7e927fc98bb7a
207
lua
Lua
lua/NSL/nsl_predict.lua
xToken/NSL
c58bcf857df00339ddd69f23bf8c0b7748ba7dd8
[ "MIT" ]
4
2016-01-15T10:12:06.000Z
2022-01-01T15:50:08.000Z
lua/NSL/nsl_predict.lua
xToken/NSL
c58bcf857df00339ddd69f23bf8c0b7748ba7dd8
[ "MIT" ]
13
2015-10-31T09:03:14.000Z
2020-09-23T22:10:23.000Z
lua/NSL/nsl_predict.lua
xToken/NSL
c58bcf857df00339ddd69f23bf8c0b7748ba7dd8
[ "MIT" ]
12
2015-10-30T17:16:54.000Z
2020-04-17T07:19:41.000Z
-- Natural Selection League Plugin -- Source located at - https://github.com/xToken/NSL -- lua/NSL/nsl_predict.lua -- - Dragon -- Load shared defs Script.Load("lua/NSL/nsl_shared.lua") -- Load predict defs
23
52
0.724638
972e82050a32f32d65dc2b91704f4dcde079b451
257
sql
SQL
Algo and DSA/LeetCode-Solutions-master/MySQL/project-employees-i.sql
Sourav692/FAANG-Interview-Preparation
f523e5c94d582328b3edc449ea16ac6ab28cdc81
[ "Unlicense" ]
3,269
2018-10-12T01:29:40.000Z
2022-03-31T17:58:41.000Z
Algo and DSA/LeetCode-Solutions-master/MySQL/project-employees-i.sql
Sourav692/FAANG-Interview-Preparation
f523e5c94d582328b3edc449ea16ac6ab28cdc81
[ "Unlicense" ]
53
2018-12-16T22:54:20.000Z
2022-02-25T08:31:20.000Z
Algo and DSA/LeetCode-Solutions-master/MySQL/project-employees-i.sql
Sourav692/FAANG-Interview-Preparation
f523e5c94d582328b3edc449ea16ac6ab28cdc81
[ "Unlicense" ]
1,236
2018-10-12T02:51:40.000Z
2022-03-30T13:30:37.000Z
# Time: O(m + n) # Space: O(m + n) SELECT project_id, Round(Avg(experience_years), 2) AS average_years FROM project AS p INNER JOIN employee AS e ON p.employee_id = e.employee_id GROUP BY project_id ORDER BY NULL
23.363636
56
0.618677
c6fc2baefa5f72ec18c66ad365899e55c5309157
133
dart
Dart
lib/utils/log/log.dart
kinstugi/formletics_apps
37337e525aa68ffea63c5105a1b1f2fb3338a51c
[ "MIT" ]
null
null
null
lib/utils/log/log.dart
kinstugi/formletics_apps
37337e525aa68ffea63c5105a1b1f2fb3338a51c
[ "MIT" ]
null
null
null
lib/utils/log/log.dart
kinstugi/formletics_apps
37337e525aa68ffea63c5105a1b1f2fb3338a51c
[ "MIT" ]
null
null
null
import 'package:formletics/common/di/di.dart'; import 'package:formletics/utils/log/log_it.dart'; final LogIt log = getIt<LogIt>();
26.6
50
0.759398
4416992cc88da492004ed7550dd52bf477adea50
5,200
py
Python
pytorch_blitz/training_classifier.py
franpena-kth/learning-deep-learning
9cd287b602dee1358672c4189445721a9c24f107
[ "MIT" ]
null
null
null
pytorch_blitz/training_classifier.py
franpena-kth/learning-deep-learning
9cd287b602dee1358672c4189445721a9c24f107
[ "MIT" ]
null
null
null
pytorch_blitz/training_classifier.py
franpena-kth/learning-deep-learning
9cd287b602dee1358672c4189445721a9c24f107
[ "MIT" ]
null
null
null
import time import numpy import torch import torchvision from torchvision import transforms from matplotlib import pyplot from torch import nn from torch.nn import functional from torch import optim PATH = './cifar_net.pth' def load_cifar10(): transform = transforms.Compose([ transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)) ]) trainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform) trainloader = torch.utils.data.DataLoader(trainset, batch_size=4, shuffle=True, num_workers=0) testset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=transform) testloader = torch.utils.data.DataLoader(testset, batch_size=4, shuffle=False, num_workers=0) classes = ('plane', 'car', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck') # # get some random training images # dataiter = iter(trainloader) # images, labels = dataiter.next() # # # show images # imshow(torchvision.utils.make_grid(images)) # # print labels # print(' '.join('%5s' % classes[labels[j]] for j in range(4))) return trainloader, testloader, classes def imshow(img): img = img / 2 + 0.5 # unnormalize npimg = img.numpy() pyplot.imshow(numpy.transpose(npimg, (1, 2, 0))) pyplot.show() def test_images(): trainloader, testloader, classes = load_cifar10() # get some random training images dataiter = iter(trainloader) images, labels = dataiter.next() # show images imshow(torchvision.utils.make_grid(images)) # print labels print(' '.join('%5s' % classes[labels[j]] for j in range(4))) class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.conv1 = nn.Conv2d(3, 6, 5) self.pool = nn.MaxPool2d(2, 2) self.conv2 = nn.Conv2d(6, 16, 5) self.fc1 = nn.Linear(16 * 5 * 5, 120) self.fc2 = nn.Linear(120, 84) self.fc3 = nn.Linear(84, 10) def forward(self, x): x = self.pool(functional.relu(self.conv1(x))) x = self.pool(functional.relu(self.conv2(x))) x = x.view(-1, 16 * 5 * 5) x = functional.relu(self.fc1(x)) x = functional.relu(self.fc2(x)) x = self.fc3(x) return x def train_network(net, train_loader): criterion = nn.CrossEntropyLoss() optimizer = optim.SGD(net.parameters(), lr=0.001, momentum=0.9) for epoch in range(2): # loop over the dataset multiple times running_loss = 0.0 for i, data in enumerate(train_loader, 0): # get the inputs; data is a list of [inputs, labels] inputs, labels = data # zero the parameter gradients optimizer.zero_grad() # forward + backward + optimize outputs = net(inputs) loss = criterion(outputs, labels) loss.backward() optimizer.step() # print statistics running_loss += loss.item() if i % 2000 == 1999: # print every 2000 mini-batches print('[%d, %5d] loss: %.3f' % (epoch + 1, i + 1, running_loss / 2000)) running_loss = 0.0 print('Finished Training') torch.save(net.state_dict(), PATH) def test_network(testloader, classes): dataiter = iter(testloader) images, labels = dataiter.next() # print images imshow(torchvision.utils.make_grid(images)) print('GroundTruth: ', ' '.join('%5s' % classes[labels[j]] for j in range(4))) net = Net() net.load_state_dict(torch.load(PATH)) outputs = net(images) _, predicted = torch.max(outputs, 1) print('Predicted: ', ' '.join('%5s' % classes[predicted[j]] for j in range(4))) correct = 0 total = 0 with torch.no_grad(): for data in testloader: images, labels = data outputs = net(images) _, predicted = torch.max(outputs.data, 1) total += labels.size(0) correct += (predicted == labels).sum().item() print('Accuracy of the network on the 10000 test images: %d %%' % (100 * correct / total)) class_correct = list(0. for i in range(10)) class_total = list(0. for i in range(10)) with torch.no_grad(): for data in testloader: images, labels = data outputs = net(images) _, predicted = torch.max(outputs, 1) correct = (predicted == labels).squeeze() for i in range(4): label = labels[i] class_correct[label] += correct[i].item() class_total[label] += 1 for i in range(10): print('Accuracy of %5s : %2d %%' % ( classes[i], 100 * class_correct[i] / class_total[i])) def main(): trainloader, testloader, classes = load_cifar10() # load_cifar10() # test_images() # net = Net() # train_network(net, trainloader) test_network(testloader, classes) start = time.time() main() end = time.time() total_time = end - start print("%s: Total time = %f seconds" % (time.strftime("%Y/%m/%d-%H:%M:%S"), total_time))
29.545455
106
0.596923
794eb9f2401789267663ff35cd093e21d5b114d5
2,629
php
PHP
src/Cache/It/ItRedis.php
ti0rafa/sparky7
5439ace021b270bf0f94d21dd77ae14b302bbf57
[ "MIT" ]
null
null
null
src/Cache/It/ItRedis.php
ti0rafa/sparky7
5439ace021b270bf0f94d21dd77ae14b302bbf57
[ "MIT" ]
null
null
null
src/Cache/It/ItRedis.php
ti0rafa/sparky7
5439ace021b270bf0f94d21dd77ae14b302bbf57
[ "MIT" ]
null
null
null
<?php namespace Sparky7\Cache\It; use Psr\SimpleCache\CacheInterface; use Redis; /** * Redis Cache Interface. */ class ItRedis implements CacheInterface { private $Redis; private $ttl; /** * Construct. * * @param Redis $Redis Redis connection * @param int $ttl Time to live */ final public function __construct(Redis $Redis, $ttl) { $this->Redis = $Redis; $this->ttl = $ttl; } /** * Get key value. * * @param string $key Key * @param any $default Default key value * * @return any Key Value */ final public function get($key, $default = null) { if (!$this->has($key)) { return $default; } $this->Redis->expire($key, $this->ttl); return $this->Redis->get($key); } /** * Set key value. * * @param string $key Key * @param any $value Key value * @param int $ttl Time to live */ final public function set($key, $value, $ttl = null) { if (is_null($ttl)) { $ttl = $this->ttl; } return $this->Redis->setEx($key, $ttl, $value); } /** * Delete key value. * * @param string $key Key */ final public function delete($key) { return $this->Redis->delete($key); } /** * Clear all keys. */ final public function clear() { return $this->Redis->flushDb(); } /** * Get Multiple keys. * * @param Iterator $keys Keys * @param any $default Default value * * @return Iterator Key values */ final public function getMultiple($keys, $default = null) { $Iterator = []; foreach ($keys as $key) { $Iterator[$key] = $this->get($key, $default); } return $Iterator; } /** * Set multiple value keys. * * @param Iterator $keys Keys * @param int $ttl Time to live */ final public function setMultiple($keys, $ttl = null) { foreach ($keys as $key) { $this->set($key, $ttl); } return true; } /** * Delete multiple value keys. * * @param Iterator $keys Keys */ final public function deleteMultiple($keys) { foreach ($keys as $key) { $this->delete($key, $ttl); } return true; } /** * Has key value. * * @param string $key Key */ final public function has($key) { return $this->Redis->exists($key); } }
18.913669
61
0.491061
2c4147066ed685fb08b59b9fc4c5102a1aaa763f
338
py
Python
madrona/layers/admin.py
movermeyer/madrona
fcdced0a03408754b88a3d88f416e04d500c32d4
[ "BSD-3-Clause" ]
9
2015-03-09T11:04:21.000Z
2022-01-16T09:45:36.000Z
madrona/layers/admin.py
movermeyer/madrona
fcdced0a03408754b88a3d88f416e04d500c32d4
[ "BSD-3-Clause" ]
1
2020-04-24T14:38:43.000Z
2020-04-24T14:38:43.000Z
madrona/layers/admin.py
movermeyer/madrona
fcdced0a03408754b88a3d88f416e04d500c32d4
[ "BSD-3-Clause" ]
2
2016-12-06T15:31:35.000Z
2018-03-04T20:04:44.000Z
from django.contrib import admin from madrona.layers.models import * class PublicLayerListAdmin(admin.ModelAdmin): list_display = ('kml_file', 'active', 'creation_date',) class PrivateKmlAdmin(admin.ModelAdmin): pass admin.site.register(PublicLayerList, PublicLayerListAdmin) admin.site.register(PrivateKml, PrivateKmlAdmin)
26
59
0.795858
f130affcf2f5bc3788d95f829c01ee2066942c49
1,808
rb
Ruby
lib/liebre/actor/rpc/client/core.rb
iadbox/liebre
252519b8f56c6240869d8a28b3738a9d461ca1ba
[ "MIT" ]
1
2017-03-20T16:30:58.000Z
2017-03-20T16:30:58.000Z
lib/liebre/actor/rpc/client/core.rb
iadbox/liebre
252519b8f56c6240869d8a28b3738a9d461ca1ba
[ "MIT" ]
null
null
null
lib/liebre/actor/rpc/client/core.rb
iadbox/liebre
252519b8f56c6240869d8a28b3738a9d461ca1ba
[ "MIT" ]
null
null
null
module Liebre module Actor module RPC class Client class Core OPTS = {:block => false, :manual_ack => false} EXPIRE_INTERVAL = 60 def initialize client, resources, context, pending, task @client = client @resources = resources @context = context @pending = pending @task = task end def start response_queue.subscribe(OPTS) do |_info, meta, payload| client.reply(meta, payload) end request_exchange task.every(EXPIRE_INTERVAL) { client.expire } end def stop task.cancel_all chan.close end def request payload, opts, timeout r = pending.add(timeout) do |correlation_id| opts = opts.merge :reply_to => response_queue.name, :correlation_id => correlation_id request_exchange.publish(payload, opts) context.logger.info("request pending - correlation_id: #{correlation_id}") end end def reply meta, response pending.finish(meta.correlation_id, response) end def expire pending.expire() end def clean request_exchange.delete response_queue.delete end private def response_queue resources.response_queue end def request_exchange resources.request_exchange end def chan context.chan end attr_reader :client, :resources, :context, :pending, :task end end end end end
23.789474
88
0.511062
b8a991e8f4f5d205f3ad8f7b3fdc9438dd9995f5
665
h
C
Testsuite/Application/Tests.h
stellarpower/new_cast-Implementation
994f7d0611da4db72fabbeea5b25a33c3e35ef96
[ "BSL-1.0" ]
2
2018-02-22T05:22:42.000Z
2018-02-27T18:59:43.000Z
Testsuite/Application/Tests.h
stellarpower/new_cast-Implementation
994f7d0611da4db72fabbeea5b25a33c3e35ef96
[ "BSL-1.0" ]
null
null
null
Testsuite/Application/Tests.h
stellarpower/new_cast-Implementation
994f7d0611da4db72fabbeea5b25a33c3e35ef96
[ "BSL-1.0" ]
null
null
null
// Copyright Benjamin Southall 2018. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef TESTS_H #define TESTS_H #include "TestsShared.h" void testPolymorphicProperties(Logger &logger); void testBinaryObjectsSharedLibraryClasses(Logger &logger); void testSharedLibraryObjectsBinaryClasses(Logger &logger); void testDynamicAgainstNewBinary(Logger &logger); void testNewCastInterfaces(Logger &logger); void testDynamicAgainstNewAny(Logger &logger); void testNewAnyForNonClassTypes(Logger& logger); #endif // TESTS_H
19.558824
61
0.771429
f18c23b44ee6d3c6d0fa60e1adc5d0000e8ba8e4
1,569
rb
Ruby
24_partition.rb
petertseng/adventofcode
48a6ba4287a5373d70685ac4d58422042156f7d4
[ "Apache-2.0" ]
2
2017-12-27T15:12:58.000Z
2020-09-24T13:59:43.000Z
24_partition.rb
petertseng/adventofcode
48a6ba4287a5373d70685ac4d58422042156f7d4
[ "Apache-2.0" ]
null
null
null
24_partition.rb
petertseng/adventofcode
48a6ba4287a5373d70685ac4d58422042156f7d4
[ "Apache-2.0" ]
null
null
null
require_relative 'lib/ckk' verbose = ARGV.delete('-v') weights = ARGF.each_line.map(&method(:Integer)).freeze def min_needed(weights, target) # This is dodgy - a take_while with state weight_so_far = 0 weights.sort.reverse.take_while { |n| weight_so_far += n weight_so_far < target }.size + 1 end module DeleteFirst; refine Array do # Yes, so evil I am, redefining - on arrays. # It's needed in partition, because I want to delete exactly one element. # So, [1, 1, 2] - [1] should == [1, 2] def -(other) arr = dup other.each { |x| arr.delete_at(arr.index(x) || arr.length) } arr end end; end using DeleteFirst def partition(weights, num_groups) sum = weights.sum each_group = sum / num_groups (min_needed(weights, each_group)..(weights.size / num_groups)).each { |n| # First, find all combinations that add up to the target value. # We do not yet check partitionability of the remaining weights, # because CKK is expensive to run. winning_combos = weights.combination(n).select { |c| c.sum == each_group } winning_combos.sort_by! { |c| c.reduce(:*) } # Now, in order of QE, use CKK to check partitionability. # Return the first combination that wins. # In this way, hopefully we only run CKK on a few combinations. winner = winning_combos.find { |c| CKK[num_groups - 1].new(weights - c).best == 0 } return winner if winner } end [3, 4].each { |n| best_weights = partition(weights, n) puts best_weights.reduce(:*) puts best_weights.to_s if verbose }
28.017857
75
0.671128
6b7e0633b06b93abf086cd196cd7fd87ddeaf91b
766
js
JavaScript
frontend/src/components/shared/chart/defaults.js
play-log/playlog
ff113930cb26130985d4ef0fcf078ffb5e3a6f30
[ "MIT" ]
3
2018-08-16T15:53:11.000Z
2020-02-06T04:12:52.000Z
frontend/src/components/shared/chart/defaults.js
play-log/playlog
ff113930cb26130985d4ef0fcf078ffb5e3a6f30
[ "MIT" ]
null
null
null
frontend/src/components/shared/chart/defaults.js
play-log/playlog
ff113930cb26130985d4ef0fcf078ffb5e3a6f30
[ "MIT" ]
1
2021-01-22T19:04:56.000Z
2021-01-22T19:04:56.000Z
import ChartJS from 'chart.js'; ChartJS.defaults.global.defaultFontColor = '#bbbbbb'; ChartJS.defaults.global.elements.point.backgroundColor = 'rgba(255, 80, 80, 0.9)'; ChartJS.defaults.global.elements.line.backgroundColor = 'rgba(255, 80, 80, 0.4)'; ChartJS.defaults.global.elements.line.borderWidth = 1; ChartJS.defaults.global.elements.line.borderColor = 'rgba(255, 80, 80, 0.8)'; ChartJS.defaults.global.elements.rectangle.backgroundColor = 'rgba(255, 80, 80, 0.4)'; ChartJS.defaults.global.elements.rectangle.borderWidth = 1; ChartJS.defaults.global.elements.rectangle.borderColor = 'rgba(255, 80, 80, 0.8)'; ChartJS.defaults.scale.gridLines.color = 'rgba(255, 255, 255, 0.05)'; ChartJS.defaults.scale.gridLines.zeroLineColor = 'rgba(255, 255, 255, 0.05)';
47.875
86
0.754569
d03bb81d8ae81df9c7ffa78f6931d124b66881d9
1,542
hpp
C++
include/Framework/Button.hpp
AdlanSADOU/SDL_Space
b8c72b50942b939be0207d8ecd9c924d1124ceb7
[ "Unlicense" ]
1
2020-08-20T17:42:11.000Z
2020-08-20T17:42:11.000Z
include/Framework/Button.hpp
AdlanSADOU/SDL_Space
b8c72b50942b939be0207d8ecd9c924d1124ceb7
[ "Unlicense" ]
null
null
null
include/Framework/Button.hpp
AdlanSADOU/SDL_Space
b8c72b50942b939be0207d8ecd9c924d1124ceb7
[ "Unlicense" ]
null
null
null
/* ** EPITECH PROJECT, 2020 ** SDL_Space ** File description: ** Button */ #ifndef BUTTON_HPP_ #define BUTTON_HPP_ #include "Entity.hpp" enum buttonState { IDLE, HOVER, CLICKED }; class Button : public Entity { public: Button(); Button(SDL_Renderer *renderer); Button(SDL_Renderer *renderer, float x, float y, float width, float height); void Update(); void Draw(); void SetPosition(float x, float y); SDL_FRect GetPosition(); void SetColorIdle(Uint8 r, Uint8 g, Uint8 b, Uint8 a); void SetColorHover(Uint8 r, Uint8 g, Uint8 b, Uint8 a); void SetColorClicked(Uint8 r, Uint8 g, Uint8 b, Uint8 a); void SetTexture(const char *path); void SetRenderer(SDL_Renderer *renderer); void SetEvent(SDL_Event *event); void SetState(buttonState state); void UpdateTexture(SDL_Surface *surface); void UpdateHoverState(); void UpdateClickedState(); void UpdateColorFromState(); private: SDL_Surface *background_surface_idle; SDL_Surface *background_surface_hover; SDL_Surface *background_surface_clicked; SDL_FRect background_rect; SDL_Texture *texture; SDL_Renderer *renderer; buttonState state; SDL_Event *event; }; #endif /* !BUTTON_HPP_ */
25.7
96
0.568093
394d7598f1cb01b047b0bbdc5bdb395e57942b61
3,673
py
Python
src/python/marbles/ie/kb/test/spell_test.py
marbles-ai/ie
b3fef462d3418580c827c94bc206bd2991500c1f
[ "MIT" ]
null
null
null
src/python/marbles/ie/kb/test/spell_test.py
marbles-ai/ie
b3fef462d3418580c827c94bc206bd2991500c1f
[ "MIT" ]
null
null
null
src/python/marbles/ie/kb/test/spell_test.py
marbles-ai/ie
b3fef462d3418580c827c94bc206bd2991500c1f
[ "MIT" ]
null
null
null
from __future__ import unicode_literals, print_function import unittest import os import StringIO from marbles.ie.kb.spell import SymSpell, BEST_SUGGESTION, NBEST_SUGGESTIONS, ALL_SUGGESTIONS from marbles import PROJDIR from marbles.test import dprint, DPRINT_ON class SymSpellTestCase(unittest.TestCase): def test1_ReadWrite(self): ldcpath = os.path.join(PROJDIR, 'data', 'ldc', 'ccgbank_1_1', 'data', 'RAW') dirlist = os.listdir(ldcpath) spellchecker1 = SymSpell() for fname in dirlist[0:1]: f, x = os.path.splitext(fname) if x != '.raw': continue ldcpath1 = os.path.join(ldcpath, fname) spellchecker1.build_from_corpus(ldcpath1) fp = StringIO.StringIO() spellchecker1.save(fp) fp.seek(0) spellchecker2 = SymSpell() spellchecker2.restore(fp) self.assertEqual(spellchecker1.longest_word_length, spellchecker2.longest_word_length) self.assertEqual(spellchecker1.max_edit_distance, spellchecker2.max_edit_distance) self.assertEqual(len(spellchecker1.dictionary), len(spellchecker2.dictionary)) l1 = sorted(spellchecker1.dictionary.items(), key=lambda(word, (suggest, freq)): word) l2 = sorted(spellchecker2.dictionary.items(), key=lambda(word, (suggest, freq)): word) for s1, s2 in zip(l1, l2): self.assertEqual(s1[0], s2[0]) self.assertListEqual(s1[1][0], s2[1][0]) self.assertEqual(s1[1][1], s2[1][1]) # self.assertDictEqual(spellchecker1.dictionary, spellchecker2.dictionary) def test2_GetSuggestions(self): spellchecker = SymSpell() strm = StringIO.StringIO() strm.write("accepted accept acceptance acceptable\n") strm.write("excepted except exception exceptional sceptered\n") strm.seek(0) spellchecker.build_from_corpus(strm) suggestion = spellchecker.get_suggestions('acept', BEST_SUGGESTION) self.assertEqual('accept', suggestion) suggestion = spellchecker.get_suggestions('cepted', NBEST_SUGGESTIONS) self.assertListEqual(['accepted', 'excepted'], sorted(suggestion)) def test3_GetSuggestions(self): ldcpath = os.path.join(PROJDIR, 'data', 'ldc', 'ccgbank_1_1', 'data', 'RAW') dirlist = os.listdir(ldcpath) spellchecker = SymSpell() stats = spellchecker.build_from_wordnet() for fname in dirlist: f, x = os.path.splitext(fname) if x != '.raw': continue ldcpath1 = os.path.join(ldcpath, fname) with open(ldcpath1, 'r') as fp: stats = spellchecker.build_from_corpus(fp, stats) if True: dprint("total words processed: %i" % stats[0]) dprint("total unique words in corpus: %i" % stats[1]) dprint("total items in dictionary (corpus words and deletions): %i" % len(spellchecker.dictionary)) dprint(" edit distance for deletions: %i" % spellchecker.max_edit_distance) dprint(" length of longest word in corpus: %i" % spellchecker.longest_word_length) strm = StringIO.StringIO() strm.write("excepted except exception exceptional\n") strm.seek(0) spellchecker.build_from_corpus(strm) suggestion = spellchecker.get_suggestions('acept', BEST_SUGGESTION) self.assertEqual('accept', suggestion) suggestion = spellchecker.get_suggestions('cepted', NBEST_SUGGESTIONS) self.assertListEqual(['accepted', 'excepted', 'sceptred'], sorted(suggestion)) if __name__ == '__main__': unittest.main()
43.211765
111
0.656684
23ba45ee6668f08b473267ef6f4dc7f0ed7d4b88
466
js
JavaScript
src/entity/Container.js
evrythng/evrythng.js
f60d1c2ae20068954b5f059dfae60f17575eb372
[ "Apache-2.0" ]
25
2015-02-13T18:05:04.000Z
2021-12-20T20:51:32.000Z
src/entity/Container.js
evrythng/evrythng.js
f60d1c2ae20068954b5f059dfae60f17575eb372
[ "Apache-2.0" ]
11
2016-06-09T12:39:27.000Z
2021-01-28T16:34:51.000Z
src/entity/Container.js
evrythng/evrythng.js
f60d1c2ae20068954b5f059dfae60f17575eb372
[ "Apache-2.0" ]
8
2015-03-10T16:01:23.000Z
2021-06-02T18:54:45.000Z
import Entity from './Entity' import Resource from '../resource/Resource' const path = '/containers' /** * Represents a Container entity object. * * @extends Entity */ export default class Container extends Entity { /** * Return simple resource factory for shipment notice containers. * * @static * @return {{container: Function}} */ static resourceFactory () { return { container: Resource.factoryFor(Container, path) } } }
19.416667
67
0.665236
97bba21fc541e1097e8cd706d23ac0a739dc0469
531
ts
TypeScript
api/poker.ts
kevin940726/slack-poker
4c39d66dc8a0620330306e510231bd4730e7b5aa
[ "MIT" ]
null
null
null
api/poker.ts
kevin940726/slack-poker
4c39d66dc8a0620330306e510231bd4730e7b5aa
[ "MIT" ]
5
2020-06-08T03:17:53.000Z
2022-01-22T11:34:19.000Z
api/poker.ts
kevin940726/slack-poker
4c39d66dc8a0620330306e510231bd4730e7b5aa
[ "MIT" ]
null
null
null
import { NowRequest, NowResponse } from '@now/node'; import NewPokerModal from '../components/NewPokerModal'; import { web } from '../lib/apis'; import verify from '../lib/verify'; export default async (req: NowRequest, res: NowResponse) => { if (req.method !== 'POST') { res.status(404); return; } await verify(req); const { trigger_id, response_url } = req.body; await web.views.open({ trigger_id, view: NewPokerModal({ responseURL: response_url, }), }); res.status(200).send(''); };
21.24
61
0.636535
5bf569a8de40780e591582fcc6d515ca0b6ee4fe
723
css
CSS
build/out/dark.css
digitalsatori/sketch-n-sketch
d69577e27049059fb6b701d4f71548bc25adb07b
[ "MIT" ]
565
2015-07-18T14:02:34.000Z
2022-03-27T10:31:18.000Z
build/out/dark.css
digitalsatori/sketch-n-sketch
d69577e27049059fb6b701d4f71548bc25adb07b
[ "MIT" ]
49
2015-07-17T18:11:22.000Z
2019-07-15T03:05:42.000Z
build/out/dark.css
digitalsatori/sketch-n-sketch
d69577e27049059fb6b701d4f71548bc25adb07b
[ "MIT" ]
44
2015-08-07T16:25:35.000Z
2021-04-27T01:17:20.000Z
:root { --main-bg-color: #333333; --panel-bg-color: #222222; --prose-code-bg-color: #444444; --hover-effect-bg-color: rgba(255, 255, 255, 0.1); --text-color: #CCCCCC; --subtle-text-color: #888888; --active-text-color: #FFFFFF; --disabled-text-color: #555555; --alert-warning-text-color: #FF3300; --pop-color: rgb(51, 170, 0, 1); --pop-color-darker: rgb(51, 136, 0, 1); --pop-color-clear: rgb(51, 170, 0, 0); --main-border-color: #555555; --subtle-border-color: #333333; --shadow-color: #000000; --resizer-color: #444444; --dragger-bg-color-fallback: #444444; --dragger-bg-gradient: linear-gradient(#444444, #333333); --satisfied-color: #33AA00; --impossible-color: #FF3300; }
24.1
59
0.632089
f464e2b870fc3dc0565e4ae4c2e830f092e2045e
321
cs
C#
Metrics/Json/JsonMetric.cs
locmxse60602/microdot
bca2724b634a8ac22c47c13230b00b58bbc83e2a
[ "Apache-2.0" ]
1,452
2017-06-04T14:19:24.000Z
2022-03-30T12:46:53.000Z
Metrics/Json/JsonMetric.cs
locmxse60602/microdot
bca2724b634a8ac22c47c13230b00b58bbc83e2a
[ "Apache-2.0" ]
33
2017-06-06T09:04:40.000Z
2021-07-05T13:39:29.000Z
Metrics/Json/JsonMetric.cs
locmxse60602/microdot
bca2724b634a8ac22c47c13230b00b58bbc83e2a
[ "Apache-2.0" ]
251
2017-06-04T13:45:19.000Z
2022-03-11T03:23:15.000Z
 namespace Metrics.Json { public class JsonMetric { private string[] tags = MetricTags.None.Tags; public string Name { get; set; } public string Unit { get; set; } public string[] Tags { get { return this.tags; } set { this.tags = value ?? new string[0]; } } } }
24.692308
103
0.557632
977b7388e6fad7a3f19d3c412cb81b45108900eb
1,211
ts
TypeScript
client/src/actions/healthStatus.ts
elyase/polyaxon
1c19f059a010a6889e2b7ea340715b2bcfa382a0
[ "MIT" ]
null
null
null
client/src/actions/healthStatus.ts
elyase/polyaxon
1c19f059a010a6889e2b7ea340715b2bcfa382a0
[ "MIT" ]
null
null
null
client/src/actions/healthStatus.ts
elyase/polyaxon
1c19f059a010a6889e2b7ea340715b2bcfa382a0
[ "MIT" ]
null
null
null
import { Action } from 'redux'; import { BASE_URL } from '../constants/api'; import { handleAuthError } from '../constants/utils'; export enum actionTypes { FETCH_HEALTH_STATUS = 'FETCH_HEALTH_STATUS', RECEIVE_HEALTH_STATUS = 'RECEIVE_HEALTH_STATUS', } export interface FetchHealthStatusAction extends Action { type: actionTypes.FETCH_HEALTH_STATUS; } export interface ReceiveHealthStatusAction extends Action { type: actionTypes.RECEIVE_HEALTH_STATUS; status: { [key: string]: any }; } export type HealthStatusAction = FetchHealthStatusAction | ReceiveHealthStatusAction; export function receiveHealthStatusActionCreator(status: { [key: string]: any }): ReceiveHealthStatusAction { return { type: actionTypes.RECEIVE_HEALTH_STATUS, status }; } export function fetchHealthStatus(): any { return (dispatch: any) => { return fetch(BASE_URL + '/_status', { method: 'GET', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }, }) .then((response) => handleAuthError(response, dispatch)) .then((response) => response.json()) .then((json) => dispatch(receiveHealthStatusActionCreator(json))); }; }
28.162791
109
0.706028
a3238dc6f50a47422b7b80be1276722dfc6a242b
2,809
java
Java
cave/com.raytheon.uf.viz.gl.triangulated/src/com/raytheon/uf/viz/gl/triangulated/GLTriangulatedImageExtension.java
srcarter3/awips2
37f31f5e88516b9fd576eaa49d43bfb762e1d174
[ "Apache-2.0" ]
null
null
null
cave/com.raytheon.uf.viz.gl.triangulated/src/com/raytheon/uf/viz/gl/triangulated/GLTriangulatedImageExtension.java
srcarter3/awips2
37f31f5e88516b9fd576eaa49d43bfb762e1d174
[ "Apache-2.0" ]
null
null
null
cave/com.raytheon.uf.viz.gl.triangulated/src/com/raytheon/uf/viz/gl/triangulated/GLTriangulatedImageExtension.java
srcarter3/awips2
37f31f5e88516b9fd576eaa49d43bfb762e1d174
[ "Apache-2.0" ]
1
2021-10-30T00:03:05.000Z
2021-10-30T00:03:05.000Z
/** * This software was developed and / or modified by Raytheon Company, * pursuant to Contract DG133W-05-CQ-1067 with the US Government. * * U.S. EXPORT CONTROLLED TECHNICAL DATA * This software product contains export-restricted data whose * export/transfer/disclosure is restricted by U.S. law. Dissemination * to non-U.S. persons whether in the United States or abroad requires * an export license or other authorization. * * Contractor Name: Raytheon Company * Contractor Address: 6825 Pine Street, Suite 340 * Mail Stop B8 * Omaha, NE 68106 * 402.291.0100 * * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ package com.raytheon.uf.viz.gl.triangulated; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.drawables.triangulated.ITriangleLocationCallback; import com.raytheon.uf.viz.drawables.triangulated.ITriangulatedImage; import com.raytheon.uf.viz.drawables.triangulated.ITriangulatedImageExtension; import com.raytheon.viz.core.gl.IGLTarget; /** * {@link ITriangulatedImageExtension} implementation for use by * {@link IGLTarget}s. For implementation details see * {@link GLTriangulatedImage}. * * * <pre> * * SOFTWARE HISTORY * * Date Ticket# Engineer Description * ------------- -------- --------- -------------------------- * Aug 24, 2015 4709 bsteffen Initial creation * * </pre> * * @author bsteffen */ public class GLTriangulatedImageExtension extends GraphicsExtension<IGLTarget> implements ITriangulatedImageExtension { @Override public ITriangulatedImage initializeImage( ColorMapParameters colorMapParameters, ITriangleLocationCallback locations, IColorMapDataRetrievalCallback dataCallback) throws VizException { return new GLTriangulatedImage(colorMapParameters, locations, dataCallback); } @Override public void drawImage(PaintProperties paintProps, ITriangulatedImage image) throws VizException { if(image instanceof GLTriangulatedImage){ ((GLTriangulatedImage) image).paint(target, paintProps); }else{ throw new VizException("Must pass GL image: " + image.getClass().getSimpleName()); } } @Override public int getCompatibilityValue(IGLTarget target) { return Compatibilty.TARGET_COMPATIBLE; } }
35.1125
79
0.693129
11ab9644a79415a4638ccf663849ce1f07557fef
6,852
lua
Lua
src/cosy/server/http/header.lua
idsok/cosyverif-server
e1831252ccbe9078020b3e10f31e8219e597a20b
[ "MIT" ]
null
null
null
src/cosy/server/http/header.lua
idsok/cosyverif-server
e1831252ccbe9078020b3e10f31e8219e597a20b
[ "MIT" ]
null
null
null
src/cosy/server/http/header.lua
idsok/cosyverif-server
e1831252ccbe9078020b3e10f31e8219e597a20b
[ "MIT" ]
null
null
null
-- http://stackoverflow.com/questions/20284515/capitalize-first-letter-of-every-word-in-lua function string:to_http () return self:gsub ("_", "-"):gsub ("(%a)(%a*)", function (letter, r) return letter:upper() .. r:lower() end) end function string:to_identifier () return self:trim ():lower ():gsub ("-", "_") end -- Sequence: { [1] = text ... } -- Parameterized: { [1] = { token = ..., parameters = { ... } } -- MIME | Language: { [1] = { ..., parameters = { ... } } -- Tokens: { [token] = { parameters } } -- Token: { token = ..., parameters = { ... } } -- local dump = require "pl.pretty" . dump local Header = {} Header.__index = Header -- Header.Sequence = { name = "Sequence", } function Header.Sequence.request (header, context) local value = context.request.headers [header.as_identifier] local result = {} for token in value:gmatch "([^,%s]+)" do result [#result + 1] = { token = token } end context.request.headers [header.as_identifier] = result end function Header.Sequence.response (header, context) local value = context.response.headers [header.as_identifier] local result = {} for i, v in ipairs (value) do result [i] = v.token end context.response.headers [header.as_identifier] = table.concat (result, ",") end -- Header.Normalized = { name = "Normalized", } function Header.Normalized.request (header, context) local value = context.request.headers [header.as_identifier] for _, x in ipairs (value) do x.token = x.token:to_identifier () end end function Header.Normalized.response (header, context) local value = context.response.headers [header.as_identifier] for _, x in ipairs (value) do x.token = x.token:to_http () end end -- Header.Parameterized = { name = "Parameterized", token_pattern = "([^;%s]+)%s*;?(.*)", parameter_pattern = "([^=;%s]+)%s*[=]%s*([^;%s]+)", } function Header.Parameterized.request (header, context) local value = context.request.headers [header.as_identifier] for _, x in ipairs (value) do local _, remaining = x.token:match (Header.Parameterized.token_pattern) local parameters = {} for k, v in remaining:gmatch (Header.Parameterized.parameter_pattern) do parameters [k] = v end x.parameters = parameters end end function Header.Parameterized.response (header, context) local value = context.response.headers [header.as_identifier] for _, x in ipairs (value) do local result = x.token for k, v in pairs (x.parameters or {}) do result = result .. "; " .. k .. "=" .. v end x.token = result end end -- Header.MIME = { name = "MIME", pattern = "([^/%s]+)%s*/%s*(.*)", } function Header.MIME.request (header, context) local value = context.request.headers [header.as_identifier] for _, x in ipairs (value) do x.main, x.sub = x.token:match (Header.MIME.pattern) end end function Header.MIME.response (header, context) local value = context.response.headers [header.as_identifier] for _, x in ipairs (value) do x.token = x.main .. "/" .. x.sub end end -- Header.Language = { name = "Language", pattern = "(%a+)(-(%a+))?", } function Header.Language.request (header, context) local value = context.request.headers [header.as_identifier] for _, x in ipairs (value) do x.primary, _, x.sub = x.token:match (Header.Language.pattern) end end function Header.Language.response (header, context) local value = context.response.headers [header.as_identifier] for _, x in ipairs (value) do x.token = x.primary .. (x.sub and "-" .. x.sub or "") end end -- Header.Sorted = { name = "Sorted", } function Header.Sorted.request (header, context) local value = context.request.headers [header.as_identifier] table.sort (value, function (lhs, rhs) local l = (lhs.parameters or {}).q or 1 local r = (rhs.parameters or {}).q or 1 return l > r end) end function Header.Sorted.response () end -- Header.Tokenized = { name = "Tokenized", } function Header.Tokenized.request (header, context) local value = context.request.headers [header.as_identifier] local result = {} for _, x in ipairs (value) do result [x.token] = x.parameters or {} end context.request.headers [header.as_identifier] = result end function Header.Tokenized.response (header, context) local value = context.response.headers [header.as_identifier] local result = {} for k, v in pairs (value) do result [#result + 1] = { token = k, parameters = v, } end context.response.headers [header.as_identifier] = result end -- Header.First = { name = "First", } function Header.First.request (header, context) local value = context.request.headers [header.as_identifier] context.request.headers [header.as_identifier] = value [1] end function Header.First.response (header, context) local value = context.response.headers [header.as_identifier] context.response.headers [header.as_identifier] = { value } end -- Header.Integer = { name = "Integer", } function Header.Integer.request (header, context) local value = context.request.headers [header.as_identifier] context.request.headers [header.as_identifier] = tonumber (value.token) end function Header.Integer.response (header, context) local value = context.response.headers [header.as_identifier] context.response.headers [header.as_identifier] = { token = tostring (value), } end -- Header.depends = {} function Header.sort (headers) table.sort (headers, function (lhs, rhs) local lhs_id = lhs.as_identifier local rhs_id = rhs.as_identifier if not Header.depends [rhs_id] then local dependencies = {} for _, dep in ipairs (rhs.depends or {}) do dependencies [dep:to_identifier ()] = true end Header.depends [rhs_id] = dependencies end return Header.depends [rhs_id] [lhs_id] end) end function Header.__tostring (header) return header.as_http end function Header.class (attributes) attributes.as_identifier = attributes.name:to_identifier () attributes.as_http = attributes.name:to_http () return setmetatable (attributes, Header) end function Header.request (header, context) local value = context.request.headers [header.as_identifier] if not value then return end local filters = header.filters for i = 1, #filters do filters [i].request (header, context) end end function Header.response (header, context) local value = context.response.headers [header.as_identifier] if not value then return end local filters = header.filters for i = #filters, 1, -1 do filters [i].response (header, context) end end function Header.request_default () end function Header.response_default () end function Header.on_request () end function Header.on_response () end return Header
24.126761
91
0.67805
c9d59375a9c77eba563bbdf9721275ea5f5dddaf
543
tsx
TypeScript
src/templates/MyPages/index.tsx
luiizsilverio/my-trips
05285f97f27e458be3904c805d0006df1b4f21b7
[ "MIT" ]
null
null
null
src/templates/MyPages/index.tsx
luiizsilverio/my-trips
05285f97f27e458be3904c805d0006df1b4f21b7
[ "MIT" ]
null
null
null
src/templates/MyPages/index.tsx
luiizsilverio/my-trips
05285f97f27e458be3904c805d0006df1b4f21b7
[ "MIT" ]
null
null
null
import { CloseOutline } from '@styled-icons/evaicons-outline' import * as S from "./styles" import LinkWrapper from "@/components/LinkWrapper" export type PageProps = { heading: string body: string } const MyPagesTemplate = ({heading, body}: PageProps) => ( <S.Content> <LinkWrapper href="/"> <CloseOutline size={32} /> </LinkWrapper> <S.Heading>{ heading }</S.Heading> <S.Body> <div dangerouslySetInnerHTML={{ __html: body }} /> </S.Body> </S.Content> ) export default MyPagesTemplate
20.111111
61
0.640884
b76fc7ee7b93c7c139178ce1253a26e2d3bfcd36
116
cs
C#
EntitySynchronization/EntitySynchronizationClient/EntitySynchronizationClient.cs
uDevDE/EntitySynchronization
799815690ac8bfdb28db6ef82413c33de32f9b71
[ "MIT" ]
null
null
null
EntitySynchronization/EntitySynchronizationClient/EntitySynchronizationClient.cs
uDevDE/EntitySynchronization
799815690ac8bfdb28db6ef82413c33de32f9b71
[ "MIT" ]
null
null
null
EntitySynchronization/EntitySynchronizationClient/EntitySynchronizationClient.cs
uDevDE/EntitySynchronization
799815690ac8bfdb28db6ef82413c33de32f9b71
[ "MIT" ]
null
null
null
using System; namespace EntitySynchronization.Client { public class EntitySynchronizationClient { } }
12.888889
44
0.732759
f5c959c9c7d4b264ce7853dcd375e1bbe810ed2c
53
css
CSS
build/aui-scheduler/assets/aui-scheduler-view-week-core.css
alanzh/alloy-ui
215606ca485b3594febd88dad85249a4eaf78392
[ "BSD-3-Clause" ]
null
null
null
build/aui-scheduler/assets/aui-scheduler-view-week-core.css
alanzh/alloy-ui
215606ca485b3594febd88dad85249a4eaf78392
[ "BSD-3-Clause" ]
null
null
null
build/aui-scheduler/assets/aui-scheduler-view-week-core.css
alanzh/alloy-ui
215606ca485b3594febd88dad85249a4eaf78392
[ "BSD-3-Clause" ]
null
null
null
.aui-scheduler-view-week-hidden { display: none; }
13.25
33
0.698113
df2e2aa2f2e72c523affc3990fa343095fa13523
371
cs
C#
Util/Stringify.cs
jalbert-dev/mystower
8a726c9c9670e94e32669bb02614baa18e0fbf9d
[ "MIT" ]
null
null
null
Util/Stringify.cs
jalbert-dev/mystower
8a726c9c9670e94e32669bb02614baa18e0fbf9d
[ "MIT" ]
null
null
null
Util/Stringify.cs
jalbert-dev/mystower
8a726c9c9670e94e32669bb02614baa18e0fbf9d
[ "MIT" ]
null
null
null
using Newtonsoft.Json; namespace Util { public static class Stringify { public static string ToPrettyJson(this object self) => $"{self.GetType().Name} => {JsonConvert.SerializeObject(self, Formatting.Indented)}"; public static string ToJson(this object self) => JsonConvert.SerializeObject(self, Formatting.None); } }
30.916667
100
0.665768
90a212564ada09c861326e41c8515d530c157ea3
1,027
kt
Kotlin
2015/kt/src/test/kotlin/org/adventofcode/Dijkstra.kt
windmaomao/adventofcode
64362397a7a94c8049a7fe98fe57e73ae1704297
[ "MIT" ]
null
null
null
2015/kt/src/test/kotlin/org/adventofcode/Dijkstra.kt
windmaomao/adventofcode
64362397a7a94c8049a7fe98fe57e73ae1704297
[ "MIT" ]
null
null
null
2015/kt/src/test/kotlin/org/adventofcode/Dijkstra.kt
windmaomao/adventofcode
64362397a7a94c8049a7fe98fe57e73ae1704297
[ "MIT" ]
null
null
null
package org.adventofcode data class Dijkstra(val map: Map) { val breadcrumbs: HashMap<String, Pair<String, Int>> = hashMapOf() val visited: MutableList<String> = mutableListOf() private fun goForward(start: String, pcost: Int) { map.edges[start]?.forEach { node, cost -> breadcrumbs.put(node, Pair(start, pcost + cost)) } } private fun nextNode(): Pair<String, Int>? { if (breadcrumbs.size == 0) return null var found = "" var cost = Int.MAX_VALUE breadcrumbs .filter { m -> visited.indexOf(m.key) < 0 } .forEach { (node, pair) -> if (pair.second < cost) { found = node cost = pair.second } } if (cost == Int.MAX_VALUE) return null return Pair(found, cost) } fun findPath(root: String): List<String> { val size = map.getNodes().size // while (visited.size < size) { // val (node, cost) = nextNode(root) // goForward(node, cost) // visited.add(node) // } return visited.toList() } }
23.883721
67
0.592989
0d35626460382dc3be295c5e2d5c368a04415bea
1,166
cs
C#
JsonPersistence/AJsonRepository.cs
xfleckx/EventSourcing
768994ac7e8767bbeae604ee85bc06628b181926
[ "MIT" ]
null
null
null
JsonPersistence/AJsonRepository.cs
xfleckx/EventSourcing
768994ac7e8767bbeae604ee85bc06628b181926
[ "MIT" ]
null
null
null
JsonPersistence/AJsonRepository.cs
xfleckx/EventSourcing
768994ac7e8767bbeae604ee85bc06628b181926
[ "MIT" ]
null
null
null
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EventSourcing.JsonPersistence { public abstract class AJsonRepository<T> : IDisposable { private FileInfo fileInfo; protected List<T> cache; public void InitializeCacheWith(FileInfo jsonFile) { fileInfo = jsonFile; using (var fileReader = new StreamReader( new FileStream(fileInfo.FullName, FileMode.OpenOrCreate))) { var content = fileReader.ReadToEnd(); cache = JsonConvert.DeserializeObject<List<T>>(content); } if (cache == null) cache = new List<T>(); } public void Save() { var jsonWorkDays = JsonConvert.SerializeObject(cache, Formatting.Indented); using (var fileWriter = new StreamWriter(fileInfo.FullName)) { fileWriter.Write(jsonWorkDays); } } public void Dispose() { Save(); } } }
25.347826
87
0.572899
742ca4b319011cf87e7534fb8f61c62320f2c12f
1,987
ps1
PowerShell
Public/Set-ConsoleWindow.ps1
Woznet/WozLab
ebd591ef0f1c93bd5e9aa99ac63cb83014725156
[ "MIT" ]
1
2021-01-05T21:31:11.000Z
2021-01-05T21:31:11.000Z
Public/Set-ConsoleWindow.ps1
Woznet/WozTools
6e4bde31e93c2d9d668ef8d61a65def6f163b8c5
[ "MIT" ]
null
null
null
Public/Set-ConsoleWindow.ps1
Woznet/WozTools
6e4bde31e93c2d9d668ef8d61a65def6f163b8c5
[ "MIT" ]
null
null
null
function Set-ConsoleWindow { param( [Parameter(ParameterSetName='Hide')] [switch]$Hide, [Parameter(ParameterSetName='ShowNormal')] [switch]$ShowNormal, [Parameter(ParameterSetName='ShowMinimized')] [switch]$ShowMinimized, [Parameter(ParameterSetName='ShowMaximized')] [switch]$ShowMaximized, [Parameter(ParameterSetName='Maximize')] [switch]$Maximize, [Parameter(ParameterSetName='ShowNormalNoActivate')] [switch]$ShowNormalNoActivate, [Parameter(ParameterSetName='Show')] [switch]$Show, [Parameter(ParameterSetName='Minimize')] [switch]$Minimize, [Parameter(ParameterSetName='ShowMinNoActivate')] [switch]$ShowMinNoActivate, [Parameter(ParameterSetName='ShowNoActivate')] [switch]$ShowNoActivate, [Parameter(ParameterSetName='Restore')] [switch]$Restore, [Parameter(ParameterSetName='ShowDefault')] [switch]$ShowDefault, [Parameter(ParameterSetName='ForceMinimized')] [switch]$ForceMinimized ) Begin { if (-not ('Console.Window' -as [type])) { # .Net methods for hiding/showing the console in the background Add-Type -Name Window -Namespace Console -MemberDefinition @' [DllImport("Kernel32.dll")] public static extern IntPtr GetConsoleWindow(); [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, Int32 nCmdShow); '@ } } Process { $sval = switch($PsCmdlet.ParameterSetName) { 'Hide' {'0'} 'ShowNormal' {'1'} 'ShowMinimized' {'2'} 'ShowMaximized' {'3'} 'Maximize' {'3'} 'ShowNormalNoActivate' {'4'} 'Show' {'5'} 'Minimize' {'6'} 'ShowMinNoActivate' {'7'} 'ShowNoActivate' {'8'} 'Restore' {'9'} 'ShowDefault' {'10'} 'ForceMinimized' {'11'} 'Default' {throw 'Error has occured while assigning numerial values'} } $null = [Console.Window]::ShowWindow([Console.Window]::GetConsoleWindow(), $sval) } }
32.048387
85
0.651233
0bddb74aab6b3b2465e47ff7fb2b6aadb8817285
48,248
cc
C++
src/mavsdk_server/src/generated/shell/shell.pb.cc
rworrall/MAVSDK
634f171bb5b492e2d5bd6453f54e7e88c603899e
[ "BSD-3-Clause" ]
275
2019-06-13T17:50:40.000Z
2022-03-28T01:03:01.000Z
src/mavsdk_server/src/generated/shell/shell.pb.cc
rworrall/MAVSDK
634f171bb5b492e2d5bd6453f54e7e88c603899e
[ "BSD-3-Clause" ]
655
2019-06-07T13:08:12.000Z
2022-03-23T04:51:21.000Z
src/mavsdk_server/src/generated/shell/shell.pb.cc
rworrall/MAVSDK
634f171bb5b492e2d5bd6453f54e7e88c603899e
[ "BSD-3-Clause" ]
299
2019-06-10T06:58:58.000Z
2022-03-25T04:14:34.000Z
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: shell/shell.proto #include "shell/shell.pb.h" #include <algorithm> #include <google/protobuf/io/coded_stream.h> #include <google/protobuf/extension_set.h> #include <google/protobuf/wire_format_lite.h> #include <google/protobuf/descriptor.h> #include <google/protobuf/generated_message_reflection.h> #include <google/protobuf/reflection_ops.h> #include <google/protobuf/wire_format.h> // @@protoc_insertion_point(includes) #include <google/protobuf/port_def.inc> PROTOBUF_PRAGMA_INIT_SEG namespace mavsdk { namespace rpc { namespace shell { constexpr SendRequest::SendRequest( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : command_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} struct SendRequestDefaultTypeInternal { constexpr SendRequestDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~SendRequestDefaultTypeInternal() {} union { SendRequest _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SendRequestDefaultTypeInternal _SendRequest_default_instance_; constexpr SendResponse::SendResponse( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : shell_result_(nullptr){} struct SendResponseDefaultTypeInternal { constexpr SendResponseDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~SendResponseDefaultTypeInternal() {} union { SendResponse _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SendResponseDefaultTypeInternal _SendResponse_default_instance_; constexpr SubscribeReceiveRequest::SubscribeReceiveRequest( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized){} struct SubscribeReceiveRequestDefaultTypeInternal { constexpr SubscribeReceiveRequestDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~SubscribeReceiveRequestDefaultTypeInternal() {} union { SubscribeReceiveRequest _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT SubscribeReceiveRequestDefaultTypeInternal _SubscribeReceiveRequest_default_instance_; constexpr ReceiveResponse::ReceiveResponse( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : data_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){} struct ReceiveResponseDefaultTypeInternal { constexpr ReceiveResponseDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ReceiveResponseDefaultTypeInternal() {} union { ReceiveResponse _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ReceiveResponseDefaultTypeInternal _ReceiveResponse_default_instance_; constexpr ShellResult::ShellResult( ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized) : result_str_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string) , result_(0) {} struct ShellResultDefaultTypeInternal { constexpr ShellResultDefaultTypeInternal() : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {} ~ShellResultDefaultTypeInternal() {} union { ShellResult _instance; }; }; PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ShellResultDefaultTypeInternal _ShellResult_default_instance_; } // namespace shell } // namespace rpc } // namespace mavsdk static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_shell_2fshell_2eproto[5]; static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_shell_2fshell_2eproto[1]; static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_shell_2fshell_2eproto = nullptr; const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_shell_2fshell_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::SendRequest, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::SendRequest, command_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::SendResponse, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::SendResponse, shell_result_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::SubscribeReceiveRequest, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::ReceiveResponse, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::ReceiveResponse, data_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::ShellResult, _internal_metadata_), ~0u, // no _extensions_ ~0u, // no _oneof_case_ ~0u, // no _weak_field_map_ PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::ShellResult, result_), PROTOBUF_FIELD_OFFSET(::mavsdk::rpc::shell::ShellResult, result_str_), }; static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = { { 0, -1, sizeof(::mavsdk::rpc::shell::SendRequest)}, { 6, -1, sizeof(::mavsdk::rpc::shell::SendResponse)}, { 12, -1, sizeof(::mavsdk::rpc::shell::SubscribeReceiveRequest)}, { 17, -1, sizeof(::mavsdk::rpc::shell::ReceiveResponse)}, { 23, -1, sizeof(::mavsdk::rpc::shell::ShellResult)}, }; static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = { reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::shell::_SendRequest_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::shell::_SendResponse_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::shell::_SubscribeReceiveRequest_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::shell::_ReceiveResponse_default_instance_), reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::mavsdk::rpc::shell::_ShellResult_default_instance_), }; const char descriptor_table_protodef_shell_2fshell_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n\021shell/shell.proto\022\020mavsdk.rpc.shell\032\024m" "avsdk_options.proto\"\036\n\013SendRequest\022\017\n\007co" "mmand\030\001 \001(\t\"C\n\014SendResponse\0223\n\014shell_res" "ult\030\001 \001(\0132\035.mavsdk.rpc.shell.ShellResult" "\"\031\n\027SubscribeReceiveRequest\"\037\n\017ReceiveRe" "sponse\022\014\n\004data\030\001 \001(\t\"\346\001\n\013ShellResult\0224\n\006" "result\030\001 \001(\0162$.mavsdk.rpc.shell.ShellRes" "ult.Result\022\022\n\nresult_str\030\002 \001(\t\"\214\001\n\006Resul" "t\022\022\n\016RESULT_UNKNOWN\020\000\022\022\n\016RESULT_SUCCESS\020" "\001\022\024\n\020RESULT_NO_SYSTEM\020\002\022\033\n\027RESULT_CONNEC" "TION_ERROR\020\003\022\026\n\022RESULT_NO_RESPONSE\020\004\022\017\n\013" "RESULT_BUSY\020\0052\305\001\n\014ShellService\022K\n\004Send\022\035" ".mavsdk.rpc.shell.SendRequest\032\036.mavsdk.r" "pc.shell.SendResponse\"\004\200\265\030\001\022h\n\020Subscribe" "Receive\022).mavsdk.rpc.shell.SubscribeRece" "iveRequest\032!.mavsdk.rpc.shell.ReceiveRes" "ponse\"\004\200\265\030\0000\001B\035\n\017io.mavsdk.shellB\nShellP" "rotob\006proto3" ; static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_shell_2fshell_2eproto_deps[1] = { &::descriptor_table_mavsdk_5foptions_2eproto, }; static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_shell_2fshell_2eproto_once; const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_shell_2fshell_2eproto = { false, false, 692, descriptor_table_protodef_shell_2fshell_2eproto, "shell/shell.proto", &descriptor_table_shell_2fshell_2eproto_once, descriptor_table_shell_2fshell_2eproto_deps, 1, 5, schemas, file_default_instances, TableStruct_shell_2fshell_2eproto::offsets, file_level_metadata_shell_2fshell_2eproto, file_level_enum_descriptors_shell_2fshell_2eproto, file_level_service_descriptors_shell_2fshell_2eproto, }; PROTOBUF_ATTRIBUTE_WEAK const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable* descriptor_table_shell_2fshell_2eproto_getter() { return &descriptor_table_shell_2fshell_2eproto; } // Force running AddDescriptors() at dynamic initialization time. PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_shell_2fshell_2eproto(&descriptor_table_shell_2fshell_2eproto); namespace mavsdk { namespace rpc { namespace shell { const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ShellResult_Result_descriptor() { ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_shell_2fshell_2eproto); return file_level_enum_descriptors_shell_2fshell_2eproto[0]; } bool ShellResult_Result_IsValid(int value) { switch (value) { case 0: case 1: case 2: case 3: case 4: case 5: return true; default: return false; } } #if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) constexpr ShellResult_Result ShellResult::RESULT_UNKNOWN; constexpr ShellResult_Result ShellResult::RESULT_SUCCESS; constexpr ShellResult_Result ShellResult::RESULT_NO_SYSTEM; constexpr ShellResult_Result ShellResult::RESULT_CONNECTION_ERROR; constexpr ShellResult_Result ShellResult::RESULT_NO_RESPONSE; constexpr ShellResult_Result ShellResult::RESULT_BUSY; constexpr ShellResult_Result ShellResult::Result_MIN; constexpr ShellResult_Result ShellResult::Result_MAX; constexpr int ShellResult::Result_ARRAYSIZE; #endif // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900) // =================================================================== class SendRequest::_Internal { public: }; SendRequest::SendRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:mavsdk.rpc.shell.SendRequest) } SendRequest::SendRequest(const SendRequest& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); command_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (!from._internal_command().empty()) { command_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_command(), GetArenaForAllocation()); } // @@protoc_insertion_point(copy_constructor:mavsdk.rpc.shell.SendRequest) } inline void SendRequest::SharedCtor() { command_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } SendRequest::~SendRequest() { // @@protoc_insertion_point(destructor:mavsdk.rpc.shell.SendRequest) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void SendRequest::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); command_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } void SendRequest::ArenaDtor(void* object) { SendRequest* _this = reinterpret_cast< SendRequest* >(object); (void)_this; } void SendRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void SendRequest::SetCachedSize(int size) const { _cached_size_.Set(size); } void SendRequest::Clear() { // @@protoc_insertion_point(message_clear_start:mavsdk.rpc.shell.SendRequest) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; command_.ClearToEmpty(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* SendRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string command = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { auto str = _internal_mutable_command(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "mavsdk.rpc.shell.SendRequest.command")); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* SendRequest::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.shell.SendRequest) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // string command = 1; if (!this->_internal_command().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_command().data(), static_cast<int>(this->_internal_command().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, "mavsdk.rpc.shell.SendRequest.command"); target = stream->WriteStringMaybeAliased( 1, this->_internal_command(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.shell.SendRequest) return target; } size_t SendRequest::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.shell.SendRequest) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // string command = 1; if (!this->_internal_command().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_command()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SendRequest::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, SendRequest::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*SendRequest::GetClassData() const { return &_class_data_; } void SendRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<SendRequest *>(to)->MergeFrom( static_cast<const SendRequest &>(from)); } void SendRequest::MergeFrom(const SendRequest& from) { // @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.shell.SendRequest) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_command().empty()) { _internal_set_command(from._internal_command()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void SendRequest::CopyFrom(const SendRequest& from) { // @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.shell.SendRequest) if (&from == this) return; Clear(); MergeFrom(from); } bool SendRequest::IsInitialized() const { return true; } void SendRequest::InternalSwap(SendRequest* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), &command_, GetArenaForAllocation(), &other->command_, other->GetArenaForAllocation() ); } ::PROTOBUF_NAMESPACE_ID::Metadata SendRequest::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_shell_2fshell_2eproto_getter, &descriptor_table_shell_2fshell_2eproto_once, file_level_metadata_shell_2fshell_2eproto[0]); } // =================================================================== class SendResponse::_Internal { public: static const ::mavsdk::rpc::shell::ShellResult& shell_result(const SendResponse* msg); }; const ::mavsdk::rpc::shell::ShellResult& SendResponse::_Internal::shell_result(const SendResponse* msg) { return *msg->shell_result_; } SendResponse::SendResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:mavsdk.rpc.shell.SendResponse) } SendResponse::SendResponse(const SendResponse& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); if (from._internal_has_shell_result()) { shell_result_ = new ::mavsdk::rpc::shell::ShellResult(*from.shell_result_); } else { shell_result_ = nullptr; } // @@protoc_insertion_point(copy_constructor:mavsdk.rpc.shell.SendResponse) } inline void SendResponse::SharedCtor() { shell_result_ = nullptr; } SendResponse::~SendResponse() { // @@protoc_insertion_point(destructor:mavsdk.rpc.shell.SendResponse) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void SendResponse::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); if (this != internal_default_instance()) delete shell_result_; } void SendResponse::ArenaDtor(void* object) { SendResponse* _this = reinterpret_cast< SendResponse* >(object); (void)_this; } void SendResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void SendResponse::SetCachedSize(int size) const { _cached_size_.Set(size); } void SendResponse::Clear() { // @@protoc_insertion_point(message_clear_start:mavsdk.rpc.shell.SendResponse) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; if (GetArenaForAllocation() == nullptr && shell_result_ != nullptr) { delete shell_result_; } shell_result_ = nullptr; _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* SendResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // .mavsdk.rpc.shell.ShellResult shell_result = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { ptr = ctx->ParseMessage(_internal_mutable_shell_result(), ptr); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* SendResponse::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.shell.SendResponse) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // .mavsdk.rpc.shell.ShellResult shell_result = 1; if (this->_internal_has_shell_result()) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite:: InternalWriteMessage( 1, _Internal::shell_result(this), target, stream); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.shell.SendResponse) return target; } size_t SendResponse::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.shell.SendResponse) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // .mavsdk.rpc.shell.ShellResult shell_result = 1; if (this->_internal_has_shell_result()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize( *shell_result_); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SendResponse::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, SendResponse::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*SendResponse::GetClassData() const { return &_class_data_; } void SendResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<SendResponse *>(to)->MergeFrom( static_cast<const SendResponse &>(from)); } void SendResponse::MergeFrom(const SendResponse& from) { // @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.shell.SendResponse) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (from._internal_has_shell_result()) { _internal_mutable_shell_result()->::mavsdk::rpc::shell::ShellResult::MergeFrom(from._internal_shell_result()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void SendResponse::CopyFrom(const SendResponse& from) { // @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.shell.SendResponse) if (&from == this) return; Clear(); MergeFrom(from); } bool SendResponse::IsInitialized() const { return true; } void SendResponse::InternalSwap(SendResponse* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); swap(shell_result_, other->shell_result_); } ::PROTOBUF_NAMESPACE_ID::Metadata SendResponse::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_shell_2fshell_2eproto_getter, &descriptor_table_shell_2fshell_2eproto_once, file_level_metadata_shell_2fshell_2eproto[1]); } // =================================================================== class SubscribeReceiveRequest::_Internal { public: }; SubscribeReceiveRequest::SubscribeReceiveRequest(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:mavsdk.rpc.shell.SubscribeReceiveRequest) } SubscribeReceiveRequest::SubscribeReceiveRequest(const SubscribeReceiveRequest& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); // @@protoc_insertion_point(copy_constructor:mavsdk.rpc.shell.SubscribeReceiveRequest) } inline void SubscribeReceiveRequest::SharedCtor() { } SubscribeReceiveRequest::~SubscribeReceiveRequest() { // @@protoc_insertion_point(destructor:mavsdk.rpc.shell.SubscribeReceiveRequest) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void SubscribeReceiveRequest::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); } void SubscribeReceiveRequest::ArenaDtor(void* object) { SubscribeReceiveRequest* _this = reinterpret_cast< SubscribeReceiveRequest* >(object); (void)_this; } void SubscribeReceiveRequest::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void SubscribeReceiveRequest::SetCachedSize(int size) const { _cached_size_.Set(size); } void SubscribeReceiveRequest::Clear() { // @@protoc_insertion_point(message_clear_start:mavsdk.rpc.shell.SubscribeReceiveRequest) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* SubscribeReceiveRequest::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* SubscribeReceiveRequest::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.shell.SubscribeReceiveRequest) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.shell.SubscribeReceiveRequest) return target; } size_t SubscribeReceiveRequest::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.shell.SubscribeReceiveRequest) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData SubscribeReceiveRequest::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, SubscribeReceiveRequest::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*SubscribeReceiveRequest::GetClassData() const { return &_class_data_; } void SubscribeReceiveRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<SubscribeReceiveRequest *>(to)->MergeFrom( static_cast<const SubscribeReceiveRequest &>(from)); } void SubscribeReceiveRequest::MergeFrom(const SubscribeReceiveRequest& from) { // @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.shell.SubscribeReceiveRequest) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void SubscribeReceiveRequest::CopyFrom(const SubscribeReceiveRequest& from) { // @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.shell.SubscribeReceiveRequest) if (&from == this) return; Clear(); MergeFrom(from); } bool SubscribeReceiveRequest::IsInitialized() const { return true; } void SubscribeReceiveRequest::InternalSwap(SubscribeReceiveRequest* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); } ::PROTOBUF_NAMESPACE_ID::Metadata SubscribeReceiveRequest::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_shell_2fshell_2eproto_getter, &descriptor_table_shell_2fshell_2eproto_once, file_level_metadata_shell_2fshell_2eproto[2]); } // =================================================================== class ReceiveResponse::_Internal { public: }; ReceiveResponse::ReceiveResponse(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:mavsdk.rpc.shell.ReceiveResponse) } ReceiveResponse::ReceiveResponse(const ReceiveResponse& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (!from._internal_data().empty()) { data_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_data(), GetArenaForAllocation()); } // @@protoc_insertion_point(copy_constructor:mavsdk.rpc.shell.ReceiveResponse) } inline void ReceiveResponse::SharedCtor() { data_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } ReceiveResponse::~ReceiveResponse() { // @@protoc_insertion_point(destructor:mavsdk.rpc.shell.ReceiveResponse) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ReceiveResponse::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); data_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } void ReceiveResponse::ArenaDtor(void* object) { ReceiveResponse* _this = reinterpret_cast< ReceiveResponse* >(object); (void)_this; } void ReceiveResponse::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ReceiveResponse::SetCachedSize(int size) const { _cached_size_.Set(size); } void ReceiveResponse::Clear() { // @@protoc_insertion_point(message_clear_start:mavsdk.rpc.shell.ReceiveResponse) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; data_.ClearToEmpty(); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ReceiveResponse::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // string data = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) { auto str = _internal_mutable_data(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "mavsdk.rpc.shell.ReceiveResponse.data")); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ReceiveResponse::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.shell.ReceiveResponse) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // string data = 1; if (!this->_internal_data().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_data().data(), static_cast<int>(this->_internal_data().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, "mavsdk.rpc.shell.ReceiveResponse.data"); target = stream->WriteStringMaybeAliased( 1, this->_internal_data(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.shell.ReceiveResponse) return target; } size_t ReceiveResponse::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.shell.ReceiveResponse) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // string data = 1; if (!this->_internal_data().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_data()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ReceiveResponse::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ReceiveResponse::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ReceiveResponse::GetClassData() const { return &_class_data_; } void ReceiveResponse::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ReceiveResponse *>(to)->MergeFrom( static_cast<const ReceiveResponse &>(from)); } void ReceiveResponse::MergeFrom(const ReceiveResponse& from) { // @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.shell.ReceiveResponse) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_data().empty()) { _internal_set_data(from._internal_data()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ReceiveResponse::CopyFrom(const ReceiveResponse& from) { // @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.shell.ReceiveResponse) if (&from == this) return; Clear(); MergeFrom(from); } bool ReceiveResponse::IsInitialized() const { return true; } void ReceiveResponse::InternalSwap(ReceiveResponse* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), &data_, GetArenaForAllocation(), &other->data_, other->GetArenaForAllocation() ); } ::PROTOBUF_NAMESPACE_ID::Metadata ReceiveResponse::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_shell_2fshell_2eproto_getter, &descriptor_table_shell_2fshell_2eproto_once, file_level_metadata_shell_2fshell_2eproto[3]); } // =================================================================== class ShellResult::_Internal { public: }; ShellResult::ShellResult(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned) : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) { SharedCtor(); if (!is_message_owned) { RegisterArenaDtor(arena); } // @@protoc_insertion_point(arena_constructor:mavsdk.rpc.shell.ShellResult) } ShellResult::ShellResult(const ShellResult& from) : ::PROTOBUF_NAMESPACE_ID::Message() { _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); result_str_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); if (!from._internal_result_str().empty()) { result_str_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_result_str(), GetArenaForAllocation()); } result_ = from.result_; // @@protoc_insertion_point(copy_constructor:mavsdk.rpc.shell.ShellResult) } inline void ShellResult::SharedCtor() { result_str_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); result_ = 0; } ShellResult::~ShellResult() { // @@protoc_insertion_point(destructor:mavsdk.rpc.shell.ShellResult) if (GetArenaForAllocation() != nullptr) return; SharedDtor(); _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } inline void ShellResult::SharedDtor() { GOOGLE_DCHECK(GetArenaForAllocation() == nullptr); result_str_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited()); } void ShellResult::ArenaDtor(void* object) { ShellResult* _this = reinterpret_cast< ShellResult* >(object); (void)_this; } void ShellResult::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) { } void ShellResult::SetCachedSize(int size) const { _cached_size_.Set(size); } void ShellResult::Clear() { // @@protoc_insertion_point(message_clear_start:mavsdk.rpc.shell.ShellResult) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; result_str_.ClearToEmpty(); result_ = 0; _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } const char* ShellResult::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) { #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure while (!ctx->Done(&ptr)) { ::PROTOBUF_NAMESPACE_ID::uint32 tag; ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag); switch (tag >> 3) { // .mavsdk.rpc.shell.ShellResult.Result result = 1; case 1: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) { ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr); CHK_(ptr); _internal_set_result(static_cast<::mavsdk::rpc::shell::ShellResult_Result>(val)); } else goto handle_unusual; continue; // string result_str = 2; case 2: if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) { auto str = _internal_mutable_result_str(); ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx); CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "mavsdk.rpc.shell.ShellResult.result_str")); CHK_(ptr); } else goto handle_unusual; continue; default: { handle_unusual: if ((tag == 0) || ((tag & 7) == 4)) { CHK_(ptr); ctx->SetLastTag(tag); goto success; } ptr = UnknownFieldParse(tag, _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(), ptr, ctx); CHK_(ptr != nullptr); continue; } } // switch } // while success: return ptr; failure: ptr = nullptr; goto success; #undef CHK_ } ::PROTOBUF_NAMESPACE_ID::uint8* ShellResult::_InternalSerialize( ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const { // @@protoc_insertion_point(serialize_to_array_start:mavsdk.rpc.shell.ShellResult) ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; // .mavsdk.rpc.shell.ShellResult.Result result = 1; if (this->_internal_result() != 0) { target = stream->EnsureSpace(target); target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteEnumToArray( 1, this->_internal_result(), target); } // string result_str = 2; if (!this->_internal_result_str().empty()) { ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::VerifyUtf8String( this->_internal_result_str().data(), static_cast<int>(this->_internal_result_str().length()), ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::SERIALIZE, "mavsdk.rpc.shell.ShellResult.result_str"); target = stream->WriteStringMaybeAliased( 2, this->_internal_result_str(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray( _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream); } // @@protoc_insertion_point(serialize_to_array_end:mavsdk.rpc.shell.ShellResult) return target; } size_t ShellResult::ByteSizeLong() const { // @@protoc_insertion_point(message_byte_size_start:mavsdk.rpc.shell.ShellResult) size_t total_size = 0; ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; // Prevent compiler warnings about cached_has_bits being unused (void) cached_has_bits; // string result_str = 2; if (!this->_internal_result_str().empty()) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize( this->_internal_result_str()); } // .mavsdk.rpc.shell.ShellResult.Result result = 1; if (this->_internal_result() != 0) { total_size += 1 + ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::EnumSize(this->_internal_result()); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize( _internal_metadata_, total_size, &_cached_size_); } int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; } const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ShellResult::_class_data_ = { ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSizeCheck, ShellResult::MergeImpl }; const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ShellResult::GetClassData() const { return &_class_data_; } void ShellResult::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message*to, const ::PROTOBUF_NAMESPACE_ID::Message&from) { static_cast<ShellResult *>(to)->MergeFrom( static_cast<const ShellResult &>(from)); } void ShellResult::MergeFrom(const ShellResult& from) { // @@protoc_insertion_point(class_specific_merge_from_start:mavsdk.rpc.shell.ShellResult) GOOGLE_DCHECK_NE(&from, this); ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0; (void) cached_has_bits; if (!from._internal_result_str().empty()) { _internal_set_result_str(from._internal_result_str()); } if (from._internal_result() != 0) { _internal_set_result(from._internal_result()); } _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } void ShellResult::CopyFrom(const ShellResult& from) { // @@protoc_insertion_point(class_specific_copy_from_start:mavsdk.rpc.shell.ShellResult) if (&from == this) return; Clear(); MergeFrom(from); } bool ShellResult::IsInitialized() const { return true; } void ShellResult::InternalSwap(ShellResult* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::InternalSwap( &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), &result_str_, GetArenaForAllocation(), &other->result_str_, other->GetArenaForAllocation() ); swap(result_, other->result_); } ::PROTOBUF_NAMESPACE_ID::Metadata ShellResult::GetMetadata() const { return ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors( &descriptor_table_shell_2fshell_2eproto_getter, &descriptor_table_shell_2fshell_2eproto_once, file_level_metadata_shell_2fshell_2eproto[4]); } // @@protoc_insertion_point(namespace_scope) } // namespace shell } // namespace rpc } // namespace mavsdk PROTOBUF_NAMESPACE_OPEN template<> PROTOBUF_NOINLINE ::mavsdk::rpc::shell::SendRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::shell::SendRequest >(Arena* arena) { return Arena::CreateMessageInternal< ::mavsdk::rpc::shell::SendRequest >(arena); } template<> PROTOBUF_NOINLINE ::mavsdk::rpc::shell::SendResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::shell::SendResponse >(Arena* arena) { return Arena::CreateMessageInternal< ::mavsdk::rpc::shell::SendResponse >(arena); } template<> PROTOBUF_NOINLINE ::mavsdk::rpc::shell::SubscribeReceiveRequest* Arena::CreateMaybeMessage< ::mavsdk::rpc::shell::SubscribeReceiveRequest >(Arena* arena) { return Arena::CreateMessageInternal< ::mavsdk::rpc::shell::SubscribeReceiveRequest >(arena); } template<> PROTOBUF_NOINLINE ::mavsdk::rpc::shell::ReceiveResponse* Arena::CreateMaybeMessage< ::mavsdk::rpc::shell::ReceiveResponse >(Arena* arena) { return Arena::CreateMessageInternal< ::mavsdk::rpc::shell::ReceiveResponse >(arena); } template<> PROTOBUF_NOINLINE ::mavsdk::rpc::shell::ShellResult* Arena::CreateMaybeMessage< ::mavsdk::rpc::shell::ShellResult >(Arena* arena) { return Arena::CreateMessageInternal< ::mavsdk::rpc::shell::ShellResult >(arena); } PROTOBUF_NAMESPACE_CLOSE // @@protoc_insertion_point(global_scope) #include <google/protobuf/port_undef.inc>
39.808581
178
0.748674
7f801e21f2a702978879efd584d5751cbd037e77
458
php
PHP
config.default.inc.php
onassar/TurtlePHP-MemcachedSessionPlugin
716205bd3e69e07cdd305dde4730b16e8d774db0
[ "MIT" ]
null
null
null
config.default.inc.php
onassar/TurtlePHP-MemcachedSessionPlugin
716205bd3e69e07cdd305dde4730b16e8d774db0
[ "MIT" ]
null
null
null
config.default.inc.php
onassar/TurtlePHP-MemcachedSessionPlugin
716205bd3e69e07cdd305dde4730b16e8d774db0
[ "MIT" ]
null
null
null
<?php /** * Plugin Config Data * */ $expiry = 0; $host = '.' . ($_SERVER['HTTP_HOST']); $name = 'session'; $servers = array(); $server = array('127.0.0.1', '11211'); array_push($servers, $server); $pluginConfigData = compact('expiry', 'host', 'name', 'servers'); /** * Storage * */ $key = 'TurtlePHP-MemcachedSessionPlugin'; TurtlePHP\Plugin\Config::set($key, $pluginConfigData);
21.809524
69
0.528384
0ae9632e7a83f776d1376ec2684eb19dce8c074c
4,668
cs
C#
Common/HelpViewer.cs
jonnosan/MIDIopsy
5c0eee2e81e5e1e777c2c72dd359bdba608f730c
[ "MIT" ]
null
null
null
Common/HelpViewer.cs
jonnosan/MIDIopsy
5c0eee2e81e5e1e777c2c72dd359bdba608f730c
[ "MIT" ]
null
null
null
Common/HelpViewer.cs
jonnosan/MIDIopsy
5c0eee2e81e5e1e777c2c72dd359bdba608f730c
[ "MIT" ]
null
null
null
/* HelpViewer.cs - Implementation of HelpViewer class, which allows the user to view help for an application. * Note that this file is shared across applications. * * Copyright (c) 2017-9 Jeffrey Paul Bourdier * * Licensed under the MIT License. This file may be used only in compliance with this License. * Software distributed under this License is provided "AS IS", WITHOUT WARRANTY OF ANY KIND. * For more information, see the accompanying License file or the following URL: * * https://opensource.org/licenses/MIT */ /* Uri, Exception */ using System; /* CancelEventArgs */ using System.ComponentModel; /* Assembly */ using System.Reflection; /* ResourceManager */ using System.Resources; /* MessageBox, Application, MessageBoxButton, MessageBoxImage */ using System.Windows; /* WebBrowser */ using System.Windows.Controls; /* Keyboard */ using System.Windows.Input; /* BitmapFrame */ using System.Windows.Media.Imaging; namespace JeffBourdier { /// <summary>Displays a browser window that allows the user to view help for the application.</summary> public static class HelpViewer { /********** * Fields * **********/ #region Public Fields /// <summary> /// The name of the resource in the entry assembly (presumably the application .exe file) containing /// the text to show in the help window. If there is no such resource, the help window cannot be shown. /// </summary> public const string HelpTextResourceName = "HelpText"; #endregion #region Private Fields /// <summary>The help window. There is one per application instance.</summary> private static StandardWindow Window; #endregion /*********** * Methods * ***********/ #region Public Methods /// <summary>Displays a help viewer for the application.</summary> public static void Show() { string s; /* If the help window is already shown, activate it. */ if (HelpViewer.Window != null) { HelpViewer.Window.Activate(); return; } /* The help window is not already shown, so build and show it. First though, try to * get the help text, because if it doesn't exist, the help window cannot be shown. */ Assembly assembly = Assembly.GetEntryAssembly(); ResourceManager manager = new ResourceManager("JeffBourdier.Properties.Resources", assembly); try { s = manager.GetString(HelpViewer.HelpTextResourceName); } catch (Exception ex) { s = Text.FormatErrorMessage(Common.Resources.NoHelp, ex); MessageBox.Show(Application.Current.MainWindow, s, AppHelper.Title, MessageBoxButton.OK, MessageBoxImage.Error); return; } /* Start building the window. */ HelpViewer.Window = new StandardWindow(); /* Set the window icon. (Note: "Build Action" property must be set to "Resource") */ Uri uri = AppHelper.CreateResourceUri(true, "Help.ico"); HelpViewer.Window.Icon = BitmapFrame.Create(uri); HelpViewer.Window.Title = AppHelper.Title + " " + Common.Resources.Help; /* Set the content of the window to the help text. */ WebBrowser browser = new WebBrowser(); browser.NavigateToString(s); HelpViewer.Window.Content = browser; /* Finish building the window. */ HelpViewer.Window.RestorePreferences(Common.Settings.Default.HelpWindowMaximized, Common.Settings.Default.HelpWindowBounds); HelpViewer.Window.Closing += HelpViewer.Window_Closing; HelpViewer.Window.Show(); Keyboard.Focus(browser); } /// <summary>Closes the help viewer.</summary> public static void Close() { if (HelpViewer.Window == null) return; HelpViewer.Window.Close(); } #endregion #region Private Methods #region Event Handlers private static void Window_Closing(object sender, CancelEventArgs e) { /* Save help window settings. */ Common.Settings.Default.HelpWindowMaximized = HelpViewer.Window.Maximized; Common.Settings.Default.HelpWindowBounds = HelpViewer.Window.Bounds; Common.Settings.Default.Save(); HelpViewer.Window = null; } #endregion #endregion } }
32.193103
112
0.613753
c3f090a58ddec430acb9cdff304928852d9dd672
2,268
cs
C#
src/EFCore/Infrastructure/IModelCreationDependencies.cs
joaodvargas/efcore
caa4e413e796f13d1afa5fc21fa36e0db1aa0130
[ "Apache-2.0" ]
null
null
null
src/EFCore/Infrastructure/IModelCreationDependencies.cs
joaodvargas/efcore
caa4e413e796f13d1afa5fc21fa36e0db1aa0130
[ "Apache-2.0" ]
45
2021-01-13T15:17:34.000Z
2022-02-14T23:03:33.000Z
src/EFCore/Infrastructure/IModelCreationDependencies.cs
Youssef1313/efcore
ede9db2f9fae681faf21dbac96da7c88f723453b
[ "Apache-2.0" ]
null
null
null
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; using Microsoft.Extensions.DependencyInjection; #nullable enable namespace Microsoft.EntityFrameworkCore.Infrastructure { /// <summary> /// <para> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </para> /// <para> /// The service lifetime is <see cref="ServiceLifetime.Scoped" />. This means that each /// <see cref="DbContext" /> instance will use its own instance of this service. /// The implementation may depend on other services registered with any lifetime. /// The implementation does not need to be thread-safe. /// </para> /// </summary> public interface IModelCreationDependencies { /// <summary> /// The model source. /// </summary> public IModelSource ModelSource { get; } /// <summary> /// The convention set to use when creating the model. /// </summary> public IConventionSetBuilder ConventionSetBuilder { get; } /// <summary> /// The dependencies object for the model. /// </summary> public ModelDependencies ModelDependencies { get; } /// <summary> /// The model runtime initializer that will be used after the model building is finished. /// </summary> public IModelRuntimeInitializer ModelRuntimeInitializer { get; } /// <summary> /// The validation logger. /// </summary> public IDiagnosticsLogger<DbLoggerCategory.Model.Validation> ValidationLogger { get; } } }
42
113
0.648148
87a81da32efd667f37c11d3181c6cf7c4807bd94
1,907
dart
Dart
test/simple_test.dart
mikes222/ecache
2744135a479750959e928495a72aac7c195cc62a
[ "MIT" ]
2
2020-08-17T02:22:58.000Z
2021-04-10T22:30:54.000Z
test/simple_test.dart
mikes222/ecache
2744135a479750959e928495a72aac7c195cc62a
[ "MIT" ]
null
null
null
test/simple_test.dart
mikes222/ecache
2744135a479750959e928495a72aac7c195cc62a
[ "MIT" ]
null
null
null
import 'package:test/test.dart'; import 'dart:io'; import 'package:ecache/ecache.dart'; void main() { test('Test cache initialization', () { Cache cache = SimpleCache<int, int>(storage: SimpleStorage(), capacity: 20); expect(cache, isNotNull); }); // test('Test simple insert/get', () { Cache c = SimpleCache<String, int>(storage: SimpleStorage(), capacity: 20); c.set('key', 42); expect(c.get('key'), equals(42)); }); test('Test simple Cache', () { Cache<int, int> c = SimpleCache<int, int>(storage: SimpleStorage(), capacity: 20); c[4] = 40; c[5] = 50; expect(c.get(4), equals(40)); expect(c.get(5), equals(50)); }); test('Test simple eviction', () { Cache<int, int> c = SimpleCache<int, int>(storage: SimpleStorage(), capacity: 3); c[4] = 40; c[5] = 50; c[6] = 60; expect(c.get(4), equals(40)); expect(c.get(5), equals(50)); expect(c.get(6), equals(60)); c[7] = 70; c[8] = 80; expect(c.get(7), equals(70)); expect(c.length, 3); }); test('Test LRU eviction', () { Cache<int, int> c = LruCache<int, int>(storage: SimpleStorage(), capacity: 3); c[4] = 40; c[5] = 50; c[6] = 60; expect(c.get(4), equals(40)); expect(c.get(5), equals(50)); expect(c.get(6), equals(60)); expect(c.get(4), equals(40)); expect(c.get(6), equals(60)); c[7] = 70; expect(c.get(7), equals(70)); expect(c.containsKey(5), equals(false)); }); test('Test LFU eviction', () { Cache<int, int> c = LfuCache<int, int>(storage: SimpleStorage(), capacity: 3); c[4] = 40; c[5] = 50; c[6] = 60; expect(c.get(4), equals(40)); expect(c.get(5), equals(50)); expect(c.get(6), equals(60)); expect(c.get(4), equals(40)); expect(c.get(6), equals(60)); c[7] = 70; expect(c.get(7), equals(70)); expect(c.containsKey(5), equals(false)); }); }
27.242857
86
0.560566
1cd29b7a08e14dc8c00c2f37c9135850101781b6
945
ps1
PowerShell
examples/hyperflex/Get-IntersightHyperflexServerFirmwareVersionEntry.ps1
CiscoDevNet/intersight-powershell
01e565eab5586e4bc4b9eecde73067e1c3497e6c
[ "Apache-2.0" ]
6
2021-03-24T15:21:12.000Z
2022-02-22T09:47:16.000Z
examples/hyperflex/Get-IntersightHyperflexServerFirmwareVersionEntry.ps1
CiscoDevNet/intersight-powershell
01e565eab5586e4bc4b9eecde73067e1c3497e6c
[ "Apache-2.0" ]
18
2020-08-27T20:54:38.000Z
2022-03-31T05:53:57.000Z
examples/hyperflex/Get-IntersightHyperflexServerFirmwareVersionEntry.ps1
CiscoDevNet/intersight-powershell
01e565eab5586e4bc4b9eecde73067e1c3497e6c
[ "Apache-2.0" ]
3
2020-07-07T14:59:28.000Z
2021-03-27T14:41:50.000Z
#Get the HyperflexServerFirmwareVersionEntry by Name $HyperflexServerFirmwareVersionEntryByName = Get-IntersightHyperflexServerFirmwareVersionEntry -Name HyperflexServerFirmwareVersionEntryName #Get the List of ServerProfiles $HyperflexServerFirmwareVersionEntryList = Get-IntersightHyperflexServerFirmwareVersionEntry #Get the list of HyperflexServerFirmwareVersionEntry under particular organization. $org = Get-IntersightOrganizationOrganization -Name myOrg $HyperflexServerFirmwareVersionEntryByOrg = Get-IntersightHyperflexServerFirmwareVersionEntry -Organization $org #Get the HyperflexServerFirmwareVersionEntry based on query Parameter $HyperflexServerFirmwareVersionEntryByQueryParam = Get-IntersightHyperflexServerFirmwareVersionEntry -Filter Name eq HyperflexServerFirmwareVersionEntryName #Note :- The output returns by the ParameterSet "QueryParam" cannot be piped to the New or Set cmdlet due to different property structure .
63
156
0.884656
c5303020c700cda68451762f0ed1e59aa0ecffac
178
css
CSS
frontend/src/modules/resourceprogress/components/ProgressChart.css
Tratty/pontoon
ecb903d72f9274f02137b16669cc3c5859f6329c
[ "BSD-3-Clause" ]
3
2020-01-27T12:26:20.000Z
2022-02-03T09:56:02.000Z
frontend/src/modules/resourceprogress/components/ProgressChart.css
texnoman/pontoon-src
6b40ac229605e99966c3bdd1510b772c89d4de24
[ "BSD-3-Clause" ]
9
2021-03-10T21:34:51.000Z
2022-02-19T03:30:06.000Z
frontend/src/modules/resourceprogress/components/ProgressChart.css
texnoman/pontoon-src
6b40ac229605e99966c3bdd1510b772c89d4de24
[ "BSD-3-Clause" ]
4
2020-01-26T21:28:43.000Z
2021-06-10T15:25:19.000Z
.progress-chart canvas { border-radius: 100%; } .progress-chart:hover .selector canvas { background: #3F4752; } .progress-chart .menu canvas { margin: 10px auto; }
14.833333
40
0.668539
57c3f565197e48a6b4e65fc69e4863a62afa58a4
72
sh
Shell
apache/setup.sh
WebRockit/webrockit-extras
822ecad64cacb6474f5453cf8a4e8a8c9b3ef9b6
[ "MIT" ]
1
2015-02-03T00:38:35.000Z
2015-02-03T00:38:35.000Z
apache/setup.sh
WebRockit/webrockit-extras
822ecad64cacb6474f5453cf8a4e8a8c9b3ef9b6
[ "MIT" ]
null
null
null
apache/setup.sh
WebRockit/webrockit-extras
822ecad64cacb6474f5453cf8a4e8a8c9b3ef9b6
[ "MIT" ]
null
null
null
yum -y install httpd mod_ssl chkconfig httpd on /etc/init.d/httpd start
18
28
0.791667
e727a0c199cc95b00f26aebe0007355823e21f32
171
php
PHP
app/CashInHand.php
justawa/myaccountant_backend
821323393d885c66edd1375605d78aee0383d5d2
[ "MIT" ]
null
null
null
app/CashInHand.php
justawa/myaccountant_backend
821323393d885c66edd1375605d78aee0383d5d2
[ "MIT" ]
null
null
null
app/CashInHand.php
justawa/myaccountant_backend
821323393d885c66edd1375605d78aee0383d5d2
[ "MIT" ]
null
null
null
<?php namespace App; use Illuminate\Database\Eloquent\Model; class CashInHand extends Model { protected $table = 'cash_in_hand'; public $timestamps = false; }
13.153846
39
0.719298
c955722795b07a6a4b280e626107df1cd8a43032
6,368
ts
TypeScript
autonomous-single-access-mode/src/pages/journal/journal.effects.ts
dvsa/mes-beta-sandbox
6e6a4b0b53dadc4bdfb451bbc1899d8af5b17532
[ "MIT" ]
null
null
null
autonomous-single-access-mode/src/pages/journal/journal.effects.ts
dvsa/mes-beta-sandbox
6e6a4b0b53dadc4bdfb451bbc1899d8af5b17532
[ "MIT" ]
24
2020-09-04T14:35:10.000Z
2022-03-02T10:00:37.000Z
autonomous-single-access-mode/src/pages/journal/journal.effects.ts
dvsa/mes-beta-sandbox
6e6a4b0b53dadc4bdfb451bbc1899d8af5b17532
[ "MIT" ]
1
2021-04-10T22:07:26.000Z
2021-04-10T22:07:26.000Z
import { Injectable } from '@angular/core'; import { Actions, Effect, ofType } from '@ngrx/effects'; import { switchMap, map, withLatestFrom, takeUntil, mapTo, filter, catchError, startWith } from 'rxjs/operators'; import { of } from 'rxjs/observable/of'; import { interval } from 'rxjs/observable/interval'; import { groupBy } from 'lodash'; import * as journalActions from './journal.actions'; import { JournalProvider } from '../../providers/journal/journal'; import { Store, select } from '@ngrx/store'; import { StoreModel } from '../../shared/models/store.model'; import { getJournalState } from './journal.reducer'; import { AppConfigProvider } from '../../providers/app-config/app-config'; import { ExaminerWorkSchedule } from '../../shared/models/DJournal'; import { SlotItem } from '../../providers/slot-selector/slot-item'; import { SlotProvider } from '../../providers/slot/slot'; import { JournalRefreshModes } from '../../providers/analytics/analytics.model'; import { getSelectedDate, getLastRefreshed, getSlots, canNavigateToPreviousDay, canNavigateToNextDay, } from './journal.selector'; import { NetworkStateProvider, ConnectionStatus } from '../../providers/network-state/network-state'; import { DateTime, Duration } from '../../shared/helpers/date-time'; @Injectable() export class JournalEffects { constructor( private actions$: Actions, private journalProvider: JournalProvider, private slotProvider: SlotProvider, private store$: Store<StoreModel>, public appConfig: AppConfigProvider, public networkStateProvider: NetworkStateProvider, ) { } callJournalProvider$ = (mode: string) => { this.store$.dispatch(new journalActions.JournalRefresh(mode)); return of(null).pipe( withLatestFrom( this.store$.pipe( select(getJournalState), map(getLastRefreshed), ), this.store$.pipe( select(getJournalState), map(getSlots), ), ), switchMap(([action, lastRefreshed, slots]) => { return this.journalProvider .getJournal(lastRefreshed) .pipe( map((journalData: ExaminerWorkSchedule) => this.slotProvider.detectSlotChanges(slots, journalData)), map((slots: any[]) => groupBy(slots, this.slotProvider.getSlotDate)), map((slots: {[k: string]: SlotItem[]}) => this.slotProvider.extendWithEmptyDays(slots)), map((slots: {[k: string]: SlotItem[]}) => this.slotProvider.getRelevantSlots(slots)), map((slots: {[k: string]: SlotItem[]}) => new journalActions.LoadJournalSuccess(slots)), ); }), ); } @Effect() journal$ = this.actions$.pipe( ofType(journalActions.LOAD_JOURNAL_SILENT), switchMap( () => this.callJournalProvider$(JournalRefreshModes.AUTOMATIC).pipe( catchError((err) => { // TODO: We don't need to use the store here, just return the action wrapped in an Observable this.store$.dispatch(new journalActions.JournalRefreshError('AutomaticJournalRefresh', err.message)); console.log(err); return of(new journalActions.LoadJournalSilentFailure(err)); }), ), ), ); @Effect() loadJournal$ = this.actions$.pipe( ofType(journalActions.LOAD_JOURNAL), switchMap( () => this.callJournalProvider$(JournalRefreshModes.MANUAL).pipe( catchError((err) => { // TODO: We don't need to use the store here, just return the action wrapped in an Observable this.store$.dispatch(new journalActions.JournalRefreshError('ManualJournalRefresh', err.message)); return of(new journalActions.LoadJournalFailure(err)); }), ), ), ); @Effect() pollingSetup$ = this.actions$.pipe( ofType(journalActions.SETUP_JOURNAL_POLLING), switchMap(() => { // Switch map the manual refreshes so they restart the timer. const manualRefreshes$ = this.actions$.pipe( ofType(journalActions.LOAD_JOURNAL), // Initial emission so poll doesn't wait until the first manual refresh startWith(null), ); const pollTimer$ = manualRefreshes$.pipe( switchMap(() => interval(this.appConfig.getAppConfig().journal.autoRefreshInterval)), ); const pollsWhileOnline$ = pollTimer$ .pipe( withLatestFrom(this.networkStateProvider.onNetworkChange()), filter(([_, connectionStatus]) => connectionStatus === ConnectionStatus.ONLINE), ); return pollsWhileOnline$ .pipe( takeUntil(this.actions$.pipe(ofType(journalActions.STOP_JOURNAL_POLLING))), mapTo({ type: journalActions.LOAD_JOURNAL_SILENT }), ); }), ); @Effect() selectPreviousDayEffect$ = this.actions$.pipe( ofType(journalActions.SELECT_PREVIOUS_DAY), withLatestFrom( this.store$.pipe( select(getJournalState), map(getSelectedDate), ), this.store$.pipe( select(getJournalState), map(canNavigateToPreviousDay), ), ), switchMap(([action, selectedDate, canNavigateToPreviousDay]) => { if (!canNavigateToPreviousDay) { return of(); } const previousDay = DateTime.at(selectedDate).add(-1, Duration.DAY).format('YYYY-MM-DD'); // TODO: We don't need to use the store here, just return the action wrapped in an Observable this.store$.dispatch(new journalActions.JournalNavigateDay(previousDay)); return of(new journalActions.SetSelectedDate(previousDay)); }), ); @Effect() selectNextDayEffect$ = this.actions$.pipe( ofType(journalActions.SELECT_NEXT_DAY), withLatestFrom( this.store$.pipe( select(getJournalState), map(getSelectedDate), ), this.store$.pipe( select(getJournalState), map(canNavigateToNextDay), ), ), switchMap(([action, selectedDate, canNavigateToNextDay]) => { if (!canNavigateToNextDay) { return of(); } const nextDay = DateTime.at(selectedDate).add(1, Duration.DAY).format('YYYY-MM-DD'); // TODO: We don't need to use the store here, just return the action wrapped in an Observable this.store$.dispatch(new journalActions.JournalNavigateDay(nextDay)); return of(new journalActions.SetSelectedDate(nextDay)); }), ); }
36.809249
113
0.659862
0790bec888dc647e0744bfb6470dd5f7bf9430a9
29,798
cc
C++
INET_EC/networklayer/ipv6/IPv6Datagram_m.cc
LarryNguyen/ECSim-
0d3f848642e49845ed7e4c7b97dd16bd3d65ede5
[ "Apache-2.0" ]
null
null
null
INET_EC/networklayer/ipv6/IPv6Datagram_m.cc
LarryNguyen/ECSim-
0d3f848642e49845ed7e4c7b97dd16bd3d65ede5
[ "Apache-2.0" ]
null
null
null
INET_EC/networklayer/ipv6/IPv6Datagram_m.cc
LarryNguyen/ECSim-
0d3f848642e49845ed7e4c7b97dd16bd3d65ede5
[ "Apache-2.0" ]
1
2018-10-09T05:00:05.000Z
2018-10-09T05:00:05.000Z
// // Generated file, do not edit! Created by nedtool 5.1 from inet/networklayer/ipv6/IPv6Datagram.msg. // // Disable warnings about unused variables, empty switch stmts, etc: #ifdef _MSC_VER # pragma warning(disable:4101) # pragma warning(disable:4065) #endif #if defined(__clang__) # pragma clang diagnostic ignored "-Wshadow" # pragma clang diagnostic ignored "-Wconversion" # pragma clang diagnostic ignored "-Wunused-parameter" # pragma clang diagnostic ignored "-Wc++98-compat" # pragma clang diagnostic ignored "-Wunreachable-code-break" # pragma clang diagnostic ignored "-Wold-style-cast" #elif defined(__GNUC__) # pragma GCC diagnostic ignored "-Wshadow" # pragma GCC diagnostic ignored "-Wconversion" # pragma GCC diagnostic ignored "-Wunused-parameter" # pragma GCC diagnostic ignored "-Wold-style-cast" # pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn" # pragma GCC diagnostic ignored "-Wfloat-conversion" #endif #include <iostream> #include <sstream> #include "IPv6Datagram_m.h" namespace omnetpp { // Template pack/unpack rules. They are declared *after* a1l type-specific pack functions for multiple reasons. // They are in the omnetpp namespace, to allow them to be found by argument-dependent lookup via the cCommBuffer argument // Packing/unpacking an std::vector template<typename T, typename A> void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::vector<T,A>& v) { int n = v.size(); doParsimPacking(buffer, n); for (int i = 0; i < n; i++) doParsimPacking(buffer, v[i]); } template<typename T, typename A> void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::vector<T,A>& v) { int n; doParsimUnpacking(buffer, n); v.resize(n); for (int i = 0; i < n; i++) doParsimUnpacking(buffer, v[i]); } // Packing/unpacking an std::list template<typename T, typename A> void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::list<T,A>& l) { doParsimPacking(buffer, (int)l.size()); for (typename std::list<T,A>::const_iterator it = l.begin(); it != l.end(); ++it) doParsimPacking(buffer, (T&)*it); } template<typename T, typename A> void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::list<T,A>& l) { int n; doParsimUnpacking(buffer, n); for (int i=0; i<n; i++) { l.push_back(T()); doParsimUnpacking(buffer, l.back()); } } // Packing/unpacking an std::set template<typename T, typename Tr, typename A> void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::set<T,Tr,A>& s) { doParsimPacking(buffer, (int)s.size()); for (typename std::set<T,Tr,A>::const_iterator it = s.begin(); it != s.end(); ++it) doParsimPacking(buffer, *it); } template<typename T, typename Tr, typename A> void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::set<T,Tr,A>& s) { int n; doParsimUnpacking(buffer, n); for (int i=0; i<n; i++) { T x; doParsimUnpacking(buffer, x); s.insert(x); } } // Packing/unpacking an std::map template<typename K, typename V, typename Tr, typename A> void doParsimPacking(omnetpp::cCommBuffer *buffer, const std::map<K,V,Tr,A>& m) { doParsimPacking(buffer, (int)m.size()); for (typename std::map<K,V,Tr,A>::const_iterator it = m.begin(); it != m.end(); ++it) { doParsimPacking(buffer, it->first); doParsimPacking(buffer, it->second); } } template<typename K, typename V, typename Tr, typename A> void doParsimUnpacking(omnetpp::cCommBuffer *buffer, std::map<K,V,Tr,A>& m) { int n; doParsimUnpacking(buffer, n); for (int i=0; i<n; i++) { K k; V v; doParsimUnpacking(buffer, k); doParsimUnpacking(buffer, v); m[k] = v; } } // Default pack/unpack function for arrays template<typename T> void doParsimArrayPacking(omnetpp::cCommBuffer *b, const T *t, int n) { for (int i = 0; i < n; i++) doParsimPacking(b, t[i]); } template<typename T> void doParsimArrayUnpacking(omnetpp::cCommBuffer *b, T *t, int n) { for (int i = 0; i < n; i++) doParsimUnpacking(b, t[i]); } // Default rule to prevent compiler from choosing base class' doParsimPacking() function template<typename T> void doParsimPacking(omnetpp::cCommBuffer *, const T& t) { throw omnetpp::cRuntimeError("Parsim error: No doParsimPacking() function for type %s", omnetpp::opp_typename(typeid(t))); } template<typename T> void doParsimUnpacking(omnetpp::cCommBuffer *, T& t) { throw omnetpp::cRuntimeError("Parsim error: No doParsimUnpacking() function for type %s", omnetpp::opp_typename(typeid(t))); } } // namespace omnetpp namespace inet { // forward template<typename T, typename A> std::ostream& operator<<(std::ostream& out, const std::vector<T,A>& vec); // Template rule which fires if a struct or class doesn't have operator<< template<typename T> inline std::ostream& operator<<(std::ostream& out,const T&) {return out;} // operator<< for std::vector<T> template<typename T, typename A> inline std::ostream& operator<<(std::ostream& out, const std::vector<T,A>& vec) { out.put('{'); for(typename std::vector<T,A>::const_iterator it = vec.begin(); it != vec.end(); ++it) { if (it != vec.begin()) { out.put(','); out.put(' '); } out << *it; } out.put('}'); char buf[32]; sprintf(buf, " (size=%u)", (unsigned int)vec.size()); out.write(buf, strlen(buf)); return out; } IPv6Datagram_Base::IPv6Datagram_Base(const char *name, short kind) : ::omnetpp::cPacket(name,kind) { this->trafficClass = 0; this->flowLabel = 0; this->hopLimit = 0; this->transportProtocol = 0; } IPv6Datagram_Base::IPv6Datagram_Base(const IPv6Datagram_Base& other) : ::omnetpp::cPacket(other) { copy(other); } IPv6Datagram_Base::~IPv6Datagram_Base() { } IPv6Datagram_Base& IPv6Datagram_Base::operator=(const IPv6Datagram_Base& other) { if (this==&other) return *this; ::omnetpp::cPacket::operator=(other); copy(other); return *this; } void IPv6Datagram_Base::copy(const IPv6Datagram_Base& other) { this->srcAddress = other.srcAddress; this->destAddress = other.destAddress; this->trafficClass = other.trafficClass; this->flowLabel = other.flowLabel; this->hopLimit = other.hopLimit; this->transportProtocol = other.transportProtocol; } void IPv6Datagram_Base::parsimPack(omnetpp::cCommBuffer *b) const { ::omnetpp::cPacket::parsimPack(b); doParsimPacking(b,this->srcAddress); doParsimPacking(b,this->destAddress); doParsimPacking(b,this->trafficClass); // field diffServCodePoint is abstract -- please do packing in customized class // field explicitCongestionNotification is abstract -- please do packing in customized class doParsimPacking(b,this->flowLabel); doParsimPacking(b,this->hopLimit); doParsimPacking(b,this->transportProtocol); // field extensionHeader is abstract -- please do packing in customized class } void IPv6Datagram_Base::parsimUnpack(omnetpp::cCommBuffer *b) { ::omnetpp::cPacket::parsimUnpack(b); doParsimUnpacking(b,this->srcAddress); doParsimUnpacking(b,this->destAddress); doParsimUnpacking(b,this->trafficClass); // field diffServCodePoint is abstract -- please do unpacking in customized class // field explicitCongestionNotification is abstract -- please do unpacking in customized class doParsimUnpacking(b,this->flowLabel); doParsimUnpacking(b,this->hopLimit); doParsimUnpacking(b,this->transportProtocol); // field extensionHeader is abstract -- please do unpacking in customized class } IPv6Address& IPv6Datagram_Base::getSrcAddress() { return this->srcAddress; } void IPv6Datagram_Base::setSrcAddress(const IPv6Address& srcAddress) { this->srcAddress = srcAddress; } IPv6Address& IPv6Datagram_Base::getDestAddress() { return this->destAddress; } void IPv6Datagram_Base::setDestAddress(const IPv6Address& destAddress) { this->destAddress = destAddress; } unsigned char IPv6Datagram_Base::getTrafficClass() const { return this->trafficClass; } void IPv6Datagram_Base::setTrafficClass(unsigned char trafficClass) { this->trafficClass = trafficClass; } unsigned int IPv6Datagram_Base::getFlowLabel() const { return this->flowLabel; } void IPv6Datagram_Base::setFlowLabel(unsigned int flowLabel) { this->flowLabel = flowLabel; } short IPv6Datagram_Base::getHopLimit() const { return this->hopLimit; } void IPv6Datagram_Base::setHopLimit(short hopLimit) { this->hopLimit = hopLimit; } int IPv6Datagram_Base::getTransportProtocol() const { return this->transportProtocol; } void IPv6Datagram_Base::setTransportProtocol(int transportProtocol) { this->transportProtocol = transportProtocol; } class IPv6DatagramDescriptor : public omnetpp::cClassDescriptor { private: mutable const char **propertynames; public: IPv6DatagramDescriptor(); virtual ~IPv6DatagramDescriptor(); virtual bool doesSupport(omnetpp::cObject *obj) const override; virtual const char **getPropertyNames() const override; virtual const char *getProperty(const char *propertyname) const override; virtual int getFieldCount() const override; virtual const char *getFieldName(int field) const override; virtual int findField(const char *fieldName) const override; virtual unsigned int getFieldTypeFlags(int field) const override; virtual const char *getFieldTypeString(int field) const override; virtual const char **getFieldPropertyNames(int field) const override; virtual const char *getFieldProperty(int field, const char *propertyname) const override; virtual int getFieldArraySize(void *object, int field) const override; virtual const char *getFieldDynamicTypeString(void *object, int field, int i) const override; virtual std::string getFieldValueAsString(void *object, int field, int i) const override; virtual bool setFieldValueAsString(void *object, int field, int i, const char *value) const override; virtual const char *getFieldStructName(int field) const override; virtual void *getFieldStructValuePointer(void *object, int field, int i) const override; }; Register_ClassDescriptor(IPv6DatagramDescriptor) IPv6DatagramDescriptor::IPv6DatagramDescriptor() : omnetpp::cClassDescriptor("inet::IPv6Datagram", "omnetpp::cPacket") { propertynames = nullptr; } IPv6DatagramDescriptor::~IPv6DatagramDescriptor() { delete[] propertynames; } bool IPv6DatagramDescriptor::doesSupport(omnetpp::cObject *obj) const { return dynamic_cast<IPv6Datagram_Base *>(obj)!=nullptr; } const char **IPv6DatagramDescriptor::getPropertyNames() const { if (!propertynames) { static const char *names[] = { "customize", nullptr }; omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); const char **basenames = basedesc ? basedesc->getPropertyNames() : nullptr; propertynames = mergeLists(basenames, names); } return propertynames; } const char *IPv6DatagramDescriptor::getProperty(const char *propertyname) const { if (!strcmp(propertyname,"customize")) return "true"; omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); return basedesc ? basedesc->getProperty(propertyname) : nullptr; } int IPv6DatagramDescriptor::getFieldCount() const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); return basedesc ? 9+basedesc->getFieldCount() : 9; } unsigned int IPv6DatagramDescriptor::getFieldTypeFlags(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldTypeFlags(field); field -= basedesc->getFieldCount(); } static unsigned int fieldTypeFlags[] = { FD_ISCOMPOUND, FD_ISCOMPOUND, FD_ISEDITABLE, FD_ISEDITABLE, FD_ISEDITABLE, FD_ISEDITABLE, FD_ISEDITABLE, FD_ISEDITABLE, FD_ISARRAY | FD_ISCOMPOUND, }; return (field>=0 && field<9) ? fieldTypeFlags[field] : 0; } const char *IPv6DatagramDescriptor::getFieldName(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldName(field); field -= basedesc->getFieldCount(); } static const char *fieldNames[] = { "srcAddress", "destAddress", "trafficClass", "diffServCodePoint", "explicitCongestionNotification", "flowLabel", "hopLimit", "transportProtocol", "extensionHeader", }; return (field>=0 && field<9) ? fieldNames[field] : nullptr; } int IPv6DatagramDescriptor::findField(const char *fieldName) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); int base = basedesc ? basedesc->getFieldCount() : 0; if (fieldName[0]=='s' && strcmp(fieldName, "srcAddress")==0) return base+0; if (fieldName[0]=='d' && strcmp(fieldName, "destAddress")==0) return base+1; if (fieldName[0]=='t' && strcmp(fieldName, "trafficClass")==0) return base+2; if (fieldName[0]=='d' && strcmp(fieldName, "diffServCodePoint")==0) return base+3; if (fieldName[0]=='e' && strcmp(fieldName, "explicitCongestionNotification")==0) return base+4; if (fieldName[0]=='f' && strcmp(fieldName, "flowLabel")==0) return base+5; if (fieldName[0]=='h' && strcmp(fieldName, "hopLimit")==0) return base+6; if (fieldName[0]=='t' && strcmp(fieldName, "transportProtocol")==0) return base+7; if (fieldName[0]=='e' && strcmp(fieldName, "extensionHeader")==0) return base+8; return basedesc ? basedesc->findField(fieldName) : -1; } const char *IPv6DatagramDescriptor::getFieldTypeString(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldTypeString(field); field -= basedesc->getFieldCount(); } static const char *fieldTypeStrings[] = { "IPv6Address", "IPv6Address", "unsigned char", "int", "int", "unsigned int", "short", "int", "IPv6ExtensionHeaderPtr", }; return (field>=0 && field<9) ? fieldTypeStrings[field] : nullptr; } const char **IPv6DatagramDescriptor::getFieldPropertyNames(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldPropertyNames(field); field -= basedesc->getFieldCount(); } switch (field) { case 7: { static const char *names[] = { "enum", nullptr }; return names; } default: return nullptr; } } const char *IPv6DatagramDescriptor::getFieldProperty(int field, const char *propertyname) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldProperty(field, propertyname); field -= basedesc->getFieldCount(); } switch (field) { case 7: if (!strcmp(propertyname,"enum")) return "inet::IPProtocolId"; return nullptr; default: return nullptr; } } int IPv6DatagramDescriptor::getFieldArraySize(void *object, int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldArraySize(object, field); field -= basedesc->getFieldCount(); } IPv6Datagram_Base *pp = (IPv6Datagram_Base *)object; (void)pp; switch (field) { case 8: return pp->getExtensionHeaderArraySize(); default: return 0; } } const char *IPv6DatagramDescriptor::getFieldDynamicTypeString(void *object, int field, int i) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldDynamicTypeString(object,field,i); field -= basedesc->getFieldCount(); } IPv6Datagram_Base *pp = (IPv6Datagram_Base *)object; (void)pp; switch (field) { default: return nullptr; } } std::string IPv6DatagramDescriptor::getFieldValueAsString(void *object, int field, int i) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldValueAsString(object,field,i); field -= basedesc->getFieldCount(); } IPv6Datagram_Base *pp = (IPv6Datagram_Base *)object; (void)pp; switch (field) { case 0: {std::stringstream out; out << pp->getSrcAddress(); return out.str();} case 1: {std::stringstream out; out << pp->getDestAddress(); return out.str();} case 2: return ulong2string(pp->getTrafficClass()); case 3: return long2string(pp->getDiffServCodePoint()); case 4: return long2string(pp->getExplicitCongestionNotification()); case 5: return ulong2string(pp->getFlowLabel()); case 6: return long2string(pp->getHopLimit()); case 7: return enum2string(pp->getTransportProtocol(), "inet::IPProtocolId"); case 8: {std::stringstream out; out << pp->getExtensionHeader(i); return out.str();} default: return ""; } } bool IPv6DatagramDescriptor::setFieldValueAsString(void *object, int field, int i, const char *value) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->setFieldValueAsString(object,field,i,value); field -= basedesc->getFieldCount(); } IPv6Datagram_Base *pp = (IPv6Datagram_Base *)object; (void)pp; switch (field) { case 2: pp->setTrafficClass(string2ulong(value)); return true; case 3: pp->setDiffServCodePoint(string2long(value)); return true; case 4: pp->setExplicitCongestionNotification(string2long(value)); return true; case 5: pp->setFlowLabel(string2ulong(value)); return true; case 6: pp->setHopLimit(string2long(value)); return true; case 7: pp->setTransportProtocol((inet::IPProtocolId)string2enum(value, "inet::IPProtocolId")); return true; default: return false; } } const char *IPv6DatagramDescriptor::getFieldStructName(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldStructName(field); field -= basedesc->getFieldCount(); } switch (field) { case 0: return omnetpp::opp_typename(typeid(IPv6Address)); case 1: return omnetpp::opp_typename(typeid(IPv6Address)); case 8: return omnetpp::opp_typename(typeid(IPv6ExtensionHeaderPtr)); default: return nullptr; }; } void *IPv6DatagramDescriptor::getFieldStructValuePointer(void *object, int field, int i) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldStructValuePointer(object, field, i); field -= basedesc->getFieldCount(); } IPv6Datagram_Base *pp = (IPv6Datagram_Base *)object; (void)pp; switch (field) { case 0: return (void *)(&pp->getSrcAddress()); break; case 1: return (void *)(&pp->getDestAddress()); break; case 8: return (void *)(&pp->getExtensionHeader(i)); break; default: return nullptr; } } Register_Class(IPv6ExtensionHeader) IPv6ExtensionHeader::IPv6ExtensionHeader() : ::omnetpp::cObject() { this->extensionType = 0; this->byteLength = 0; } IPv6ExtensionHeader::IPv6ExtensionHeader(const IPv6ExtensionHeader& other) : ::omnetpp::cObject(other) { copy(other); } IPv6ExtensionHeader::~IPv6ExtensionHeader() { } IPv6ExtensionHeader& IPv6ExtensionHeader::operator=(const IPv6ExtensionHeader& other) { if (this==&other) return *this; ::omnetpp::cObject::operator=(other); copy(other); return *this; } void IPv6ExtensionHeader::copy(const IPv6ExtensionHeader& other) { this->extensionType = other.extensionType; this->byteLength = other.byteLength; } void IPv6ExtensionHeader::parsimPack(omnetpp::cCommBuffer *b) const { doParsimPacking(b,this->extensionType); doParsimPacking(b,this->byteLength); } void IPv6ExtensionHeader::parsimUnpack(omnetpp::cCommBuffer *b) { doParsimUnpacking(b,this->extensionType); doParsimUnpacking(b,this->byteLength); } short IPv6ExtensionHeader::getExtensionType() const { return this->extensionType; } void IPv6ExtensionHeader::setExtensionType(short extensionType) { this->extensionType = extensionType; } short IPv6ExtensionHeader::getByteLength() const { return this->byteLength; } void IPv6ExtensionHeader::setByteLength(short byteLength) { this->byteLength = byteLength; } class IPv6ExtensionHeaderDescriptor : public omnetpp::cClassDescriptor { private: mutable const char **propertynames; public: IPv6ExtensionHeaderDescriptor(); virtual ~IPv6ExtensionHeaderDescriptor(); virtual bool doesSupport(omnetpp::cObject *obj) const override; virtual const char **getPropertyNames() const override; virtual const char *getProperty(const char *propertyname) const override; virtual int getFieldCount() const override; virtual const char *getFieldName(int field) const override; virtual int findField(const char *fieldName) const override; virtual unsigned int getFieldTypeFlags(int field) const override; virtual const char *getFieldTypeString(int field) const override; virtual const char **getFieldPropertyNames(int field) const override; virtual const char *getFieldProperty(int field, const char *propertyname) const override; virtual int getFieldArraySize(void *object, int field) const override; virtual const char *getFieldDynamicTypeString(void *object, int field, int i) const override; virtual std::string getFieldValueAsString(void *object, int field, int i) const override; virtual bool setFieldValueAsString(void *object, int field, int i, const char *value) const override; virtual const char *getFieldStructName(int field) const override; virtual void *getFieldStructValuePointer(void *object, int field, int i) const override; }; Register_ClassDescriptor(IPv6ExtensionHeaderDescriptor) IPv6ExtensionHeaderDescriptor::IPv6ExtensionHeaderDescriptor() : omnetpp::cClassDescriptor("inet::IPv6ExtensionHeader", "omnetpp::cObject") { propertynames = nullptr; } IPv6ExtensionHeaderDescriptor::~IPv6ExtensionHeaderDescriptor() { delete[] propertynames; } bool IPv6ExtensionHeaderDescriptor::doesSupport(omnetpp::cObject *obj) const { return dynamic_cast<IPv6ExtensionHeader *>(obj)!=nullptr; } const char **IPv6ExtensionHeaderDescriptor::getPropertyNames() const { if (!propertynames) { static const char *names[] = { nullptr }; omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); const char **basenames = basedesc ? basedesc->getPropertyNames() : nullptr; propertynames = mergeLists(basenames, names); } return propertynames; } const char *IPv6ExtensionHeaderDescriptor::getProperty(const char *propertyname) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); return basedesc ? basedesc->getProperty(propertyname) : nullptr; } int IPv6ExtensionHeaderDescriptor::getFieldCount() const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); return basedesc ? 2+basedesc->getFieldCount() : 2; } unsigned int IPv6ExtensionHeaderDescriptor::getFieldTypeFlags(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldTypeFlags(field); field -= basedesc->getFieldCount(); } static unsigned int fieldTypeFlags[] = { FD_ISEDITABLE, FD_ISEDITABLE, }; return (field>=0 && field<2) ? fieldTypeFlags[field] : 0; } const char *IPv6ExtensionHeaderDescriptor::getFieldName(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldName(field); field -= basedesc->getFieldCount(); } static const char *fieldNames[] = { "extensionType", "byteLength", }; return (field>=0 && field<2) ? fieldNames[field] : nullptr; } int IPv6ExtensionHeaderDescriptor::findField(const char *fieldName) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); int base = basedesc ? basedesc->getFieldCount() : 0; if (fieldName[0]=='e' && strcmp(fieldName, "extensionType")==0) return base+0; if (fieldName[0]=='b' && strcmp(fieldName, "byteLength")==0) return base+1; return basedesc ? basedesc->findField(fieldName) : -1; } const char *IPv6ExtensionHeaderDescriptor::getFieldTypeString(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldTypeString(field); field -= basedesc->getFieldCount(); } static const char *fieldTypeStrings[] = { "short", "short", }; return (field>=0 && field<2) ? fieldTypeStrings[field] : nullptr; } const char **IPv6ExtensionHeaderDescriptor::getFieldPropertyNames(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldPropertyNames(field); field -= basedesc->getFieldCount(); } switch (field) { default: return nullptr; } } const char *IPv6ExtensionHeaderDescriptor::getFieldProperty(int field, const char *propertyname) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldProperty(field, propertyname); field -= basedesc->getFieldCount(); } switch (field) { default: return nullptr; } } int IPv6ExtensionHeaderDescriptor::getFieldArraySize(void *object, int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldArraySize(object, field); field -= basedesc->getFieldCount(); } IPv6ExtensionHeader *pp = (IPv6ExtensionHeader *)object; (void)pp; switch (field) { default: return 0; } } const char *IPv6ExtensionHeaderDescriptor::getFieldDynamicTypeString(void *object, int field, int i) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldDynamicTypeString(object,field,i); field -= basedesc->getFieldCount(); } IPv6ExtensionHeader *pp = (IPv6ExtensionHeader *)object; (void)pp; switch (field) { default: return nullptr; } } std::string IPv6ExtensionHeaderDescriptor::getFieldValueAsString(void *object, int field, int i) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldValueAsString(object,field,i); field -= basedesc->getFieldCount(); } IPv6ExtensionHeader *pp = (IPv6ExtensionHeader *)object; (void)pp; switch (field) { case 0: return long2string(pp->getExtensionType()); case 1: return long2string(pp->getByteLength()); default: return ""; } } bool IPv6ExtensionHeaderDescriptor::setFieldValueAsString(void *object, int field, int i, const char *value) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->setFieldValueAsString(object,field,i,value); field -= basedesc->getFieldCount(); } IPv6ExtensionHeader *pp = (IPv6ExtensionHeader *)object; (void)pp; switch (field) { case 0: pp->setExtensionType(string2long(value)); return true; case 1: pp->setByteLength(string2long(value)); return true; default: return false; } } const char *IPv6ExtensionHeaderDescriptor::getFieldStructName(int field) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldStructName(field); field -= basedesc->getFieldCount(); } switch (field) { default: return nullptr; }; } void *IPv6ExtensionHeaderDescriptor::getFieldStructValuePointer(void *object, int field, int i) const { omnetpp::cClassDescriptor *basedesc = getBaseClassDescriptor(); if (basedesc) { if (field < basedesc->getFieldCount()) return basedesc->getFieldStructValuePointer(object, field, i); field -= basedesc->getFieldCount(); } IPv6ExtensionHeader *pp = (IPv6ExtensionHeader *)object; (void)pp; switch (field) { default: return nullptr; } } } // namespace inet
33.368421
139
0.692261
7541929ad5a5e6e61c4373bda7a8083214feb224
32
css
CSS
public/css/modules.css
matthill500/gradr2.1
07072a5674a79f44b761ca4b01ff6bf641a90c44
[ "MIT" ]
null
null
null
public/css/modules.css
matthill500/gradr2.1
07072a5674a79f44b761ca4b01ff6bf641a90c44
[ "MIT" ]
4
2021-03-10T05:46:37.000Z
2022-02-18T19:20:19.000Z
public/css/modules.css
EoinClancy92/gradr2.3
4532e7569c6490dac9c97d98482e3eb7e0863726
[ "MIT" ]
null
null
null
.questions{ margin-top:2em; }
8
17
0.65625
a34835667767291bc9a1271b0261f5a6cd4ff6ee
595
java
Java
src/main/java/Application.java
yuwen41200/personal-calendar
725ce3d4f9d4e6c02ba4f1879c4aec813b4ed59f
[ "MIT" ]
null
null
null
src/main/java/Application.java
yuwen41200/personal-calendar
725ce3d4f9d4e6c02ba4f1879c4aec813b4ed59f
[ "MIT" ]
null
null
null
src/main/java/Application.java
yuwen41200/personal-calendar
725ce3d4f9d4e6c02ba4f1879c4aec813b4ed59f
[ "MIT" ]
null
null
null
/** * The application entry point. */ public class Application { /** * A String representing the application version. */ public static final String version = "v0.99"; /** * Start the application with MVC objects. * @param args optional arguments */ public static void main(String args[]) { Model model = new Model(); View view = new View(); Controller controller = new Controller(); model.init(); view.init(model, controller, version); controller.init(model, view); controller.run(); } }
22.037037
53
0.588235
76ec14e994e4c14304ac1d09d5ce7d30b94a2598
1,159
dart
Dart
frontend-manager/lib/core/redux/connectors/space_info/edit_equipment.dart
UNIZAR-30249-20220-uCampus/frontend
f00a441ba130a09a93e956f51210acab7362ac9c
[ "MIT" ]
null
null
null
frontend-manager/lib/core/redux/connectors/space_info/edit_equipment.dart
UNIZAR-30249-20220-uCampus/frontend
f00a441ba130a09a93e956f51210acab7362ac9c
[ "MIT" ]
null
null
null
frontend-manager/lib/core/redux/connectors/space_info/edit_equipment.dart
UNIZAR-30249-20220-uCampus/frontend
f00a441ba130a09a93e956f51210acab7362ac9c
[ "MIT" ]
null
null
null
import 'package:async_redux/async_redux.dart'; import 'package:flutter/material.dart'; import 'package:ucampus_lib/core/models/equipment.dart'; import 'package:ucampus_lib/core/models/space.dart'; import 'package:ucampus_lib/core/redux/app_state.dart'; import 'package:ucampus_manager/ui/widgets/space_info/edit_equipment_form.dart'; import 'package:ucampus_lib/core/redux/actions/edit_equipment_actions.dart'; class EditEquipmentConnector extends StatelessWidget { final Space space; EditEquipmentConnector({ @required this.space, }); @override Widget build(BuildContext context) { return StoreConnector<AppState, ViewModel>( model: ViewModel(), builder: (context, model) => EditEquipmentForm(space: space, onEdit: model.onEdit), ); } } class ViewModel extends BaseModel<AppState> { ViewModel(); Function(String, List<Equipment>) onEdit; ViewModel.build({ @required this.onEdit, }) : super(equals: []); @override BaseModel fromStore() => ViewModel.build( onEdit: (spaceID, newEquipment) => dispatch(EditEquipmentAction( newEquipment: newEquipment, spaceID: spaceID))); }
29.717949
80
0.734254
a1480248f870df17b000a83fd769eeae8711aa38
6,994
ts
TypeScript
core/src/utils/common.ts
DiogoVCS/jeep
bc1d6c40ad1d48bb66ba94f066dedcc7645c2071
[ "MIT" ]
21
2020-01-22T04:33:39.000Z
2021-11-14T20:21:12.000Z
core/src/utils/common.ts
DiogoVCS/jeep
bc1d6c40ad1d48bb66ba94f066dedcc7645c2071
[ "MIT" ]
30
2020-01-29T18:46:35.000Z
2022-03-02T09:46:23.000Z
core/src/utils/common.ts
DiogoVCS/jeep
bc1d6c40ad1d48bb66ba94f066dedcc7645c2071
[ "MIT" ]
7
2020-03-02T16:51:52.000Z
2021-06-11T06:00:03.000Z
export function debounce(context,func:Function,wait:number,immediate:boolean) { let timeout: NodeJS.Timer; return () => { const args:IArguments = arguments; const later = () => { timeout = null; if (!immediate) func.apply(context, args); }; const callNow:boolean = immediate && !timeout; clearTimeout(timeout); timeout = setTimeout(later, wait); if (callNow) func.apply(context, args); }; } export const getValueFromCss = (data:string,type:string): Promise<number> => { return new Promise ((resolve) => { if(data.indexOf('calc') === 0) { const formula: string = data.substring(data.indexOf('(')+1,data.length-1).replace(/ +/g, ' '); const arr: Array<string> = formula.split(' '); let retArr: Array<string> = []; let retValue: string; for (let i:number = 0; i < arr.length; i++) { if(arr[i] !== '+' && arr[i] !== '-' && arr[i] !== '*' && arr[i] !== '/') { getValueFromCss(arr[i],type).then(value => { retArr[i] = value.toString() if(i === arr.length -1) { resolve(evaluateString(retArr.join().replace(/,/g,' '))); } }); } else if (arr[i] !== "") { retValue = arr[i]; retArr[i] = retValue } } } else if(data.slice(-2) === "px") { resolve(Number(data.slice(0,-2))); } else if(data.slice(-1) === "%") { if(type === 'x') { resolve(Number(data.slice(0,-1)) * window.innerWidth / 100); } else if(type === 'y') { resolve(Number(data.slice(0,-1)) * window.innerHeight / 100); } else { resolve(null); } } else if(data.slice(-2) === 'vw') { resolve(Number(data.slice(0,-2)) * window.innerWidth / 100); } else if(data.slice(-2) === 'vh') { resolve(Number(data.slice(0,-2)) * window.innerHeight / 100); } else if(data.slice(-4) === 'vmin') { const v:number = Math.min(window.innerWidth,window.innerHeight); resolve(Number(data.slice(0,-4)) * v / 100); } else if(data.slice(-4) === 'vmax') { const v:number = Math.max(window.innerWidth,window.innerHeight); resolve(Number(data.slice(0,-4)) * v / 100); } else { resolve(null); } }); } export const cssVar = (elem: any,name:string,value?:string): string => { if(name[0]!='-') name = '--'+name;//allow passing with or without -- if(value) elem.style.setProperty(name, value); // below required to work with Unit Tests let propVal: string = elem.style.getPropertyValue(name); propVal = propVal ? propVal : window.getComputedStyle(elem).getPropertyValue(name); return propVal.trim(); } export const getDim = (css:string, wind:number, pad:string): number =>{ let w: number; let vpad:number = 0; if(pad !== "0"){ if (pad.length > 2 && pad.slice(-2) === "px") { vpad = parseFloat(pad.split('px',2)[0]); } } if(css && css !== "0"){ if (css.length > 1 && css.slice(-1) === "%") { w = parseFloat(css.split('%',2)[0]); if (w > 100) w = 100; let ret:number = Math.round(((w * wind / 100) -vpad)); return ret; } else if (css.length > 2 && css.slice(-2) === "px") { w = parseFloat(css.split('px',2)[0]); if (w > (wind-vpad)) { return wind-vpad; } else { return w-vpad; } } else { return wind-vpad; } } else { return wind-vpad; } } export const convertCSSNumber = (css:string): number => { if (css.length > 2 && css.slice(-2) === "px") { return parseFloat(css.split('px',2)[0]); } else { return 0; } } export const convertCSSBoolean = (css:string): boolean => { if (css.length > 2 && css.slice(-2) === "ue") { return true; } else { return false; } } export const getInstanceCSSProperties = (parent:HTMLElement | Element,instanceId:string): Promise<any> => { let prop:any = null; if(instanceId != null && parent != null) { if(parent.previousElementSibling !=null && parent.previousElementSibling.tagName === 'STYLE') { prop = getCssPropertyFromInnerHTML(parent.previousElementSibling.innerHTML,instanceId); if (prop != null) { return prop; } else { return getInstanceCSSProperties(parent.previousElementSibling,instanceId); } } else { return getInstanceCSSProperties(parent.parentElement,instanceId); } } return prop; } export const getCssPropertyFromInnerHTML = (innerHTML:string,instanceId:string): any => { let prop:any = null; if(innerHTML.length > 0 && instanceId !=null) { const str: string = innerHTML.replace(/}/g, '#').replace(/{/g,'#').replace(/ /g,'').replace(/\n/g,''); const arr: Array<string> = str.split('#'); let id:string = instanceId; if( instanceId.charAt( 0 ) === '0' ) { id = instanceId.slice( 1 ); } const ind:number = arr.indexOf(id); if(ind > -1) { const arrInst:Array<string> =arr[ind+1].replace(/:/g,';').split(';').slice(0,-1); if(arrInst.length % 2 === 0) { prop = {}; for(let i: number =0;i< arrInst.length; i+=2) { prop[arrInst[i].replace(/-/g,'')] = arrInst[i+1]; } return prop; } } } return prop; } export const getCssPropertyFromString = async (cstyle:string, type?:string): Promise<any> => { let prop: any = null; const stype:string = type ? `--${type}-` : `--`; const styles = cstyle.replace(/:host{/g,'').replace(/}/g,'').replace(/[\n\r]+/g, '').replace(/:/g,';').split(';').slice(0,-1); if(styles.length % 2 === 0) { prop = {}; for(let i: number =0;i< styles.length; i+=2) { prop[styles[i].replace(stype,'').replace(/(\-\w)/g, (m) => {return m[1].toUpperCase();}).trim()] = styles[i+1].trim(); } } return prop; } export const evaluateString = (s: string): number => { const arr: Array<string> = s.split(' '); for(let i:number =0; i< arr.length; i+=2) { if(i >= arr.length -1 ) { return arr[i] !== null ? Number(arr[i]) : null; } const val = arr[i] !== null ? calculate(Number(arr[i]),Number(arr[i+2]),arr[i+1]) : null; arr[i+2] = val !== null ? val.toString() : null; } } const calculate = (a:number,b:number,op:string): number => { if (op === "+") { return a + b; } else if (op === "-") { return a - b; } else if (op === "*") { return a * b; } else if (op === "/") { return a / b; } else { return null; } } export const getBoundingClientRect = (el:Element | HTMLElement,delay:number): Promise<ClientRect> => { return new Promise((resolve) => { const i_delay: number = delay ? delay : 300; const i_el: Element | HTMLElement = el ? el : null; if(i_el !== null) { setTimeout(() => { const rectBB:ClientRect = i_el.getBoundingClientRect(); resolve(rectBB); },i_delay); } else { resolve(null); } }); }
33.951456
128
0.549328
92a5223344c2bb7b2cdc17653b6540ac98feb831
2,484
kt
Kotlin
dsb-gui/src/test/java/com/spectralogic/dsbrowser/gui/util/FileSizeFormatTest.kt
shabtaisharon/ds3_java_browser
993267e7eb70b052159a23abc7a7789547d33431
[ "Apache-2.0" ]
null
null
null
dsb-gui/src/test/java/com/spectralogic/dsbrowser/gui/util/FileSizeFormatTest.kt
shabtaisharon/ds3_java_browser
993267e7eb70b052159a23abc7a7789547d33431
[ "Apache-2.0" ]
null
null
null
dsb-gui/src/test/java/com/spectralogic/dsbrowser/gui/util/FileSizeFormatTest.kt
shabtaisharon/ds3_java_browser
993267e7eb70b052159a23abc7a7789547d33431
[ "Apache-2.0" ]
null
null
null
/* * *************************************************************************** * Copyright 2014-2017 Spectra Logic Corporation. 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. A copy of the License is located at * * http://www.apache.org/licenses/LICENSE-2.0 * * or in the "license" file accompanying this file. * This file 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.spectralogic.dsbrowser.gui.util import com.spectralogic.ds3client.Ds3Client import io.reactivex.Completable import io.reactivex.functions.Consumer import org.junit.Before import org.junit.Test import org.assertj.core.api.Assertions.* import org.mockito.Mockito import java.util.* class FileSizeFormatTest { @Test fun tenBytes() { assertThat(10L.toByteRepresentation()).isEqualTo("10.00 Bytes") } @Test fun zeroBytes() { assertThat(0L.toByteRepresentation()).isEqualTo("0 Bytes") } @Test fun oneKB() { assertThat(1024L.toByteRepresentation()).isEqualTo("1.00 KB") } @Test fun tenKB() { assertThat(10240L.toByteRepresentation()).isEqualTo("10.00 KB") } @Test fun tenMB() { assertThat((1024L * 1024L * 10L).toByteRepresentation()).isEqualTo("10.00 MB") } @Test fun tenGB() { assertThat((1024L * 1024L * 1024L * 10L).toByteRepresentation()).isEqualTo("10.00 GB") } @Test fun tenTB() { assertThat((1024L * 1024L * 1024L * 1024L * 10L).toByteRepresentation()).isEqualTo("10.00 TB") } @Test fun tenPB() { assertThat((1024L * 1024L * 1024L * 1024L * 1024L * 10L).toByteRepresentation()).isEqualTo("10.00 PB") } @Test fun tenEB() { assertThat((1024L * 1024L * 1024L * 1024L * 1024L * 1024L).toByteRepresentation()).isEqualTo("1.00 EB") } @Test fun threes() { assertThat(3500L.toByteRepresentation()).isEqualTo("3.42 KB") } @Test fun twoAndAQuarter() { assertThat(2359296L.toByteRepresentation()).isEqualTo("2.25 MB") assertThat(2359295L.toByteRepresentation()).isEqualTo("2.25 MB") } }
29.571429
111
0.619968
9e14e8502c85165116d9455a70608b2c821f3971
2,000
cs
C#
generator/test/Core/Generator.Core.Application.UnitTest/Products/BrowseProductsUseCaseTest.cs
optivem/optivem-commons-cs
ea1cf2b0a6c951e090bca06efc18904a5cd3d8c2
[ "MIT" ]
6
2020-11-25T10:57:49.000Z
2022-03-23T17:14:48.000Z
generator/test/Core/Generator.Core.Application.UnitTest/Products/BrowseProductsUseCaseTest.cs
optivem/optivem-commons-cs
ea1cf2b0a6c951e090bca06efc18904a5cd3d8c2
[ "MIT" ]
284
2019-05-01T13:19:10.000Z
2020-01-02T18:43:33.000Z
generator/test/Core/Generator.Core.Application.UnitTest/Products/BrowseProductsUseCaseTest.cs
optivem/platform-dotnetcore
ea1cf2b0a6c951e090bca06efc18904a5cd3d8c2
[ "MIT" ]
1
2020-10-14T10:00:29.000Z
2020-10-14T10:00:29.000Z
using Moq; using Atomiv.Core.Application; using Atomiv.Core.Application.Mappers; using Generator.Core.Application.Products.Requests; using Generator.Core.Application.Products.Responses; using Generator.Core.Application.Products.UseCases; using Generator.Core.Domain.Products; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Xunit; namespace Generator.Core.Application.UnitTest.Products { public class BrowseProductsUseCaseTest { private readonly Mock<IUseCaseMapper> _mapperMock; private readonly Mock<IProductRepository> _repositoryMock; private readonly BrowseProductsUseCase _useCase; public BrowseProductsUseCaseTest() { _mapperMock = new Mock<IUseCaseMapper>(); _repositoryMock = new Mock<IProductRepository>(); _useCase = new BrowseProductsUseCase(_mapperMock.Object, _repositoryMock.Object); } [Fact] public async Task HandleAsync_ValidRequest_ReturnsResponse() { var products = new List<Product> { new Product(new ProductIdentity(10), "ABC", "My name", 12), new Product(new ProductIdentity(11), "BDE", "My name 2", 14), new Product(new ProductIdentity(12), "GDE", "My name 3", 16), new Product(new ProductIdentity(13), "HDE", "My name 4", 18), }; var page = 2; var size = 5; _repositoryMock.Setup(e => e.GetAsync(page, size)) .Returns(Task.FromResult(products.AsEnumerable())); var request = new BrowseProductsRequest { Page = page, Size = size, }; await _useCase.HandleAsync(request); _mapperMock.Verify(e => e.Map<IEnumerable<Product>, BrowseProductsResponse>(products), Times.Once); _repositoryMock.Verify(e => e.GetAsync(page, size), Times.Once); } } }
33.898305
111
0.633
955375cdace3d6ea5bca891a0f8b926a27e77160
16,621
rb
Ruby
vendor/rails/actionpack/test/template/text_helper_test.rb
barak/talks-cam.railsapp
203bbb138948f408243ce0d8a43e268e07ad4e93
[ "BSD-3-Clause" ]
12
2016-05-08T06:01:57.000Z
2021-07-13T19:20:54.000Z
vendor/rails/actionpack/test/template/text_helper_test.rb
barak/talks-cam.railsapp
203bbb138948f408243ce0d8a43e268e07ad4e93
[ "BSD-3-Clause" ]
null
null
null
vendor/rails/actionpack/test/template/text_helper_test.rb
barak/talks-cam.railsapp
203bbb138948f408243ce0d8a43e268e07ad4e93
[ "BSD-3-Clause" ]
2
2020-10-01T14:31:41.000Z
2021-07-13T19:17:04.000Z
require File.dirname(__FILE__) + '/../abstract_unit' require "#{File.dirname(__FILE__)}/../testing_sandbox" class TextHelperTest < Test::Unit::TestCase include ActionView::Helpers::TextHelper include ActionView::Helpers::TagHelper include TestingSandbox def setup # This simulates the fact that instance variables are reset every time # a view is rendered. The cycle helper depends on this behavior. @_cycles = nil if (defined? @_cycles) end def test_simple_format assert_equal "<p></p>", simple_format(nil) assert_equal "<p>crazy\n<br /> cross\n<br /> platform linebreaks</p>", simple_format("crazy\r\n cross\r platform linebreaks") assert_equal "<p>A paragraph</p>\n\n<p>and another one!</p>", simple_format("A paragraph\n\nand another one!") assert_equal "<p>A paragraph\n<br /> With a newline</p>", simple_format("A paragraph\n With a newline") text = "A\nB\nC\nD".freeze assert_equal "<p>A\n<br />B\n<br />C\n<br />D</p>", simple_format(text) text = "A\r\n \nB\n\n\r\n\t\nC\nD".freeze assert_equal "<p>A\n<br /> \n<br />B</p>\n\n<p>\t\n<br />C\n<br />D</p>", simple_format(text) end def test_truncate assert_equal "Hello World!", truncate("Hello World!", 12) assert_equal "Hello Wor...", truncate("Hello World!!", 12) end def test_truncate_multibyte with_kcode 'none' do assert_equal "\354\225\210\353\205\225\355...", truncate("\354\225\210\353\205\225\355\225\230\354\204\270\354\232\224", 10) end with_kcode 'u' do assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...", truncate("\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244", 10) end end def test_strip_links assert_equal "on my mind\nall day long", strip_links("<a href='almost'>on my mind</a>\n<A href='almost'>all day long</A>") end def test_highlighter assert_equal( "This is a <strong class=\"highlight\">beautiful</strong> morning", highlight("This is a beautiful morning", "beautiful") ) assert_equal( "This is a <strong class=\"highlight\">beautiful</strong> morning, but also a <strong class=\"highlight\">beautiful</strong> day", highlight("This is a beautiful morning, but also a beautiful day", "beautiful") ) assert_equal( "This is a <b>beautiful</b> morning, but also a <b>beautiful</b> day", highlight("This is a beautiful morning, but also a beautiful day", "beautiful", '<b>\1</b>') ) assert_equal( "This text is not changed because we supplied an empty phrase", highlight("This text is not changed because we supplied an empty phrase", nil) ) end def test_highlighter_with_regexp assert_equal( "This is a <strong class=\"highlight\">beautiful!</strong> morning", highlight("This is a beautiful! morning", "beautiful!") ) assert_equal( "This is a <strong class=\"highlight\">beautiful! morning</strong>", highlight("This is a beautiful! morning", "beautiful! morning") ) assert_equal( "This is a <strong class=\"highlight\">beautiful? morning</strong>", highlight("This is a beautiful? morning", "beautiful? morning") ) end def test_excerpt assert_equal("...is a beautiful morni...", excerpt("This is a beautiful morning", "beautiful", 5)) assert_equal("This is a...", excerpt("This is a beautiful morning", "this", 5)) assert_equal("...iful morning", excerpt("This is a beautiful morning", "morning", 5)) assert_nil excerpt("This is a beautiful morning", "day") end def test_excerpt_with_regex assert_equal('...is a beautiful! morn...', excerpt('This is a beautiful! morning', 'beautiful', 5)) assert_equal('...is a beautiful? morn...', excerpt('This is a beautiful? morning', 'beautiful', 5)) end def test_excerpt_with_utf8 with_kcode('u') do assert_equal("...fficiency could not be h...", excerpt("That's why efficiency could not be helped", 'could', 8)) end with_kcode('none') do assert_equal("...\203ciency could not be h...", excerpt("That's why efficiency could not be helped", 'could', 8)) end end def test_word_wrap assert_equal("my very very\nvery long\nstring", word_wrap("my very very very long string", 15)) end def test_pluralization assert_equal("1 count", pluralize(1, "count")) assert_equal("2 counts", pluralize(2, "count")) assert_equal("1 count", pluralize('1', "count")) assert_equal("2 counts", pluralize('2', "count")) assert_equal("1,066 counts", pluralize('1,066', "count")) assert_equal("1.25 counts", pluralize('1.25', "count")) assert_equal("2 counters", pluralize(2, "count", "counters")) end def test_auto_link_parsing urls = %w(http://www.rubyonrails.com http://www.rubyonrails.com:80 http://www.rubyonrails.com/~minam https://www.rubyonrails.com/~minam http://www.rubyonrails.com/~minam/url%20with%20spaces http://www.rubyonrails.com/foo.cgi?something=here http://www.rubyonrails.com/foo.cgi?something=here&and=here http://www.rubyonrails.com/contact;new http://www.rubyonrails.com/contact;new%20with%20spaces http://www.rubyonrails.com/contact;new?with=query&string=params http://www.rubyonrails.com/~minam/contact;new?with=query&string=params http://en.wikipedia.org/wiki/Wikipedia:Today%27s_featured_picture_%28animation%29/January_20%2C_2007 ) urls.each do |url| assert_equal %(<a href="#{url}">#{url}</a>), auto_link(url) end end def test_auto_linking email_raw = 'david@loudthinking.com' email_result = %{<a href="mailto:#{email_raw}">#{email_raw}</a>} link_raw = 'http://www.rubyonrails.com' link_result = %{<a href="#{link_raw}">#{link_raw}</a>} link_result_with_options = %{<a href="#{link_raw}" target="_blank">#{link_raw}</a>} link2_raw = 'www.rubyonrails.com' link2_result = %{<a href="http://#{link2_raw}">#{link2_raw}</a>} link3_raw = 'http://manuals.ruby-on-rails.com/read/chapter.need_a-period/103#page281' link3_result = %{<a href="#{link3_raw}">#{link3_raw}</a>} link4_raw = 'http://foo.example.com/controller/action?parm=value&p2=v2#anchor123' link4_result = %{<a href="#{link4_raw}">#{link4_raw}</a>} link5_raw = 'http://foo.example.com:3000/controller/action' link5_result = %{<a href="#{link5_raw}">#{link5_raw}</a>} link6_raw = 'http://foo.example.com:3000/controller/action+pack' link6_result = %{<a href="#{link6_raw}">#{link6_raw}</a>} link7_raw = 'http://foo.example.com/controller/action?parm=value&p2=v2#anchor-123' link7_result = %{<a href="#{link7_raw}">#{link7_raw}</a>} link8_raw = 'http://foo.example.com:3000/controller/action.html' link8_result = %{<a href="#{link8_raw}">#{link8_raw}</a>} link9_raw = 'http://business.timesonline.co.uk/article/0,,9065-2473189,00.html' link9_result = %{<a href="#{link9_raw}">#{link9_raw}</a>} assert_equal %(hello #{email_result}), auto_link("hello #{email_raw}", :email_addresses) assert_equal %(Go to #{link_result}), auto_link("Go to #{link_raw}", :urls) assert_equal %(Go to #{link_raw}), auto_link("Go to #{link_raw}", :email_addresses) assert_equal %(Go to #{link_result} and say hello to #{email_result}), auto_link("Go to #{link_raw} and say hello to #{email_raw}") assert_equal %(<p>Link #{link_result}</p>), auto_link("<p>Link #{link_raw}</p>") assert_equal %(<p>#{link_result} Link</p>), auto_link("<p>#{link_raw} Link</p>") assert_equal %(<p>Link #{link_result_with_options}</p>), auto_link("<p>Link #{link_raw}</p>", :all, {:target => "_blank"}) assert_equal %(Go to #{link_result}.), auto_link(%(Go to #{link_raw}.)) assert_equal %(<p>Go to #{link_result}, then say hello to #{email_result}.</p>), auto_link(%(<p>Go to #{link_raw}, then say hello to #{email_raw}.</p>)) assert_equal %(Go to #{link2_result}), auto_link("Go to #{link2_raw}", :urls) assert_equal %(Go to #{link2_raw}), auto_link("Go to #{link2_raw}", :email_addresses) assert_equal %(<p>Link #{link2_result}</p>), auto_link("<p>Link #{link2_raw}</p>") assert_equal %(<p>#{link2_result} Link</p>), auto_link("<p>#{link2_raw} Link</p>") assert_equal %(Go to #{link2_result}.), auto_link(%(Go to #{link2_raw}.)) assert_equal %(<p>Say hello to #{email_result}, then go to #{link2_result}.</p>), auto_link(%(<p>Say hello to #{email_raw}, then go to #{link2_raw}.</p>)) assert_equal %(Go to #{link3_result}), auto_link("Go to #{link3_raw}", :urls) assert_equal %(Go to #{link3_raw}), auto_link("Go to #{link3_raw}", :email_addresses) assert_equal %(<p>Link #{link3_result}</p>), auto_link("<p>Link #{link3_raw}</p>") assert_equal %(<p>#{link3_result} Link</p>), auto_link("<p>#{link3_raw} Link</p>") assert_equal %(Go to #{link3_result}.), auto_link(%(Go to #{link3_raw}.)) assert_equal %(<p>Go to #{link3_result}. seriously, #{link3_result}? i think I'll say hello to #{email_result}. instead.</p>), auto_link(%(<p>Go to #{link3_raw}. seriously, #{link3_raw}? i think I'll say hello to #{email_raw}. instead.</p>)) assert_equal %(<p>Link #{link4_result}</p>), auto_link("<p>Link #{link4_raw}</p>") assert_equal %(<p>#{link4_result} Link</p>), auto_link("<p>#{link4_raw} Link</p>") assert_equal %(<p>#{link5_result} Link</p>), auto_link("<p>#{link5_raw} Link</p>") assert_equal %(<p>#{link6_result} Link</p>), auto_link("<p>#{link6_raw} Link</p>") assert_equal %(<p>#{link7_result} Link</p>), auto_link("<p>#{link7_raw} Link</p>") assert_equal %(Go to #{link8_result}), auto_link("Go to #{link8_raw}", :urls) assert_equal %(Go to #{link8_raw}), auto_link("Go to #{link8_raw}", :email_addresses) assert_equal %(<p>Link #{link8_result}</p>), auto_link("<p>Link #{link8_raw}</p>") assert_equal %(<p>#{link8_result} Link</p>), auto_link("<p>#{link8_raw} Link</p>") assert_equal %(Go to #{link8_result}.), auto_link(%(Go to #{link8_raw}.)) assert_equal %(<p>Go to #{link8_result}. seriously, #{link8_result}? i think I'll say hello to #{email_result}. instead.</p>), auto_link(%(<p>Go to #{link8_raw}. seriously, #{link8_raw}? i think I'll say hello to #{email_raw}. instead.</p>)) assert_equal %(Go to #{link9_result}), auto_link("Go to #{link9_raw}", :urls) assert_equal %(Go to #{link9_raw}), auto_link("Go to #{link9_raw}", :email_addresses) assert_equal %(<p>Link #{link9_result}</p>), auto_link("<p>Link #{link9_raw}</p>") assert_equal %(<p>#{link9_result} Link</p>), auto_link("<p>#{link9_raw} Link</p>") assert_equal %(Go to #{link9_result}.), auto_link(%(Go to #{link9_raw}.)) assert_equal %(<p>Go to #{link9_result}. seriously, #{link9_result}? i think I'll say hello to #{email_result}. instead.</p>), auto_link(%(<p>Go to #{link9_raw}. seriously, #{link9_raw}? i think I'll say hello to #{email_raw}. instead.</p>)) assert_equal '', auto_link(nil) assert_equal '', auto_link('') end def test_auto_link_at_eol url1 = "http://api.rubyonrails.com/Foo.html" url2 = "http://www.ruby-doc.org/core/Bar.html" assert_equal %(<p><a href="#{url1}">#{url1}</a><br /><a href="#{url2}">#{url2}</a><br /></p>), auto_link("<p>#{url1}<br />#{url2}<br /></p>") end def test_auto_link_with_block url = "http://api.rubyonrails.com/Foo.html" email = "fantabulous@shiznadel.ic" assert_equal %(<p><a href="#{url}">#{url[0...7]}...</a><br /><a href="mailto:#{email}">#{email[0...7]}...</a><br /></p>), auto_link("<p>#{url}<br />#{email}<br /></p>") { |url| truncate(url, 10) } end def test_sanitize_form raw = "<form action=\"/foo/bar\" method=\"post\"><input></form>" result = sanitize(raw) assert_equal %(&lt;form action="/foo/bar" method="post"><input>&lt;/form>), result end def test_sanitize_plaintext raw = "<plaintext><span>foo</span></plaintext>" result = sanitize(raw) assert_equal "&lt;plaintext><span>foo</span>&lt;/plaintext>", result end def test_sanitize_script raw = "<script language=\"Javascript\">blah blah blah</script>" result = sanitize(raw) assert_equal %(&lt;script language="Javascript">blah blah blah&lt;/script>), result end def test_sanitize_js_handlers raw = %{onthis="do that" <a href="#" onclick="hello" name="foo" onbogus="remove me">hello</a>} result = sanitize(raw) assert_equal %{onthis="do that" <a name="foo" href="#">hello</a>}, result end def test_sanitize_javascript_href raw = %{href="javascript:bang" <a href="javascript:bang" name="hello">foo</a>, <span href="javascript:bang">bar</span>} result = sanitize(raw) assert_equal %{href="javascript:bang" <a name="hello">foo</a>, <span>bar</span>}, result end def test_sanitize_image_src raw = %{src="javascript:bang" <img src="javascript:bang" width="5">foo</img>, <span src="javascript:bang">bar</span>} result = sanitize(raw) assert_equal %{src="javascript:bang" <img width="5">foo</img>, <span>bar</span>}, result end def test_cycle_class value = Cycle.new("one", 2, "3") assert_equal("one", value.to_s) assert_equal("2", value.to_s) assert_equal("3", value.to_s) assert_equal("one", value.to_s) value.reset assert_equal("one", value.to_s) assert_equal("2", value.to_s) assert_equal("3", value.to_s) end def test_cycle_class_with_no_arguments assert_raise(ArgumentError) { value = Cycle.new() } end def test_cycle assert_equal("one", cycle("one", 2, "3")) assert_equal("2", cycle("one", 2, "3")) assert_equal("3", cycle("one", 2, "3")) assert_equal("one", cycle("one", 2, "3")) assert_equal("2", cycle("one", 2, "3")) assert_equal("3", cycle("one", 2, "3")) end def test_cycle_with_no_arguments assert_raise(ArgumentError) { value = cycle() } end def test_cycle_resets_with_new_values assert_equal("even", cycle("even", "odd")) assert_equal("odd", cycle("even", "odd")) assert_equal("even", cycle("even", "odd")) assert_equal("1", cycle(1, 2, 3)) assert_equal("2", cycle(1, 2, 3)) assert_equal("3", cycle(1, 2, 3)) assert_equal("1", cycle(1, 2, 3)) end def test_named_cycles assert_equal("1", cycle(1, 2, 3, :name => "numbers")) assert_equal("red", cycle("red", "blue", :name => "colors")) assert_equal("2", cycle(1, 2, 3, :name => "numbers")) assert_equal("blue", cycle("red", "blue", :name => "colors")) assert_equal("3", cycle(1, 2, 3, :name => "numbers")) assert_equal("red", cycle("red", "blue", :name => "colors")) end def test_default_named_cycle assert_equal("1", cycle(1, 2, 3)) assert_equal("2", cycle(1, 2, 3, :name => "default")) assert_equal("3", cycle(1, 2, 3)) end def test_reset_cycle assert_equal("1", cycle(1, 2, 3)) assert_equal("2", cycle(1, 2, 3)) reset_cycle assert_equal("1", cycle(1, 2, 3)) end def test_reset_unknown_cycle reset_cycle("colors") end def test_recet_named_cycle assert_equal("1", cycle(1, 2, 3, :name => "numbers")) assert_equal("red", cycle("red", "blue", :name => "colors")) reset_cycle("numbers") assert_equal("1", cycle(1, 2, 3, :name => "numbers")) assert_equal("blue", cycle("red", "blue", :name => "colors")) assert_equal("2", cycle(1, 2, 3, :name => "numbers")) assert_equal("red", cycle("red", "blue", :name => "colors")) end def test_cycle_no_instance_variable_clashes @cycles = %w{Specialized Fuji Giant} assert_equal("red", cycle("red", "blue")) assert_equal("blue", cycle("red", "blue")) assert_equal("red", cycle("red", "blue")) assert_equal(%w{Specialized Fuji Giant}, @cycles) end def test_strip_tags assert_equal("This is a test.", strip_tags("<p>This <u>is<u> a <a href='test.html'><strong>test</strong></a>.</p>")) assert_equal("This is a test.", strip_tags("This is a test.")) assert_equal( %{This is a test.\n\n\nIt no longer contains any HTML.\n}, strip_tags( %{<title>This is <b>a <a href="" target="_blank">test</a></b>.</title>\n\n<!-- it has a comment -->\n\n<p>It no <b>longer <strong>contains <em>any <strike>HTML</strike></em>.</strong></b></p>\n})) assert_equal "This has a here.", strip_tags("This has a <!-- comment --> here.") [nil, '', ' '].each { |blank| assert_equal blank, strip_tags(blank) } end end
47.488571
245
0.642741
955ad6d8347283adceccd50aa85b45bb210e2673
707
rb
Ruby
lib/flipper/types/group.rb
KevinBongart/flipper
bdbee31d5825ecf5a90a9891fa102c653f441d7a
[ "MIT" ]
null
null
null
lib/flipper/types/group.rb
KevinBongart/flipper
bdbee31d5825ecf5a90a9891fa102c653f441d7a
[ "MIT" ]
null
null
null
lib/flipper/types/group.rb
KevinBongart/flipper
bdbee31d5825ecf5a90a9891fa102c653f441d7a
[ "MIT" ]
null
null
null
module Flipper module Types class Group < Type def self.wrap(group_or_name) return group_or_name if group_or_name.is_a?(self) Flipper.group(group_or_name) end attr_reader :name def initialize(name, &block) @name = name.to_sym @value = @name if block_given? @block = block @single_argument = @block.arity == 1 else @block = lambda { |thing, context| false } @single_argument = false end end def match?(thing, context) if @single_argument @block.call(thing) else @block.call(thing, context) end end end end end
20.794118
57
0.551627
209d558237c06ac4e17758c703c48142076b0cc0
534
cs
C#
src/Vts/MonteCarlo/Interfaces/ISource.cs
acs3235/VTS
ec0c30c5b5112a2961682c99d165a58157b2dccc
[ "MIT" ]
22
2017-06-03T22:22:34.000Z
2021-11-06T06:43:21.000Z
src/Vts/MonteCarlo/Interfaces/ISource.cs
acs3235/VTS
ec0c30c5b5112a2961682c99d165a58157b2dccc
[ "MIT" ]
26
2017-06-12T23:26:47.000Z
2021-06-18T20:03:34.000Z
src/Vts/MonteCarlo/Interfaces/ISource.cs
acs3235/VTS
ec0c30c5b5112a2961682c99d165a58157b2dccc
[ "MIT" ]
7
2017-06-03T22:24:01.000Z
2021-07-26T14:49:00.000Z
using System; namespace Vts.MonteCarlo { /// <summary> /// Defines a contract for Source classes for Monte Carlo simulation. /// </summary> public interface ISource { /// <summary> /// Method to initiate new photon. /// </summary> /// <param name="tissue"></param> /// <returns></returns> Photon GetNextPhoton(ITissue tissue); /// <summary> /// Random number generator /// </summary> Random Rng { get; } } }
24.272727
74
0.516854
29f2fd50d638e4a3e6a37fc4721fa48b5459219d
1,130
rs
Rust
src/store.rs
schell/mogwai-todo
43ec5d6011c6934b1f0cc1bb1b790ce81b38ba99
[ "Apache-2.0", "MIT" ]
3
2019-11-28T13:50:41.000Z
2019-11-28T16:28:29.000Z
src/store.rs
schell/mogwai-todo
43ec5d6011c6934b1f0cc1bb1b790ce81b38ba99
[ "Apache-2.0", "MIT" ]
null
null
null
src/store.rs
schell/mogwai-todo
43ec5d6011c6934b1f0cc1bb1b790ce81b38ba99
[ "Apache-2.0", "MIT" ]
null
null
null
use wasm_bindgen::JsValue; use web_sys::Storage; use serde::{Serialize, Deserialize}; use serde_json; use mogwai::utils; #[derive(Serialize, Deserialize)] pub struct Item { pub title: String, pub completed: bool } const KEY: &str = "todomvc-mogwai"; pub fn write_items(items: Vec<Item>) -> Result<(), JsValue> { let str_value = serde_json::to_string(&items) .expect("Could not serialize items"); utils::window() .local_storage()? .into_iter() .for_each(|storage:Storage| { storage .set_item(KEY, &str_value) .expect("could not store serialized items"); }); Ok(()) } pub fn read_items() -> Result<Vec<Item>, JsValue> { let storage = utils::window() .local_storage()? .expect("Could not get local storage"); let may_item_str: Option<String> = storage .get_item(KEY) .expect("Error using storage get_item"); let items = may_item_str .map(|json_str:String| { let items:Vec<Item> = serde_json::from_str(&json_str) .expect("Could not deserialize items"); items }) .unwrap_or(vec![]); Ok(items) }
20.925926
61
0.633628
40d52582758714bab45a437798580d7a00104769
199
rb
Ruby
test/system/relats_test.rb
Alesson-mansur/Projeto-HLA-UERJ
bae96020eb6b5baff22df7a197deac63d749c5ef
[ "MIT" ]
null
null
null
test/system/relats_test.rb
Alesson-mansur/Projeto-HLA-UERJ
bae96020eb6b5baff22df7a197deac63d749c5ef
[ "MIT" ]
null
null
null
test/system/relats_test.rb
Alesson-mansur/Projeto-HLA-UERJ
bae96020eb6b5baff22df7a197deac63d749c5ef
[ "MIT" ]
null
null
null
require "application_system_test_case" class RelatsTest < ApplicationSystemTestCase # test "visiting the index" do # visit relats_url # # assert_selector "h1", text: "Relat" # end end
19.9
44
0.723618
49a105186ee0c5ea4e94d0d52b1d33573cc29b4c
67,708
lua
Lua
Holy Knight (Glaive).lua
xVoid-xyz/Roblox-Scripts
7eb176fa654f2ea5fbc6bcccced1b15df7ed82c2
[ "BSD-3-Clause" ]
70
2021-02-09T17:21:32.000Z
2022-03-28T12:41:42.000Z
Holy Knight (Glaive).lua
xVoid-xyz/Roblox-Scripts
7eb176fa654f2ea5fbc6bcccced1b15df7ed82c2
[ "BSD-3-Clause" ]
4
2021-08-19T22:05:58.000Z
2022-03-19T18:58:01.000Z
Holy Knight (Glaive).lua
xVoid-xyz/Roblox-Scripts
7eb176fa654f2ea5fbc6bcccced1b15df7ed82c2
[ "BSD-3-Clause" ]
325
2021-02-26T22:23:41.000Z
2022-03-31T19:36:12.000Z
Player = game:GetService("Players").rigletto Character = Player.Character PlayerGui = Player.PlayerGui Backpack = Player.Backpack Torso = Character.Torso Head = Character.Head LeftArm = Character["Left Arm"] LeftLeg = Character["Left Leg"] RightArm = Character["Right Arm"] RightLeg = Character["Right Leg"] LS = Torso["Left Shoulder"] LH = Torso["Left Hip"] RS = Torso["Right Shoulder"] RH = Torso["Right Hip"] attack = false attackdebounce = false combo = 0 --player player = nil --save shoulders RSH, LSH = nil, nil --welds RW, LW = Instance.new("Weld"), Instance.new("Weld") if Character:findFirstChild("Glaive",true) ~= nil then Character:findFirstChild("Glaive",true).Parent = nil end if Player:findFirstChild("Team",true) ~= nil then Player:findFirstChild("Team",true).Parent = nil end if Player:findFirstChild("Team") then Player:findFirstChild("Team").Value = "Magic Knight" else local s = Instance.new("StringValue") s.Parent = Player s.Value = "Magic Knight" s.Name = "Team" end local glaive = Instance.new("Model") glaive.Parent = Character glaive.Name = "Glaive" local part1 = Instance.new("Part") part1.formFactor = 1 part1.CanCollide = false part1.Name = "Handle1" part1.Locked = true part1.Size = Vector3.new(1,4,1) part1.Parent = glaive part1.BrickColor = BrickColor.new("Black") local part2 = Instance.new("Part") part2.formFactor = 1 part2.CanCollide = false part2.Name = "Handle2" part2.Locked = true part2.Size = Vector3.new(1,1,1) part2.Parent = glaive part2.BrickColor = BrickColor.new("White") local part3 = Instance.new("Part") part3.formFactor = 1 part3.CanCollide = false part3.Name = "Handle3" part3.Locked = true part3.Size = Vector3.new(1,1,1) part3.Parent = glaive part3.BrickColor = BrickColor.new("Bright blue") local part4 = Instance.new("Part") part4.formFactor = 1 part4.CanCollide = false part4.Name = "Handle4" part4.Locked = true part4.Size = Vector3.new(1,1,1) part4.Parent = glaive part4.BrickColor = BrickColor.new("Bright yellow") local part5 = Instance.new("Part") part5.formFactor = 1 part5.CanCollide = false part5.Name = "Handle5" part5.Locked = true part5.Size = Vector3.new(1,1,1) part5.Parent = glaive part5.BrickColor = BrickColor.new("White") local part6 = Instance.new("Part") part6.formFactor = 1 part6.CanCollide = false part6.Name = "Handle6" part6.Locked = true part6.Size = Vector3.new(1,1,1) part6.Parent = glaive part6.BrickColor = BrickColor.new("White") local part7 = Instance.new("Part") part7.formFactor = 1 part7.CanCollide = false part7.Name = "Handle7" part7.Locked = true part7.Size = Vector3.new(1,1,1) part7.Parent = glaive part7.BrickColor = BrickColor.new("Bright blue") local part8 = Instance.new("Part") part8.formFactor = 1 part8.CanCollide = false part8.Name = "Handle8" part8.Locked = true part8.Size = Vector3.new(1,1,1) part8.Parent = glaive part8.BrickColor = BrickColor.new("Bright blue") local part9 = Instance.new("Part") part9.formFactor = 1 part9.CanCollide = false part9.Name = "Handle9" part9.Locked = true part9.Size = Vector3.new(1,1,1) part9.Parent = glaive part9.BrickColor = BrickColor.new("Bright blue") local part10 = Instance.new("Part") part10.formFactor = 1 part10.CanCollide = false part10.Name = "Handle10" part10.Locked = true part10.Size = Vector3.new(1,1,1) part10.Parent = glaive part10.BrickColor = BrickColor.new("Bright yellow") local part11 = Instance.new("Part") part11.formFactor = 1 part11.CanCollide = false part11.Name = "Blade1" part11.Locked = true part11.Size = Vector3.new(1,1,1) part11.Parent = glaive part11.BrickColor = BrickColor.new("White") local part12 = Instance.new("Part") part12.formFactor = 1 part12.CanCollide = false part12.Name = "Blade2" part12.Locked = true part12.Size = Vector3.new(1,1,1) part12.Parent = glaive part12.BrickColor = BrickColor.new("Bright blue") local part13 = Instance.new("Part") part13.formFactor = 1 part13.CanCollide = false part13.Name = "Blade3" part13.Locked = true part13.Size = Vector3.new(1,1,1) part13.Parent = glaive part13.BrickColor = BrickColor.new("Bright blue") local part14 = Instance.new("Part") part14.formFactor = 1 part14.CanCollide = false part14.Name = "Blade4" part14.Locked = true part14.Size = Vector3.new(1,1,1) part14.Parent = glaive part14.BrickColor = BrickColor.new("Bright blue") local part15 = Instance.new("Part") part15.formFactor = 1 part15.CanCollide = false part15.Name = "Blade5" part15.Locked = true part15.Size = Vector3.new(1,1,1) part15.Parent = glaive part15.BrickColor = BrickColor.new("Black") local part16 = Instance.new("Part") part16.formFactor = 1 part16.CanCollide = false part16.Name = "Blade6" part16.Locked = true part16.Size = Vector3.new(1,1,1) part16.Parent = glaive part16.BrickColor = BrickColor.new("Bright blue") local part17 = Instance.new("Part") part17.formFactor = 1 part17.CanCollide = false part17.Reflectance = 0.3 part17.Name = "Blade7" part17.Locked = true part17.Size = Vector3.new(1,2,1) part17.Parent = glaive part17.BrickColor = BrickColor.new("White") local part18 = Instance.new("Part") part18.formFactor = 1 part18.CanCollide = false part18.Reflectance = 0.3 part18.Name = "Blade8" part18.Locked = true part18.Size = Vector3.new(1,2,1) part18.Parent = glaive part18.BrickColor = BrickColor.new("White") local part19 = Instance.new("Part") part19.formFactor = 1 part19.CanCollide = false part19.Reflectance = 0.1 part19.Name = "Blade9" part19.Locked = true part19.Size = Vector3.new(1,1,1) part19.Parent = glaive part19.BrickColor = BrickColor.new("Bright yellow") local part20 = Instance.new("Part") part20.formFactor = 1 part20.CanCollide = false part20.Reflectance = 0.1 part20.Name = "Blade10" part20.Locked = true part20.Size = Vector3.new(1,1,1) part20.Parent = glaive part20.BrickColor = BrickColor.new("Bright yellow") local part21 = Instance.new("Part") part21.formFactor = 1 part21.CanCollide = false part21.Reflectance = 0.1 part21.Name = "Blade11" part21.Locked = true part21.Size = Vector3.new(1,1,1) part21.Parent = glaive part21.BrickColor = BrickColor.new("Bright yellow") local part22 = Instance.new("Part") part22.formFactor = 1 part22.CanCollide = false part22.Reflectance = 0.1 part22.Name = "Blade12" part22.Locked = true part22.Size = Vector3.new(1,1,1) part22.Parent = glaive part22.BrickColor = BrickColor.new("Bright yellow") local part23 = Instance.new("Part") part23.formFactor = 1 part23.CanCollide = false part23.Reflectance = 0.1 part23.Name = "Blade13" part23.Locked = true part23.Size = Vector3.new(1,1,1) part23.Parent = glaive part23.BrickColor = BrickColor.new("Bright yellow") local part24 = Instance.new("Part") part24.formFactor = 1 part24.CanCollide = false part24.Reflectance = 0.1 part24.Name = "Blade14" part24.Locked = true part24.Size = Vector3.new(1,1,1) part24.Parent = glaive part24.BrickColor = BrickColor.new("Bright yellow") local part25 = Instance.new("Part") part25.formFactor = 1 part25.CanCollide = false part25.Reflectance = 0.1 part25.Name = "Blade15" part25.Locked = true part25.Size = Vector3.new(1,1,1) part25.Parent = glaive part25.BrickColor = BrickColor.new("Bright yellow") local part26 = Instance.new("Part") part26.formFactor = 1 part26.CanCollide = false part26.Reflectance = 0 part26.Name = "Blade16" part26.Locked = true part26.Size = Vector3.new(1,1,1) part26.Parent = glaive part26.BrickColor = BrickColor.new("White") local part27 = Instance.new("Part") part27.formFactor = 1 part27.CanCollide = false part27.Reflectance = 0 part27.Name = "Blade17" part27.Locked = true part27.Size = Vector3.new(1,1,1) part27.Parent = glaive part27.BrickColor = BrickColor.new("White") local mesh1 = Instance.new("CylinderMesh") mesh1.Scale = Vector3.new(0.4,1,0.4) mesh1.Parent = part1 local mesh2 = Instance.new("CylinderMesh") mesh2.Scale = Vector3.new(0.41,0.6,0.41) mesh2.Parent = part2 local mesh3 = Instance.new("CylinderMesh") mesh3.Scale = Vector3.new(0.55,0.4,0.55) mesh3.Parent = part3 local mesh4 = Instance.new("CylinderMesh") mesh4.Scale = Vector3.new(0.56,0.2,0.56) mesh4.Parent = part4 local mesh5 = Instance.new("CylinderMesh") mesh5.Scale = Vector3.new(0.56,0.2,0.56) mesh5.Parent = part5 local mesh6 = Instance.new("SpecialMesh") mesh6.Scale = Vector3.new(0.42,0.2,0.42) mesh6.Parent = part6 mesh6.MeshId = "http://www.roblox.com/asset/?id=1778999" local mesh7 = Instance.new("SpecialMesh") mesh7.Scale = Vector3.new(0.4,0.3,0.7) mesh7.Parent = part7 mesh7.MeshType = "Wedge" local mesh8 = Instance.new("CylinderMesh") mesh8.Scale = Vector3.new(0.56,0.335,0.56) mesh8.Parent = part8 local mesh9 = Instance.new("SpecialMesh") mesh9.Scale = Vector3.new(0.4,0.3,0.7) mesh9.Parent = part9 mesh9.MeshType = "Wedge" local mesh10 = Instance.new("CylinderMesh") mesh10.Scale = Vector3.new(0.5,0.2,0.5) mesh10.Parent = part10 local mesh11 = Instance.new("SpecialMesh") mesh11.Scale = Vector3.new(0.6,0.4,0.7) mesh11.Parent = part11 mesh11.MeshId = "http://www.roblox.com/asset/?id=1778999" local mesh12 = Instance.new("SpecialMesh") mesh12.Scale = Vector3.new(0.9,0.7,1) mesh12.Parent = part12 mesh12.MeshType = "Wedge" local mesh13 = Instance.new("SpecialMesh") mesh13.Scale = Vector3.new(0.9,0.7,1) mesh13.Parent = part13 mesh13.MeshType = "Wedge" local mesh14 = Instance.new("BlockMesh") mesh14.Scale = Vector3.new(0.5,0.9,0.9) mesh14.Parent = part14 local mesh15 = Instance.new("BlockMesh") mesh15.Scale = Vector3.new(0.9,0.9,0.7) mesh15.Parent = part15 local mesh16 = Instance.new("BlockMesh") mesh16.Scale = Vector3.new(1,1,0.5) mesh16.Parent = part16 local mesh17 = Instance.new("SpecialMesh") mesh17.Scale = Vector3.new(0.3,1,1) mesh17.Parent = part17 mesh17.MeshType = "Wedge" local mesh18 = Instance.new("SpecialMesh") mesh18.Scale = Vector3.new(0.3,1,1) mesh18.Parent = part18 mesh18.MeshType = "Wedge" local mesh19 = Instance.new("BlockMesh") mesh19.Scale = Vector3.new(0.6,0.6,1) mesh19.Parent = part19 local mesh20 = Instance.new("BlockMesh") mesh20.Scale = Vector3.new(0.3,0.6,1) mesh20.Parent = part20 local mesh21 = Instance.new("BlockMesh") mesh21.Scale = Vector3.new(0.3,0.6,1) mesh21.Parent = part21 local mesh22 = Instance.new("BlockMesh") mesh22.Scale = Vector3.new(0.3,0.6,1) mesh22.Parent = part22 local mesh23 = Instance.new("BlockMesh") mesh23.Scale = Vector3.new(0.3,0.6,1) mesh23.Parent = part23 local mesh24 = Instance.new("BlockMesh") mesh24.Scale = Vector3.new(0.5,0.6,1) mesh24.Parent = part24 local mesh25 = Instance.new("BlockMesh") mesh25.Scale = Vector3.new(0.6,0.7,1) mesh25.Parent = part25 local mesh26 = Instance.new("SpecialMesh") mesh26.Scale = Vector3.new(1,0.6,0.5) mesh26.Parent = part26 mesh26.MeshType = "Wedge" local mesh27 = Instance.new("SpecialMesh") mesh27.Scale = Vector3.new(1,0.6,0.5) mesh27.Parent = part27 mesh27.MeshType = "Wedge" local weld1 = Instance.new("Weld") weld1.Parent = part1 weld1.Part0 = part1 weld1.Part1 = Torso weld1.C0 = CFrame.fromEulerAnglesXYZ(0,0,0.8) * CFrame.new(0,0,-0.7) local weld2 = Instance.new("Weld") weld2.Parent = part2 weld2.Part0 = part2 weld2.Part1 = part1 weld2.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,1.5,0) local weld3 = Instance.new("Weld") weld3.Parent = part3 weld3.Part0 = part3 weld3.Part1 = part2 weld3.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0.2,0) local weld4 = Instance.new("Weld") weld4.Parent = part4 weld4.Part0 = part4 weld4.Part1 = part3 weld4.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0.1,0) local weld5 = Instance.new("Weld") weld5.Parent = part5 weld5.Part0 = part5 weld5.Part1 = part3 weld5.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0.35,0) local weld6 = Instance.new("Weld") weld6.Parent = part6 weld6.Part0 = part6 weld6.Part1 = part5 weld6.C0 = CFrame.fromEulerAnglesXYZ(math.rad(180),0,0) * CFrame.new(0,0.28,0) local weld7 = Instance.new("Weld") weld7.Parent = part7 weld7.Part0 = part7 weld7.Part1 = part6 weld7.C0 = CFrame.fromEulerAnglesXYZ(-math.rad(90),math.rad(90),0) * CFrame.new(0.4,0,0) local weld8 = Instance.new("Weld") weld8.Parent = part8 weld8.Part0 = part8 weld8.Part1 = part6 weld8.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,0) * CFrame.new(0,-0.2,0) local weld9 = Instance.new("Weld") weld9.Parent = part9 weld9.Part0 = part9 weld9.Part1 = part6 weld9.C0 = CFrame.fromEulerAnglesXYZ(-math.rad(90),-math.rad(90),0) * CFrame.new(-0.4,0,0) local weld10 = Instance.new("Weld") weld10.Parent = part10 weld10.Part0 = part10 weld10.Part1 = part1 weld10.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,-1.5,0) local weld11 = Instance.new("Weld") weld11.Parent = part11 weld11.Part0 = part11 weld11.Part1 = part1 weld11.C0 = CFrame.fromEulerAnglesXYZ(math.rad(180),0,0) * CFrame.new(0,-1.6,0) local weld12 = Instance.new("Weld") weld12.Parent = part12 weld12.Part0 = part12 weld12.Part1 = part11 weld12.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),math.rad(90),0) * CFrame.new(-0.6,0.8,0) local weld13 = Instance.new("Weld") weld13.Parent = part13 weld13.Part0 = part13 weld13.Part1 = part11 weld13.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),-math.rad(90),0) * CFrame.new(0.6,0.8,0) local weld14 = Instance.new("Weld") weld14.Parent = part14 weld14.Part0 = part14 weld14.Part1 = part11 weld14.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0.87,0) local weld15 = Instance.new("Weld") weld15.Parent = part15 weld15.Part0 = part15 weld15.Part1 = part14 weld15.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,1,0) local weld16 = Instance.new("Weld") weld16.Parent = part16 weld16.Part0 = part16 weld16.Part1 = part15 weld16.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,1.1,0) local weld17 = Instance.new("Weld") weld17.Parent = part17 weld17.Part0 = part17 weld17.Part1 = part16 weld17.C0 = CFrame.fromEulerAnglesXYZ(math.rad(180),math.rad(90),0) * CFrame.new(0.5,1,0) local weld18 = Instance.new("Weld") weld18.Parent = part18 weld18.Part0 = part18 weld18.Part1 = part16 weld18.C0 = CFrame.fromEulerAnglesXYZ(math.rad(180),-math.rad(90),0) * CFrame.new(-0.5,1,0) local weld19 = Instance.new("Weld") weld19.Parent = part19 weld19.Part0 = part19 weld19.Part1 = part15 weld19.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0,0) local weld20 = Instance.new("Weld") weld20.Parent = part20 weld20.Part0 = part20 weld20.Part1 = part19 weld20.C0 = CFrame.fromEulerAnglesXYZ(0,0,1) * CFrame.new(0.5,0.5,0) local weld21 = Instance.new("Weld") weld21.Parent = part21 weld21.Part0 = part21 weld21.Part1 = part19 weld21.C0 = CFrame.fromEulerAnglesXYZ(0,0,-1) * CFrame.new(-0.5,0.5,0) local weld22 = Instance.new("Weld") weld22.Parent = part22 weld22.Part0 = part22 weld22.Part1 = part19 weld22.C0 = CFrame.fromEulerAnglesXYZ(0,0,-1) * CFrame.new(0.5,-0.4,0) local weld23 = Instance.new("Weld") weld23.Parent = part23 weld23.Part0 = part23 weld23.Part1 = part19 weld23.C0 = CFrame.fromEulerAnglesXYZ(0,0,1) * CFrame.new(-0.5,-0.4,0) local weld24 = Instance.new("Weld") weld24.Parent = part24 weld24.Part0 = part24 weld24.Part1 = part19 weld24.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0.6,0) local weld25 = Instance.new("Weld") weld25.Parent = part25 weld25.Part0 = part25 weld25.Part1 = part19 weld25.C0 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,-0.6,0) local weld26 = Instance.new("Weld") weld26.Parent = part26 weld26.Part0 = part26 weld26.Part1 = part15 weld26.C0 = CFrame.fromEulerAnglesXYZ(math.rad(180),math.rad(90),0) * CFrame.new(0.3,1.3,0) local weld27 = Instance.new("Weld") weld27.Parent = part27 weld27.Part0 = part27 weld27.Part1 = part15 weld27.C0 = CFrame.fromEulerAnglesXYZ(math.rad(180),-math.rad(90),0) * CFrame.new(-0.3,1.3,0) local gairo = Instance.new("BodyGyro") gairo.Parent = nil function ss(parent,pitch) --linerider64 was here :D local SlashSound = Instance.new("Sound") SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav" SlashSound.Parent = parent SlashSound.Volume = .7 SlashSound.Pitch = pitch --linerider64 was also here XD SlashSound.PlayOnRemove = true --SlashSound:play() coroutine.resume(coroutine.create(function() wait(0) SlashSound.Parent = nil end)) end if (script.Parent.className ~= "HopperBin") then Tool = Instance.new("HopperBin") Tool.Parent = Backpack Tool.Name = "Glaive" script.Parent = Tool end Bin = script.Parent function unequipweld() weld1.Part1 = Torso weld1.C0 = CFrame.fromEulerAnglesXYZ(0,0,0.8) * CFrame.new(0,0,-0.7) end function equipweld() weld1.Part1 = LeftArm weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),2.7,math.rad(90)) * CFrame.new(0, 1, 0) end function hideanim() for i = 0 , 1 , 0.1 do wait(0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),2.7*i,math.rad(90)) * CFrame.new(0, 1, 0) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(-1.5*i,-0.5*i+0.5,1.5*i-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) end wait(0.1) unequipweld() wait(0.1) for i = 0 , 1 , 0.1 do wait(0) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(1.5*i-1.5,0,-1*i+1) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) end end function equipanim() for i = 0 , 1 , 0.1 do wait(0) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(-1.5*i,0,1*i) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) end equipweld() wait(0.1) for i = 0 , 1 , 0.1 do wait(0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),-2.7*i+2.7,math.rad(90)) * CFrame.new(0, 1, 0) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(1.5*i-1.5,0.5*i,-1.5*i+1) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) end end function oneslash() attack = true combo = 1 for i = 0 , 1 , 0.1 do wait(0) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(2*i,-0.5*i+0.5,0.5*i-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) end gairo.Parent = Head gairo.maxTorque = Vector3.new(4e+005,4e+005,4e+005)*math.huge gairo.P = 20e+003 gairo.cframe = Head.CFrame ss(part16,0.8) con1=part16.Touched:connect(function(hit) Damagefunc1(hit,10,10) end) con2=part17.Touched:connect(function(hit) Damagefunc1(hit,10,10) end) for i = 0 , 1 , 0.2 do wait(0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,-1*i) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(-2*i+2,1*i,0) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-1*i,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(1*i,0,1*i) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),1*i,math.rad(90)) * CFrame.new(0, 1, 0.4*i) end wait(0.3) con1:disconnect() con2:disconnect() --Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) attack = false end function twoslash() attack = true combo = 2 ss(part16,0.8) con1=part16.Touched:connect(function(hit) Damagefunc1(hit,10,10) end) con2=part17.Touched:connect(function(hit) Damagefunc1(hit,10,10) end) for i = 0 , 1 , 0.2 do wait(0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,2*i-1) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,-2*i+1,0) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2*i-1,0,0) RW.C0 = CFrame.new(-0.5*i+1.5,0.5,-0.5*i) * CFrame.fromEulerAnglesXYZ(1,0,-2*i+1) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),-2*i+1,math.rad(90)) * CFrame.new(0, 0.3*i+1, -0.9*i+0.4) end wait(0.3) con1:disconnect() con2:disconnect() attack = false end function threeslash() attack = true combo = 3 for i = 0 , 1 , 0.1 do wait(0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,-1*i+1) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,1*i-1,0) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.57*i+1,0,0) RW.C0 = CFrame.new(0.5*i-0.5+1.5,0.5,0.5*i-0.5) * CFrame.fromEulerAnglesXYZ(-1.5*i+1,0,1*i-1) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),4.2*i-1,math.rad(90)) * CFrame.new(0, -0.3*i+1.3, 1.2*i-0.5) end wait() ss(part16,0.8) con1=part16.Touched:connect(function(hit) Damagefunc1(hit,10,10) end) con2=part17.Touched:connect(function(hit) Damagefunc1(hit,10,10) end) for i = 0 , 1.2 , 0.3 do wait(0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0.5*i+3.57,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),-0.5*i+3.2,math.rad(90)) * CFrame.new(0, 1, -0.7*i+0.7) end wait(0.2) con1:disconnect() con2:disconnect() for i = 0 , 1.2 , 0.2 do wait(0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-0.5*i+0.5+3.57,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),2.7,math.rad(90)) * CFrame.new(0, 1, 0) end ss(part16,0.8) con1=part16.Touched:connect(function(hit) Damagefunc1(hit,10,10) end) con2=part17.Touched:connect(function(hit) Damagefunc1(hit,10,10) end) for i = 0 , 1.2 , 0.3 do wait(0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0.5*i+3.57,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),2.7,math.rad(90)) * CFrame.new(0, 1, 0) end con1:disconnect() con2:disconnect() wait(0.3) attack = false end function fourslash() attack = true combo = 4 for i = 0 , 1 , 0.1 do wait(0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5*i+4.07,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),1*i+2.7,math.rad(90)) * CFrame.new(0, 1, 0) end ss(part16,0.8) con1=part16.Touched:connect(function(hit) Damagefunc2(hit,20,30) end) con2=part17.Touched:connect(function(hit) Damagefunc2(hit,20,30) end) for i = 0 , 1 , 0.1 do wait(0) MMMAGIC(part16,2,2,2,0,0,0,BrickColor.new("White")) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-3*i+2.5+4.07,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),-2*i+1+2.7,math.rad(90)) * CFrame.new(0, 1, 0) end con1:disconnect() con2:disconnect() wait(0.5) attack = false end function sparklesparkle() attack = true imfloatinglulz = true coroutine.resume(coroutine.create(function() while imfloatinglulz == true do wait() local bawleffecty = Instance.new("Part") bawleffecty.formFactor = 1 bawleffecty.CanCollide = false bawleffecty.Name = "Effect" bawleffecty.Locked = true bawleffecty.Size = Vector3.new(1,1,1) bawleffecty.Parent = glaive bawleffecty.Anchored = true bawleffecty.BrickColor = BrickColor.new("White") bawleffecty.CFrame = Torso.CFrame * CFrame.new(math.random(-1,1)+math.random()-math.random(),math.random(-1,1)+math.random()-math.random(),math.random(-1,1)+math.random()-math.random()) local bawlmesh = Instance.new("SpecialMesh") bawlmesh.Parent = bawleffecty bawlmesh.Scale = Vector3.new(0.1,0.1,0.1) bawlmesh.MeshType = "Sphere" coroutine.resume(coroutine.create(function() wait(0.2) for i = 0,1,0.1 do wait() bawleffecty.Transparency = i end bawleffecty.Parent = nil end)) end end)) local bov = Instance.new("BodyPosition") bov.position = Torso.Position bov.Parent = Torso bov.maxForce = Vector3.new(50000000,50000000,50000000) Character.Humanoid.WalkSpeed = 0 for i = 0,1,0.05 do wait() bov.position = Torso.Position + Vector3.new(0,i*2,0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(-0.5*i+1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(1*i,-0.5*i+0.5,-0.5*i-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(1*i,0,1*i) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(90)) * CFrame.new(0, 1, 0) end wait(2) local bawleffecty = Instance.new("Part") bawleffecty.formFactor = 1 bawleffecty.CanCollide = false bawleffecty.Name = "Effect" bawleffecty.Locked = true bawleffecty.Size = Vector3.new(1,1,1) bawleffecty.Parent = glaive bawleffecty.Anchored = true bawleffecty.BrickColor = BrickColor.new("White") bawleffecty.CFrame = Torso.CFrame local c = game.Workspace:GetChildren(); for i = 1, #c do local hum = c[i]:findFirstChild("Humanoid") if hum ~= nil and hum.Health ~= 0 then local head = c[i]:findFirstChild("Head"); if head ~= nil then local targ = head.Position - bawleffecty.Position; local mag = targ.magnitude; if mag <= 25 and c[i].Name ~= Player.Name then coroutine.resume(coroutine.create(function() BALLFUNC(head,20,0) end)) end end end end local bawlmesh = Instance.new("SpecialMesh") bawlmesh.Parent = bawleffecty bawlmesh.Scale = Vector3.new(1,1,1) bawlmesh.MeshType = "Sphere" coroutine.resume(coroutine.create(function() wait(0) for i = 0,1,0.05 do wait() bawlmesh.Scale = bawlmesh.Scale + Vector3.new(3,3,3) bawleffecty.Transparency = i end bawleffecty.Parent = nil end)) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0.5,-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(90)) * CFrame.new(0, 1, 0) bov.Parent = nil Character.Humanoid.WalkSpeed = 16 imfloatinglulz = false attack = false end function HolyWave() attack = true for i = 0,1,0.1 do wait() Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(0.3*i-1.5,0.5,-0.5*i) * CFrame.fromEulerAnglesXYZ(1.57*i,-2.07*i+0.5,0.5*i-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-0.5*i,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(1.57*i,0,1*i) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0.5*i,math.rad(90)) * CFrame.new(0, 1, 0) end gairo.Parent = Head gairo.maxTorque = Vector3.new(4e+005,4e+005,4e+005)*math.huge gairo.P = 20e+003 gairo.cframe = Head.CFrame CeEff = Head.CFrame ss(part16,0.8) con1=part16.Touched:connect(function(hit) Damagefunc1(hit,20,10) end) con2=part17.Touched:connect(function(hit) Damagefunc1(hit,20,10) end) for i = 0,1,0.1 do wait() gairo.cframe = Head.CFrame * CFrame.fromEulerAnglesXYZ(0,0.5,0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-0.3*i+0.3-1.5,0.5,0.5*i-0.5) * CFrame.fromEulerAnglesXYZ(1.57,-2.07+0.5,0.5-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5*i-0.5,0,0) RW.C0 = CFrame.new(-0.5*i+1.5,0.5,-0.5*i) * CFrame.fromEulerAnglesXYZ(1.57,0,-2*i+1) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0.2*i+0.5,math.rad(90)) * CFrame.new(0, 1, 0) end ss(part16,0.8) for i = 0,1,0.1 do wait() gairo.cframe = gairo.cframe * CFrame.fromEulerAnglesXYZ(0,0.5,0) end ss(part16,0.8) for i = 0,1,0.1 do wait() gairo.cframe = gairo.cframe * CFrame.fromEulerAnglesXYZ(0,0.5,0) end gairo.cframe = CeEff con1:disconnect() con2:disconnect() for i = 0,1,0.1 do wait() MMMAGIC(part16,3,3,3,0,0,0,BrickColor.new("Institutional white")) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(0.5*i-1.5,0.5,-0.7*i) * CFrame.fromEulerAnglesXYZ(0.93*i+1.57,-1.57*i-1.57,-0.8*i) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-2*i+2,0,0) RW.C0 = CFrame.new(-0.5+1.5,0.5,-0.7) * CFrame.fromEulerAnglesXYZ(0.93*i+1.57,math.rad(180)*i,1.8*i-1) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),-0.7*i+0.7,math.rad(90)) * CFrame.new(0, 1, -1*i) end wait(0.2) ss(part16,0.8) for i = 0,1,0.2 do wait() MMMAGIC(part16,3,3,3,0,0,0,BrickColor.new("Institutional white")) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1,0.5,-0.7) * CFrame.fromEulerAnglesXYZ(-0.93*i+0.93+1.57,-3.14,-0.8) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C0 = CFrame.new(1,0.5,-0.7) * CFrame.fromEulerAnglesXYZ(-0.93*i+0.93+1.57,math.rad(180),0.8) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(90)) * CFrame.new(0, 1, -1) end local msh1 = Instance.new("SpecialMesh") --Messy Script incoming >_> msh1.Scale = Vector3.new(0.01,0.01,0.01) msh1.MeshType = "Sphere" S=Instance.new("Part") S.Name="Effect" S.formFactor=0 S.Size=Vector3.new(3,3,3) S.BrickColor=BrickColor.new("White") S.Reflectance = 0 S.TopSurface=0 S.BottomSurface=0 S.Transparency=0 S.Anchored=true S.CanCollide=false S.CFrame=part16.CFrame*CFrame.new(0,0,0)*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) S.Parent=Character msh1.Parent = S r=Instance.new("Part") r.Anchored=true r.Name="Ring" r.CanCollide=false r.TopSurface=0 r.BottomSurface=0 r.CFrame=part16.CFrame*CFrame.new(0,0,0)*CFrame.fromEulerAnglesXYZ(0,0,0) r.Parent=workspace local ring = Instance.new("SpecialMesh") ring.Parent = r ring.MeshId = "http://www.roblox.com/asset/?id=3270017" ring.Name = "RingMesh" r.RingMesh.Scale=Vector3.new(0.1,0.1,0.1) r.BrickColor=BrickColor.new("White") coroutine.resume(coroutine.create(function(par) for i=1, 14 do par.Transparency=i/14 par.RingMesh.Scale=par.RingMesh.Scale+Vector3.new(3,3,3) wait() end par.Parent=nil end),r) p=Instance.new("Part") p.Name="BlastRing" p.TopSurface=0 p.BottomSurface=0 p.CanCollide=false p.Anchored=true p.BrickColor=BrickColor.new("Institutional white") p.Size=Vector3.new(1,1,1) p.CFrame=part16.CFrame*CFrame.new(0,0,0)*CFrame.fromEulerAnglesXYZ(0,0,0) p.CFrame=p.CFrame p.Parent=workspace local mesheh = Instance.new("SpecialMesh") mesheh.Parent = p mesheh.Name = "BlastMesh" mesheh.MeshId = "http://www.roblox.com/asset/?id=20329976" p.BlastMesh.Scale=Vector3.new(0.3,0.3,0.1) coroutine.resume(coroutine.create(function(par) for lol=1, 17 do if Corrupt==false then par.BlastMesh.Scale=par.BlastMesh.Scale+Vector3.new(0.1,0.1,0.1) else par.BlastMesh.Scale=par.BlastMesh.Scale+Vector3.new(1,1.5,1) end par.Transparency=lol/17 par.CFrame=par.CFrame*CFrame.new(0,.1,0) wait() end par.Parent=nil end),p) coroutine.resume(coroutine.create(function(Part,CF) for i=1, 19 do Part.Mesh.Scale = Part.Mesh.Scale + Vector3.new(0.4,0.4,0.4) Part.CFrame=Part.CFrame*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) Part.Transparency=Part.Transparency+0.05 wait() end Part.Parent=nil end),S,S.CFrame) local msh1 = Instance.new("SpecialMesh") msh1.Scale = Vector3.new(0.01,0.01,0.01) msh1.MeshType = "Sphere" S=Instance.new("Part") S.Name="Effect" S.formFactor=0 S.Size=Vector3.new(3,3,3) S.BrickColor=BrickColor.new("White") S.Reflectance = 0 S.TopSurface=0 S.BottomSurface=0 S.Transparency=0 S.Anchored=true S.CanCollide=false S.CFrame=part16.CFrame*CFrame.new(0,0,0)*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) S.Parent=Character msh1.Parent = S coroutine.resume(coroutine.create(function(Part,CF) for i=1, 19 do Part.Mesh.Scale = Part.Mesh.Scale + Vector3.new(0.3,0.3,0.3) Part.CFrame=Part.CFrame*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) Part.Transparency=Part.Transparency+0.05 wait() end Part.Parent=nil end),S,S.CFrame) Vel=Vector3.new(Torso.Velocity.x,0,Torso.Velocity.z) v=Instance.new("BodyVelocity") v.P=3000 v.maxForce=Vector3.new(math.huge,math.huge,math.huge) v.velocity=Vel v.Parent=S local c = game.Workspace:GetChildren(); for i = 1, #c do local hum = c[i]:findFirstChild("Humanoid") if hum ~= nil and hum.Health ~= 0 then local head = c[i]:findFirstChild("Head"); if head ~= nil then local targ = head.Position - S.Position; local mag = targ.magnitude; if mag <= 10 and c[i].Name ~= Player.Name then coroutine.resume(coroutine.create(function() for i = 0,1,0.1 do wait() DBHit(head,S) end end)) end end end end wait(0.3) gairo.Parent = nil for i = 0,1,0.1 do wait() Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-0.5*i-1,0.5,0.7*i-0.7) * CFrame.fromEulerAnglesXYZ(-1.57*i+1.57,3.64*i-3.14,0.3*i-0.8) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C0 = CFrame.new(0.5*i+1,0.5,0.7*i-0.7) * CFrame.fromEulerAnglesXYZ(-1.57*i+1.57,-math.rad(180)*i+math.rad(180),-0.8*i+0.8) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(90)) * CFrame.new(0, 1, -1) end attack = false end function MagicBlast() attack = true gairo.Parent = Head gairo.maxTorque = Vector3.new(4e+005,4e+005,4e+005)*math.huge gairo.P = 20e+003 gairo.cframe = Head.CFrame for i = 0,1,0.1 do wait() MMMAGIC(RightArm,3,3,3,0,-1,0,BrickColor.new("White")) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,1.57*i) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0.5,-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(90)*i) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(90)) * CFrame.new(0, 1, 0) end for i = 0,1,0.05 do wait() MMMAGIC(RightArm,3,3,3,0,-1,0,BrickColor.new("White")) end Shot=Instance.new("Part") Shot.Name="Effect" Shot.formFactor=0 Shot.Size=Vector3.new(1,1,1) Shot.BrickColor=BrickColor.new("White") Shot.Reflectance = 0 Shot.TopSurface=0 Shot.BottomSurface=0 Shot.Transparency=0 Shot.Anchored=false Shot.CanCollide=false Shot.CFrame=RightArm.CFrame*CFrame.new(0,-1,0) Shot.Parent=workspace --Shot.Velocity = Head.CFrame.lookVector * 100 coroutine.resume(coroutine.create(function() while Shot.Parent ~= nil do wait() MMMAGIC(Shot,1,1,1,0,0,0,BrickColor.new("White")) end end)) coroutine.resume(coroutine.create(function() while Shot.Parent ~= nil do --I use this function instead of the touch function :3 wait() local c = game.Workspace:GetChildren(); for i = 1, #c do local hum = c[i]:findFirstChild("Humanoid") if hum ~= nil and hum.Health ~= 0 then local head = c[i]:findFirstChild("Head"); if head ~= nil then local targ = head.Position - Shot.Position; local mag = targ.magnitude; if mag <= 4 and c[i].Name ~= Player.Name then Damagefunc2(head.Parent.Torso,10,30) v=Instance.new("BodyVelocity") v.P=1000 v.maxForce=Vector3.new(math.huge,0,math.huge) v.velocity=Torso.CFrame.lookVector*25+Torso.Velocity/1.05 v.Parent=hum.Parent.Torso coroutine.resume(coroutine.create(function() wait(0.3) v.Parent = nil end)) game:GetService("Debris"):AddItem(v,.1) Shot.Parent = nil end end end end end end)) coroutine.resume(coroutine.create(function() wait(3) for i = 0,1,0.05 do wait() Shot.Transparency = i end Shot.Parent = nil end)) local v = Instance.new("BodyVelocity") v.Parent = Shot v.maxForce = Vector3.new(math.huge,math.huge,math.huge) v.velocity = Head.CFrame.lookVector * 100 local force = Instance.new("BodyForce") force.Parent = Shot force.force = Vector3.new(0,190,0) local meh = Instance.new("SpecialMesh") meh.Parent = Shot meh.Scale = Vector3.new(1,2,1) meh.MeshType = "Sphere" MMMAGIC(RightArm,4,4,4,0,-1,0,BrickColor.new("White")) MMMAGIC(RightArm,5,5,5,0,-1,0,BrickColor.new("Institutional white")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("White")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("Institutional white")) wait(0.3) for i = 0,1,0.05 do wait() MMMAGIC(RightArm,3,3,3,0,-1,0,BrickColor.new("White")) end Shot2=Instance.new("Part") Shot2.Name="Effect" Shot2.formFactor=0 Shot2.Size=Vector3.new(1,1,1) Shot2.BrickColor=BrickColor.new("White") Shot2.Reflectance = 0 Shot2.TopSurface=0 Shot2.BottomSurface=0 Shot2.Transparency=0 Shot2.Anchored=false Shot2.CanCollide=false Shot2.CFrame=RightArm.CFrame*CFrame.new(0,-1,0) Shot2.Parent=workspace --Shot2.Velocity = Head.CFrame.lookVector * 100 coroutine.resume(coroutine.create(function() while Shot2.Parent ~= nil do wait() MMMAGIC(Shot2,1,1,1,0,0,0,BrickColor.new("White")) end end)) coroutine.resume(coroutine.create(function() while Shot2.Parent ~= nil do --I use this function instead of the touch function :3 wait() local c = game.Workspace:GetChildren(); for i = 1, #c do local hum = c[i]:findFirstChild("Humanoid") if hum ~= nil and hum.Health ~= 0 then local head = c[i]:findFirstChild("Head"); if head ~= nil then local targ = head.Position - Shot2.Position; local mag = targ.magnitude; if mag <= 4 and c[i].Name ~= Player.Name then Damagefunc2(head.Parent.Torso,10,30) v=Instance.new("BodyVelocity") v.P=1000 v.maxForce=Vector3.new(math.huge,0,math.huge) v.velocity=Torso.CFrame.lookVector*25+Torso.Velocity/1.05 v.Parent=hum.Parent.Torso coroutine.resume(coroutine.create(function() wait(0.3) v.Parent = nil end)) game:GetService("Debris"):AddItem(v,.1) Shot2.Parent = nil end end end end end end)) coroutine.resume(coroutine.create(function() wait(3) for i = 0,1,0.05 do wait() Shot2.Transparency = i end Shot2.Parent = nil end)) local v = Instance.new("BodyVelocity") v.Parent = Shot2 v.maxForce = Vector3.new(math.huge,math.huge,math.huge) v.velocity = Head.CFrame.lookVector * 100 local force = Instance.new("BodyForce") force.Parent = Shot2 force.force = Vector3.new(0,190,0) local meh = Instance.new("SpecialMesh") meh.Parent = Shot2 meh.Scale = Vector3.new(1,2,1) meh.MeshType = "Sphere" MMMAGIC(RightArm,4,4,4,0,-1,0,BrickColor.new("White")) MMMAGIC(RightArm,5,5,5,0,-1,0,BrickColor.new("Institutional white")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("White")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("Institutional white")) wait(0.3) for i = 0,1,0.05 do wait() MMMAGIC(RightArm,3,3,3,0,-1,0,BrickColor.new("White")) end Shot3=Instance.new("Part") Shot3.Name="Effect" Shot3.formFactor=0 Shot3.Size=Vector3.new(1,1,1) Shot3.BrickColor=BrickColor.new("White") Shot3.Reflectance = 0 Shot3.TopSurface=0 Shot3.BottomSurface=0 Shot3.Transparency=0 Shot3.Anchored=false Shot3.CanCollide=false Shot3.CFrame=RightArm.CFrame*CFrame.new(0,-1,0) Shot3.Parent=workspace --Shot3.Velocity = Head.CFrame.lookVector * 100 coroutine.resume(coroutine.create(function() while Shot3.Parent ~= nil do wait() MMMAGIC(Shot3,1,1,1,0,0,0,BrickColor.new("White")) end end)) coroutine.resume(coroutine.create(function() while Shot3.Parent ~= nil do --I use this function instead of the touch function :3 wait() local c = game.Workspace:GetChildren(); for i = 1, #c do local hum = c[i]:findFirstChild("Humanoid") if hum ~= nil and hum.Health ~= 0 then local head = c[i]:findFirstChild("Head"); if head ~= nil then local targ = head.Position - Shot3.Position; local mag = targ.magnitude; if mag <= 4 and c[i].Name ~= Player.Name then Damagefunc2(head.Parent.Torso,10,30) v=Instance.new("BodyVelocity") v.P=1000 v.maxForce=Vector3.new(math.huge,0,math.huge) v.velocity=Torso.CFrame.lookVector*25+Torso.Velocity/1.05 v.Parent=hum.Parent.Torso coroutine.resume(coroutine.create(function() wait(0.3) v.Parent = nil end)) game:GetService("Debris"):AddItem(v,.1) Shot3.Parent = nil end end end end end end)) coroutine.resume(coroutine.create(function() wait(3) for i = 0,1,0.05 do wait() Shot3.Transparency = i end Shot3.Parent = nil end)) local v = Instance.new("BodyVelocity") v.Parent = Shot3 v.maxForce = Vector3.new(math.huge,math.huge,math.huge) v.velocity = Head.CFrame.lookVector * 100 local force = Instance.new("BodyForce") force.Parent = Shot3 force.force = Vector3.new(0,190,0) local meh = Instance.new("SpecialMesh") meh.Parent = Shot3 meh.Scale = Vector3.new(1,2,1) meh.MeshType = "Sphere" MMMAGIC(RightArm,4,4,4,0,-1,0,BrickColor.new("White")) MMMAGIC(RightArm,5,5,5,0,-1,0,BrickColor.new("Institutional white")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("White")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("Institutional white")) wait(0.3) for i = 0,1,0.1 do wait() Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,-1.57*i+1.57) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0.5,-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,-math.rad(90)*i+math.rad(90)) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(90)) * CFrame.new(0, 1, 0) end gairo.Parent = nil attack = false end function LightOrb() attack = true gairo.Parent = Head gairo.maxTorque = Vector3.new(4e+005,4e+005,4e+005)*math.huge gairo.P = 20e+003 gairo.cframe = Head.CFrame for i = 0,1,0.1 do wait() MMMAGIC(RightArm,3,3,3,0,-1,0,BrickColor.new("White")) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,1.57*i) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0.5,-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(90)*i) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(90)) * CFrame.new(0, 1, 0) end for i = 0,1,0.02 do wait() MMMAGIC(RightArm,3,3,3,0,-1,0,BrickColor.new("White")) end Shoty=Instance.new("Part") Shoty.Name="Effect" Shoty.formFactor=0 Shoty.Size=Vector3.new(1,1,1) Shoty.BrickColor=BrickColor.new("White") Shoty.Reflectance = 0 Shoty.TopSurface=0 Shoty.BottomSurface=0 Shoty.Transparency=0 Shoty.Anchored=false Shoty.CanCollide=false Shoty.CFrame=RightArm.CFrame*CFrame.new(0,-1,0) Shoty.Parent=workspace --Shot.Velocity = Head.CFrame.lookVector * 100 coroutine.resume(coroutine.create(function() while Shoty.Parent ~= nil do wait(0.2) p=Instance.new("Part") p.Name="BlastRing" p.TopSurface=0 p.BottomSurface=0 p.CanCollide=false p.Anchored=true p.BrickColor=BrickColor.new("Institutional white") p.Size=Vector3.new(1,1,1) p.CFrame=Shoty.CFrame*CFrame.new(-3,0,0)*CFrame.fromEulerAnglesXYZ(0,0,-math.rad(90)) p.CFrame=p.CFrame p.Parent=workspace local mesheh = Instance.new("SpecialMesh") mesheh.Parent = p mesheh.Name = "BlastMesh" mesheh.MeshId = "http://www.roblox.com/asset/?id=20329976" p.BlastMesh.Scale=Vector3.new(0.3,0.3,0.1) coroutine.resume(coroutine.create(function(par) for lol=1, 17 do if Corrupt==false then par.BlastMesh.Scale=par.BlastMesh.Scale+Vector3.new(0.1,0.1,0.1) else par.BlastMesh.Scale=par.BlastMesh.Scale+Vector3.new(0.2,0.2,0.2) end par.Transparency=lol/17 par.CFrame=par.CFrame*CFrame.new(0,.1,0) wait() end par.Parent=nil end),p) end end)) local v = Instance.new("BodyVelocity") v.Parent = Shoty v.maxForce = Vector3.new(math.huge,math.huge,math.huge) v.velocity = Head.CFrame.lookVector * 20 local force = Instance.new("BodyForce") force.Parent = Shoty force.force = Vector3.new(0,190,0) local meh = Instance.new("SpecialMesh") meh.Parent = Shoty meh.Scale = Vector3.new(3,3,3) meh.MeshType = "Sphere" MMMAGIC(RightArm,5,5,5,0,-1,0,BrickColor.new("White")) MMMAGIC(RightArm,6,6,6,0,-1,0,BrickColor.new("Institutional white")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("White")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("Institutional white")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("White")) MOREMAGIX(RightArm,-1,4,4,4,BrickColor.new("Institutional white")) coroutine.resume(coroutine.create(function() wait(5) Shoty.Parent = nil local msh1 = Instance.new("SpecialMesh") --Messy Script incoming >_> msh1.Scale = Vector3.new(0.01,0.01,0.01) msh1.MeshType = "Sphere" S=Instance.new("Part") S.Name="Effect" S.formFactor=0 S.Size=Vector3.new(3,3,3) S.BrickColor=BrickColor.new("White") S.Reflectance = 0 S.TopSurface=0 S.BottomSurface=0 S.Transparency=0 S.Anchored=true S.CanCollide=false S.CFrame=Shoty.CFrame*CFrame.new(0,0,0)*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) S.Parent=Character msh1.Parent = S r=Instance.new("Part") r.Anchored=true r.Name="Ring" r.CanCollide=false r.TopSurface=0 r.BottomSurface=0 r.CFrame=Shoty.CFrame*CFrame.new(0,0,0)*CFrame.fromEulerAnglesXYZ(0,0,0) r.Parent=workspace local ring = Instance.new("SpecialMesh") ring.Parent = r ring.MeshId = "http://www.roblox.com/asset/?id=3270017" ring.Name = "RingMesh" r.RingMesh.Scale=Vector3.new(0.1,0.1,0.1) r.BrickColor=BrickColor.new("White") coroutine.resume(coroutine.create(function(par) for i=1, 14 do par.Transparency=i/14 par.RingMesh.Scale=par.RingMesh.Scale+Vector3.new(3,3,3) wait() end par.Parent=nil end),r) p=Instance.new("Part") p.Name="BlastRing" p.TopSurface=0 p.BottomSurface=0 p.CanCollide=false p.Anchored=true p.BrickColor=BrickColor.new("Institutional white") p.Size=Vector3.new(1,1,1) p.CFrame=Shoty.CFrame*CFrame.new(0,0,0)*CFrame.fromEulerAnglesXYZ(0,0,-math.rad(90)) p.CFrame=p.CFrame p.Parent=workspace local mesheh = Instance.new("SpecialMesh") mesheh.Parent = p mesheh.Name = "BlastMesh" mesheh.MeshId = "http://www.roblox.com/asset/?id=20329976" p.BlastMesh.Scale=Vector3.new(0.3,0.3,0.1) coroutine.resume(coroutine.create(function(par) for lol=1, 17 do if Corrupt==false then par.BlastMesh.Scale=par.BlastMesh.Scale+Vector3.new(0.1,0.1,0.1) else par.BlastMesh.Scale=par.BlastMesh.Scale+Vector3.new(1,1.5,1) end par.Transparency=lol/17 par.CFrame=par.CFrame*CFrame.new(0,.1,0) wait() end par.Parent=nil end),p) coroutine.resume(coroutine.create(function(Part,CF) for i=1, 19 do Part.Mesh.Scale = Part.Mesh.Scale + Vector3.new(0.4,0.4,0.4) Part.CFrame=Part.CFrame*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) Part.Transparency=Part.Transparency+0.05 wait() end Part.Parent=nil end),S,S.CFrame) local msh1 = Instance.new("SpecialMesh") msh1.Scale = Vector3.new(0.01,0.01,0.01) msh1.MeshType = "Sphere" S=Instance.new("Part") S.Name="Effect" S.formFactor=0 S.Size=Vector3.new(3,3,3) S.BrickColor=BrickColor.new("White") S.Reflectance = 0 S.TopSurface=0 S.BottomSurface=0 S.Transparency=0 S.Anchored=true S.CanCollide=false S.CFrame=Shoty.CFrame*CFrame.new(0,0,0)*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) S.Parent=Character msh1.Parent = S coroutine.resume(coroutine.create(function(Part,CF) for i=1, 19 do Part.Mesh.Scale = Part.Mesh.Scale + Vector3.new(0.3,0.3,0.3) Part.CFrame=Part.CFrame*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) Part.Transparency=Part.Transparency+0.05 wait() end Part.Parent=nil end),S,S.CFrame) Vel=Vector3.new(Torso.Velocity.x,0,Torso.Velocity.z) v=Instance.new("BodyVelocity") v.P=3000 v.maxForce=Vector3.new(math.huge,math.huge,math.huge) v.velocity=Vel v.Parent=S local c = game.Workspace:GetChildren(); for i = 1, #c do local hum = c[i]:findFirstChild("Humanoid") if hum ~= nil and hum.Health ~= 0 then local head = c[i]:findFirstChild("Head"); if head ~= nil then local targ = head.Position - S.Position; local mag = targ.magnitude; if mag <= 10 and c[i].Name ~= Player.Name then coroutine.resume(coroutine.create(function() for i = 0,1,0.1 do wait() DBHit(head,S) end end)) end end end end end)) for i = 0,1,0.1 do wait() Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,-1.57*i+1.57) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0.5,-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,-math.rad(90)*i+math.rad(90)) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(90)) * CFrame.new(0, 1, 0) end gairo.Parent = nil attack = false end function MMMAGIC(part,x1,y1,z1,x2,y2,z2,color) local msh1 = Instance.new("BlockMesh") msh1.Scale = Vector3.new(0.5,0.5,0.5) S=Instance.new("Part") S.Name="Effect" S.formFactor=0 S.Size=Vector3.new(x1,y1,z1) S.BrickColor=color S.Reflectance = 0 S.TopSurface=0 S.BottomSurface=0 S.Transparency=0 S.Anchored=true S.CanCollide=false S.CFrame=part.CFrame*CFrame.new(x2,y2,z2)*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) S.Parent=Character msh1.Parent = S coroutine.resume(coroutine.create(function(Part,CF) for i=1, 9 do Part.Mesh.Scale = Part.Mesh.Scale + Vector3.new(0.1,0.1,0.1) Part.CFrame=Part.CFrame*CFrame.fromEulerAnglesXYZ(math.random(-50,50),math.random(-50,50),math.random(-50,50)) Part.Transparency=i*.1 wait() end Part.Parent=nil end),S,S.CFrame) end function MOREMAGIX(part,cframe,x,y,z,color) p2=Instance.new("Part") p2.Name="Blast" p2.TopSurface=0 p2.BottomSurface=0 p2.CanCollide=false p2.Anchored=true p2.BrickColor=color p2.Size=Vector3.new(x,y,z) p2.formFactor="Symmetric" p2.CFrame=part.CFrame*CFrame.new(0,cframe,0) p2.Parent=workspace m=Instance.new("BlockMesh") m.Parent=p2 m.Name="BlastMesh" coroutine.resume(coroutine.create(function(part,dir) for loll=1, 15 do part.BlastMesh.Scale=part.BlastMesh.Scale-Vector3.new(.09,.09,.09) part.Transparency=loll/20 part.CFrame=part.CFrame*CFrame.new(dir)*CFrame.fromEulerAnglesXYZ(math.random(-100,100)/100, math.random(-100,100)/100, math.random(-100,100)/100) wait() end part.Parent=nil end),p2,Vector3.new(math.random(-10,10)/10,math.random(-10,10)/10,math.random(-10,10)/10)) end Damagefunc1=function(hit,Damage,Knockback) if attackdebounce == false then attackdebounce = true coroutine.resume(coroutine.create(function() wait(0.1) attackdebounce = false end)) if hit.Parent==nil then return end CPlayer=Bin h=hit.Parent:FindFirstChild("Humanoid") if h~=nil and hit.Parent.Name~="rigletto" and hit.Parent:FindFirstChild("Torso")~=nil then Damage=Damage --[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then return end]] c=Instance.new("ObjectValue") c.Name="creator" c.Value=game.Players.LocalPlayer c.Parent=h game:GetService("Debris"):AddItem(c,.5) -- print(c.Value) if math.random(1,5)==1 then CRIT=true Damage=Damage*2 coroutine.resume(coroutine.create(function() for i = 0,5 do wait() MMMAGIC(hit.Parent.Torso,3,3,3,0,0,0,BrickColor.new("White")) end wait(1) for i = 0,8 do wait(0.1) MOREMAGIX(hit.Parent.Torso,0,2,2,2,BrickColor.new("White")) end end)) Knockback=Knockback*2 r=Instance.new("BodyAngularVelocity") r.P=3000 r.maxTorque=Vector3.new(500000000,50000000000,500000000)*50000 r.angularvelocity=Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20)) r.Parent=hit.Parent.Torso s=Instance.new("Sound") s.SoundId="http://www.roblox.com/asset/?id=2801263" s.Volume=1 s.Pitch=2 s.Parent=hit s.PlayOnRemove=true s.Parent=nil end Damage=Damage+math.random(0,10) -- Blood(hit.CFrame*CFrame.new(math.random(-10,10)/10,math.random(-10,10)/10,0),math.floor(Damage/2)) h:TakeDamage(Damage) showDamage(hit.Parent,Damage,.5) vp=Instance.new("BodyVelocity") vp.P=500 vp.maxForce=Vector3.new(math.huge,0,math.huge) -- vp.velocity=Character.Torso.CFrame.lookVector*Knockback vp.velocity=Torso.CFrame.lookVector*Knockback+Torso.Velocity/1.05 if Knockback>0 then vp.Parent=hit.Parent.Torso end game:GetService("Debris"):AddItem(vp,.25) --[[ r=Instance.new("BodyAngularVelocity") r.P=3000 r.maxTorque=Vector3.new(500000000,50000000000,500000000)*50000 r.angularvelocity=Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20)) r.Parent=hit.Parent.Torso]] game:GetService("Debris"):AddItem(r,.5) c=Instance.new("ObjectValue") c.Name="creator" c.Value=Player c.Parent=h game:GetService("Debris"):AddItem(c,.5) CRIT=false hitDeb=true AttackPos=6 end end end Damagefunc2=function(hit,Damage,Knockback) if attackdebounce == false then attackdebounce = true coroutine.resume(coroutine.create(function() wait(0.1) attackdebounce = false end)) if hit.Parent==nil then return end CPlayer=Bin h=hit.Parent:FindFirstChild("Humanoid") if h~=nil and hit.Parent.Name~="rigletto" and hit.Parent:FindFirstChild("Torso")~=nil then Damage=Damage --[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then return end]] c=Instance.new("ObjectValue") c.Name="creator" c.Value=game.Players.LocalPlayer c.Parent=h game:GetService("Debris"):AddItem(c,.5) -- print(c.Value) if math.random(1,1)==1 then CRIT=true Damage=Damage*2 coroutine.resume(coroutine.create(function() for i = 0,5 do wait() MMMAGIC(hit.Parent.Torso,3,3,3,0,0,0,BrickColor.new("White")) end wait(1) for i = 0,8 do wait(0.1) MOREMAGIX(hit.Parent.Torso,0,2,2,2,BrickColor.new("White")) end end)) Knockback=Knockback*2 r=Instance.new("BodyAngularVelocity") r.P=3000 r.maxTorque=Vector3.new(500000000,50000000000,500000000)*50000 r.angularvelocity=Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20)) r.Parent=hit.Parent.Torso s=Instance.new("Sound") s.SoundId="http://www.roblox.com/asset/?id=2801263" s.Volume=1 s.Pitch=2 s.Parent=hit s.PlayOnRemove=true s.Parent=nil end Damage=Damage+math.random(0,10) -- Blood(hit.CFrame*CFrame.new(math.random(-10,10)/10,math.random(-10,10)/10,0),math.floor(Damage/2)) h:TakeDamage(Damage) showDamage(hit.Parent,Damage,.5) vp=Instance.new("BodyVelocity") vp.P=500 vp.maxForce=Vector3.new(math.huge,0,math.huge) -- vp.velocity=Character.Torso.CFrame.lookVector*Knockback vp.velocity=Torso.CFrame.lookVector*Knockback+Torso.Velocity/1.05 if Knockback>0 then vp.Parent=hit.Parent.Torso end game:GetService("Debris"):AddItem(vp,.25) --[[ r=Instance.new("BodyAngularVelocity") r.P=3000 r.maxTorque=Vector3.new(500000000,50000000000,500000000)*50000 r.angularvelocity=Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20)) r.Parent=hit.Parent.Torso]] game:GetService("Debris"):AddItem(r,.5) c=Instance.new("ObjectValue") c.Name="creator" c.Value=Player c.Parent=h game:GetService("Debris"):AddItem(c,.5) CRIT=false hitDeb=true AttackPos=6 end end end BALLFUNC=function(hit,Damage,Knockback) if hit.Parent==nil then return end CPlayer=Bin h=hit.Parent:FindFirstChild("Humanoid") if h~=nil and hit.Parent.Name~="rigletto" and hit.Parent:FindFirstChild("Torso")~=nil then Damage=Damage --[[ if game.Players:GetPlayerFromCharacter(hit.Parent)~=nil then return end]] c=Instance.new("ObjectValue") c.Name="creator" c.Value=game.Players.LocalPlayer c.Parent=h game:GetService("Debris"):AddItem(c,.5) -- print(c.Value) if math.random(1,1)==1 then CRIT=true Damage=Damage*2 coroutine.resume(coroutine.create(function() for i = 0,5 do wait() MMMAGIC(hit.Parent.Torso,3,3,3,0,0,0,BrickColor.new("White")) end wait(1) for i = 0,8 do wait(0.1) MOREMAGIX(hit.Parent.Torso,0,2,2,2,BrickColor.new("White")) end end)) Knockback=Knockback*2 r=Instance.new("BodyAngularVelocity") r.P=3000 r.maxTorque=Vector3.new(500000000,50000000000,500000000)*50000 r.angularvelocity=Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20)) r.Parent=hit.Parent.Torso s=Instance.new("Sound") s.SoundId="http://www.roblox.com/asset/?id=2801263" s.Volume=1 s.Pitch=2 s.Parent=hit s.PlayOnRemove=true s.Parent=nil end Damage=Damage+math.random(0,10) -- Blood(hit.CFrame*CFrame.new(math.random(-10,10)/10,math.random(-10,10)/10,0),math.floor(Damage/2)) h:TakeDamage(Damage) showDamage(hit.Parent,Damage,.5) vp=Instance.new("BodyVelocity") vp.P=500 vp.maxForce=Vector3.new(math.huge,0,math.huge) -- vp.velocity=Character.Torso.CFrame.lookVector*Knockback vp.velocity=Torso.CFrame.lookVector*Knockback+Torso.Velocity/1.05 if Knockback>0 then vp.Parent=hit.Parent.Torso end game:GetService("Debris"):AddItem(vp,.25) --[[ r=Instance.new("BodyAngularVelocity") r.P=3000 r.maxTorque=Vector3.new(500000000,50000000000,500000000)*50000 r.angularvelocity=Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20)) r.Parent=hit.Parent.Torso]] game:GetService("Debris"):AddItem(r,.5) c=Instance.new("ObjectValue") c.Name="creator" c.Value=Player c.Parent=h game:GetService("Debris"):AddItem(c,.5) CRIT=false hitDeb=true AttackPos=6 end end DBHit=function(hit,DB) --credits to turdulator for making this function :D if hit.Parent==nil then return end h=hit.Parent:FindFirstChild("Humanoid") t=hit.Parent:FindFirstChild("Torso") if h~=nil and t~=nil then if h.Parent==Character then return end h:TakeDamage(5) showDamage(hit.Parent,5,.5) coroutine.resume(coroutine.create(function() MMMAGIC(hit.Parent.Torso,3,3,3,0,0,0,BrickColor.new("White")) wait(1) wait(0.1) MOREMAGIX(hit.Parent.Torso,0,2,2,2,BrickColor.new("White")) end)) vl=Instance.new("BodyVelocity") vl.P=4500 vl.maxForce=Vector3.new(math.huge,math.huge,math.huge) vl.velocity=Vector3.new(Torso.Velocity.x,0,Torso.Velocity.z)*1.05+Vector3.new(0,3,0) vl.Parent=t game:GetService("Debris"):AddItem(vl,.2) rl=Instance.new("BodyAngularVelocity") rl.P=3000 rl.maxTorque=Vector3.new(500000,500000,500000)*50000000000000 rl.angularvelocity=Vector3.new(math.random(-20,20),math.random(-20,20),math.random(-20,20)) rl.Parent=t game:GetService("Debris"):AddItem(rl,.2) else if hit.CanCollide==false then return end MagicCom:disconnect() -- DBExplode(DB) end end showDamage=function(Char,Dealt,du) m=Instance.new("Model") m.Name=tostring(Dealt) h=Instance.new("Humanoid") h.Health=0 h.MaxHealth=0 h.Parent=m c=Instance.new("Part") c.Transparency=0 c.BrickColor=BrickColor:Red() if CRIT==true then c.BrickColor=BrickColor.new("White") end c.Name="Head" c.TopSurface=0 c.BottomSurface=0 c.formFactor="Plate" c.Size=Vector3.new(1,.4,1) ms=Instance.new("CylinderMesh") ms.Bevel=.1 ms.Scale=Vector3.new(.8,.8,.8) if CRIT==true then ms.Scale=Vector3.new(1.25,1.5,1.25) ms.Bevel=.2 end ms.Parent=c c.Reflectance=0 Instance.new("BodyGyro").Parent=c c.Parent=m c.CFrame=CFrame.new(Char["Head"].CFrame.p+Vector3.new(0,1.5,0)) f=Instance.new("BodyPosition") f.P=2000 f.D=100 f.maxForce=Vector3.new(math.huge,math.huge,math.huge) f.position=c.Position+Vector3.new(0,3,0) f.Parent=c game:GetService("Debris"):AddItem(m,.5+du) c.CanCollide=false m.Parent=workspace c.CanCollide=false end function ob1d(mouse) if attack == true then return end hold = true if combo == 0 then oneslash() coroutine.resume(coroutine.create(function() wait(0.5) if attack == false then combo = 0 for i = 0,1,0.1 do wait() Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,1*i-1) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(-2+2,-0.5*i+1,-0.5*i) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1*i-1,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(-1*i+1,0,-1*i+1) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),-1*i+1,math.rad(90)) * CFrame.new(0, 1, -0.4*i+0.4) end wait(0.1) gairo.Parent = nil end end)) elseif combo == 1 then twoslash() coroutine.resume(coroutine.create(function() wait(0.5) if attack == false then combo = 0 for i = 0,1,0.1 do wait() Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,-1*i+1) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,1.5*i-1,-0.5*i) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-1*i+1,0,0) RW.C0 = CFrame.new(0.5*i-0.5+1.5,0.5,0.5*i-0.5) * CFrame.fromEulerAnglesXYZ(-1*i+1,0,1*i-1) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),1*i-1,math.rad(90)) * CFrame.new(0, -0.3*i+0.3+1, 0.5*i-0.5) end wait(0.1) gairo.Parent = nil end end)) elseif combo == 2 then threeslash() coroutine.resume(coroutine.create(function() wait(0.2) if attack == false then combo = 0 for i = 0,1,0.1 do wait(0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0.5*i,-0.5*i) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2*i+4.07,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0.5*i-0.5,0,0) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),-2.7*i+2.7,math.rad(90)) * CFrame.new(0, 1, 0) end wait(0.1) gairo.Parent = nil end end)) elseif combo == 3 then fourslash() coroutine.resume(coroutine.create(function() wait(0.2) if attack == false then combo = 0 for i = 0 , 1 , 0.1 do wait(0) Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0.5*i,-0.5*i) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(3*i+3.57,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0.5*i-0.5,0,0) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),-1.7*i+1.7,math.rad(90)) * CFrame.new(0, 1, 0) end Torso.Neck.C1 = CFrame.fromEulerAnglesXYZ(1.57,3.14,0) * CFrame.new(0,0,-0.5) gairo.Parent = nil LW.C0 = CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0.5,-0.5) LW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C0 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0) RW.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0) weld1.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,math.rad(90)) * CFrame.new(0, 1, 0) end end)) end end function ob1u(mouse) hold = false end buttonhold = false function key(key) if attack == true then return end if key == "q" then HolyWave() end if key == "z" then MagicBlast() end if key == "c" then LightOrb() end if key == "x" then sparklesparkle() end end function key2(key) end function s(mouse) mouse.Button1Down:connect(function() ob1d(mouse) end) mouse.Button1Up:connect(function() ob1u(mouse) end) mouse.KeyDown:connect(key) mouse.KeyUp:connect(key2) unsheathed = true player = Player ch = Character RSH = ch.Torso["Right Shoulder"] LSH = ch.Torso["Left Shoulder"] -- RSH.Parent = nil LSH.Parent = nil -- RW.Part0 = ch.Torso RW.C0 = CFrame.new(1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5) RW.C1 = CFrame.new(0, 0.5, 0) RW.Part1 = ch["Right Arm"] RW.Parent = ch.Torso --_G.R = RW -- LW.Part0 = ch.Torso LW.C0 = CFrame.new(-1.5, 0.5, 0) --* CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8) LW.C1 = CFrame.new(0, 0.5, 0) LW.Part1 = ch["Left Arm"] LW.Parent = ch.Torso --_G.L = LW -- equipanim() end function ds(mouse) unsheathed = false hideanim() wait(0) RW.Parent = nil LW.Parent = nil RSH.Parent = player.Character.Torso LSH.Parent = player.Character.Torso end Bin.Selected:connect(s) Bin.Deselected:connect(ds) coroutine.resume(coroutine.create(function() while true do wait(0.2) if unsheathed == true then local bawleffect = Instance.new("Part") bawleffect.formFactor = 1 bawleffect.CanCollide = false bawleffect.Name = "Effect" bawleffect.Locked = true bawleffect.Size = Vector3.new(1,1,1) bawleffect.Parent = glaive bawleffect.Anchored = true bawleffect.BrickColor = BrickColor.new("White") bawleffect.CFrame = part17.CFrame * CFrame.new(math.random(),math.random(),math.random()) local bawlmesh = Instance.new("SpecialMesh") bawlmesh.Parent = bawleffect bawlmesh.Scale = Vector3.new(0.1,0.1,0.1) bawlmesh.MeshType = "Sphere" coroutine.resume(coroutine.create(function() wait(0.2) for i = 0,1,0.1 do wait() bawleffect.Transparency = i end bawleffect.Parent = nil end)) local bawleffect = Instance.new("Part") bawleffect.formFactor = 1 bawleffect.CanCollide = false bawleffect.Name = "Effect" bawleffect.Locked = true bawleffect.Size = Vector3.new(1,1,1) bawleffect.Parent = glaive bawleffect.Anchored = true bawleffect.BrickColor = BrickColor.new("White") bawleffect.CFrame = part18.CFrame * CFrame.new(math.random(),math.random(),math.random()) local bawlmesh = Instance.new("SpecialMesh") bawlmesh.Parent = bawleffect bawlmesh.Scale = Vector3.new(0.1,0.1,0.1) bawlmesh.MeshType = "Sphere" coroutine.resume(coroutine.create(function() wait(0.2) for i = 0,1,0.1 do wait() bawleffect.Transparency = i end bawleffect.Parent = nil end)) local bawleffect = Instance.new("Part") bawleffect.formFactor = 1 bawleffect.CanCollide = false bawleffect.Name = "Effect" bawleffect.Locked = true bawleffect.Size = Vector3.new(1,1,1) bawleffect.Parent = glaive bawleffect.Anchored = true bawleffect.BrickColor = BrickColor.new("White") bawleffect.CFrame = part17.CFrame * CFrame.new(-math.random(),math.random(),math.random()) local bawlmesh = Instance.new("SpecialMesh") bawlmesh.Parent = bawleffect bawlmesh.Scale = Vector3.new(0.1,0.1,0.1) bawlmesh.MeshType = "Sphere" coroutine.resume(coroutine.create(function() wait(0.2) for i = 0,1,0.1 do wait() bawleffect.Transparency = i end bawleffect.Parent = nil end)) local bawleffect = Instance.new("Part") bawleffect.formFactor = 1 bawleffect.CanCollide = false bawleffect.Name = "Effect" bawleffect.Locked = true bawleffect.Size = Vector3.new(1,1,1) bawleffect.Parent = glaive bawleffect.Anchored = true bawleffect.BrickColor = BrickColor.new("White") bawleffect.CFrame = part18.CFrame * CFrame.new(-math.random(),math.random(),math.random()) local bawlmesh = Instance.new("SpecialMesh") bawlmesh.Parent = bawleffect bawlmesh.Scale = Vector3.new(0.1,0.1,0.1) bawlmesh.MeshType = "Sphere" coroutine.resume(coroutine.create(function() wait(0.2) for i = 0,1,0.1 do wait() bawleffect.Transparency = i end bawleffect.Parent = nil end)) end end end))
33.353695
430
0.703078
a45ce085f323b039193e078874cd0fea5ebcd106
5,086
php
PHP
application/views/user/atualizar/lista.php
cineasthales/Gifty
5cc5774ec956b1cdb522d19785e0895c542b099f
[ "MIT" ]
2
2018-04-20T13:38:28.000Z
2018-12-22T22:13:40.000Z
application/views/user/atualizar/lista.php
cineasthales/Gifty
5cc5774ec956b1cdb522d19785e0895c542b099f
[ "MIT" ]
5
2018-04-07T13:39:19.000Z
2018-11-26T00:58:02.000Z
application/views/user/atualizar/lista.php
cineasthales/Gifty
5cc5774ec956b1cdb522d19785e0895c542b099f
[ "MIT" ]
null
null
null
<main> <section> <div class="row"> <div class="col-8"> <h1>Atualizar Lista</h1> </div> <div class="col-4"> <br><button id="btFinalizar"> <a href="<?= base_url('usuario/atualizar/finalizar') ?>">Finalizar</a></button> </div> <div class="col-12"> <?php if (count($itens) > 0) { ?> <br><br><div style="overflow-x: auto"><table> <tr> <th>Posição</th> <th>Item</th> <th>Adicionado em</th> <th>Ações</th> </tr> <?php for ($i = 0; $i < count($itens); ++$i) { ?> <tr> <td><?= $itens[$i]->prioridade ?></td> <td><a href="<?= $itens[$i]->url ?>" target="_blank"><?= $itens[$i]->nome ?></a></td> <td><?= date_format(date_create($itens[$i]->dataAdicao), 'd/m/Y') ?></td> <td> <?php if (count($itens) > 1) { ?> <?php if ($i > 0) { ?> <a href="<?= base_url('usuario/atualizar/subir/') . $itens[$i]->idItem . '/' . $itens[$i]->idEvento ?>"><i class="fas fa-chevron-circle-up"></i></a> <?php } ?> <?php if ($i < count($itens) - 1) { ?> <a href="<?= base_url('usuario/atualizar/descer/') . $itens[$i]->idItem . '/' . $itens[$i]->idEvento ?>"><i class="fas fa-chevron-circle-down"></i></i></a> <?php } ?> <?php } ?> <a href="<?= base_url('usuario/atualizar/excluir_item/') . $itens[$i]->idEvento . '/' . $itens[$i]->idItem ?>"><i class="fas fa-minus-circle"></i></a> </td> </tr> <?php } ?> </table></div><br><br> <?php } else { ?> <br><br><p class="icon-big"><i class="fas fa-gift"></i></p><p>Sua lista ainda está vazia.<br>Você pode buscar itens ou adicionar nossas recomendações.</p><br> <br><br> <?php } ?> </div> <div class="col-6"> <h2>Itens Recomendados Para Você</h2><br> </div> <form method="post" action="<?= base_url('usuario/atualizar/busca/' . $idEvento) ?>"> <div class="col-5"> <input type="text" id="busca" name="busca" pattern="[A-Za-z0-9]{,100}" maxlength="100" required placeholder="Buscar itens"> </div> <div class="col-1"> <button id='btsearch' style="font-size: 0.75em;" type="submit"><i class="fas fa-search"></i></button><br><br> </div> </form> <?php if (isset($json)) { ?> <?php foreach ($json as $item) { ?> <form method="post" action="<?= base_url('usuario/atualizar/adicionar/' . $idEvento) ?>"> <div class="col-3" style="height: 22em;"> <a href="<?= $item->permalink ?>" target='_blank'> <img style="width: 40%; display: block; margin: 0 auto" src="<?= $item->thumbnail ?>"><br> <p><?= $item->title ?></p><br> </a> <p>R$ <?= number_format($item->price, 2, ',', '.') ?></p><br> <input hidden type="text" id="nome" name="nome" value="<?= $item->title ?>"> <input hidden type="text" id="url" name="url" value="<?= $item->permalink ?>"> <input hidden type="text" id="descricao" name="descricao" value="-"> <input hidden type="text" id="idCategoria" name="idCategoria" value="<?= $item->category_id ?>"> <input hidden type="text" id="preco" name="preco" value="<?= $item->price ?>"> <input hidden type="text" id="imagem" name="imagem" value="<?= $item->thumbnail ?>"> <input type="submit" value="Adicionar"><br><br><br><br><br> </div> </form> <?php } ?> <?php } else { ?> <div class="col-12"> <p class="icon-big"><i class="fas fa-tasks"></i></p><p>Por enquanto, não temos dados suficientes para recomendar itens a você.<br></p><br> </div> <?php } ?> </div> </section> </main>
62.02439
199
0.372591
fdff8f6876b44f86a4ae201385833fb985e0bcd5
290
css
CSS
src/components/card/product-card/product-card.css
hsnice16/react-Inclusive-Mart
5fad8f488df3416d74fd59ea4366643ad3101085
[ "MIT" ]
2
2022-03-21T07:24:50.000Z
2022-03-23T02:13:11.000Z
src/components/card/product-card/product-card.css
hsnice16/react-Inclusive-Mart
5fad8f488df3416d74fd59ea4366643ad3101085
[ "MIT" ]
15
2022-03-13T14:40:41.000Z
2022-03-23T08:16:38.000Z
src/components/card/product-card/product-card.css
hsnice16/react-Inclusive-Mart
5fad8f488df3416d74fd59ea4366643ad3101085
[ "MIT" ]
null
null
null
.btn-add-to-cart { color: var(--COLOR-TEXT-800); font-weight: bold; margin: 0; } .btn-add-to-cart:hover { background: var(--COLOR-YELLOW-600); } .loading-product-card > span { background: var(--COLOR-BACKGROUND); } .loading-product-card > span:nth-child(4) { width: 12rem; }
16.111111
43
0.648276