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
3de4eab50eb81abf525866021351b44ec677a171
138
py
Python
smarttm/storage_backends.py
mseemab/smarttm
4fbc4f2ae57b8555709fafce41528e7d8137ab82
[ "MIT" ]
1
2019-11-25T16:03:58.000Z
2019-11-25T16:03:58.000Z
smarttm/storage_backends.py
mseemab/smarttm
4fbc4f2ae57b8555709fafce41528e7d8137ab82
[ "MIT" ]
32
2019-12-08T13:53:49.000Z
2022-03-12T00:05:23.000Z
smarttm/storage_backends.py
mseemab/smarttm
4fbc4f2ae57b8555709fafce41528e7d8137ab82
[ "MIT" ]
null
null
null
from storages.backends.s3boto3 import S3Boto3Storage class MediaStorage(S3Boto3Storage): location = 'media' file_overwrite = False
34.5
52
0.797101
b0f74c1a34819f3c0c88d1f7fddc318c6201b758
1,001
h
C
31_Traits/Pvector.h
jonixis/CPP18
0dfe165f22a3cbef9e8cda102196d53d3e120e57
[ "MIT" ]
null
null
null
31_Traits/Pvector.h
jonixis/CPP18
0dfe165f22a3cbef9e8cda102196d53d3e120e57
[ "MIT" ]
null
null
null
31_Traits/Pvector.h
jonixis/CPP18
0dfe165f22a3cbef9e8cda102196d53d3e120e57
[ "MIT" ]
null
null
null
#include <vector> #include <fstream> #include <iostream> #include "Persistence_traits.h" using namespace std; #ifndef INC_41_TRAITS_PVECTOR_H #define INC_41_TRAITS_PVECTOR_H template<typename T, typename P=Persistence_traits<T, vector<T>>> class Pvector { string filename; vector<T> v; void read_vector() { ifstream ifs(filename); persister::read(ifs, v); } void write_vector() { ofstream ofs(filename); persister::write(ofs, v); } public: typedef P persister; explicit Pvector(string fname) : filename(fname) { read_vector(); } ~Pvector() { write_vector(); cout << "Pvector: Destructor called!" << endl; } void push_back(const T &el) { v.push_back(el); } void pop_back() { v.pop_back(); } long getSize() { return v.size(); } void printElement(int index) { cout << v.at(index) << endl; } }; #endif //INC_41_TRAITS_PVECTOR_H
18.2
65
0.599401
93a4952dfc9d9207b9b37d7d63e7da17ba83369d
379
cs
C#
Character/Attributes/IAttributeSet.cs
MyTurnyet/CharacterBuilder
b5adaa1ad629113d675a26313430e1355936c307
[ "MIT" ]
1
2017-09-20T16:16:35.000Z
2017-09-20T16:16:35.000Z
Character/Attributes/IAttributeSet.cs
MyTurnyet/CharacterBuilder
b5adaa1ad629113d675a26313430e1355936c307
[ "MIT" ]
null
null
null
Character/Attributes/IAttributeSet.cs
MyTurnyet/CharacterBuilder
b5adaa1ad629113d675a26313430e1355936c307
[ "MIT" ]
null
null
null
using System.Text; using Character.Display; namespace Character.Attributes { public interface IAttributeSet { ICharacterAttribute MatchesName(IAttributeName attributeName); ITextObj DisplayText(); void SetAttribute(IAttributeName attName, IAttributeScore attributeScore); void AddJsonToStringbuilder(StringBuilder stringBuilder); } }
29.153846
82
0.754617
6d426ec0b24fcb3420495e35d5c6b7c47c280df2
521
ts
TypeScript
src/molecules/rentalItem/styles.ts
cchampou/toukan-prod
603cf22dc3f2127f2a17c3c8e06250359fa6670c
[ "MIT" ]
null
null
null
src/molecules/rentalItem/styles.ts
cchampou/toukan-prod
603cf22dc3f2127f2a17c3c8e06250359fa6670c
[ "MIT" ]
2
2022-03-24T01:08:57.000Z
2022-03-31T17:00:30.000Z
src/molecules/rentalItem/styles.ts
cchampou/toukan-prod
603cf22dc3f2127f2a17c3c8e06250359fa6670c
[ "MIT" ]
null
null
null
import styled from '@emotion/styled'; export const RentalItemContainer = styled('div')` display: flex; flex-direction: column; justify-content: flex-start; flex: 1; max-width: 300px; margin: 2rem; `; export const RentalImageContainer = styled('div')` width: 100%; padding-top: 100%; position: relative; overflow: hidden; justify-self: flex-start; img { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 100%; max-height: 100%; } `;
18.607143
50
0.642994
7be6cda482acbf4120e764d2e5b3621154112962
1,390
cpp
C++
src/cpp/226. Invert Binary Tree.cpp
yjjnls/D.S.A-Leet
be19c3ccc1f704e75590786fdfd4cd3ab4818d4f
[ "MIT" ]
222
2018-09-25T08:46:31.000Z
2022-02-07T12:33:42.000Z
src/cpp/226. Invert Binary Tree.cpp
yjjnls/D.S.A-Leet
be19c3ccc1f704e75590786fdfd4cd3ab4818d4f
[ "MIT" ]
1
2017-11-23T04:39:48.000Z
2017-11-23T04:39:48.000Z
src/cpp/226. Invert Binary Tree.cpp
yjjnls/D.S.A-Leet
be19c3ccc1f704e75590786fdfd4cd3ab4818d4f
[ "MIT" ]
12
2018-10-05T03:16:05.000Z
2020-12-19T04:25:33.000Z
/* Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem was inspired by this original tweet by Max Howell: Google: 90% of our engineers use the software you wrote (Homebrew), but you can’t invert a binary tree on a whiteboard so fuck off. */ /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ #include <common.hpp> class Solution1 { public: TreeNode *invertTree(TreeNode *root) { //recursion terminator //current level processing //drill down if (root == NULL) { return NULL; } std::swap(root->left, root->right); invertTree(root->left); invertTree(root->right); return root; } }; //solution 2 no-recursion class Solution2 { public: TreeNode *invertTree(TreeNode *root) { std::stack<TreeNode *> stk; stk.push(root); while (!stk.empty()) { TreeNode *p = stk.top(); stk.pop(); if (p) { stk.push(p->left); stk.push(p->right); std::swap(p->left, p->right); } } return root; } };
18.533333
131
0.5
a3d1db8441797131baf210775c8c81edaa975a5f
1,816
java
Java
engine/src/main/java/org/teiid/query/sql/util/ValueIteratorSource.java
rkorytkowski/teiid
a2b33e947978daf4fee009c8dc2311df6f05d52c
[ "Apache-2.0" ]
null
null
null
engine/src/main/java/org/teiid/query/sql/util/ValueIteratorSource.java
rkorytkowski/teiid
a2b33e947978daf4fee009c8dc2311df6f05d52c
[ "Apache-2.0" ]
1
2019-11-13T09:01:19.000Z
2019-11-13T09:01:19.000Z
engine/src/main/java/org/teiid/query/sql/util/ValueIteratorSource.java
rkorytkowski/teiid
a2b33e947978daf4fee009c8dc2311df6f05d52c
[ "Apache-2.0" ]
null
null
null
/* * Copyright Red Hat, Inc. and/or its affiliates * and other contributors as indicated by the @author tags and * the COPYRIGHT.txt file distributed with this work. * * 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 org.teiid.query.sql.util; import java.util.Set; import org.teiid.core.TeiidComponentException; import org.teiid.core.TeiidProcessingException; import org.teiid.query.sql.symbol.Expression; /** * The ValueIteratorSource lets a language object that needs a ValueIterator hold this * reference to the source of the ValueIterator as a reference until the ValueIterator * can be ready. * * @since 5.0.1 */ public interface ValueIteratorSource { /** * Attempt to obtain a ValueIterator from this source. If the iterator is * not ready yet, return null to indicate that. * @param valueExpression The expression we are retrieving an iterator for * @return ValueIterator if ready, null otherwise * @throws TeiidComponentException * @since 5.0.1 */ ValueIterator getValueIterator(Expression valueExpression) throws TeiidComponentException; Set<Object> getCachedSet(Expression valueExpression) throws TeiidComponentException, TeiidProcessingException; void setUnused(boolean unused); boolean isUnused(); }
33.018182
114
0.746696
5866fe6397fcd5a749a3b574b320a383ac6a0e90
31,203
css
CSS
articles/css/test.css
VibavariG/aicvscummins.github.io
073eb4c8fd2cf48fffa4597059b23051ed3bf8f1
[ "MIT" ]
null
null
null
articles/css/test.css
VibavariG/aicvscummins.github.io
073eb4c8fd2cf48fffa4597059b23051ed3bf8f1
[ "MIT" ]
null
null
null
articles/css/test.css
VibavariG/aicvscummins.github.io
073eb4c8fd2cf48fffa4597059b23051ed3bf8f1
[ "MIT" ]
null
null
null
*{ padding:0; margin:0; } *, ::after, ::before { box-sizing: border-box; } *, *:before, *:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } body{ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; text-align: left; } .wrapper-masthead{ margin-bottom: 50px; } .container { margin: 0 auto; max-width: 740px; padding: 0 10px; width: 100%; } .container{ width: 100%; padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; } @media (min-width: 576px){ .container { max-width: 540px; } } @media (min-width: 768px){ .container { max-width: 720px; } } @media (min-width: 992px){ .container { max-width: 90%; } } header{ display: block; } .masthead { padding: 20px 0; border-bottom: 1px solid #eee; } @media screen and (max-width: 640px){ .masthead { text-align: center; } } .clearfix:before, .clearfix:after { content: " "; display: table; } .clearfix::after { display: block; clear: both; content: ""; } .site-avatar { float: left; margin-right: 15px; } @media screen and (max-width: 640px){ .site-avatar { float: none; display: block; margin: 0 auto; } } .site-avatar img { width:63px; height:63px; margin-top: 5%; border-radius: 5px; } .site-info { float: left; } @media screen and (max-width: 640px){ .site-info { float: none; display: block; margin: 0 auto; } } .site-name{ font-weight: 300; font-size: 28px; letter-spacing: 1px; padding:0px; line-height: 1.2; } .site-description{ color: #666; font-size: 16px; letter-spacing: 0.2px; } a{ color:#333; text-decoration: none; cursor: pointer; } nav { float: right; margin-top: 23px; font-size: 18px; display: block; } @media screen and (max-width: 640px){ nav { float: none; margin-top: 12px; display: block; font-size: 16px; } } nav a{ margin-left:20px; text-align: right; font-weight: 300; letter-spacing: 1px; } @media screen and (max-width: 640px){ nav a { margin: 0 10px; color: #4183C4; } } a:hover, a:active { color: #4183C4; } .active-nav{ color: #4183C4; font-weight: bold; } /*Articles*/ #articles{ margin:70px; } .card{ width:90%; /* width:270px; */ margin:20px auto; } .card img{ width:100%; margin:0; height:20%; } /* @media (max-width:991px){ .card{ width:370px; } .card img{ height:230px; } } @media (max-width:953px){ .card{ width:340px; } .card img{ height:210px; } } @media (max-width:870px){ .card{ width:80%; /* width:300px; */ /*} .card img{ height:200px; } } @media (max-width:767px){ .card{ width:80%; } .card img{ height:30%; } } */ h5{ font-size: 20px; font-weight: bold; } .card-text{ color: rgb(148, 143, 143); } .card-link{ color:#333; } /* Footer */ .wrapper-footer { margin-top: 50px; background-color: rgb(238, 238, 238); border-top: 1px solid rgb(221, 221, 221); border-bottom: 1px solid rgb(221, 221, 221); } footer { text-align: center; padding: 20px 0px; } .svg-icon { width: 40px; height: 40px; display: inline-block; } .svg-icon.github { background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNjAgNjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sbnM6c2tldGNoPSJodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2gvbnMiPg0KICAgIDxwYXRoIGQ9Ik0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NU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+); }
120.011538
10,422
0.943755
2febac12ea78752566e578a3e8ef8e4b192bd2e9
66
py
Python
network_serializer/__init__.py
bubblemans/network-serializer
329fb725d3cc4c6a7ee3ef7b6ad4696379cd7349
[ "MIT" ]
null
null
null
network_serializer/__init__.py
bubblemans/network-serializer
329fb725d3cc4c6a7ee3ef7b6ad4696379cd7349
[ "MIT" ]
null
null
null
network_serializer/__init__.py
bubblemans/network-serializer
329fb725d3cc4c6a7ee3ef7b6ad4696379cd7349
[ "MIT" ]
null
null
null
from network_serializer.network_serializer import Encoder, Decoder
66
66
0.909091
df9d9aa4a923284e4d5794351723761210f2097c
1,051
cs
C#
SimpleAccessModifiers/Parent.cs
GentianGashi/SimpleAccessModifiers
6027a4391bc24b1f7cb86f9b40d95fba33ccbbaa
[ "MIT" ]
1
2020-08-13T00:08:16.000Z
2020-08-13T00:08:16.000Z
SimpleAccessModifiers/Parent.cs
UnboundPhantom/SimpleAccessModifiers
6027a4391bc24b1f7cb86f9b40d95fba33ccbbaa
[ "MIT" ]
null
null
null
SimpleAccessModifiers/Parent.cs
UnboundPhantom/SimpleAccessModifiers
6027a4391bc24b1f7cb86f9b40d95fba33ccbbaa
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SimpleAccessModifiers { public class Parent { string ParentMethod() { return "Method Called In Property"; } string ParentProperty() { return "Property Called In Method"; } public string ParentMethodPublic() { return "Method Called In Property"; } public string ParentPropertyPublic() { return "Property Called In Method"; } //GetName private string parentstring; public string GetName { get { return parentstring; } set { parentstring = value; } } public Parent() { parentstring = "Parent Constructor Called"; } //Protection protected string ParentMethodProtected() { return "Protected Method Called in Parent"; } } }
21.02
55
0.546147
92ec808422e2d50bf1d0809e60bc3d0596f0f662
466
c
C
oddneven.c
el-chay/random-tests
7497bb337092e7f03ca7d1b068b8574d43b3edcb
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
oddneven.c
el-chay/random-tests
7497bb337092e7f03ca7d1b068b8574d43b3edcb
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
oddneven.c
el-chay/random-tests
7497bb337092e7f03ca7d1b068b8574d43b3edcb
[ "Naumen", "Condor-1.1", "MS-PL" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include "mkswap.h" MKSWAP(int) int main(int argc, char *argv[]) { int len = argc-1, *a = malloc(len*sizeof(int)); if(!a) return 1; for(int i = 1; i < argc; i++) a[i-1] = atoi(argv[i]); int *b = a, *e = a+len-1; do{ while(*b%2) b++; while(!(*e%2)) e--; } while(e > b && swap(b++, e--)); for(int i=0; i<len; i++) printf("[%d]:%d\n", i, a[i]); free(a); return 0; }
19.416667
58
0.465665
384e9757b0b19204b9336e8a5715b845be8c2ecc
1,019
php
PHP
app/Http/Controllers/DepartmentsController.php
christiandale1011/ensys-api
a50d20da59e80d70f393e2eb91a724876794dde9
[ "MIT" ]
null
null
null
app/Http/Controllers/DepartmentsController.php
christiandale1011/ensys-api
a50d20da59e80d70f393e2eb91a724876794dde9
[ "MIT" ]
null
null
null
app/Http/Controllers/DepartmentsController.php
christiandale1011/ensys-api
a50d20da59e80d70f393e2eb91a724876794dde9
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers; use App\Departments; use Illuminate\Http\Request; use App\Http\Resources\Departments as DepartmentsResource; class DepartmentsController extends Controller { public function index() { $Departments = Departments::where('status','Active')->get(); return DepartmentsResource::collection($Departments); } public function store(Request $request) { $Departments = new Departments; $incrementing = true; $Departments = $request->isMethod('put') ? Departments::findOrFail ($request->department_id) : new Departments; $Departments->department_desc = $request->input('department_desc'); $Departments->status = "Active"; $Departments->save(); } public function show($id) { // } public function delete($id) { Departments::where(['department_id'=>$id])->update(['status'=>'Inactive']); return response()->json(['success'],200); } }
23.697674
83
0.630029
4d3a5333813606dfee92def3ed68928a211edffd
861
asm
Assembly
programs/oeis/083/A083579.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/083/A083579.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/083/A083579.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A083579: Generalized Jacobsthal numbers. ; 0,1,1,4,8,19,39,82,166,337,677,1360,2724,5455,10915,21838,43682,87373,174753,349516,699040,1398091,2796191,5592394,11184798,22369609,44739229,89478472,178956956,357913927,715827867,1431655750,2863311514,5726623045,11453246105,22906492228,45812984472,91625968963,183251937943,366503875906,733007751830,1466015503681,2932031007381,5864062014784,11728124029588,23456248059199,46912496118419,93824992236862,187649984473746,375299968947517,750599937895057,1501199875790140,3002399751580304,6004799503160635 mov $5,$0 mov $7,$0 lpb $5 mov $0,$7 sub $5,1 sub $0,$5 mov $2,$0 mov $0,2 mov $4,3 mov $6,0 lpb $2 lpb $4 mov $3,$0 sub $3,$6 mov $4,2 trn $4,$0 add $4,2 lpe mul $0,$4 sub $0,1 sub $2,1 mov $4,6 mov $6,$3 lpe sub $6,1 add $1,$6 lpe
27.774194
503
0.707317
fbb502932117762118638048c90d8d048ed91f41
461
h
C
bar-sign/src/applib/esp8266-udp.h
jxmot/esp8266-WS2812B
13bc34dd451e75b4e65e50443b584a371e5a4a5d
[ "MIT" ]
null
null
null
bar-sign/src/applib/esp8266-udp.h
jxmot/esp8266-WS2812B
13bc34dd451e75b4e65e50443b584a371e5a4a5d
[ "MIT" ]
null
null
null
bar-sign/src/applib/esp8266-udp.h
jxmot/esp8266-WS2812B
13bc34dd451e75b4e65e50443b584a371e5a4a5d
[ "MIT" ]
null
null
null
/* ************************************************************************ */ /* esp8266-udp.h - UDP support for the associated ino file. */ #pragma once #include "udp-defs.h" #ifdef __cplusplus extern "C" { #endif extern int initUDP(); extern int replyUDP(char *payload, int len); extern int recvUDP(); extern int multiUDP(char *payload, int len); extern unsigned char readBuffer[]; extern unsigned char writeBuffer[]; #ifdef __cplusplus } #endif
17.074074
78
0.596529
b51ab08b7c5194b420936ac94afcacd72dbbee7a
3,566
rb
Ruby
spec/requests/api/v2/providers/courses/update_sites_spec.rb
VickyKoblinski/teacher-training-api
b03b78ef0b7d02d0c3adc164627d84128269ff01
[ "MIT" ]
null
null
null
spec/requests/api/v2/providers/courses/update_sites_spec.rb
VickyKoblinski/teacher-training-api
b03b78ef0b7d02d0c3adc164627d84128269ff01
[ "MIT" ]
null
null
null
spec/requests/api/v2/providers/courses/update_sites_spec.rb
VickyKoblinski/teacher-training-api
b03b78ef0b7d02d0c3adc164627d84128269ff01
[ "MIT" ]
null
null
null
require "rails_helper" describe "PATCH /providers/:provider_code/courses/:course_code with sites" do let(:organisation) { create :organisation } let(:provider) { create :provider, organisations: [organisation] } let(:user) { create :user, organisations: [organisation] } let(:payload) { { email: user.email } } let(:token) { build_jwt :apiv2, payload: payload } let(:credentials) do ActionController::HttpAuthentication::Token.encode_credentials(token) end let(:course) { create(:course, :infer_level, provider: provider, site_statuses: [site_status], subjects: [primary_subject], enrichments: [course_enrichment]) } let(:course_enrichment) { build :course_enrichment } let(:site_status) { build(:site_status) } let(:primary_subject) { find_or_create(:primary_subject, :primary_with_mathematics) } let(:site_to_add) { create :site, provider: provider } let(:unwanted_site) { create :site, provider: provider } let(:existing_site) { create :site, provider: provider } before do course.sites = [site_status.site, existing_site, unwanted_site] end let(:sites_payload) { [ { "type" => "sites", "id" => existing_site.id.to_s }, { "type" => "sites", "id" => site_to_add.id.to_s }, ] } let(:jsonapi_data) do { "_jsonapi" => { "data" => { "id" => course.id.to_s, "type" => "courses", "relationships" => { "sites" => { "data" => sites_payload, }, }, }, }, } end def perform_request patch "/api/v2/providers/#{course.provider.provider_code}" \ "/courses/#{course.course_code}", headers: { "HTTP_AUTHORIZATION" => credentials, 'Content-Type': "application/json", }, params: jsonapi_data.to_json end context "course has some sites" do context "course is new" do before do perform_enqueued_jobs do perform_request end end it "returns http success" do expect(response).to have_http_status(:success) end it "adds a new site" do expect(course.reload.sites.exists?(site_to_add.id)).to be(true) end it "leaves existing site in place" do expect(course.reload.sites.exists?(existing_site.id)).to be(true) end it "removes an unwanted site" do expect(course.reload.sites.exists?(unwanted_site.id)).to be(false) end end context "course is running" do let(:course_enrichment) { build :course_enrichment, :published } before do course.publish_sites perform_enqueued_jobs do perform_request end end it "suspends an unwanted site" do expect( course.reload.site_statuses.find_by(site_id: unwanted_site.id).status, ).to eq("suspended") end end context "removing all sites" do let(:sites_payload) { [] } before do perform_enqueued_jobs do perform_request end end it "returns http 422" do expect(response).to have_http_status(:unprocessable_entity) end it "leaves existing site in place" do expect(course.reload.sites.exists?(existing_site.id)).to be(true) expect(course.reload.sites.exists?(unwanted_site.id)).to be(true) end it "returns validation error" do expect(response.body).to include("You must choose at least one location") end end end end
28.758065
161
0.617218
0352a033b95d3cabc925c60f92cdae7196e0b2a3
722
rb
Ruby
lib/tkh_access_control.rb
allesklar/tkh_access_control
b9482d4d49c28701e299ed706b22944bb719d886
[ "MIT" ]
null
null
null
lib/tkh_access_control.rb
allesklar/tkh_access_control
b9482d4d49c28701e299ed706b22944bb719d886
[ "MIT" ]
2
2020-02-25T02:59:25.000Z
2020-08-10T07:26:48.000Z
lib/tkh_access_control.rb
allesklar/tkh_access_control
b9482d4d49c28701e299ed706b22944bb719d886
[ "MIT" ]
null
null
null
require "tkh_access_control/version" # require 'bcrypt-ruby' require 'simple_form' require 'stringex' require 'tkh_access_control/tkh_access_control_action_controller_extension' require 'tkh_access_control/tkh_access_control_helper' module TkhAccessControl class Engine < ::Rails::Engine # to extend the application helper in the host app initializer 'tkh_access_control.helper' do |app| ActionView::Base.send :include, TkhAccessControlHelper end # to extend the application_controller in the host app initializer 'tkh_access_control.controller' do |app| ActiveSupport.on_load(:action_controller) do include TkhAccessControlActionControllerExtension end end end end
32.818182
75
0.782548
14cf44227300943cc3ddcd38664170f082b45973
697
ts
TypeScript
src/helpers.ts
paulbarclay/loom-js
5dbf8e49e87c4e03c3b946e23e2a3b6e27d48c7b
[ "BSD-3-Clause" ]
2
2018-10-08T08:12:57.000Z
2021-09-19T10:33:39.000Z
src/helpers.ts
paulbarclay/loom-js
5dbf8e49e87c4e03c3b946e23e2a3b6e27d48c7b
[ "BSD-3-Clause" ]
null
null
null
src/helpers.ts
paulbarclay/loom-js
5dbf8e49e87c4e03c3b946e23e2a3b6e27d48c7b
[ "BSD-3-Clause" ]
2
2018-10-03T15:05:50.000Z
2019-12-04T15:12:26.000Z
import { Client, ITxMiddlewareHandler } from './client' import { NonceTxMiddleware, SignedTxMiddleware } from './middleware' import { publicKeyFromPrivateKey } from './crypto-utils' /** * Creates the default set of tx middleware required to successfully commit a tx to a Loom DAppChain. * @param client The client the middleware is being created for. * @param privateKey Private key that should be used to sign txs. * @returns Set of middleware. */ export function createDefaultTxMiddleware( client: Client, privateKey: Uint8Array ): ITxMiddlewareHandler[] { const pubKey = publicKeyFromPrivateKey(privateKey) return [new NonceTxMiddleware(client), new SignedTxMiddleware(client)] }
38.722222
101
0.771879
ddd6ef230ea85f9ae7b006cd784d9e47cb8339fa
5,022
java
Java
car/app/app/src/main/java/androidx/car/app/model/ActionStrip.java
Mu-L/androidx
f42c5f033a9e71bbaf580392cebaa6b274f2aca0
[ "Apache-2.0" ]
null
null
null
car/app/app/src/main/java/androidx/car/app/model/ActionStrip.java
Mu-L/androidx
f42c5f033a9e71bbaf580392cebaa6b274f2aca0
[ "Apache-2.0" ]
null
null
null
car/app/app/src/main/java/androidx/car/app/model/ActionStrip.java
Mu-L/androidx
f42c5f033a9e71bbaf580392cebaa6b274f2aca0
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package androidx.car.app.model; import static java.util.Objects.requireNonNull; import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.car.app.model.Action.ActionType; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.Set; /** * Represents a list of {@link Action}s that are used for a template. * * <p>The {@link Action}s in the {@link ActionStrip} may be displayed differently depending on the * template they are used with. For example, a map template may display them as a group of floating * action buttons (FABs) over the map background. * * <p>See the documentation of individual {@link Template}s on restrictions around what actions are * supported. */ public class ActionStrip { @Keep private final List<Object> mActions; /** Constructs a new builder of {@link ActionStrip}. */ @NonNull public static Builder builder() { return new Builder(); } /** * Returns the list of {@link Action}'s. */ @NonNull public List<Object> getActions() { return mActions; } /** * Returns the {@link Action} associated with the input {@code actionType}, or {@code null} if * no matching {@link Action} is found. */ @Nullable public Action getActionOfType(@ActionType int actionType) { for (Object object : mActions) { if (object instanceof Action) { Action action = (Action) object; if (action.getType() == actionType) { return action; } } } return null; } @Override @NonNull public String toString() { return "[action count: " + mActions.size() + "]"; } @Override public int hashCode() { return Objects.hashCode(mActions); } @Override public boolean equals(@Nullable Object other) { if (this == other) { return true; } if (!(other instanceof ActionStrip)) { return false; } ActionStrip otherActionStrip = (ActionStrip) other; return Objects.equals(mActions, otherActionStrip.mActions); } private ActionStrip(Builder builder) { mActions = builder.mActions; } /** Constructs an empty instance, used by serialization code. */ private ActionStrip() { mActions = Collections.emptyList(); } /** A builder of {@link ActionStrip}. */ public static final class Builder { private final List<Object> mActions = new ArrayList<>(); private final Set<Integer> mAddedActionTypes = new HashSet<>(); /** * Adds an {@link Action} to the list. * * @throws IllegalArgumentException if the background color of the action is specified. * @throws IllegalArgumentException if {@code action} is a standard action and an action of * the same type has already been added. * @throws NullPointerException if {@code action} is {@code null}. */ @NonNull public Builder addAction(@NonNull Action action) { Action actionObj = requireNonNull(action); int actionType = actionObj.getType(); if (actionType != Action.TYPE_CUSTOM && mAddedActionTypes.contains(actionType)) { throw new IllegalArgumentException( "Duplicated action types are disallowed: " + action); } if (!CarColor.DEFAULT.equals(actionObj.getBackgroundColor())) { throw new IllegalArgumentException( "Action strip actions don't support background colors"); } mAddedActionTypes.add(actionType); mActions.add(action); return this; } /** * Constructs the {@link ActionStrip} defined by this builder. * * @throws IllegalStateException if the action strip is empty. */ @NonNull public ActionStrip build() { if (mActions.isEmpty()) { throw new IllegalStateException("Action strip must contain at least one action"); } return new ActionStrip(this); } } }
32.192308
99
0.621466
3900a7f49afa6d939d6dc4513df732b20be28a95
211
py
Python
ligabot/domain/match.py
eiriktj/ligabot
cbb6645338072d26d22959795efbdd70f2c61d33
[ "MIT" ]
null
null
null
ligabot/domain/match.py
eiriktj/ligabot
cbb6645338072d26d22959795efbdd70f2c61d33
[ "MIT" ]
null
null
null
ligabot/domain/match.py
eiriktj/ligabot
cbb6645338072d26d22959795efbdd70f2c61d33
[ "MIT" ]
null
null
null
class Match: def __init__(self): self.date = "" self.round = "" self.tournament = "" self.home = "" self.score = "" self.away = "" self.channels = ""
19.181818
28
0.440758
6d25a75c882eba7e542ee0042589cfe812b1bed5
211
dart
Dart
packages/hetu_script/lib/binding/auto_binding.dart
polotto/hetu-script
ea6ef0ca44366ea576622d08a4f3c4db16fb545b
[ "MIT" ]
null
null
null
packages/hetu_script/lib/binding/auto_binding.dart
polotto/hetu-script
ea6ef0ca44366ea576622d08a4f3c4db16fb545b
[ "MIT" ]
null
null
null
packages/hetu_script/lib/binding/auto_binding.dart
polotto/hetu-script
ea6ef0ca44366ea576622d08a4f3c4db16fb545b
[ "MIT" ]
null
null
null
/// Annotation for auto-binding. /// Referrence: [https://github.com/hetu-script/hetu-script-autobinding](https://github.com/hetu-script/hetu-script-autobinding) class HTAutoBinding { const HTAutoBinding(); }
35.166667
128
0.758294
a46c5db3edb35e3fbb1e0a6e27725aecf946077c
3,975
php
PHP
adm/adm/cad_frete.php
sistemaids/newcorpbrasil
7d33208138bc3fda0aa2487cc1d110378fa94c46
[ "BSD-2-Clause" ]
null
null
null
adm/adm/cad_frete.php
sistemaids/newcorpbrasil
7d33208138bc3fda0aa2487cc1d110378fa94c46
[ "BSD-2-Clause" ]
null
null
null
adm/adm/cad_frete.php
sistemaids/newcorpbrasil
7d33208138bc3fda0aa2487cc1d110378fa94c46
[ "BSD-2-Clause" ]
null
null
null
<?PHP // +---------------------------------------------------------+ // | Edi��o de registros - frete | // +---------------------------------------------------------+ include "../inc_dbConexao.php"; SESSION_START(); $acao = $_GET['acao']; $id = $_GET['id']; $titulo_pagina = $_GET['titulo']; if ($acao == "ver") { // modo de edi��o das caixas de texto do formul�rio $editar = "readonly='true'"; $editar_combo = "disabled='disabled'"; $estilo_caixa = "caixa_texto_des"; } else { $editar = ""; $editar_combo = ""; $estilo_caixa = "caixa_texto"; } // Recupera registro $sql = "SELECT * FROM tb_estados "; $sql = $sql . " WHERE id = '" . $id . "' "; $rs = mysql_query($sql, $conexao); $reg = mysql_fetch_array($rs); $id = $reg['id']; $uf = $reg['uf']; $nome = $reg['nome']; $frete = $reg['frete']; $cepi = $reg['cepi']; $cepf = $reg['cepf']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>MiniERP - Administrativo</title> <link href="estilo_adm.css" rel="stylesheet" type="text/css" /> </head> <body> <form name="form_cad" method="post" action="cad_frete1.php"> <div id="corpo"> <div id="topo"> <h1>Administração do Site</h1> </div> <div id="caixa_menu"> <?PHP include "inc_menu.php" ?> </div> <div id="caixa_conteudo"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="62%"><h1 class="c_cinza">Manutenção Cadastral <img src="../imagens/marcador_setaDir.gif" align="absmiddle" /> Frete <img src="../imagens/marcador_setaDir.gif" align="absmiddle" /> <span class="c_preto"><?PHP print $titulo_pagina; ?></span> </h1> </td> <td width="38%"><div align="right"> <?PHP if($acao == "ins" or $acao == "alt") { ?> <a href="cad_frete_grid.php?id=<?PHP print $id; ?>"><img src="../imagens/btn_fechar_ss.gif" alt="Fechar" border="0" /></a> <input type="image" name="imageField" src="../imagens/btn_salvar.gif" /> <input type="hidden" name="acao" value="<?PHP print $acao; ?>" /> <input type="hidden" name="id" value="<?PHP print $id; ?>" /> <?PHP } ?> <?PHP if($acao == "exc") { ?> <input type="image" name="imageField" src="../imagens/btn_excluir.gif" /> <input type="hidden" name="acao" value="<?PHP print $acao; ?>" /> <input type="hidden" name="id" value="<?PHP print $id; ?>" /> <a href="cad_frete_grid.php?id=<?PHP print $id; ?>"><img src="../imagens/btn_nao_excluir.gif" alt="Fechar" border="0" /></a> <?PHP } ?> <?PHP if($acao == "ver") { ?> <a href="cad_frete_grid.php?id=<?PHP print $id; ?>"><img src="../imagens/btn_fechar.gif" alt="Fechar" border="0" /></a> <?PHP } ?> </div></td> </tr> </table> <div id="caixa_cad"> <p><label>UF:</label><input name="uf" type="text" class="<?PHP print $estilo_caixa; ?>" size="2" maxlength="2" value="<?PHP print $uf; ?>" <?PHP print $editar; ?> /></p> <p><label>Estado:</label><input name="nome" type="text" class="<?PHP print $estilo_caixa; ?>" size="20" maxlength="20" value="<?PHP print $nome; ?>" <?PHP print $editar; ?> /></p> <p><label>Frete:</label><input name="frete" type="text" class="<?PHP print $estilo_caixa; ?>" size="11" maxlength="11" value="<?PHP print $frete; ?>" <?PHP print $editar; ?> /></p> <p><label>CEP inicial:</label><input name="cepi" type="text" class="<?PHP print $estilo_caixa; ?>" size="8" maxlength="8" value="<?PHP print $cepi; ?>" <?PHP print $editar; ?> /></p> <p><label>CEP final:</label><input name="cepf" type="text" class="<?PHP print $estilo_caixa; ?>" size="8" maxlength="8" value="<?PHP print $cepf; ?>" <?PHP print $editar; ?> /></p> </div> </div> <!-- rodape da p�gina --> <?PHP include "inc_rodape.php" ?> </div> </form> </body> </html> <?PHP // Libera os recursos usados pela conex�o atual mysql_free_result($rs); mysql_close ($conexao); ?>
40.979381
257
0.582642
ef1f8c9d8aecfbdc79553595af668c5426a04e78
1,198
kt
Kotlin
confluence-plugin/src/main/java/com/networkedassets/git4c/infrastructure/HtmlErrorPageBuilder.kt
RobertPaasche/git4c
e55391b33cb70d66bbf5f36ba570fb8822f10953
[ "Apache-2.0" ]
17
2017-08-31T20:54:04.000Z
2020-12-22T09:45:14.000Z
confluence-plugin/src/main/java/com/networkedassets/git4c/infrastructure/HtmlErrorPageBuilder.kt
RobertPaasche/git4c
e55391b33cb70d66bbf5f36ba570fb8822f10953
[ "Apache-2.0" ]
27
2017-11-05T14:23:26.000Z
2021-09-30T04:52:21.000Z
confluence-plugin/src/main/java/com/networkedassets/git4c/infrastructure/HtmlErrorPageBuilder.kt
RobertPaasche/git4c
e55391b33cb70d66bbf5f36ba570fb8822f10953
[ "Apache-2.0" ]
8
2018-03-08T20:21:57.000Z
2020-12-25T21:59:41.000Z
package com.networkedassets.git4c.infrastructure import com.networkedassets.git4c.core.business.ErrorPageBuilder import com.networkedassets.git4c.core.bussiness.ImportedFileData import org.apache.commons.lang3.exception.ExceptionUtils class HtmlErrorPageBuilder: ErrorPageBuilder { override fun build(file: ImportedFileData, ex: Throwable): String { val stackTrace = ExceptionUtils.getStackTrace(ex) val page = """ <div class="aui-message aui-message-error"> <p class="title"> <strong>Error!</strong> </p> <p>Error while reading file. Please send the following log to the plugin developers.</p> </div> <pre> <code class="git4c-code" style="overflow-x: auto;"> File: ${file.path} Message: ${ex.message} Stacktrace: $stackTrace </code> </pre> """.lines().joinToString(separator = "\n") { it.trim() } return page } }
34.228571
112
0.520033
1f485bf1a822c08229b3136902e8701e7befda49
381
lua
Lua
build.lua
ryanhe312/fduthesis
3db6c36b62affeb941e5201cd4eb02c5179964fe
[ "LPPL-1.3c" ]
450
2019-01-29T03:58:43.000Z
2022-03-25T03:03:44.000Z
build.lua
ryanhe312/fduthesis
3db6c36b62affeb941e5201cd4eb02c5179964fe
[ "LPPL-1.3c" ]
193
2019-01-31T06:38:11.000Z
2022-03-23T16:42:16.000Z
build.lua
ryanhe312/fduthesis
3db6c36b62affeb941e5201cd4eb02c5179964fe
[ "LPPL-1.3c" ]
145
2019-03-01T10:28:32.000Z
2022-03-28T09:31:17.000Z
#!/usr/bin/env texlua -- Build script for fduthesis. module = "fduthesis" checkengines = {"xetex", "luatex"} checkopts = "-interaction=batchmode" sourcefiles = {"source/*.dtx"} installfiles = {"*.cls", "*.sty", "*.def"} -- typesetdeps = {"source/latexmkrc."} typesetexe = "xelatex" typesetfiles = {"fduthesis.dtx"} unpackfiles = {"fduthesis.dtx"} unpackexe = "xetex"
20.052632
42
0.656168
437047fb9ba3a627ba72a8e8238c61e062798c1d
1,046
ts
TypeScript
backend/src/utils/scholarship/selectScholarshipsByCategoryId.ts
team-free-money/team-free-money-cs
c5ff8b048befb4dc695554194c6fb5c807306505
[ "Apache-2.0" ]
null
null
null
backend/src/utils/scholarship/selectScholarshipsByCategoryId.ts
team-free-money/team-free-money-cs
c5ff8b048befb4dc695554194c6fb5c807306505
[ "Apache-2.0" ]
null
null
null
backend/src/utils/scholarship/selectScholarshipsByCategoryId.ts
team-free-money/team-free-money-cs
c5ff8b048befb4dc695554194c6fb5c807306505
[ "Apache-2.0" ]
null
null
null
import {Scholarship} from "../interfaces/Scholarship"; import {connect} from "../database.utils"; import {RowDataPacket} from 'mysql2'; export async function selectScholarshipsByCategoryId(categoryId: string) : Promise<Scholarship[]> { try { console.log(categoryId) const mySqlConnection = await connect(); const mySqlQuery = "SELECT BIN_TO_UUID(scholarshipId) as scholarshipId, scholarshipAmount, scholarshipCriteria, scholarshipDeadline, scholarshipDescription, scholarshipLink, scholarshipName, (SELECT COUNT(likeScholarshipId) FROM `like` WHERE scholarship.scholarshipId = `like`.likeScholarshipId) AS likeCount FROM scholarship INNER JOIN scholarshipCategory ON scholarshipCategory.scholarshipCategoryScholarshipId = scholarship.scholarshipId WHERE scholarshipCategory.scholarshipCategoryCategoryId = uuid_to_bin(:categoryId)" const result = await <RowDataPacket>mySqlConnection.execute(mySqlQuery, {categoryId}) return result[0] as Scholarship[] } catch (error) { throw error } }
69.733333
532
0.778203
49a3ead6a0655508c4f79c96f7d0846d824f596a
658
dart
Dart
lib/screens/requests/requestlist.dart
kanavpruthi/ShareACab
71cccef9247cc27064be0fe069ba88226b40947c
[ "MIT" ]
1
2020-06-20T07:17:00.000Z
2020-06-20T07:17:00.000Z
lib/screens/requests/requestlist.dart
kanavpruthi/ShareACab
71cccef9247cc27064be0fe069ba88226b40947c
[ "MIT" ]
null
null
null
lib/screens/requests/requestlist.dart
kanavpruthi/ShareACab
71cccef9247cc27064be0fe069ba88226b40947c
[ "MIT" ]
null
null
null
import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; class RequestDetails { @required final String name; @required final String finalDestination; @required final String id; @required final String destination; @required final DateTime startDate; @required final TimeOfDay startTime; @required final DateTime endDate; @required final TimeOfDay endTime; @required final String status; // Give status as Pending, Accepted and Declined. RequestDetails({this.name, this.id, this.destination, this.finalDestination, this.startDate, this.startTime, this.endDate, this.endTime, this.status}); }
23.5
153
0.753799
ff248193e25ef8d38d150e64bc64284ed07fe8b8
958
py
Python
mayan/apps/databases/patches.py
nattangwiwat/Mayan-EDMS-recitation
fcf16afb56eae812fb99144d65ae1ae6749de0b7
[ "Apache-2.0" ]
343
2015-01-05T14:19:35.000Z
2018-12-10T19:07:48.000Z
mayan/apps/databases/patches.py
nattangwiwat/Mayan-EDMS-recitation
fcf16afb56eae812fb99144d65ae1ae6749de0b7
[ "Apache-2.0" ]
191
2015-01-03T00:48:19.000Z
2018-11-30T09:10:25.000Z
mayan/apps/databases/patches.py
nattangwiwat/Mayan-EDMS-recitation
fcf16afb56eae812fb99144d65ae1ae6749de0b7
[ "Apache-2.0" ]
257
2019-05-14T10:26:37.000Z
2022-03-30T03:37:36.000Z
import datetime from django.conf import settings from django.db.migrations import Migration def patch_Migration(): _method_original__apply = Migration.apply _method_original__unapply = Migration.unapply def _method_patched__apply(self, *args, **kwargs): now_start = datetime.datetime.now() result = _method_original__apply(self, *args, **kwargs) time_delta = datetime.datetime.now() - now_start print(' (Time delta: {})'.format(time_delta), end='') return result def _method_patched__unapply(self, *args, **kwargs): now_start = datetime.datetime.now() result = _method_original__unapply(self, *args, **kwargs) time_delta = datetime.datetime.now() - now_start print(' (Time delta: {})'.format(time_delta), end='') return result if settings.DEBUG: Migration.apply = _method_patched__apply Migration.unapply = _method_patched__unapply
29.9375
65
0.68476
5bff7566177243efb113abd6625d346304c75e8c
64
css
CSS
app/portainer/settings/authentication/ldap/ldap-settings-custom/ldap-settings-custom.css
TONITUCKER/portainer
c442d936d3cabfc66f8560b2f4087b4331935c39
[ "Zlib" ]
1
2022-02-14T21:28:16.000Z
2022-02-14T21:28:16.000Z
app/portainer/settings/authentication/ldap/ldap-settings-custom/ldap-settings-custom.css
powerpook/portainer
335f951e6b59f7e3f1177bb29481e31d3c02d2f5
[ "Zlib" ]
1
2022-01-22T11:53:55.000Z
2022-01-22T11:53:56.000Z
app/portainer/settings/authentication/ldap/ldap-settings-custom/ldap-settings-custom.css
powerpook/portainer
335f951e6b59f7e3f1177bb29481e31d3c02d2f5
[ "Zlib" ]
null
null
null
label[for='anonymous_mode'].control-label { padding-top: 0; }
16
43
0.703125
a4583cd7886681bad3d002575a2169d0f1630260
12,232
php
PHP
src/core/classes/org/glizycms/core/application/Application.php
GiulioTuretta/Movio
0ed030673214fb11680077bcb49efdbfd4aef4cf
[ "MIT" ]
18
2016-06-02T08:09:30.000Z
2021-05-09T08:37:18.000Z
src/core/classes/org/glizycms/core/application/Application.php
GiulioTuretta/Movio
0ed030673214fb11680077bcb49efdbfd4aef4cf
[ "MIT" ]
18
2016-03-29T11:26:18.000Z
2021-11-03T15:14:09.000Z
src/core/classes/org/glizycms/core/application/Application.php
GiulioTuretta/Movio
0ed030673214fb11680077bcb49efdbfd4aef4cf
[ "MIT" ]
6
2017-12-09T09:53:35.000Z
2021-07-23T15:23:42.000Z
<?php /** * Application class. * * This file is part of the GLIZY framework. * Copyright (c) 2005-2012 Daniele Ugoletti <daniele.ugoletti@glizy.com> * * For the full copyright and license information, please view the COPYRIGHT.txt * file that was distributed with this source code. */ class org_glizycms_core_application_Application extends org_glizy_mvc_core_Application { var $_aclPage; var $_siteProperty; var $_templateName; function __construct($pathApplication='', $pathCore='', $configHost='') { org_glizy_Paths::init($pathApplication, $pathCore); org_glizy_Paths::add('APPLICATION_TO_ADMIN', org_glizy_Paths::get('APPLICATION')); org_glizy_Paths::add('APPLICATION_TO_ADMIN_CACHE', org_glizy_Paths::get('APPLICATION').'../cache/'); parent::__construct($pathApplication, $pathCore, $configHost); } public function runSoft() { parent::runSoft(); $this->readSiteProperties(); } function _init() { org_glizy_ObjectValues::set('org.glizy', 'siteId', __Config::get('glizy.multisite.id')); parent::_init(); } function _initLanguage() { $this->log( "initLanguage", GLZ_LOG_SYSTEM ); // inizializza la lingua $this->_language = org_glizy_Session::get('glizy.language', NULL); $this->_languageId = org_glizy_Session::get('glizy.languageId', NULL); if (is_null($this->_languageId)) { $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); // try to read the browser language $this->log( "Read browser language", GLZ_LOG_SYSTEM ); $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language'); if (!$ar->find(array('language_code' => $lang))) { $this->log( "Read defaul language", GLZ_LOG_SYSTEM ); $ar->emptyRecord(); $ar->find(array('language_isDefault' => 1)); } $this->_language = $ar->language_code; $this->_languageId = $ar->language_id; org_glizy_Session::set('glizy.language', $this->_language); org_glizy_Session::set('glizy.languageId', $this->_languageId); } org_glizy_ObjectValues::set('org.glizy', 'languageId', $this->_languageId); // importa i file di localizzazione if (file_exists(org_glizy_Paths::getRealPath('CORE_CLASSES').'org/glizy/locale/'.$this->getLanguage().'.php')) { $this->log( "Import locale file", GLZ_LOG_SYSTEM ); require_once(org_glizy_Paths::getRealPath('CORE_CLASSES').'org/glizy/locale/'.$this->getLanguage().'.php'); } else { require_once(org_glizy_Paths::getRealPath('CORE_CLASSES').'org/glizy/locale/en.php'); } } function createSiteMap($forceReload=false) { $this->log( "initSiteMap", GLZ_LOG_SYSTEM ); $this->siteMap = &org_glizy_ObjectFactory::createObject('org.glizycms.core.application.SiteMapDB'); $this->siteMap->getSiteArray($forceReload); // controlla se l'utente ha i permessi per modificare la pagina // per velocizzare vengono precaricate tutte le relazioni in memoria $this->_aclPage = array(); if ( __Config::get( 'ACL_ENABLED' ) ) { $this->_aclPage = __Session::get('glizy.aclFront', NULL); if (is_null($this->_aclPage)) { $this->_aclPage = array(); $it = org_glizy_ObjectFactory::createModelIterator( 'org.glizy.models.Join', 'all', array( 'filters' => array( 'join_objectName' => 'menus_tbl#rel_aclFront' ) ) ); foreach ($it as $arC) { if ( !isset( $this->_aclPage[ $arC->join_FK_source_id ] ) ) { $this->_aclPage[ $arC->join_FK_source_id ] = array(); } $this->_aclPage[ $arC->join_FK_source_id ][] = $arC->join_FK_dest_id ; } // scorre tutti i menù per attribuire l'acl ai menù che non ce l'hanno // ereditandola dal padre $siteMapIterator = &org_glizy_ObjectFactory::createObject('org.glizy.application.SiteMapIterator', $this->siteMap); while (!$siteMapIterator->EOF) { $n = $siteMapIterator->getNode(); $siteMapIterator->moveNext(); if ( !isset($this->_aclPage[$n->id])) { $n2 = $n; while (true) { if ( $n2->parentId == 0 ) break; $parentNode = $n2->parentNode(); $n2 = $parentNode; if ( isset( $this->_aclPage[$parentNode->id])) { $this->_aclPage[$n->id] = $this->_aclPage[$parentNode->id]; break; } } } } __Session::set('glizy.aclFront', $this->_aclPage); } } } function _startProcess($readPageId=true) { $this->log( "startProcess", GLZ_LOG_SYSTEM ); $this->checkSwitchLanguage(); $controller = __Request::get( 'controller', '', GLZ_REQUEST_ROUTING ); if ($controller) { $controllerClass = org_glizy_ObjectFactory::createObject( $controller, null, $this ); org_glizy_helpers_PhpScript::callMethodWithParams( $controllerClass, 'execute' ); } $this->readSiteProperties(); $this->setTemplateFolder(); if ($readPageId) { $evt = array('type' => GLZ_EVT_BEFORE_CREATE_PAGE); $this->dispatchEvent($evt); $this->_readPageId(); } if ($this->siteMapMenu->isVisible===false) { while(true) { $parentMenu = &$this->siteMapMenu->parentNode(); if (is_null($parentMenu)) { // ERROR $e = new org_glizy_Exception(array('[%s] %s', $this->getClassName(), __T(GLZ_ERR_EMPTY_APP_PATH))); } $this->siteMapMenu = &$parentMenu; if ($parentMenu->isVisible===true) { $this->_pageId = $this->siteMapMenu->id; break; } } } // TODO da risolvare in modo migliore // creando un nuovo menu_type if ($this->siteMapMenu->pageType=='Empty') { $currentPage = &$this->siteMapMenu; $childPos = 0; while (true) { $childNodes = $currentPage->childNodes(); if (!count($childNodes)) { org_glizy_helpers_Navigation::gotoUrl(GLZ_HOST); return; } $tempPage = &$childNodes[$childPos]; if ($tempPage->type=='BLOCK') { $childPos++; continue; } $currentPage = &$tempPage; $childPos = 0; if ($currentPage->pageType!='Empty') { $this->siteMapMenu = &$currentPage; $this->_pageId = $currentPage->id; break; } } } parent::_startProcess(false); } function canViewPage( $page=null ) { if ( is_null( $page ) ) { $page = $this->_pageId; } $user = &$this->getCurrentUser(); /* if ( isset( $this->_aclPage[ $page ] ) && $user->groupId != 1 ) { return in_array( $user->groupId, $this->_aclPage[ $page ] ); } else return true; */ if (__Config::get('ACL_ROLES')) { if ( isset( $this->_aclPage[ $page ] ) && !$user->acl(__Config::get('SITEMAP_ID'), 'all')) { return $user->isInRoles($this->_aclPage[ $page ]); } else { return true; } } else { if ( isset( $this->_aclPage[ $page ]) && $user->groupId != 1 ) { return in_array( $user->groupId, $this->_aclPage[ $page ] ); } else { return true; } } } function getSiteProperty() { return $this->_siteProperty; } function getTemplateName() { return $this->_templateName; } private function setTemplateFolder() { $this->_templateName = __Config::get('glizycms.template.default'); if (__Config::get('glizycms.contents.templateEnabled')) { $this->_templateName = org_glizy_Registry::get( __Config::get( 'REGISTRY_TEMPLATE_NAME' ), $this->_templateName); } if (__Config::get('glizycms.mobile.template.enabled')) { $browser = strpos($_SERVER['HTTP_USER_AGENT'],"iPhone") || strpos($_SERVER['HTTP_USER_AGENT'],"Android"); if ($browser === true) { if ( file_exists( org_glizy_Paths::get('APPLICATION_STATIC').'templates/'.$this->_templateName.'-mobile' ) ) { $this->_templateName .= '-iPhone'; } else if ( file_exists( org_glizy_Paths::get('APPLICATION_STATIC').'templates/mobile' ) ) { $this->_templateName = 'iPhone'; } } } $pathBaseTemplate = org_glizy_Paths::get('APPLICATION_STATIC').'templates/'; org_glizy_Paths::set('APPLICATION_TEMPLATE', $pathBaseTemplate.$this->_templateName.'/'); org_glizy_Paths::set('APPLICATION_TEMPLATE_DEFAULT', $pathBaseTemplate.'Default/'); org_glizy_Paths::addClassSearchPath($pathBaseTemplate.$this->_templateName.'/classes/'); glz_loadLocaleReal( $pathBaseTemplate.$this->_templateName.'/classes', $this->getLanguage() ); } private function readSiteProperties() { $siteProp = unserialize(org_glizy_Registry::get(__Config::get( 'REGISTRY_SITE_PROP' ).$this->getLanguage(), '')); if (!is_array($siteProp)) { // if the site properties are not defined // try to read the properties from default language $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language'); $ar->language_isDefault = 1; $ar->find(); $siteProp = org_glizy_Registry::get(__Config::get( 'REGISTRY_SITE_PROP' ).$ar->language_code, ''); org_glizy_Registry::set(__Config::get( 'REGISTRY_SITE_PROP' ).$this->getLanguage(), $siteProp); $siteProp = unserialize($siteProp); } if (!is_array($siteProp)) { $siteProp = array(); } $this->_siteProperty = $siteProp; } private function checkSwitchLanguage() { $language = org_glizy_Request::get('language', NULL); if (!is_null($language) && $language!=$this->_language) { // cambio lingua $this->log( "change language", GLZ_LOG_SYSTEM ); $ar = org_glizy_ObjectFactory::createModel('org.glizycms.core.models.Language'); $ar->language_code = $language; $ar->find(); org_glizy_Session::set('glizy.language', $ar->language_code); org_glizy_Session::set('glizy.languageId', $ar->language_id); org_glizy_ObjectValues::set('org.glizy', 'languageId', $ar->language_id); $this->_languageId = $ar->language_id; $this->_language = $ar->language_code; // ricarica la struttura del sito per avere i titoli aggiornati $this->_initSiteMap(true); // controlla se il routing ha definito un urlResolver $speakingUrlManager = $this->retrieveProxy('org.glizycms.speakingUrl.Manager'); $urlResolver = $speakingUrlManager->getResolver(__Request::get('cms:urlResolver', 'org.glizycms.core.models.Content')); $url = $urlResolver->makeUrlFromRequest(); org_glizy_helpers_Navigation::gotoUrl($url); } } }
38.465409
179
0.544637
e7810c3be000b9ba7c888db670502587b5cae9a5
587
php
PHP
module/Application/src/View/Helper/LoggedIn.php
backjack/classroom
6b4e63616ade09d83ba8cbbb72722b73667472b1
[ "BSD-3-Clause" ]
null
null
null
module/Application/src/View/Helper/LoggedIn.php
backjack/classroom
6b4e63616ade09d83ba8cbbb72722b73667472b1
[ "BSD-3-Clause" ]
null
null
null
module/Application/src/View/Helper/LoggedIn.php
backjack/classroom
6b4e63616ade09d83ba8cbbb72722b73667472b1
[ "BSD-3-Clause" ]
null
null
null
<?php /** * Application\View\Helper * * @author * @version */ namespace Application\View\Helper; use Intermatics\UtilityFunctions; use Zend\View\Helper\AbstractHelper; use Zend\ServiceManager\ServiceLocatorInterface; /** * View Helper */ class LoggedIn extends AbstractViewHelper { public function __invoke() { // TODO Auto-generated LoggedIn::__invoke $sm = $this->getServicelocator(); $authService = $sm->get('StudentAuthService'); $role = UtilityFunctions::getRole(); return ($authService->hasIdentity() && $role == 'student'); } }
16.305556
61
0.678024
fdce023265e611a0b1a6102c643d4fb607e20176
2,784
css
CSS
autotest/testsuite/properties/positive/border-left/css1/001.css
drspun/css-validator
f92c2ae01af9d961e1833f64d5153e5f10742aa6
[ "W3C-19980720" ]
null
null
null
autotest/testsuite/properties/positive/border-left/css1/001.css
drspun/css-validator
f92c2ae01af9d961e1833f64d5153e5f10742aa6
[ "W3C-19980720" ]
null
null
null
autotest/testsuite/properties/positive/border-left/css1/001.css
drspun/css-validator
f92c2ae01af9d961e1833f64d5153e5f10742aa6
[ "W3C-19980720" ]
1
2021-05-16T12:06:46.000Z
2021-05-16T12:06:46.000Z
bt1 { border-left: #f00 } bt2 { border-left: #f00 dotted } bt3 { border-left: #f00 dotted 1px } bt4 { border-left: #f00 dotted thin } bt5 { border-left: #f00 1px } bt6 { border-left: #f00 1px dotted } bt7 { border-left: #f00 1px none } bt8 { border-left: #f00 none } bt9 { border-left: #f00 none 1px } bt10 { border-left: #f00 none thin } bt11 { border-left: #f00 thin } bt12 { border-left: #f00 thin dotted } bt13 { border-left: #f00 thin none } bt14 { border-left: dotted } bt15 { border-left: dotted #f00 } bt16 { border-left: dotted #f00 1px } bt17 { border-left: dotted #f00 thin } bt18 { border-left: dotted 1px } bt19 { border-left: dotted 1px #f00 } bt20 { border-left: dotted 1px red } bt21 { border-left: dotted red } bt22 { border-left: dotted red 1px } bt23 { border-left: dotted red thin } bt24 { border-left: dotted thin } bt25 { border-left: dotted thin #f00 } bt26 { border-left: dotted thin red } bt27 { border-left: 1px } bt28 { border-left: 1px #f00 } bt29 { border-left: 1px #f00 dotted } bt30 { border-left: 1px #f00 none } bt31 { border-left: 1px dotted } bt32 { border-left: 1px dotted #f00 } bt33 { border-left: 1px dotted red } bt34 { border-left: 1px none } bt35 { border-left: 1px none #f00 } bt36 { border-left: 1px none red } bt37 { border-left: 1px red } bt38 { border-left: 1px red dotted } bt39 { border-left: 1px red none } bt40 { border-left: none } bt41 { border-left: none #f00 } bt42 { border-left: none #f00 1px } bt43 { border-left: none #f00 thin } bt44 { border-left: none 1px } bt45 { border-left: none 1px #f00 } bt46 { border-left: none 1px red } bt47 { border-left: none red } bt48 { border-left: none red 1px } bt49 { border-left: none red thin } bt50 { border-left: none thin } bt51 { border-left: none thin #f00 } bt52 { border-left: none thin red } bt53 { border-left: red } bt54 { border-left: red dotted } bt55 { border-left: red dotted 1px } bt56 { border-left: red dotted thin } bt57 { border-left: red 1px } bt58 { border-left: red 1px dotted } bt59 { border-left: red 1px none } bt60 { border-left: red none } bt61 { border-left: red none 1px } bt62 { border-left: red none thin } bt63 { border-left: red thin } bt64 { border-left: red thin dotted } bt65 { border-left: red thin none } bt66 { border-left: thin } bt67 { border-left: thin #f00 } bt68 { border-left: thin #f00 dotted } bt69 { border-left: thin #f00 none } bt70 { border-left: thin dotted } bt71 { border-left: thin dotted #f00 } bt72 { border-left: thin dotted red } bt73 { border-left: thin none } bt74 { border-left: thin none #f00 } bt75 { border-left: thin none red } bt76 { border-left: thin red } bt77 { border-left: thin red dotted } bt78 { border-left: thin red none }
35.240506
40
0.661638
cf34c0e67b923ec5ee4b487c88c3d9062b55ab95
863
php
PHP
app/Transformers/ProjectFileTransformer.php
marcelobjr/Laravel-Angular
3a8e3317de17223c9a8ca15db549db1a82b74270
[ "MIT" ]
null
null
null
app/Transformers/ProjectFileTransformer.php
marcelobjr/Laravel-Angular
3a8e3317de17223c9a8ca15db549db1a82b74270
[ "MIT" ]
null
null
null
app/Transformers/ProjectFileTransformer.php
marcelobjr/Laravel-Angular
3a8e3317de17223c9a8ca15db549db1a82b74270
[ "MIT" ]
null
null
null
<?php namespace Code\Transformers; use League\Fractal\TransformerAbstract; use Code\Entities\ProjectFile; /** * Class ProjectFileTransformer * @package namespace Code\Transformers; */ class ProjectFileTransformer extends TransformerAbstract { /** * Transform the \ProjectFile entity * @param \ProjectFile $model * * @return array */ public function transform(ProjectFile $model) { return [ 'id' => (int) $model->id, 'name' => $model->name, 'extension' => $model->extension, 'description'=> $model->description, 'project_id' => $model->project_id /* place your other model properties here */ //'created_at' => $model->created_at, //'updated_at' => $model->updated_at ]; } }
22.710526
56
0.567787
aee4d44b3d700654b1c8cffe8e5f479553328239
1,328
cs
C#
Assets/Scripts/UIController.cs
aguandstrika/sillyHacksSimulator
070a229ac08677e78e583fa899e1272874312e72
[ "MIT" ]
null
null
null
Assets/Scripts/UIController.cs
aguandstrika/sillyHacksSimulator
070a229ac08677e78e583fa899e1272874312e72
[ "MIT" ]
null
null
null
Assets/Scripts/UIController.cs
aguandstrika/sillyHacksSimulator
070a229ac08677e78e583fa899e1272874312e72
[ "MIT" ]
null
null
null
using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UIElements; public class UIController : MonoBehaviour { // Start is called before the first frame update public GameObject hourBar; public GameObject hourText; public float hours = 48; public GameObject energyBar; public GameObject energyText; public float energy; public GameObject foodBar; public GameObject foodText; public float food; public GameObject experienceBar; public GameObject experienceText; public float experience; void Start() { } // Update is called once per frame void Update() { hourBar.GetComponent<RectTransform>().anchorMax = new Vector2(hours/48, 1); hourText.GetComponent<TMP_Text>().text = hours.ToString(); energyBar.GetComponent<RectTransform>().anchorMax = new Vector2(energy / 100, 1); energyText.GetComponent<TMP_Text>().text = energy.ToString(); foodBar.GetComponent<RectTransform>().anchorMax = new Vector2(food / 100, 1); foodText.GetComponent<TMP_Text>().text = food.ToString(); experienceBar.GetComponent<RectTransform>().anchorMax = new Vector2(experience / 100, 1); experienceText.GetComponent<TMP_Text>().text = experience.ToString(); } }
34.947368
97
0.709337
db6e1e382852d6a69556dca58d340b3f6a844a76
5,609
php
PHP
database/seeders/DatabaseSeeder.php
didapatria/prakweb2021_laravel_193040052
17dd21934c126133db4b78360cc18c564ccef9d5
[ "MIT" ]
null
null
null
database/seeders/DatabaseSeeder.php
didapatria/prakweb2021_laravel_193040052
17dd21934c126133db4b78360cc18c564ccef9d5
[ "MIT" ]
null
null
null
database/seeders/DatabaseSeeder.php
didapatria/prakweb2021_laravel_193040052
17dd21934c126133db4b78360cc18c564ccef9d5
[ "MIT" ]
null
null
null
<?php namespace Database\Seeders; use Illuminate\Database\Seeder; use App\Models\User; use App\Models\Category; use App\Models\Post; class DatabaseSeeder extends Seeder { /** * Seed the application's database. * * @return void */ public function run() { User::create([ 'name' => 'Adinda Fadhil Patria', 'username' => 'didapatria', 'email' => '193040052@mail.unpas.ac.id', 'password' => bcrypt('password') ]); // User::create([ // 'name' => 'Aldi Ageng Tri Seftian', // 'email' => '193040054@mail.unpas.ac.id', // 'password' => bcrypt('12345') // ]); User::factory(3)->create(); Category::create([ 'name' => 'Web Programming', 'slug' => 'web-programing' ]); Category::create([ 'name' => 'Web Desgin', 'slug' => 'web-design' ]); Category::create([ 'name' => 'Personal', 'slug' => 'personal' ]); Post::factory(20)->create(); // Post::create([ // 'title' => 'Judul Pertama', // 'slug' => 'judul-pertama', // 'excerpt' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio suscipit odit impedit quas nisi iure dolorem ullam reiciendis ex error,', // 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio suscipit odit impedit quas nisi iure dolorem ullam reiciendis ex error, voluptate dicta soluta fugiat nobis hic esse laudantium, illo voluptatibus nemo porro aspernatur quam. Molestias reiciendis recusandae, ipsum illo alias quidem excepturi inventore veniam ipsa laborum! Quos suscipit vero officia nulla impedit quas modi atque odio sapiente neque! Dignissimos, ipsa molestiae ex impedit iste laudantium. Reprehenderit ratione ipsum quae magnam repellendus debitis dolore. Deserunt asperiores ipsum quidem saepe quo earum, deleniti sint? Iusto, vitae obcaecati at porro suscipit id architecto veritatis ex aliquid sed consequuntur modi corporis dolores iure asperiores?', // 'category_id' => 1, // 'user_id' => 1 // ]); // Post::create([ // 'title' => 'Judul Ke Dua', // 'slug' => 'judul-ke-dua', // 'excerpt' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio suscipit odit impedit quas nisi iure dolorem ullam reiciendis ex error,', // 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio suscipit odit impedit quas nisi iure dolorem ullam reiciendis ex error, voluptate dicta soluta fugiat nobis hic esse laudantium, illo voluptatibus nemo porro aspernatur quam. Molestias reiciendis recusandae, ipsum illo alias quidem excepturi inventore veniam ipsa laborum! Quos suscipit vero officia nulla impedit quas modi atque odio sapiente neque! Dignissimos, ipsa molestiae ex impedit iste laudantium. Reprehenderit ratione ipsum quae magnam repellendus debitis dolore. Deserunt asperiores ipsum quidem saepe quo earum, deleniti sint? Iusto, vitae obcaecati at porro suscipit id architecto veritatis ex aliquid sed consequuntur modi corporis dolores iure asperiores?', // 'category_id' => 1, // 'user_id' => 1 // ]); // Post::create([ // 'title' => 'Judul Ke Tiga', // 'slug' => 'judul-ke-tiga', // 'excerpt' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio suscipit odit impedit quas nisi iure dolorem ullam reiciendis ex error,', // 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio suscipit odit impedit quas nisi iure dolorem ullam reiciendis ex error, voluptate dicta soluta fugiat nobis hic esse laudantium, illo voluptatibus nemo porro aspernatur quam. Molestias reiciendis recusandae, ipsum illo alias quidem excepturi inventore veniam ipsa laborum! Quos suscipit vero officia nulla impedit quas modi atque odio sapiente neque! Dignissimos, ipsa molestiae ex impedit iste laudantium. Reprehenderit ratione ipsum quae magnam repellendus debitis dolore. Deserunt asperiores ipsum quidem saepe quo earum, deleniti sint? Iusto, vitae obcaecati at porro suscipit id architecto veritatis ex aliquid sed consequuntur modi corporis dolores iure asperiores?', // 'category_id' => 2, // 'user_id' => 1 // ]); // Post::create([ // 'title' => 'Judul Ke Empat', // 'slug' => 'judul-ke-empat', // 'excerpt' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio suscipit odit impedit quas nisi iure dolorem ullam reiciendis ex error,', // 'body' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio suscipit odit impedit quas nisi iure dolorem ullam reiciendis ex error, voluptate dicta soluta fugiat nobis hic esse laudantium, illo voluptatibus nemo porro aspernatur quam. Molestias reiciendis recusandae, ipsum illo alias quidem excepturi inventore veniam ipsa laborum! Quos suscipit vero officia nulla impedit quas modi atque odio sapiente neque! Dignissimos, ipsa molestiae ex impedit iste laudantium. Reprehenderit ratione ipsum quae magnam repellendus debitis dolore. Deserunt asperiores ipsum quidem saepe quo earum, deleniti sint? Iusto, vitae obcaecati at porro suscipit id architecto veritatis ex aliquid sed consequuntur modi corporis dolores iure asperiores?', // 'category_id' => 2, // 'user_id' => 2 // ]); } }
62.322222
762
0.668925
a3425fab18aa0fbca5089fc8e8f15c287d3adc99
895
ts
TypeScript
typings-custom/node-expat.d.ts
mercury83/cxsd
652fa04a97b290fee87f82a6b7283353fe3249b9
[ "MIT" ]
91
2016-07-03T16:53:39.000Z
2022-03-04T04:20:03.000Z
typings-custom/node-expat.d.ts
mercury83/cxsd
652fa04a97b290fee87f82a6b7283353fe3249b9
[ "MIT" ]
26
2016-02-17T03:12:03.000Z
2022-01-09T15:58:53.000Z
typings-custom/node-expat.d.ts
mercury83/cxsd
652fa04a97b290fee87f82a6b7283353fe3249b9
[ "MIT" ]
40
2016-04-03T02:13:48.000Z
2022-03-16T15:33:49.000Z
declare module "node-expat" { import * as events from "events"; export class Parser extends events.EventEmitter { constructor(encoding: string); parse(data: string | Buffer, isFinal: boolean): boolean; setEncoding(encoding: string): boolean; // setUnknownEncoding() TODO // getError() TODO stop(): boolean; // Same return value as stop(). pause(): boolean; resume(): boolean; destroy(): void; destroySoon(): void; // Same data argument and return value as parse() but emits errors and isFinal is false. write(data: string | Buffer): boolean; // Same data argument and return value as parse() but emits errors and isFinal is true. end(data: string | Buffer): boolean; reset(): boolean; getCurrentLineNumber(): number; getCurrentColumnNumber(): number; getCurrentByteIndex(): number; } // export function createParser(cb: ???): Parser TODO }
24.861111
90
0.694972
5882ec1c88e29d178536f12882f7fae09243256b
1,774
css
CSS
Aula6/style.css
mfsilveira/apex-formacao-fe
7935ff5f5759bf94c2eab0cd902cda4d7866fcfa
[ "MIT" ]
null
null
null
Aula6/style.css
mfsilveira/apex-formacao-fe
7935ff5f5759bf94c2eab0cd902cda4d7866fcfa
[ "MIT" ]
null
null
null
Aula6/style.css
mfsilveira/apex-formacao-fe
7935ff5f5759bf94c2eab0cd902cda4d7866fcfa
[ "MIT" ]
1
2018-09-17T12:52:44.000Z
2018-09-17T12:52:44.000Z
form { width: 80%; display: flex; justify-content: space-between; align-items: flex-start; flex-direction: row; flex-wrap: wrap; } .content { display: flex; justify-content: center; flex-direction: column; align-items: center; width: 100%; } h1 { font-family: "Open Sans"; font-weight: 800; font-size: 26px; color: #9b9b9b; text-align: center; margin: 5px 0px 0px 2px; } h4 { font-family: "Open Sans"; border-bottom: solid 1px #ccc; margin: 5px 0px 0px 2px; color: #9b9b9b; } .col-50 { width: 40%; } .col-33 { width: 27%; } .col-25 { width: 20%; } .col-20 { width: 16%; } .col-100 { width: 100% } .input-group { display: flex; margin: 5px 0px; flex-direction: column; } label, input, select { font-family: "Open Sans"; } input, select { border-radius: 5px; border: solid 1px #ccc; } input { height: 25px; } select { height: 35px; } .margin-sub { margin-left: 10px; } .campo-comprido { width: 270px; } .campo-curto { width: 80px; } .input-group label { font-size: 14px; } .buttons-bar { border-top: solid 1px #ccc; display: flex; margin: 5px 0px; flex-direction: row; align-items: center; justify-content: center; } button { margin: 5px; height: 40px; width: 140px; border: 1px solid green; border-radius: 20px; background-color: rgba(128, 128, 128, 0.1); color: green; font-size: 18px; display: flex; flex-direction: row; align-items: center; justify-content: center; font-family: "Open Sans"; } button span { margin-left: 5px; } .imagem-salvar { background-image: url('save.png'); background-repeat: no-repeat; }
14.192
47
0.587937
e83d4bf778f44611bd35ea65edcb370904d316d4
967
cs
C#
StarryEyes/Models/Backstages/BackstageEventBase.cs
ktoku89/StarryEyes
2ab80f61508cee9898d449d2aa374623c3f234fe
[ "MIT" ]
84
2015-02-12T07:54:45.000Z
2021-08-28T07:44:22.000Z
StarryEyes/Models/Backstages/BackstageEventBase.cs
ktoku89/StarryEyes
2ab80f61508cee9898d449d2aa374623c3f234fe
[ "MIT" ]
28
2015-01-09T06:25:12.000Z
2018-10-20T02:41:36.000Z
StarryEyes/Models/Backstages/BackstageEventBase.cs
ktoku89/StarryEyes
2ab80f61508cee9898d449d2aa374623c3f234fe
[ "MIT" ]
56
2015-01-09T08:18:41.000Z
2022-02-18T17:04:57.000Z
using System.Windows.Media; namespace StarryEyes.Models.Backstages { /// <summary> /// Represents event. /// </summary> public abstract class BackstageEventBase { /// <summary> /// Title of the event. /// </summary> public abstract string Title { get; } /// <summary> /// Image title of the event.<para /> /// If not available, returns null value. /// </summary> public virtual ImageSource TitleImage { get { return null; } } /// <summary> /// Detail description of the event. /// </summary> public abstract string Detail { get; } /// <summary> /// Background color of the event. /// </summary> public abstract Color Background { get; } /// <summary> /// Foreground color of the event. /// </summary> public virtual Color Foreground { get { return Colors.White; } } } }
26.135135
72
0.541882
ad8f082e017ec33d28f1d7f9e36c9af4dffc1e72
155
rb
Ruby
spec/support/active_record/models/post.rb
GraphQL-Query-Planner/graphql-analyzer
b989c910fd5f070cdc5256cbe5ba2be071282a79
[ "MIT" ]
4
2018-03-14T03:29:47.000Z
2020-11-04T10:56:30.000Z
spec/support/active_record/models/post.rb
GraphQL-Query-Planner/graphql-analyzer
b989c910fd5f070cdc5256cbe5ba2be071282a79
[ "MIT" ]
7
2018-02-08T20:49:26.000Z
2019-02-05T22:37:34.000Z
spec/support/active_record/models/post.rb
GraphQL-Query-Planner/graphql-analyzer
b989c910fd5f070cdc5256cbe5ba2be071282a79
[ "MIT" ]
null
null
null
class Post < ApplicationRecord belongs_to :author, class_name: 'User' belongs_to :receiver, class_name: 'User' has_many :comments, as: :content end
22.142857
42
0.748387
11c8a299b52629878ad160622265055cf58b78b8
5,418
go
Go
pkg/ast/Linker.go
mewbak/geode
acc6eca680845c2516462d470c40b0ac2a9b6640
[ "MIT" ]
17
2018-09-14T04:42:34.000Z
2022-01-10T20:49:29.000Z
pkg/ast/Linker.go
mewbak/geode
acc6eca680845c2516462d470c40b0ac2a9b6640
[ "MIT" ]
11
2018-08-14T14:57:41.000Z
2020-08-23T20:52:30.000Z
pkg/ast/Linker.go
mewbak/geode
acc6eca680845c2516462d470c40b0ac2a9b6640
[ "MIT" ]
4
2018-08-14T14:53:57.000Z
2019-04-29T13:51:54.000Z
package ast import ( "fmt" "io/ioutil" "os" "path" "path/filepath" "strings" "github.com/geode-lang/geode/pkg/arg" "github.com/geode-lang/geode/pkg/util" "github.com/geode-lang/geode/pkg/util/log" ) // CompileTarget is a target to build a binary for type CompileTarget int // Some default targets const ( ASMTarget CompileTarget = iota BinaryTarget ) // Linker is an instance that can link several // object files into a single binary or other format type Linker struct { output string target CompileTarget buildDir string objectPaths []string optimize int } // NewLinker constructs a linker with an outpu func NewLinker(output string) *Linker { l := &Linker{} l.output = output return l } // HasObject returns if the linker already has a path func (l *Linker) HasObject(path string) bool { for _, p := range l.objectPaths { if p == path { return true } } return false } // AddObject appends an object path to a linker func (l *Linker) AddObject(path string) { if !l.HasObject(path) { l.objectPaths = append(l.objectPaths, path) } } // SetTarget sets the target output format of the linker // be it binary, asm, etc... func (l *Linker) SetTarget(t CompileTarget) { l.target = t } // SetBuildDir sets the target output format of the linker // be it binary, asm, etc... func (l *Linker) SetBuildDir(t string) { l.buildDir = t } // SetOutput - func (l *Linker) SetOutput(path string) { l.output = path } // SetOptimize - func (l *Linker) SetOptimize(o int) { l.optimize = o } // Cleanup removes all the func (l *Linker) Cleanup() { for _, objFile := range l.objectPaths { ext := filepath.Ext(objFile) // We only remove ll and s files. if ext == ".ll" || ext == ".s" { os.Remove(objFile) } } } // Run a list of objects through a linker and build // into a single outfile with the given target func (l *Linker) Run() { linker := "clang" linkArgs := make([]string, 0) optString := fmt.Sprintf("-O%d", l.optimize) if l.optimize > 0 && l.optimize <= 3 { linkArgs = append(linkArgs, optString) } filename := l.output hadAlternateEmission := false if *arg.EmitASM { hadAlternateEmission = true log.Timed("Assembly Generation", func() { // We want to only write intel syntax. AT&T Sucks asmArgs := append(linkArgs, "-S", "-masm=intel", "-Wno-everything") // Compile each of the objects to a .s file. for _, obj := range l.objectPaths { // We only want to leave user generated files in the filesystem if strings.HasSuffix(obj, ".ll") { // ext := path.Ext(obj) out := path.Base(strings.Replace(obj, path.Ext(obj), ".s", -1)) util.RunCommandStr(linker, append(asmArgs, "-o", out, obj)...) } } }) } if *arg.EmitLLVM { hadAlternateEmission = true log.Timed("LLVM Generation", func() { // Compile each of the objects to a .s file. for _, obj := range l.objectPaths { // We only want to leave user generated files in the filesystem if strings.HasSuffix(obj, ".ll") { out := path.Base(strings.Replace(obj, path.Ext(obj), ".ll", -1)) res, err := util.RunCommandStr(linker, append(linkArgs, "-S", "-emit-llvm", "-o", out, obj)...) if err != nil { log.Error("Failed with llvm generation:\n") fmt.Println(res) } } } }) } if *arg.EmitObject { hadAlternateEmission = true log.Timed("Object File Generation", func() { // Compile each of the objects to a .s file. for _, obj := range l.objectPaths { // We only want to leave user generated files in the filesystem if strings.HasSuffix(obj, ".ll") { out := path.Base(strings.Replace(obj, path.Ext(obj), ".o", -1)) util.RunCommandStr(linker, append(linkArgs, "-c", "-o", out, obj)...) } } }) } linkArgs = append(linkArgs, "--std=c99", "-lm", "-lc", "-lgc", "-pthread", "-DREDIRECT_MALLOC=xmalloc", "-DIGNORE_FREE") if !hadAlternateEmission { for i, obj := range l.objectPaths { outbase := path.Join(l.buildDir, obj) extension := filepath.Ext(outbase) if extension == ".ll" { } if extension == ".a" { } if extension == ".c" { outbase = outbase[0 : len(outbase)-len(extension)] cachefile := outbase + ".cache" objFile := outbase + ".o" hash := util.HashFile(obj) cachedat, err := ioutil.ReadFile(cachefile) if err != nil || strings.Compare(string(cachedat), hash) != 0 { os.MkdirAll(path.Dir(outbase), os.ModePerm) // fmt.Printf("\tCC\t%s\n", path.Base(obj)) // the file doesnt exist, we need to compile it out, err := util.RunCommand("clang", "-O3", "--std=c99", "-c", "-o", objFile, obj) if err != nil { log.Fatal("(%s) %s\n", err, string(out)) } ioutil.WriteFile(cachefile, []byte(hash), os.ModePerm) } l.objectPaths[i] = objFile } } // return // Append input files to the end of the command linkArgs = append(linkArgs, l.objectPaths...) if *arg.EnableDebug { linkArgs = append(linkArgs, "-g") } // set the output filename linkArgs = append(linkArgs, "-o", filename) if *arg.ClangFlags != "" { userArgs := strings.Split(*arg.ClangFlags, " ") linkArgs = append(linkArgs, userArgs...) } out, err := util.RunCommand(linker, linkArgs...) if err != nil { log.Fatal("failed to run command `%s %s`: `%s`\n\n%s", linker, strings.Join(linkArgs, " "), err.Error(), string(out)) } } }
23.353448
121
0.631414
f455b51d2269bdf8683020ccaa64cf569c67b470
26
ts
TypeScript
src/client/api/index.ts
zl940722/antd-mobile-fastify
7a542617647f71f6527ddcd62c26f82f3994e819
[ "MIT" ]
2
2018-05-02T09:51:21.000Z
2018-05-03T09:02:25.000Z
src/client/api/index.ts
zl940722/antd-mobile-fastify-router4
7a542617647f71f6527ddcd62c26f82f3994e819
[ "MIT" ]
null
null
null
src/client/api/index.ts
zl940722/antd-mobile-fastify-router4
7a542617647f71f6527ddcd62c26f82f3994e819
[ "MIT" ]
null
null
null
export * from './mainApi'
13
25
0.653846
960430a881322af6866b70459ae112ff727c672a
871
kt
Kotlin
nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/ImportanceTranslator.kt
Dor558/NutshellFirebase
05602e8189ade7d11c05523b75aec5ef357bc91d
[ "Apache-2.0" ]
11
2019-08-28T15:40:43.000Z
2019-09-08T15:32:30.000Z
nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/ImportanceTranslator.kt
Dor558/NutshellFirebase
05602e8189ade7d11c05523b75aec5ef357bc91d
[ "Apache-2.0" ]
null
null
null
nutshellfcm/nuthsellfcm-framework/src/main/java/com/nutshellfcm/framework/ImportanceTranslator.kt
Dor558/NutshellFirebase
05602e8189ade7d11c05523b75aec5ef357bc91d
[ "Apache-2.0" ]
null
null
null
package com.nutshellfcm.framework import androidx.core.app.NotificationCompat.* import androidx.core.app.NotificationManagerCompat.* import com.nutshellfcm.framework.NutshellFCMContract.Importance.* internal class ImportanceTranslator: NutshellFCMContract.Translators.ImportanceTranslator { override fun getAndroidPriority(importance: NutshellFCMContract.Importance) = when(importance) { LOW -> PRIORITY_MIN MEDIUM -> PRIORITY_LOW HIGH -> PRIORITY_DEFAULT URGENT -> PRIORITY_MAX } override fun getAndroidImportance(importance: NutshellFCMContract.Importance) = when(importance) { LOW -> IMPORTANCE_MIN MEDIUM -> IMPORTANCE_LOW HIGH -> IMPORTANCE_DEFAULT URGENT -> IMPORTANCE_HIGH } }
36.291667
91
0.657865
acdec2e23bb1df56052889fc7e1eff6fd27ab5c5
9,428
swift
Swift
SerializableDataDemo/SerializableDataDemoTests/SerializableDataDemoTests.swift
mleiv/SerializableData
df10006715841fed45f00376c939a6ffb66a1a97
[ "MIT" ]
14
2015-10-17T07:07:42.000Z
2016-10-09T02:18:22.000Z
SerializableDataDemo/SerializableDataDemoTests/SerializableDataDemoTests.swift
mleiv/SerializableData
df10006715841fed45f00376c939a6ffb66a1a97
[ "MIT" ]
null
null
null
SerializableDataDemo/SerializableDataDemoTests/SerializableDataDemoTests.swift
mleiv/SerializableData
df10006715841fed45f00376c939a6ffb66a1a97
[ "MIT" ]
null
null
null
// // SerializableDataDemoTests.swift // SerializableDataDemoTests // // Created by Emily Ivie on 10/16/15. // Copyright © 2015 Emily Ivie. All rights reserved. // import XCTest @testable import SerializableDataDemo class SerializableDataDemoTests: XCTestCase { let sampleJson = "{\"persons\":[{\"id\": \"\(UUID())\", \"name\" : \"Phil Myman\", \"profession\" : \"R&D Lab Scientist\", \"organization\" : \"Veridian Dynamics\", \"notes\" : \"You know what you did.\", \"createdDate\" : \"2010-03-18 19:05:15\", \"modifiedDate\" : \"2010-01-26 20:00:09\"}, {\"id\": \"\(UUID())\", \"name\" : \"Veronica Palmer\", \"profession\" : \"Executive\", \"organization\" : \"Veridian Dynamics\", \"notes\" : \"Friendship. It's the same as stealing.\", \"createdDate\" : \"2010-03-18 19:00:07\", \"modifiedDate\" : \"2010-01-26 23:17:20\"}]}" let oneDay = TimeInterval(24 * 60 * 60) var sevenYearsAgo = Date() var fiveYearsAgo = Date() override func setUp() { super.setUp() SimpleCoreDataManager.current = getSandboxedManager() sevenYearsAgo = Date(timeIntervalSinceNow: (-self.oneDay) * 365 * 7) fiveYearsAgo = Date(timeIntervalSinceNow: (-self.oneDay) * 365 * 5) } override func tearDown() { super.tearDown() } private func getSandboxedManager() -> SimpleCoreDataManager { return SimpleCoreDataManager(storeName: SimpleCoreDataManager.defaultStoreName, isConfineToMemoryStore: true) } func testNsData() { if let jsonData = (sampleJson as NSString).data(using: String.Encoding.utf8.rawValue) { if let serializableData = try? SerializableData(jsonData: jsonData) { if let personsList = serializableData["persons"]?.array { XCTAssert(personsList[0]["name"]?.string == "Phil Myman", "Lost Phil's name") XCTAssert(personsList[1]["name"]?.string == "Veronica Palmer", "Lost Veronica's name") let philsStartDate = personsList[0]["createdDate"]?.date ?? Date() XCTAssert(philsStartDate.compare(sevenYearsAgo) == .orderedDescending && philsStartDate.compare(fiveYearsAgo) == .orderedAscending, "Misread Phil's start date") } else { XCTAssert(false, "Failed to recover array") } } else { XCTAssert(false, "Failed to parse data") } } else { XCTAssert(false, "Failed to create data") } } func testString() { do { let serializableData = try SerializableData(jsonString: sampleJson) if let personsList = serializableData["persons"]?.array { XCTAssert(personsList[0]["name"]?.string == "Phil Myman", "Lost Phil's name") XCTAssert(personsList[1]["name"]?.string == "Veronica Palmer", "Lost Veronica's name") let philsStartDate = personsList[0]["createdDate"]?.date ?? Date() XCTAssert(philsStartDate.compare(sevenYearsAgo) == .orderedDescending && philsStartDate.compare(fiveYearsAgo) == .orderedAscending, "Misread Phil's start date") } else { XCTAssert(false, "Failed to recover array") } } catch { XCTAssert(false, "Failed to parse string") } } func testRepeatedConversions(){ if let jsonData = (sampleJson as NSString).data(using: String.Encoding.utf8.rawValue) { do { let serializableData = try SerializableData(jsonData: jsonData) let serializableData2 = try SerializableData(jsonString: serializableData.jsonString) if let personsList = serializableData2["persons"]?.array { XCTAssert(personsList[0]["name"]?.string == "Phil Myman", "Lost Phil's name") XCTAssert(personsList[1]["name"]?.string == "Veronica Palmer", "Lost Veronica's name") let philsStartDate = personsList[0]["createdDate"]?.date ?? Date() XCTAssert(philsStartDate.compare(sevenYearsAgo) == .orderedDescending && philsStartDate.compare(fiveYearsAgo) == .orderedAscending, "Misread Phil's start date") } else { XCTAssert(false, "Failed to recover array") } } catch { XCTAssert(false, "Failed to parse string") } } else { XCTAssert(false, "Failed to create data") } } func testCreateData() { var serializableData = SerializableData() serializableData["test1"] = "test" XCTAssert(serializableData["test1"]?.string == "test", "Did not correctly set String value") serializableData["number1"] = 5 XCTAssert(serializableData["number1"]?.int == 5, "Did not correctly set Int value") serializableData["number2"] = 5.01 XCTAssert(serializableData["number2"]?.float == 5.01, "Did not correctly set Float value") XCTAssert(serializableData["number2"]?.double == 5.01, "Did not correctly set Double value") serializableData["bool1"] = true XCTAssert(serializableData["bool1"]?.bool == true, "Did not correctly set Bool value") serializableData["date1"] = SerializableData.safeInit(date: fiveYearsAgo) // dates are tricky print("\(serializableData["date1"]?.date) \(fiveYearsAgo)") XCTAssert(stringFromDate(serializableData["date1"]?.date ?? Date()) == stringFromDate(fiveYearsAgo), "Did not correctly set Date value") // it is also hard to compare dates - they report the same up to second, but still don't == serializableData["array1"] = [1, 5] XCTAssert(serializableData["array1"]?[1] == 5, "Did not correctly set Array value") serializableData["dictionary1"] = ["key1": 1, "key2": 5] XCTAssert(serializableData["dictionary1"]?["key2"] == 5, "Did not correctly set Dictionary value") let serializedArray: SerializableData = [1,2,5] XCTAssert(serializedArray.jsonString == "[\n 1,\n 2,\n 5\n]", "Did not correctly serialize an Array") let serializedDictionary: SerializableData = ["key1": "value1"] XCTAssert(serializedDictionary.jsonString == "{\n \"key1\" : \"value1\"\n}", "Did not correctly serialize a Dictionary") } func testCgFloat() { var serializableData = SerializableData() // sorry, this won't work // serializableData["cgfloat"] = CGFloat(5) // but this will let cgFloat1 = CGFloat(5) serializableData["cgfloat"] = cgFloat1.getData() // and so will this: serializableData["cgfloats"] = [cgFloat1, CGFloat(1.5)] XCTAssert(serializableData["cgfloat"]?.cgFloat == cgFloat1, "Did not correctly serialize CGFloat") XCTAssert(serializableData["cgfloats"]?[0]?.cgFloat == cgFloat1, "Did not correctly serialize CGFloat Array") } func testUrl() { var serializableData = SerializableData() // sorry, this won't work // serializableData["url"] = NSURL(string: "http://example.com/") // but this will let nsUrl = URL(string: "http://example.com/") serializableData["url"] = nsUrl?.getData() // and so will this: let urls: [SerializedDataStorable?] = [nsUrl, URL(string: "http://yahoo.com/")] serializableData["urls"] = SerializableData.safeInit(urls) XCTAssert(serializableData["url"]?.url == nsUrl, "Did not correctly serialize CGFloat") XCTAssert(serializableData["urls"]?[0]?.url == nsUrl, "Did not correctly serialize CGFloat Array") } func testFileReadWrite() { do { let serializableData = try SerializableData(jsonString: sampleJson) let fileName = "store.data" if serializableData.store(fileName: fileName) { let retrievedData = try SerializableData(fileName: fileName) if let personsList = retrievedData["persons"]?.array { XCTAssert(personsList[0]["name"]?.string == "Phil Myman", "Lost Phil's name") } else { XCTAssert(false, "Failed to retrieve array from file") } if retrievedData.delete(fileName: fileName) { if let documents = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first { let path = (documents as NSString).appendingPathComponent(fileName) XCTAssert(FileManager.default.fileExists(atPath: path) == false, "Reported file delete but file exists") } else { XCTAssert(false, "Problem with documents folder") } } else { XCTAssert(false, "Failed to delete file") } } else { XCTAssert(false, "Failed to write file") } } catch { XCTAssert(false, "Failed to parse string") } } func stringFromDate(_ value: Date) -> String? { let dateFormatter = DateFormatter() //add more flexible parsing later dateFormatter.dateFormat = "YYYY-MM-dd HH:mm:ss" dateFormatter.timeZone = TimeZone(abbreviation: "UTC") return dateFormatter.string(from: value) } }
52.088398
572
0.603203
752aa5949ac096addffee280358f9baf0b182f97
808
sql
SQL
peacetrue-template-model-content/src/test/resources/schema-route.sql
peacetrue/peacetrue-template-model
5040440a18d6f52180271f48b9ab08d179978589
[ "Apache-2.0" ]
3
2020-02-24T04:35:17.000Z
2020-02-24T22:20:37.000Z
peacetrue-template-model-content/src/test/resources/schema-route.sql
peacetrue/peacetrue-template-model
5040440a18d6f52180271f48b9ab08d179978589
[ "Apache-2.0" ]
null
null
null
peacetrue-template-model-content/src/test/resources/schema-route.sql
peacetrue/peacetrue-template-model
5040440a18d6f52180271f48b9ab08d179978589
[ "Apache-2.0" ]
null
null
null
DROP TABLE IF EXISTS route; create table route ( id bigint auto_increment primary key, express_type_code varchar(63) not null comment '快递类型', code varchar(63) not null comment '路由编号', order_code varchar(63) null comment '订单编号', express_code varchar(63) not null comment '运单号', address varchar(255) not null comment '接收地址', accept_time datetime not null comment '接收时间', remark varchar(255) null comment '描述', created_time datetime not null comment '创建时间' ); INSERT INTO route (id, express_type_code, code, order_code, express_code, address, remark, accept_time, created_time) VALUES (1, 'sf', '54', null, '803423039008', '天津市', '顺丰速运 已收取快件', '2019-02-27 15:56:25', '2019-03-06 19:42:09');
50.5
117
0.642327
1a953e704d5d407b81986a9f24e7997bbfcd87e9
3,482
py
Python
pvhttpsrv/server.py
cszielke/SolarPy
7a0575c98033c42c391783428adad1f9782943e6
[ "MIT" ]
null
null
null
pvhttpsrv/server.py
cszielke/SolarPy
7a0575c98033c42c391783428adad1f9782943e6
[ "MIT" ]
null
null
null
pvhttpsrv/server.py
cszielke/SolarPy
7a0575c98033c42c391783428adad1f9782943e6
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 import os from http.server import BaseHTTPRequestHandler from pvhttpsrv.routes.main import routes from pvhttpsrv.routes.response.dataRequestHandler import DataRequestHandler from pvhttpsrv.routes.response.configRequestHandler import ConfigRequestHandler from pvhttpsrv.routes.response.serviceRequestHandler import ServiceRequestHandler from pvhttpsrv.routes.response.webcamRequestHandler import WebCamRequestHandler from pvhttpsrv.routes.response.staticHandler import StaticHandler from pvhttpsrv.routes.response.templateHandler import TemplateHandler from pvhttpsrv.routes.response.badRequestHandler import BadRequestHandler class Server(BaseHTTPRequestHandler): def do_HEAD(self): return def do_POST(self): request_name = os.path.basename(self.path) content_length = int(self.headers['Content-Length']) # <--- Gets the size of data if(content_length > 0): post_data = self.rfile.read(content_length) # <--- Gets the data itself if request_name == "config": handler = ConfigRequestHandler() handler.processPost(self.path, post_data) elif request_name == "service": handler = ServiceRequestHandler() handler.processPost(self.path, post_data) else: handler = BadRequestHandler() self.respond({ 'handler': handler }) def do_GET(self): split_path = os.path.splitext(self.path) request_extension = split_path[1] request_name = os.path.basename(self.path) if request_extension == "" or request_extension == ".html" or request_extension == ".txt": if self.path in routes: handler = TemplateHandler() handler.onDataRequest = self.onDataRequest handler.directory = self.directory handler.find(routes[self.path]) else: handler = BadRequestHandler() elif request_extension == ".py": handler = BadRequestHandler() elif request_extension == ".json": handler = DataRequestHandler() handler.onDataRequest = self.onDataRequest handler.find(self.path) elif (request_name == 'ipcam.jpg' or request_name == 'pvipcam.jpg'): handler = WebCamRequestHandler() handler.onWebCamRequest = self.onWebCamRequest handler.find(self.path) else: handler = StaticHandler() handler.directory = self.directory handler.find(self.path) self.respond({ 'handler': handler }) def handle_http(self, handler): status_code = handler.getStatus() self.send_response(status_code) if status_code == 200: content = handler.getContents() self.send_header('Content-type', handler.getContentType()) else: content = "404 Not Found" self.end_headers() if isinstance(content, (bytes, bytearray)): return content return bytes(content, 'UTF-8') def respond(self, opts): response = self.handle_http(opts['handler']) self.wfile.write(response) def log_message(self, format, *args): print("%s - - [%s] %s\n" % (self.address_string(), self.log_date_time_string(), format % args))
36.652632
104
0.626364
37b97f7c48e9d5bf34c10a4c272f127df3a11f58
805
rb
Ruby
lib/travis/settings/model.rb
saucelabs/travis-core
c7e1301ed3ea5364a638c3e947d646219529e7c4
[ "MIT" ]
113
2015-01-05T18:51:55.000Z
2021-11-14T17:39:44.000Z
lib/travis/settings/model.rb
ConnectionMaster/travis-core
1d60188446e12fe9d4b29276dc82837eadf91829
[ "MIT" ]
78
2015-01-05T19:24:06.000Z
2018-05-10T13:47:09.000Z
lib/travis/settings/model.rb
ConnectionMaster/travis-core
1d60188446e12fe9d4b29276dc82837eadf91829
[ "MIT" ]
65
2015-01-02T09:09:41.000Z
2020-07-28T06:13:53.000Z
require 'virtus' require 'travis/settings/encrypted_value' require 'travis/settings/model_extensions' class Travis::Settings class Model include Virtus.model include ActiveModel::Validations include ModelExtensions include ActiveModel::Serialization def attribute?(name) attributes.keys.include?(name.to_sym) end def read_attribute_for_serialization(name) self.send(name) if attribute?(name) end def read_attribute_for_validation(name) return unless attribute?(name) value = self.send(name) value.is_a?(EncryptedValue) ? value.to_s : value end def update(attributes) self.attributes = attributes end def key Travis.config.encryption.key end def to_json to_hash.to_json end end end
20.125
54
0.701863
2fc504df4b5103bcf9690e07aaec24478eba8496
462
py
Python
secret_santaclaus/congratulations.py
wheeltune/secret-santaclaus
c8082d2d8ef12297c8503e95954184e9352a4917
[ "MIT" ]
null
null
null
secret_santaclaus/congratulations.py
wheeltune/secret-santaclaus
c8082d2d8ef12297c8503e95954184e9352a4917
[ "MIT" ]
null
null
null
secret_santaclaus/congratulations.py
wheeltune/secret-santaclaus
c8082d2d8ef12297c8503e95954184e9352a4917
[ "MIT" ]
null
null
null
import random import re __all__ = ['Congratulations'] class Congratulations: def __init__(self): self._texts = [] with open('data/congratulations.txt', 'r') as file: for line in file: line = line.strip() if line: self._texts.append(line) def get_random(self): ind = random.randint(0, len(self._texts) - 1) return self._texts[ind].replace('<br/>', '\n')
23.1
59
0.547619
c18c1acb723168913cddc4bb712d727edc02d5c2
909
sql
SQL
schema/routines/count_by_current_ratio.sql
eclissi91/brahma
5ef9f8e9d9d3871c21aa9832962ee9ee3800c9a9
[ "MIT" ]
null
null
null
schema/routines/count_by_current_ratio.sql
eclissi91/brahma
5ef9f8e9d9d3871c21aa9832962ee9ee3800c9a9
[ "MIT" ]
1
2020-10-28T13:00:20.000Z
2020-10-29T09:39:20.000Z
schema/routines/count_by_current_ratio.sql
eclissi91/brahma
5ef9f8e9d9d3871c21aa9832962ee9ee3800c9a9
[ "MIT" ]
1
2020-10-29T08:20:01.000Z
2020-10-29T08:20:01.000Z
# # Copyright (c) Ionplus AG and contributors. All rights reserved. # Licensed under the MIT license. See LICENSE file in the project root for details. # delimiter // # summary: # Calculates the ratio between the specified count and the specified current. # # params: # - $count: The count. # - $current_micro: The current in µA. # - $runtime: The runtime in seconds. # - $electrical_charge: The electrical charge of the ions measured as current. # # returns: # The ratio or null if the current or the runtime is zero. create function count_by_current_ratio($count int, $current_micro double, $runtime double, $electrical_charge double) returns double deterministic begin declare $elementary_charge double default 1.60217662e-19; return safe_ratio( $count * 1e6 * $electrical_charge * $elementary_charge, $current_micro * $runtime); end; // delimiter ;
30.3
118
0.716172
f65649ca1352400cf3cc53daee9b4085b521cf68
572
cpp
C++
hackerrank/non-divisible-subset/solution.cpp
SamProkopchuk/coding-problems
fa0ca2c05ac90e41945de1a5751e5545a8459ac4
[ "MIT" ]
null
null
null
hackerrank/non-divisible-subset/solution.cpp
SamProkopchuk/coding-problems
fa0ca2c05ac90e41945de1a5751e5545a8459ac4
[ "MIT" ]
null
null
null
hackerrank/non-divisible-subset/solution.cpp
SamProkopchuk/coding-problems
fa0ca2c05ac90e41945de1a5751e5545a8459ac4
[ "MIT" ]
null
null
null
#include <iostream> #include <unordered_map> using namespace std; int main() { int n, mod, temp, res; cin >> n >> mod; unordered_map<int, int> remcount; for (int posrem = 0; posrem < mod; posrem++) { // Simple defaultdict-like behavior remcount[posrem] = 0; } for (int c = 0; c < n; c++) { cin >> temp; remcount[temp % mod] += 1; } res = (remcount[0] > 0) + (mod % 2 == 0 && remcount[mod / 2]); for (int rem = 1; rem < (mod + 1) / 2; rem++) { res += max(remcount[rem], remcount[mod - rem]); } cout << res << endl; return 0; }
22.88
64
0.547203
c47871a5d8133a4a65f916b37349926ab5def4aa
5,139
cpp
C++
base/fs/sis/groveler/pathlist.cpp
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
base/fs/sis/groveler/pathlist.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
base/fs/sis/groveler/pathlist.cpp
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
/*++ Copyright (c) 1998 Microsoft Corporation Module Name: pathlist.cpp Abstract: SIS Groveler path list manager Authors: John Douceur, 1998 Environment: User Mode Revision History: --*/ #include "all.hxx" static const _TCHAR *paths_ini_filename = _T("grovel.ini"); static const _TCHAR *paths_ini_section = _T("Excluded Paths"); static const _TCHAR *excluded_paths_path = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Groveler\\Excluded Paths"); static const int default_excluded_path_count = 1; static _TCHAR *default_path_tags[default_excluded_path_count] = { _T("System Volume Information directory") }; static _TCHAR *default_excluded_paths[default_excluded_path_count] = { _T("\\System Volume Information") }; PathList::PathList() { ASSERT(this != 0); paths = 0; buffer = 0; num_partitions = sis_drives.partition_count(); num_paths = new int[num_partitions]; paths = new const _TCHAR **[num_partitions]; partition_buffers = new _TCHAR *[num_partitions]; for (int part_num = 0; part_num < num_partitions; part_num++) { num_paths[part_num] = 1; paths[part_num] = 0; partition_buffers[part_num] = 0; } int num_strings; _TCHAR **strings = 0; bool ok = Registry::read_string_set(HKEY_LOCAL_MACHINE, excluded_paths_path, &num_strings, &strings, &buffer); if (!ok) { Registry::write_string_set(HKEY_LOCAL_MACHINE, excluded_paths_path, default_excluded_path_count, default_excluded_paths, default_path_tags); num_strings = default_excluded_path_count; strings = default_excluded_paths; buffer = 0; } ASSERT(num_strings >= 0); ASSERT(strings != 0); int bLen = SIS_CSDIR_STRING_NCHARS + _tcslen(paths_ini_filename) + MAX_PATH; _TCHAR *ini_file_partition_path = new _TCHAR[bLen]; int *num_partition_strings = new int[num_partitions]; _TCHAR ***partition_strings = new _TCHAR **[num_partitions]; for (part_num = 0; part_num < num_partitions; part_num++) { partition_strings[part_num] = NULL; // // Construct the string // (void)StringCchCopy(ini_file_partition_path, bLen, sis_drives.partition_guid_name(part_num)); TrimTrailingChar(ini_file_partition_path,L'\\'); (void)StringCchCat(ini_file_partition_path, bLen, SIS_CSDIR_STRING); (void)StringCchCat(ini_file_partition_path, bLen, paths_ini_filename); IniFile::read_string_set(ini_file_partition_path, paths_ini_section, &num_partition_strings[part_num], &partition_strings[part_num], &partition_buffers[part_num]); ASSERT(num_partition_strings[part_num] >= 0); ASSERT(num_partition_strings[part_num] == 0 || partition_strings[part_num] != 0); } delete[] ini_file_partition_path; ini_file_partition_path = 0; for (part_num = 0; part_num < num_partitions; part_num++) { paths[part_num] = new const _TCHAR *[num_strings + num_partition_strings[part_num] + 1]; paths[part_num][0] = SIS_CSDIR_STRING; for (int index = 0; index < num_strings; index++) { paths[part_num][num_paths[part_num]] = strings[index]; num_paths[part_num]++; } int num_part_strings = num_partition_strings[part_num]; _TCHAR **part_strings = partition_strings[part_num]; for (index = 0; index < num_part_strings; index++) { paths[part_num][num_paths[part_num]] = part_strings[index]; num_paths[part_num]++; } if (partition_strings[part_num] != 0) { delete[] partition_strings[part_num]; partition_strings[part_num] = 0; } } ASSERT(num_partition_strings != 0); delete[] num_partition_strings; num_partition_strings = 0; ASSERT(partition_strings != 0); delete[] partition_strings; partition_strings = 0; if (buffer != 0) { ASSERT(strings != 0); ASSERT(strings != default_excluded_paths); delete[] strings; strings = 0; } } PathList::~PathList() { ASSERT(this != 0); ASSERT(num_paths != 0); ASSERT(paths != 0); ASSERT(partition_buffers != 0); ASSERT(num_partitions > 0); for (int part_num = 0; part_num < num_partitions; part_num++) { ASSERT(paths[part_num] != 0); delete[] paths[part_num]; paths[part_num] = 0; if (partition_buffers[part_num] != 0) { delete[] partition_buffers[part_num]; partition_buffers[part_num] = 0; } } delete[] paths; paths = 0; delete[] partition_buffers; partition_buffers = 0; if (buffer != 0) { delete[] buffer; buffer = 0; } ASSERT(num_paths != 0); delete[] num_paths; num_paths = 0; }
28.870787
85
0.615684
795c851032e2bece1d8584715aa64538f2d46924
1,179
php
PHP
app/Http/Controllers/UploadFileController.php
bill1224/flea_market_site
a36eefd4b1743b723438a4ab08b8bbc6b94ad413
[ "MIT" ]
null
null
null
app/Http/Controllers/UploadFileController.php
bill1224/flea_market_site
a36eefd4b1743b723438a4ab08b8bbc6b94ad413
[ "MIT" ]
null
null
null
app/Http/Controllers/UploadFileController.php
bill1224/flea_market_site
a36eefd4b1743b723438a4ab08b8bbc6b94ad413
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Storage; use App\Models\Photo; class UploadFileController extends Controller { public function index() { return view('picture'); } // public function store(Request $request) // { // $file = $request->uploadFile->store('images'); // return redirect()->route('/upload'); // } public function store(Request $request) { if(!$request->file('photo')) { return redirect()->back()->withErrors([ 'error' => 'you are not upload the image' ]); } $path = $request->file('photo')->store('public'); $photo = Photo::create([ 'url' => Storage::url($path), 'hashname' => $request->file('photo')->hashName(), 'originalname' => $request->file('photo')->getClientOriginalName(), 'user_seq' => auth()->id() ]); return redirect() ->back() ->with([ 'id' => $photo->id, 'url' => $photo->url, 'status' => 'Photo has been uploaded' ]); } }
25.630435
79
0.514843
a38f89936739ee239f4cbbc07a5aadd564bd0075
1,060
ts
TypeScript
src/app/shared/services/api.service.ts
inidaname/waterfront
99b09425054bde3eab0c1da5e8c36e0fc53887b0
[ "MIT" ]
null
null
null
src/app/shared/services/api.service.ts
inidaname/waterfront
99b09425054bde3eab0c1da5e8c36e0fc53887b0
[ "MIT" ]
9
2021-01-28T20:36:07.000Z
2022-03-25T19:00:41.000Z
src/app/shared/services/api.service.ts
inidaname/waterfront
99b09425054bde3eab0c1da5e8c36e0fc53887b0
[ "MIT" ]
null
null
null
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { environment } from 'src/environments/environment'; import { Observable } from 'rxjs'; import {map, catchError} from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class ApiService { api: string = environment.api; constructor( private http: HttpClient ) {} checkHouseNumber(house): Observable<any> { return this.http .get(`${this.api}/record/${house}`) .pipe(map((record: any) => record), catchError(this.handleError)); } update(data) { return this.http .patch(`${this.api}/record`, data) .pipe(map((record: any) => record), catchError(this.handleError)); } createRecord(data: any): Observable<any> { return this.http .post<any>(`${this.api}/record`, data) .pipe(map((record: any) => record), catchError(this.handleError)); } private handleError(handleError: any): import("rxjs").OperatorFunction<any, any> { throw new Error("Method not implemented."); } }
27.179487
84
0.658491
e913a504cb6fc05498694b45804f0f6700041df8
496
cql
SQL
src/neo4j/cypher/node_tweet.cql
CLARITI-REPHRAIN/mumin-trawl
8a7eda49d8740e927332cd3972750d0b54c23eb1
[ "MIT" ]
null
null
null
src/neo4j/cypher/node_tweet.cql
CLARITI-REPHRAIN/mumin-trawl
8a7eda49d8740e927332cd3972750d0b54c23eb1
[ "MIT" ]
null
null
null
src/neo4j/cypher/node_tweet.cql
CLARITI-REPHRAIN/mumin-trawl
8a7eda49d8740e927332cd3972750d0b54c23eb1
[ "MIT" ]
null
null
null
UNWIND $tweets AS tweet WITH tweet WHERE tweet.id IS NOT NULL MERGE (n:Tweet {tweetId:tweet.id}) ON CREATE SET n.text = tweet.text, n.source = tweet.source, n.lang = tweet.lang, n.createdAt = tweet.created_at, n.likeCount = toInteger(tweet['public_metrics.like_count']), n.retweetCount = toInteger(tweet['public_metrics.retweet_count']), n.replyCount = toInteger(tweet['public_metrics.reply_count']), n.quoteCount = toInteger(tweet['public_metrics.quote_count']);
35.428571
70
0.721774
f07958733cd981dd081d634dc3709f33d83b1dd5
5,394
swift
Swift
HotProspects/Techniques.swift
M4t2h3w/100DaysWithSwiftUI
3d08e7a52a8e12a8de43687a5a45a02825ef8963
[ "MIT" ]
null
null
null
HotProspects/Techniques.swift
M4t2h3w/100DaysWithSwiftUI
3d08e7a52a8e12a8de43687a5a45a02825ef8963
[ "MIT" ]
null
null
null
HotProspects/Techniques.swift
M4t2h3w/100DaysWithSwiftUI
3d08e7a52a8e12a8de43687a5a45a02825ef8963
[ "MIT" ]
null
null
null
// // ContentView.swift // HotProspects // // Created by Matej Novotný on 15/11/2020. // import SamplePackage import UserNotifications import SwiftUI class User: ObservableObject { @Published var name = "Taylor Swift" } struct EditView: View { @EnvironmentObject var user: User var body: some View { TextField("Name", text: $user.name) } } struct DisplayView: View { @EnvironmentObject var user: User var body: some View { Text(user.name) } } enum NetworkError: Error { case badURL, requestFailed, unknown } class DelayedUpdater: ObservableObject { var value = 0 { willSet { objectWillChange.send() } } init() { for i in 1...10 { DispatchQueue.main.asyncAfter(deadline: .now() + Double(i)) { self.value += 1 } } } } struct ContentView: View { @State private var selectedTab = 0 let user = User() @ObservedObject var updater = DelayedUpdater() @State private var backgroundColor = Color.red let possibleNumbers = Array(1...60) var results: String { let selected = possibleNumbers.random(7).sorted() let strings = selected.map(String.init) return strings.joined(separator: ", ") } var body: some View { // ADDING DEPENDENCIES Text(results) // NOTIFICATIONS // VStack { // Button("Request permision") { // UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, error in // if success { // print("All set!") // } else if let error = error { // print(error.localizedDescription) // } // } // } // // Button("Schedule notification") { // let content = UNMutableNotificationContent() // content.title = "Feed the cat" // content.subtitle = "It looks hungry" // content.sound = UNNotificationSound.default // // let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false) // // let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger) // // UNUserNotificationCenter.current().add(request) // // } // } // CONTEXT MENU // VStack { // Text("Hello, World!") // .padding() // .background(backgroundColor) // // Text("Change color") // .padding() // .contextMenu { // Button(action: { // self.backgroundColor = .red // }) { // Text("Red") // Image(systemName: "checkmark.circle.fill") // .foregroundColor(.red) // } // // Button(action: { // self.backgroundColor = .green // }) { // Text("Green") // } // // Button(action: { // self.backgroundColor = .blue // }) { // Text("Blue") // } // } // } // IMAGE INTERPOLATION // Image("example") // .interpolation(.none) // .resizable() // .scaledToFit() // .frame(maxHeight: .infinity) // .background(Color.black) // .edgesIgnoringSafeArea(/*@START_MENU_TOKEN@*/.all/*@END_MENU_TOKEN@*/) // FETCHING DATA FROM REMOTE URL // .onAppear { // self.fetchData(from: "https://www.apple.com") { result in // switch result { // case .success(let str): // print(str) // case .failure(let error): // switch error { // case .badURL: // print("Bad URL") // case .requestFailed: // print("Network problems") // case .unknown: // print("Unknown error") // } // } // } // } } func fetchData(from urlString: String, completion: @escaping (Result<String, NetworkError>) -> Void) { guard let url = URL(string: urlString) else { completion(.failure(.badURL)) return } URLSession.shared.dataTask(with: url) { data, response, error in DispatchQueue.main.async { if let data = data { let stringData = String(decoding: data, as: UTF8.self) completion(.success(stringData)) } else if error != nil { completion(.failure(.requestFailed)) } else { completion(.failure(.unknown)) } } } .resume() } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
29.47541
128
0.46218
b358a3ff2afe6dd7adb665a987fda584c2ac71b4
566
py
Python
Baekjoon/1004.py
pumaka/TIL
50d2ab309896eaf4e6416fa9b3f26552e74d7a5e
[ "CC0-1.0" ]
null
null
null
Baekjoon/1004.py
pumaka/TIL
50d2ab309896eaf4e6416fa9b3f26552e74d7a5e
[ "CC0-1.0" ]
null
null
null
Baekjoon/1004.py
pumaka/TIL
50d2ab309896eaf4e6416fa9b3f26552e74d7a5e
[ "CC0-1.0" ]
null
null
null
import math def length(x1,y1,c1,c2,r): len_ = 0 len_ = math.sqrt((c1-x1)**2 + (c2-y1)**2) if(len_ >= r): return 0; else: return 1; count = 0 T = int(input()) for i in range(T): x1, y1, x2, y2 = map(int, input().split()) N = int(input()) for l in range(N): c1, c2, r = map(int, input().split()) if (length(x1,y1,c1,c2,r) and (length(x2,y2,c1,c2,r) == 0)) or ((length(x1,y1,c1,c2,r) == 0) and length(x2,y2,c1,c2,r)): count += 1 else: continue print(count) count = 0
23.583333
128
0.492933
0a44a381426fd43cbb8f87eb310687993cd6638e
1,003
cs
C#
Amazon.Pay.API.SDK/WebStore/Types/MerchantMetadata.cs
nabehiro/amazon-pay-api-sdk-dotnet
dd55e49f93349f0549792d75f158e0c8e8357c37
[ "Apache-2.0" ]
null
null
null
Amazon.Pay.API.SDK/WebStore/Types/MerchantMetadata.cs
nabehiro/amazon-pay-api-sdk-dotnet
dd55e49f93349f0549792d75f158e0c8e8357c37
[ "Apache-2.0" ]
null
null
null
Amazon.Pay.API.SDK/WebStore/Types/MerchantMetadata.cs
nabehiro/amazon-pay-api-sdk-dotnet
dd55e49f93349f0549792d75f158e0c8e8357c37
[ "Apache-2.0" ]
null
null
null
using Newtonsoft.Json; using System; namespace Amazon.Pay.API.WebStore.Types { public class MerchantMetadata { /// <summary> /// External merchant order identifer. /// </summary> [JsonProperty(PropertyName = "merchantReferenceId")] public string MerchantReferenceId { get; set; } /// <summary> /// Merchant store name. /// </summary> [JsonProperty(PropertyName = "merchantStoreName")] public string MerchantStoreName { get; set; } /// <summary> /// Description of the order that is shared in buyer communication. /// </summary> [JsonProperty(PropertyName = "noteToBuyer")] public string NoteToBuyer { get; set; } /// <summary> /// Custom info for the order. This data is not shared in any buyer communication. /// </summary> [JsonProperty(PropertyName = "customInformation")] public string CustomInformation { get; set; } } }
30.393939
90
0.604187
ce17f959bbdeeb26b92a58844c350ad2899d05e5
44,302
rs
Rust
hal/src/spi.rs
newAM/stm32wlxx-hal
a9d4b5a77d7d4fc6d5da3402328196d980d4b680
[ "MIT" ]
10
2021-11-03T08:15:01.000Z
2022-03-23T21:10:29.000Z
hal/src/spi.rs
newAM/stm32wlxx-hal
a9d4b5a77d7d4fc6d5da3402328196d980d4b680
[ "MIT" ]
9
2021-10-31T19:28:23.000Z
2022-03-17T23:36:23.000Z
hal/src/spi.rs
newAM/stm32wlxx-hal
a9d4b5a77d7d4fc6d5da3402328196d980d4b680
[ "MIT" ]
4
2021-11-02T15:16:45.000Z
2022-03-10T12:14:32.000Z
//! Serial peripheral interface //! //! The [`Spi`] struct implement the [`embedded-hal`] traits for transfers. //! //! # Constructors //! //! There was a minor cartesian explosion when writing this module. //! This will get a lot nicer when [GATs are stabilized]. //! //! | Function | Bus | plex | DMA | //! |-------------------------------------|-----|--------------|-----| //! | [`new_spi1_full_duplex`] | 1 | Full-duplex | No | //! | [`new_spi1_full_duplex_dma`] | 1 | Full-duplex | Yes | //! | [`new_spi1_mosi_simplex`] | 1 | MOSI-simplex | No | //! | [`new_spi1_mosi_simplex_dma`] | 1 | MOSI-simplex | Yes | //! | [`new_spi2_full_duplex`] | 2 | Full-duplex | No | //! | [`new_spi2_full_duplex_dma`] | 2 | Full-duplex | Yes | //! | [`new_spi2_mosi_simplex`] | 2 | MOSI-simplex | No | //! | [`new_spi2_mosi_simplex_dma`] | 2 | MOSI-simplex | Yes | //! //! [GATs are stabilized]: https://blog.rust-lang.org/2021/08/03/GATs-stabilization-push.html //! [`embedded-hal`]: https://docs.rs/embedded-hal/latest/embedded_hal/ //! [`new_spi1_full_duplex_dma`]: Spi::new_spi1_full_duplex_dma //! [`new_spi1_full_duplex`]: Spi::new_spi1_full_duplex //! [`new_spi1_mosi_simplex_dma`]: Spi::new_spi1_mosi_simplex_dma //! [`new_spi1_mosi_simplex`]: Spi::new_spi1_mosi_simplex //! [`new_spi2_full_duplex_dma`]: Spi::new_spi2_full_duplex_dma //! [`new_spi2_full_duplex`]: Spi::new_spi2_full_duplex //! [`new_spi2_mosi_simplex_dma`]: Spi::new_spi2_mosi_simplex_dma //! [`new_spi2_mosi_simplex`]: Spi::new_spi2_mosi_simplex use crate::{ dma::{self, DmaCh}, gpio::sealed::{ Spi1Miso, Spi1Mosi, Spi1Sck, Spi2Miso, Spi2Mosi, Spi2Sck, SpiMiso, SpiMosi, SpiSck, }, pac::{self, SPI1, SPI2}, }; pub use embedded_hal::{ blocking::spi::{Transfer, Write}, spi::{FullDuplex, Mode, Phase, Polarity, MODE_0, MODE_1, MODE_2, MODE_3}, }; use cortex_m::interrupt::CriticalSection; typestate!(NoSck, "no SCK on a generic SPI structure"); typestate!(NoMosi, "no MOSI on a generic SPI structure"); typestate!(NoMiso, "no MISO on a generic SPI structure"); typestate!(SgSck, "the internal Sub-GHz SCK"); typestate!(SgMosi, "the internal Sub-GHz MOSI"); typestate!(SgMiso, "the internal Sub-GHz MISO"); impl SpiSck for SgSck {} impl SpiMosi for SgMosi {} impl SpiMiso for SgMiso {} use pac::spi1::cr1::BR_A; /// Baud rate divisors. #[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] #[repr(u8)] pub enum BaudRate { /// Source clock / 256 Div256 = BR_A::DIV256 as u8, /// Source clock / 128 Div128 = BR_A::DIV128 as u8, /// Source clock / 64 Div64 = BR_A::DIV64 as u8, /// Source clock / 32 Div32 = BR_A::DIV32 as u8, /// Source clock / 16 Div16 = BR_A::DIV16 as u8, /// Source clock / 8 Div8 = BR_A::DIV8 as u8, /// Source clock / 4 Div4 = BR_A::DIV4 as u8, /// Source clock / 2 Div2 = BR_A::DIV2 as u8, } impl BaudRate { /// Get baud rate divisor. /// /// # Example /// /// ``` /// use stm32wlxx_hal::spi::BaudRate; /// /// assert_eq!(BaudRate::Div256.div(), 256); /// assert_eq!(BaudRate::Div128.div(), 128); /// assert_eq!(BaudRate::Div64.div(), 64); /// assert_eq!(BaudRate::Div32.div(), 32); /// assert_eq!(BaudRate::Div16.div(), 16); /// assert_eq!(BaudRate::Div8.div(), 8); /// assert_eq!(BaudRate::Div4.div(), 4); /// assert_eq!(BaudRate::Div2.div(), 2); /// ``` pub const fn div(&self) -> u16 { match self { BaudRate::Div256 => 256, BaudRate::Div128 => 128, BaudRate::Div64 => 64, BaudRate::Div32 => 32, BaudRate::Div16 => 16, BaudRate::Div8 => 8, BaudRate::Div4 => 4, BaudRate::Div2 => 2, } } } /// SPI errors #[derive(Debug, PartialEq, Eq, Clone, Copy)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Error { /// Frame format error Framing, /// CRC check error Crc, /// NSS mode fault ModeFault, /// FIFO overrun Overrun, /// RX DMA error /// /// This can only occur on SPI transfers that use the RX DMA. RxDma, /// TX DMA error /// /// This can only occur on SPI transfers that use the TX DMA. TxDma, } const fn cpha_from_phase(phase: Phase) -> bool { match phase { Phase::CaptureOnFirstTransition => false, Phase::CaptureOnSecondTransition => true, } } const fn cpol_from_polarity(polarity: Polarity) -> bool { match polarity { Polarity::IdleLow => false, Polarity::IdleHigh => true, } } use sealed::SpiRegs; pub(crate) mod sealed { use super::Error; use crate::{ dma::{self, DmaCh}, pac, }; use core::{ ptr::{read_volatile, write_volatile}, sync::atomic::{compiler_fence, Ordering::SeqCst}, }; use pac::dmamux::c0cr::DMAREQ_ID_A::{ SPI1_RX_DMA, SPI1_TX_DMA, SPI2_RX_DMA, SPI2_TX_DMA, SUBGHZSPI_RX, SUBGHZSPI_TX, }; const SPI1_BASE: usize = 0x4001_3000; const SPI2_BASE: usize = 0x4000_3800; const SPI3_BASE: usize = 0x5801_0000; const DR_OFFSET: usize = 0xC; pub trait SpiRegs: core::ops::Deref<Target = pac::spi1::RegisterBlock> { const DR: usize; const DMA_TX_ID: u8; const DMA_RX_ID: u8; fn status(&self) -> Result<pac::spi1::sr::R, Error> { let sr = self.deref().sr.read(); if sr.ovr().bit_is_set() { Err(Error::Overrun) } else if sr.fre().bit_is_set() { Err(Error::Framing) } else if sr.modf().bit_is_set() { Err(Error::ModeFault) } else if sr.crcerr().bit_is_set() { Err(Error::Crc) } else { Ok(sr) } } fn write_simplex_u8(&mut self, words: &[u8]) -> Result<(), Error> { for word in words.iter() { self.write_word(*word)?; } Ok(()) } fn write_simplex_u8_dma<TxDma: DmaCh>( &mut self, tx_dma: &mut TxDma, words: &[u8], ) -> Result<(), Error> { if words.is_empty() { return Ok(()); } const CR: dma::Cr = dma::Cr::RESET .set_dir_from_mem() .set_mem_inc(true) .set_enable(true); tx_dma.set_mem_addr(words.as_ptr() as u32); tx_dma.set_num_data_xfer(words.len() as u32); tx_dma.set_cr(CR); let ret: Result<(), Error> = loop { let status = self.status()?; let tx_dma_flags: u8 = tx_dma.flags(); if tx_dma_flags & dma::flags::XFER_ERR != 0 { break Err(Error::TxDma); } if status.bsy().is_not_busy() && status.ftlvl().is_empty() && tx_dma_flags & dma::flags::XFER_CPL != 0 { break Ok(()); } }; tx_dma.set_cr(dma::Cr::DISABLE); tx_dma.clear_all_flags(); ret } fn write_full_duplex_u8(&mut self, words: &[u8]) -> Result<(), Error> { for word in words.iter() { self.write_word(*word)?; let _: u8 = self.read_word()?; } Ok(()) } fn write_full_duplex_u8_dma<RxDma: DmaCh, TxDma: DmaCh>( &mut self, rx_dma: &mut RxDma, tx_dma: &mut TxDma, words: &[u8], ) -> Result<(), Error> { if words.is_empty() { return Ok(()); } const RX_CR: dma::Cr = dma::Cr::RESET .set_dir_from_periph() .set_mem_inc(false) .set_enable(true); const TX_CR: dma::Cr = dma::Cr::RESET .set_dir_from_mem() .set_mem_inc(true) .set_enable(true); let garbage: [u8; 1] = [0]; rx_dma.set_mem_addr(garbage.as_ptr() as u32); tx_dma.set_mem_addr(words.as_ptr() as u32); let ndt: u32 = words.len() as u32; rx_dma.set_num_data_xfer(ndt); tx_dma.set_num_data_xfer(ndt); // RX MUST come before TX rx_dma.set_cr(RX_CR); tx_dma.set_cr(TX_CR); let ret: Result<(), Error> = loop { let status = self.status()?; let tx_dma_flags: u8 = tx_dma.flags(); let rx_dma_flags: u8 = rx_dma.flags(); if tx_dma_flags & dma::flags::XFER_ERR != 0 { break Err(Error::TxDma); } if rx_dma_flags & dma::flags::XFER_ERR != 0 { break Err(Error::RxDma); } if status.bsy().is_not_busy() && status.ftlvl().is_empty() && status.frlvl().is_empty() && tx_dma_flags & dma::flags::XFER_CPL != 0 && rx_dma_flags & dma::flags::XFER_CPL != 0 { break Ok(()); } }; // TX must come before RX tx_dma.set_cr(dma::Cr::DISABLE); rx_dma.set_cr(dma::Cr::DISABLE); rx_dma.clear_all_flags(); tx_dma.clear_all_flags(); ret } fn transfer_u8_dma<'w, RxDma: DmaCh, TxDma: DmaCh>( &mut self, rx_dma: &mut RxDma, tx_dma: &mut TxDma, words: &'w mut [u8], ) -> Result<&'w [u8], Error> { if words.is_empty() { return Ok(words); } const RX_CR: dma::Cr = dma::Cr::RESET .set_dir_from_periph() .set_mem_inc(true) .set_enable(true); const TX_CR: dma::Cr = dma::Cr::RESET .set_dir_from_mem() .set_mem_inc(true) .set_enable(true); rx_dma.set_mem_addr(words.as_ptr() as u32); tx_dma.set_mem_addr(words.as_ptr() as u32); let ndt: u32 = words.len() as u32; rx_dma.set_num_data_xfer(ndt); tx_dma.set_num_data_xfer(ndt); // RX MUST come before TX rx_dma.set_cr(RX_CR); tx_dma.set_cr(TX_CR); let ret: Result<&'w [u8], Error> = loop { let status = self.status()?; let tx_dma_flags: u8 = tx_dma.flags(); let rx_dma_flags: u8 = rx_dma.flags(); if tx_dma_flags & dma::flags::XFER_ERR != 0 { break Err(Error::TxDma); } if rx_dma_flags & dma::flags::XFER_ERR != 0 { break Err(Error::RxDma); } if status.bsy().is_not_busy() && status.ftlvl().is_empty() && status.frlvl().is_empty() && tx_dma_flags & dma::flags::XFER_CPL != 0 && rx_dma_flags & dma::flags::XFER_CPL != 0 { break Ok(words); } }; // DMA disable must come BEFORE memory barrier // TX must come before RX tx_dma.set_cr(dma::Cr::DISABLE); rx_dma.set_cr(dma::Cr::DISABLE); rx_dma.clear_all_flags(); tx_dma.clear_all_flags(); // tell the compiler the memory in dst may have changed compiler_fence(SeqCst); // tell the cpu the memory in dst may have changed cortex_m::asm::dmb(); ret } fn write_word(&mut self, word: u8) -> Result<(), Error> { loop { if !self.status()?.ftlvl().is_full() { unsafe { write_volatile(Self::DR as *mut u8, word) }; return Ok(()); } } } fn read_word(&mut self) -> Result<u8, Error> { loop { if !self.status()?.frlvl().is_empty() { return Ok(unsafe { read_volatile(Self::DR as *const u8) }); } } } fn transfer_u8<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Error> { for word in words.iter_mut() { self.write_word(*word)?; *word = self.read_word()?; } Ok(words) } fn nb_read_u8(&mut self) -> nb::Result<u8, Error> { if self.status()?.frlvl().is_empty() { Err(nb::Error::WouldBlock) } else { Ok(unsafe { read_volatile(Self::DR as *const u8) }) } } fn nb_send_u8(&mut self, word: u8) -> nb::Result<(), Error> { if self.status()?.ftlvl().is_full() { Err(nb::Error::WouldBlock) } else { unsafe { write_volatile(Self::DR as *mut u8, word) }; Ok(()) } } } impl SpiRegs for pac::SPI1 { const DR: usize = SPI1_BASE + DR_OFFSET; const DMA_TX_ID: u8 = SPI1_TX_DMA as u8; const DMA_RX_ID: u8 = SPI1_RX_DMA as u8; } impl SpiRegs for pac::SPI2 { const DR: usize = SPI2_BASE + DR_OFFSET; const DMA_TX_ID: u8 = SPI2_TX_DMA as u8; const DMA_RX_ID: u8 = SPI2_RX_DMA as u8; } impl SpiRegs for pac::SPI3 { const DR: usize = SPI3_BASE + DR_OFFSET; const DMA_TX_ID: u8 = SUBGHZSPI_TX as u8; const DMA_RX_ID: u8 = SUBGHZSPI_RX as u8; } } /// SPI 1 and 2 driver. #[derive(Debug)] pub struct Spi<SPI, SCK, MISO, MOSI> { spi: SPI, sck: SCK, miso: MISO, mosi: MOSI, } /// SPI 3 (Sub-GHz) driver. #[derive(Debug)] #[doc(hidden)] pub struct Spi3<MISO, MOSI> { spi: pac::SPI3, miso: MISO, mosi: MOSI, } impl<SCK, MISO, MOSI> Spi<pac::SPI1, SCK, MISO, MOSI> { /// Reset the SPI. /// /// # Safety /// /// 1. The SPI must not be in-use. /// 2. You are responsible for setting up the SPI after a reset. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// pac, /// spi::{NoMiso, NoMosi, NoSck, Spi}, /// }; /// /// let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap(); /// unsafe { Spi::<pac::SPI1, NoSck, NoMiso, NoMosi>::pulse_reset(&mut dp.RCC) }; /// ``` #[inline] pub unsafe fn pulse_reset(rcc: &mut pac::RCC) { rcc.apb2rstr.modify(|_, w| w.spi1rst().set_bit()); rcc.apb2rstr.modify(|_, w| w.spi1rst().clear_bit()); } /// Disable the SPI clock. /// /// # Safety /// /// 1. You are responsible for ensuring the SPI is in a state where /// the clock can be disabled without entering an error state. /// 2. You cannot use the SPI while the clock is disabled. /// 3. You are responsible for re-enabling the clock before resuming /// use of the SPI. /// 4. You are responsible for setting up anything that may have lost /// state while the clock was disabled. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// pac, /// spi::{NoMiso, NoMosi, NoSck, Spi}, /// }; /// /// let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap(); /// unsafe { Spi::<pac::SPI1, NoSck, NoMiso, NoMosi>::disable_clock(&mut dp.RCC) }; /// ``` #[inline] pub unsafe fn disable_clock(rcc: &mut pac::RCC) { rcc.apb2enr.modify(|_, w| w.spi1en().disabled()); } /// Enable the SPI clock. /// /// This is done for you in `new_` constructors. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// pac, /// spi::{NoMiso, NoMosi, NoSck, Spi}, /// }; /// /// let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap(); /// Spi::<pac::SPI1, NoSck, NoMiso, NoMosi>::enable_clock(&mut dp.RCC); /// ``` #[inline] pub fn enable_clock(rcc: &mut pac::RCC) { rcc.apb2enr.modify(|_, w| w.spi1en().enabled()); rcc.apb2enr.read(); // delay after an RCC peripheral clock enabling } } impl<SCK, MISO, MOSI> Spi<pac::SPI2, SCK, MISO, MOSI> { /// Reset the SPI. /// /// # Safety /// /// 1. The SPI must not be in-use. /// 2. You are responsible for setting up the SPI after a reset. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// pac, /// spi::{NoMiso, NoMosi, NoSck, Spi}, /// }; /// /// let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap(); /// unsafe { Spi::<pac::SPI2, NoSck, NoMiso, NoMosi>::pulse_reset(&mut dp.RCC) }; /// ``` #[inline] pub unsafe fn pulse_reset(rcc: &mut pac::RCC) { rcc.apb1rstr1.modify(|_, w| w.spi2s2rst().set_bit()); rcc.apb1rstr1.modify(|_, w| w.spi2s2rst().clear_bit()); } /// Disable the SPI clock. /// /// # Safety /// /// 1. You are responsible for ensuring the SPI is in a state where /// the clock can be disabled without entering an error state. /// 2. You cannot use the SPI while the clock is disabled. /// 3. You are responsible for re-enabling the clock before resuming /// use of the SPI. /// 4. You are responsible for setting up anything that may have lost /// state while the clock was disabled. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// pac, /// spi::{NoMiso, NoMosi, NoSck, Spi}, /// }; /// /// let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap(); /// unsafe { Spi::<pac::SPI2, NoSck, NoMiso, NoMosi>::disable_clock(&mut dp.RCC) }; /// ``` #[inline] pub unsafe fn disable_clock(rcc: &mut pac::RCC) { rcc.apb1enr1.modify(|_, w| w.spi2s2en().disabled()); } /// Enable the SPI clock. /// /// This is done for you in `new_` constructors. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// pac, /// spi::{NoMiso, NoMosi, NoSck, Spi}, /// }; /// /// let mut dp: pac::Peripherals = pac::Peripherals::take().unwrap(); /// Spi::<pac::SPI2, NoSck, NoMiso, NoMosi>::enable_clock(&mut dp.RCC); /// ``` #[inline] pub fn enable_clock(rcc: &mut pac::RCC) { rcc.apb1enr1.modify(|_, w| w.spi2s2en().enabled()); rcc.apb1enr1.read(); // delay after an RCC peripheral clock enabling } } #[allow(missing_docs)] // struct is hidden #[allow(clippy::missing_safety_doc)] impl<MISO, MOSI> Spi3<MISO, MOSI> { #[inline] pub unsafe fn pulse_reset(rcc: &mut pac::RCC) { rcc.apb3rstr.modify(|_, w| w.subghzspirst().set_bit()); rcc.apb3rstr.modify(|_, w| w.subghzspirst().clear_bit()); } #[inline] pub unsafe fn disable_clock(rcc: &mut pac::RCC) { rcc.apb3enr.modify(|_, w| w.subghzspien().disabled()); } #[inline] pub fn enable_clock(rcc: &mut pac::RCC) { rcc.apb3enr.modify(|_, w| w.subghzspien().enabled()); rcc.apb3enr.read(); // delay after an RCC peripheral clock enabling } } macro_rules! impl_new_full_duplex { ($n:expr) => { paste::paste! { impl<SCK, MISO, MOSI> Spi<[<SPI $n>], SCK, MISO, MOSI> where SCK: [<Spi $n Sck>], MISO: [<Spi $n Miso>], MOSI: [<Spi $n Mosi>], { /// Create a new full-duplex master. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// cortex_m, /// gpio::PortA, /// pac, /// spi::{BaudRate::Div2, Spi, MODE_0}, /// }; /// /// let mut dp = pac::Peripherals::take().unwrap(); /// /// let pa = PortA::split(dp.GPIOA, &mut dp.RCC); /// let spi = cortex_m::interrupt::free(|cs| { /// Spi::new_spi1_full_duplex( /// dp.SPI1, /// (pa.a5, pa.a6, pa.a7), /// MODE_0, /// Div2, /// &mut dp.RCC, /// cs, /// ) /// }); /// ``` pub fn [<new_spi $n _full_duplex>]( spi: [<SPI $n>], mut pins: (SCK, MISO, MOSI), mode: Mode, div: BaudRate, rcc: &mut pac::RCC, cs: &CriticalSection, ) -> Self { Self::enable_clock(rcc); unsafe { Self::pulse_reset(rcc) }; pins.0.[<set_spi $n _sck_af>](cs); pins.1.[<set_spi $n _miso_af>](cs); pins.2.[<set_spi $n _mosi_af>](cs); spi.cr1.write(|w| { w .ssi().set_bit() .ssm().set_bit() .spe().set_bit() .br().bits(div as u8) .mstr().set_bit() .cpol().bit(cpol_from_polarity(mode.polarity)) .cpha().bit(cpha_from_phase(mode.phase)) }); spi.cr2.write(|w| w.frxth().quarter()); Self { spi, sck: pins.0, miso: pins.1, mosi: pins.2, } } } } }; } impl_new_full_duplex!(1); impl_new_full_duplex!(2); macro_rules! impl_new_full_duplex_dma { ($n:expr) => { paste::paste! { impl<SCK, MISO, MOSI, MISODMA, MOSIDMA> Spi<[<SPI $n>], SCK, (MISO, MISODMA), (MOSI, MOSIDMA)> where SCK: [<Spi $n Sck>], MISO: [<Spi $n Miso>], MOSI: [<Spi $n Mosi>], MISODMA: DmaCh, MOSIDMA: DmaCh, { /// Create a new full-duplex master with DMA transfers. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// cortex_m, /// dma::AllDma, /// gpio::PortA, /// pac, /// spi::{BaudRate::Div2, Spi, MODE_0}, /// }; /// /// let mut dp = pac::Peripherals::take().unwrap(); /// /// let dma = AllDma::split(dp.DMAMUX, dp.DMA1, dp.DMA2, &mut dp.RCC); /// let pa = PortA::split(dp.GPIOA, &mut dp.RCC); /// let spi = cortex_m::interrupt::free(|cs| { /// Spi::new_spi1_full_duplex_dma( /// dp.SPI1, /// (pa.a5, pa.a6, pa.a7), /// (dma.d1.c1, dma.d1.c2), /// MODE_0, /// Div2, /// &mut dp.RCC, /// cs, /// ) /// }); /// ``` pub fn [<new_spi $n _full_duplex_dma>]( spi: [<SPI $n>], mut pins: (SCK, MISO, MOSI), mut dmas: (MISODMA, MOSIDMA), mode: Mode, div: BaudRate, rcc: &mut pac::RCC, cs: &CriticalSection, ) -> Self { Self::enable_clock(rcc); unsafe { Self::pulse_reset(rcc) }; pins.0.[<set_spi $n _sck_af>](cs); pins.1.[<set_spi $n _miso_af>](cs); pins.2.[<set_spi $n _mosi_af>](cs); spi.cr1.write(|w| { w .ssi().set_bit() .ssm().set_bit() .spe().set_bit() .br().bits(div as u8) .mstr().set_bit() .cpol().bit(cpol_from_polarity(mode.polarity)) .cpha().bit(cpha_from_phase(mode.phase)) }); dmas.0.set_cr(dma::Cr::DISABLE); dmas.0.clear_all_flags(); dmas.0.set_periph_addr([<SPI $n>]::DR as u32); dmas.0.set_mux_cr_reqid([<SPI $n>]::DMA_RX_ID); dmas.1.set_cr(dma::Cr::DISABLE); dmas.1.clear_all_flags(); dmas.1.set_periph_addr([<SPI $n>]::DR as u32); dmas.1.set_mux_cr_reqid([<SPI $n>]::DMA_TX_ID); spi.cr2 .write(|w| w.txdmaen().enabled().rxdmaen().enabled().frxth().quarter()); Self { spi, sck: pins.0, miso: (pins.1, dmas.0), mosi: (pins.2, dmas.1), } } } } }; } impl_new_full_duplex_dma!(1); impl_new_full_duplex_dma!(2); macro_rules! impl_new_mosi_simplex { ($n:expr) => { paste::paste! { impl<SCK, MOSI> Spi<[<SPI $n>], SCK, NoMiso, MOSI> where SCK: [<Spi $n Sck>], MOSI: [<Spi $n Mosi>], { /// Create a new MOSI-simplex master. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// cortex_m, /// gpio::PortA, /// pac, /// spi::{BaudRate::Div2, Spi, MODE_0}, /// }; /// /// let mut dp = pac::Peripherals::take().unwrap(); /// /// let pa = PortA::split(dp.GPIOA, &mut dp.RCC); /// let spi = cortex_m::interrupt::free(|cs| { /// Spi::new_spi1_mosi_simplex( /// dp.SPI1, /// (pa.a5, pa.a7), /// MODE_0, /// Div2, /// &mut dp.RCC, /// cs, /// ) /// }); /// ``` pub fn [<new_spi $n _mosi_simplex>]( spi: [<SPI $n>], mut pins: (SCK, MOSI), mode: Mode, div: BaudRate, rcc: &mut pac::RCC, cs: &CriticalSection, ) -> Self { Self::enable_clock(rcc); unsafe { Self::pulse_reset(rcc) }; pins.0.[<set_spi $n _sck_af>](cs); pins.1.[<set_spi $n _mosi_af>](cs); spi.cr1.write(|w| w .bidimode().set_bit() .bidioe().set_bit() .ssi().set_bit() .ssm().set_bit() .spe().set_bit() .br().bits(div as u8) .mstr().set_bit() .cpol().bit(cpol_from_polarity(mode.polarity)) .cpha().bit(cpha_from_phase(mode.phase)) ); spi.cr2.write(|w| w.frxth().quarter()); Self { spi, sck: pins.0, miso: NoMiso::new(), mosi: pins.1, } } } } }; } impl_new_mosi_simplex!(1); impl_new_mosi_simplex!(2); macro_rules! impl_new_mosi_simplex_dma { ($n:expr) => { paste::paste! { impl<SCK, MOSI, MOSIDMA> Spi<[<SPI $n>], SCK, NoMiso, (MOSI, MOSIDMA)> where SCK: [<Spi $n Sck>], MOSI: [<Spi $n Mosi>], MOSIDMA: DmaCh, { /// Create a new MOSI-simplex master with DMA transfers. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// cortex_m, /// dma::AllDma, /// gpio::PortA, /// pac, /// spi::{BaudRate::Div2, Spi, MODE_0}, /// }; /// /// let mut dp = pac::Peripherals::take().unwrap(); /// /// let dma = AllDma::split(dp.DMAMUX, dp.DMA1, dp.DMA2, &mut dp.RCC); /// let pa = PortA::split(dp.GPIOA, &mut dp.RCC); /// let spi = cortex_m::interrupt::free(|cs| { /// Spi::new_spi1_mosi_simplex_dma( /// dp.SPI1, /// (pa.a5, pa.a7), /// dma.d1.c1, /// MODE_0, /// Div2, /// &mut dp.RCC, /// cs, /// ) /// }); /// ``` pub fn [<new_spi $n _mosi_simplex_dma>]( spi: [<SPI $n>], mut pins: (SCK, MOSI), mut dma: MOSIDMA, mode: Mode, div: BaudRate, rcc: &mut pac::RCC, cs: &CriticalSection, ) -> Self { Self::enable_clock(rcc); unsafe { Self::pulse_reset(rcc) }; pins.0.[<set_spi $n _sck_af>](cs); pins.1.[<set_spi $n _mosi_af>](cs); spi.cr1.write(|w| w .bidimode().set_bit() .bidioe().set_bit() .ssi().set_bit() .ssm().set_bit() .spe().set_bit() .br().bits(div as u8) .mstr().set_bit() .cpol().bit(cpol_from_polarity(mode.polarity)) .cpha().bit(cpha_from_phase(mode.phase)) ); dma.set_cr(dma::Cr::DISABLE); dma.clear_all_flags(); dma.set_periph_addr([<SPI $n>]::DR as u32); dma.set_mux_cr_reqid([<SPI $n>]::DMA_TX_ID); spi.cr2.write(|w| w.txdmaen().enabled().frxth().quarter()); Self { spi, sck: pins.0, miso: NoMiso::new(), mosi: (pins.1, dma), } } } } }; } impl_new_mosi_simplex_dma!(1); impl_new_mosi_simplex_dma!(2); macro_rules! impl_new_miso_simplex { ($n:expr) => { paste::paste! { impl<SCK, MISO> Spi<[<SPI $n>], SCK, MISO, NoMosi> where SCK: [<Spi $n Sck>], MISO: [<Spi $n Miso>], { /// Create a new MOSI-simplex slave. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// cortex_m, /// gpio::PortA, /// pac, /// spi::{Spi, MODE_0}, /// }; /// /// let mut dp = pac::Peripherals::take().unwrap(); /// /// let pa = PortA::split(dp.GPIOA, &mut dp.RCC); /// let spi = cortex_m::interrupt::free(|cs| { /// Spi::new_spi1_miso_simplex_slave( /// dp.SPI1, /// (pa.a5, pa.a6), /// MODE_0, /// &mut dp.RCC, /// cs, /// ) /// }); /// ``` pub fn [<new_spi $n _miso_simplex_slave>]( spi: [<SPI $n>], mut pins: (SCK, MISO), mode: Mode, rcc: &mut pac::RCC, cs: &CriticalSection, ) -> Self { Self::enable_clock(rcc); unsafe { Self::pulse_reset(rcc) }; pins.0.[<set_spi $n _sck_af>](cs); pins.1.[<set_spi $n _miso_af>](cs); spi.cr1.write(|w| { w .bidimode().set_bit() .bidioe().set_bit() .ssi().set_bit() .ssm().set_bit() .spe().set_bit() .cpol().bit(cpol_from_polarity(mode.polarity)) .cpha().bit(cpha_from_phase(mode.phase)) }); spi.cr2.write(|w| w.frxth().quarter()); Self { spi, sck: pins.0, miso: pins.1, mosi: NoMosi::new(), } } } } }; } impl_new_miso_simplex!(1); impl_new_miso_simplex!(2); macro_rules! impl_new_miso_simplex_dma { ($n:expr) => { paste::paste! { impl<SCK, MISO, MISODMA> Spi<[<SPI $n>], SCK, (MISO, MISODMA), NoMosi> where SCK: [<Spi $n Sck>], MISO: [<Spi $n Miso>], MISODMA: DmaCh, { /// Create a new MISO-simplex slave with DMA transfers. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// cortex_m, /// dma::AllDma, /// gpio::PortA, /// pac, /// spi::{Spi, MODE_0}, /// }; /// /// let mut dp = pac::Peripherals::take().unwrap(); /// /// let dma = AllDma::split(dp.DMAMUX, dp.DMA1, dp.DMA2, &mut dp.RCC); /// let pa = PortA::split(dp.GPIOA, &mut dp.RCC); /// let spi = cortex_m::interrupt::free(|cs| { /// Spi::new_spi1_miso_simplex_slave_dma( /// dp.SPI1, /// (pa.a5, pa.a6), /// dma.d1.c1, /// MODE_0, /// &mut dp.RCC, /// cs, /// ) /// }); /// ``` pub fn [<new_spi $n _miso_simplex_slave_dma>]( spi: [<SPI $n>], mut pins: (SCK, MISO), mut dma: MISODMA, mode: Mode, rcc: &mut pac::RCC, cs: &CriticalSection, ) -> Self { Self::enable_clock(rcc); unsafe { Self::pulse_reset(rcc) }; pins.0.[<set_spi $n _sck_af>](cs); pins.1.[<set_spi $n _miso_af>](cs); spi.cr1.write(|w| { w .bidimode().set_bit() .bidioe().set_bit() .ssi().set_bit() .ssm().set_bit() .spe().set_bit() .cpol().bit(cpol_from_polarity(mode.polarity)) .cpha().bit(cpha_from_phase(mode.phase)) }); dma.set_cr(dma::Cr::DISABLE); dma.clear_all_flags(); dma.set_periph_addr([<SPI $n>]::DR as u32); dma.set_mux_cr_reqid([<SPI $n>]::DMA_TX_ID); spi.cr2.write(|w| w.txdmaen().enabled().frxth().quarter()); Self { spi, sck: pins.0, miso: (pins.1, dma), mosi: NoMosi::new(), } } } } }; } impl_new_miso_simplex_dma!(1); impl_new_miso_simplex_dma!(2); impl Spi3<SgMiso, SgMosi> { pub(crate) fn new(spi: pac::SPI3, div: BaudRate, rcc: &mut pac::RCC) -> Self { Self::enable_clock(rcc); unsafe { Self::pulse_reset(rcc) }; spi.cr1.write(|w| { w.ssi().set_bit(); w.ssm().set_bit(); w.spe().set_bit(); w.br().bits(div as u8); w.mstr().set_bit(); // hard coded because we know the SPI mode of the radio w.cpol().idle_low(); w.cpha().first_edge() }); spi.cr2.write(|w| w.frxth().quarter()); Self { spi, mosi: SgMosi::new(), miso: SgMiso::new(), } } pub(crate) unsafe fn steal() -> Self { Self { spi: pac::Peripherals::steal().SPI3, mosi: SgMosi::new(), miso: SgMiso::new(), } } } impl<MISO, MOSI> Spi3<MISO, MOSI> { pub(crate) fn free(self) -> (pac::SPI3, MISO, MOSI) { (self.spi, self.miso, self.mosi) } } impl<MISODMA: DmaCh, MOSIDMA: DmaCh> Spi3<MISODMA, MOSIDMA> { pub(crate) fn new_with_dma( spi: pac::SPI3, mut miso_dma: MISODMA, mut mosi_dma: MOSIDMA, div: BaudRate, rcc: &mut pac::RCC, ) -> Self { Self::enable_clock(rcc); unsafe { Self::pulse_reset(rcc) }; spi.cr1.write(|w| { w.ssi().set_bit(); w.ssm().set_bit(); w.spe().set_bit(); w.br().bits(div as u8); w.mstr().set_bit(); // hard coded because we know the SPI mode of the radio w.cpol().idle_low(); w.cpha().first_edge() }); mosi_dma.set_cr(dma::Cr::DISABLE); mosi_dma.clear_all_flags(); mosi_dma.set_periph_addr(pac::SPI3::DR as u32); mosi_dma.set_mux_cr_reqid(pac::SPI3::DMA_TX_ID); miso_dma.set_cr(dma::Cr::DISABLE); miso_dma.clear_all_flags(); miso_dma.set_periph_addr(pac::SPI3::DR as u32); miso_dma.set_mux_cr_reqid(pac::SPI3::DMA_RX_ID); spi.cr2 .write(|w| w.txdmaen().enabled().rxdmaen().enabled().frxth().quarter()); Self { spi, miso: miso_dma, mosi: mosi_dma, } } pub(crate) unsafe fn steal_with_dma(miso_dma: MISODMA, mosi_dma: MOSIDMA) -> Self { Self { spi: pac::Peripherals::steal().SPI3, miso: miso_dma, mosi: mosi_dma, } } } impl<SPI, SCK, MISO, MOSI> Spi<SPI, SCK, MISO, MOSI> { /// Free the SPI peripheral, pins, and DMA channel(s) from the driver. /// /// # Example /// /// ```no_run /// use stm32wlxx_hal::{ /// dma::AllDma, /// gpio::PortA, /// pac, /// spi::{BaudRate::Div2, Spi, MODE_0}, /// }; /// /// let mut dp = pac::Peripherals::take().unwrap(); /// /// let dma = AllDma::split(dp.DMAMUX, dp.DMA1, dp.DMA2, &mut dp.RCC); /// let pa = PortA::split(dp.GPIOA, &mut dp.RCC); /// let spi = cortex_m::interrupt::free(|cs| { /// Spi::new_spi1_full_duplex_dma( /// dp.SPI1, /// (pa.a5, pa.a6, pa.a7), /// (dma.d1.c1, dma.d1.c2), /// MODE_0, /// Div2, /// &mut dp.RCC, /// cs, /// ) /// }); /// // .. use spi /// let (spi1, a5, (a6, d1c1), (a7, d1c2)) = spi.free(); /// ``` pub fn free(self) -> (SPI, SCK, MISO, MOSI) { (self.spi, self.sck, self.miso, self.mosi) } } impl<SPI: SpiRegs, SCK, MISO, MOSI> Spi<SPI, SCK, MISO, MOSI> { /// Read the SPI status register. #[inline] pub fn status(&self) -> pac::spi1::sr::R { self.spi.sr.read() } } impl<SPI: SpiRegs, SCK: SpiSck, MISO: SpiMiso, MISODMA: DmaCh> Write<u8> for Spi<SPI, SCK, (MISO, MISODMA), NoMosi> { type Error = Error; fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { self.spi.write_simplex_u8_dma(&mut self.miso.1, words) } } impl<SPI: SpiRegs, SCK: SpiSck, MOSI: SpiMosi, MOSIDMA: DmaCh> Write<u8> for Spi<SPI, SCK, NoMiso, (MOSI, MOSIDMA)> { type Error = Error; fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { self.spi.write_simplex_u8_dma(&mut self.mosi.1, words) } } impl<SPI: SpiRegs, SCK: SpiSck, MOSI: SpiMosi> Write<u8> for Spi<SPI, SCK, NoMiso, MOSI> { type Error = Error; fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { self.spi.write_simplex_u8(words) } } impl<SPI: SpiRegs, SCK: SpiSck, MISO: SpiMiso, MOSI: SpiMosi> Write<u8> for Spi<SPI, SCK, MISO, MOSI> { type Error = Error; fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { self.spi.write_full_duplex_u8(words) } } impl<SPI: SpiRegs, SCK: SpiSck, MISO: SpiMiso, MOSI: SpiMosi, MISODMA: DmaCh, MOSIDMA: DmaCh> Write<u8> for Spi<SPI, SCK, (MISO, MISODMA), (MOSI, MOSIDMA)> { type Error = Error; fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { self.spi .write_full_duplex_u8_dma(&mut self.miso.1, &mut self.mosi.1, words) } } impl<SPI: SpiRegs, SCK: SpiSck, MISO: SpiMiso, MOSI: SpiMosi> FullDuplex<u8> for Spi<SPI, SCK, MISO, MOSI> { type Error = Error; fn read(&mut self) -> nb::Result<u8, Self::Error> { self.spi.nb_read_u8() } fn send(&mut self, word: u8) -> nb::Result<(), Self::Error> { self.spi.nb_send_u8(word) } } impl<SPI: SpiRegs, SCK: SpiSck, MISO: SpiMiso, MOSI: SpiMosi> Transfer<u8> for Spi<SPI, SCK, MISO, MOSI> { type Error = Error; fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> { self.spi.transfer_u8(words) } } impl<SPI: SpiRegs, SCK: SpiSck, MISO: SpiMiso, MOSI: SpiMosi, MISODMA: DmaCh, MOSIDMA: DmaCh> Transfer<u8> for Spi<SPI, SCK, (MISO, MISODMA), (MOSI, MOSIDMA)> { type Error = Error; fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> { self.spi .transfer_u8_dma(&mut self.miso.1, &mut self.mosi.1, words) } } // sub-GHz SPI traits impl Transfer<u8> for Spi3<SgMiso, SgMosi> { type Error = Error; fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> { self.spi.transfer_u8(words) } } impl<MISODMA: DmaCh, MOSIDMA: DmaCh> Transfer<u8> for Spi3<MISODMA, MOSIDMA> { type Error = Error; fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> { self.spi .transfer_u8_dma(&mut self.miso, &mut self.mosi, words) } } impl Write<u8> for Spi3<SgMiso, SgMosi> { type Error = Error; fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { self.spi.write_full_duplex_u8(words) } } impl<MISODMA: DmaCh, MOSIDMA: DmaCh> Write<u8> for Spi3<MISODMA, MOSIDMA> { type Error = Error; fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { self.spi .write_full_duplex_u8_dma(&mut self.miso, &mut self.mosi, words) } }
32.551065
106
0.443817
7563b4f06e957bc88f60d2c512bc8bd1a987ff63
2,878
css
CSS
assets/history/history.css
KawaiiShadowii/maribelhearn.com
904e314432588b3210177eec412a452e02bf98c2
[ "MIT" ]
null
null
null
assets/history/history.css
KawaiiShadowii/maribelhearn.com
904e314432588b3210177eec412a452e02bf98c2
[ "MIT" ]
null
null
null
assets/history/history.css
KawaiiShadowii/maribelhearn.com
904e314432588b3210177eec412a452e02bf98c2
[ "MIT" ]
null
null
null
table { margin-left: auto; margin-right: auto; } table, tr, th, td { border: 1px solid black; text-align: center; } caption { margin-bottom: 10px; } div > div > p { margin: 4px; } .hidden { border: none; text-align: left; } .separator { margin-top: 16px; } .border { border: 1px solid black; margin-bottom: 15px; } .list { width: 250px; } .overview { width: 80px; } .legend { margin: 0px; } .attempted { background-color: orange; } .clear { background-color: green; } .nm { background-color: brown; } .nb { background-color: blue; } .nmnb { background-color: purple; } .attempted_text { color: orange; } .clear_text { color: green; } .nm_text { color: brown; } .nb_text { color: blue; } .nmnb_text { color: purple; } .g { color: green; font-weight: bold; } .y { background-color: green; color: white; } .r { background-color: red; } .v { font-weight: bold; } .i { color: white; } .calendar-box { display: none; background-color: #fff; border: 1px solid #444; position: absolute; width: 300px; padding: 0 5px; } .calendar-box select.calendar-month { width: 90px; } .calendar-box select.calendar-year { width: 70px; } .calendar-box .calendar-cancel { width: 100%; } .calendar-box table td { width: 14%; } .calendar-box .calendar-title { text-align: center; } .calendar-box a { text-decoration: none; } .calendar-box .today a { padding: 0 5px; margin-left: -5px; background-color: #ffe9c6; } .calendar-box .selected a { padding: 0 5px; margin-left: -5px; background-color: #c9ff8b; } .tooltip { visibility: hidden; background-color: black; color: #fff; text-align: center; border-radius: 6px; padding: 5px; position: absolute; z-index: 1; top: 100%; } .dropdown_content > p { margin: 4px; } .dropdown_content:hover .dropdown_content { display: block; } .wrap { border: 1px solid black; text-align: center; margin-left: 25%; margin-right: 25%; font: 14px verdana, sans-serif; } #wrap { padding-left: 15px; padding-right: 15px; padding-bottom: 10px; opacity: 0.8; } #wrap > div:not(#topbar):not(#overview) { display: inline-block; } #nav { margin-bottom: 5px; } #contents td, #contents th, #contents tr { border: none; } #notice { display: none; } #routes { margin-top: 15px; } @media only screen and (min-width: 1100px) and (max-width: 1400px) { .wrap { margin-left: 15%; margin-right: 15%; } } @media only screen and (min-width: 800px) and (max-width: 1100px) { h1, h2 { clear: both; } .wrap { margin-left: 13%; margin-right: 13%; } } @media only screen and (max-width: 800px) { h1, h2 { clear: both; } }
15.726776
68
0.589646
b0878be9e684e61d99a80d32086d7c4ecf7e7fa0
1,076
py
Python
gtsfm/feature_extractor.py
swershrimpy/gtsfm
8d301eb3ef9172345a1ac1369fd4e19764d28946
[ "Apache-2.0" ]
122
2021-02-07T23:01:58.000Z
2022-03-30T13:10:35.000Z
gtsfm/feature_extractor.py
swershrimpy/gtsfm
8d301eb3ef9172345a1ac1369fd4e19764d28946
[ "Apache-2.0" ]
273
2021-01-30T16:45:26.000Z
2022-03-16T15:02:33.000Z
gtsfm/feature_extractor.py
swershrimpy/gtsfm
8d301eb3ef9172345a1ac1369fd4e19764d28946
[ "Apache-2.0" ]
13
2021-03-12T03:01:27.000Z
2022-03-11T03:16:54.000Z
"""Extracts features and their descriptors from a single image. Authors: Ayush Baid, John Lambert """ from typing import Tuple from dask.delayed import Delayed from gtsfm.frontend.detector_descriptor.detector_descriptor_base import DetectorDescriptorBase class FeatureExtractor: """Wrapper for running detection and description on each image.""" def __init__(self, detector_descriptor: DetectorDescriptorBase) -> None: """Initializes the detector-descriptor Args: detector_descriptor: the joint detector-descriptor to use. """ self.detector_descriptor = detector_descriptor def create_computation_graph(self, image_graph: Delayed) -> Tuple[Delayed, Delayed]: """Given an image, create detection and descriptor generation tasks Args: image_graph: image wrapped up in Delayed Returns: Delayed object for detected keypoints. Delayed object for corr. descriptors. """ return self.detector_descriptor.create_computation_graph(image_graph)
31.647059
94
0.716543
38809efa0a5f9e9a257a446845860562c5b7e21c
1,088
php
PHP
nav.php
kduddy/tslown
db4992dcbb07604313ed15433a58a2c639fe67a1
[ "FSFAP" ]
null
null
null
nav.php
kduddy/tslown
db4992dcbb07604313ed15433a58a2c639fe67a1
[ "FSFAP" ]
null
null
null
nav.php
kduddy/tslown
db4992dcbb07604313ed15433a58a2c639fe67a1
[ "FSFAP" ]
null
null
null
<div id="nav"> <ul> <li><a href="index.php">home</a></li> <li><a href="aboutbook.php">about the book</a></li> <li><a href="thesecretlife.php" class="secret-link">inside the<br/>secret life</a></li> <li><a href="bio.php">biography</a></li> <li><a href="programs.php">programs</a></li> <ul> <li><a href="programs-greyg.php">grey gardens</a></li> <li><a href="programs-lloud.php">lance loud!</a></li> <li><a href="programs-familytv.php">the family on tv</a></li> </ul> <li><a href="amfam.php">an american family</a></li> <li><a href="buybook.php">buy the secret life</a></li> <li><a href="publicity.php">publicity</a></li> <li><a href="merch.php">merchandise</a></li> <li><a href="fshow.php" class="fshow">the secret life<br/>fashion show<br/>extrahvahgahnza</a></li> <li><a href="praise.php" class="praise-link">praise for<br/><span class="italic">the secret life of<br/>walter newkirk</span></a></li> <li><a href="video.php">video!</a></li> <li class="last-nav"><a href="mailto:newkirkpr@aol.com">contact</a></li> </ul> </div><!-- #nav -->
37.517241
136
0.621324
c8b95534cc9d9e771b7e3464c8077e833a278a4b
4,233
ps1
PowerShell
VMShutdown.ps1
askew/runbooks
c12233c8f731cbb4fa2ac2c8b62c7276a171c5d2
[ "MIT" ]
null
null
null
VMShutdown.ps1
askew/runbooks
c12233c8f731cbb4fa2ac2c8b62c7276a171c5d2
[ "MIT" ]
null
null
null
VMShutdown.ps1
askew/runbooks
c12233c8f731cbb4fa2ac2c8b62c7276a171c5d2
[ "MIT" ]
null
null
null
<# .SYNOPSIS This Azure Automation runbook automates the shutdown of virtual machines .DESCRIPTION .PARAMETER connectionName The name of an AzureServicePrincipal connection configureed in the automation assets that has contributor access to subscriptions. .INPUTS None. .OUTPUTS #> param( [parameter(Mandatory=$false)] [String] $connectionName = "AzureRunAsConnection" ) $VERSION = "0.1" # Checks the shutDownAt string to see if the this pime has passed today. # shutDownAt can be a time value, or list of days of the week and optionally a time value. function ShouldShutdownNow ([string]$scheduleText) { # Initialize variables $d = [DateTime]::MinValue $weekDays = [DayOfWeek].GetEnumValues() if (![DateTime]::TryParse($scheduleText, [ref]$d)) { # Break up the text by space $parts = $scheduleText.Split(' ', [StringSplitOptions]::RemoveEmptyEntries) # Do we have a list of days of the week? $days = @($weekDays | ? { $_ -in $parts }) if ($days -contains [DateTime]::Today.DayOfWeek) { # list of stings that are not days of the week. One of them should resolve to a time of day. $notDays = @($parts | ? { $_ -notin $weekDays }) # today is in the list of names. $time = $notDays | ? { [DateTime]::TryParse($_, [ref]$d) } | % { [DateTime]::Parse($_).TimeOfDay } | select -First 1 $d = [DateTime]::Today + $time } } # Check if current time falls within range return ($d -ne ([DateTime]::MinValue) -and $d.Date -eq ([DateTime]::Today) -and $d -lt [DateTime]::UtcNow) } try { $startTime = [DateTime]::UtcNow $spConnection = Get-AutomationConnection -Name $connectionName $azCtx = Add-AzureRmAccount -ServicePrincipal ` -TenantId $spConnection.TenantId ` -ApplicationId $spConnection.ApplicationId ` -SubscriptionId $spConnection.SubscriptionId ` -CertificateThumbprint $spConnection.CertificateThumbprint $subs = @(Get-AzureRmSubscription -TenantId $azCtx.Context.Tenant.TenantId | ? State -EQ 'Enabled') foreach($sub in $subs) { Write-Output "Looking at subscription `"$($sub.SubscriptionName)`"" $azCtx = $sub | Set-AzureRmContext Write-Output "Looking for VMs with 'shutDownAt' tag." # Get a list of VMs with the 'shutDownAt' tag value. $vms = @(Find-AzureRmResource -ResourceType 'Microsoft.Compute/virtualMachines' | % { $tags = $_.Tags; $_} | select ResourceGroupName, ResourceName, @{ Name='ShutDownAt'; Expression={$tags['shutDownAt']} }) Write-Output "Checking resource group for 'shutDownAt' tag." # Add the 'shutDownAt' tag value from the resource group, if not set on the resource $vms = @($vms | % { $rgTags = (Get-AzureRmResourceGroup -Name $_.ResourceGroupName).Tags; $_ } | select ResourceGroupName, ResourceName, @{ Name='ShutDownAt'; Expression={if ($_.ShutDownAt) {$_.ShutDownAt} else {$rgTags['shutDownAt']}} }) Write-Output "Checking VM power state" # Get the power state for each of these VM's $vms = @($vms | % { $status = Get-AzureRmVM -Status -ResourceGroupName $_.ResourceGroupName -Name $_.ResourceName; $_ } | select ResourceGroupName, ResourceName, ShutDownAt, @{ Name='PowerState'; Expression={($status.Statuses | ? Code -Like 'PowerState/*').Code.Split('/')[1] }}) Write-Output $vms foreach ($vm in $vms | ? { (ShouldShutdownNow -scheduleText $_.ShutDownAt) -and $_.PowerState -notin 'deallocated','deallocating' }) { Write-Output "Stopping VM `"$($vm.ResourceName)`"" Stop-AzureRmVM -ResourceGroupName $vm.ResourceGroupName -Name $vm.ResourceName -Force } } } catch { $errorMessage = $_.Exception.Message throw "Unexpected exception: $errorMessage" } finally { Write-Output "Runbook finished (Duration: $(("{0:hh\:mm\:ss}" -f (([DateTime]::UtcNow) - $startTime))))" }
40.701923
288
0.617529
93bda810846225ddb0fbe3b4e099042b27555c6d
697
cs
C#
Bill.Management/Program.cs
DaniilMonin/levelup_160321
d65d48195a33bc259a81ea289acaa4c0c8b9a2e4
[ "MIT" ]
null
null
null
Bill.Management/Program.cs
DaniilMonin/levelup_160321
d65d48195a33bc259a81ea289acaa4c0c8b9a2e4
[ "MIT" ]
null
null
null
Bill.Management/Program.cs
DaniilMonin/levelup_160321
d65d48195a33bc259a81ea289acaa4c0c8b9a2e4
[ "MIT" ]
1
2021-05-03T18:06:12.000Z
2021-05-03T18:06:12.000Z
using System; using System.Collections.Generic; using System.Threading.Tasks; using Bill.Management.Abstractions; using Bill.Management.Rest.Service.Client; using Bill.Management.Rest.Service.Client.Connection; using BillManagement.Core.Abstractions.Data.Results; using BillManagement.Imlementations.Data; namespace Bill.Management { class Program { static async Task Main(string[] args) { Console.WriteLine("Hello World!"); IBillManagementClient client = ClientFactory.Create("http://localhost:58755"); IOperationResult<IReadOnlyList<User>> usersList = await client.GetClients(); Console.ReadLine(); } } }
25.814815
90
0.707317
c69702905dd18e363497f22c50dd71a10a0c465e
816
py
Python
server/pythonCode/DataGenerator.py
varsheshjp/game
2a47f2099aa0538301815272f749c63aa11e6ce1
[ "MIT" ]
null
null
null
server/pythonCode/DataGenerator.py
varsheshjp/game
2a47f2099aa0538301815272f749c63aa11e6ce1
[ "MIT" ]
null
null
null
server/pythonCode/DataGenerator.py
varsheshjp/game
2a47f2099aa0538301815272f749c63aa11e6ce1
[ "MIT" ]
null
null
null
import math from matplotlib import pyplot as plt import numpy as np listx=[] listy=[] listz=[] listw=[] phi=(1+5**(1/2))/2 def function(x): y=(phi**x)-(phi) return y def function2(x): return (function4(x-1)*(phi**x))-(function4(x-2)*phi**(x-2)) def function4(x): return ((phi**i)-(-1*(phi-1))**i)/(5**(1/2)) x=float(input("last n")) i=0 while i<x: listx.append(i) listy.append(function(i)) listz.append(function2(i)) listw.append(function4(i)) i=i+0.1 listx=np.array(listx) listy=np.array(listy) listz=np.array(listz) listw=np.array(listw) listz=(listy+phi)*math.log(phi) plt.plot( listx,listy, color='skyblue') plt.plot( listx,listz, color='black') plt.plot( listx,listw, color='red') #plt.plot(listx,,color="pink") plt.legend() plt.show()
22.054054
65
0.618873
ef4de950371fe25e225c4f2254425581d3454a8f
136
php
PHP
resources/views/pages/Impressum.blade.php
lorodialog/LoroDialog.com
7d8d794c5648c51ef893c61d745e021fe2a09793
[ "MIT" ]
null
null
null
resources/views/pages/Impressum.blade.php
lorodialog/LoroDialog.com
7d8d794c5648c51ef893c61d745e021fe2a09793
[ "MIT" ]
null
null
null
resources/views/pages/Impressum.blade.php
lorodialog/LoroDialog.com
7d8d794c5648c51ef893c61d745e021fe2a09793
[ "MIT" ]
null
null
null
@extends('LoroTemplate') @section('titel', 'LoroDialog | Impressum') @section('inhalt') @include('sections.Impressum') @endsection
19.428571
43
0.713235
efbdc8693702889519417eb76b01f373ee3ef81a
604
rs
Rust
examples/marker_traits.rs
DuckLogic/thin_trait_object-zerogc
9ad8402921a6be76dc8314f52b03ebec153b9ce6
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
19
2021-02-22T00:57:20.000Z
2022-03-29T13:46:21.000Z
examples/marker_traits.rs
DuckLogic/thin_trait_object-zerogc
9ad8402921a6be76dc8314f52b03ebec153b9ce6
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
6
2021-04-11T19:19:10.000Z
2022-02-05T21:13:33.000Z
examples/marker_traits.rs
DuckLogic/thin_trait_object-zerogc
9ad8402921a6be76dc8314f52b03ebec153b9ce6
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
5
2021-04-11T17:43:42.000Z
2022-02-04T12:32:39.000Z
use thin_trait_object::*; #[thin_trait_object( marker_traits( SafeMarker, // `unsafe` keyword here ensures that "unsafe code" is required // to produce UB by implementing the trait unsafe UnsafeMarker, ) )] trait Foo: SafeMarker + UnsafeMarker { fn fooify(&self); } trait SafeMarker {} unsafe trait UnsafeMarker {} impl Foo for String { fn fooify(&self) { println!("Fooified a string: {}", self); } } impl SafeMarker for String {} unsafe impl UnsafeMarker for String {} fn main() { BoxedFoo::new("Hello World!".to_string()).fooify(); }
20.827586
71
0.64404
b9f993072f6f48d71d130d1a856d25e948c5b8d2
5,990
dart
Dart
packages/hknews_repository/lib/src/repositories/stories.dart
thuongleit/MinimalistHackerNews
da51618bcec2c4dc52c79020a455f2e75b187ecd
[ "Apache-2.0" ]
null
null
null
packages/hknews_repository/lib/src/repositories/stories.dart
thuongleit/MinimalistHackerNews
da51618bcec2c4dc52c79020a455f2e75b187ecd
[ "Apache-2.0" ]
26
2020-12-11T13:26:19.000Z
2021-01-08T14:12:15.000Z
packages/hknews_repository/lib/src/repositories/stories.dart
thuongleit/MinimalistHackerNews
da51618bcec2c4dc52c79020a455f2e75b187ecd
[ "Apache-2.0" ]
null
null
null
import 'package:hackernews_api/hackernews_api.dart'; import 'package:hknews_database/hknews_database.dart'; import 'package:meta/meta.dart'; import '../mapping/model_and_entity_mapping.dart'; import '../../src/utils/pair.dart'; import '../../src/utils/web_analyzer.dart'; import '../result.dart'; /// Repository that holds stories information of Hacker News abstract class StoriesRepository { Future<List<int>> getItemIds(StoryType type); Item getCachedItem(int itemId); Future<Item> getItem( int itemId, { bool requestContent = false, bool refresh = false, }); Future<Result> save(Item item); Future<void> saveAsDraft(Item item); Future<Result> unsave(Item item); Future<List<Item>> getSavedItems(); Future<Result> updateVisited(Item item); Stream<Item> getComments(Item parent); } class StoriesRepositoryImpl extends StoriesRepository { final StoryDao _localSource; final HackerNewsApiClient _apiClient; StoriesRepositoryImpl({ StoryDao localSource, HackerNewsApiClient apiClient, }) : this._localSource = localSource ?? StoryDao(), this._apiClient = apiClient ?? HackerNewsApiClientImpl(); Map<int, Pair<Item, bool>> _itemsCache = Map(); //Map<story_id, Pair(Story, is_up_to_date)> //FIXME: Remove this logic when introduce local database Set<int> _localItemIds = Set(); @override Future<List<int>> getItemIds(StoryType type) async { if (type == null) { return const []; } return _apiClient.getItemIds(type); } @override Item getCachedItem(int itemId) => _itemsCache[itemId]?.first; @override Future<Item> getItem( int itemId, { bool requestContent = false, bool refresh = false, }) async { Item item = getCachedItem(itemId); //if item is local draft, don't request a copy from server if (!_isDraft(item) && (refresh || item == null)) { item = await _apiClient.getItem(itemId); } if (item == null) { return null; } if (requestContent && (item.text?.isEmpty ?? true)) { final content = await _getContent(url: item.url); item = item.copyWith(text: content); } //put local draft item into the item list to display it to user immediately //because Hacker News server take time (some seconds) to process request (e.g. a posted comment) and show the request in the API //i.e. request API doesn't show the item immediately after posting if (_localItemIds.isNotEmpty) { final localKidIds = _getKidsOfParent( parent: item, kids: _localItemIds.map((id) => _itemsCache[id].first).toList(), ).map((kid) => kid.id).toList(); if (localKidIds.isNotEmpty) { final kids = Set<int>.from(item.kids)..addAll(localKidIds); item = item.copyWith( kids: kids.toList(), descendants: kids.length, ); } } _itemsCache[item.id] = Pair(item, true); return item; } bool _isDraft(Item item) => _localItemIds.contains(item?.id); List<Item> _getKidsOfParent({Item parent, List<Item> kids}) { assert(parent != null); assert(kids != null); return kids .map((item) { if (item.parent == parent.id) { return item; } }) .where((item) => item != null) .toList(); } @override Future<Result> save(Item item) async { final copiedStory = item.copyWith(updatedAt: DateTime.now().millisecondsSinceEpoch); final success = await _localSource.insertOrReplace(copiedStory.toEntity()); return (success) ? Result.success() : Result.failure(); } @override Future<void> saveAsDraft(Item item) { _localItemIds.add(item.id); _itemsCache[item.id] = Pair(item, true); return null; } @override Future<Result> unsave(Item item) async { final success = await _localSource.deleteStory(item.id); return (success) ? Result.success() : Result.failure(); } @override Future<List<Item>> getSavedItems() async { // Try to load the data from database try { final itemsInDb = await _localSource.getItems(); return await Future.wait( itemsInDb.map((element) async { // final itemModel = itemEntity.toModel(); final latestItem = await _apiClient.getItem(element.id); _itemsCache[latestItem.id] = Pair(latestItem, true); return latestItem; }).toList(), ); } on Exception catch (e) { throw e; } } @override Future<Result> updateVisited(Item item) async { var isUpdated = await _localSource.updateVisitStory(item.id); if (isUpdated) { final copiedItem = item.copyWith(visited: true); _itemsCache[copiedItem.id] = Pair(copiedItem, true); } return (isUpdated) ? Result.success() : Result.failure(); } @override Stream<Item> getComments(Item parent) async* { if (parent.kids.isEmpty) return; for (int kidId in parent.kids) { Item kid = await getItem(kidId); if (kid == null) continue; final copiedKid = kid.copyWith(depth: parent.depth + 1); _itemsCache[copiedKid.id] = Pair(copiedKid, true); //remove draft item if there is a version from server if (!_isDraft(copiedKid)) { _localItemIds.removeWhere((draftKidId) { final draftItem = _itemsCache[draftKidId]?.first; if (draftItem != null) { if (draftItem.by == copiedKid.by && draftItem.text == copiedKid.text) { _itemsCache[draftKidId] = null; print('removed $kidId'); return true; } } return false; }); } yield copiedKid; } } Future<String> _getContent({@required String url}) async { if (url?.isEmpty == true) { return ''; } final info = await WebAnalyzer.getInfo(url, multimedia: false); if (info != null && info is WebInfo) { return info.description; } return ''; } }
27.990654
132
0.635225
e07f1daaeba80a304ae1ab66a2294fb958462cdc
327
h
C
ZenUnitLibraryTests/Components/Args/MetalMock/TestNameFilterMock.h
NeilJustice/ZenUnit
6ddbe157e4652ac76aa074a70f9f83e34ee779df
[ "MIT" ]
2
2018-04-21T06:38:53.000Z
2018-08-31T00:56:21.000Z
ZenUnitLibraryTests/Components/Args/MetalMock/TestNameFilterMock.h
NeilJustice/ZenUnitAndZenMock
bbcb4221d063fa04e4ef3a98143e0f123e3af8d5
[ "MIT" ]
1
2021-03-03T07:19:16.000Z
2021-03-28T21:46:32.000Z
ZenUnitLibraryTests/Components/Args/MetalMock/TestNameFilterMock.h
NeilJustice/ZenUnitAndZenMock
bbcb4221d063fa04e4ef3a98143e0f123e3af8d5
[ "MIT" ]
null
null
null
#pragma once class TestNameFilterMock : public Metal::Mock<TestNameFilter> { public: METALMOCK_NONVOID1_CONST(bool, MatchesTestName, std::string_view) METALMOCK_NONVOID1_CONST(bool, MatchesTestClassName, std::string_view) METALMOCK_NONVOID3_CONST(bool, MatchesTestCase, std::string_view, std::string_view, size_t) };
32.7
94
0.807339
f49b1bfdb5a754d81acbb2885f69a3bc1eb1cba2
561
ts
TypeScript
tools/generators/rester/index.ts
DevinDon/rester
27f046edaf0c156ffd0744678414ae29aed5596b
[ "MIT" ]
1
2019-06-28T19:29:14.000Z
2019-06-28T19:29:14.000Z
tools/generators/rester/index.ts
DevinDon/rester
27f046edaf0c156ffd0744678414ae29aed5596b
[ "MIT" ]
99
2019-06-12T14:55:55.000Z
2022-01-01T14:10:45.000Z
tools/generators/rester/index.ts
DevinDon/rester
27f046edaf0c156ffd0744678414ae29aed5596b
[ "MIT" ]
1
2019-05-17T02:23:41.000Z
2019-05-17T02:23:41.000Z
import { logger, Tree } from '@nrwl/devkit'; import { $ } from 'zx'; import { generatePrismaClients } from '../prisma'; export type ResterSchema = { action: string; app: string; }; export default async (tree: Tree, { action, app }: ResterSchema) => { switch (action) { case 'g': case 'generate': await $`nx generate @rester/nx:application --name=${app}`; await generatePrismaClients(tree, [app]); break; default: logger.info(`NX Avaliable commands: \n- ${['generate, alias "g"'].join('\n- ')}`); break; } };
24.391304
88
0.602496
e092406db0922bb6f22bfb1fe9baaec2624f548f
5,860
dart
Dart
StudyWatch_SDK_healthwearableApp/Source/lib/main.dart
analogdevicesinc/ApplicationsWaveTool
0c1f236dd0745caa3187841ee1a882f209ac3ebe
[ "Apache-2.0" ]
2
2019-03-11T15:24:51.000Z
2022-03-07T09:42:05.000Z
StudyWatch_SDK_healthwearableApp/Source/lib/main.dart
analogdevicesinc/ApplicationsWaveTool
0c1f236dd0745caa3187841ee1a882f209ac3ebe
[ "Apache-2.0" ]
null
null
null
StudyWatch_SDK_healthwearableApp/Source/lib/main.dart
analogdevicesinc/ApplicationsWaveTool
0c1f236dd0745caa3187841ee1a882f209ac3ebe
[ "Apache-2.0" ]
1
2021-03-16T08:26:05.000Z
2021-03-16T08:26:05.000Z
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:responsive_framework/responsive_framework.dart'; import 'package:vsm/services/network/communication_service.dart'; import 'package:vsm/services/sdk_lib/sdk_service.dart'; import 'package:vsm/services/service_locator.dart'; import 'package:vsm/user_interface/views/chart_view.dart'; import 'package:vsm/user_interface/views/dashboard_view.dart'; import 'package:curved_navigation_bar/curved_navigation_bar.dart'; import 'package:vsm/user_interface/views/logging_view.dart'; import 'package:vsm/user_interface/views/main_view.dart'; import 'package:vsm/user_interface/views/settings_view.dart'; import 'package:vsm/user_interface/views/theme/app_theme.dart'; import 'package:vsm/user_interface/views/theme/theme_provider.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:vsm/user_interface/widgets/app_retain_widget.dart'; import 'business_logic/view_model/main_viewmodel.dart'; const bool kReleaseMode = true; void main() { setupServiceLocator(); runApp(StarterApp()); // DevicePreview( // enabled: !kReleaseMode, // plugins: [ // const ScreenshotPlugin(), // ], // builder: (context) => StarterApp(), // ), } class StarterApp extends StatefulWidget { const StarterApp(); @override _StarterAppState createState() => _StarterAppState(); } class _StarterAppState extends State<StarterApp> { ThemeProvider themeProvider = ThemeProvider(); Widget responsiveFrameworkSetup(BuildContext context, Widget child) { child = ResponsiveWrapper.builder( BouncingScrollWrapper.builder(context, child), maxWidth: 1200, minWidth: 450, defaultScale: true, breakpoints: [ ResponsiveBreakpoint.resize(450, name: MOBILE), ResponsiveBreakpoint.autoScale(800, name: TABLET), ResponsiveBreakpoint.autoScale(1000, name: TABLET), ResponsiveBreakpoint.resize(1200, name: DESKTOP), ResponsiveBreakpoint.autoScale(2460, name: "4K"), ], background: Container(color: Color(0xFFF5F5F5)), ); return child; } @override void initState() { super.initState(); getCurrentAppTheme(); } void getCurrentAppTheme() async { themeProvider.isDarkThemeEnabled = await themeProvider.darkThemePreference.getTheme(); } @override Widget build(BuildContext context) { return ChangeNotifierProvider<ThemeProvider>( create: (context) => themeProvider, child: Consumer<ThemeProvider>(builder: (context, themeProvider, child) { return MaterialApp( builder: EasyLoading.init(builder: responsiveFrameworkSetup), navigatorObservers: [BotToastNavigatorObserver()], theme: AppTheme.lightTheme, darkTheme: AppTheme.darkTheme, themeMode: themeProvider.isDarkThemeEnabled ? ThemeMode.dark : ThemeMode.light, home: AppRetainWidget( child: MainView(), ), debugShowCheckedModeBanner: false, ); }), ); } } class AppNavigator extends StatefulWidget { @override _AppNavigatorState createState() => _AppNavigatorState(); } class _AppNavigatorState extends State<AppNavigator> { final SdkWrapperService _sdkService = serviceLocator<SdkWrapperService>(); final CommunicationService bledatainstance = serviceLocator<CommunicationService>(); int _currentIndex = 0; GlobalKey _bottomNavigationKey = GlobalKey(); final DashboardPortrait _dashboard = DashboardPortrait(); final ChartView _chartView = ChartView(); final LoggingView _loggingView = LoggingView(); final SettingsView _settingView = SettingsView(); Widget _showPage; @override void initState() { super.initState(); print('Homepage init'); EasyLoading.show( status: 'Initializing...', maskType: EasyLoadingMaskType.black, ); EasyLoading.addStatusCallback((status) { print('EasyLoading Status $status'); }); _showPage = _dashboard; _sdkService.initializeGen3SDK(); } @override void deactivate() { print('Homepage deactivate'); super.deactivate(); } @override void dispose() { super.dispose(); } Widget switchPage(int pageIndex) { switch (pageIndex) { case 0: return _dashboard; case 1: return _chartView; case 2: return _loggingView; case 3: return _settingView; default: return Text('wrong index received'); } } @override Widget build(BuildContext context) { print('On build'); var colorScheme = Theme.of(context).colorScheme; return Consumer<MainViewModel>( builder: (context, _mainViewModel, child) => Scaffold( bottomNavigationBar: CurvedNavigationBar( key: _bottomNavigationKey, index: _currentIndex, height: 50.0, items: <Widget>[ Icon(Icons.dashboard, size: 30, color: Colors.white), Icon(Icons.stacked_line_chart, size: 30, color: Colors.white), Icon(Icons.insert_drive_file, size: 30, color: Colors.white), Icon(Icons.settings, size: 30, color: Colors.white), ], color: colorScheme.primary, buttonBackgroundColor: colorScheme.primary, backgroundColor: colorScheme.surface, animationCurve: Curves.easeInOut, animationDuration: Duration(milliseconds: 600), onTap: (tappedIndex) { setState(() { _showPage = switchPage(tappedIndex); }); }, ), body: Container( color: colorScheme.primary, child: Center( child: _showPage, ), ), ), ); } }
30.051282
79
0.677474
8c13a9a786c5a98420eb3fa143bc45a871292608
187
cs
C#
src/UniQode.Entities/Enums/AdminAction.cs
uniQodeAB/uniqode-web
651f866976ace9fe1527e476b41115f60bbc8fa2
[ "MIT" ]
null
null
null
src/UniQode.Entities/Enums/AdminAction.cs
uniQodeAB/uniqode-web
651f866976ace9fe1527e476b41115f60bbc8fa2
[ "MIT" ]
12
2016-04-02T18:37:26.000Z
2016-04-03T19:32:53.000Z
src/UniQode.Entities/Enums/AdminAction.cs
uniQodeAB/uniqode-web
651f866976ace9fe1527e476b41115f60bbc8fa2
[ "MIT" ]
null
null
null
namespace UniQode.Entities.Enums { public enum AdminAction { None = 0, Add, Save, Update, Delete, Preview, Publish } }
14.384615
33
0.470588
cdbdf15328c78e73ea5aa1267fb8b25cd7821c72
3,676
cs
C#
BrotliSharpLib/Detect.cs
facebamm/BrotliSharpLib
c070999692e36a28889131953ac08b2e3ba180ea
[ "MIT" ]
74
2017-06-03T14:13:44.000Z
2022-01-20T19:17:16.000Z
BrotliSharpLib/Detect.cs
facebamm/BrotliSharpLib
c070999692e36a28889131953ac08b2e3ba180ea
[ "MIT" ]
13
2017-10-06T13:20:42.000Z
2021-11-10T17:20:56.000Z
BrotliSharpLib/Detect.cs
facebamm/BrotliSharpLib
c070999692e36a28889131953ac08b2e3ba180ea
[ "MIT" ]
14
2018-04-09T20:31:38.000Z
2021-11-30T09:17:31.000Z
using System; using System.Runtime.InteropServices; namespace BrotliSharpLib { public static partial class Brotli { #if PROPER_DETECT [StructLayout(LayoutKind.Sequential)] private struct SYSTEM_INFO { public ushort wProcessorArchitecture; public ushort wReserved; public uint dwPageSize; public IntPtr lpMinimumApplicationAddress; public IntPtr lpMaximumApplicationAddress; public IntPtr dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public ushort wProcessorLevel; public ushort wProcessorRevision; } [DllImport("kernel32.dll")] private static extern void GetNativeSystemInfo(out SYSTEM_INFO info); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] private struct utsname { [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string sysname; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string nodename; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string release; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string version; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 65)] public string machine; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)] private byte[] padding; } [DllImport("libc")] private static extern int uname(out utsname buf); #endif private enum Endianess { Little, Big, Unknown } /// <summary> /// Detects the endianness of the current CPU /// </summary> private static unsafe Endianess GetEndianess() { uint value = 0xaabbccdd; byte* b = (byte*)&value; if (b[0] == 0xdd) return Endianess.Little; if (b[0] == 0xaa) return Endianess.Big; return Endianess.Unknown; } /// <summary> /// Determines if the current CPU supports unaligned reads /// </summary> private static bool IsWhitelistedCPU() { #if PROPER_DETECT // Detect the current CPU architecture to enable unaligned reads switch (Environment.OSVersion.Platform) { // Unix case PlatformID.MacOSX: case PlatformID.Unix: case (PlatformID) 128: utsname buf; if (uname(out buf) == 0) { switch (buf.machine) { case "i386": case "i686": case "x86_64": case "arm": case "armv7l": case "aarch64": return true; } } break; // Windows NT case PlatformID.Win32NT: SYSTEM_INFO info; GetNativeSystemInfo(out info); switch (info.wProcessorArchitecture) { case 0: // Intel (x86) case 5: // ARM case 9: // AMD64 (x64) return true; } break; } return false; #else return true; #endif } } }
34.35514
77
0.505169
e29d03d30e7ba6678ef5d0b296e49908138341d2
3,002
py
Python
backend/app/services/authentication.py
huggingface/collaborative-training-auth
aae4ee030002610949ee72f65345a8d1746fcd30
[ "Apache-2.0" ]
4
2021-06-25T15:08:44.000Z
2022-02-15T15:19:11.000Z
backend/app/services/authentication.py
huggingface/collaborative-training-auth
aae4ee030002610949ee72f65345a8d1746fcd30
[ "Apache-2.0" ]
1
2021-11-30T17:36:37.000Z
2021-11-30T17:36:37.000Z
backend/app/services/authentication.py
huggingface/collaborative-training-auth
aae4ee030002610949ee72f65345a8d1746fcd30
[ "Apache-2.0" ]
1
2021-09-23T03:15:51.000Z
2021-09-23T03:15:51.000Z
# # Copyright (c) 2021 the Hugging Face team. # # 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.# from enum import Enum from functools import partial from typing import List, Optional import requests from fastapi import Depends, HTTPException from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBase from pydantic import BaseModel from requests import ConnectionError, HTTPError from starlette.status import HTTP_401_UNAUTHORIZED HF_API = "https://huggingface.co/api" class RepoRole(Enum): read = 1 write = 2 admin = 3 class Organization(BaseModel): name: str role_in_org: RepoRole class MoonlandingUser(BaseModel): """Dataclass holding a user info""" username: str email: Optional[str] orgs: Optional[List[Organization]] UnauthenticatedError = partial( HTTPException, status_code=HTTP_401_UNAUTHORIZED, headers={"WWW-Authenticate": 'Bearer realm="Access to the API"'}, ) api_key = HTTPBase(scheme="bearer", auto_error=False) async def authenticate(credentials: Optional[HTTPAuthorizationCredentials] = Depends(api_key)) -> MoonlandingUser: if credentials is None: raise UnauthenticatedError(detail="Not authenticated") if credentials.scheme.lower() != "bearer": raise UnauthenticatedError(detail="Not authenticated") token = credentials.credentials try: user_identity = moonlanding_auth(token) except HTTPError as exc: if exc.response.status_code == 401: raise UnauthenticatedError(detail="Invalid credentials") else: raise UnauthenticatedError(detail="Error when authenticating") except ConnectionError: raise UnauthenticatedError(detail="Authentication backend could not be reached") username = user_identity["name"] email = user_identity["email"] if user_identity["type"] != "user": raise UnauthenticatedError(detail="Invalid credentials. You should use the credentials from a user.") orgs = [Organization(name=org["name"], role_in_org=RepoRole[org["roleInOrg"]]) for org in user_identity["orgs"]] return MoonlandingUser(username=username, email=email, orgs=orgs) def moonlanding_auth(token: str) -> dict: """Validate token with Moon Landing TODO: cache requests to avoid flooding Moon Landing """ auth_repsonse = requests.get(HF_API + "/whoami-v2", headers={"Authorization": f"Bearer {token}"}, timeout=3) auth_repsonse.raise_for_status() return auth_repsonse.json()
31.93617
116
0.734843
58c4854d9988c416254a79818b93035bba2d12dc
11,687
css
CSS
public/asset/kriyo/css/index.css
quocnv12/krioy
d654e27803f9abc92a1cb9522fa1f587fca7186b
[ "MIT" ]
1
2021-06-29T06:51:15.000Z
2021-06-29T06:51:15.000Z
public/asset/kriyo/css/index.css
quocnv12/krioy
d654e27803f9abc92a1cb9522fa1f587fca7186b
[ "MIT" ]
null
null
null
public/asset/kriyo/css/index.css
quocnv12/krioy
d654e27803f9abc92a1cb9522fa1f587fca7186b
[ "MIT" ]
null
null
null
*{ font-family: Arial; } #khanh:focus{ height: 95px; } #khanh{ height:0; } body#login{ background-color: #fff !important; } button:focus{ outline: none; } a{ text-decoration: none !impor tant; } .page-top-center{ min-height: 550px; } .login{ width: 100%; margin-top: 50px; border:2px solid #5363d6; border-radius: 5px; } .login-label{ background-color: #5363d6; padding: 10px 15px; width: 100%; } .login-label p{ font-weight: bold; color: #fff; font-size: 18px; margin-bottom: 0 !important; } .login-button{ margin-bottom: 30px; } .login-input > div input{ width: 80% !important; } .login-button button{ border: 1px solid #5363d6; background: #5363d6; color: #fff; padding: 5px 15px; margin: 20px 0; border-radius: 5px; line-height: 25px; } .login-button a{ cursor:pointer;color:#FF4081 } /*footer login*/ footer.site-footer{ z-index: 1000; position: relative; display: block; font-size: 14px; background-color: #3e4771; color: #ffffff; padding: 15px 0; } .icon-lienket{ text-align: center; margin-top: 10px; margin-bottom: 10px; } .icon-lienket a{ margin-right: 10px; display: inline-block; } .icon-lienket a img{ display: block; border: 0; outline: none; text-decoration: none; width: 32px;height: 32px; } footer.site-footer div p{ text-align: center; margin: 10px 0; } footer.site-footer div p b{ font-size: 18px; } footer.site-footer div p span{ font-size: 15px; } footer.site-footer div p a.termsHover{ cursor: pointer; color: #ff4081; font-size: 16px; } footer.site-footer div p a.termsHover:hover{ color: #fff; font-size: 17px; } /*introduce*/ /**/ .topnav .icon { display: none; } .navbar-header { overflow: hidden; padding: 20px 10px; width: 100%; } .navbar-header a { float: left; color: white; text-align: center; padding: 12px 16px; font-size: 16px; line-height: 25px; border-radius: 4px; font-weight: 700; font-style: normal; text-transform: uppercase; } .navbar-header a.logo { font-size: 25px; font-weight: bold; } .navbar-header a:hover, .navbar-header a:focus{ color: white !important; } .topnav a:hover { background-color: #ddd; color: black; } .navbar-header a.active { background-color: #5363d6; color: white; } .topnav { float: right; } /**/ .introduce { width: 100%; height: 460px; } .introduce-1 { width: 100%; height: 100%; background-color: black; /* fallback color */ background-image: url("images/landingImg3.jpg"); background-size: cover; transition: all .5s; background-position: center 25%; background-repeat: no-repeat; position: relative; } .introduce:hover .introduce-1, .introduce:focus .introduce-1 { transform: scale(1.01); } .introduce-1::before { content: ""; display: none; height: 100%; width: 100%; position: absolute; top: 0; left: 0; } .introduce:hover .introduce-1:before, .introduce:focus .introduce-1:before { display: block; } .navbar-brand{ padding: 0 10px !important; } .navbar-brand img{ border-radius: 50%; width: 60px;height: 60px; margin: 3px 0; } .navbar-brand p{ padding: 10px; font-size: 30px; font-weight: bold; color: #fff !important; margin: 10px 0; } .textMsg{ display: flex; align-items: center; justify-content: center; position: absolute; top: 0; left: 0; height: 100%; width: 100%; } .textMsg span img{ width: 100px;height: auto; } .textMsg h2{ color: #fff; font-size: 30px; margin-bottom: 5px; font-family: Arial; font-weight: 600; } .introduce-button{ z-index: 2; } .introduce-button button{ background: none; border: none; color: #fff; font-weight: bold; font-size: 18px; border-radius: 5px; padding: 0.3em 1em !important; cursor: pointer; margin: 5px 0; } .introduce-button button.btt-1{ background-color: #5363d6; } .introduce-button button.btt-2{ background-color: #FF4081; } span.slider img{ width: 150px;height: auto; margin-right: 5px; z-index: 3; position: relative; } .textMsg-children span.slider{ width: 320px;position: absolute;right: 2px;bottom: 15px; } /*introduce school*/ .introduce-school,.introduce-customers{ background: #FBFCFC; } .schoolTiltle{ text-align: center; } .schoolTiltle h2{ color: #FF4081; font-weight: bold; } .schoolTiltle .hr{ width: 100px; size: 3px; display: block; margin: 20px auto; border: 2px solid #5363d6; } .featured-item{ height: auto; margin: auto; width: 100%; text-align: center; padding: 1rem 3%; color: #62658b; letter-spacing: .03rem; line-height: 1.3; } .featured-item h3{ font-weight: 700; font-size: 20px; text-transform: uppercase; } .featured-item p{ font-size: 14px; min-height: 5em; padding-bottom: 0; margin-bottom: 20px; } .features-block__image { height: auto; width: 100%; padding: 0 18% 2em; } .image-block__cta{ display: block; font-size: 25px; } .introduce-school span.slider img{ margin: 15px 5px; } .featured-item img{ width: 60px;height: 60px; } /*introduce-parent*/ .introduce-parent{ background-color: #fff; } .slick-prev:before, .slick-next:before{ color: red !important; } /*customer*/ .mixedSlider { } .MS-content{ background: #fff; padding: 30px 20px 10px 25px; display: inline-block; } .item p{ text-align: justify; font-style: normal; color: #333333; font-size: 16px; margin: 1rem auto; line-height: 1.4; } .item-vikas{ color: #FF4081; font-weight: bold; margin: .5rem 0 0; font-size: 15px; line-height: 1.4; text-align: center; } .item-1{ text-align: center; font-size: 16px; } .item-a{ font-size: 16px; margin: 5px 0; color: #FF4081; } .item-b{ color: #5363d6; } /**/ .introduce-packages{ background: #f9f9f9; } section.introduce-packages .introduce-packages-content .row > div > div{ min-height: 580px; position: relative; } div.priceImg{ text-align: center; padding-top: 40px; border: 2px solid #fff; } .priceFree ul{ background: #A290C4; color: white; padding-top: 31px; border-radius: 10px; padding-bottom: 30px; line-height: 1.9; } .priceLite, .pricePro{ padding-top: 30px; border-radius: 10px; } .priceLite{ background-color: #e78ab9; } .pricePro{ background: #4ac7e5; } .priceLite .priceImg{ background-color: #E78AB9; padding-top: 30px; } .pricePro .priceImg{ background-color: #4AC7E5; padding-top: 30px; } .priceLite ul, .pricePro ul{ color: white; padding-bottom: 30px; line-height: 1.9; padding-top: 10px; } .priceFree .priceImg{ background-color: #A290C4 } .freeFeature{ text-align: center; } .freeFeature-p{ margin: 5px auto 5px; border: 1px solid #fff; text-align: center; width: 130px; border-radius: 5px; color: white; font-size: 16px; } .freeFeature-i { color: white; font-size: 20px; margin: 5px 0; } section.introduce-packages .introduce-packages-content .row > div>div>div{ position: absolute; bottom: 0; left: 50%; margin-left: -125px; ; width: 250px; } section.introduce-packages .introduce-packages-content .row > div>div >div> div.priceImg{ width: 120px; height: 120px; border-radius: 100%; left:50%; margin-left: -60px; overflow: hidden; position: absolute; top: -100px; color: white; font-size: 16px; } /**/ .happy-customers img{ max-width: 100%; height: 170px; padding: 10px; object-fit: contain; } .happy-customers p{ text-align: center; color: #5363d6; font-weight: 600; margin-top: 50px; font-style: italic; font-size: 20px; } .about-as p{ text-align: justify; font-size: 17px; } .our-team div{ text-align: center; } .our-team img{ width: 150px;height: 155px; border-radius: 50%; } .our-team p{ color: #FF4081; font-weight: bold; margin: .5rem 0 0; font-size: 15px; line-height: 1.4; text-align: center; } .our-team span{ display: block; } .slick-slide{ height: auto !important; } .introduce-customers-1{ margin-bottom: 30px; } .modal-body{ border-radius: 0px 0px 5px 0px; margin-bottom: 5px; height:185px; overflow:auto; background: white; text-align: center; } .modal-body button{ width: 160px; border-radius: 50px; background: white; border: 1px solid #ccc; margin-bottom: 15px; padding: 5px 10px; } .modal-body button:hover{ background-color: #ccc; } /*logo languge header*/ .dropbtn-logo1 { border: none;border-radius: 5px; background: none !important; } .dropdown-logo1 { display: inline; } .dropdown-content-logo1 { display: none; position: absolute; background-color: #b8b3b3; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content-logo1 a { color: black; padding: 12px 16px; text-decoration: none; display: block; } .dropdown-content-logo1 a img{ width: 30px; } .dropdown-content-logo1 a:hover {background-color: #ddd;} .dropdown-logo1:hover .dropdown-content-logo1 {display: block;} .menu_desktop img.logo { width: auto;height: 50px;margin: 15px 0; margin-left: 30px; } /*end*/ /*REPONSIVE*/ @media screen and (max-width: 768px) { .navbar-header{ padding: 10px 0; } .topnav a{display: none;} .topnav a.icon { float: right; display: block; font-size: 26px; position: absolute; top: 24px; right: 15px; } .topnav.responsive { position: relative; width: 250px; top: -80px } .topnav.responsive .icon { position: absolute; right: 0; top: 0; } .topnav.responsive a { float: none; display: block; background: #646464; border: 1px solid; cursor: pointer; text-align: center; } .navbar-brand{ margin: 10px; } .textMsg h2{ font-size: 25px; margin-bottom: 10px; line-height: 1.6; } .packages-priceFree{ min-height: 350px !important; } .packages-priceLite{ min-height: 480px !important; } } .col-2dot4, extra small .col-sm-2dot4, // small .col-md-2dot4, // medium .col-lg-2dot4, // large .col-xl-2dot4 { // extra large position: relative; width: 100%; min-height: 1px; padding-right: 15px; padding-left: 15px; } .col-2dot4 { -webkit-box-flex: 0; -ms-flex: 0 0 20%; flex: 0 0 20%; max-width: 20%; } @media (min-width: 540px) { .col-sm-2dot4 { -webkit-box-flex: 0; -ms-flex: 0 0 20%; flex: 0 0 20%; max-width: 20%; } } @media (min-width: 767px) { .col-md-2dot4 { -webkit-box-flex: 0; -ms-flex: 0 0 20%; flex: 0 0 20%; max-width: 20%; } } @media (min-width: 960px) { .col-lg-2dot4 { -webkit-box-flex: 0; -ms-flex: 0 0 20%; flex: 0 0 20%; max-width: 20%; } } @media (min-width: 1140px) { .col-xl-2dot4 { -webkit-box-flex: 0; -ms-flex: 0 0 20%; flex: 0 0 20%; max-width: 20%; } } /*11234567*/ .menu_mobile #menu_mobile .closebtn { position: absolute; top: 15px; left: 25px; font-size: 25px; color: white; cursor: pointer; } /* Chỉnh sửa label h2 */ @media (min-width:375px) and (max-width:400px){ .introduce-customers-h2 h2{ padding: 0 10px; } } @media (min-width:430px) and (max-width:450px){ .introduce-customers-h2 h2{ padding: 0 10px; } } @media (min-width:451px) and (max-width:460px){ .introduce-customers-h2 h2{ padding: 0 15px; } } @media (min-width:461px) and (max-width:470px){ .introduce-customers-h2 h2{ padding: 0 20px; } } @media (min-width:471px) and (max-width:480px){ .introduce-customers-h2 h2{ padding: 0 25px; } }
17.574436
89
0.637118
ef61e8c4915d4bebe3d2a331a5226c5f072b7000
1,896
js
JavaScript
Plugins/AutoPlayGifs.plugin.js
OdarGM/BetterDiscordApp
3a78bc459864ad49759be62103f876dd9bc87b7c
[ "MIT" ]
1,744
2015-08-25T20:43:40.000Z
2022-03-09T05:58:43.000Z
Plugins/AutoPlayGifs.plugin.js
OdarGM/BetterDiscordApp
3a78bc459864ad49759be62103f876dd9bc87b7c
[ "MIT" ]
733
2015-09-23T00:29:36.000Z
2022-02-27T06:45:20.000Z
Plugins/AutoPlayGifs.plugin.js
OdarGM/BetterDiscordApp
3a78bc459864ad49759be62103f876dd9bc87b7c
[ "MIT" ]
1,200
2015-10-04T09:28:55.000Z
2022-03-10T13:23:30.000Z
//META{"name":"agif"}*// var agif = function () {}; // Autoplay GIFs agif.prototype.convert = function (target) { // Handle GIF $(target).find(".image:has(canvas)").each(function () { var image = $(this); var canvas = image.children("canvas").first(); // Replace GIF preview with actual image var src = canvas.attr("src"); if(src !== undefined) { image.replaceWith($("<img>", { src: canvas.attr("src"), width: canvas.attr("width"), height: canvas.attr("height"), }).addClass("image kawaii-autogif")); } }); // Handle GIFV $(target).find(".embed-thumbnail-gifv:has(video)").each(function () { var embed = $(this); var video = embed.children("video").first(); // Remove the class, embed-thumbnail-gifv, to avoid the "GIF" overlay embed.removeClass("embed-thumbnail-gifv").addClass("kawaii-autogif"); // Prevent the default behavior of pausing the video embed.parent().on("mouseout.autoGif", function (event) { event.stopPropagation(); }); video[0].play(); }); }; agif.prototype.onMessage = function () {}; agif.prototype.onSwitch = function () {}; agif.prototype.start = function () { this.convert(document); }; agif.prototype.observer = function (e) { this.convert(e.target); }; agif.prototype.load = function () {}; agif.prototype.unload = function () {}; agif.prototype.stop = function () {}; agif.prototype.getSettingsPanel = function () { return ""; }; agif.prototype.getName = function () { return "Autogif"; }; agif.prototype.getDescription = function () { return "Autoplay gifs without having to hover."; }; agif.prototype.getVersion = function () { return "1.0.0"; }; agif.prototype.getAuthor = function () { return "noodlebox"; };
28.298507
77
0.5923
24726c7940449348e8c68d82b014681a0992728a
3,469
php
PHP
resources/views/stock_ins/show.blade.php
beamnarak/phunin-1
2ab218a1dd99e6c84aa14f2953c6e2c3bd42bef8
[ "MIT" ]
null
null
null
resources/views/stock_ins/show.blade.php
beamnarak/phunin-1
2ab218a1dd99e6c84aa14f2953c6e2c3bd42bef8
[ "MIT" ]
null
null
null
resources/views/stock_ins/show.blade.php
beamnarak/phunin-1
2ab218a1dd99e6c84aa14f2953c6e2c3bd42bef8
[ "MIT" ]
null
null
null
@extends('layouts.app') @section('content') <div class="container"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel panel-default"> <div class="panel-heading"> <h3>{{Lang::get('stock_in.title')}}</h3> </div> <div class="panel-body"> <div class="form-group"> {{ Form::label('shop', Lang::get('id')) }} : {{$stock_in->id}}</h4> </div> <div class="form-group"> <h4>{{ Form::label('order_id', Lang::get('stock_in.order_id')) }} : {{$stock_in->order_id}}</h4> </div> <div class="form-group"> <h4>{{ Form::label('date', Lang::get('stock_in.date')) }} : @if($stock_in->spare_parts->count() > 0) {{$stock_in->spare_parts->first()->pivot->date}} @endif </h4> </div> <div class="form-group"> <h4>{{ Form::label('shop', Lang::get('shop.title')) }} : {{$stock_in->shop->name}}</h4> </div> <div class="form-group"> <h4>{{ Form::label('total', Lang::get('stock_in.total')) }} : {{number_format($stock_in->getTotalPrice(),2)}} บาท</h4> </div> <div class="form-group"> <h4>{{ Form::label('total', Lang::get('stock_in.note')) }} : {{$stock_in->note}}</h4> </div> <div class="form-group"> <h4>{{ Form::label('total', Lang::get('common.writer')) }} : {{$stock_in->user->name}}</h4> </div> <table class="table"> <thead> <th>{{Lang::get('spare_part.title')}}</th> <th>{{Lang::get('stock_in.qty')}}</th> <th>{{Lang::get('stock_in.price')}}</th> <th>{{Lang::get('stock_in.total')}}</th> </thead> <tbody> @foreach($stock_in->spare_parts->sortBy('code') as $spare_part) <tr> <td><a href="{{route('spare_parts.show',$spare_part->id)}}">{{$spare_part->detail}}</a></td> <td>{{$spare_part->pivot->amount}} {{$spare_part->unit->name}}</td> <td>{{number_format($spare_part->pivot->price,2)}}</td> <td>{{number_format($spare_part->pivot->amount * $spare_part->pivot->price,2)}}</td> </tr> @endforeach </tbody> </table> </div> <div class="panel-footer"> {!! Form::open(['action' => ['StockInController@destroy', $stock_in->id], 'method' => 'POST' ]) !!} {{Form::hidden('_method','DELETE') }} {{Form::submit(Lang::get('button.delete'), ['class' => 'btn btn-danger'])}} {!! Form::close() !!} </div> </div> </div> </div> </div> @endsection
48.859155
142
0.379072
20bb9b16354d5ad41d0db3bd5ebadd1cf0f3b700
842
cs
C#
src/Prometheus.Client/ScrapeHandler.cs
jakubneubauer/prom-client
74870d22ae75d7c8e34f3a1c4579506ccecf33df
[ "MIT" ]
72
2018-04-12T08:13:47.000Z
2021-05-18T09:51:28.000Z
src/Prometheus.Client/ScrapeHandler.cs
jakubneubauer/prom-client
74870d22ae75d7c8e34f3a1c4579506ccecf33df
[ "MIT" ]
92
2018-06-08T14:13:23.000Z
2021-03-21T10:43:10.000Z
src/Prometheus.Client/ScrapeHandler.cs
jakubneubauer/prom-client
74870d22ae75d7c8e34f3a1c4579506ccecf33df
[ "MIT" ]
17
2018-06-15T23:44:45.000Z
2020-10-06T08:23:28.000Z
using System.IO; using System.Threading.Tasks; using Prometheus.Client.Collectors; using Prometheus.Client.MetricsWriter; namespace Prometheus.Client { public static class ScrapeHandler { public static async Task ProcessAsync(ICollectorRegistry registry, Stream outputStream) { using var metricsWriter = new MetricsTextWriter(outputStream); await registry.CollectToAsync(metricsWriter).ConfigureAwait(false); await metricsWriter.CloseWriterAsync().ConfigureAwait(false); } public static async Task<MemoryStream> ProcessAsync(ICollectorRegistry registry) { // leave open var stream = new MemoryStream(); await ProcessAsync(registry, stream); stream.Position = 0; return stream; } } }
30.071429
95
0.667458
b8d29ef2567982b53598a10cbdbe6e43f623212f
12,352
c
C
packages/seacas/libraries/chaco/submain/divide.c
jschueller/seacas
14c34ae08b757cba43a3a03ec0f129c8a168a9d3
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "NetCDF", "BSL-1.0", "X11", "BSD-3-Clause" ]
82
2016-02-04T18:38:25.000Z
2022-03-29T03:01:49.000Z
packages/seacas/libraries/chaco/submain/divide.c
jschueller/seacas
14c34ae08b757cba43a3a03ec0f129c8a168a9d3
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "NetCDF", "BSL-1.0", "X11", "BSD-3-Clause" ]
206
2015-11-20T01:57:47.000Z
2022-03-31T21:12:04.000Z
packages/seacas/libraries/chaco/submain/divide.c
jschueller/seacas
14c34ae08b757cba43a3a03ec0f129c8a168a9d3
[ "Python-2.0", "Zlib", "BSD-2-Clause", "MIT", "NetCDF", "BSL-1.0", "X11", "BSD-3-Clause" ]
68
2016-01-13T22:46:51.000Z
2022-03-31T06:25:05.000Z
/* * Copyright(C) 1999-2021 National Technology & Engineering Solutions * of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with * NTESS, the U.S. Government retains certain rights in this software. * * See packages/seacas/LICENSE for details */ #include "defs.h" #include "params.h" #include "smalloc.h" #include "structs.h" #include <stdio.h> void chaco_divide(struct vtx_data **graph, /* graph data structure */ int nvtxs, /* number of vertices in graph */ int nedges, /* number of edges in graph */ int using_vwgts, /* are vertex weights being used? */ int using_ewgts, /* are edge weights being used? */ double * vwsqrt, /* sqrt of vertex weights (length nvtxs+1) */ int igeom, /* geometry dimension for inertial method */ float ** coords, /* coordinates for inertial method */ int * assignment, /* set number of each vtx (length n) */ double * goal, /* desired set sizes */ int architecture, /* 0 => hypercube, d => d-dimensional mesh */ float * term_wgts[], /* weights for terminal propagation */ int global_method, /* global partitioning algorithm */ int local_method, /* local partitioning algorithm */ int rqi_flag, /* should I use multilevel eigensolver? */ int vmax, /* if so, # vertices to coarsen down to */ int ndims, /* number of eigenvectors */ double eigtol, /* tolerance on eigenvectors */ int (*hop_mtx)[MAXSETS], /* between-set hop costs for KL */ int nsets, /* number of sets to partition into */ int striping /* partition by striping into pieces? */ ) { extern int DEBUG_TRACE; /* trace main execution path? */ extern int DEBUG_CONNECTED; /* debug flag for connected components */ extern int DEBUG_KL; /* debug flag for KL variants */ extern int COARSE_NLEVEL_KL; /* how often to invoke KL while uncoarsening */ extern int MAPPING_TYPE; /* how to map from eigenvectors to partition */ extern int LANCZOS_TYPE; /* which Lanczos variant to use */ extern int MAKE_CONNECTED; /* force connectivity in spectral method? */ extern double KL_IMBALANCE; /* fractional imbalance allowed in KL */ extern int VERTEX_SEPARATOR; /* vertex instead of edge separator? */ extern int VERTEX_COVER; /* form/improve vtx separator via matching? */ extern int COARSE_BPM; /* apply matching/flow while uncoarsening? */ struct connect_data *cdata; /* data for enforcing connectivity */ double * yvecs[MAXDIMS + 1]; /* space for pointing to eigenvectors */ double evals[MAXDIMS + 1]; /* corresponding eigenvalues */ double weights[MAXSETS]; /* vertex weight in each set */ double maxdeg; /* maximum weighted degree of a vertex */ double total_weight; /* weight of all vertices */ double temp_goal[2]; /* goal to simulate bisection while striping */ double * fake_goal; /* either goal or temp_goal */ int * active; /* keeping track of vtxs in BFS (length nvtxs) */ int * bndy_list; /* list of boundary vtxs */ int * null_ptr; /* argument to klspiff */ int * mark; /* for marking vtxs in BFS (length nvtxs+1) */ int vwgt_max; /* largest vertex weight */ int max_dev; /* largest allowed deviation from balance */ int mediantype; /* how to map from eigenvectors to partition */ int solver_flag; /* which Lanczos variant to use */ int mkconnected; /* enforce connectivity in spectral method? */ int i; /* loop counters */ int simple_type; /* which type of simple partitioning to use */ int find_bndy(), find_side_bndy(); void make_connected(), print_connected(), coarsen_kl(), eigensolve(); void coarsen_klv(), klvspiff(); void assign(), make_unconnected(), inertial(), klspiff(), simple_part(); void count_weights(), bpm_improve(), countup_vtx_sep(); double find_maxdeg(); maxdeg = 0; if (DEBUG_TRACE > 0) { printf("<Entering divide, nvtxs = %d, nedges = %d>\n", nvtxs, nedges); } if (nvtxs <= 0) { return; } if (nedges == 0 && global_method != 3) { global_method = 4; local_method = 2; } for (i = 0; i < MAXSETS; i++) { weights[i] = 0.0; } bndy_list = NULL; if (striping) { ndims = 1; mediantype = 4; temp_goal[0] = temp_goal[1] = 0; for (i = 0; 2 * i + 1 < nsets; i++) { temp_goal[0] += goal[i]; temp_goal[1] += goal[nsets - 1 - i]; } i = nsets / 2; if (2 * i != nsets) { temp_goal[0] += .5 * goal[i]; temp_goal[1] += .5 * goal[i]; } fake_goal = temp_goal; } else { mediantype = MAPPING_TYPE; fake_goal = goal; } if (using_vwgts) { vwgt_max = 0; for (i = 1; i <= nvtxs; i++) { if (graph[i]->vwgt > vwgt_max) { vwgt_max = graph[i]->vwgt; } } } else { vwgt_max = 1; } /* Perform one of the global partitionings on this sub-graph. */ if (global_method == 1) { /* Multilevel method. */ mkconnected = MAKE_CONNECTED; solver_flag = LANCZOS_TYPE; if (VERTEX_SEPARATOR) { coarsen_klv(graph, nvtxs, nedges, using_vwgts, using_ewgts, term_wgts, igeom, coords, vwgt_max, assignment, goal, architecture, hop_mtx, solver_flag, ndims, nsets, vmax, mediantype, mkconnected, eigtol, COARSE_NLEVEL_KL, 0, &bndy_list, weights, FALSE); if (VERTEX_COVER && !COARSE_BPM) { max_dev = vwgt_max; total_weight = 0; for (i = 0; i < nsets; i++) { total_weight += goal[i]; } total_weight *= KL_IMBALANCE / nsets; if (total_weight > max_dev) { max_dev = total_weight; } bpm_improve(graph, assignment, goal, max_dev, &bndy_list, weights, using_vwgts); } } else { coarsen_kl(graph, nvtxs, nedges, using_vwgts, using_ewgts, term_wgts, igeom, coords, vwgt_max, assignment, goal, architecture, hop_mtx, solver_flag, ndims, nsets, vmax, mediantype, mkconnected, eigtol, COARSE_NLEVEL_KL, 0, &bndy_list, weights, FALSE); if (VERTEX_COVER) { max_dev = vwgt_max; total_weight = 0; for (i = 0; i < nsets; i++) { total_weight += goal[i]; } total_weight *= KL_IMBALANCE / nsets; if (total_weight > max_dev) { max_dev = total_weight; } if (goal[0] - weights[0] <= goal[1] - weights[1]) { i = 0; } else { i = 1; } find_side_bndy(graph, nvtxs, assignment, i, 2, &bndy_list); count_weights(graph, nvtxs, assignment, nsets + 1, weights, using_vwgts); if (DEBUG_KL > 0) { printf("After KL, before bpm_improve\n"); countup_vtx_sep(graph, nvtxs, assignment); } bpm_improve(graph, assignment, goal, max_dev, &bndy_list, weights, using_vwgts); } } } else if (global_method == 2) { /* Spectral method. */ mkconnected = MAKE_CONNECTED; solver_flag = LANCZOS_TYPE; active = smalloc(nvtxs * sizeof(int)); for (i = 1; i <= ndims; i++) { yvecs[i] = smalloc((nvtxs + 1) * sizeof(double)); } if (mkconnected) { /* If doing multi-level KL, this happens on coarse graph. */ mark = (int *)&(yvecs[1][0]); make_connected(graph, nvtxs, &nedges, mark, active, &cdata, using_ewgts); if (DEBUG_CONNECTED > 0) { printf("Enforcing connectivity\n"); print_connected(cdata); } } else if (DEBUG_CONNECTED > 0) { printf("Not enforcing connectivity\n"); } maxdeg = find_maxdeg(graph, nvtxs, using_ewgts, (float *)NULL); eigensolve(graph, nvtxs, nedges, maxdeg, vwgt_max, vwsqrt, using_vwgts, using_ewgts, term_wgts, igeom, coords, yvecs, evals, architecture, assignment, fake_goal, solver_flag, rqi_flag, vmax, ndims, mediantype, eigtol); assign(graph, yvecs, nvtxs, ndims, architecture, nsets, vwsqrt, assignment, active, mediantype, goal, vwgt_max); for (i = 1; i <= ndims; i++) { sfree(yvecs[i]); } if (mkconnected) { make_unconnected(graph, &nedges, &cdata, using_ewgts); } sfree(active); } else if (global_method == 3) { /* Inertial method. */ inertial(graph, nvtxs, architecture, nsets, igeom, coords, assignment, goal, using_vwgts); } else if (global_method == 4) { /* Linear ordering. */ simple_type = 3; simple_part(graph, nvtxs, assignment, nsets, simple_type, goal); } else if (global_method == 5) { /* Random partitioning. */ simple_type = 2; simple_part(graph, nvtxs, assignment, nsets, simple_type, goal); } else if (global_method == 6) { /* Scattered partitioning. */ simple_type = 1; simple_part(graph, nvtxs, assignment, nsets, simple_type, goal); } /* Perform a local refinement, if specified, on the global partitioning. */ if (local_method == 1 && global_method != 1) { /* If global_method == 1, already did KL as part of multilevel-KL. */ null_ptr = NULL; max_dev = vwgt_max; total_weight = 0; for (i = 0; i < nsets; i++) { total_weight += goal[i]; } total_weight *= KL_IMBALANCE / nsets; if (total_weight > max_dev) { max_dev = total_weight; } if (VERTEX_SEPARATOR) { find_bndy(graph, nvtxs, assignment, 2, &bndy_list); count_weights(graph, nvtxs, assignment, nsets + 1, weights, (vwgt_max != 1)); klvspiff(graph, nvtxs, assignment, goal, max_dev, &bndy_list, weights); if (VERTEX_COVER) { bpm_improve(graph, assignment, goal, max_dev, &bndy_list, weights, using_vwgts); } } else { if (global_method != 2) { maxdeg = find_maxdeg(graph, nvtxs, using_ewgts, (float *)NULL); } count_weights(graph, nvtxs, assignment, nsets, weights, (vwgt_max != 1)); klspiff(graph, nvtxs, assignment, nsets, hop_mtx, goal, term_wgts, max_dev, maxdeg, using_ewgts, &null_ptr, weights); if (VERTEX_COVER) { if (goal[0] - weights[0] <= goal[1] - weights[1]) { i = 0; } else { i = 1; } find_side_bndy(graph, nvtxs, assignment, i, 2, &bndy_list); count_weights(graph, nvtxs, assignment, nsets + 1, weights, (vwgt_max != 1)); if (DEBUG_KL > 0) { printf("After KL, before bpm_improve\n"); countup_vtx_sep(graph, nvtxs, assignment); } bpm_improve(graph, assignment, goal, max_dev, &bndy_list, weights, using_vwgts); } } } else if (global_method != 1 && VERTEX_COVER) { find_bndy(graph, nvtxs, assignment, 2, &bndy_list); count_weights(graph, nvtxs, assignment, nsets + 1, weights, (vwgt_max != 1)); if (DEBUG_KL > 0) { printf("Before bpm_improve\n"); countup_vtx_sep(graph, nvtxs, assignment); } max_dev = vwgt_max; total_weight = 0; for (i = 0; i < nsets; i++) { total_weight += goal[i]; } total_weight *= KL_IMBALANCE / nsets; if (total_weight > max_dev) { max_dev = total_weight; } bpm_improve(graph, assignment, goal, max_dev, &bndy_list, weights, using_vwgts); } if (bndy_list != NULL) { sfree(bndy_list); } }
39.717042
100
0.557319
05fa1a460099690034e4c2643888a9bf6d770aff
1,173
py
Python
AutoProcess.py
acep-uaf/canarylabs-odbc-extractor
41b0175369d3ff3edf66bcd5d5ea909c7c2152a7
[ "MIT" ]
null
null
null
AutoProcess.py
acep-uaf/canarylabs-odbc-extractor
41b0175369d3ff3edf66bcd5d5ea909c7c2152a7
[ "MIT" ]
null
null
null
AutoProcess.py
acep-uaf/canarylabs-odbc-extractor
41b0175369d3ff3edf66bcd5d5ea909c7c2152a7
[ "MIT" ]
1
2021-06-03T18:02:42.000Z
2021-06-03T18:02:42.000Z
import datetime import os import process_historic_canary logPath = 'C:\\Users\\radiance-admin\Canary_Labs_Data_Management\canarylabs-odbc-extractor' logFile = 'ScheduledTasksLog.txt' log =os.path.join(logPath,logFile) def logRuns(): writeToLog('RunStart' + datetime.datetime.now().strftime("%Y-%m-%d %H%M%S")) return def logComplete(): writeToLog('RunComplete' + datetime.datetime.now().strftime("%Y-%m-%d %H%M%S")) return def writeToLog(msg): with open(log, "a+") as logFile: logFile.write('\n' + msg) return def logFiles(dboxCount, zipCount,failedCount): writeToLog('Dropbox files transferred:' + str(dboxCount)) writeToLog('zipFiles uploaded:' + str(zipCount)) writeToLog('zipFiles not uploaded:' + str(failedCount)) return def main(): logRuns() try: result= process_historic_canary.main() logFiles(result['downloaded'],result['uploaded'],result['failedUploads']) # except ProcessingStoppedError as e: # writeLast(e.datetime) # writeToLog(e.message) except Exception as e: print(e) writeToLog(str(e)) logComplete() return if __name__ =='__main__': main()
27.27907
91
0.683717
a112347c9fe8cb942bf840701712c01977e8e794
4,142
ts
TypeScript
src/beacon/BeaconService.ts
zurfyx/eddy-test
ec15058eabb7089c6429210c1cb62eaa386d4c34
[ "MIT" ]
36
2017-06-27T16:18:13.000Z
2021-03-21T18:08:28.000Z
src/beacon/BeaconService.ts
zurfyx/eddy-test
ec15058eabb7089c6429210c1cb62eaa386d4c34
[ "MIT" ]
1
2017-06-28T08:41:48.000Z
2017-06-28T08:47:34.000Z
src/beacon/BeaconService.ts
zurfyx/eddy-test
ec15058eabb7089c6429210c1cb62eaa386d4c34
[ "MIT" ]
5
2017-06-27T17:50:55.000Z
2020-05-17T17:50:14.000Z
import constants from '../constants'; import { LOCK_VALUES, DATA_VALUES } from './enums'; import { decodeUrl, encodeUrl } from './url'; export class BeaconService { constructor(public service: BluetoothRemoteGATTService) {} private async readCharacteristic(uuid: string): Promise<DataView> { const characteristic = await this.service.getCharacteristic(uuid); return characteristic.readValue(); } private async writeCharacteristic(uuid: string, value: BufferSource): Promise<void> { const characteristic = await this.service.getCharacteristic(uuid); return characteristic.writeValue(value); } /** * Interval. */ async readInterval(): Promise<number> { const uuid = constants.ADVERTISING_INTERVAL_CHARACTERISTIC_UUID; const rawVal = await this.readCharacteristic(uuid); const val = rawVal.getUint16(0, false); // Big-Endian. return val; } async writeInterval(ms: number): Promise<void> { const uuid = constants.ADVERTISING_INTERVAL_CHARACTERISTIC_UUID; const rawMs = new DataView(new ArrayBuffer(2)); // 2 * 8bit rawMs.setUint16(0, ms, false); return this.writeCharacteristic(uuid, rawMs); } /** * LOCK */ async isLocked(): Promise<boolean> { const uuid = constants.EDDYSTONE_LOCK_STATE_CHARACTERISTIC_UUID; const rawVal = await this.readCharacteristic(uuid); const val = rawVal.getUint8(0); return val === LOCK_VALUES.LOCKED; } /** * RADIO */ async readRadioTxPower(): Promise<number> { const uuid = constants.RADIO_TX_POWER_CHARACTERISTIC_UUID; const rawVal = await this.readCharacteristic(uuid); const val = rawVal.getInt8(0); return val; } /** * Writes Radio Tx Power. * @param dbm Tx power. Values should range between -100 and +20 dBm. * If a power is selected that is not supported by the radio, the beacon should select * the next highest power supported, or else the maximum power. * @see https://github.com/google/eddystone/blob/master/eddystone-url/README.md#tx-power-level */ async writeRadioTxPower(dbm: number): Promise<void> { const uuid = constants.RADIO_TX_POWER_CHARACTERISTIC_UUID; const dbmByte = new Int8Array([dbm]); return this.writeCharacteristic(uuid, dbmByte); } async readAdvertisedTxPower(): Promise<number> { const uuid = constants.ADVANCED_ADVERTISED_TX_POWER_CHARACTERISTIC_UUID; const rawVal = await this.readCharacteristic(uuid); const val = rawVal.getInt8(0); return val; } async writeAdvertisedTxPower(dbm: number): Promise<void> { const uuid = constants.ADVANCED_ADVERTISED_TX_POWER_CHARACTERISTIC_UUID; const dbmByte = new Int8Array([dbm]); return this.writeCharacteristic(uuid, dbmByte); } /** * URL */ async readUrl(): Promise<string> { const uuid = constants.ADV_SLOT_DATA_CHARACTERISTIC_UUID; const rawVal = await this.readCharacteristic(uuid); const type = rawVal.getUint8(0); if (type !== DATA_VALUES.URL) { return Promise.reject('Advertised data is not a URL'); } const rawUrl = new DataView(rawVal.buffer, 2); // w/o type. return decodeUrl(rawUrl); } async writeUrl(url: string): Promise<void> { const uuid = constants.ADV_SLOT_DATA_CHARACTERISTIC_UUID; const raw = encodeUrl(url); if (raw.byteLength > 18) { return Promise.reject('Encoded URL is longer than 18 bytes'); } const urlBytes = Array.from(Array(raw.byteLength).keys()).map((bytePos) => { return raw.getUint8(bytePos); }); const fullBytes = new Uint8Array([DATA_VALUES.URL, ...urlBytes]); // With URL type preceding. return this.writeCharacteristic(uuid, fullBytes); } async clearUrl(): Promise<void> { const uuid = constants.ADV_SLOT_DATA_CHARACTERISTIC_UUID; const clearByte = new Uint8Array([0x00]); return this.writeCharacteristic(uuid, clearByte); } /** * MISC */ async factoryReset(): Promise<void> { const uuid = constants.ADVANCED_FACTORY_RESET_CHARACTERISTIC_UUID; const factoryResetByte = new Uint8Array([0x0B]); return this.writeCharacteristic(uuid, factoryResetByte); } }
32.614173
97
0.706422
1a31af198fd0b5c175f1e035b96011beb1af43e7
1,053
py
Python
docs/Dockerfile/scripts/init_spug.py
showsmall/spug
9c878d37c3bd732808d43a2a3958735a9ad07cfe
[ "MIT" ]
2
2020-08-10T14:29:46.000Z
2021-05-21T09:06:20.000Z
docs/Dockerfile/scripts/init_spug.py
xiaoyiios/spug
67c137da9ea1bc451bfa1c34ebfb35c4821825c2
[ "MIT" ]
null
null
null
docs/Dockerfile/scripts/init_spug.py
xiaoyiios/spug
67c137da9ea1bc451bfa1c34ebfb35c4821825c2
[ "MIT" ]
1
2020-09-07T03:48:44.000Z
2020-09-07T03:48:44.000Z
import sys import os sys.path.append('/spug/spug_api') import random import string from public import db from config import BASE_DIR from apps.account.models import User import apps.configuration.models import apps.deploy.models import apps.assets.models import apps.schedule.models import apps.setting.models # init database db.drop_all() db.create_all() with open(os.path.join(BASE_DIR, 'libs', 'sql', 'permissions.sql'), 'r') as f: line = f.readline() while line: if line.startswith('INSERT INTO'): db.engine.execute(line.strip()) line = f.readline() # create default admin username = 'admin' password = 'spug' User(username=username, password=password, nickname='Administrator', is_supper=True).save() print('*' * 80) print('Database name: ' + (os.getenv('MYSQL_DATABASE') or 'spug')) print('Database username: ' + (os.getenv('MYSQL_USER') or 'spuguser')) print('Database password: ' + (os.getenv('MYSQL_PASSWORD') or 'spugpwd')) print('Login web site account: %s %s' % (username, password)) print('*' * 80)
28.459459
91
0.710351
a3a69d3af9ad64be51d335dedf034c3fae958457
2,175
java
Java
URIScraper/src/main/java/URIScraper/threads/MainScraper.java
mauromascarenhas/PGC_UFABC
d2014a6fa4b7ded2a38044cfd495d7da66ac4c28
[ "Apache-2.0" ]
1
2020-05-01T17:49:44.000Z
2020-05-01T17:49:44.000Z
URIScraper/src/main/java/URIScraper/threads/MainScraper.java
mauromascarenhas/PGC_UFABC
d2014a6fa4b7ded2a38044cfd495d7da66ac4c28
[ "Apache-2.0" ]
null
null
null
URIScraper/src/main/java/URIScraper/threads/MainScraper.java
mauromascarenhas/PGC_UFABC
d2014a6fa4b7ded2a38044cfd495d7da66ac4c28
[ "Apache-2.0" ]
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package URIScraper.threads; import URIScraper.data.ExecutionLogger; import URIScraper.data.URIProblem; import java.io.IOException; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; /** * * @author Mauro */ public class MainScraper extends ScraperThread{ private final URIProblem problem; public MainScraper(URIProblem problem) { this.problem = problem; } @Override public void run() { Document doc; try{ doc = Jsoup.connect(String.format("https://www.urionlinejudge.com.br/repository/UOJ_%s%s.html" , this.problem.getProblemID(), this.problem.getDescriptionLanguage())).get(); boolean hasImages = false; Elements cElement = doc.getElementsByClass("description"); if (cElement.size() > 0){ this.problem.setDescription(cElement.get(0).wholeText().trim()); hasImages |= cElement.get(0).getElementsByTag("img").size() > 0; } cElement = doc.getElementsByClass("input"); if (cElement.size() > 0){ this.problem.setInput(cElement.get(0).wholeText().trim()); hasImages |= cElement.get(0).getElementsByTag("img").size() > 0; } cElement = doc.getElementsByClass("output"); if (cElement.size() > 0){ this.problem.setOutput(cElement.get(0).wholeText().trim()); hasImages |= cElement.get(0).getElementsByTag("img").size() > 0; } this.problem.setExistentImage(hasImages); } catch (IOException e) { ExecutionLogger.getInstance().appendMessage("\n[ MAIN ]" + "\nURI Problem: " + problem.getProblemID()); ExecutionLogger.getInstance().appendMessage(e); } finally{ setFinished(true); } } }
33.461538
108
0.584368
b0d56dc8ad053424145629b33c77330dfc108d2f
3,012
h
C
src/include/vuh/arr/arrayProperties.h
mihhaiii/vuh
1bdb886f51e8aaca7c9e6652f899ce4df28c1967
[ "MIT" ]
326
2018-05-24T04:12:54.000Z
2022-03-14T17:13:13.000Z
src/include/vuh/arr/arrayProperties.h
mihhaiii/vuh
1bdb886f51e8aaca7c9e6652f899ce4df28c1967
[ "MIT" ]
49
2018-04-26T11:49:09.000Z
2021-07-25T16:43:47.000Z
src/include/vuh/arr/arrayProperties.h
mihhaiii/vuh
1bdb886f51e8aaca7c9e6652f899ce4df28c1967
[ "MIT" ]
34
2018-06-05T16:01:50.000Z
2022-01-07T12:29:33.000Z
#pragma once #include <vulkan/vulkan.hpp> #include <type_traits> namespace vuh { namespace arr { /// Contains the traits to hold together buffer and memory flags for /// some common buffer usage scenarious. Each trait also defines the fall-back trait, /// being void if fall-back is not available. namespace properties { using memflags_t = std::underlying_type_t<vk::MemoryPropertyFlagBits>; using bufflags_t = std::underlying_type_t<vk::BufferUsageFlagBits>; /// Flags for buffer in host-visible memory. /// This is the fallback of most other usage flags, and has no fall-back itself. struct Host { using fallback_t = void; static constexpr memflags_t memory = memflags_t(vk::MemoryPropertyFlagBits::eHostVisible); static constexpr bufflags_t buffer = {}; }; /// Flags for buffer used as a staging buffer to transfer data to GPU. struct HostCoherent { using fallback_t = Host; static constexpr memflags_t memory = memflags_t(vk::MemoryPropertyFlagBits::eHostVisible ) | memflags_t(vk::MemoryPropertyFlagBits::eHostCoherent); static constexpr bufflags_t buffer = bufflags_t(vk::BufferUsageFlagBits::eTransferSrc); }; /// Flags for buffer used as a staging buffer to transfer data from GPU. struct HostCached { using fallback_t = Host; static constexpr memflags_t memory = memflags_t(vk::MemoryPropertyFlagBits::eHostVisible) | memflags_t(vk::MemoryPropertyFlagBits::eHostCached ); static constexpr bufflags_t buffer = bufflags_t(vk::BufferUsageFlagBits::eTransferDst); }; /// Flags for buffer in both device-local and host-visible memory if such exists. /// There is no fall-back for this. struct Unified { using fallback_t = void; static constexpr memflags_t memory = memflags_t(vk::MemoryPropertyFlagBits::eDeviceLocal) | memflags_t(vk::MemoryPropertyFlagBits::eHostVisible); static constexpr bufflags_t buffer = {}; }; /// Flags for buffer in device-local memory. Additionally sets transfer bits to enable /// using this buffer to transfer data to/from staging buffers (and eventually host). /// The fall-back is Host. struct Device { using fallback_t = Host; static constexpr memflags_t memory = memflags_t(vk::MemoryPropertyFlagBits::eDeviceLocal); static constexpr bufflags_t buffer = bufflags_t(vk::BufferUsageFlagBits::eTransferSrc) | bufflags_t(vk::BufferUsageFlagBits::eTransferDst); }; /// Flags for buffer in device-local memory which is not supposed to take part in data /// exchange with host or other buffers. All you can do with it is to bind it to kernel /// as an input or output parameter. struct DeviceOnly { using fallback_t = Host; static constexpr memflags_t memory = memflags_t(vk::MemoryPropertyFlagBits::eDeviceLocal); static constexpr bufflags_t buffer = {}; }; } // namespace props } // namespace arr } // namespace vuh
42.422535
95
0.715471
f80c9f0db834353d847de8b6d759df1ba68905ba
15,736
rs
Rust
kernel/src/syscall/file.rs
Ko-oK-OS/Rix
f2949aadfff23a27da9c771282a4c0d8804a1f65
[ "MIT" ]
44
2021-03-20T02:14:58.000Z
2022-03-31T03:40:52.000Z
kernel/src/syscall/file.rs
Ko-oK-OS/Rix
f2949aadfff23a27da9c771282a4c0d8804a1f65
[ "MIT" ]
10
2021-05-28T17:00:00.000Z
2022-02-06T03:14:50.000Z
kernel/src/syscall/file.rs
Ko-oK-OS/Rix
f2949aadfff23a27da9c771282a4c0d8804a1f65
[ "MIT" ]
4
2021-04-28T08:43:35.000Z
2022-03-18T01:34:28.000Z
use core::char::MAX; use core::intrinsics::drop_in_place; use core::str::from_utf8; use core::usize; use core::{ptr::NonNull, slice::from_raw_parts_mut}; use core::slice::from_raw_parts; use core::cell::RefCell; use crate::arch::riscv::qemu::fs::DIRSIZ; use crate::arch::riscv::qemu::layout::PGSIZE; use crate::arch::riscv::qemu::param::MAXARG; use crate::memory::{ RawPage, PageAllocator }; use crate::misc::str_cmp; use crate::{arch::riscv::qemu::{fs::OpenMode, param::MAXPATH}, fs::{FILE_TABLE, FileType, ICACHE, Inode, InodeData, InodeType, LOG, VFile}, lock::sleeplock::{SleepLock, SleepLockGuard}}; use crate::fs::Pipe; use super::*; use alloc::string::String; use alloc::sync::Arc; use alloc::vec; use bit_field::BitField; impl Syscall<'_> { pub fn sys_dup(&self) -> SysResult { let mut fd = self.arg(0); // let proc = self.process; let pdata = unsafe{ &mut *self.process.data.get() }; let file = pdata.open_files[fd].as_ref().unwrap(); if let Ok(newfd) = unsafe{ CPU_MANAGER.alloc_fd(file) } { fd = newfd; }else{ panic!("sys_dup: 没有发现空闲的文件描述符") } file.dup(); Ok(fd) } /// read file data by special vfile. pub fn sys_read(&self) -> SysResult { let size: usize; // Get file let fd = self.arg(0); let pdata = unsafe{ &mut *self.process.data.get() }; let file = pdata.open_files[fd].as_ref().unwrap(); // Get user read address let ptr = self.arg(1); // Get read size let len = self.arg(2); // Read file data match file.read(ptr, len) { Ok(cur_size) => { size = cur_size; }, Err(err) => { println!("{}", err); return Err(()) } } Ok(size) } /// Write into file. pub fn sys_write(&self) -> SysResult { let size; let fd = self.arg(0); let pdata = unsafe{ &mut *self.process.data.get() }; let file = pdata.open_files[fd].as_ref().unwrap(); let ptr = self.arg(1); let len = self.arg(2); match file.write(ptr, len) { Ok(cur_size) => { size = cur_size; }, Err(err) => { println!("{}", err); return Err(()) } } Ok(size) } pub fn sys_open(&self) -> SysResult { let mut path = [0;MAXPATH]; let mut inode: Inode; let mut file: &mut VFile; let mut inode_guard: SleepLockGuard<InodeData>; // Get file path let addr = self.arg(0); self.copy_from_str(addr, &mut path, MAXPATH).unwrap(); // Get open mode let open_mode = self.arg(1); // Start write log LOG.begin_op(); match OpenMode::mode(open_mode) { OpenMode::CREATE => { match ICACHE.create(&path, crate::fs::InodeType::File, 0, 0) { Ok(cur_inode) => { inode = cur_inode; inode_guard = inode.lock(); }, Err(err) => { LOG.end_op(); println!("{}", err); return Err(()) } } }, _ => { match ICACHE.namei(&path) { Some(cur_inode) => { inode = cur_inode; inode_guard = inode.lock(); if inode_guard.dinode.itype == InodeType::Directory && open_mode != OpenMode::RDONLY as usize{ drop(inode_guard); LOG.end_op(); println!("[Debug] sys_open: Fail to enter dir."); return Err(()); } }, None => { LOG.end_op(); return Err(()) } } } } // Allocate file descriptor match unsafe{ FILE_TABLE.allocate() } { Some(cur_file) => { file = cur_file; } None => { drop(inode_guard); LOG.end_op(); println!("Fail to allocate file"); return Err(()) } } match inode_guard.dinode.itype { InodeType::Device => { // println!("[Debug] sys_open: 文件类型为设备"); file.ftype = FileType::Device; file.major = inode_guard.dinode.major; file.readable = true; file.writeable = true; }, _ => { file.ftype = FileType::Inode; file.offset = 0; file.readable = true; file.writeable = true; } } if open_mode.get_bit(11) && inode_guard.dinode.itype == InodeType::File { inode_guard.truncate(&inode); } // Drop guard for immutable borrow drop(inode_guard); LOG.end_op(); file.inode = Some((&mut inode) as *mut Inode); file.writeable = !open_mode.get_bit(0); file.readable = open_mode.get_bit(0) | open_mode.get_bit(1); let fd; match unsafe { CPU_MANAGER.alloc_fd(file) } { Ok(cur_fd) => { fd = cur_fd; } Err(err) => { println!("{}", err); return Err(()) } } Ok(fd) } pub fn sys_exec(&self) -> SysResult { let mut path = [0u8;MAXPATH]; let mut argv = [0 as *mut u8; MAXARG]; let mut user_arg: usize; let addr = self.arg(0); self.copy_from_str(addr, &mut path, MAXPATH).unwrap(); let user_argv = self.arg(1); let path = from_utf8(&path).unwrap(); let mut count = 0; loop { if count >= argv.len() { for i in 0..MAXARG { if argv[i] != 0 as *mut u8 { unsafe{ drop_in_place(argv[i] as *mut RawPage) }; } } return Err(()); } let mut buf = [0u8;8]; self.copy_form_addr( user_argv + count * size_of::<usize>(), &mut buf, 8 )?; // TODO: use little endian to create an native integer? user_arg = usize::from_le_bytes(buf); if user_arg == 0 { argv[count] = 0 as *mut u8; break; } let mem = unsafe{ RawPage::new_zeroed() as *mut u8 }; argv[count] = mem; let buf = unsafe { from_raw_parts_mut(mem, PGSIZE) }; self.copy_from_str( user_arg, buf, PGSIZE )?; count += 1; } let argv = unsafe{ from_raw_parts( argv.as_ptr() as *const *const u8, MAXARG ) }; let ret = unsafe { exec(path, &argv).expect("Fail to exec") }; for i in 0..MAXARG { if argv[i] != 0 as *mut u8 { unsafe{ drop_in_place(argv[i] as *mut RawPage) }; } } Ok(ret) } pub fn sys_mknod(&self) -> SysResult { let mut path: [u8; MAXPATH] = [0;MAXPATH]; let major = self.arg(1); let minor = self.arg(2); LOG.begin_op(); // Get file path let addr = self.arg(0); self.copy_from_str(addr, &mut path, MAXPATH)?; match ICACHE.create( &path, InodeType::Device, major as i16, minor as i16 ) { Ok(inode) => { LOG.end_op(); drop(inode); // println!("[Debug] create: 创建成功"); Ok(0) }, Err(err) => { println!("err: {}", err); LOG.end_op(); // println!("[Debug] create: 创建失败"); Err(()) } } } /// TODO: fix pub fn sys_close(&self) -> SysResult { let fd = self.arg(0); let pdata = unsafe{ &mut *self.process.data.get() }; pdata.fd_close(fd); // file.close(); Ok(0) } } // pub fn sys_pipe() -> SysResult { // // User use an array to represent two file. // let mut fd_array: usize = 0; // let mut rf: &mut VFile = &mut VFile::init(); // let mut wf: &mut VFile = &mut VFile::init(); // arg_addr(0, &mut &mut fd_array)?; // Pipe::alloc(&mut rf, &mut wf); // let p = unsafe { // CPU_MANAGER.myproc().expect("Fail to get my process.") // }; // // Allocate file descriptor for r/w file. // let rfd: usize; // let wfd: usize; // match p.fd_alloc(rf) { // Ok(fd) => { // rfd = fd; // }, // Err(err) => { // rf.close(); // println!("err: {}", err); // return Err(()) // } // } // match p.fd_alloc(wf) { // Ok(fd) => { // wfd = fd; // }, // Err(err) => { // rf.close(); // wf.close(); // println!("err: {}", err); // return Err(()) // } // } // let pgt = p.page_table(); // let extern_data = unsafe { // &mut *p.extern_data.get() // }; // let open_files = &mut extern_data.open_files; // if pgt.copy_out(fd_array, rf as *const _ as *const u8, size_of::<usize>()).is_err() { // open_files[rfd].take(); // open_files[wfd].take(); // rf.close(); // wf.close(); // return Err(()) // } // if pgt.copy_out( // fd_array + size_of::<usize>(), // wf as *const _ as *const u8, // size_of::<usize>() // ).is_err() { // open_files[rfd].take(); // open_files[wfd].take(); // rf.close(); // wf.close(); // return Err(()) // } // Ok(0) // } // pub fn sys_fstat() -> SysResult { // // let mut file: VFile = VFile::init(); // let mut stat: usize = 0; // let mut fd = 0; // arg_fd(0, &mut fd)?; // arg_addr(1, &mut stat)?; // let proc = unsafe{ CPU_MANAGER.myproc().unwrap() }; // let extern_data = proc.extern_data.get_mut(); // let file = extern_data.open_files[fd].as_ref().unwrap(); // match file.stat(stat) { // Ok(()) => { // return Ok(0) // }, // Err(err) => { // println!("err: {}", err); // return Err(()) // } // } // } // pub fn sys_chdir() -> SysResult { // let mut path = [0u8; MAXPATH]; // let my_proc = unsafe{ CPU_MANAGER.myproc().expect("Fail to get my process.") }; // LOG.begin_op(); // arg_str(0, &mut path, MAXPATH)?; // match ICACHE.namei(&path) { // Some(inode) => { // let inode_guard = inode.lock(); // match inode_guard.dinode.itype { // InodeType::Directory => { // drop(inode_guard); // let old_cwd = my_proc.extern_data.get_mut().cwd.replace(inode); // drop(old_cwd); // LOG.end_op(); // return Ok(0) // }, // _ => { // LOG.end_op(); // drop(inode_guard); // return Err(()) // } // } // }, // None => { // LOG.end_op(); // return Err(()) // } // } // } // pub fn sys_unlink() -> SysResult { // let mut path = [0u8; MAXPATH]; // let mut name = [0u8; DIRSIZ]; // let mut parent: Inode; // let mut inode: Inode; // arg_str(0, &mut path, MAXPATH)?; // LOG.begin_op(); // match ICACHE.namei_parent(&path, &mut name) { // Some(cur) => { // parent = cur; // }, // None => { // LOG.end_op(); // return Err(()) // } // } // let mut parent_guard = parent.lock(); // if str_cmp(&name, ".".as_bytes(), DIRSIZ) && // str_cmp(&name, "..".as_bytes(), DIRSIZ) { // drop(parent_guard); // LOG.end_op(); // return Err(()) // } // match parent_guard.dir_lookup(&name) { // Some(cur) => { // inode = cur; // }, // _ => { // drop(parent_guard); // LOG.end_op(); // return Err(()) // } // } // let mut inode_guard = inode.lock(); // if inode_guard.dinode.nlink < 1 { // panic!("sys_unlink: inods's nlink must be larger than 1."); // } // if inode_guard.dinode.itype == InodeType::Directory && // !inode_guard.is_dir_empty() { // drop(inode_guard); // drop(parent_guard); // LOG.end_op(); // return Err(()) // } // if inode_guard.dinode.itype == InodeType::Directory { // parent_guard.dinode.nlink -= 1; // parent_guard.update(); // } // drop(parent_guard); // inode_guard.dinode.nlink -= 1; // inode_guard.update(); // drop(inode_guard); // LOG.end_op(); // Ok(0) // } // /// Create the path new as a link to the same inode as old. // pub fn sys_link() -> SysResult { // let mut new_path = [0u8; MAXPATH]; // let mut old_path = [0u8; MAXPATH]; // let mut name = [0u8; DIRSIZ]; // let mut inode: Inode; // let mut parent: Inode; // arg_str(0, &mut old_path, MAXPATH)?; // arg_str(1, &mut new_path, MAXPATH)?; // LOG.begin_op(); // match ICACHE.namei(&old_path) { // Some(cur) => { // inode = cur; // }, // None => { // LOG.end_op(); // return Err(()) // } // } // let mut inode_guard = inode.lock(); // if inode_guard.dinode.itype == InodeType::Directory { // drop(inode_guard); // LOG.end_op(); // return Err(()) // } // inode_guard.dinode.nlink += 1; // match ICACHE.namei_parent(&new_path, &mut name) { // Some(cur) => { // parent = cur; // }, // _ => { // inode_guard.dinode.nlink -= 1; // drop(inode_guard); // LOG.end_op(); // return Err(()) // } // } // let mut parent_guard = parent.lock(); // if parent_guard.dinode.itype != InodeType::Directory || // parent_guard.dir_link(&name, inode.inum).is_ok() { // drop(parent_guard); // inode_guard.dinode.nlink -= 1; // drop(inode_guard); // LOG.end_op(); // return Err(()) // } // inode_guard.update(); // drop(inode_guard); // LOG.end_op(); // return Ok(0) // } // pub fn sys_mkdir() -> SysResult { // let mut path = [0u8; MAXPATH]; // LOG.begin_op(); // arg_str(0, &mut path, MAXPATH)?; // match ICACHE.create(&path, InodeType::Directory, 0, 0) { // Ok(inode) => { // drop(inode); // LOG.end_op(); // Ok(0) // }, // Err(err) => { // println!("err: {}", err); // Err(()) // } // } // }
28.302158
186
0.43607
e001d3a2ace62618f820eb31b5366e17b84c79ae
8,024
php
PHP
application/views/dashboard.php
amainyebriggs/Okoatanicampus
68d691e9efa530146b657f18561097cd212b0eb4
[ "MIT" ]
null
null
null
application/views/dashboard.php
amainyebriggs/Okoatanicampus
68d691e9efa530146b657f18561097cd212b0eb4
[ "MIT" ]
null
null
null
application/views/dashboard.php
amainyebriggs/Okoatanicampus
68d691e9efa530146b657f18561097cd212b0eb4
[ "MIT" ]
null
null
null
<div class="container"> <div id="update_notice"></div> <div class="row"> <div class="col-md-4"> <div class="card border-left-success shadow py-2"> <div class="card-body"> <div class="row no-gutters align-items-center"> <div class="col mr-2"> <div class="text-xs font-weight-bold text-primary text-uppercase mb-1"> <a href="<?php echo site_url('qbank');?>"> <?php echo $this->lang->line('no_questions_qbank');?> </a> </div> <div class="h5 mb-0 font-weight-bold text-gray-800"><?php echo $num_qbank;?></div> </div> <div class="col-auto"> <i class="fas fa-book fa-2x text-gray-300"></i> </div> </div> </div> </div> </div> <div class="col-md-4"> <div class="card border-left-warning shadow py-2"> <div class="card-body"> <div class="row no-gutters align-items-center"> <div class="col mr-2"> <div class="text-xs font-weight-bold text-primary text-uppercase mb-1"> <a href="<?php echo site_url('quiz');?>"> <?php echo $this->lang->line('no_registered_quiz');?> </a> </div> <div class="h5 mb-0 font-weight-bold text-gray-800"><?php echo $num_quiz;?></div> </div> <div class="col-auto"> <i class="fas fa-chalkboard-teacher fa-2x text-gray-300"></i> </div> </div> </div> </div> </div> </div> <div class="row"></div> <div class="row" style="margin-top:20px;"> <div class="col-lg-7"> <div class="row"> </div> <!-- recent users --> <div class="card shadow py-2" style="margin-top:20px;"> <div class="card-heading" style="padding:5px;"> <h6 class="m-0 font-weight-bold text-primary" > <?php echo $this->lang->line('recently_registered');?> </h6> </div> <div class="card-body table-responsive"> <table class="table table-striped valign-middle"> <thead> <tr><th><?php echo $this->lang->line('email');?></th> <th class="text-xs-right"><?php echo $this->lang->line('full_name');?></th> <th class="text-xs-right"><?php echo $this->lang->line('group_name');?></th> <th class="text-xs-right"><?php echo $this->lang->line('contact_no');?></th> <th></th> </tr></thead> <tbody> <?php if(count($result)==0){ ?> <tr> <td colspan="3"><?php echo $this->lang->line('no_record_found');?></td> </tr> <?php } foreach($result as $key => $val){ ?><tr> <td> <a href="<?php echo site_url('user/edit_user/'.$val['uid']);?>"><?php echo $val['email'];?> <?php echo $val['wp_user'];?></a></td> <td class="text-xs-right"><?php echo $val['first_name'];?> <?php echo $val['last_name'];?> <?php echo $val['ADMISSION_NUMBER'];?></td> <td class="text-xs-right"><?php echo $val['group_name'];?></td> <td class="text-xs-right"><?php echo $val['contact_no'];?></td> </tr> <?php } ?> </tbody></table> </div> </div> <!-- recent users --> </div> <div class="col-lg-5"> <?php $revenue_months2=array(); foreach($revenue_months as $fk => $fv){ $revenue_months2[]=floatval($fv); } ?> <?php $months=array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); ?> <div class="card shadow mb-4"> <!-- Card Header - Dropdown --> <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between"> <h6 class="m-0 font-weight-bold text-primary"><?php echo $this->lang->line('revenue');?> <?php $todaymonth=date('M',time()); if(date('m',time()) != 1){ $mm=date('m',time())-1; }else{ $mm=date('m',time()); } $pastmonth=$months[$mm-1]; $cal=number_format(((($revenue_months[$todaymonth]-$revenue_months[$pastmonth])/$revenue_months[$pastmonth])*100),'2','.',''); if($cal < 0){ ?> <small class="font-weight-light text-muted" style="font-size:16px;color:#ff0000;" title="<?php echo $this->lang->line('growth_lath_month');?>"> <?php echo $cal;?>% <i class="fa fa-arrow-down"></i> </small> <?php }else{ ?> <small class="font-weight-light text-muted" style="font-size:16px;color:#72B159;" title="<?php echo $this->lang->line('growth_lath_month');?>"> <?php echo $cal;?>% <i class="fa fa-arrow-up"></i> </small> <?php } ?> <?php echo $this->lang->line('past_days');?> </h6> </div> <!-- Card Body --> <div class="card-body"> <div class="font-size-34"><small class="font-weight-light text-muted"><?php echo $this->config->item('base_currency_prefix');?></small> <strong><?php echo number_format(array_sum($revenue_months2), 2, '.', ''); ?></strong> <small class="font-weight-light text-muted"><?php echo $this->lang->line('this_year');?> </small> </div> <canvas id="myChart" width="340" height="340"></canvas> </div> <script> var ctx = document.getElementById("myChart"); var myChart = new Chart(ctx, { type: 'line', data: { labels: <?php echo json_encode($months);?>, datasets: [{ label: '<?php echo $this->lang->line('rev_paid_quiz');?>', data: <?php echo json_encode($revenue_months2);?>, backgroundColor: 'rgba(255, 188, 188, 0.2)', borderColor: 'rgba(153, 0, 0, 1)', borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] } } }); </script> </div> <!-- References --> <div class="panel"> <div class="panel-heading"> <div class="panel-title"><?php echo $this->lang->line('recent_sub');?></div> </div> <?php if(count($payments)==0){ ?> <div class="box m-y-2"> <div class="box-cell valign-middle text-xs-center" style="width: 60px"> <i class="ion-social-twitter font-size-28 line-height-1 text-info"></i> </div> <div class="box-cell p-r-3"> <?php echo $this->lang->line('no_record_found');?> <div class="progress m-b-0" style="height: 5px; margin-top: 5px;"> <div class="progress-bar progress-bar-info" style="width: 40%"></div> </div> </div> </div> <?php } $i=0; $colorcode=array( 'success', 'warning', 'info', 'danger' ); foreach($payments as $key => $val){ ?> <div class="alert alert-<?php echo $colorcode[$i];?>" style="margin:5px;"> <a href="<?php echo site_url('user/edit_user/'.$val['uid']);?>"> <?php echo $val['first_name'].' '.$val['last_name'];?></a> <?php echo $this->lang->line('subscribed');?> <?php echo $val['group_name'];?> <button class="btn btn-<?php echo $colorcode[$i];?>"> <?php echo $this->config->item(strtolower($val['payment_gateway']).'_currency_prefix');?> <?php echo $val['amount'];?> <?php echo $this->config->item(strtolower($val['payment_gateway']).'_currency_sufix');?> </button> </div> <?php if($i >= 4){ $i=0; }else{ $i+=1; } } ?> <!-- / payments --> </div> </div> </div> <div class="row text-center" style="margin-top:30px;"> <script> update_check('5'); </script>
24.842105
223
0.492149
e0573a8d4f6c3d8437463977f500ad30d9b215f1
3,729
h
C
compiler/ArgumentsPositions.h
eladraz/morph
e80b93af449471fb2ca9e256188f9a92f631fbc2
[ "BSD-3-Clause" ]
4
2017-01-24T09:32:23.000Z
2021-08-20T03:29:54.000Z
compiler/ArgumentsPositions.h
eladraz/morph
e80b93af449471fb2ca9e256188f9a92f631fbc2
[ "BSD-3-Clause" ]
null
null
null
compiler/ArgumentsPositions.h
eladraz/morph
e80b93af449471fb2ca9e256188f9a92f631fbc2
[ "BSD-3-Clause" ]
1
2021-08-20T03:29:55.000Z
2021-08-20T03:29:55.000Z
/* * Copyright (c) 2008-2016, Integrity Project Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the Integrity Project nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE */ #ifndef __TBA_CLR_COMPILER_ARGUMENTSPOSITIONS_H #define __TBA_CLR_COMPILER_ARGUMENTSPOSITIONS_H /* * ArgumentsPositions.h * * Handle method arguments. * * Author: Elad Raz <e@eladraz.com> */ #include "xStl/types.h" #include "xStl/data/array.h" #include "data/ElementType.h" // Forward deceleration class MethodCompiler; /* * Translate between argument to argument positions (+alignment) and sizes */ class ArgumentsPositions { public: /* * Constructor. Generate new arguments template */ ArgumentsPositions(); /* * Return the size of all arguments */ uint getTotalArgumentsSize() const; /* * Return the stack position of argument variable * * index - The index for the argument */ uint getArgumentPosition(uint index) const; /* * Return the stack size of an argument * * index - The index for the argument */ uint getArgumentStackSize(uint index) const; /* * Return the variable object. The variable object is used for managing the * apartment object and the different variable type. * * index - The index for the argument */ const ElementType& getArgumentStackVariableType(uint index) const; /* * Return the amount of arguments */ uint getCount() const; /* * Count the amount of object arguments */ uint countObjects() const; private: // Only CallingConvention can build a stack template friend class CallingConvention; // Deny copy-constructor and operator = ArgumentsPositions(const ArgumentsPositions& other); ArgumentsPositions& operator = (const ArgumentsPositions& other); // The array of arguments positions cSArray<uint> m_argumentPosition; // The array of arguments sizes cSArray<uint> m_argumentSizes; // The array of arguments types cArray<ElementType> m_argumentTypes; // the size of all arguments uint m_totalArgumentsSize; // NOTE: Each new member should affect the MethodCompiler and the // MethodCompiler::calculateStackSize as well! }; #endif // __TBA_CLR_COMPILER_ARGUMENTSPOSITIONS_H
31.336134
79
0.7262
437eddcdba95457bddf9231b95f0b65f561f3b63
9,883
tsx
TypeScript
src/components/pages/authorized/Dashboard/views/Dashboard/useDashboard.tsx
Prisma-Laster-Management-Tools/qc-platform-frontend-v1
0be916d6f7a7a1585f225a6f91b49a7e931a3483
[ "Unlicense" ]
null
null
null
src/components/pages/authorized/Dashboard/views/Dashboard/useDashboard.tsx
Prisma-Laster-Management-Tools/qc-platform-frontend-v1
0be916d6f7a7a1585f225a6f91b49a7e931a3483
[ "Unlicense" ]
null
null
null
src/components/pages/authorized/Dashboard/views/Dashboard/useDashboard.tsx
Prisma-Laster-Management-Tools/qc-platform-frontend-v1
0be916d6f7a7a1585f225a6f91b49a7e931a3483
[ "Unlicense" ]
null
null
null
import React, { useEffect, useMemo, useState } from 'react' import { TRoles } from './Dashboard' import { BarChart, Bar, Cell, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'; import { API_GetDeliberationStatistic, API_GetMaintenanceStatistic, API_GetProductStatistic, API_GetPurchasementStatistic, API_GetQcStatistic, API_GetRecruitmentStatistic } from '../../apis/dashboard.api'; import { IDeliberationStatisticData, IMaintenanceStatisticData, IProductStatisticData, IPurchasementStatisticData, IQcStatisticData, IRecruitmentStatisticData } from '../../shared/interfaces/dashboard.interfaces'; import { createStaticDeliberationChartTypeWithPassedData, createStaticMaintenanceChartTypeWithPassedData, createStaticProductChartTypeWithPassedData, createStaticPurchasementChartTypeWithPassedData, createStaticQcChartTypeWithPassedData, createStaticRecruitmentChartTypeWithPassedData } from './staticChartRenderer'; export default function useDashboard() { const [focusedRole,setFocusRole] = useState<TRoles>('qc') const [chartData,setChartData] = useState<any>(null) const [chartElement,setChartElement] = useState<React.ReactElement<any> | null>(null) // INSTANCE ONLY [NO EXPORT] function resetChartData(){ setChartData(null) setChartElement(null) } function onRoleChanged(role:TRoles){ resetChartData() if(role === "qc") return fetchAndPrepareQcDataForStatistic() else if(role==='purchasement') return fetchAndPreparePurchasementDataForStatistic() else if(role === 'hr') return fetchAndPrepareRecruitmentDataForStatistic() else if(role==='maintenance') return fetchAndPrepareMaintenanceDataForStatistic() else if(role==='deliberation') return fetchAndPrepareDeliberationDataForStatistic() else if(role === 'product') return fetchAndPrepareProductDataForStatistic() } useEffect(() => { console.log('role changed') onRoleChanged(focusedRole) },[focusedRole]) // // ─── QC ───────────────────────────────────────────────────────────────────────── // async function fetchAndPrepareQcDataForStatistic(){ const mapped_response = await API_GetQcStatistic() let dataset: any = []; if(mapped_response.success){ const {statistic}: IQcStatisticData = mapped_response.data dataset = [ { name: 'สินค้าทั้งหมด', 'สินค้าทั้งหมด': statistic.product_count },{ name: 'ยังไม่เคยได้รับการตรวจสอบ', 'ยังไม่เคยได้รับการตรวจสอบ': statistic.total_never_qc }, { name: 'ผ่านมาตรฐานการตรวจสอบ', 'ผ่านมาตรฐานการตรวจสอบ': statistic.total_qc_passed }, { name: 'ไม่ผ่านมาตรฐานการตรวจสอบ', 'ไม่ผ่านมาตรฐานการตรวจสอบ': statistic.total_qc_failed }, { name: 'อยู่ในคิวการตรวจสอบ', 'อยู่ในคิวการตรวจสอบ': statistic.total_in_queue } ] } setChartElement(createStaticQcChartTypeWithPassedData(dataset)) } // ──────────────────────────────────────────────────────────────────────────────── // // ─── PURCHASEMENT ─────────────────────────────────────────────────────────────── // async function fetchAndPreparePurchasementDataForStatistic(){ const mapped_response = await API_GetPurchasementStatistic() let dataset: any = []; if(mapped_response.success){ const {statistic}: IPurchasementStatisticData = mapped_response.data dataset = [ { name: 'คำร้องทั้งหมด', 'คำร้องทั้งหมด': statistic.totaL_request },{ name: 'คำสั่งซื้อที่รอการตอบกลับ', 'คำสั่งซื้อที่รอการตอบกลับ': statistic.total_await_request_to_be_accept }, { name: 'คำสั่งซื้อถูกปฏิเสธ', 'คำสั่งซื้อถูกปฏิเสธ': statistic.total_rejected_request }, { name: 'คำสั่งซื้อที่ดำเนินการอยู่', 'คำสั่งซื้อที่ดำเนินการอยู่': statistic.total_in_process_request }, { name: 'การสั่งซื้อสำเร็จ', 'การสั่งซื้อสำเร็จ': statistic.total_successfully_request } ] } setChartElement(createStaticPurchasementChartTypeWithPassedData(dataset)) } // ──────────────────────────────────────────────────────────────────────────────── // // ─── RECRUITMENT ──────────────────────────────────────────────────────────────── // async function fetchAndPrepareRecruitmentDataForStatistic(){ const mapped_response = await API_GetRecruitmentStatistic() let dataset: any = []; if(mapped_response.success){ const {statistic}: IRecruitmentStatisticData = mapped_response.data dataset = [ { name: 'จำนวนลื้งค์ใช้งานที่สร้างขึ้น', 'จำนวนลื้งค์ใช้งานที่สร้างขึ้น': statistic.total_generated_link },{ name: 'จำนวนลื่งค์ที่ใช้งานแล้ว', 'จำนวนลื่งค์ที่ใช้งานแล้ว': statistic.total_used_link }, { name: 'จำนวนลิ้งค์ที่ยังไม่ได้ใช้งาน', 'จำนวนลิ้งค์ที่ยังไม่ได้ใช้งาน': statistic.total_unused_link } ] } setChartElement(createStaticRecruitmentChartTypeWithPassedData(dataset)) } // ──────────────────────────────────────────────────────────────────────────────── // // ─── RECRUITMENT ──────────────────────────────────────────────────────────────── // async function fetchAndPrepareMaintenanceDataForStatistic(){ const mapped_response = await API_GetMaintenanceStatistic() let dataset: any = []; if(mapped_response.success){ const {statistic}: IMaintenanceStatisticData = mapped_response.data dataset = [ { name: 'จำนวนเครื่องจักรทั้งหมด', 'จำนวนเครื่องจักรทั้งหมด': statistic.total_maintenance_schedule }, { name: 'เครื่องจักรที่ถึงรอบการบำรุงรักษา', 'เครื่องจักรที่ถึงรอบการบำรุงรักษา': statistic.total_maintenance_attention_needed } , { name: 'จำนวนเครื่องวัดทั้งหมด', 'จำนวนเครื่องวัดทั้งหมด': statistic.total_calibration_schedule }, { name: 'จำนวนเครื่องวัดที่ถึงรอบการตรวจสอบประสิทธิภาพ', 'จำนวนเครื่องวัดที่ถึงรอบการตรวจสอบประสิทธิภาพ': statistic.total_calibration_period_hit } ] } setChartElement(createStaticMaintenanceChartTypeWithPassedData(dataset)) } // ──────────────────────────────────────────────────────────────────────────────── // // ─── RECRUITMENT ──────────────────────────────────────────────────────────────── // async function fetchAndPrepareDeliberationDataForStatistic(){ const mapped_response = await API_GetDeliberationStatistic() let dataset: any = []; if(mapped_response.success){ const {statistic}: IDeliberationStatisticData = mapped_response.data dataset = [ { name: 'จำนวนการจัดเตรียมส่งออกทั้งหมด', 'จำนวนการจัดเตรียมส่งออกทั้งหมด': statistic.total_exportation },{ name: 'ถูกยกเลิก', 'ถูกยกเลิก': statistic.total_rejected_shipping }, { name: 'จัดส่งสำเร็จ', 'จัดส่งสำเร็จ': statistic.total_shipping_successfully }, { name: 'รอการส่งออก', 'รอการส่งออก': statistic.total_waiting_to_be_shipped } ] } setChartElement(createStaticDeliberationChartTypeWithPassedData(dataset)) } // ──────────────────────────────────────────────────────────────────────────────── // // ─── RECRUITMENT ──────────────────────────────────────────────────────────────── // async function fetchAndPrepareProductDataForStatistic(){ const mapped_response = await API_GetProductStatistic() let dataset: any = []; if(mapped_response.success){ const {statistic}: IProductStatisticData = mapped_response.data dataset = [ { name: 'จำนวนสินค้าทั้งหมดที่นำเข้ามาในระบบ', 'จำนวนสินค้าทั้งหมดที่นำเข้ามาในระบบ': statistic.total_product },{ name: 'จำนวนประเภทของสินค้าทั้งหมด', 'จำนวนประเภทของสินค้าทั้งหมด': statistic.total_product_type } ] } setChartElement(createStaticProductChartTypeWithPassedData(dataset)) } // ──────────────────────────────────────────────────────────────────────────────── return { get: { focusedRole, chartElement }, set:{ setFocusRole }, events:{ } } }
43.346491
316
0.4957
89bd4ced61b48d74d3d6c4d0bd549a4b94ed5bed
2,374
swift
Swift
LRActionKit/Source/Rule/Specific/UserScript.swift
Acidburn0zzz/LiveReload
af9b5ce8d5cf1f7065b8e70e4ddff8bce6963633
[ "MIT" ]
723
2015-01-03T09:33:55.000Z
2022-03-28T07:25:17.000Z
LRActionKit/Source/Rule/Specific/UserScript.swift
Acidburn0zzz/LiveReload
af9b5ce8d5cf1f7065b8e70e4ddff8bce6963633
[ "MIT" ]
39
2015-01-15T06:56:15.000Z
2020-03-09T02:09:10.000Z
LRActionKit/Source/Rule/Specific/UserScript.swift
Acidburn0zzz/LiveReload
af9b5ce8d5cf1f7065b8e70e4ddff8bce6963633
[ "MIT" ]
102
2015-02-04T15:02:59.000Z
2021-03-26T11:16:39.000Z
import Foundation import ExpressiveCollections public class UserScriptRule : Rule { public var scriptName: String? public var script: UserScript? { if let actualScriptName = scriptName { let userScripts = UserScriptManager.sharedUserScriptManager().userScripts as! [UserScript] let matchingScript = userScripts.find { $0.uniqueName == actualScriptName } if let matchingScript = matchingScript { return matchingScript } else { return MissingUserScript(name: actualScriptName) } } else { return nil; } } public override var label: String { return "Run \(scriptName)" } public class func keyPathsForValuesAffectingLabel() -> NSSet { return NSSet(object: "scriptName") } public class func keyPathsForValuesAffectingScript() -> NSSet { return NSSet(object: "scriptName") } public class func keyPathsForValuesAffectingNonEmpty() -> NSSet { return NSSet(object: "scriptName") } public override var nonEmpty: Bool { if scriptName == nil { return false } else if let actualScript = script { return actualScript.exists } else { return false } } public /*protected*/ override func loadFromMemento() throws { try super.loadFromMemento() // scriptName = NonEmptyStringValue(memento["script"] as? String) } public /*protected*/ override func updateMemento() { super.updateMemento() memento["script"] = scriptName } public override func targetForModifiedFiles(files: [ProjectFile]) -> LRTarget? { if inputPathSpecMatchesFiles(files) { return LRProjectTarget(rule: self, modifiedFiles: files as [ProjectFile]) } else { return nil } } public override func invokeWithModifiedFiles(files: [ProjectFile], result: LROperationResult, completionHandler: dispatch_block_t) { let trueFiles = files as [ProjectFile] let filePaths = trueFiles.map { $0.relativePath } if let actualScript = script { actualScript.invokeForProjectAtPath(project.rootURL.path!, withModifiedFiles: Set(filePaths), result: result, completionHandler: completionHandler) } } }
31.236842
159
0.635636
549812f34195a72c22823a77159803ca795b5d95
540
swift
Swift
Tests/MapboxMapsTests/Foundation/Camera/Mocks/MockCameraAnimatorDelegate.swift
landyrev/mapbox-maps-ios
539769a3f35682e9a1445c621f838002fa4a4c2b
[ "BSD-2-Clause" ]
181
2021-01-27T13:04:05.000Z
2022-03-30T21:23:25.000Z
Tests/MapboxMapsTests/Camera/Mocks/MockCameraAnimatorDelegate.swift
jakechristman/mapbox-maps-ios
8657f29b84d0fba7fcff0d5a0b369d6368091298
[ "BSD-2-Clause" ]
555
2021-01-27T13:08:04.000Z
2022-03-30T21:09:32.000Z
Tests/MapboxMapsTests/Camera/Mocks/MockCameraAnimatorDelegate.swift
jakechristman/mapbox-maps-ios
8657f29b84d0fba7fcff0d5a0b369d6368091298
[ "BSD-2-Clause" ]
79
2021-01-27T23:49:34.000Z
2022-03-29T05:56:57.000Z
@testable import MapboxMaps final class MockCameraAnimatorDelegate: CameraAnimatorDelegate { let cameraAnimatorDidStartRunningStub = Stub<CameraAnimator, Void>() func cameraAnimatorDidStartRunning(_ cameraAnimator: CameraAnimator) { cameraAnimatorDidStartRunningStub.call(with: cameraAnimator) } let cameraAnimatorDidStopRunningStub = Stub<CameraAnimator, Void>() func cameraAnimatorDidStopRunning(_ cameraAnimator: CameraAnimator) { cameraAnimatorDidStopRunningStub.call(with: cameraAnimator) } }
38.571429
74
0.794444
4557624a574311269d5d40b75e0a58758e1e3760
4,379
py
Python
fitting_source/1D_fitting/plot_2_PASS_cross_sections.py
pjgrandinetti/mrsimulator
e603395e52ad162d4a9051a0741651c9030c3459
[ "BSD-3-Clause" ]
14
2019-05-28T20:06:13.000Z
2021-05-27T01:37:16.000Z
fitting_source/1D_fitting/plot_2_PASS_cross_sections.py
wushanyun64/mrsimulator
01b447239d9f469df62b7293a74a3d0c34500a19
[ "BSD-3-Clause" ]
74
2021-06-07T15:13:49.000Z
2022-03-29T20:09:19.000Z
fitting_source/1D_fitting/plot_2_PASS_cross_sections.py
wushanyun64/mrsimulator
01b447239d9f469df62b7293a74a3d0c34500a19
[ "BSD-3-Clause" ]
7
2019-05-28T20:19:29.000Z
2021-04-06T18:48:24.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 1D PASS/MAT sideband order cross-section ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ """ # %% # This example illustrates the use of mrsimulator and LMFIT modules in fitting the # sideband intensity profile across the isotropic chemical shift cross-section from a # PASS/MAT dataset. import csdmpy as cp import matplotlib.pyplot as plt from lmfit import Minimizer from mrsimulator import Simulator, SpinSystem, Site from mrsimulator.methods import BlochDecaySpectrum from mrsimulator import signal_processing as sp from mrsimulator.utils import spectral_fitting as sf from mrsimulator.utils import get_spectral_dimensions # sphinx_gallery_thumbnail_number = 3 # %% # Import the dataset # ------------------ name = "https://sandbox.zenodo.org/record/814455/files/LHistidine_cross_section.csdf" pass_cross_section = cp.load(name) # standard deviation of noise from the dataset sigma = 4.640351 # For the spectral fitting, we only focus on the real part of the complex dataset. pass_cross_section = pass_cross_section.real # Convert the coordinates along each dimension from Hz to ppm. _ = [item.to("ppm", "nmr_frequency_ratio") for item in pass_cross_section.dimensions] # The plot of the dataset. plt.figure(figsize=(4.25, 3.0)) ax = plt.subplot(projection="csdm") ax.plot(pass_cross_section, "k", alpha=0.5) ax.invert_xaxis() plt.grid() plt.tight_layout() plt.show() # %% # Create a fitting model # ---------------------- # **Guess model** # # Create a guess list of spin systems. For fitting the sideband profile at an isotropic # chemical shift cross-section from PASS/MAT datasets, set the isotropic_chemical_shift # parameter of the site object as zero. site = Site( isotope="13C", isotropic_chemical_shift=0, # shielding_symmetric={"zeta": -70, "eta": 0.8}, ) spin_systems = [SpinSystem(sites=[site])] # %% # **Method** # # For the sideband-only cross-section, use the BlochDecaySpectrum method. # Get the dimension information from the experiment. spectral_dims = get_spectral_dimensions(pass_cross_section) PASS = BlochDecaySpectrum( channels=["13C"], magnetic_flux_density=9.395, # in T rotor_frequency=1500, # in Hz spectral_dimensions=spectral_dims, experiment=pass_cross_section, # also add the measurement to the method. ) # Optimize the script by pre-setting the transition pathways for each spin system from # the method. for sys in spin_systems: sys.transition_pathways = PASS.get_transition_pathways(sys) # %% # **Guess Spectrum** # Simulation # ---------- sim = Simulator(spin_systems=spin_systems, methods=[PASS]) sim.run() # Post Simulation Processing # -------------------------- processor = sp.SignalProcessor(operations=[sp.Scale(factor=2000)]) processed_data = processor.apply_operations(data=sim.methods[0].simulation).real # Plot of the guess Spectrum # -------------------------- plt.figure(figsize=(4.25, 3.0)) ax = plt.subplot(projection="csdm") ax.plot(pass_cross_section, color="k", linewidth=1, label="Experiment") ax.plot(processed_data, color="r", alpha=0.75, linewidth=1, label="guess spectrum") plt.grid() ax.invert_xaxis() plt.legend() plt.tight_layout() plt.show() # %% # Least-squares minimization with LMFIT # ------------------------------------- # First, create the fitting parameters. # Use the :func:`~mrsimulator.utils.spectral_fitting.make_LMFIT_params` for a quick # setup. params = sf.make_LMFIT_params(sim, processor) # Fix the value of the isotropic chemical shift to zero for pure anisotropic sideband # amplitude simulation. params["sys_0_site_0_isotropic_chemical_shift"].vary = False print(params.pretty_print(columns=["value", "min", "max", "vary", "expr"])) # %% # Run the minimization using LMFIT minner = Minimizer(sf.LMFIT_min_function, params, fcn_args=(sim, processor, sigma)) result = minner.minimize() result # %% # The best fit solution # --------------------- best_fit = sf.bestfit(sim, processor)[0] residuals = sf.residuals(sim, processor)[0] # Plot the spectrum plt.figure(figsize=(4.25, 3.0)) ax = plt.subplot(projection="csdm") ax.plot(pass_cross_section, color="k", linewidth=1, label="Experiment") ax.plot(best_fit, "r", alpha=0.75, linewidth=1, label="Best Fit") ax.plot(residuals, alpha=0.75, linewidth=1, label="Residuals") ax.invert_xaxis() plt.grid() plt.legend() plt.tight_layout() plt.show()
29.993151
87
0.718657
6d9c516c5a2549483dfe14d442c358eabd9df295
3,863
ts
TypeScript
src/comment/comment.service.ts
LazarPetrovic1/newstackbasic
c8a5861b2337c48e59e8ce0a4cbe2865810a9496
[ "MIT" ]
null
null
null
src/comment/comment.service.ts
LazarPetrovic1/newstackbasic
c8a5861b2337c48e59e8ce0a4cbe2865810a9496
[ "MIT" ]
null
null
null
src/comment/comment.service.ts
LazarPetrovic1/newstackbasic
c8a5861b2337c48e59e8ce0a4cbe2865810a9496
[ "MIT" ]
null
null
null
import { InjectRepository } from '@mikro-orm/nestjs'; import { EntityRepository } from '@mikro-orm/postgresql'; import { Injectable } from '@nestjs/common'; import { History as HistoryEntity } from 'src/entities/History'; import { Comment as CommentEntity } from '../entities/Comment'; import { Item as ItemEntity } from "../entities/Item" import { User as UserEntity } from "../entities/User" import { Comment } from "./interfaces/comment.interface" @Injectable() export class CommentService { constructor( @InjectRepository(CommentEntity) private readonly commentRepository: EntityRepository<CommentEntity>, @InjectRepository(ItemEntity) private readonly itemRepository: EntityRepository<ItemEntity>, @InjectRepository(UserEntity) private readonly userRepository: EntityRepository<UserEntity>, @InjectRepository(HistoryEntity) private readonly historyRepository: EntityRepository<HistoryEntity> ) {} async create(comment: Comment) : Promise<CommentEntity> { let newComment : CommentEntity; if (comment.id) newComment = await this.commentRepository.findOne({ id: comment.id }) else newComment = this.commentRepository.create(comment) const newLog = this.historyRepository.create({ log: `Created a comment on item ${newComment.item.id} (title: ${newComment.item.title}), by user ${newComment.user.name} (email: ${newComment.user.email})`, type: "comment", verb: "POST" }) // KAD SE SREDI BAZA // const user = await this.userRepository.findOne({ id: comment.user.id }) // const item = await this.itemRepository.findOne({ id: comment.item.id }) // if (!user.comments.isInitialized) await user.comments.init({ populate: [...Array.from(user.comments).map(comm => comm.id.toString()), newComment.id.toString()] }) // if (!item.comments.isInitialized) await item.comments.init({ populate: [...Array.from(item.comments).map(comm => comm.id.toString()), newComment.id.toString()] }) await this.commentRepository.persistAndFlush(newComment) await this.historyRepository.persistAndFlush(newLog) // await this.itemRepository.persistAndFlush(item) // await this.userRepository.persistAndFlush(user) return newComment } async getAllItemComments(id: number) : Promise<CommentEntity[]> { const item = await this.itemRepository.findOne({ id }) const comments = await this.commentRepository.findAll(item) return comments } async getAllUserComments(id: number) : Promise<CommentEntity[]> { const user = await this.userRepository.findOne({ id }) const comments = await this.commentRepository.findAll(user) return comments; } async findOne(id: number) : Promise<CommentEntity> { const comment = await this.commentRepository.findOne({ id }) return comment } async update(id: number, comment: Comment) : Promise<CommentEntity> { const newComment = this.commentRepository.create(comment) const newLog = this.historyRepository.create({ log: `Updated the comment on item ${newComment.item.id} (title: ${newComment.item.title}), by user ${newComment.user.name} (email: ${newComment.user.email})`, type: "comment", verb: "PUT" }) await this.historyRepository.persistAndFlush(newLog) await this.commentRepository.nativeUpdate({ id }, newComment) return newComment } async remove(id: number) : Promise<CommentEntity> { const comment = await this.commentRepository.findOne({ id }) const newLog = this.historyRepository.create({ log: `Updated the comment on item ${comment.item.id} (title: ${comment.item.title}), by user ${comment.user.name} (email: ${comment.user.email})`, type: "comment", verb: "DELETE" }) await this.historyRepository.persistAndFlush(newLog) await this.commentRepository.nativeDelete({ id }) return comment } }
45.447059
169
0.717836
dbb704de25d8ab9813a7fa2dd12630061f11cb8d
1,064
php
PHP
app/Database/Migrations/2020-10-02-124239_Prodi.php
J3C118045/Pert5
097f72cab569c74a33027ce2c0b4a612dc255960
[ "MIT" ]
null
null
null
app/Database/Migrations/2020-10-02-124239_Prodi.php
J3C118045/Pert5
097f72cab569c74a33027ce2c0b4a612dc255960
[ "MIT" ]
null
null
null
app/Database/Migrations/2020-10-02-124239_Prodi.php
J3C118045/Pert5
097f72cab569c74a33027ce2c0b4a612dc255960
[ "MIT" ]
null
null
null
<?php namespace App\Database\Migrations; use CodeIgniter\Database\Migration; class Prodi extends Migration { private $table = 'prodi'; public function up() { $this->forge->addField([ 'kode_prodi' => [ 'type' => 'VARCHAR', 'constraint' => '1', ], 'nama_prodi' => [ 'type' => 'VARCHAR', 'constraint' => '100', ], 'ketua_prodi' => [ 'type' => 'VARCHAR', 'constraint' => '100', ], ]); $this->forge->addKey('kode_prodi', true); $this->forge->createTable($this->table); } //-------------------------------------------------------------------- public function down() { $this->forge->dropTable($this->table); } }
29.555556
71
0.323308
7d23d3ca9a97cfcc73216700ffa319eaa1638b6d
1,533
ps1
PowerShell
Roles/functions/System/Remove-RoleSystem.ps1
VMDeployment/Roles
8d7bfa8de3bf7ec6f39b22d1902f4f44ffe74c25
[ "MIT" ]
null
null
null
Roles/functions/System/Remove-RoleSystem.ps1
VMDeployment/Roles
8d7bfa8de3bf7ec6f39b22d1902f4f44ffe74c25
[ "MIT" ]
null
null
null
Roles/functions/System/Remove-RoleSystem.ps1
VMDeployment/Roles
8d7bfa8de3bf7ec6f39b22d1902f4f44ffe74c25
[ "MIT" ]
null
null
null
function Remove-RoleSystem { <# .SYNOPSIS Remove an existing role system. .DESCRIPTION Remove an existing role system. Will silently terminate if system is unknown. Note: Requires elevation unless overridden using the 'Roles.Validation.SkipElevationTest' configuration. .PARAMETER Name Name of the role system to delete. .PARAMETER Confirm If this switch is enabled, you will be prompted for confirmation before executing any operations that change state. .PARAMETER WhatIf If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run. .EXAMPLE PS C:\> Remove-RoleSystem -Name 'VMDeployment' Removes the role system "VMDeployment" #> [CmdletBinding(SupportsShouldProcess = $true)] param ( [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [PsfArgumentCompleter('Roles.System')] [string[]] $Name ) begin { Assert-Elevation -Cmdlet $PSCmdlet } process { if (-not (Test-Path $script:roleSystemPath)) { return } foreach ($systemName in $Name) { $systemPath = Get-RoleSystemPath -System $systemName if (-not (Test-Path -Path $systemPath)) { continue } Invoke-PSFProtectedCommand -ActionString 'Remove-RoleSystem.Removing' -ActionStringValues $systemName -ScriptBlock { Remove-Item -Path $systemPath -Force -Recurse -ErrorAction Stop } -Target $systemName -EnableException $true -PSCmdlet $PSCmdlet } } }
30.058824
157
0.741683
494ecf355004fe476376c1063f5b74927ab0e53f
1,638
py
Python
core_admin/old_apps/praia/admin.py
linea-it/tno
f973381280504ceb1b606b5b3ccc79b6b8c2aa4f
[ "MIT" ]
null
null
null
core_admin/old_apps/praia/admin.py
linea-it/tno
f973381280504ceb1b606b5b3ccc79b6b8c2aa4f
[ "MIT" ]
112
2018-04-24T19:10:55.000Z
2022-02-26T16:55:02.000Z
core_admin/old_apps/praia/admin.py
linea-it/tno
f973381280504ceb1b606b5b3ccc79b6b8c2aa4f
[ "MIT" ]
null
null
null
# from django.contrib import admin # from .models import (AstrometryAsteroid, AstrometryInput, AstrometryJob, # AstrometryOutput, Configuration, Run) # @admin.register(Run) # class PraiaRunsAdmin(admin.ModelAdmin): # list_display = ('id', 'status', 'owner', 'proccess', 'catalog', 'configuration', # 'start_time', 'finish_time', 'count_objects', 'count_success', 'count_failed', 'count_warning', 'count_not_executed', 'step') # @admin.register(Configuration) # class PraiaConfigAdmin(admin.ModelAdmin): # list_display = ('id', 'displayname', 'owner', 'creation_date', ) # @admin.register(AstrometryAsteroid) # class AstrometryAsteroidAdmin(admin.ModelAdmin): # list_display = ('id', 'astrometry_run', 'name', 'number', 'status', # 'ccd_images', 'catalog_rows', 'execution_time', 'error_msg',) # search_fields = ('name',) # @admin.register(AstrometryInput) # class AstrometryInputAdmin(admin.ModelAdmin): # list_display = ('id', 'asteroid', 'input_type', 'filename', # 'file_size', 'file_type', 'file_path', 'execution_time', 'error_msg',) # @admin.register(AstrometryOutput) # class AstrometryOutputAdmin(admin.ModelAdmin): # list_display = ('id', 'asteroid', 'type', 'catalog', 'ccd_image', 'filename', # 'file_size', 'file_type', 'file_path',) # @admin.register(AstrometryJob) # class AstrometryJobs(admin.ModelAdmin): # list_display = ('id', 'astrometry_run', 'asteroid', 'job_status', 'clusterid', # 'procid', 'submit_time', 'start_time', 'finish_time', 'execution_time')
39.95122
147
0.656899
b76ce747d9ad39846b84e7253d7129870c1f7024
839
cs
C#
MedicalCenter/MedicalCenter.Services/Services/IPatientService.cs
mitkokazakov/Medical-Center
42be0b592b4a6c0512c638931c7ede065cf7d539
[ "MIT" ]
null
null
null
MedicalCenter/MedicalCenter.Services/Services/IPatientService.cs
mitkokazakov/Medical-Center
42be0b592b4a6c0512c638931c7ede065cf7d539
[ "MIT" ]
null
null
null
MedicalCenter/MedicalCenter.Services/Services/IPatientService.cs
mitkokazakov/Medical-Center
42be0b592b4a6c0512c638931c7ede065cf7d539
[ "MIT" ]
null
null
null
using MedicalCenter.Services.ViewModels.Patients; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace MedicalCenter.Services.Services { public interface IPatientService { bool IsPatientProfileCompleted(string userId); bool IsPatientWithCertainEGNExist(string EGN); Task AddPatient(AddPatientFormModel patient, string userId); ChangePatientProfileViewModel ChangePatientInfo(string userId); Task ChangePatient(ChangePatientProfileViewModel model, string userId); PatientProfileViewModel FindPatientByEGN(string egn); //PatientProfileViewModel FindPatientByName(string name); IEnumerable<PatientProfileViewModel> GetAllPatients(); PatientTestsAndDiagnosesViewModel GetPatientMedicalRecord(string patientId); } }
29.964286
84
0.77354
73b1442b0c7730f5a8628fb6446549116dbcf9f3
1,771
dart
Dart
lib/screens/home/components/product_card.dart
Dev-Devarsh/cloth_shop_UI
0647295c9ae8c54c4c754fba5847a691b83c2ce3
[ "Apache-2.0" ]
null
null
null
lib/screens/home/components/product_card.dart
Dev-Devarsh/cloth_shop_UI
0647295c9ae8c54c4c754fba5847a691b83c2ce3
[ "Apache-2.0" ]
null
null
null
lib/screens/home/components/product_card.dart
Dev-Devarsh/cloth_shop_UI
0647295c9ae8c54c4c754fba5847a691b83c2ce3
[ "Apache-2.0" ]
null
null
null
import 'package:flutter/material.dart'; import '../../../constants.dart'; class ProductCard extends StatelessWidget { const ProductCard({ Key? key, required this.image, required this.title, required this.price, required this.press, required this.bgColor, }) : super(key: key); final String image, title; final VoidCallback press; final int price; final Color bgColor; @override Widget build(BuildContext context) { return GestureDetector( onTap: press, child: Container( width: 154, padding: const EdgeInsets.all(defaultPadding / 2), decoration: const BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(defaultBorderRadius)), ), child: Column( children: [ Container( width: double.infinity, decoration: BoxDecoration( color: bgColor, borderRadius: const BorderRadius.all( Radius.circular(defaultBorderRadius)), ), child: Image.asset( image, height: 132, ), ), const SizedBox(height: defaultPadding / 2), Row( children: [ Expanded( child: Text( title, style: const TextStyle(color: Colors.black), ), ), const SizedBox(width: defaultPadding / 4), Text( "\$" + price.toString(), style: Theme.of(context).textTheme.subtitle2, ), ], ) ], ), ), ); } }
26.833333
79
0.498024
4ca931b5c1d51ab72753b7f1fa23ed59ff234209
2,335
lua
Lua
as/tpp/script/common/TppUtility.lua
kapuragu/GzPs3Lua
7d1dfbf8f74e31ed5d78ed8f58e1dbc1e9f24d33
[ "MIT" ]
1
2022-01-28T11:23:18.000Z
2022-01-28T11:23:18.000Z
as/tpp/script/common/TppUtility.lua
kapuragu/GzPs3Lua
7d1dfbf8f74e31ed5d78ed8f58e1dbc1e9f24d33
[ "MIT" ]
null
null
null
as/tpp/script/common/TppUtility.lua
kapuragu/GzPs3Lua
7d1dfbf8f74e31ed5d78ed8f58e1dbc1e9f24d33
[ "MIT" ]
null
null
null
local this = {} --------------------------------------------------------------------------------- -- Public Functions --------------------------------------------------------------------------------- -- Split a string this.SplitString = function( str, pat ) local retVal = {} local index local subStr = str while( true ) do index = string.find( subStr, pat ) if( index == nil ) then table.insert( retVal, subStr ) break else local tmpStr = string.sub( subStr, 0, index - 1 ) table.insert( retVal, tmpStr ) subStr = string.sub( subStr, index + 1 ) end end return retVal end -- Check if an item is included in a table or not this.IsIncluded = function( tbl, item ) for i = 1, #tbl do if( item == tbl[i] ) then return true end end return false end -- Invert a key, value table so the values become keys and keys become values this.InvertTable = function( tbl ) local retVal = {} for k, v in pairs( tbl ) do retVal[v] = k end return retVal end -- Get index of value in table this.GetValueIndex = function( tbl, value ) local invertTable = this.InvertTable( tbl ) return invertTable[value] end -- Find a distance between two Vector3s -- NOTE: does NOT return the sqrt()! Make sure you pass in the square of what you want to check! this.FindDistance = function( point1, point2 ) local x1 = point1:GetX() local y1 = point1:GetY() local z1 = point1:GetZ() local x2 = point2:GetX() local y2 = point2:GetY() local z2 = point2:GetZ() local xDist = ( x2 - x1 ) ^ 2 local yDist = ( y2 - y1 ) ^ 2 local zDist = ( z2 - z1 ) ^ 2 local dist = xDist + yDist + zDist -- Do not do sqrt() because of heavy operation return dist end -- Set preference this.SetPreference = function( prefName, propName, propValue ) local pref = Preference.GetPreferenceEntity( prefName ) if( pref == nil ) then Fox.Warning( "The preference [" .. prefName .. "] does not exist!" ) return end if( pref[propName] == nil ) then Fox.Warning( "The property [" .. propName .. "] does not exist in [" .. prefName .. "]!" ) return end Command.SetProperty{ entity = pref, property = propName, value = propValue } end --------------------------------------------------------------------------------- -- END --------------------------------------------------------------------------------- return this
25.944444
96
0.574732
c146733f131f830cbe047f3acfce3eb2ed1c4dae
3,163
swift
Swift
windmill/Classes/TextDocumentLocation.swift
qnoid/windmill-osx
c8deced8ca7fa391ead4436d34c255810624fae3
[ "FSFAP" ]
27
2020-04-08T08:36:14.000Z
2021-09-15T11:59:01.000Z
windmill/Classes/TextDocumentLocation.swift
qnoid/windmill-osx
c8deced8ca7fa391ead4436d34c255810624fae3
[ "FSFAP" ]
null
null
null
windmill/Classes/TextDocumentLocation.swift
qnoid/windmill-osx
c8deced8ca7fa391ead4436d34c255810624fae3
[ "FSFAP" ]
6
2020-04-08T17:23:06.000Z
2020-05-02T15:22:28.000Z
// // TextDocumentLocation.swift // windmill // // Created by Markos Charatzas (markos@qnoid.com) on 27/2/18. // Copyright © 2014-2020 qnoid.com. All rights reserved. // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // Permission is granted to anyone to use this software for any purpose, // including commercial applications, and to alter it and redistribute it // freely, subject to the following restrictions: // // This software is provided 'as-is', without any express or implied // warranty. In no event will the authors be held liable for any damages // arising from the use of this software. // // 1. The origin of this software must not be misrepresented; you must not // claim that you wrote the original software. If you use this software // in a product, an acknowledgment in the product documentation is required. // 2. Altered source versions must be plainly marked as such, and must not be // misrepresented as being the original software. // 3. This notice may not be removed or altered from any source distribution. // import Foundation @objc(DVTTextDocumentLocation) class TextDocumentLocation: NSObject, NSCoding { var documentURL: URL? let startingColumnNumber: Int let endingColumnNumber: Int let startingLineNumber: Int let endingLineNumber: Int let characterRangeLen: Int let characterRangeLoc: Int init(documentURL: URL = URL(fileURLWithPath: "")) { self.documentURL = documentURL self.startingColumnNumber = 0 self.endingColumnNumber = 0 self.characterRangeLen = 0 self.endingLineNumber = 0 self.startingLineNumber = 0 self.characterRangeLoc = 0 } func encode(with aCoder: NSCoder) { if let path = self.documentURL?.path { aCoder.encode(path, forKey: "documentURL") } aCoder.encode(self.startingColumnNumber, forKey: "startingColumnNumber") aCoder.encode(self.endingColumnNumber, forKey: "endingColumnNumber") aCoder.encode(self.startingLineNumber, forKey: "startingLineNumber") aCoder.encode(self.endingLineNumber, forKey: "endingLineNumber") aCoder.encode(self.characterRangeLen, forKey: "characterRangeLen") aCoder.encode(self.characterRangeLoc, forKey: "characterRangeLoc") } required init?(coder aDecoder: NSCoder) { if let string = aDecoder.decodeObject(forKey: "documentURL") as? String { self.documentURL = URL(string: string) } self.startingColumnNumber = aDecoder.decodeInteger(forKey: "startingColumnNumber") self.endingColumnNumber = aDecoder.decodeInteger(forKey: "endingColumnNumber") self.startingLineNumber = aDecoder.decodeInteger(forKey: "startingLineNumber") self.endingLineNumber = aDecoder.decodeInteger(forKey: "endingLineNumber") self.characterRangeLen = aDecoder.decodeInteger(forKey: "characterRangeLen") self.characterRangeLoc = aDecoder.decodeInteger(forKey: "characterRangeLoc") } }
41.077922
90
0.709137
dbdfd02d4229d6dd87f034454a1a5df701eeded5
2,558
php
PHP
app/Http/Controllers/Auth/LoginController.php
honarmandpooria/tootiko
45c5879a320e0b586b74d2017a9f70bebb982b71
[ "MIT" ]
null
null
null
app/Http/Controllers/Auth/LoginController.php
honarmandpooria/tootiko
45c5879a320e0b586b74d2017a9f70bebb982b71
[ "MIT" ]
null
null
null
app/Http/Controllers/Auth/LoginController.php
honarmandpooria/tootiko
45c5879a320e0b586b74d2017a9f70bebb982b71
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use App\User; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Str; use Laravel\Socialite\Facades\Socialite; class LoginController extends Controller { /* |-------------------------------------------------------------------------- | Login Controller |-------------------------------------------------------------------------- | | This controller handles authenticating users for the application and | redirecting them to your home screen. The controller uses a trait | to conveniently provide its functionality to your applications. | */ use AuthenticatesUsers; /** * Where to redirect users after login. * * @var string */ protected $redirectTo = '/home'; /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('guest')->except('logout'); } //GOOGLE LOGIN API /** * Redirect the user to the google authentication page. * * @return \Illuminate\Http\Response */ public function redirectToProvider() { return Socialite::driver('google')->redirect(); } /** * Obtain the user information from google. * * @param Request $request * @return \Illuminate\Http\Response */ public function handleProviderCallback(Request $request) { $userSocial = Socialite::driver('google')->user(); $findUser = User::where('email', $userSocial->email)->first(); if ($findUser) { Auth::loginUsingId($findUser->id); } else { $input = []; $input['email'] = $userSocial->email; $input['name'] = $userSocial->name; $input['password'] = bcrypt(Str::random(20)); $input['email_verified_at'] = now(); $registeredUser = User::create($input); Auth::loginUsingId($registeredUser->id); } return redirect('/home'); } public function authenticated(Request $request, $user) { if (Auth::user()->role->id == 1 && Auth::check() && Auth::user()->role->name == 'boss') { return redirect('/admin-home'); } elseif (Auth::user()->role->id == 2) { return redirect('/translator-home'); } else { return redirect('/home'); } } }
22.839286
97
0.548866
5ce4def114d848057227e619821a75f03455fa5e
815
kt
Kotlin
app/src/main/java/com/pawegio/homebudget/picker/PickerViewModel.kt
pawegio/HomeBudget
2cc3da1c06fc928a4c2934e15f41a70525bbd4df
[ "Apache-2.0" ]
2
2020-01-31T19:46:39.000Z
2020-03-20T22:54:10.000Z
app/src/main/java/com/pawegio/homebudget/picker/PickerViewModel.kt
pawegio/HomeBudget
2cc3da1c06fc928a4c2934e15f41a70525bbd4df
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/pawegio/homebudget/picker/PickerViewModel.kt
pawegio/HomeBudget
2cc3da1c06fc928a4c2934e15f41a70525bbd4df
[ "Apache-2.0" ]
4
2020-01-31T19:46:42.000Z
2022-01-09T19:35:47.000Z
package com.pawegio.homebudget.picker import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.jakewharton.rxrelay2.PublishRelay import com.pawegio.homebudget.HomeBudgetRepository import com.pawegio.homebudget.Navigator import com.pawegio.homebudget.util.HowToLauncher import kotlinx.coroutines.launch class PickerViewModel( private val howToLauncher: HowToLauncher, private val repository: HomeBudgetRepository, private val navigator: Navigator, ) : ViewModel() { val actions = PublishRelay.create<PickerAction>() init { viewModelScope.launch { PickerLogic( actions, howToLauncher, repository, ::parseSpreadsheetId, navigator, ) } } }
26.290323
53
0.687117
e0046625187232af9464cd7cf988e660a2c00542
37,545
php
PHP
application/views/control_view.php
Ical852/CI---e-commerce-web-scrapping
7b4c7026ed9a0c1c765931799ca10a1ba8a5a543
[ "MIT" ]
null
null
null
application/views/control_view.php
Ical852/CI---e-commerce-web-scrapping
7b4c7026ed9a0c1c765931799ca10a1ba8a5a543
[ "MIT" ]
null
null
null
application/views/control_view.php
Ical852/CI---e-commerce-web-scrapping
7b4c7026ed9a0c1c765931799ca10a1ba8a5a543
[ "MIT" ]
null
null
null
<div class="col-md-10 col-lg-10 col-sm-10 col-xs-12 float-right-style"> <!-- col lanjutan menu --> <div class="cart-main-area ptb--20 bg__white"> <div class="container-fluid"> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="table-content table-responsive"> <!-- Data Produk --> <div class="container"> <h1><b>Control Data Produk</b></h1><br> <div class="main-content"> <div class="main-content-inner"> <div class="page-content"> <div class="row"> <div class="col-md-10 col-lg-12 col-sm-10 col-xs-10"> <div class="clearfix"> </div> <!-- BATAS HEADER TITLE --> <div class="ln_solid"></div> <!--DATAGRID BERDASARKAN DATA YANG AKAN KITA TAMPILKAN --> <table id="datatable" class="table table-striped table-bordered" style="width: 100%"> <thead> <tr> <th class="center" width="5%">No</th> <th class="center" width="15%">Kategori Cabe</th> <th class="center" width="15%">Nama Cabe</th> <th class="center" width="20%">gambar</th> <th class="center" width="15%">Harga</th> <th class="center" width="15%">Stok</th> <th class="center" > <a href="# " class="tooltip-info" title="Tambah" style="text-decoration: none;"> <span class="blue"><button class="btn btn-primary ace-icon fa fa-search-plus bigger-120"><b>Tambah Data</b></button></span></a> </th> </tr> </thead> <tr> <td align="center"></td> <td></td> <td align="center"></td> </tr> </table> <!-- BATAS DATAGRID BERDASARKAN DATA YANG AKAN KITA TAMPILKAN --> </div> </div> </div> </div> </div> <div class="modal fade" id="m_kategori" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header no-padding"> <div class="table-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span class="white">&times;</span> </button> Data Cabe </div> </div> <div class="modal-body"> <form name="f_kategori" id="f_kategori" action="" enctype="multipart/form-data"> <input type="hidden" name="txtIdCabe" id="txtIdCabe" value=""> <div id="konfirmasi"></div> <table class="table-form"> <tr><td style="width: 25%">Kategori Cabe</td> <td style="width: 75%"> <select style="width: 100%" type="text" class="form-control" name="txtKategoriCabe" id="txtKategoriCabe" required=""> <option value="cabe merah">Cabe Merah</option> <option value="cabe ijo">Cabe Ijo</option> <option value="cabe pedes">Cabe Pedes</option> <option value="cabe lain">Cabe Lain</option> </select> </td> </tr> <tr><td style="width: 25%">Nama Cabe</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtNamaCabe" id="txtNamaCabe" required=""> </td> </tr> <tr><td style="width: 25%">Harga</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtHarga" id="txtHarga" required=""> </td> </tr> <tr><td style="width: 25%">Stok</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtStok" id="txtStok" required=""> </td> </tr> </table> </div> <div class="modal-footer"> <button class="btn btn-white btn-info btn-bold" type="button" id="btnSimpan" name="btnSimpan"> <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i> Simpan</button> <button class="btn btn-white btn-default btn-round" data-dismiss="modal" aria-hidden="true"> <i class="fa fa-minus-circle"></i> Tutup</button> </div> </form> </div> </div> </div> <!-- Hapus Modal --> <div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header no-padding"> <div class="table-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span class="white"> &times; </span> </button> Hapus Data </div> </div> <div class="modal-body"> <div id="konfirmasihapus"></div> </div> <div class="modal-footer"> <a href="#" data-dismiss="modal" class="btn btn-white btn-default btn-round"> <i class="fa fa-minus-circle"></i> Tutup </a> </div> </form> </div> </div> </div> </div> <!-- Data Produk --> <!-- Data Keluar Masuk Produk --> <div class="modal fade" id="m_kategorimasuk" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header no-padding"> <div class="table-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span class="white">&times;</span> </button> Pemasukkan </div> </div> <div class="modal-body"> <form name="f_kategori" id="f_kategori" action=""> <input type="hidden" name="txtKodeMasuk" id="txtKodeMasuk" value=""> <div id="konfirmasimasuk"></div> <table class="table-form"> <tr><td style="width: 25%">Tanggal</td> <td style="width: 75%"> <input style="width: 100%" type="date" class="form-control" name="txtDate" id="txtDate" required> </td> </tr> <tr><td style="width: 25%">Kategori Cabe</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtKategoriCabeMasuk" id="txtKategoriCabeMasuk" required readonly=""> </td> </tr> <tr><td style="width: 25%">Nama Cabe</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtNamaCabeMasuk" id="txtNamaCabeMasuk" required readonly=""> </td> </tr> <tr><td style="width: 25%">Jumlah Masuk</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtJumlahMasuk" id="txtJumlahMasuk" required> </td> </tr> <tr><td style="width: 25%">Keterangan</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtKeterangan" id="txtKeterangan" required> </td> </tr> </table> </div> <div class="modal-footer"> <button class="btn btn-white btn-info btn-bold" type="button" id="btnSimpanMasuk" name="btnSimpanMasuk"> <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i> Simpan</button> <button class="btn btn-white btn-default btn-round" data-dismiss="modal" aria-hidden="true"> <i class="fa fa-minus-circle"></i> Tutup</button> </div> </form> </div> </div> </div> <div class="modal fade" id="m_kategorikeluar" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header no-padding"> <div class="table-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span class="white">&times;</span> </button> Pengeluaran </div> </div> <div class="modal-body"> <form name="f_kategori" id="f_kategori" action=""> <input type="hidden" name="txtKodeKeluar" id="txtKodeKeluar" value=""> <div id="konfirmasikeluar"></div> <table class="table-form"> <tr><td style="width: 25%">Tanggal</td> <td style="width: 75%"> <input style="width: 100%" type="date" class="form-control" name="txtDateKeluar" id="txtDateKeluar" required> </td> </tr> <tr><td style="width: 25%">Kategori Cabe</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtKategoriCabeKeluar" id="txtKategoriCabeKeluar" required readonly=""> </td> </tr> <tr><td style="width: 25%">Nama Cabe</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtNamaCabeKeluar" id="txtNamaCabeKeluar" required readonly=""> </td> </tr> <tr><td style="width: 25%">Jumlah Keluar</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtJumlahKeluar" id="txtJumlahKeluar" required> </td> </tr> <tr><td style="width: 25%">Keterangan</td> <td style="width: 75%"> <input style="width: 100%" type="text" class="form-control" name="txtKeteranganKeluar" id="txtKeteranganKeluar" required> </td> </tr> </table> </div> <div class="modal-footer"> <button class="btn btn-white btn-info btn-bold" type="button" id="btnSimpanKeluar" name="btnSimpanKeluar"> <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i> Simpan</button> <button class="btn btn-white btn-default btn-round" data-dismiss="modal" aria-hidden="true"> <i class="fa fa-minus-circle"></i> Tutup</button> </div> </form> </div> </div> </div> <!-- Data Keluar Masuk Produk --> <!-- ganti gambar --> <div class="modal fade" id="ganti" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Upload Gambar</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <?php echo form_open_multipart('control/ganti'); ?><br> <input class="hidden" type="text" name="nama_cabe" id="nama_cabe" readonly> <input type="file" name="img" id="img"><br> <p>"Make The Name of The Picture Easier Please"</p> </div> <div class="modal-footer"> <button type="submit" class="btn btn-white btn-info btn-bold" name="btnGanti" id="btnGanti"><i class="ace-icon fa fa-floppy-o bigger-120 blue"></i> Ganti</button> <button type="button" class="btn btn-white btn-default btn-round" data-dismiss="modal"><i class="fa fa-minus-circle"></i> Tutup</button> <?php echo form_close(); ?> </div> </div> </div> </div> <!-- ganti gambar --> </div> </form> </div> </div> </div> </div> <!-- penutup col menu --> </div> <!-- penutup menu --> </div> </div> </div><br> </section> <script> $(document).ready(function() { $.fn.dataTable.ext.errMode = 'none'; var myTable =$('#datatable').DataTable({ "ajax": { type : "POST", url : "<?php echo base_url(); ?>control/daftar_data/", data : function(d) { }}, "columnDefs": [ { "visible": false, "targets": [7], "searchable": false } ], select: { style: 'multi' } }); $('#datatable tbody').on( 'click', '.fa-trash-o', function () { var jawab; obj= $(this).parents('tr'); id = myTable.row( $(this).parents('tr') ).data()[7]; jawab=confirm("Apakah yakin untuk menghapus record \n"+ "Perlengkapan: "+myTable.row( $(this).parents('tr') ).data()[2]+"?"); if (jawab==false){ exit(); } console.log(id); $.post( "<?php echo base_url(); ?>control/hapus/", { id:id }, function( data ) { obj = $.parseJSON(data); $("#myModal3").modal('show'); if (obj.msg[0]=="hapus"){ $('#konfirmasihapus').html( '<div class="alert alert-success alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Hapus Data</strong><br/>'+obj.msg[1]+ '</div>'); setTimeout(function() { $('#konfirmasihapus').html(''); $("#myModal3").modal('hide'); },2000); myTable.ajax.reload(); } else { $('#konfirmasihapus').html( '<div class="alert alert-danger alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Error</strong><br/>'+obj.msg[1]+ '</div>'); } }); }); $('#datatable thead').on( 'click', '.fa-search-plus', function () { $("#m_kategori").modal('show'); $('#txtIdCabe').val(''); $('#txtKategoriCabe').val(''); $('#txtNamaCabe').val(''); $('#txtGambar').val(''); $('#txtHarga').val(''); $('#txtStok').val(''); }); $('#datatable tbody').on( 'click', '.fa-pencil-square-o', function () { $("#m_kategori").modal('show'); nama = myTable.row( $(this).parents('tr') ).data()[1]; nama1 = myTable.row( $(this).parents('tr') ).data()[2]; nama2 = myTable.row( $(this).parents('tr') ).data()[4]; nama3 = myTable.row( $(this).parents('tr') ).data()[5]; id = myTable.row( $(this).parents('tr') ).data()[7]; $('#txtKategoriCabe').val(nama); $('#txtNamaCabe').val(nama1); $('#txtHarga').val(nama2); $('#txtStok').val(nama3); $('#txtIdCabe').val(id); myTable.ajax.reload(); }); $('#datatable tbody').on( 'click', '.fa-download', function () { $("#m_kategorimasuk").modal('show'); nama = myTable.row( $(this).parents('tr') ).data()[1]; nama1 = myTable.row( $(this).parents('tr') ).data()[2]; nama2 = myTable.row( $(this).parents('tr') ).data()[4]; nama3 = myTable.row( $(this).parents('tr') ).data()[5]; nama4 = myTable.row( $(this).parents('tr') ).data()[6]; id = myTable.row( $(this).parents('tr') ).data()[7]; $('#txtKategoriCabeMasuk').val(nama); $('#txtNamaCabeMasuk').val(nama1); $('#txtKodeMasuk').val(id); myTable.ajax.reload(); }); $('#datatable tbody').on( 'click', '.fa-share-square-o', function () { $("#m_kategorikeluar").modal('show'); nama = myTable.row( $(this).parents('tr') ).data()[1]; nama1 = myTable.row( $(this).parents('tr') ).data()[2]; nama2 = myTable.row( $(this).parents('tr') ).data()[4]; nama3 = myTable.row( $(this).parents('tr') ).data()[5]; nama4 = myTable.row( $(this).parents('tr') ).data()[6]; id = myTable.row( $(this).parents('tr') ).data()[7]; $('#txtKategoriCabeKeluar').val(nama); $('#txtNamaCabeKeluar').val(nama1); $('#txtKodeKeluar').val(id); myTable.ajax.reload(); }); $('#datatable tbody').on( 'click', '.fa-picture-o', function () { $("#ganti").modal('show'); kode = myTable.row( $(this).parents('tr') ).data()[7]; $('#nama_cabe').val(kode); myTable.ajax.reload(); }); $('#btnSimpan').click(function(){ $.post( "<?php echo base_url(); ?>control/add/", { type:1, txtIdCabe:$('#txtIdCabe').val(), txtKategoriCabe:$('#txtKategoriCabe').val(), txtNamaCabe:$('#txtNamaCabe').val(), txtHarga:$('#txtHarga').val(), txtStok:$('#txtStok').val() }, function( data ) { console.log(data); obj = $.parseJSON(data); if (obj.msg[0]=="repeat"){ $('#konfirmasi').html( '<div class="alert alert-danger alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Error</strong><br/>'+obj.msg[1]+ '</div>'); setTimeout(function() { $('#konfirmasi').html(''); },3000); } else if (obj.msg[0]=="update"){ $('#konfirmasi').html( '<div class="alert alert-success alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Sukses</strong><br/>'+obj.msg[1]+ '</div>'); setTimeout(function() { $('#konfirmasi').html(''); },2000); myTable.ajax.reload(); } else if (obj.msg[0]=="ok"){ $('#konfirmasi').html( '<div class="alert alert-success alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Sukses</strong><br/>'+obj.msg[1]+ '</div>'); setTimeout(function() { $('#konfirmasi').html(''); },2000); $('#txtIdCabe').val(''); $('#txtKategoriCabe').val(''); $('#txtNamaCabe').val(''); $('#txtHarga').val(''); $('#txtStok').val(''); myTable.ajax.reload(); } else { $('#konfirmasi').html( '<div class="alert alert-danger alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Error</strong><br/>'+obj.msg[1]+ '</div>'); } }); }); $('#btnSimpanMasuk').click(function(){ $.post( "<?php echo base_url(); ?>controlmasuk/add/", { type:1, txtKodeMasuk:$('#txtKodeMasuk').val(), txtDate:$('#txtDate').val(), txtKategoriCabeMasuk:$('#txtKategoriCabeMasuk').val(), txtNamaCabeMasuk:$('#txtNamaCabeMasuk').val(), txtJumlahMasuk:$('#txtJumlahMasuk').val(), txtKeterangan:$('#txtKeterangan').val() }, function( data ) { console.log(data); obj = $.parseJSON(data); if (obj.msg[0]=="repeat"){ $('#konfirmasimasuk').html( '<div class="alert alert-danger alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Error</strong><br/>'+obj.msg[1]+ '</div>'); setTimeout(function() { $('#konfirmasimasuk').html(''); },3000); } else if (obj.msg[0]=="ok"){ $('#konfirmasimasuk').html( '<div class="alert alert-success alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Sukses</strong><br/>'+obj.msg[1]+ '</div>'); setTimeout(function() { $('#konfirmasimasuk').html(''); },2000); $('#txtDate').val(''); $('#txtJumlahMasuk').val(''); $('#txtKeterangan').val(''); myTable.ajax.reload(); } else { $('#konfirmasimasuk').html( '<div class="alert alert-danger alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Error</strong><br/>'+obj.msg[1]+ '</div>'); } }); }); $('#btnSimpanKeluar').click(function(){ $.post( "<?php echo base_url(); ?>controlkeluar/add/", { type:1, txtKodeKeluar:$('#txtKodeKeluar').val(), txtDateKeluar:$('#txtDateKeluar').val(), txtKategoriCabeKeluar:$('#txtKategoriCabeKeluar').val(), txtNamaCabeKeluar:$('#txtNamaCabeKeluar').val(), txtJumlahKeluar:$('#txtJumlahKeluar').val(), txtKeteranganKeluar:$('#txtKeteranganKeluar').val() }, function( data ) { console.log(data); obj = $.parseJSON(data); if (obj.msg[0]=="repeat"){ $('#konfirmasikeluar').html( '<div class="alert alert-danger alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Error</strong><br/>'+obj.msg[1]+ '</div>'); setTimeout(function() { $('#konfirmasikeluar').html(''); },3000); } else if (obj.msg[0]=="ok"){ $('#konfirmasikeluar').html( '<div class="alert alert-success alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Sukses</strong><br/>'+obj.msg[1]+ '</div>'); setTimeout(function() { $('#konfirmasikeluar').html(''); },2000); $('#txtDateKeluar').val(''); $('#txtJumlahKeluar').val(''); $('#txtKeteranganKeluar').val(''); myTable.ajax.reload(); } else { $('#konfirmasikeluar').html( '<div class="alert alert-danger alert-dismissible fade in" role="alert">'+ ' <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+ ' <strong>Error</strong><br/>'+obj.msg[1]+ '</div>'); } }); }); }); </script>
60.556452
205
0.316713
0d4d0b337387c28846de4a1d2590bb8c9b2b7d8f
1,827
dart
Dart
lib/models/list.dart
noAudio/uhandisi
e5d2170d648e0bea67184f0eb9ae9b5b2b9d767a
[ "MIT" ]
2
2022-02-25T05:56:19.000Z
2022-03-03T16:35:37.000Z
lib/models/list.dart
noAudio/uhandisi
e5d2170d648e0bea67184f0eb9ae9b5b2b9d767a
[ "MIT" ]
9
2022-02-26T18:57:07.000Z
2022-03-03T16:43:01.000Z
lib/models/list.dart
noAudio/uhandisi
e5d2170d648e0bea67184f0eb9ae9b5b2b9d767a
[ "MIT" ]
null
null
null
import 'dart:convert'; import 'package:collection/collection.dart'; import 'package:intl/intl.dart'; import 'package:uhandisi/models/material_item.dart'; class MaterialList { String? title; List<MaterialItem> list; DateTime date; MaterialList({ this.title, required this.list, required this.date, }) { // If no title is given, the current date and time is used instead. title ??= "${date.day} ${DateFormat('MMM').format(date)} ${date.year} (${date.hour}:${date.minute})"; } MaterialList copyWith({ String? title, List<MaterialItem>? list, DateTime? date, }) { return MaterialList( title: title ?? this.title, list: list ?? this.list, date: date ?? this.date, ); } Map<String, dynamic> toMap() { return { 'title': title, 'list': list.map((x) => x.toMap()).toList(), 'date': date.millisecondsSinceEpoch, }; } factory MaterialList.fromMap(Map<String, dynamic> map) { return MaterialList( title: map['title'], list: List<MaterialItem>.from( map['list']?.map((x) => MaterialItem.fromMap(x))), date: DateTime.fromMillisecondsSinceEpoch(map['date']), ); } String toJson() => json.encode(toMap()); factory MaterialList.fromJson(String source) => MaterialList.fromMap(json.decode(source)); @override String toString() => 'MaterialList(title: $title, list: $list, date: $date)'; @override bool operator ==(Object other) { if (identical(this, other)) return true; final listEquals = const DeepCollectionEquality().equals; return other is MaterialList && other.title == title && listEquals(other.list, list) && other.date == date; } @override int get hashCode => title.hashCode ^ list.hashCode ^ date.hashCode; }
25.027397
99
0.629995
be703d5862d9a4a82c1b6e64ba04b623b24ef4d3
265
ts
TypeScript
src/shared/audio/common/controller.ts
jportela/electric-player
867dbd788970ced8775d91daae32d3b0e3a17391
[ "MIT" ]
null
null
null
src/shared/audio/common/controller.ts
jportela/electric-player
867dbd788970ced8775d91daae32d3b0e3a17391
[ "MIT" ]
null
null
null
src/shared/audio/common/controller.ts
jportela/electric-player
867dbd788970ced8775d91daae32d3b0e3a17391
[ "MIT" ]
null
null
null
export const PLAY_SONG_COMMAND = 'play-song'; export const STOP_COMMAND = 'stop'; export interface IStopResult { currentTime: number; } export interface IAudioController { playSong(id: string, seek?: number): Promise<void>; stop(): Promise<IStopResult>; }
20.384615
53
0.739623
0a6a8550c3dac5c60921898a5c7ca58519a426d7
551
cs
C#
resources/csharp-essential-materials/006_StaticClasses/002_StaticClass/Static2/Program.cs
6e3veR6k/codewars-csharp
611de8583fe31e0663238d9ad4fab93bd12e165a
[ "MIT" ]
null
null
null
resources/csharp-essential-materials/006_StaticClasses/002_StaticClass/Static2/Program.cs
6e3veR6k/codewars-csharp
611de8583fe31e0663238d9ad4fab93bd12e165a
[ "MIT" ]
null
null
null
resources/csharp-essential-materials/006_StaticClasses/002_StaticClass/Static2/Program.cs
6e3veR6k/codewars-csharp
611de8583fe31e0663238d9ad4fab93bd12e165a
[ "MIT" ]
null
null
null
using System; // Паттерн проектирования - Singleton. namespace Static { class Program { static void Main() { // Конструктор "protected" - невозможно использовать - new Singleton() Singleton instance1 = Singleton.Instance(); Singleton instance2 = Singleton.Instance(); if (instance1 == instance2) Console.WriteLine("Ссылки указывают на один экземпляр объекта."); // Delay. Console.ReadKey(); } } }
23.956522
93
0.540835