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
sequencelengths 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
sequencelengths 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
sequencelengths 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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
572b3be5aca0d9973a5f2675cbddca2b65212a08 | 4,694 | js | JavaScript | lib/mllib/fpm/FPGrowth.js | danielsan/eclairjs-node | 0dd5bcc0c08de8116a6a21d5c64789ea35b12179 | [
"Apache-2.0"
] | null | null | null | lib/mllib/fpm/FPGrowth.js | danielsan/eclairjs-node | 0dd5bcc0c08de8116a6a21d5c64789ea35b12179 | [
"Apache-2.0"
] | null | null | null | lib/mllib/fpm/FPGrowth.js | danielsan/eclairjs-node | 0dd5bcc0c08de8116a6a21d5c64789ea35b12179 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2016 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Utils = require('../../utils.js');
var FPGrowthModel = require('./FPGrowthModel.js');
var gKernelP;
/**
* A parallel FP-growth algorithm to mine frequent itemsets. The algorithm is described in
* [[http://dx.doi.org/10.1145/1454008.1454027 Li et al., PFP: Parallel FP-Growth for Query
* Recommendation]]. PFP distributes computation in such a way that each worker executes an
* independent group of mining tasks. The FP-Growth algorithm is described in
* [[http://dx.doi.org/10.1145/335191.335372 Han et al., Mining frequent patterns without candidate
* generation]].
*
* @param minSupport the minimal support level of the frequent pattern, any pattern appears
* more than (minSupport * size-of-the-dataset) times will be output
* @param numPartitions number of partitions used by parallel FP-growth
*
* @see [[http://en.wikipedia.org/wiki/Association_rule_learning Association rule learning
* (Wikipedia)]]
*
* @classdesc
*/
/**
* Constructs a default instance with default parameters {minSupport: `0.3`, numPartitions: same
* as the input data}.
*
* @returns {??}
* @class
*/
function FPGrowth(kernelP, refIdP) {
if (kernelP && refIdP) {
this.kernelP = kernelP;
this.refIdP = refIdP;
} else {
this.kernelP = gKernelP;
var templateStr = 'var {{refId}} = new FPGrowth();';
this.refIdP = Utils.evaluate(gKernelP, FPGrowth, templateStr, null, true);
}
}
/**
* Sets the minimal support level (default: `0.3`).
*
* @param {float} minSupport
* @returns {FPGrowth}
*/
FPGrowth.prototype.setMinSupport = function(minSupport) {
var templateStr = 'var {{refId}} = {{inRefId}}.setMinSupport({{minSupport}});';
return Utils.generateAssignment(this, FPGrowth, templateStr, {minSupport: minSupport});
};
/**
* Sets the number of partitions used by parallel FP-growth (default: same as input data).
*
* @param {integer} numPartitions
* @returns {FPGrowth}
*/
FPGrowth.prototype.setNumPartitions = function(numPartitions) {
var templateStr = 'var {{refId}} = {{inRefId}}.setNumPartitions({{numPartitions}});';
return Utils.generateAssignment(this, FPGrowth, templateStr, {numPartitions: numPartitions});
};
/**
* Computes an FP-Growth model that contains frequent itemsets.
* @param {RDD} data input data set, each element contains a transaction
*
* @returns {FPGrowthModel} an [[FPGrowthModel]]
*/
FPGrowth.prototype.run = function(data) {
var templateStr = 'var {{refId}} = {{inRefId}}.run({{data}});';
return Utils.generateAssignment(this, FPGrowthModel, templateStr, {data: Utils.prepForReplacement(data)});
};
/**
* Frequent itemset. param: items items in this itemset. Java users should call javaItems() instead. param: freq frequency
* @classdesc
* @param {object} items
* @param {integer} freq
* @constructor
*/
function FreqItemset(items, freq) {
this.kernelP = kernelP;
var templateStr = freq ? 'var {{refId}} = new FreqItemset({{items}}, {{freq}});' : 'var {{refId}} = new FreqItemset({{items}});';
this.refIdP = Utils.evaluate(kernelP, FreqItemset, templateStr, {items: Utils.prepForReplacement(items), freq: freq}, true);
}
FreqItemset.prototype.items = function() {
function _resolve(result, resolve, reject) {
try {
// take returns a stringified json result so parse it here
resolve(JSON.parse(result));
} catch (e) {
var err = new Error("Parse Error: "+ e.message);
reject(err);
}
}
var templateStr = 'JSON.stringify({{inRefId}}.items());';
return Utils.generateResultPromise(this, templateStr, null, _resolve);
};
/**
*
* @returns {integer}
*/
FreqItemset.prototype.freq = function() {
function _resolve(result, resolve, reject) {
try {
resolve(parseFloat(result));
} catch (e) {
var err = new Error("Parse Error: "+ e.message);
reject(err);
}
}
var templateStr = '{{inRefId}}.freq();';
return Utils.generateResultPromise(this, templateStr, null, _resolve);
};
FPGrowth.FreqItemset = FreqItemset;
module.exports = function(kP) {
gKernelP = kP;
return FPGrowth;
};
| 30.089744 | 131 | 0.689604 |
8d0b3f30028f81bdf5d8668afd4a35073fe8d0a7 | 2,366 | cs | C# | src/RoadCaptain.Runner/InGameNavigationWindow.xaml.cs | sandermvanvliet/RoadCaptain | 0bac44962d74d12a74adec7e480faf07d8740180 | [
"Artistic-2.0"
] | 1 | 2022-03-25T22:27:52.000Z | 2022-03-25T22:27:52.000Z | src/RoadCaptain.Runner/InGameNavigationWindow.xaml.cs | sandermvanvliet/RoadCaptain | 0bac44962d74d12a74adec7e480faf07d8740180 | [
"Artistic-2.0"
] | 1 | 2022-03-26T15:38:26.000Z | 2022-03-26T17:36:18.000Z | src/RoadCaptain.Runner/InGameNavigationWindow.xaml.cs | sandermvanvliet/RoadCaptain | 0bac44962d74d12a74adec7e480faf07d8740180 | [
"Artistic-2.0"
] | null | null | null | // Copyright (c) 2022 Sander van Vliet
// Licensed under Artistic License 2.0
// See LICENSE or https://choosealicense.com/licenses/artistic-2.0/
using System;
using System.Windows;
using System.Windows.Input;
using RoadCaptain.GameStates;
using RoadCaptain.Ports;
using RoadCaptain.Runner.ViewModels;
using Point = System.Drawing.Point;
namespace RoadCaptain.Runner
{
/// <summary>
/// Interaction logic for InGameNavigationWindow.xaml
/// </summary>
// ReSharper disable once RedundantExtendsListEntry
public partial class InGameNavigationWindow : Window
{
private readonly MonitoringEvents _monitoringEvents;
private InGameNavigationWindowViewModel _viewModel;
public InGameNavigationWindow(IGameStateReceiver gameStateReceiver,
MonitoringEvents monitoringEvents)
{
_monitoringEvents = monitoringEvents;
InitializeComponent();
gameStateReceiver.Register(
null,
null,
GameStateReceived);
}
private void Window_OnMouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
DragMove();
}
}
private void InGameNavigationWindow_OnInitialized(object sender, EventArgs e)
{
if (AppSettings.Default.InGameWindowLocation != Point.Empty)
{
Left = AppSettings.Default.InGameWindowLocation.X;
Top = AppSettings.Default.InGameWindowLocation.Y;
}
}
private void InGameNavigationWindow_OnLocationChanged(object sender, EventArgs e)
{
AppSettings.Default.InGameWindowLocation = new Point((int)Left, (int)Top);
AppSettings.Default.Save();
}
private void InGameNavigationWindow_OnActivated(object sender, EventArgs e)
{
_viewModel = DataContext as InGameNavigationWindowViewModel;
}
private void GameStateReceived(GameState gameState)
{
try
{
_viewModel.UpdateGameState(gameState);
}
catch (Exception e)
{
_monitoringEvents.Error(e, "Failed to update game state");
}
}
}
}
| 30.333333 | 89 | 0.617498 |
448226b0b0bb3e7dfc88ffd8561110cbae44b23e | 941 | py | Python | gpu_watchdog.py | AlphaGoMK/GPU_Watchdog | 01aa3370d4521d800c23a8afe396e4424a94b77e | [
"MIT"
] | null | null | null | gpu_watchdog.py | AlphaGoMK/GPU_Watchdog | 01aa3370d4521d800c23a8afe396e4424a94b77e | [
"MIT"
] | null | null | null | gpu_watchdog.py | AlphaGoMK/GPU_Watchdog | 01aa3370d4521d800c23a8afe396e4424a94b77e | [
"MIT"
] | null | null | null | import GPUtil
import time
import datetime
import argparse
import sys
import requests
parser = argparse.ArgumentParser()
parser.add_argument('--threshold', type=int, default=1024, help='GPU memory threshold (MB)')
parser.add_argument('--index', type=int, default=0, help='Index of the GPU to be monitored')
opt = parser.parse_args()
sckey = '' # your sckey
assert sckey != '' # No sckey is given
li = []
while True:
gpu = GPUtil.getGPUs()[opt.index]
li.append(gpu.memoryUsed < opt.threshold)
if sum(li) > 5:
now = datetime.datetime.now()
err_info = 'GPU mem drop @ %s'%(now.strftime('%b %d %H:%M'))
try:
requests.get('https://sc.ftqq.com/%s.send?text=%s'%(sckey, err_info.replace(' ', '_').replace(':', '_')))
except:
print('Send error')
print('\033[31m%s\033[0m'%err_info)
sys.exit(0)
elif len(li) > 5:
del li[0]
time.sleep(1)
| 29.40625 | 117 | 0.609989 |
c6f175b70fd25d8633c97d3d0d59465e21251689 | 978 | py | Python | example/apps/buttons/methods/Buttons.py | NinjaDero/Directly | bb241b49c54c8a1510438f955b39d1785594cc64 | [
"MIT"
] | 4 | 2015-03-09T10:50:05.000Z | 2020-07-02T17:22:37.000Z | example/apps/buttons/methods/Buttons.py | NinjaDero/Directly | bb241b49c54c8a1510438f955b39d1785594cc64 | [
"MIT"
] | null | null | null | example/apps/buttons/methods/Buttons.py | NinjaDero/Directly | bb241b49c54c8a1510438f955b39d1785594cc64 | [
"MIT"
] | null | null | null | from Directly import Ext
@Ext.cls
class Buttons():
@staticmethod
@Ext.method
def ping(request):
return "Pong!"
@staticmethod
@Ext.method
def reverse(request, text):
return text[::-1]
@staticmethod
@Ext.method
def full_caps(request, text):
all_caps = Buttons.make_caps(text)
return all_caps
@staticmethod
@Ext.method
def full_lows(request, text):
all_lows = Buttons.make_lows(text)
return all_lows
# Not included, remains hidden to Ext.direct.Manager
# You don't have to separate your exposed and hidden methods, if you don't want to.
# They can also not be called if the Manager is edited manually
@staticmethod
def make_caps(_text):
if 'upper' in dir(_text):
_text = _text.upper()
return _text
@staticmethod
def make_lows(_text):
if 'lower' in dir(_text):
_text = _text.lower()
return _text | 23.853659 | 87 | 0.621677 |
bdd0a52523eb607702b0a32c71b9f6f7819b2597 | 1,156 | gemspec | Ruby | dry-struct-rails.gemspec | fnordfish/dry-struct-rails | 093c8b4e220305cdd5d5d0a52b4d2f2bb805ec5b | [
"MIT"
] | 2 | 2017-11-29T15:56:30.000Z | 2017-11-29T16:55:22.000Z | dry-struct-rails.gemspec | fnordfish/dry-struct-rails | 093c8b4e220305cdd5d5d0a52b4d2f2bb805ec5b | [
"MIT"
] | null | null | null | dry-struct-rails.gemspec | fnordfish/dry-struct-rails | 093c8b4e220305cdd5d5d0a52b4d2f2bb805ec5b | [
"MIT"
] | null | null | null | # coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "dry/struct/rails/version"
Gem::Specification.new do |spec|
spec.name = "dry-struct-rails"
spec.version = Dry::Struct::Rails::VERSION
spec.authors = ["Robert Schulze"]
spec.email = ["[email protected]"]
spec.summary = %q{Dry::Struct railties}
spec.description = %q{Rails reloading for `dry-struct`}
spec.homepage = "https://github.com/fnordfish/dry-struct-rails"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_development_dependency "bundler", "~> 1.15"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "combustion", "~> 0.7.0"
spec.add_development_dependency "rspec-rails", "~> 3.7"
spec.add_runtime_dependency "rails", ">= 5.1"
spec.add_runtime_dependency "dry-struct", "~> 0.4.0"
end
| 36.125 | 74 | 0.647924 |
af71b19523456cf3eb111125d5b90857585c2b94 | 309 | py | Python | problems/linkedlist/Solution206.py | akalu/cs-problems-python | 9b1bd8e3932be62135a38a77f955ded9a766b654 | [
"MIT"
] | null | null | null | problems/linkedlist/Solution206.py | akalu/cs-problems-python | 9b1bd8e3932be62135a38a77f955ded9a766b654 | [
"MIT"
] | null | null | null | problems/linkedlist/Solution206.py | akalu/cs-problems-python | 9b1bd8e3932be62135a38a77f955ded9a766b654 | [
"MIT"
] | null | null | null | """
Reverse a singly linked list.
Example:
Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL
// 4 -> 5 -> 6
//prev cur nextTemp
// 4 -> 5 -> 6
// prev cur nextTemp
"""
class Solution206:
pass
| 17.166667 | 57 | 0.375405 |
4b78a561e47fe37063b4d7b32c57d9033532bfb0 | 1,415 | cpp | C++ | examples/EnsembledCrash.cpp | acpaquette/deepstate | 6acf07ad5dd95c9e8b970ca516ab93aa2620ea6e | [
"Apache-2.0"
] | 684 | 2018-02-18T18:04:23.000Z | 2022-03-26T06:18:39.000Z | examples/EnsembledCrash.cpp | acpaquette/deepstate | 6acf07ad5dd95c9e8b970ca516ab93aa2620ea6e | [
"Apache-2.0"
] | 273 | 2018-02-18T04:01:36.000Z | 2022-02-09T16:07:38.000Z | examples/EnsembledCrash.cpp | acpaquette/deepstate | 6acf07ad5dd95c9e8b970ca516ab93aa2620ea6e | [
"Apache-2.0"
] | 77 | 2018-02-19T00:18:33.000Z | 2022-03-16T04:12:09.000Z | /*
* Copyright (c) 2019 Trail of Bits, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <deepstate/DeepState.hpp>
using namespace deepstate;
DEEPSTATE_NOINLINE static void segfault(char *first, char* second) {
std::size_t hashed = std::hash<std::string>{}(first);
std::size_t hashed2 = std::hash<std::string>{}(second);
unsigned *p = NULL;
if (hashed == 7169420828666634849U) {
if (hashed2 == 10753164746288518855U) {
*(p+2) = 0xdeadbeef; /* crash */
}
printf("BOM\n");
}
}
TEST(SimpleCrash, SegFault) {
char *first = (char*)DeepState_CStr_C(9, 0);
char *second = (char*)DeepState_CStr_C(9, 0);
for (int i = 0; i < 9; ++i)
printf("%02x", (unsigned char)first[i]);
printf("\n");
for (int i = 0; i < 9; ++i)
printf("%02x", (unsigned char)second[i]);
segfault(first, second);
ASSERT_EQ(first, first);
ASSERT_NE(first, second);
}
| 28.877551 | 75 | 0.671378 |
c6c489cf147b8641580a70ffd119e11fef35075b | 5,840 | py | Python | LMA_emulator/LMA_slidingWindow_data.py | Bhare8972/LOFAR-LMA-Emulator | 5d82ba6a5ec7c361d958d7edd1335c2ea753ac46 | [
"Apache-2.0"
] | null | null | null | LMA_emulator/LMA_slidingWindow_data.py | Bhare8972/LOFAR-LMA-Emulator | 5d82ba6a5ec7c361d958d7edd1335c2ea753ac46 | [
"Apache-2.0"
] | null | null | null | LMA_emulator/LMA_slidingWindow_data.py | Bhare8972/LOFAR-LMA-Emulator | 5d82ba6a5ec7c361d958d7edd1335c2ea753ac46 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
from os import mkdir, remove
from os.path import isdir
from datetime import datetime, timezone, timedelta
#import struct
import numpy as np
from LoLIM.utilities import processed_data_dir, v_air
from LoLIM.IO.raw_tbb_IO import filePaths_by_stationName, MultiFile_Dal1, read_station_delays, read_antenna_pol_flips, read_bad_antennas, read_antenna_delays
from LoLIM.IO.metadata import ITRF_to_geoditic
from LoLIM.findRFI import window_and_filter
from LoLIM.interferometry import read_interferometric_PSE as R_IPSE
from LoLIM.getTrace_fromLoc import getTrace_fromLoc
from LoLIM.signal_processing import remove_saturation, upsample_and_correlate, parabolic_fit, num_double_zeros, data_cut_inspan, locate_data_loss
from LoLIM.signal_processing import parabolic_fitter
from LMA_window_data import writer_manager, antenna_symbols
def window_data(TBB_data, filter, edge_length, start_sample_number, end_sample_number, amp_tresh, num_dataLoss_zeros, max_num_antennas, data_writer_manager,
inject_T_noise=None):
## note, the clock noise is one value per all pulses on station
if inject_T_noise is not None:
clock_noise = np.random.normal(scale=inject_T_noise)
else:
clock_noise = 0.0
ITRFantenna_locations = TBB_data.get_ITRF_antenna_positions()
antenna_names = TBB_data.get_antenna_names()
sname = TBB_data.get_station_name()
num_ants = len(ITRFantenna_locations)
posix_timestamp = TBB_data.get_timestamp()
num_station_antennas = len(ITRFantenna_locations)
num_ants = min(int(num_station_antennas/2),max_num_antennas )
antennas_to_use = np.arange( num_ants )*2
writers = []
for antI in antennas_to_use:
name = antenna_names[ antI ]
lat_lon_alt = ITRF_to_geoditic( ITRFantenna_locations[antI] )
writers.append( data_writer_manager.get_next_writer(name, lat_lon_alt, posix_timestamp ) )
antenna_start_times = TBB_data.get_time_from_second()
antenna_start_times += clock_noise
#### allocate memory ####
blocksize = filter.blocksize
data_loss_segments = [ [] ]*num_station_antennas ## note: length of all antennas in station, not just antennas to load
workspace = np.empty( blocksize, dtype=np.complex )
data_blocks = np.empty( (num_station_antennas,blocksize), dtype=np.double )## note: length of all antennas in station, not just antennas to load
current_samples = np.empty( num_station_antennas, dtype=np.int ) ## note: length of all antennas in station, not just antennas to load
#### initialize data
def load_data_block(ant_i, sample_number):
sample_number -= edge_length
TMP = TBB_data.get_data(sample_number, blocksize, antenna_index=ant_i )
data_loss_spans, DL = locate_data_loss(TMP, num_dataLoss_zeros)
workspace[:] = TMP
workspace[:] = filter.filter( workspace )
np.abs(workspace, out = data_blocks[ant_i,:])
data_loss_segments[ant_i] = data_loss_spans
current_samples[ant_i] = sample_number
return data_blocks[ant_i, edge_length:-edge_length], len(data_loss_spans)>0
for ant_i in antennas_to_use:
load_data_block( ant_i, start_sample_number )
print_width = 10 ## number of blocks
bin_width = int( (80e-6)/(5e-9) )
half_bin_width = int( bin_width/2 )
nominal_blocksize = blocksize - 2*edge_length - bin_width
number_blocks = ((end_sample_number-start_sample_number)/nominal_blocksize) + 1
blocks_total = 0
blocks_found = 0
last_pulse_10us_index = None
current_sample = start_sample_number
last_peak_time = None
while current_sample<end_sample_number:
blocks_total += 1
if not blocks_total % print_width:
print(sname, blocks_total, blocks_total/number_blocks )
for ant_i,writer in zip(antennas_to_use,writers):
data, has_dataloss = load_data_block(ant_i, current_sample)
if has_dataloss:
continue
local_start_time = current_sample*5.0E-9 + antenna_start_times[ant_i]
blocks_found += 1
start_i = half_bin_width
if (last_peak_time is not None) and ((local_start_time + start_i*5e-9) < last_peak_time ):
start_i = int( (last_peak_time-local_start_time)/5e-9 ) + 1
for i in range(half_bin_width, len(data)-half_bin_width):
if data[i] > amp_tresh:
window = data[i-half_bin_width:i+half_bin_width]
AM = np.argmax( window )
if AM == half_bin_width :
peak_time = local_start_time + i*5.0E-9
pulse_10us_index = int( (peak_time-int(peak_time))/(10e-6) )
if (last_pulse_10us_index is None or pulse_10us_index != last_pulse_10us_index) and (last_peak_time is None or (peak_time-last_peak_time)>(40e-6) ) :
if (last_peak_time is not None) and peak_time<last_peak_time:
print("giggles McDukes!")
quit()
writer.write_pulse( peak_time )
last_peak_time = peak_time
last_pulse_10us_index = pulse_10us_index
break
current_sample += nominal_blocksize
for w in writers:
w.finalize()
return blocks_found/blocks_total
| 37.922078 | 173 | 0.643493 |
1851548ff4bcc0bba8f59a89f020e8437d68dd26 | 559 | lua | Lua | API/CovenantCallings.lua | MrMartinZockt/vscode-lua-wow | b279bc1528f28f45befb2760b08475d698a39fd7 | [
"MIT"
] | 3 | 2020-06-03T01:59:19.000Z | 2020-10-11T01:55:26.000Z | API/CovenantCallings.lua | MrMartin92/vscode-lua-wow | b279bc1528f28f45befb2760b08475d698a39fd7 | [
"MIT"
] | 2 | 2020-01-25T14:16:05.000Z | 2020-01-25T14:22:06.000Z | API/CovenantCallings.lua | MrMartinZockt/vscode-lua-wow | b279bc1528f28f45befb2760b08475d698a39fd7 | [
"MIT"
] | 1 | 2020-06-03T01:59:31.000Z | 2020-06-03T01:59:31.000Z | -- !!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!
-- This file is automaticly generated. Don't edit manualy!
-- !!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!
---@class C_CovenantCallings
C_CovenantCallings = {}
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantCallings.AreCallingsUnlocked)
---@return boolean @unlocked
function C_CovenantCallings.AreCallingsUnlocked()
end
---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantCallings.RequestCallings)
function C_CovenantCallings.RequestCallings()
end
| 32.882353 | 97 | 0.667263 |
9cf3b32a57631b903543b9ce4d6fbca782c27783 | 347 | swift | Swift | PokerEvaluator/UnitTests/Mocks/MockGameScorer.swift | davejlin/PokerEvaluator | 76e41b448c7b3a1e73df3ac227ea5a9d8b922bda | [
"Unlicense"
] | 1 | 2017-10-24T00:23:24.000Z | 2017-10-24T00:23:24.000Z | PokerEvaluator/UnitTests/Mocks/MockGameScorer.swift | davejlin/PokerEvaluator | 76e41b448c7b3a1e73df3ac227ea5a9d8b922bda | [
"Unlicense"
] | null | null | null | PokerEvaluator/UnitTests/Mocks/MockGameScorer.swift | davejlin/PokerEvaluator | 76e41b448c7b3a1e73df3ac227ea5a9d8b922bda | [
"Unlicense"
] | null | null | null | //
// MockGameScorer.swift
// PokerEvaluator
//
// Created by Lin David, US-20 on 8/21/17.
// Copyright © 2017 Lin David, US-20. All rights reserved.
//
import Foundation
class MockGameScorer: GameScorerProtocol {
var isScoreCalled = false
func score(of cards: [Card]) -> Int {
isScoreCalled = true
return 0;
}
}
| 19.277778 | 59 | 0.645533 |
6f5d04bcfe1ad429e87048cf49644854b564ce7e | 654 | php | PHP | common/models/Questions.php | giicms/yii2-job-mongodb | d997f67e428ebf508381b88474e51347e5818cc4 | [
"BSD-3-Clause",
"MIT"
] | null | null | null | common/models/Questions.php | giicms/yii2-job-mongodb | d997f67e428ebf508381b88474e51347e5818cc4 | [
"BSD-3-Clause",
"MIT"
] | null | null | null | common/models/Questions.php | giicms/yii2-job-mongodb | d997f67e428ebf508381b88474e51347e5818cc4 | [
"BSD-3-Clause",
"MIT"
] | null | null | null | <?php
namespace common\models;
use Yii;
use yii\base\NotSupportedException;
use yii\mongodb\ActiveRecord;
use yii\web\IdentityInterface;
/**
* Questions model
*
* @property string $content
*/
class Questions extends ActiveRecord {
public static function tableName() {
return [ 'questions'];
}
public function rules() {
return [
[['content'], 'required']
];
}
public function attributes() {
return [
'_id',
'content'
];
}
public function attributeLabels() {
return [
'content' => 'Nội dung câu hỏi',
];
}
}
| 15.95122 | 44 | 0.54893 |
384eef51f378a54ec33ad527f5ac3350dcbc9745 | 1,781 | php | PHP | app/Mms/Application/Materias/Queries/ListarMateriasQueryResult.php | kaiomarques/boxmms_web | 14e6da8f16cbb713693f68f8c2e8f21e326554c6 | [
"MIT"
] | null | null | null | app/Mms/Application/Materias/Queries/ListarMateriasQueryResult.php | kaiomarques/boxmms_web | 14e6da8f16cbb713693f68f8c2e8f21e326554c6 | [
"MIT"
] | null | null | null | app/Mms/Application/Materias/Queries/ListarMateriasQueryResult.php | kaiomarques/boxmms_web | 14e6da8f16cbb713693f68f8c2e8f21e326554c6 | [
"MIT"
] | null | null | null | <?php namespace App\Mms\Application\Materias\Queries;
use App\Mms\Application\Shared\Queries\CollectionQueryResult;
class ListarMateriasQueryResult extends CollectionQueryResult
{
private $paginacao;
public function __construct(array $materias, ListarMateriasQueryResultPaginacao $paginacao)
{
parent::__construct($materias);
$this->paginacao = $paginacao;
}
protected function handle($materia)
{
return array(
"blnk" => "",
"cliente_list" => $this->handleClientes($materia->getClientes()),
"data" => $materia->getData(),
"data_cadastro" => $materia->getDataDeCadasttro(),
"dia" => $materia->getDia(),
"emissora_nome" => $materia->getEmissora(),
"id" => $materia->getId(),
"id_materia_radiotv_jornal" => $materia->getMateriaId(),
"id_operador" => $materia->getOperador(),
"id_programa" => $materia->getPrograma(),
"id_projeto" => $materia->getProjeto(),
"nome_operador" => $materia->getOperadorNome(),
"programa_nome" => $materia->getProgramaNome(),
"status" => $materia->getStatus(),
"titulo" => $materia->getTitulo());
}
private function handleClientes($clientes)
{
if (!isset($clientes) || empty($clientes))
return "";
$lista = explode(",", $clientes);
if (count($lista) < 1)
return "";
$outrosClientesQuantidade = count($lista) - 1;
$complemento = $outrosClientesQuantidade < 1 ? "" : " + {$outrosClientesQuantidade} cliente(s)";
return "{$lista[0]}{$complemento}";
}
public function getPaginacao()
{
return $this->paginacao;
}
}
| 31.245614 | 104 | 0.580573 |
489240a5d6ab7946d2288fbd32e8a8541cb5a64d | 534 | sql | SQL | db/Visitante/sp_visitante_add.sql | WilmoMorandeDeodato/Hotel-Restaurante-Golai | ce646176c55a729c83a35a13b33431aed2d872bf | [
"CC-BY-3.0"
] | null | null | null | db/Visitante/sp_visitante_add.sql | WilmoMorandeDeodato/Hotel-Restaurante-Golai | ce646176c55a729c83a35a13b33431aed2d872bf | [
"CC-BY-3.0"
] | null | null | null | db/Visitante/sp_visitante_add.sql | WilmoMorandeDeodato/Hotel-Restaurante-Golai | ce646176c55a729c83a35a13b33431aed2d872bf | [
"CC-BY-3.0"
] | null | null | null | DROP PROCEDURE sp_visitante_add;
DELIMITER //
CREATE PROCEDURE sp_visitante_add(
v_id_hotel INT,
v_ip VARCHAR(15),
v_navegador VARCHAR(30),
v_sistema VARCHAR(30)
)
BEGIN
DECLARE v_auto_id INT;
SELECT COUNT(id_visitante) + 1 FROM tb_visitante INTO v_auto_id;
INSERT
INTO tb_visitante(
id_visitante, id_hotel, ip, navegador, sistema, data_ace
)
VALUES(
v_auto_id, v_id_hotel, v_ip, v_navegador, v_sistema, NOW()
);
END //
DELIMITER ;
CALL sp_visitante_add(1,'','',''); | 25.428571 | 65 | 0.679775 |
dbe34b28121a0a755b2dd71d131a7ed9101f0a05 | 1,252 | php | PHP | app/Http/Controllers/StudentController.php | AminulCSE/Laravel7AjaxCRUD | f316204a4c9c3d11f35b53c7729f11d5e1870d99 | [
"MIT"
] | null | null | null | app/Http/Controllers/StudentController.php | AminulCSE/Laravel7AjaxCRUD | f316204a4c9c3d11f35b53c7729f11d5e1870d99 | [
"MIT"
] | null | null | null | app/Http/Controllers/StudentController.php | AminulCSE/Laravel7AjaxCRUD | f316204a4c9c3d11f35b53c7729f11d5e1870d99 | [
"MIT"
] | null | null | null | <?php
namespace App\Http\Controllers;
use App\Student;
use Illuminate\Http\Request;
class StudentController extends Controller
{
public function index(){
$students = Student::orderBy('id', 'DESC')->get();
return view('students', compact('students'));
}
public function addStudent(Request $request){
$student = new Student();
$student->firstname = $request->firstname;
$student->lastname = $request->lastname;
$student->email = $request->email;
$student->phone = $request->phone;
$student->save();
return response()->json();
}
public function getStudentById($id){
$student = Student::find($id);
return response()->json($student);
}
public function updateStudent(Request $request){
$student = Student::find($request->id);
$student->firstname = $request->firstname;
$student->lastname = $request->lastname;
$student->email = $request->email;
$student->phone = $request->phone;
$student->save();
return response()->json($student);
}
public function deleteStudent($id){
$student = Student::find($id);
$student->delete();
return response()->json(['success'=>'record is successfully deleted']);
}
}
| 26.083333 | 76 | 0.627796 |
e2276f9a3a6d51e31f6fa4d77cfffd8a30ff5c23 | 1,959 | py | Python | remorse/wavegen.py | jhobbs/morsegen | 771b8bb38fd3ad6f94d775edc00323dd0b42f566 | [
"Apache-2.0"
] | 2 | 2016-05-27T04:08:50.000Z | 2016-05-27T12:48:59.000Z | remorse/wavegen.py | jhobbs/remorse | 771b8bb38fd3ad6f94d775edc00323dd0b42f566 | [
"Apache-2.0"
] | null | null | null | remorse/wavegen.py | jhobbs/remorse | 771b8bb38fd3ad6f94d775edc00323dd0b42f566 | [
"Apache-2.0"
] | null | null | null | import itertools
import math
from pyaudio import PyAudio
BITRATE = 16000
FADE_LENGTH = 0.003
FADE_FRAMES = int(BITRATE * FADE_LENGTH)
MAX_AMPLITUDE = 127
def sine(frequency, length):
"""Generate a sine wave in 8-bit unsigned PCM format.
Uses linear fading at the beginning and end to avoid click noise.
Good reference on how simple digital sound generation works:
http://www.cs.nmsu.edu/~rth/cs/computermusic/Simple%20sound%20generation.html
We use s_n = (a * sin(2*pi*f*n/sr)) + 128 where:
- n is the sample number.
- s_n is sample n.
- f is frequency in hertz.
- sr is the sample rate in samples per second.
- a is the amplitude in the range of 0 to 127.
Adding 128 serves to center the samples at 128, which is silence in 8-bit
unsigned PCM format.
"""
wave_data = ''
number_of_frames = int(BITRATE * length)
factor = (float(frequency) * (math.pi * 2)) / BITRATE
for n in xrange(number_of_frames):
if n < FADE_FRAMES:
amplitude_factor = float(n) / FADE_FRAMES
elif number_of_frames - n < FADE_FRAMES:
amplitude_factor = float(number_of_frames - n) / FADE_FRAMES
else:
amplitude_factor = 1
amplitude = MAX_AMPLITUDE * amplitude_factor
zero_centered = int(math.sin(n * factor) * amplitude)
wave_data += chr(zero_centered + 128)
return wave_data
def silence(length):
wave_data = ''
number_of_frames = int(BITRATE * length)
for x in xrange(number_of_frames):
wave_data += chr(128)
return wave_data
def play(wave_data):
chunk_size = BITRATE/10
p = PyAudio()
stream = p.open(format = p.get_format_from_width(1),
channels = 1,
rate = BITRATE,
output = True)
for chunk in itertools.islice(wave_data, chunk_size):
stream.write(chunk)
stream.stop_stream()
stream.close()
p.terminate()
| 28.808824 | 81 | 0.64829 |
a49e04604c4f6f785f282528a5ebe210af1c15ff | 1,985 | php | PHP | resources/views/contract/show.blade.php | trananh46/Project-TourReservation | 7f66c3b92f98982a011b0bbfd263d44afea20279 | [
"MIT"
] | null | null | null | resources/views/contract/show.blade.php | trananh46/Project-TourReservation | 7f66c3b92f98982a011b0bbfd263d44afea20279 | [
"MIT"
] | null | null | null | resources/views/contract/show.blade.php | trananh46/Project-TourReservation | 7f66c3b92f98982a011b0bbfd263d44afea20279 | [
"MIT"
] | 1 | 2021-09-01T06:48:35.000Z | 2021-09-01T06:48:35.000Z | @extends('layout.app')
@section('content')
<div class="content">
<div class="container">
<div class="row">
<h2 class="text-center">Tên Tour : {{ $hoadon->nameTour }}</h2>
<h4 class="text-center">Ngày Khởi Hành : {{ $hoadon->ngayKhoiHanh }} --- Ngày Kết Thúc : {{ $hoadon->ngayKetThuc }}</h4>
<h4 class="text-center">Số Chỗ Còn : {{ $hoadon->soLuongNguoi }}</h4>
<div class="text-center">
<img src="{{ URL::to($hoadon->anhTour) }}" width="800px">
</div>
<h2 >Thông Tin Khách Hàng</h2>
<br>
<div>
<h6>Tên Khách Hàng</h6>
<input type="text" value="{{ $hoadon->nameKhachHang }}" disabled class="form-control">
<br>
<h6>SĐT</h6>
<input type="text" value="{{ $hoadon->sdt }}" disabled class="form-control">
<br>
<h6>Số Lượng Người Lớn</h6>
<input type="text" value="{{ $hoadon->soLuongNguoiLon }}" disabled class="form-control">
<br>
<h6>Số Lượng Trẻ Em</h6>
<input type="text" value="{{ $hoadon->soLuongTreEm }}" disabled class="form-control">
<br>
<h6>Ngày Đặt Tour</h6>
<input type="text" value="{{ $hoadon->ngayDatTour }}" disabled class="form-control">
<br>
<h6>Tổng Giá Tiền</h6>
<input type="text" value="{{ $hoadon->tongTien }}" disabled class="form-control">
<br>
<h6>Ghi Chú</h6>
<textarea cols="30" rows="5" disabled class="form-control">{{ $hoadon->ghiChu }}</textarea>
<br>
</div>
</div>
</div>
</div>
<br>
@endsection | 39.7 | 136 | 0.435768 |
e76d9f5ca719936d151c0a1fecd79d9c619ddf75 | 4,406 | php | PHP | app/Http/Controllers/EditorjsController.php | MwSpaceLLC/tickets | d527cb6ad5080bbc831b63cf55277b2a7d86ab8e | [
"MIT"
] | 1 | 2019-09-21T15:56:08.000Z | 2019-09-21T15:56:08.000Z | app/Http/Controllers/EditorjsController.php | MwSpaceLLC/tickets | d527cb6ad5080bbc831b63cf55277b2a7d86ab8e | [
"MIT"
] | null | null | null | app/Http/Controllers/EditorjsController.php | MwSpaceLLC/tickets | d527cb6ad5080bbc831b63cf55277b2a7d86ab8e | [
"MIT"
] | 1 | 2019-11-09T12:56:35.000Z | 2019-11-09T12:56:35.000Z | <?php
namespace App\Http\Controllers;
use App\Department;
use App\Mail\NewTicket;
use App\TicketReply;
use App\Tickets;
use App\TicketsAttach;
use App\User;
use Illuminate\Database\Query\Builder;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use shweshi\OpenGraph\OpenGraph;
use function GuzzleHttp\Promise\all;
class EditorjsController extends Controller
{
public function __construct()
{
$this->middleware('checkroles');
}
public function image(Request $request)
{
if ($request->url) {
return response()->json([
'success' => 1,
'file' => [
'url' => $request->url
]
]);
}
$filepath = Storage::disk('public')->put('tickets/images/', $request->file('image'));
return response()->json([
'success' => 1,
'file' => [
'url' => url("storage/$filepath")
]
]);
}
public function attaches(Request $request)
{
// return Log::info($request);
$filepath = Storage::disk('public')->put('tickets/attaches/', $request->file('file'));
return response()->json([
'success' => 1,
'file' => [
'url' => url("storage/$filepath"),
'name' => $request->file('file')->getClientOriginalName()
]
]);
}
public function link(Request $request)
{
$OpenGraph = new OpenGraph();
$data = (object)$OpenGraph->fetch($request->url);
return response()->json([
'success' => 1,
'meta' => [
'title' => isset($data->title) ? $data->title : 'titolo',
'description' => isset($data->description) ? $data->description : 'description',
'image' => [
'url' => isset($data->image) ? $data->image : 'image',
],
]
]);
}
public function save(Request $request)
{
if (!\auth()->user()->department()->first()) {
return response()->json(['message' => __('Non hai i permessi di scrittura per il reparto. Torna indietro')], 403);
}
$ticket = Tickets::findOrFail($request->id);
if ($ticket->whereHas('department', function ($query) {
$query->where('status', 0);
})->first()) {
return response()->json(['message' => __('il reparto in questione è momentaneamente non disponibile')], 403);
}
if (!$department = $ticket->department()->first()->user()->where('user_id', auth()->id())->first()) {
return response()->json(['message' => __('access denied a questo reparto')], 403);
}
if (!$department->write) {
return response()->json(['message' => __('non hai i permessi di scrittura per questo reparto')], 403);
}
if (empty($request->data['blocks'])) {
return response()->json(['message' => __('non puoi pubblicare risposte vuote')], 401);
}
$ticketReply = new TicketReply();
$ticketReply->user_id = \auth()->id();
$ticketReply->ticket_id = $request->id;
$ticketReply->row = serialize($request->data['blocks']);
$ticketReply->save();
$author = Tickets::find($request->id)->user()->first();
$ticket = Tickets::find($request->id);
$notAuthor = \auth()->id() !== $author->id;
if ($notAuthor) {
/**
* Send mail to ticket request mail author
*/
Mail::to($author->email)->send(new NewTicket($ticket));
} else {
/**
* Send mail to all listener peaple
*/
$users = User::all();
$department = $ticket->department()->first();
foreach ($users as $user) {
$role = $user->department()->where('department_id', $department->id)->first();
if ($role && $role->listen > 0) {
if ($user->id !== $author->id) {
Mail::to($user->email)->send(new NewTicket($ticket));
}
}
}
}
return response()->json('success');
}
}
| 28.61039 | 126 | 0.508398 |
208bfeae42cdf85549ab8759d1c05ca821d1cd5d | 2,307 | cs | C# | Source/Pablo/Formats/Rip/FormatRip.cs | christianvozar/pablodraw | 56011d8b579e00ced41e6c4a6a02c155d125bbc1 | [
"MIT"
] | 3 | 2019-11-01T23:42:19.000Z | 2020-07-31T13:43:07.000Z | Source/Pablo/Formats/Rip/FormatRip.cs | christianvozar/pablodraw | 56011d8b579e00ced41e6c4a6a02c155d125bbc1 | [
"MIT"
] | null | null | null | Source/Pablo/Formats/Rip/FormatRip.cs | christianvozar/pablodraw | 56011d8b579e00ced41e6c4a6a02c155d125bbc1 | [
"MIT"
] | null | null | null | using System;
using System.IO;
using System.Text;
using Eto.Drawing;
using Pablo.BGI;
using Eto;
using System.Collections.Generic;
using Eto.Forms;
namespace Pablo.Formats.Rip
{
public class FormatRip : Animated.AnimatedFormat
{
public static Encoding Encoding = Encoding.GetEncoding (437);
public FormatRip (DocumentInfo info) : base(info, "rip", "RIPscrip", "rip")
{
}
public override bool DetectAnimation (Stream stream)
{
// rip always should be shown with animation
return true;
}
public override bool CanSave { get { return true; } }
public void Save (Stream stream, RipDocument document)
{
var writer = new RipWriter (stream);
foreach (var command in document.Commands) {
command.Write (writer);
}
writer.WriteNewCommand ("#|#|#");
writer.WriteNewLine();
}
public void Load (Stream stream, RipDocument document, RipHandler handler)
{
var reader = new BinaryReader (stream);
var commands = document.Commands;
commands.Clear ();
bool lastEnableZoom = true;
/*
*/
if (document.AnimateView && Application.Instance != null) {
document.BGI.DelayDraw = true; // for faster animation
Application.Instance.Invoke (delegate {
//lastEnableZoom = handler.EnableZoom;
#if DESKTOP
//handler.EnableZoom = false;
#endif
});
}
try {
var args = new WaitEventArgs ();
while (true) {
if (document.AnimateView) {
document.OnWait (args);
if (args.Exit)
break;
}
byte b = reader.ReadRipByte ();
/*
*/
if (b == (byte)'|') {
string op = ((char)reader.ReadRipByte ()).ToString ();
if (op == "1")
op += ((char)reader.ReadRipByte ());
else if (op == "#")
break; // done reading rip!
var command = RipCommands.Create (op, document);
if (command != null) {
command.Read (reader);
command.Apply ();
if (command.Store)
commands.Add (command);
}
}
/*
*/
}
} catch (EndOfStreamException) {
} finally {
if (document.AnimateView && Application.Instance != null) {
Application.Instance.Invoke (delegate {
if (document.AnimateView) {
//handler.EnableZoom = lastEnableZoom;
}
});
}
}
}
}
}
| 22.617647 | 77 | 0.606849 |
af91089c95e4ed7d63c9f6848966cba3c13704d1 | 1,259 | py | Python | tests/task/test_can_task.py | jha929/pyMODI | 6175e6579b7fab4d26a8add852bbc8357eb8bf30 | [
"MIT"
] | 2 | 2020-11-25T03:20:12.000Z | 2020-11-25T03:20:14.000Z | tests/task/test_can_task.py | jha929/pyMODI | 6175e6579b7fab4d26a8add852bbc8357eb8bf30 | [
"MIT"
] | null | null | null | tests/task/test_can_task.py | jha929/pyMODI | 6175e6579b7fab4d26a8add852bbc8357eb8bf30 | [
"MIT"
] | null | null | null | import json
import unittest
from queue import Queue
from modi.task.can_task import CanTask
from modi.util.msgutil import parse_message
class MockCan:
def __init__(self):
self.recv_buffer = Queue()
def recv(self, timeout):
json_pkt = parse_message(0x03, 0, 1)
return CanTask.compose_can_msg(json.loads(json_pkt))
def send(self, item):
self.recv_buffer.put(item)
class TestCanTask(unittest.TestCase):
"""Tests for 'CanTask' class"""
def setUp(self):
"""Set up test fixtures, if any."""
self.can_task = CanTask()
self.can_task._bus = MockCan()
def tearDown(self):
"""Tear down test fixtures, if any."""
del self.can_task
CanTask._instances.clear()
def test_recv(self):
"""Test _recv_data method"""
self.assertEqual(self.can_task.recv(), parse_message(0x03, 0, 1))
def test_send(self):
"""Test _send_data method"""
json_pkt = parse_message(0x03, 0, 1)
self.can_task.send(json_pkt)
self.assertEqual(self.can_task.bus.recv_buffer.get().data,
CanTask.compose_can_msg(json.loads(json_pkt)).data
)
if __name__ == "__main__":
unittest.main()
| 25.693878 | 75 | 0.625894 |
5864fd816f8cf0a73ca50dba76ef83c4019f4659 | 281 | lua | Lua | scripts/globals/items/scroll_of_regen_ii.lua | zircon-tpl/topaz | dc2f7e68e5ed84274976e8a787c29fe03eecc382 | [
"FTL"
] | 1 | 2021-10-30T11:30:33.000Z | 2021-10-30T11:30:33.000Z | scripts/globals/items/scroll_of_regen_ii.lua | zircon-tpl/topaz | dc2f7e68e5ed84274976e8a787c29fe03eecc382 | [
"FTL"
] | 2 | 2020-07-01T04:11:03.000Z | 2020-07-02T03:54:24.000Z | scripts/globals/items/scroll_of_regen_ii.lua | zircon-tpl/topaz | dc2f7e68e5ed84274976e8a787c29fe03eecc382 | [
"FTL"
] | 1 | 2020-07-01T05:31:49.000Z | 2020-07-01T05:31:49.000Z | -----------------------------------------
-- ID: 4718
-- Scroll of Regen II
-- Teaches the white magic Regen II
-----------------------------------------
function onItemCheck(target)
return target:canLearnSpell(110)
end
function onItemUse(target)
target:addSpell(110)
end | 21.615385 | 41 | 0.523132 |
0dfc642156154b0dfdae0c64ce6da72203d6fe86 | 234 | cs | C# | ThirtyRails/Logic/CenterTile.cs | MadCowDevelopment/ThirtyRails | a043ba3cefd2b70f8ee882a5624cf4a85591e337 | [
"MIT"
] | null | null | null | ThirtyRails/Logic/CenterTile.cs | MadCowDevelopment/ThirtyRails | a043ba3cefd2b70f8ee882a5624cf4a85591e337 | [
"MIT"
] | null | null | null | ThirtyRails/Logic/CenterTile.cs | MadCowDevelopment/ThirtyRails | a043ba3cefd2b70f8ee882a5624cf4a85591e337 | [
"MIT"
] | null | null | null | namespace ThirtyRails.Logic
{
public class CenterTile : Tile
{
public CenterTile(int id) : base(id)
{
}
public bool IsMountain { get; set; }
public bool IsMine { get; set; }
}
} | 15.6 | 44 | 0.534188 |
3f90daf23eb0c0bb94f597b63df854585be07cd2 | 2,122 | php | PHP | application/views/homepage/Footer.php | milhamsuryapratama/wisata-web | 73fcba853b473768977b4668c17d0b3fb992f0ca | [
"MIT"
] | 1 | 2019-06-20T02:30:53.000Z | 2019-06-20T02:30:53.000Z | application/views/homepage/Footer.php | milhamsuryapratama/wisata-web | 73fcba853b473768977b4668c17d0b3fb992f0ca | [
"MIT"
] | null | null | null | application/views/homepage/Footer.php | milhamsuryapratama/wisata-web | 73fcba853b473768977b4668c17d0b3fb992f0ca | [
"MIT"
] | 2 | 2019-06-19T07:19:19.000Z | 2022-02-18T10:46:05.000Z | <!-- Section Footer -->
<section class="section-footer">
<div class="texture-handler-top"></div>
<div class="row">
<div class="col-left">
<p>Copyright © 2019</p>
<p>Jl. Raya Panglima Sudirman No.134, Patokan, Kraksaan, Probolinggo, Jawa Timur 67282</p>
<a href="#" target="_blank"><span
class="ion-social-facebook icon-social"></span></a>
<a href="#" target="_blank"><span
class="ion-social-instagram icon-social"></span></a>
<a href="#" target="_blank"><span
class="ion-social-twitter icon-social"></span></a>
</div>
<div class="col-right">
<b>PAGES</b>
<ul>
<li><a href="<?=base_url()?>destinasi">Destination</a></li>
<li><a href="<?=base_url()?>akomodasi">Akomodasi</a></li>
<li><a href="<?=base_url()?>kuliner">Kuliner</a></li>
<li><a href="<?=base_url()?>news">News</a></li>
</ul>
</div>
<div class="col-right">
<b>PARTNERS</b>
<ul>
<li><a href="#">Kabupaten Probolinggo</a></li>
<li><a href="#">Endless Probolinggo</a></li>
</ul>
</div>
<!-- <div class="col-right">
<b>EXPERIENCE</b>
<ul>
<li><a href="#">Natural</a></li>
<li><a href="#">Culture</a></li>
<li><a href="#">Religi</a></li>
<li><a href="#">Culnary</a></li>
<li><a href="#">Adventure</a></li>
</ul>
</div> -->
</div>
<div class="footer-bottom">
<p>Diskominfo Kabupaten Probolinggo <span class="ion-heart red"></span></p>
</div>
</section>
<script type="text/javascript" src="<?=base_url()?>assets/homepage/js/jquery.js"></script>
<!-- Bootstrap Core Js -->
<script src="<?php echo base_url(); ?>assets/adminBSB/plugins/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="<?=base_url()?>assets/homepage/js/main.js"></script>
<script type="text/javascript" src="<?=base_url()?>assets/homepage/js/swipe.js"></script>
<script src="<?php echo base_url(); ?>assets/adminBSB/plugins/light-gallery/js/lightgallery-all.js"></script>
<script src="<?php echo base_url(); ?>assets/adminBSB/js/pages/medias/image-gallery.js"></script>
</body>
</html> | 37.22807 | 110 | 0.594251 |
00728235d9760fb4809394e01807ade95936a6bc | 298 | lua | Lua | announce/server.lua | CarterParker/Server-announcement-script | b03bb99dbc9e7eb86780d2721bd4902d4481d07b | [
"MIT"
] | null | null | null | announce/server.lua | CarterParker/Server-announcement-script | b03bb99dbc9e7eb86780d2721bd4902d4481d07b | [
"MIT"
] | null | null | null | announce/server.lua | CarterParker/Server-announcement-script | b03bb99dbc9e7eb86780d2721bd4902d4481d07b | [
"MIT"
] | null | null | null | -- script created by C. Parker, Join our discord for support! https://discord.gg/4A6Qdp9
RegisterServerEvent("announce")
AddEventHandler("announce", function(param)
print("^7[^1Announcement^7]^5:" .. param)
TriggerClientEvent("chatMessage", -1, "^7[^1Announcement^7]", {0,0,0}, param)
end)
| 42.571429 | 88 | 0.711409 |
216bb0badc12fe221e702e028b9bd5a433e9842d | 611 | js | JavaScript | api/xamarin/latest/search/variables_d.js | finp/finp.github.io | e52782f9cda9d85f43011cc6c7a7aa9ba15462ab | [
"Apache-2.0"
] | 1 | 2018-05-30T11:05:12.000Z | 2018-05-30T11:05:12.000Z | api/xamarin/latest/search/variables_d.js | finp/finp.github.io | e52782f9cda9d85f43011cc6c7a7aa9ba15462ab | [
"Apache-2.0"
] | 17 | 2018-06-22T16:15:26.000Z | 2019-09-06T15:00:31.000Z | api/xamarin/latest/search/variables_d.js | finp/finp.github.io | e52782f9cda9d85f43011cc6c7a7aa9ba15462ab | [
"Apache-2.0"
] | 9 | 2018-05-04T15:59:25.000Z | 2018-09-03T09:41:34.000Z | var searchData=
[
['values',['Values',['../class_aero_gear_1_1_mobile_1_1_core_1_1_configuration_1_1_service_configuration.html#a31af5a47c356ff87cab68282a29eed29',1,'AeroGear::Mobile::Core::Configuration::ServiceConfiguration']]],
['version',['Version',['../class_aero_gear_1_1_mobile_1_1_core_1_1_utils_1_1_application_runtime_info.html#aaddee31e7f493580a56d3c2beff0afd4',1,'AeroGear.Mobile.Core.Utils.ApplicationRuntimeInfo.Version()'],['../class_aero_gear_1_1_mobile_1_1_core_1_1_utils_1_1_platform_info.html#a8a9283eeec60a5df7f957c36ac35e67a',1,'AeroGear.Mobile.Core.Utils.PlatformInfo.Version()']]]
];
| 101.833333 | 374 | 0.841244 |
1290ecc40a1562981cd6b460cf0b3dbbdd1ccae9 | 568 | cs | C# | Logging.Infrastructure.MongoDb/Mappings/LogMapping.cs | sohilww/UserOperationLoggingSystem | 6e64e17d11b32bf170a0142062625b852c2efebe | [
"Apache-2.0"
] | null | null | null | Logging.Infrastructure.MongoDb/Mappings/LogMapping.cs | sohilww/UserOperationLoggingSystem | 6e64e17d11b32bf170a0142062625b852c2efebe | [
"Apache-2.0"
] | null | null | null | Logging.Infrastructure.MongoDb/Mappings/LogMapping.cs | sohilww/UserOperationLoggingSystem | 6e64e17d11b32bf170a0142062625b852c2efebe | [
"Apache-2.0"
] | null | null | null | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LoggingDomianModel;
using MongoDB.Bson.Serialization;
namespace Logging.Infrastructure.MongoDb.Mappings
{
public class LogMapping: BsonClassMap
{
public LogMapping(Type classType) : base(classType)
{
RegisterClassMap<LogModel>(a => a.AutoMap());
}
public LogMapping(Type classType, BsonClassMap baseClassMap) : base(classType, baseClassMap)
{
}
}
}
| 24.695652 | 101 | 0.665493 |
b765bc1b8109e0f6d66db3013f303c7d00fd5768 | 5,069 | cs | C# | Assets/Plugins/VolumetricFog/Editor/VolumetricFogGaiaExtension.cs | ProxorGamesStudio/ReflexFightProject | 15a621103b3c0a2135d46cefb7626370392f7816 | [
"Unlicense"
] | null | null | null | Assets/Plugins/VolumetricFog/Editor/VolumetricFogGaiaExtension.cs | ProxorGamesStudio/ReflexFightProject | 15a621103b3c0a2135d46cefb7626370392f7816 | [
"Unlicense"
] | null | null | null | Assets/Plugins/VolumetricFog/Editor/VolumetricFogGaiaExtension.cs | ProxorGamesStudio/ReflexFightProject | 15a621103b3c0a2135d46cefb7626370392f7816 | [
"Unlicense"
] | null | null | null | #if GAIA_PRESENT && UNITY_EDITOR
using UnityEngine;
using System.Collections;
using System;
using System.Reflection;
using VolumetricFogAndMist;
using UnityEditor;
namespace Gaia.GX.Kronnect
{
/// <summary>
/// Volumetric Fog & Mist extension for Gaia.
/// </summary>
public class VolumetricFogGaiaExtension : MonoBehaviour
{
#region Generic informational methods
/// <summary>
/// Returns the publisher name if provided.
/// This will override the publisher name in the namespace ie Gaia.GX.PublisherName
/// </summary>
/// <returns>Publisher name</returns>
public static string GetPublisherName()
{
return "Kronnect";
}
/// <summary>
/// Returns the package name if provided
/// This will override the package name in the class name ie public class PackageName.
/// </summary>
/// <returns>Package name</returns>
public static string GetPackageName()
{
return "Volumetric Fog & Mist";
}
#endregion
#region Methods exposed by Gaia as buttons must be prefixed with GX_
public static void GX_About()
{
EditorUtility.DisplayDialog("About Volumetric Fog & Mist", "Volumetric Fog & Mist is a full-screen image effect that adds realistic, live, moving fog, mist, dust, clouds and sky haze to your scenes making them less dull and boring.", "OK");
}
static VolumetricFog CheckFog() {
VolumetricFog fog = VolumetricFog.instance;
// Checks Volumetric Fog image effect is attached
if (fog==null) {
Camera camera = Camera.main;
if (camera == null)
{
camera = FindObjectOfType<Camera>();
}
if (camera == null)
{
Debug.LogError("Could not find camera to add camera effects to. Please add a camera to your scene.");
return null;
}
fog = camera.gameObject.AddComponent<VolumetricFog>();
}
// Finds a suitable Sun light
if (fog.sun==null) {
Light[] lights = FindObjectsOfType<Light>();
for (int k=0;k<lights.Length;k++) {
Light light = lights[k];
if (light.name.Equals("Sun")) {
fog.sun = light.gameObject;
break;
}
}
if (fog.sun==null) {
for (int k=0;k<lights.Length;k++) {
Light light = lights[k];
if (light.type == LightType.Directional) {
fog.sun = light.gameObject;
break;
}
}
}
}
return fog;
}
public static void GX_WorldEdge() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.WorldEdge;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
public static void GX_WindyMist() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.WindyMist;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
public static void GX_SeaOfClouds() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.SeaClouds;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
public static void GX_Fog() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.Fog;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
public static void GX_HeavyFog() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.HeavyFog;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
public static void GX_FrostedWater() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.FrostedGround;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
fog.color = Color.white;
fog.height = 1.5f;
}
public static void GX_GroundFog() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.GroundFog;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
public static void GX_ToxicSwamps() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.ToxicSwamp;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
public static void GX_FoggyLakes() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.FoggyLake;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
public static void GX_SandStorm1() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.SandStorm1;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
public static void GX_SandStorm2() {
VolumetricFog fog = CheckFog();
if (fog==null) return;
fog.preset = FOG_PRESET.SandStorm2;
fog.preset = FOG_PRESET.Custom; // enable to make modifications and preserve them
}
#endregion
}
}
#endif | 29.47093 | 243 | 0.658907 |
c6c241ec001d97ea5369671398549c36fff087a3 | 224 | css | CSS | src/main/webapp/css/aboutus.css | nanda-thant-sin/team35-codeu | ae6aebbb386e2b128dcfdedfe68259a8d29da0c5 | [
"Apache-2.0"
] | 1 | 2019-06-01T15:20:52.000Z | 2019-06-01T15:20:52.000Z | src/main/webapp/css/aboutus.css | nanda-thant-sin/team35-codeu | ae6aebbb386e2b128dcfdedfe68259a8d29da0c5 | [
"Apache-2.0"
] | 22 | 2019-05-24T02:59:53.000Z | 2019-07-28T03:33:34.000Z | src/main/webapp/css/aboutus.css | nanda-thant-sin/team35-codeu | ae6aebbb386e2b128dcfdedfe68259a8d29da0c5 | [
"Apache-2.0"
] | 2 | 2019-09-05T22:31:16.000Z | 2019-09-10T10:37:52.000Z | .btn.know-more {
float: right;
padding-right: 20px;
text-align: center;
}
.col-sm {
margin-bottom: 70px;
padding: 30px;
}
.card.customized-card {
padding: 20px;
}
.img-customized.card-img-top {
width: 20rem;
}
| 14 | 30 | 0.651786 |
f84707a4e99aa797f027278329fbd2b928b70ced | 3,041 | rs | Rust | rust/src/pixel.rs | kaniini/notcurses | e6f87aaa515444878e50d7b82f8d6b9243eda69a | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2020-12-17T19:25:34.000Z | 2020-12-17T19:25:34.000Z | rust/src/pixel.rs | kaniini/notcurses | e6f87aaa515444878e50d7b82f8d6b9243eda69a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | rust/src/pixel.rs | kaniini/notcurses | e6f87aaa515444878e50d7b82f8d6b9243eda69a | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | //! The ncpixel API facilitates direct management of the pixels within an
//! ncvisual (ncvisuals keep a backing store of 32-bit RGBA pixels, and render
//! them down to terminal graphics in ncvisual_render()).
//
// - NOTE: The pixel color & alpha components are u8 instead of u32.
// Because of type enforcing, some runtime checks are now unnecessary.
//
// - NOTE: None of the functions can't fail anymore and don't have to return an error.
//
// functions manually reimplemented: 10
// ------------------------------------------
// (+) implement : 10 / 0
// (#) unit tests: 0 / 10
// ------------------------------------------
// + ncpixel
// + ncpixel_a
// + ncpixel_b
// + ncpixel_g
// + ncpixel_r
// + ncpixel_set_a
// + ncpixel_set_b
// + ncpixel_set_g
// + ncpixel_set_r
// + ncpixel_set_rgb
use crate::NcColor;
// NcPixel (RGBA)
/// 32 bits broken into RGB + 8-bit alpha
///
/// NcPixel has 8 bits of alpha, more or less linear, contributing
/// directly to the usual alpha blending equation.
///
/// We map the 8 bits of alpha to 2 bits of alpha via a level function:
/// https://nick-black.com/dankwiki/index.php?title=Notcurses#Transparency.2FContrasting
///
/// ## Diagram
///
/// ```txt
/// AAAAAAAA GGGGGGGG BBBBBBBB RRRRRRRR
/// ```
/// `type in C: ncpixel (uint32_t)`
///
// NOTE: the order of the colors is different than in NcChannel.
pub type NcPixel = u32;
/// Get an RGB pixel from RGB values
pub fn ncpixel(r: NcColor, g: NcColor, b: NcColor) -> NcPixel {
0xff000000 as NcPixel | r as NcPixel | (b as NcPixel) << 8 | (g as NcPixel) << 16
}
/// Extract the 8-bit alpha component from a pixel
pub fn ncpixel_a(pixel: NcPixel) -> NcColor {
((pixel & 0xff000000) >> 24) as NcColor
}
/// Extract the 8 bit green component from a pixel
pub fn ncpixel_g(pixel: NcPixel) -> NcColor {
((pixel & 0x00ff0000) >> 16) as NcColor
}
/// Extract the 8 bit blue component from a pixel
pub fn ncpixel_b(pixel: NcPixel) -> NcColor {
((pixel & 0x0000ff00) >> 8) as NcColor
}
/// Extract the 8 bit red component from a pixel
pub fn ncpixel_r(pixel: NcPixel) -> NcColor {
(pixel & 0x000000ff) as NcColor
}
/// Set the 8-bit alpha component of a pixel
pub fn ncpixel_set_a(pixel: &mut NcPixel, alpha: NcColor) {
*pixel = (*pixel & 0x00ffffff) | ((alpha as NcPixel) << 24);
}
/// Set the 8-bit green component of a pixel
pub fn ncpixel_set_g(pixel: &mut NcPixel, green: NcColor) {
*pixel = (*pixel & 0xff00ffff) | ((green as NcPixel) << 16);
}
/// Set the 8-bit blue component of a pixel
pub fn ncpixel_set_b(pixel: &mut NcPixel, blue: NcColor) {
*pixel = (*pixel & 0xffff00ff) | ((blue as NcPixel) << 8);
}
/// Set the 8-bit red component of a pixel
pub fn ncpixel_set_r(pixel: &mut NcPixel, red: NcColor) {
*pixel = (*pixel & 0xffffff00) | red as NcPixel;
}
/// set the RGB values of an RGB pixel
pub fn ncpixel_set_rgb(pixel: &mut NcPixel, red: NcColor, green: NcColor, blue: NcColor) {
ncpixel_set_r(pixel, red);
ncpixel_set_g(pixel, green);
ncpixel_set_b(pixel, blue);
}
| 31.030612 | 90 | 0.656363 |
be8465a0f3ff16adcd08cbb851646be9bdf7fa57 | 5,905 | ts | TypeScript | packages/plugin-node-unhandled-rejection/test/unhandled-rejection.test.ts | orinamio/bugsnag-js-7.14.2-patch | bc15fa8cf6c5442710aaeeb7749c489c5558f85c | [
"MIT"
] | 682 | 2015-01-02T06:35:11.000Z | 2022-03-31T07:49:05.000Z | packages/plugin-node-unhandled-rejection/test/unhandled-rejection.test.ts | orinamio/bugsnag-js-7.14.2-patch | bc15fa8cf6c5442710aaeeb7749c489c5558f85c | [
"MIT"
] | 1,456 | 2015-01-10T01:56:02.000Z | 2022-03-31T07:26:24.000Z | packages/plugin-node-unhandled-rejection/test/unhandled-rejection.test.ts | orinamio/bugsnag-js-7.14.2-patch | bc15fa8cf6c5442710aaeeb7749c489c5558f85c | [
"MIT"
] | 266 | 2015-01-23T02:25:34.000Z | 2022-03-19T04:37:48.000Z | import Client from '@bugsnag/core/client'
import { schema } from '@bugsnag/core/config'
import plugin from '../'
import EventWithInternals from '@bugsnag/core/event'
describe('plugin: node unhandled rejection handler', () => {
it('should listen to the process#unhandledRejection event', () => {
const before = process.listeners('unhandledRejection').length
const c = new Client({ apiKey: 'api_key', plugins: [plugin] })
const after = process.listeners('unhandledRejection').length
expect(before < after).toBe(true)
expect(c).toBe(c)
plugin.destroy()
})
it('does not add a process#unhandledRejection listener if autoDetectErrors=false', () => {
const before = process.listeners('unhandledRejection').length
const c = new Client({ apiKey: 'api_key', autoDetectErrors: false, plugins: [plugin] })
const after = process.listeners('unhandledRejection').length
expect(c).toBe(c)
expect(after).toBe(before)
})
it('does not add a process#unhandledRejection listener if enabledErrorTypes.unhandledRejections=false', () => {
const before = process.listeners('unhandledRejection').length
const c = new Client({
apiKey: 'api_key',
enabledErrorTypes: { unhandledExceptions: false, unhandledRejections: false },
plugins: [plugin]
})
const after = process.listeners('unhandledRejection').length
expect(c).toBe(c)
expect(after).toBe(before)
})
it('should call the configured onUnhandledRejection callback', done => {
const c = new Client({
apiKey: 'api_key',
onUnhandledRejection: (err: Error, event: EventWithInternals) => {
expect(err.message).toBe('never gonna catch me')
expect(event.errors[0].errorMessage).toBe('never gonna catch me')
expect(event._handledState.unhandled).toBe(true)
expect(event._handledState.severity).toBe('error')
expect(event._handledState.severityReason).toEqual({ type: 'unhandledPromiseRejection' })
plugin.destroy()
done()
},
plugins: [plugin]
}, {
...schema,
onUnhandledRejection: {
validate: (val: unknown) => typeof val === 'function',
message: 'should be a function',
defaultValue: () => {}
}
})
c._setDelivery(client => ({
sendEvent: (payload, cb) => cb(),
sendSession: (payload, cb) => cb()
}))
process.listeners('unhandledRejection')[0](new Error('never gonna catch me'), Promise.resolve())
})
it('should tolerate delivery errors', done => {
const c = new Client({
apiKey: 'api_key',
onUnhandledRejection: (err: Error, event: EventWithInternals) => {
expect(err.message).toBe('never gonna catch me')
expect(event.errors[0].errorMessage).toBe('never gonna catch me')
expect(event._handledState.unhandled).toBe(true)
expect(event._handledState.severity).toBe('error')
expect(event._handledState.severityReason).toEqual({ type: 'unhandledPromiseRejection' })
plugin.destroy()
done()
},
plugins: [plugin]
}, {
...schema,
onUnhandledRejection: {
validate: (val: unknown) => typeof val === 'function',
message: 'should be a function',
defaultValue: () => {}
}
})
c._setDelivery(client => ({
sendEvent: (payload, cb) => cb(new Error('floop')),
sendSession: (payload, cb) => cb()
}))
process.listeners('unhandledRejection')[0](new Error('never gonna catch me'), Promise.resolve())
})
it('should return a promise that resolves after the onUnhandledRejection callback is called', async () => {
try {
const options = {
apiKey: 'api_key',
onUnhandledRejection: jest.fn(),
plugins: [plugin]
}
const pluginSchema = {
...schema,
onUnhandledRejection: {
validate: (val: unknown) => typeof val === 'function',
message: 'should be a function',
defaultValue: () => {}
}
}
const client = new Client(options, pluginSchema)
client._setDelivery(client => ({
sendEvent: (payload, cb) => cb(),
sendSession: (payload, cb) => cb()
}))
const listener = process.listeners('unhandledRejection')[0]
expect(options.onUnhandledRejection).not.toHaveBeenCalled()
await listener(new Error('never gonna catch me'), Promise.resolve())
expect(options.onUnhandledRejection).toHaveBeenCalledTimes(1)
} finally {
plugin.destroy()
}
})
it('should prepend its listener (Node 6+)', async () => {
// Skip this test on Node 4/5 as prependListener doesn't exist
if (process.version.startsWith('v4.') || process.version.startsWith('v5.')) {
return
}
const listener = () => {}
try {
process.on('unhandledRejection', listener)
const listenersBefore = process.listeners('unhandledRejection')
expect(listenersBefore).toHaveLength(1)
expect(listenersBefore[0]).toBe(listener)
const options = {
apiKey: 'api_key',
onUnhandledRejection: jest.fn(),
plugins: [plugin]
}
const pluginSchema = {
...schema,
onUnhandledRejection: {
validate: (val: unknown) => typeof val === 'function',
message: 'should be a function',
defaultValue: () => {}
}
}
const client = new Client(options, pluginSchema)
client._setDelivery(client => ({
sendEvent: (payload, cb) => cb(),
sendSession: (payload, cb) => cb()
}))
const listenersAfter = process.listeners('unhandledRejection')
expect(listenersAfter).toHaveLength(2)
expect(listenersAfter[0]).not.toBe(listener)
expect(listenersAfter[1]).toBe(listener)
} finally {
process.removeListener('unhandledRejection', listener)
plugin.destroy()
}
})
})
| 33.361582 | 113 | 0.62591 |
1dee85d1ab98670f204017556a2fdfd184ba2ae7 | 625 | kt | Kotlin | src/main/kotlin/nbt/lang/NbttFile.kt | SizableShrimp/MinecraftDev | c364d47cc7fa07c0c04b33ee4eb760a82fdcf2b8 | [
"MIT"
] | 992 | 2016-10-28T17:37:24.000Z | 2022-03-31T18:19:48.000Z | src/main/kotlin/nbt/lang/NbttFile.kt | Toshimichi0915/MinecraftDev | 9321bea67126d2b0730f246cb7e10cb6473e4b6a | [
"MIT"
] | 1,629 | 2016-10-27T17:05:13.000Z | 2022-03-29T13:00:06.000Z | src/main/kotlin/nbt/lang/NbttFile.kt | Toshimichi0915/MinecraftDev | 9321bea67126d2b0730f246cb7e10cb6473e4b6a | [
"MIT"
] | 194 | 2016-11-01T11:18:24.000Z | 2022-03-25T17:56:05.000Z | /*
* Minecraft Dev for IntelliJ
*
* https://minecraftdev.org
*
* Copyright (c) 2021 minecraft-dev
*
* MIT License
*/
package com.demonwav.mcdev.nbt.lang
import com.demonwav.mcdev.asset.PlatformAssets
import com.demonwav.mcdev.nbt.lang.gen.psi.NbttRootCompound
import com.intellij.extapi.psi.PsiFileBase
import com.intellij.psi.FileViewProvider
class NbttFile(viewProvider: FileViewProvider) : PsiFileBase(viewProvider, NbttLanguage) {
override fun getFileType() = NbttFileType
override fun getIcon(flags: Int) = PlatformAssets.MINECRAFT_ICON
fun getRootCompound() = firstChild as? NbttRootCompound
}
| 25 | 90 | 0.7744 |
4bd30adb8a105fc11c28474816632e17042ce7db | 1,416 | c | C | JustForFun/EXPR/SCANNER.c | nvectorrr/2019-fall-polytech-cs | 679cb16b5881931267f9a9009e4edf2b989b72c2 | [
"MIT"
] | 1 | 2020-03-14T11:23:31.000Z | 2020-03-14T11:23:31.000Z | JustForFun/EXPR/SCANNER.c | nvectorrr/2019-fall-polytech-cs | 679cb16b5881931267f9a9009e4edf2b989b72c2 | [
"MIT"
] | null | null | null | JustForFun/EXPR/SCANNER.c | nvectorrr/2019-fall-polytech-cs | 679cb16b5881931267f9a9009e4edf2b989b72c2 | [
"MIT"
] | null | null | null | /* Naydenovich Viktor */
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <setjmp.h>
#include "EXPR.h"
void Scanner( QUEUE *Q, char *s )
{
TOK T;
int denum, i;
while (*s != 0)
{
switch (*s)
{
case ' ':
case '\n':
s++;
continue;
case '+':
case '-':
case '(':
case ')':
case '*':
case '/':
case '%':
case '^':
case '=':
case ',':
T.Id = TOK_OP;
T.Op = *s++;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
T.Id = TOK_NUM;
T.Num = 0;
while (*s >= '0' && *s <= '9')
T.Num = T.Num * 10 + *s++ - '0';
if (*s == '.')
{
s++;
denum = 1;
while (*s >= '0' && *s <= '9')
T.Num += (double)(*s++ - '0') / (denum *= 10);
}
break;
default:
if (isalpha((unsigned char) * s))
{
T.Id = TOK_NAME;
i = 0;
do
{
if (i < MAX - 1)
T.Name[i++] = *s;
s++;
}while (isalpha((unsigned char) * s) || isdigit((unsigned char) * s));
T.Name[i] = 0;
break;
}
Error("Unrecognized character '%c'\n", *s);
break;
}
Put(Q, T);
}
}
| 18.38961 | 79 | 0.356638 |
e755a10d6c3aa36447f49f34c17df747bd472232 | 7,177 | php | PHP | application/views/contents/master/mata_ajar.php | ngabngab/pusdiklat | 3864013e1cc16cccc1b244456b3d92d4e6338286 | [
"Apache-2.0",
"MIT"
] | null | null | null | application/views/contents/master/mata_ajar.php | ngabngab/pusdiklat | 3864013e1cc16cccc1b244456b3d92d4e6338286 | [
"Apache-2.0",
"MIT"
] | null | null | null | application/views/contents/master/mata_ajar.php | ngabngab/pusdiklat | 3864013e1cc16cccc1b244456b3d92d4e6338286 | [
"Apache-2.0",
"MIT"
] | null | null | null | <?php
/**
* Simdiklat Online Website.
*
* @package core
* @copyright 2016 kim-leny
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$loggedIn = $this->session->userdata['logged_in'];
?>
<script>
$(document).ready(function() {
$('#dataMataAjar').DataTable({
responsive: false,
dom: 'Bfrtip',
buttons: [
'csv', 'excel', 'pdf', 'print'
]
});
});
</script>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Data Master <small>Mata Ajar</small>
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-database"></i> Data Master | Mata Ajar
</li>
</ol>
</div>
</div>
<!-- /.row -->
<!-- show error message -->
<?php
if(validation_errors()!= null){
?>
<div class="row">
<div class="col-lg-12">
<div class="alert alert-danger">
<?php echo validation_errors(); ?>
</div>
</div>
</div>
<?php
}
if($errMessage!= ''){
?>
<div class="row">
<div class="col-lg-12">
<div class="alert alert-danger">
<?php echo $errMessage; ?>
</div>
</div>
</div>
<?php
}
if($success == true){
?>
<div class="row">
<div class="col-lg-12">
<div class="alert alert-success">
<strong>Well done!</strong> Data has been saved successfully.
</div>
</div>
</div>
<?php
}
?>
<!-- show error message -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<div class="panel-heading">Form Tambah Mata Ajar</div>
<div class="panel-body">
<?php echo form_open('Mata_ajarStatement'); ?>
<?php
$Mata_ajarID = "";
$Mata_ajarName = "";
$Mata_ajarDesc = "";
$jamlat = "";
if($SelectedMata_ajar){
$Mata_ajarID = $SelectedMata_ajar[0]->mataAjarID;
$Mata_ajarName = $SelectedMata_ajar[0]->mataAjarName;
$Mata_ajarDesc = $SelectedMata_ajar[0]->mataAjarDesc;
$jamlat = $SelectedMata_ajar[0]->jamlat;
}
?>
<div class="form-group">
<label>Nama Mata Ajar</label>
<input class="form-control" type="hidden" name="mataAjarID" value="<?php echo $Mata_ajarID; ?>">
<input class="form-control" type="text" name="mataAjarName" placeholder="Enter Nama Mata Ajar" value="<?php echo $Mata_ajarName; ?>">
</div>
<div class="form-group">
<label>Deskripsi Mata Ajar</label>
<textarea class="form-control" name="mataAjarDesc" rows="3"><?php echo $Mata_ajarDesc; ?></textarea>
</div>
<div class="form-group">
<label>Jamlat</label>
<input class="form-control" type="text" name="jamlat" placeholder="Enter Jamlat" value="<?php echo $jamlat; ?>">
</div>
<button type="submit" class="btn btn-default">Save</button>
</form>
</div>
</div>
</div>
<?php
?>
<div class="col-lg-12" style="margin-top:1%;">
<div class="panel panel-default">
<div class="panel-heading">Data Mata Ajar</div>
<div class="panel-body table-responsive">
<table class="table table-bordered table-hover table-striped" id="dataMataAjar" width="100%">
<thead>
<tr>
<th>No</th>
<th>Nama Mata Ajar</th>
<th>Jamlat</th>
<th> </th>
</tr>
</thead>
<tbody>
<?php
if($mata_ajars){
$i=1;
$this->load->model('enum');
foreach($mata_ajars as $mata_ajar){
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $mata_ajar->mataAjarName; ?></td>
<td><?php echo $mata_ajar->jamlat; ?></td>
<td style="text-align:right;"><a class="btn btn-info btn-xs" href="<?php echo base_url();?>index.php/mata_ajar/edit/<?php echo $mata_ajar->mataAjarID;?>"><i class="fa fa-pencil"></i></a> <a class="btn btn-danger btn-xs" href="<?php echo base_url();?>index.php/mata_ajar/delete/<?php echo $mata_ajar->mataAjarID;?>" onclick = "if (! confirm('Are you sure want to delete this?')) { return false; }"><i class="fa fa-times"></i></a></td>
</tr>
<?php
$i++;
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="row">
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper --> | 42.467456 | 485 | 0.338024 |
e31ed9c1fa06d9c6415499739ee9550d9d73dc7b | 5,405 | rb | Ruby | spec/lib/gitlab/github_import/issue_formatter_spec.rb | samruddhi2909/Citi_Bridge | df4dc2ac2986436915f4878c84e6910ec169dd41 | [
"MIT"
] | null | null | null | spec/lib/gitlab/github_import/issue_formatter_spec.rb | samruddhi2909/Citi_Bridge | df4dc2ac2986436915f4878c84e6910ec169dd41 | [
"MIT"
] | null | null | null | spec/lib/gitlab/github_import/issue_formatter_spec.rb | samruddhi2909/Citi_Bridge | df4dc2ac2986436915f4878c84e6910ec169dd41 | [
"MIT"
] | 1 | 2020-11-04T05:34:36.000Z | 2020-11-04T05:34:36.000Z | require 'spec_helper'
describe Gitlab::GithubImport::IssueFormatter, lib: true do
let!(:project) { create(:project, namespace: create(:namespace, path: 'octocat')) }
let(:octocat) { double(id: 123456, login: 'octocat') }
let(:created_at) { DateTime.strptime('2011-01-26T19:01:12Z') }
let(:updated_at) { DateTime.strptime('2011-01-27T19:01:12Z') }
let(:base_data) do
{
number: 1347,
milestone: nil,
state: 'open',
title: 'Found a bug',
body: "I'm having a problem with this.",
assignee: nil,
user: octocat,
comments: 0,
pull_request: nil,
created_at: created_at,
updated_at: updated_at,
closed_at: nil
}
end
subject(:issue) { described_class.new(project, raw_data) }
shared_examples 'Gitlab::GithubImport::IssueFormatter#attributes' do
context 'when issue is open' do
let(:raw_data) { double(base_data.merge(state: 'open')) }
it 'returns formatted attributes' do
expected = {
iid: 1347,
project: project,
milestone: nil,
title: 'Found a bug',
description: "*Created by: octocat*\n\nI'm having a problem with this.",
state: 'opened',
author_id: project.creator_id,
assignee_id: nil,
created_at: created_at,
updated_at: updated_at
}
expect(issue.attributes).to eq(expected)
end
end
context 'when issue is closed' do
let(:raw_data) { double(base_data.merge(state: 'closed')) }
it 'returns formatted attributes' do
expected = {
iid: 1347,
project: project,
milestone: nil,
title: 'Found a bug',
description: "*Created by: octocat*\n\nI'm having a problem with this.",
state: 'closed',
author_id: project.creator_id,
assignee_id: nil,
created_at: created_at,
updated_at: updated_at
}
expect(issue.attributes).to eq(expected)
end
end
context 'when it is assigned to someone' do
let(:raw_data) { double(base_data.merge(assignee: octocat)) }
it 'returns nil as assignee_id when is not a GitLab user' do
expect(issue.attributes.fetch(:assignee_id)).to be_nil
end
it 'returns GitLab user id as assignee_id when is a GitLab user' do
gl_user = create(:omniauth_user, extern_uid: octocat.id, provider: 'github')
expect(issue.attributes.fetch(:assignee_id)).to eq gl_user.id
end
end
context 'when it has a milestone' do
let(:milestone) { double(id: 42, number: 42) }
let(:raw_data) { double(base_data.merge(milestone: milestone)) }
it 'returns nil when milestone does not exist' do
expect(issue.attributes.fetch(:milestone)).to be_nil
end
it 'returns milestone when it exists' do
milestone = create(:milestone, project: project, iid: 42)
expect(issue.attributes.fetch(:milestone)).to eq milestone
end
end
context 'when author is a GitLab user' do
let(:raw_data) { double(base_data.merge(user: octocat)) }
it 'returns project#creator_id as author_id when is not a GitLab user' do
expect(issue.attributes.fetch(:author_id)).to eq project.creator_id
end
it 'returns GitLab user id as author_id when is a GitLab user' do
gl_user = create(:omniauth_user, extern_uid: octocat.id, provider: 'github')
expect(issue.attributes.fetch(:author_id)).to eq gl_user.id
end
it 'returns description without created at tag line' do
create(:omniauth_user, extern_uid: octocat.id, provider: 'github')
expect(issue.attributes.fetch(:description)).to eq("I'm having a problem with this.")
end
end
end
shared_examples 'Gitlab::GithubImport::IssueFormatter#number' do
let(:raw_data) { double(base_data.merge(number: 1347)) }
it 'returns issue number' do
expect(issue.number).to eq 1347
end
end
context 'when importing a GitHub project' do
it_behaves_like 'Gitlab::GithubImport::IssueFormatter#attributes'
it_behaves_like 'Gitlab::GithubImport::IssueFormatter#number'
end
context 'when importing a Gitea project' do
before do
project.update(import_type: 'gitea')
end
it_behaves_like 'Gitlab::GithubImport::IssueFormatter#attributes'
it_behaves_like 'Gitlab::GithubImport::IssueFormatter#number'
end
describe '#has_comments?' do
context 'when number of comments is greater than zero' do
let(:raw_data) { double(base_data.merge(comments: 1)) }
it 'returns true' do
expect(issue.has_comments?).to eq true
end
end
context 'when number of comments is equal to zero' do
let(:raw_data) { double(base_data.merge(comments: 0)) }
it 'returns false' do
expect(issue.has_comments?).to eq false
end
end
end
describe '#pull_request?' do
context 'when mention a pull request' do
let(:raw_data) { double(base_data.merge(pull_request: double)) }
it 'returns true' do
expect(issue.pull_request?).to eq true
end
end
context 'when does not mention a pull request' do
let(:raw_data) { double(base_data.merge(pull_request: nil)) }
it 'returns false' do
expect(issue.pull_request?).to eq false
end
end
end
end
| 30.195531 | 93 | 0.644588 |
7be2d2e4bac98b67b31bada4699c8f102f0f9bea | 2,696 | cpp | C++ | Projects/Demo/source/Common/SpawnComponent.cpp | asheraryam/ETEngine | cac9b62146bfd2fe249a53eb8031cbbbd1db0931 | [
"MIT"
] | 552 | 2017-08-21T18:12:52.000Z | 2022-03-31T15:41:56.000Z | Projects/Demo/source/Common/SpawnComponent.cpp | asheraryam/ETEngine | cac9b62146bfd2fe249a53eb8031cbbbd1db0931 | [
"MIT"
] | 14 | 2017-08-07T23:36:13.000Z | 2021-05-10T08:41:19.000Z | Projects/Demo/source/Common/SpawnComponent.cpp | asheraryam/ETEngine | cac9b62146bfd2fe249a53eb8031cbbbd1db0931 | [
"MIT"
] | 40 | 2017-10-10T14:42:22.000Z | 2022-03-10T07:14:33.000Z | #include "stdafx.h"
#include "SpawnComponent.h"
#include <EtCore/Reflection/Registration.h>
#include <EtCore/Content/ResourceManager.h>
#include <EtRendering/GraphicsTypes/Mesh.h>
#include <EtRendering/MaterialSystem/MaterialInstance.h>
#include <EtRendering/MaterialSystem/MaterialData.h>
namespace et {
namespace demo {
// reflection
//------------
RTTR_REGISTRATION
{
rttr::registration::class_<SpawnComponent>("spawn component");
BEGIN_REGISTER_CLASS(SpawnComponentDesc, "spawn comp desc")
.property("mesh", &SpawnComponentDesc::mesh)
.property("material", &SpawnComponentDesc::material)
.property("scale", &SpawnComponentDesc::scale)
.property("shape", &SpawnComponentDesc::shape)
.property("mass", &SpawnComponentDesc::mass)
.property("interval", &SpawnComponentDesc::interval)
.property("impulse", &SpawnComponentDesc::impulse)
END_REGISTER_CLASS_POLYMORPHIC(SpawnComponentDesc, fw::I_ComponentDescriptor);
}
DEFINE_FORCED_LINKING(SpawnComponentDesc) // force the linker to include this unit
ECS_REGISTER_COMPONENT(SpawnComponent);
//=================
// Spawn Component
//=================
//-----------------------
// SpawnComponent::c-tor
//
// load assets from ids
//
SpawnComponent::SpawnComponent(AssetPtr<render::MeshData> const meshPtr,
AssetPtr<render::I_Material> const materialPtr,
float const s,
btCollisionShape* const shape,
float const shapeMass,
float const interv,
float const imp
)
: collisionShape(shape)
, mass(shapeMass)
, scale(s)
, interval(interv)
, impulse(imp)
, mesh(meshPtr)
, material(materialPtr)
{ }
//============================
// Spawn Component Descriptor
//============================
//-----------------------------
// SpawnComponentDesc:: =
//
SpawnComponentDesc& SpawnComponentDesc::operator=(SpawnComponentDesc const& other)
{
mesh = other.mesh;
material = other.material;
scale = other.scale;
mass = other.mass;
interval = other.interval;
impulse = other.impulse;
delete shape;
shape = nullptr;
if (other.shape != nullptr)
{
shape = other.shape->Clone();
}
return *this;
}
//-------------------------------
// SpawnComponentDesc::c-tor
//
SpawnComponentDesc::SpawnComponentDesc(SpawnComponentDesc const& other)
{
*this = other;
}
//-------------------------------
// SpawnComponentDesc::d-tor
//
SpawnComponentDesc::~SpawnComponentDesc()
{
delete shape;
}
//------------------------------
// SpawnComponentDesc::MakeData
//
// Create a spawn component from a descriptor
//
SpawnComponent* SpawnComponentDesc::MakeData()
{
return new SpawnComponent(mesh, material, scale, shape->MakeBulletCollisionShape(), mass, interval, impulse);
}
} // namespace demo
} // namespace et
| 21.918699 | 110 | 0.676929 |
c669b734a4dd7b4d3ee133c4fa4748cd3b8c1de3 | 2,688 | py | Python | SSolver.py | Hexman768/SudokuSolver | e65be1bc84f540942f40ef37c6273e09dd7ef059 | [
"MIT"
] | null | null | null | SSolver.py | Hexman768/SudokuSolver | e65be1bc84f540942f40ef37c6273e09dd7ef059 | [
"MIT"
] | null | null | null | SSolver.py | Hexman768/SudokuSolver | e65be1bc84f540942f40ef37c6273e09dd7ef059 | [
"MIT"
] | null | null | null | board = [[7,8,0,4,0,0,1,2,0],
[6,0,0,0,7,5,0,0,9],
[0,0,0,6,0,1,0,7,8],
[0,0,7,0,4,0,2,6,0],
[0,0,1,0,5,0,9,3,0],
[9,0,4,0,6,0,0,0,5],
[0,7,0,3,0,0,0,1,2],
[1,2,0,0,0,7,4,0,0],
[0,4,9,2,0,6,0,0,7]]
def solve():
if (checkBoard()):
return True
"Takes a sudoku board in array form as a parameter "
for y in range(0, 9):
for x in range(0, 9):
if (board[y][x] == 0):
for i in range(1, 10):
if (checkValid(x, y, i)):
board[y][x] = i
if (solve()):
return True
else:
board[y][x] = 0
return False
return True
def checkBoard():
for y in range(0, 9):
for x in range(0, 9):
if (board[y][x] == 0):
return False
return True
def checkValid(x, y, val):
"Checking x axis"
for i in range(0, len(board[y])):
if (board[y][i] == val):
return False
"Check y axis"
for i in range(0, len(board)):
if (board[i][x] == val):
return False
"Checking surrounding square"
if (y == 0 or y == 3 or y == 6):
if (csx(x, y+1, val) and csx(x, y+2, val)):
return True
if (y == 1 or y == 4 or y == 7):
if (csx(x, y-1, val) and csx(x, y+1, val)):
return True
else:
if (csx(x, y-1, val) and csx(x, y-2, val)):
return True
return False
def csx(x, y, val):
if (x == 0 or x == 3 or x == 6):
if (board[y][x+1] == val or board[y][x+2] == val):
return False
return True
if (x == 1 or x == 4 or x == 7):
if (board[y][x-1] == val or board[y][x+1] == val):
return False
return True
else:
if (board[y][x-1] == val or board[y][x-2] == val):
return False
return True;
def printBoard():
for i in range(0, len(board)):
print(board[i])
if (solve()):
printBoard()
| 34.461538 | 72 | 0.327753 |
c9b61b2acfde525984bae7e0b1aa13de408c91c6 | 5,925 | ts | TypeScript | Backend/Mapping Service/src/controller/MappingController.ts | mauriceackel/Gabble | 40aac84f365c98c4b7b78e5004082150b90dc902 | [
"MIT"
] | 1 | 2021-05-27T12:42:18.000Z | 2021-05-27T12:42:18.000Z | Backend/Mapping Service/src/controller/MappingController.ts | mauriceackel/Gabble | 40aac84f365c98c4b7b78e5004082150b90dc902 | [
"MIT"
] | null | null | null | Backend/Mapping Service/src/controller/MappingController.ts | mauriceackel/Gabble | 40aac84f365c98c4b7b78e5004082150b90dc902 | [
"MIT"
] | null | null | null | import { Request, Response, Router } from 'express'
import { NextFunction } from 'connect'
import { NoSuchElementError } from '../utils/errors/NoSuchElementError';
import { ApiResponse, ErrorResponse, SuccessResponse } from '../utils/responses/ApiResponse';
import * as MappingService from '../services/MappingService'
import { ForbiddenError } from '../utils/errors/ForbiddenError';
import { MultiMappingResponse, SingleMappingResponse } from '../utils/responses/MappingResponse';
import { IMapping } from '../models/MappingModel';
//Reference to express
const router: Router = Router();
/**
* Create a mapping
*/
router.post('/', createMapping)
const createCondition = (mapping: IMapping | undefined, userId: string, data: IMapping) => data.createdBy === userId;
async function createMapping(req: Request, res: Response, next: NextFunction) {
const mappingData: IMapping = req.body;
let response: ApiResponse;
try {
if (!createCondition(undefined, req.userId, mappingData)) {
throw new ForbiddenError("Insufficient right, permission denied");
}
const mapping = await MappingService.createMapping(mappingData);
response = new SingleMappingResponse(200, undefined, mapping.toJSON({ claims: [...req.claims, ...(mapping.createdBy === req.userId ? ['owner'] : [])] }));
} catch (err) {
if (err instanceof NoSuchElementError) {
response = new ErrorResponse(404);
} else if (err instanceof ForbiddenError) {
response = new ErrorResponse(403);
} else {
response = new ErrorResponse(500);
}
}
res.status(response.Code).json(response);
}
/**
* Get all mappings
*/
router.get('/', getMappings)
const listCondition = (mapping: IMapping, userId: string) => true;
async function getMappings(req: Request, res: Response, next: NextFunction) {
let response: ApiResponse;
try {
const { apiType: rawApiType, createdBy } = req.query as Record<string, any>;
const mappings = await MappingService.getMappings({ apiType: rawApiType ? Number.parseInt(rawApiType): undefined, createdBy });
if (mappings.some(mapping => !listCondition(mapping, req.userId))) {
throw new ForbiddenError("Insufficient right, permission denied");
}
response = new MultiMappingResponse(200, undefined, mappings.map(mapping => mapping.toJSON({ claims: [...req.claims, ...(mapping.createdBy === req.userId ? ['owner'] : [])] })));
} catch (err) {
if (err instanceof NoSuchElementError) {
response = new ErrorResponse(404);
} else if (err instanceof ForbiddenError) {
response = new ErrorResponse(403);
} else {
response = new ErrorResponse(500);
}
}
res.status(response.Code).json(response);
}
/**
* Get a specific mapping by its id
*/
router.get('/:mappingId', getMapping)
const getCondition = (mapping: IMapping, userId: string) => true;
async function getMapping(req: Request, res: Response, next: NextFunction) {
let response: ApiResponse;
try {
const mapping = await MappingService.getMapping(req.params.mappingId);
if (!getCondition(mapping, req.userId)) {
throw new ForbiddenError("Insufficient right, permission denied");
}
response = new SingleMappingResponse(200, undefined, mapping.toJSON({ claims: [...req.claims, ...(mapping.createdBy === req.userId ? ['owner'] : [])] }));
} catch (err) {
if (err instanceof NoSuchElementError) {
response = new ErrorResponse(404);
} else if (err instanceof ForbiddenError) {
response = new ErrorResponse(403);
} else {
response = new ErrorResponse(500);
}
}
res.status(response.Code).json(response);
}
/**
* Update a mapping
*/
router.put('/:mappingId', updateApi)
const updateCondition = (mapping: IMapping, userId: string, data: IMapping) => mapping.createdBy === userId && mapping.createdBy === data.createdBy;
async function updateApi(req: Request, res: Response, next: NextFunction) {
const mappingData: IMapping = req.body;
mappingData.id = req.params.mappingId;
let response: ApiResponse;
try {
const mapping = await MappingService.getMapping(req.params.mappingId);
if (!updateCondition(mapping, req.userId, mappingData)) {
throw new ForbiddenError("Insufficient right, permission denied");
}
await MappingService.updateMapping(mappingData);
response = new SuccessResponse(200);
} catch (err) {
if (err instanceof NoSuchElementError) {
response = new ErrorResponse(404);
} else if (err instanceof ForbiddenError) {
response = new ErrorResponse(403);
} else {
response = new ErrorResponse(500);
}
}
res.status(response.Code).json(response);
}
/**
* Delete a mapping
*/
router.delete('/:mappingId', deleteMapping)
const deleteCondition = (mapping: IMapping, userId: string) => mapping.createdBy === userId;
async function deleteMapping(req: Request, res: Response, next: NextFunction) {
let response: ApiResponse;
try {
const mapping = await MappingService.getMapping(req.params.mappingId);
if (!deleteCondition(mapping, req.userId)) {
throw new ForbiddenError("Insufficient right, permission denied");
}
await MappingService.deleteMapping(req.params.mappingId);
response = new SuccessResponse(200);
} catch (err) {
if (err instanceof NoSuchElementError) {
response = new ErrorResponse(404);
} else if (err instanceof ForbiddenError) {
response = new ErrorResponse(403);
} else {
response = new ErrorResponse(500);
}
}
res.status(response.Code).json(response);
}
export default router; | 36.128049 | 186 | 0.65384 |
79e411cbac963bd2881d494072e51e6cf3ffe7ec | 322 | php | PHP | src/Model/Event/Listener/IAfterBatchUpdateEventListener.php | RonieLiu/imi | f71701d6af08d2ee32ebcffd4a5034bec27afc0c | [
"MulanPSL-1.0"
] | 1 | 2019-11-22T07:29:01.000Z | 2019-11-22T07:29:01.000Z | src/Model/Event/Listener/IAfterBatchUpdateEventListener.php | RonieLiu/imi | f71701d6af08d2ee32ebcffd4a5034bec27afc0c | [
"MulanPSL-1.0"
] | null | null | null | src/Model/Event/Listener/IAfterBatchUpdateEventListener.php | RonieLiu/imi | f71701d6af08d2ee32ebcffd4a5034bec27afc0c | [
"MulanPSL-1.0"
] | null | null | null | <?php
namespace Imi\Model\Event\Listener;
use Imi\Model\Event\Param\AfterBatchUpdateEventParam;
/**
* 模型 批量更新后 事件监听接口
*/
interface IAfterBatchUpdateEventListener
{
/**
* 事件处理方法
* @param AfterBatchUpdateEventParam $e
* @return void
*/
public function handle(AfterBatchUpdateEventParam $e);
} | 18.941176 | 58 | 0.704969 |
23ad5ed35ae13c141180643b15eab1fc4d0cc914 | 22,530 | js | JavaScript | assets/anyChart/geodata/countries/sri_lanka/sri_lanka.topo.js | markosocco/KernelPMS | 99d3612d59ab2f2c22472c1634e7a9570fd4e5d7 | [
"MIT"
] | null | null | null | assets/anyChart/geodata/countries/sri_lanka/sri_lanka.topo.js | markosocco/KernelPMS | 99d3612d59ab2f2c22472c1634e7a9570fd4e5d7 | [
"MIT"
] | null | null | null | assets/anyChart/geodata/countries/sri_lanka/sri_lanka.topo.js | markosocco/KernelPMS | 99d3612d59ab2f2c22472c1634e7a9570fd4e5d7 | [
"MIT"
] | 1 | 2018-12-06T22:36:06.000Z | 2018-12-06T22:36:06.000Z | window['anychart']=window['anychart']||{};window['anychart']['maps']=window['anychart']['maps']||{};window['anychart']['maps']['sri_lanka']={"crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:EPSG:5234"}}, "ac-tx": {"default": {"crs": "+proj=tmerc +lat_0=7.000480277777778 +lon_0=80.77171111111112 +k=0.9999238418000001 +x_0=200000 +y_0=200000 +a=6377276.345 +b=6356075.41314024 +towgs84=-97,787,86,0,0,0,0 +units=m +no_defs", "scale": 1}}, "arcs": [[[5973, 3999], [39, -387], [97, -185], [-7, -83], [-120, -64], [-151, -35]], [[5831, 3245], [-184, 22], [-353, -9], [-102, 92], [-84, 12], [-141, 88], [55, -169], [-376, -282], [-162, 11], [-129, -51], [-251, 0], [-100, -46], [71, -3], [197, -159], [-54, -86], [-96, -58], [-129, 44], [-199, 170], [-127, 6]], [[3667, 2827], [35, 90], [-100, 124], [371, 93], [60, 65], [-115, 74], [9, 83], [-204, 89], [8, 49], [-192, 96], [-54, 79]], [[3485, 3669], [171, 8], [38, 108], [208, -31], [0, 55], [176, 27], [-62, 68], [105, 22]], [[4121, 3926], [91, -72], [282, -102], [163, -6], [94, 61], [-14, 94], [88, 61], [231, -93], [127, 11], [140, 67], [256, 19], [54, -38], [109, 72], [231, -1]], [[5998, 4599], [38, -149], [-42, -122]], [[5994, 4328], [-43, -120], [22, -209]], [[4121, 3926], [36, 76], [-106, 136], [11, 54], [79, 55], [14, 84], [-81, 45], [-107, 278], [-76, 82], [-73, 18], [10, 87]], [[3828, 4841], [243, 71], [78, 54], [124, -21], [66, 26], [179, 153], [24, 89], [78, -5], [169, 91], [177, 46]], [[4966, 5345], [100, -61], [23, -60], [121, 33], [186, -39], [-133, -79], [-121, -320], [-129, -17], [-30, -70], [52, -206], [44, -36], [117, -14], [199, 73], [106, -55], [30, 91], [237, -10], [230, 24]], [[5831, 3245], [66, -181], [-52, -46], [31, -63], [-141, -154], [-98, -84], [-248, -43], [-152, -127], [-163, 1], [5, -41], [142, -41], [94, -108], [-65, -61], [82, -27], [-129, -48]], [[5203, 2222], [-252, -76], [-489, -22], [-583, 54], [-91, 40], [50, 45], [-27, 61]], [[3811, 2324], [51, 25], [-41, 102], [-232, 67], [-38, 75], [31, 95], [-53, 36], [120, 56], [18, 47]], [[8749, 1678], [113, 939], [-107, 193], [29, 99], [-409, 98], [-110, 135], [52, 79], [164, 96], [-171, 193], [-98, 49], [-57, 280], [-57, 12], [65, 59], [-87, 13], [-213, -57], [-47, -52], [-106, -11], [30, -94], [-71, -64], [-90, -29], [-110, 3], [24, -194], [-172, -53], [-74, 92]], [[7247, 3464], [-105, 144], [-93, 1], [-115, 97], [-61, 176], [84, 174], [-17, 128], [-197, 24], [-312, -120], [-179, -34], [-109, 105], [-70, 139], [-79, 30]], [[5998, 4599], [329, 18], [161, -36], [131, -75], [406, -78], [83, 101], [7, 118]], [[7115, 4647], [380, -32], [250, -179], [276, -37], [-41, -194], [256, -128], [291, -28], [295, 18], [104, 34], [51, -272], [33, -41], [154, 88], [90, 41]], [[9254, 3917], [122, 12], [84, 8]], [[9460, 3937], [41, -14], [35, 26], [61, -141], [31, 0], [56, 169], [64, -28], [93, -136], [112, -218], [-19, -602], [65, -184], [-25, -102], [-203, -407], [-31, -143], [-229, -261], [31, -62], [-330, -331]], [[9212, 1503], [-148, 27], [-74, 48], [-108, 6], [-133, 94]], [[9693, 4015], [-65, -31], [-91, 45], [-1, 247], [-216, 172], [-61, 98], [0, 105], [361, -361], [73, -275]], [[9460, 3937], [-206, -20], [-90, -41], [-154, -88], [-33, 41], [-51, 272], [-104, -34], [-295, -18], [-291, 28], [-256, 128], [41, 194], [-276, 37], [-250, 179], [-380, 32]], [[7115, 4647], [-63, 198], [38, 197], [33, 74], [100, 39], [126, 10], [161, -12], [41, 2], [-37, 95], [-74, 92], [-33, 95], [35, 403], [-24, 134]], [[7418, 5974], [73, 15], [398, -24]], [[7889, 5965], [13, -27], [128, -295], [-80, -64], [-119, 227], [-32, 0], [0, -141], [174, -111], [75, 3], [53, 55], [72, -129], [173, -169], [63, 37], [28, -70], [91, 33], [0, -105], [155, -104], [-61, -16], [-26, -56], [52, -87], [92, -61], [125, 10], [76, -96], [254, -171], [11, -49], [-99, -17], [-285, 140], [-107, -30], [-31, -57], [105, -18], [77, 36], [100, -25], [21, -46], [213, -140], [-29, -30], [29, -42], [10, 55], [156, -54], [106, -140], [-30, -70], [31, -43], [-68, -47], [99, -85], [-44, -29]], [[4966, 5345], [6, 68], [86, 69], [-88, 41], [38, 189], [165, 302], [371, 19], [165, 143]], [[5709, 6176], [67, 11], [191, -90], [74, -85], [186, 11], [414, -47], [280, -76], [52, -140], [-75, -50], [39, -12], [111, 15], [113, 175], [133, 85], [124, 1]], [[5709, 6176], [125, 260], [154, 92], [-403, 388], [64, 144], [-115, 156], [-3, 110], [126, 130], [-145, 89], [-305, 113], [-255, -27]], [[4952, 7631], [57, 81]], [[5009, 7712], [694, 133]], [[5703, 7845], [1, -40], [52, -21], [-89, -54], [70, -31], [75, 3], [136, 121], [302, -251], [203, -78], [95, -132], [159, -58], [117, -201], [25, 35], [68, -17], [-13, -25], [164, -115], [0, -46], [-121, -59], [91, 18], [110, -182], [-110, -10], [23, 41], [-79, 38], [-34, -45], [60, -84], [-32, -39], [-229, 70], [-73, -18], [-58, -44], [21, -23], [160, 49], [190, -123], [300, -14], [69, 25], [-45, 60], [211, 37], [140, -83], [105, -303], [-166, 105], [21, -108], [24, -32], [165, -27], [28, -98], [40, -79], [10, -42]], [[3828, 4841], [-113, 62], [17, 89], [-75, 162], [-36, 36], [-134, 17], [-8, 210], [-230, 59], [-205, 104], [-970, 238]], [[2074, 5818], [-115, 66], [-89, -1], [-79, 34], [-167, -20], [-201, 376], [48, 63], [240, 125], [80, 98], [-25, 106]], [[1766, 6665], [80, -13]], [[1846, 6652], [9, 237], [-34, 150], [196, -46], [217, -1], [430, 64]], [[2664, 7056], [47, -155], [133, -30], [91, -121], [182, -37], [68, 70], [79, 19], [82, 110], [174, 130], [135, 36], [157, -56], [141, 0], [546, 313], [-118, 127], [-115, 22], [-8, 57], [329, 6], [128, 52], [237, 32]], [[2664, 7056], [-166, 125], [-105, 45], [1, 34], [17, 38], [114, 6], [66, 86], [124, 39], [408, 7], [238, 51], [22, 89]], [[3383, 7576], [-66, 98], [-69, 63]], [[3248, 7737], [-119, 33]], [[3129, 7770], [205, 73], [123, 58], [79, 68], [-25, 131], [-99, 33], [11, 37], [317, 4], [178, -99], [289, 118], [143, 3], [137, -31], [16, -82], [119, -7], [51, -52], [-50, -71], [134, 35], [139, -12], [140, -50], [54, -41], [-81, -173]], [[1255, 7740], [-38, -28], [16, 44], [22, -16]], [[43, 8051], [-43, -1], [55, 20], [93, -12], [-105, -7]], [[1108, 8014], [151, -84], [-274, 53], [243, -175], [-105, 8], [-379, 186], [-427, 80], [-22, 25], [71, 36], [197, -1], [366, -68], [179, -60]], [[2476, 8482], [4, -87], [27, -84], [82, -74], [8, -18], [5, -19], [-4, -39], [-16, -37], [10, -61], [-7, -52], [-97, -19], [-20, -25], [-14, -28], [-24, -30], [-15, -29], [41, -41], [-56, -91], [729, 22]], [[3129, 7770], [119, -33], [135, -161], [-22, -89], [-238, -51], [-408, -7], [-124, -39], [-66, -86], [-114, -6], [-17, -38], [-1, -34], [105, -45], [166, -125]], [[1846, 6652], [-608, 129]], [[1238, 6781], [128, 180], [40, 249], [-106, 159], [18, 211], [-64, 139], [139, 26], [447, 198], [274, 468]], [[2114, 8411], [184, 8], [93, 27], [85, 36]], [[2476, 8482], [116, -8], [-11, 71], [115, 86], [695, 17], [76, 110], [372, 0], [75, 23], [61, 116], [21, 3], [120, -66], [101, -32], [-12, 58], [13, 59], [94, 42], [10, 43], [21, 12]], [[4343, 9016], [23, 9], [26, 13]], [[4392, 9038], [522, -244], [241, -165], [-54, -17], [-187, 59], [-34, -6], [23, -27], [318, -151], [-46, 82], [90, -3], [258, -321], [-186, 28], [-25, -36], [170, -40], [10, -58], [94, 33], [88, -139], [185, -113], [-62, -45], [-60, 53], [-245, 52], [211, -135]], [[374, 9119], [-112, -3], [-148, 52], [14, 132], [77, -52], [189, -28], [51, -62], [-71, -39]], [[870, 9411], [86, -5], [-23, 40], [81, -19], [-9, -101], [-184, 13], [-6, 132], [55, -60]], [[1206, 9615], [104, -1], [31, -62], [195, -78], [-89, -18], [-138, 32], [-135, -31], [-68, 29], [-174, 181], [88, 146], [148, 2], [-24, -121], [62, -79]], [[2762, 9451], [-363, 85], [10, -63], [106, -64], [-62, -39], [-405, 156], [183, -105], [-212, 37], [-381, 145], [-237, 48], [-164, 192], [347, 140], [590, -11], [34, -107], [180, -26], [42, -29], [184, -4], [301, -189]], [[2915, 9617], [-153, -166]], [[4343, 9016], [-300, 118], [-398, 94]], [[3645, 9228], [-65, 123]], [[3580, 9351], [-537, 246], [-316, 211], [-414, 84], [-67, 28], [-8, 39], [397, 40], [148, -35], [81, -119], [576, -390], [952, -417]], [[1564, 8595], [-59, 31], [52, 30], [41, -25], [-34, -36]], [[2114, 8411], [38, 233], [-230, 83], [-57, 151], [150, 60], [238, 39], [97, 74], [151, 36], [-157, 121], [-412, 147], [-65, 47], [142, -2], [399, -121], [254, -37], [171, -77], [25, -28], [-54, -15], [0, -53], [93, -36], [616, 122], [343, -44], [277, -72], [210, -23]], [[3645, 9228], [-121, -28], [-59, 25], [-207, 7], [-496, 219]], [[2915, 9617], [211, -132], [454, -134]], [[3485, 3669], [-105, 88], [-204, -14], [-57, -156], [-369, -57], [-279, -117]], [[2471, 3413], [-266, 174], [-360, -79], [-122, 50], [-107, -2], [-264, -97]], [[1352, 3459], [-10, 152], [-162, 505], [1, 176], [163, 189], [117, 26], [-79, 32], [53, 63], [201, 47], [-41, 56], [81, 188], [239, 120], [52, 84], [120, 34], [26, 56], [92, -30], [56, 25], [-53, 57], [59, 59], [30, 191], [-113, 31], [-42, 46], [-68, 252]], [[1352, 3459], [-77, 17], [-117, -20], [-35, 23], [-274, -16]], [[849, 3463], [-215, 837], [64, 0], [40, 145], [-58, 74], [-124, 461], [-279, 589], [0, 82], [31, -17], [16, 47], [-45, 197], [141, 79], [222, 256], [-152, -176], [56, -45], [95, -9], [-88, -121], [-56, -17], [-84, -244], [9, -76], [99, -68], [-89, -106], [141, -59], [205, -10], [105, 43], [-178, 178], [150, 163], [-99, 237], [100, 125], [95, 410], [78, 60], [36, 196], [173, 87]], [[1238, 6781], [528, -116]], [[5203, 2222], [12, -95], [65, 17], [137, -52], [-41, -53], [-121, -32], [-21, -33], [47, -43], [169, -42], [279, 65]], [[5729, 1954], [-200, -185], [-86, -168], [-151, -141], [45, -240], [113, -103], [166, -59], [77, -106]], [[5693, 952], [123, -118], [-22, -45], [-256, 37], [-120, 65], [-255, -9], [-580, 96]], [[4583, 978], [24, 38], [-103, 83], [-187, -2], [30, 46], [-64, 68], [-271, -15], [-31, -42], [-174, -18]], [[3807, 1136], [-38, 31], [-351, 56], [-115, 62]], [[3303, 1285], [-348, 312], [-23, 43], [67, 15], [-64, 70], [-210, 92], [-26, 75], [-136, 75], [-156, 311]], [[2407, 2278], [98, 50], [-109, 67], [147, 149]], [[2543, 2544], [68, 18], [239, -148], [68, -30], [77, 16], [53, -48], [111, -14], [135, 44], [123, 2], [218, -55], [176, -5]], [[3807, 1136], [-152, -51], [121, -85], [-26, -72], [-138, 18], [-178, 86], [-145, 2], [226, -157], [33, -73], [-78, -55], [-156, 16], [67, -74], [-72, -102], [29, -50], [217, -104], [-219, -121], [127, -56], [-157, -98], [9, -58]], [[3315, 102], [-118, 38], [-77, -19], [-61, 36], [-354, 62], [-162, 62], [-33, -19], [-474, 273], [-288, 343], [-88, 243], [-133, 204]], [[1527, 1325], [81, -37], [74, 22], [55, -40], [332, -75], [145, -65], [193, -21], [121, 39], [135, 6], [269, -127], [-25, 162], [396, 96]], [[9212, 1503], [-275, -204], [-454, -154], [-824, -373], [-701, -160], [-8, 39], [-66, 9], [-50, -80], [-284, -77], [-933, -127], [-112, -25], [-67, -54], [-121, 13], [-116, -26], [-353, -152]], [[4848, 132], [-138, 38], [-52, 46], [34, 32], [-143, 37], [-11, 41], [145, 35], [-49, 99], [56, 43], [-174, 24], [-15, 44], [48, 49], [-225, 60], [54, 110], [171, 74], [-30, 40], [22, 64], [42, 10]], [[5693, 952], [443, 141], [-42, 57], [21, 58], [116, 3], [36, 63], [55, -22], [42, 27], [222, -7], [154, -66], [144, 22], [151, -129], [111, -26], [165, 63], [510, 115], [293, -2], [94, 132], [-25, 78], [368, 153], [119, 13], [79, 53]], [[4848, 132], [-68, -45], [-258, 0], [-291, -87], [-228, 52], [-331, -9], [-94, 77], [-75, -25], [-188, 7]], [[7247, 3464], [-173, -24], [-34, -102], [-161, -127], [-74, -18], [-135, 43], [-52, -45], [-13, -52], [220, -163], [163, 25], [105, -70], [36, -117], [-125, -249], [-102, 4], [-148, -94], [-208, -49], [109, -86], [-129, -23], [-39, -43], [-150, -7], [-40, -156], [18, -33], [77, -12], [6, -45], [-66, -59], [-8, -76], [108, -131], [-92, -19], [-14, -61], [-96, 31], [-80, -124], [-243, 281], [-70, 15], [-55, 75], [-53, 1]], [[2543, 2544], [37, 128], [-173, 26]], [[2407, 2698], [-53, 166], [23, 75], [154, 143], [-201, 1], [-54, 64], [19, 73], [128, 52], [48, 141]], [[2407, 2278], [-130, 17], [-144, -35], [28, -74], [-87, 13], [-57, 77], [-51, 11], [-124, -57], [-98, 10], [-171, -84], [-229, -47], [-206, 73], [28, -163]], [[1166, 2019], [-165, 244], [-65, 212], [6, 192]], [[942, 2667], [247, -55], [75, 21], [221, -38], [152, 12], [163, -65], [129, -17], [96, 3], [23, 98], [71, 40], [288, 32]], [[942, 2667], [54, 120], [-210, 432], [29, 64], [123, -212], [61, 35], [-1, 79], [-32, 63], [-124, 47], [33, 58], [-26, 110]], [[1527, 1325], [-79, 79], [61, 17], [-37, 146], [-306, 452]]], "transform": {"translate": [74633.0432726784, 80945.99936097216], "scale": [24.896797562297888, 43.19899952896725]}, "objects": {"features": {"type": "GeometryCollection", "geometries": [{"type": "Polygon", "properties": {"labelrank": 7, "code_hasc": "LK.KY", "name": "Mahanuvara", "admin": "Sri Lanka", "type_en": "District", "region": "Madhyama paḷāta", "woe_id": 23706513, "longitude": 80, "woe_name": "Kandy", "fips": "CE10", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "KY", "type": "Distrikkaya", "id": "LK.KY"}, "arcs": [[0, 1, 2, 3, 4]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.MT", "name": "Mātale", "admin": "Sri Lanka", "type_en": "District", "region": "Madhyama paḷāta", "woe_id": 23706512, "longitude": 80, "woe_name": "Matale", "fips": "CE14", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "MT", "type": "Distrikkaya", "id": "LK.MT"}, "arcs": [[5, 6, -5, 7, 8, 9]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.NW", "name": "Nuvara Ĕliya", "admin": "Sri Lanka", "type_en": "District", "region": "Madhyama paḷāta", "woe_id": 23706511, "longitude": 80, "woe_name": "Nuwara Eliya", "fips": "CE17", "woe_label": "", "latitude": 6, "iso_a2": "LK", "postal": "NW", "type": "Distrikkaya", "id": "LK.NW"}, "arcs": [[10, 11, 12, -2]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.AP", "name": "Ampāra", "admin": "Sri Lanka", "type_en": "District", "region": "Næ̆gĕnahira paḷāta", "woe_id": 23706509, "longitude": 81, "woe_name": "Ampara", "fips": "CE01", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "AP", "type": "Distrikkaya", "id": "LK.AP"}, "arcs": [[13, 14, -6, 15, 16, 17, 18, 19]]}, {"type": "MultiPolygon", "properties": {"labelrank": 9, "code_hasc": "LK.BC", "name": "Maḍakalapuva", "admin": "Sri Lanka", "type_en": "District", "region": "Næ̆gĕnahira paḷāta", "woe_id": 23706508, "longitude": 81, "woe_name": "Batticaloa", "fips": "CE04", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "BC", "type": "Distrikkaya", "id": "LK.BC"}, "arcs": [[[20]], [[21, 22, 23, 24]]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.PR", "name": "Pŏḷŏnnaruva", "admin": "Sri Lanka", "type_en": "District", "region": "Uturumæ̆da paḷāta", "woe_id": 23706504, "longitude": 81, "woe_name": "Polonnaruwa", "fips": "CE18", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "PR", "type": "Distrikkaya", "id": "LK.PR"}, "arcs": [[-23, -16, -10, 25, 26]]}, {"type": "Polygon", "properties": {"labelrank": 7, "code_hasc": "LK.TC", "name": "Trikuṇāmalaya", "admin": "Sri Lanka", "type_en": "District", "region": "Næ̆gĕnahira paḷāta", "woe_id": 23706507, "longitude": 81, "woe_name": "Trincomalee", "fips": "CE21", "woe_label": "", "latitude": 8, "iso_a2": "LK", "postal": "TC", "type": "Distrikkaya", "id": "LK.TC"}, "arcs": [[-27, 27, 28, 29, 30, -24]]}, {"type": "Polygon", "properties": {"labelrank": 7, "code_hasc": "LK.AD", "name": "Anurādhapura", "admin": "Sri Lanka", "type_en": "District", "region": "Uturumæ̆da paḷāta", "woe_id": 23706503, "longitude": 80, "woe_name": "Anuradhapura", "fips": "CE02", "woe_label": "", "latitude": 8, "iso_a2": "LK", "postal": "AD", "type": "Distrikkaya", "id": "LK.AD"}, "arcs": [[-26, -9, 31, 32, 33, 34, 35, -28]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.VA", "name": "Vavuniyāva", "admin": "Sri Lanka", "type_en": "District", "region": "Uturu paḷāta", "woe_id": 23706510, "longitude": 80, "woe_name": "Vavuniya", "fips": "CE28", "woe_label": "", "latitude": 8, "iso_a2": "LK", "postal": "VA", "type": "Distrikkaya", "id": "LK.VA"}, "arcs": [[-36, 36, 37, 38, 39, -29]]}, {"type": "MultiPolygon", "properties": {"labelrank": 9, "code_hasc": "LK.MB", "name": "Mannārama", "admin": "Sri Lanka", "type_en": "District", "region": "Uturu paḷāta", "woe_id": 23706506, "longitude": 80, "woe_name": "Mannar", "fips": "CE26", "woe_label": "", "latitude": 8, "iso_a2": "LK", "postal": "MB", "type": "Distrikkaya", "id": "LK.MB"}, "arcs": [[[40]], [[41]], [[42]], [[43, 44, -35, 45, 46, 47]]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.MP", "name": "Mulativ", "admin": "Sri Lanka", "type_en": "District", "region": "Uturu paḷāta", "woe_id": 23706505, "longitude": 80, "woe_name": "Mullaitivu", "fips": "CE27", "woe_label": "", "latitude": 9, "iso_a2": "LK", "postal": "MP", "type": "Distrikkaya", "id": "LK.MP"}, "arcs": [[-40, -44, 48, 49, 50, -30]]}, {"type": "MultiPolygon", "properties": {"labelrank": 9, "code_hasc": "LK.JA", "name": "Yāpanaya", "admin": "Sri Lanka", "type_en": "District", "region": "Uturu paḷāta", "woe_id": 23706489, "longitude": 79, "woe_name": "Jaffna", "fips": "CE25", "woe_label": "", "latitude": 9, "iso_a2": "LK", "postal": "JA", "type": "Distrikkaya", "id": "LK.JA"}, "arcs": [[[51]], [[52]], [[53]], [[54, 55]], [[56, 57, 58, -50]]]}, {"type": "MultiPolygon", "properties": {"labelrank": 9, "code_hasc": "LK.KL", "name": "Kilinŏchchi", "admin": "Sri Lanka", "type_en": "District", "region": "Uturu paḷāta", "woe_id": 23706490, "longitude": 80, "woe_name": "Kilinochchi", "fips": "", "woe_label": "", "latitude": 9, "iso_a2": "LK", "postal": "KL", "type": "Distrikkaya", "id": "LK.KL"}, "arcs": [[[59]], [[-49, -48, 60]], [[61, -56, 62, -58]]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.KG", "name": "Kuruṇægala", "admin": "Sri Lanka", "type_en": "District", "region": "Vayamba paḷāta", "woe_id": 23706501, "longitude": 80, "woe_name": "Kurunegala", "fips": "CE12", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "KG", "type": "Distrikkaya", "id": "LK.KG"}, "arcs": [[-8, -4, 63, 64, 65, -32]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.PX", "name": "Puttalama", "admin": "Sri Lanka", "type_en": "District", "region": "Vayamba paḷāta", "woe_id": 23706502, "longitude": 79, "woe_name": "Puttalam", "fips": "CE19", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "PX", "type": "Distrikkaya", "id": "LK.PX"}, "arcs": [[-66, 66, 67, 68, -33]]}, {"type": "Polygon", "properties": {"labelrank": 7, "code_hasc": "LK.RN", "name": "Ratnapura", "admin": "Sri Lanka", "type_en": "District", "region": "Sabaragamuva paḷāta", "woe_id": 23706494, "longitude": 80, "woe_name": "Ratnapura", "fips": "CE20", "woe_label": "", "latitude": 6, "iso_a2": "LK", "postal": "RN", "type": "Distrikkaya", "id": "LK.RN"}, "arcs": [[-12, 69, 70, 71, 72, 73, 74, 75, 76]]}, {"type": "Polygon", "properties": {"labelrank": 7, "code_hasc": "LK.GL", "name": "Gālla", "admin": "Sri Lanka", "type_en": "District", "region": "Dakuṇu paḷāta", "woe_id": 23706498, "longitude": 80, "woe_name": "Galle", "fips": "CE06", "woe_label": "", "latitude": 6, "iso_a2": "LK", "postal": "GL", "type": "Distrikkaya", "id": "LK.GL"}, "arcs": [[-74, 77, 78, 79]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.HB", "name": "Hambantŏṭa", "admin": "Sri Lanka", "type_en": "District", "region": "Dakuṇu paḷāta", "woe_id": 23706497, "longitude": 81, "woe_name": "Hambantota", "fips": "CE07", "woe_label": "", "latitude": 6, "iso_a2": "LK", "postal": "HB", "type": "Distrikkaya", "id": "LK.HB"}, "arcs": [[80, 81, -72, 82, -20]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.MH", "name": "Mātara", "admin": "Sri Lanka", "type_en": "District", "region": "Dakuṇu paḷāta", "woe_id": 23706496, "longitude": 80, "woe_name": "Matara", "fips": "CE15", "woe_label": "", "latitude": 6, "iso_a2": "LK", "postal": "MH", "type": "Distrikkaya", "id": "LK.MH"}, "arcs": [[-82, 83, -78, -73]]}, {"type": "Polygon", "properties": {"labelrank": 7, "code_hasc": "LK.BD", "name": "Badulla", "admin": "Sri Lanka", "type_en": "District", "region": "Ūva paḷāta", "woe_id": 23706499, "longitude": 81, "woe_name": "Badulla", "fips": "CE03", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "BD", "type": "Distrikkaya", "id": "LK.BD"}, "arcs": [[84, -70, -11, -1, -7, -15]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.MJ", "name": "Mŏṇarāgala", "admin": "Sri Lanka", "type_en": "District", "region": "Ūva paḷāta", "woe_id": 23706500, "longitude": 81, "woe_name": "Moneragala", "fips": "CE16", "woe_label": "", "latitude": 6, "iso_a2": "LK", "postal": "MJ", "type": "Distrikkaya", "id": "LK.MJ"}, "arcs": [[-83, -71, -85, -14]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.KE", "name": "Kægalla", "admin": "Sri Lanka", "type_en": "District", "region": "Sabaragamuva paḷāta", "woe_id": 23706495, "longitude": 80, "woe_name": "Kegalle", "fips": "CE11", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "KE", "type": "Distrikkaya", "id": "LK.KE"}, "arcs": [[-3, -13, -77, 85, 86, -64]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.CO", "name": "Kŏḷamba", "admin": "Sri Lanka", "type_en": "District", "region": "Basnāhira paḷāta", "woe_id": 23706493, "longitude": 80, "woe_name": "Colombo", "fips": "CE23", "woe_label": "", "latitude": 6, "iso_a2": "LK", "postal": "CO", "type": "Distrikkaya", "id": "LK.CO"}, "arcs": [[-76, 87, 88, 89, -86]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.GQ", "name": "Gampaha", "admin": "Sri Lanka", "type_en": "District", "region": "Basnāhira paḷāta", "woe_id": 23706491, "longitude": 80, "woe_name": "Gampaha", "fips": "CE24", "woe_label": "", "latitude": 7, "iso_a2": "LK", "postal": "GQ", "type": "Distrikkaya", "id": "LK.GQ"}, "arcs": [[-87, -90, 90, -67, -65]]}, {"type": "Polygon", "properties": {"labelrank": 9, "code_hasc": "LK.KT", "name": "Kaḷutara", "admin": "Sri Lanka", "type_en": "District", "region": "Basnāhira paḷāta", "woe_id": 23706492, "longitude": 80, "woe_name": "Kalutara", "fips": "CE09", "woe_label": "", "latitude": 6, "iso_a2": "LK", "postal": "KT", "type": "Distrikkaya", "id": "LK.KT"}, "arcs": [[-75, -80, 91, -88]]}]}}, "bbox": [74633.0432726784, 80945.99936097216, 323576.12209809496, 512892.79565111565], "type": "Topology"} | 22,530 | 22,530 | 0.493342 |
da26b5d78e33b8daa86a5e2106d02a012f5d4deb | 5,921 | php | PHP | application/views/admin/transaksi/excel.php | rahmatsubandi/lazadi | a39431ab2e3657196c09d6fe2667891bca19f84b | [
"MIT"
] | null | null | null | application/views/admin/transaksi/excel.php | rahmatsubandi/lazadi | a39431ab2e3657196c09d6fe2667891bca19f84b | [
"MIT"
] | null | null | null | application/views/admin/transaksi/excel.php | rahmatsubandi/lazadi | a39431ab2e3657196c09d6fe2667891bca19f84b | [
"MIT"
] | null | null | null | <?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=$title | $header_transaksi->nama_pelanggan.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?php echo $title ?></title>
</head>
<body>
<div class="cetak">
<h1>Laporan Detail Transaksi <?php echo $site->namaweb ?></h1>
<table border="1" width="100%">
<thead>
<tr>
<th>NAMA PELANGGAN</th>
<th>: <?php echo $header_transaksi->nama_pelanggan ?></th>
</tr>
<tr>
<th>KODE TRANSAKSI</th>
<th>: <?php echo $header_transaksi->kode_transaksi ?></th>
</tr>
</thead>
<tbody>
<tr>
<td>Tanggal</td>
<td>: <?php echo date('d-m-Y', strtotime($header_transaksi->tanggal_transaksi)) ?></td>
</tr>
<tr>
<td>Jumlah Total</td>
<td>: <?php echo number_format($header_transaksi->jumlah_transaksi) ?></td>
</tr>
<tr>
<td>Status Bayar</td>
<td>: <?php echo $header_transaksi->status_bayar ?></td>
</tr>
<tr>
<td>Bukti Bayar</td>
<td>: <?php if ($header_transaksi->bukti_bayar == "") { //Jika belum ada bukti bayar
echo 'Belum ada bukti bayar'; //makan menampilkan ini
} else {
// Kalo sudah ada bukti bayar maka menampilkan gambar
?>
<?php echo 'Sudah Bayar'; ?>
<?php } ?>
</td>
</tr>
<tr>
<td>Tanggal Bayar</td>
<td>: <?php if ($header_transaksi->tanggal_bayar == "") { //Jika belum bayar
echo 'Belum bayar'; //makan menampilkan ini
} else {
// Kalo sudah bayar menampilkan tanggal bayar
?>
<?php echo date('d-m-Y', strtotime($header_transaksi->tanggal_bayar)) ?>
<?php } ?>
</td>
</>
<tr>
<td>Jumlah Bayar</td>
<td>: <?php if ($header_transaksi->jumlah_bayar == "") { //Jika belum bayar
echo 'Belum bayar'; //makan menampilkan ini
} else {
// Kalo sudah bayar menampilkan total bayar
?>
<?php echo number_format($header_transaksi->jumlah_bayar, '0', ',', '.') ?>
<?php } ?>
</td>
</tr>
<tr>
<td>Pembayaran dari</td>
<td>: <?php if ($header_transaksi->nama_bank == "") { //Jika belum bayar
echo 'Belum bayar'; //makan menampilkan ini
} else {
// Kalo sudah bayar menampilkan data pemabayaran, no rekening, dan atas nama pemilik rekening
?>
<?php echo $header_transaksi->nama_bank ?> No. rekening
<?php echo $header_transaksi->rekening_pembayaran ?> a.n <?php echo $header_transaksi->rekening_pelanggan ?>
<?php } ?>
</td>
</tr>
<tr>
<td>Pembayaran ke rekening</td>
<td>: <?php if ($header_transaksi->bank == "") { //Jika belum bayar
echo 'Belum bayar'; //makan menampilkan ini
} else {
// Kalo sudah bayar menampilkan data pemabayaran, no rekening, dan atas nama pemilik rekening
?>
<?php echo $header_transaksi->bank ?> No. rekening
<?php echo $header_transaksi->nomor_rekening ?> a.n <?php echo $header_transaksi->nama_pemilik ?> <?php } ?>
</td>
</tr>
</tbody>
</table>
<br>
<table border="1" width="100%">
<thead>
<tr style="background-color:green">
<th class="text-center">NO</th>
<th class="text-center">KODE</th>
<th class="text-center">NAMA PRODUK</th>
<th class="text-center">JUMLAH</th>
<th class="text-center">HARGA</th>
<th class="text-center">SUB TOTAL</th>
</tr>
</thead>
<tbody class="text-center">
<?php $i = 1;
foreach ($transaksi as $transaksi) { ?>
<tr class="text-center">
<td class="text-center"><?php echo $i ?></td>
<td class="text-center"><?php echo $transaksi->kode_produk ?></td>
<td class="text-center"><?php echo $transaksi->nama_produk ?></td>
<td class="text-center"><?php echo number_format($transaksi->jumlah) ?></td>
<td class="text-center"><?php echo number_format($transaksi->harga) ?></td>
<td class="text-center"><?php echo number_format($transaksi->total_harga) ?></td>
</tr>
<?php $i++;
} ?>
</tbody>
</table>
</div>
</body>
</html> | 43.536765 | 136 | 0.411755 |
8da958609a0fdc4271ff1b34ba64498383d7e529 | 4,654 | js | JavaScript | src/components/Builds/PreviousBuildGallery/PreviousBuildGallery.js | cra1gg/website | 4bd7b392c00b4c129c3b999dc1766eeb73948809 | [
"MIT",
"Unlicense"
] | null | null | null | src/components/Builds/PreviousBuildGallery/PreviousBuildGallery.js | cra1gg/website | 4bd7b392c00b4c129c3b999dc1766eeb73948809 | [
"MIT",
"Unlicense"
] | null | null | null | src/components/Builds/PreviousBuildGallery/PreviousBuildGallery.js | cra1gg/website | 4bd7b392c00b4c129c3b999dc1766eeb73948809 | [
"MIT",
"Unlicense"
] | null | null | null | import React from 'react';
import './main.css'
import build1 from '../../../media/builds/build1.jpg'
import build2 from '../../../media/builds/build2.png'
import build3 from '../../../media/builds/build3.jpg'
import build4 from '../../../media/builds/build4.jpeg'
import build5 from '../../../media/builds/build5.png'
import { Image } from 'antd';
import { Row, Col, Card } from 'antd';
class PreviousBuildGallery extends React.Component {
render() {
return (
<div style={{
display: "block",
width: "100%",
overflow: "hidden",
textAlign: "center",
}}>
<Row gutter={[10, 60]}>
<Col className="gutter-row" xs={24} xl={8}>
<Card
className="card"
bordered={false}
cover={<Image src={build1}></Image>}
style={{
width: "80%",
alignItems: "center",
backgroundColor: "rgba(45, 45, 55, 0.7)",
}} >
<p class="card-text" style={{padding: "0px", lineHeight: "100%", marginBottom: "0.5rem"}}>Personal (2017)</p>
</Card>
</Col>
<Col className="gutter-row" xs={24} xl={8}>
<Card
className="card"
bordered={false}
cover={<Image src={build2}></Image>}
style={{
width: "80%",
alignItems: "center",
backgroundColor: "rgba(45, 45, 55, 0.7)",
}} >
<p class="card-text" style={{padding: "0px", lineHeight: "100%", marginBottom: "0.5rem"}}>Personal (2017)</p>
</Card>
</Col>
<Col className="gutter-row" xs={24} xl={8}>
<Card
className="card"
bordered={false}
cover={<Image src={build3}></Image>}
style={{
width: "80%",
alignItems: "center",
backgroundColor: "rgba(45, 45, 55, 0.7)",
}} >
<p class="card-text" style={{padding: "0px", lineHeight: "100%", marginBottom: "0.5rem"}}>Client (2017)</p>
</Card>
</Col>
<Col className="gutter-row" xs={24} xl={8}>
<Card
className="card"
bordered={false}
cover={<Image src={build4}></Image>}
style={{
width: "80%",
alignItems: "center",
backgroundColor: "rgba(45, 45, 55, 0.7)",
}} >
<p class="card-text" style={{padding: "0px", lineHeight: "100%", marginBottom: "0.5rem"}}>Personal (2018)</p>
</Card>
</Col>
<Col className="gutter-row" xs={24} xl={8}>
<Card
className="card"
bordered={false}
cover={<Image src={build5}></Image>}
style={{
width: "80%",
alignItems: "center",
backgroundColor: "rgba(45, 45, 55, 0.7)",
}} >
<p class="card-text" style={{padding: "0px", lineHeight: "100%", marginBottom: "0.5rem"}}>Client (2018)</p>
</Card>
</Col>
</Row>
</div>
);
}
}
export default PreviousBuildGallery;
| 41.553571 | 137 | 0.322303 |
0a84df42b9292ac27b0a9ba9a66bcdddf4eaa521 | 494 | cshtml | C# | Kroeg.Server/Views/Settings/Menu.cshtml | cobalto/Kroeg | 3ab6638e7747a517856041a7b77b39915ab450b0 | [
"MIT"
] | 1 | 2018-11-15T18:13:09.000Z | 2018-11-15T18:13:09.000Z | Kroeg.Server/Views/Settings/Menu.cshtml | cobalto/Kroeg | 3ab6638e7747a517856041a7b77b39915ab450b0 | [
"MIT"
] | null | null | null | Kroeg.Server/Views/Settings/Menu.cshtml | cobalto/Kroeg | 3ab6638e7747a517856041a7b77b39915ab450b0 | [
"MIT"
] | 1 | 2021-12-09T20:48:09.000Z | 2021-12-09T20:48:09.000Z | @*
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
@model Kroeg.Server.Controllers.SettingsController.BaseModel
<div class="list-group">
@foreach (var item in Model.Actors)
{
<a class="list-group-item list-group-item-action" href="@Url.Action("Edit", new { id = item.ActorId })">@item.ActorId</a>
}
<a class="list-group-item list-group-item-action" href="@Url.Action("NewActor")">New</a>
</div> | 35.285714 | 129 | 0.680162 |
c3780bb637edb94e7724489a1f44469393447d64 | 746 | cs | C# | Assets/Scripts/Commons/GameEventFloat.cs | SokPapageorgiou/Gravity | 5236cb4d789c28d39e3b1ac6ecbdd861275e46a2 | [
"MIT"
] | null | null | null | Assets/Scripts/Commons/GameEventFloat.cs | SokPapageorgiou/Gravity | 5236cb4d789c28d39e3b1ac6ecbdd861275e46a2 | [
"MIT"
] | null | null | null | Assets/Scripts/Commons/GameEventFloat.cs | SokPapageorgiou/Gravity | 5236cb4d789c28d39e3b1ac6ecbdd861275e46a2 | [
"MIT"
] | null | null | null | using System.Collections.Generic;
using UnityEngine;
namespace Commons
{
[CreateAssetMenu(menuName = "ScriptableObjects/Values/GameEventFloat", fileName = "NewEventFloat")]
public class GameEventFloat : ScriptableObject
{
private readonly List<GameEventListenerFloat> _listeners = new List<GameEventListenerFloat>();
public void Raise(float item)
{
foreach (var gameEventListener in _listeners)
{
gameEventListener.OnEventRaised(item);
}
}
public void Register(GameEventListenerFloat listener) => _listeners.Add(listener);
public void Unregister(GameEventListenerFloat listener) => _listeners.Remove(listener);
}
}
| 29.84 | 103 | 0.674263 |
231faa7603759657fd040c100b212ef2358fceaa | 2,061 | swift | Swift | ViewPagerExperiments/CenterCellCollectionViewFlowLayout.swift | OHAKO-Inc/ViewPagerExperiments | 902fe1508b8b4d0d5b349fa70e68e92f2a44879b | [
"MIT"
] | 2 | 2017-10-15T07:59:43.000Z | 2017-11-30T01:50:02.000Z | ViewPagerExperiments/CenterCellCollectionViewFlowLayout.swift | OHAKO-Inc/ViewPagerExperiments | 902fe1508b8b4d0d5b349fa70e68e92f2a44879b | [
"MIT"
] | null | null | null | ViewPagerExperiments/CenterCellCollectionViewFlowLayout.swift | OHAKO-Inc/ViewPagerExperiments | 902fe1508b8b4d0d5b349fa70e68e92f2a44879b | [
"MIT"
] | null | null | null | //
// CenterCellCollectionViewFlowLayout.swift
// ViewPagerExperiments
//
// Created by Yoshikuni Kato on 2016/04/21.
// Copyright © 2016年 Ohako Inc. All rights reserved.
//
import UIKit
class CenterCellCollectionViewFlowLayout: UICollectionViewFlowLayout {
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
guard let collectionView = collectionView,
let attributesForVisibleElements = layoutAttributesForElements(in: collectionView.bounds) else {
return super.targetContentOffset(forProposedContentOffset: proposedContentOffset)
}
let attributesForVisibleCells = attributesForVisibleElements.filter { (attributes) -> Bool in
return attributes.representedElementCategory == .cell
}
guard !attributesForVisibleCells.isEmpty else {
return super.targetContentOffset(forProposedContentOffset: proposedContentOffset)
}
let visibleRectHalfWidth = collectionView.bounds.size.width * 0.5
let proposedVisibleRectCenterX = proposedContentOffset.x + visibleRectHalfWidth
// find centerCell in proposedVisibleRect
var centerCellCandidateAttributes = attributesForVisibleCells.first!
for attributes in attributesForVisibleCells {
let centerDistanceBetweenCurrentCellAndVisibleRect = fabs(attributes.center.x - proposedVisibleRectCenterX)
let centerDistanceBetweenCandidateCellAndVisibleRect = fabs(centerCellCandidateAttributes.center.x - proposedVisibleRectCenterX)
if centerDistanceBetweenCurrentCellAndVisibleRect < centerDistanceBetweenCandidateCellAndVisibleRect {
centerCellCandidateAttributes = attributes
}
}
return CGPoint(x: round(centerCellCandidateAttributes.center.x - visibleRectHalfWidth), y: proposedContentOffset.y)
}
}
| 42.061224 | 148 | 0.715672 |
5002d62c5fbf7d224d50b01bbd0bee86e9a67974 | 179 | lua | Lua | Project_Professions/Media/lua/client/Tailor.lua | Grammarsalad/Project_Professions | 7344437bf0cfbe9cec4c9d96b84f0b921efef4e9 | [
"CC0-1.0"
] | null | null | null | Project_Professions/Media/lua/client/Tailor.lua | Grammarsalad/Project_Professions | 7344437bf0cfbe9cec4c9d96b84f0b921efef4e9 | [
"CC0-1.0"
] | 3 | 2021-05-21T02:23:21.000Z | 2021-05-21T02:23:49.000Z | Project_Professions/Media/lua/client/Tailor.lua | Grammarsalad/Project_Professions | 7344437bf0cfbe9cec4c9d96b84f0b921efef4e9 | [
"CC0-1.0"
] | null | null | null | ProfessionFramework.addProfession('tail', {
name = "Tailor",
icon = "profession_Tailor",
cost = 5,
xp = {
[Perks.Tailoring] = 4,
},
traits = {},
}) | 19.888889 | 43 | 0.530726 |
448988002510e3127956d886c6b4f0dbd44fbb16 | 897 | py | Python | scripts/mail/__init__.py | irahorecka/pweb2-dev | a685c42e84807ab786c4330a2ab4bb68d3d0387f | [
"MIT"
] | null | null | null | scripts/mail/__init__.py | irahorecka/pweb2-dev | a685c42e84807ab786c4330a2ab4bb68d3d0387f | [
"MIT"
] | null | null | null | scripts/mail/__init__.py | irahorecka/pweb2-dev | a685c42e84807ab786c4330a2ab4bb68d3d0387f | [
"MIT"
] | null | null | null | """
/scripts/mail/__init__.py
Concerns all things emails.
"""
import inspect
import os
import traceback
from dotenv import load_dotenv
from scripts.mail.mail import write_email
load_dotenv()
def email_if_exception(func):
"""Wrapper that sends an email to [email protected] if the
wrapped function raises an exception."""
def wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except:
write_email(
os.environ["EMAIL_USER"],
os.environ["EMAIL_PASS"],
"[email protected]",
f"An exception occurred in function {inspect.getfile(func)}::{func.__name__}",
f"An exception occurred in function {inspect.getfile(func)}::{func.__name__}. Check error message below.",
code=str(traceback.format_exc()),
)
return wrapper
| 24.916667 | 122 | 0.619844 |
5d734406d164dd56a50e9f6dc0ce43d148360e57 | 455 | hpp | C++ | server/include/tds/ip/address_v4.hpp | JMazurkiewicz/TinDox | 7f6c8e826683c875692fc97a3e89a4c5833dabf9 | [
"MIT"
] | null | null | null | server/include/tds/ip/address_v4.hpp | JMazurkiewicz/TinDox | 7f6c8e826683c875692fc97a3e89a4c5833dabf9 | [
"MIT"
] | null | null | null | server/include/tds/ip/address_v4.hpp | JMazurkiewicz/TinDox | 7f6c8e826683c875692fc97a3e89a4c5833dabf9 | [
"MIT"
] | null | null | null | #pragma once
#include <cstdint>
#include <ostream>
namespace tds::ip {
class AddressV4 {
public:
static const AddressV4 any;
AddressV4();
explicit AddressV4(std::uint32_t address);
std::uint32_t as_integer() const;
bool operator==(const AddressV4&) const noexcept = default;
private:
std::uint32_t m_address;
};
std::ostream& operator<<(std::ostream& stream, AddressV4 address);
}
| 19.782609 | 70 | 0.632967 |
6cadcd5fc459530800cffd9d9446121e5d2216b2 | 581 | sql | SQL | DatabaseBuilder/Identity/Migrations/000006-Migrate-AspNetUserRoles.sql | mwijnen/WebPortal | 96d54747061ce95be62ce9332dcec14c8576b4bc | [
"MIT"
] | null | null | null | DatabaseBuilder/Identity/Migrations/000006-Migrate-AspNetUserRoles.sql | mwijnen/WebPortal | 96d54747061ce95be62ce9332dcec14c8576b4bc | [
"MIT"
] | null | null | null | DatabaseBuilder/Identity/Migrations/000006-Migrate-AspNetUserRoles.sql | mwijnen/WebPortal | 96d54747061ce95be62ce9332dcec14c8576b4bc | [
"MIT"
] | null | null | null | CREATE TABLE [dbo].[AspNetUserRoles] (
[UserId] NVARCHAR (450) NOT NULL,
[RoleId] NVARCHAR (450) NOT NULL,
CONSTRAINT [PK_AspNetUserRoles] PRIMARY KEY CLUSTERED ([UserId] ASC, [RoleId] ASC),
CONSTRAINT [FK_AspNetUserRoles_AspNetRoles_RoleId] FOREIGN KEY ([RoleId]) REFERENCES [dbo].[AspNetRoles] ([Id]) ON DELETE CASCADE,
CONSTRAINT [FK_AspNetUserRoles_AspNetUsers_UserId] FOREIGN KEY ([UserId]) REFERENCES [dbo].[AspNetUsers] ([Id]) ON DELETE CASCADE
);
GO
CREATE NONCLUSTERED INDEX [IX_AspNetUserRoles_RoleId]
ON [dbo].[AspNetUserRoles]([RoleId] ASC);
| 44.692308 | 134 | 0.738382 |
3f85b1361736f342252baea63be407694cdb7426 | 6,759 | php | PHP | examples/index.php | BaptisteHugot/informationPageWeb | f01e61889455b9f881fa3d531be7cfacdcc9e171 | [
"MIT"
] | null | null | null | examples/index.php | BaptisteHugot/informationPageWeb | f01e61889455b9f881fa3d531be7cfacdcc9e171 | [
"MIT"
] | null | null | null | examples/index.php | BaptisteHugot/informationPageWeb | f01e61889455b9f881fa3d531be7cfacdcc9e171 | [
"MIT"
] | null | null | null | <?php
/**
* @file index.php
* @brief Page permettant de récupérer les informations sur les adresses IP utilisées par un domaine
*/
declare(strict_types = 1); // On définit le mode strict
/* Code utilisé uniquement pour le débogage, à supprimer en production */
error_reporting(E_ALL);
ini_set('display_errors','1');
/* Fin du code utilisé uniquement pour le débogage, à supprimer en production */
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Récupération d'informations sur une page Internet</title>
<link rel="StyleSheet" type="text/css" href="style.css">
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script src="./style.js"></script>
</head>
<body>
<!-- Le formulaire qui sera utilisé -->
<form name="form" method="post" action="index.php" id="form">
<input type="radio" id="serveur" name="choix" value="serveur" class="radioSelect" required>Serveurs du domaine
<input type="radio" id="lastCheck" name="choix" value="lastCheck" class="radioSelect" required> Derniers sites testés
<input type="radio" id="hallOfFame" name="choix" value="hallOfFame" class="radioSelect" required> Hall of Fame
<input type="radio" id="hallOfShame" name="choix" value="hallOfShame" class="radioSelect" required> Hall of Shame
<br />
<input type="radio" id="whois" name="choix" value="whois" class="radioSelect" required>Whois du domaine
<input type="radio" id="http" name="choix" value="http" class="radioSelect" required>Entête HTTP de la page
<input type="radio" id="meta" name="choix" value="meta" class="radioSelect" required> Balises meta de la page
<br />
<input type="radio" id="usersIP" name="choix" value="usersIP" class="radioSelect" required> Adresses IP de l'utilisateur
<input type="radio" id="userAgent" name="choix" value="userAgent" class="radioSelect" required> Navigateur de l'utilisateur
<br />
<input type="radio" id="hostIP" name="choix" value="hostIP" class="radioSelect" required> Adresse IP du domaine
<input type="radio" id="ping" name="choix" value="ping" class="radioSelect" required> Hôte à pinger
<input type="radio" id="pingPort" name="choix" value="pingPort" class="radioSelect" required> Hôte et port à pinger
<br />
<input type="text" class="specificField serveur whois http meta" id="site" name="site" placeholder="URL de la page Internet : " />
<input type="text" class="specificField hostIP" id="ip" name="ip" placeholder="Adresse IP : " />
<input type="text" class="specificField ping pingPort" id="host" name="host" placeholder="Hôte : " />
<input type="text" class="specificField pingPort" id="port" name="port" placeholder="Port : " />
<br />
<input type="submit" name="submit"></input>
</form>
</body>
</html>
<?php
include("./db.php");
include("displayFunctions.php");
include("db_insertion.php");
if(isset($_POST["choix"]) && $_POST["choix"] != ""){
$radioValue = $_POST["choix"]; // On récupère la valeur du radio bouton
$start = microtime(true); // Début du chronomètre
if($radioValue === "usersIP"){
$usersIP = getUserIP();
displayUsersIP($usersIP);
}else if($radioValue === "userAgent"){
$user = getUserAgent();
displayUserAgent($user);
}else if($radioValue === "lastCheck"){
lastManualChecks();
}else if($radioValue === "hallOfFame"){
displayHallOfFame();
}else if($radioValue === "hallOfShame"){
displayHallOfShame();
}else{
if(isset($_POST["site"]) && $_POST["site"] != ""){
$searchedWebsite = $_POST["site"]; // On récupère la valeur du champ texte
$searchedWebsite = cleanEntry($searchedWebsite);
if(urlExists($searchedWebsite)){ // On vérifie que le site entré est au bon format
list($hostWithoutSubdomain, $hostWithWWW, $hostWithSubdomain, $hasSubdomain, $hasWWW, $extension) = arrayDomains($searchedWebsite);
displayWebsite($searchedWebsite);
if($radioValue === "serveur"){ // On récupère les informations sur les adresses IP
list($arrayWebsiteIPv4WithoutSubdomain, $arrayWebsiteIPv6WithoutSubdomain, $arrayWebsiteIPv4WithSubdomain, $arrayWebsiteIPv6WithSubdomain, $arrayWebsiteIPv4WithWWW, $arrayWebsiteIPv6WithWWW, $arrayNSServers, $arrayNSServersIPv4, $arrayNSServersIPv6, $arrayMXServers, $arrayMXServersIPv4, $arrayMXServersIPv6, $arrayCAAServers, $arraySOAMname, $arraySOARname, $hasSubdomain, $hasWWW, $hostWithoutSubdomain, $hostWithWWW, $hostWithSubdomain, $arrayResultsIPv6) = manualCheck($hostWithoutSubdomain, $hostWithWWW, $hostWithSubdomain, $hasSubdomain, $hasWWW);
displayStars($arrayResultsIPv6);
displayDomainServers($arrayWebsiteIPv4WithoutSubdomain, $arrayWebsiteIPv6WithoutSubdomain, $arrayWebsiteIPv4WithSubdomain, $arrayWebsiteIPv6WithSubdomain, $arrayWebsiteIPv4WithWWW, $arrayWebsiteIPv6WithWWW, $arrayNSServers, $arrayNSServersIPv4, $arrayNSServersIPv6, $arrayMXServers, $arrayMXServersIPv4, $arrayMXServersIPv6, $arrayCAAServers, $arraySOAMname, $arraySOARname, $hasSubdomain, $hasWWW, $hostWithoutSubdomain, $hostWithWWW, $hostWithSubdomain);
manualCheckInsertion($arrayResultsIPv6, $hostWithoutSubdomain);
manualDateInsertion();
} else if($radioValue === "whois"){ // On récupère les informations du Whois
$whois = array();
$whois = getWhois($hostWithoutSubdomain,$extension);
displayWhois($whois);
}else if($radioValue === "http"){ // On récupère les entêtes HTTP
list($httpHeaders, $keys, $values) = getHeaders(getLastLocation($searchedWebsite));
displayHeaders($httpHeaders, $keys, $values);
}else if($radioValue === "meta"){ // On récupère l'ensemble des balises meta
list($metaTags, $keys, $values) = getMeta(getLastLocation($searchedWebsite));
displayMeta($metaTags, $keys,$values);
}
mysqli_close($connexion); // On ferme la connexion à la base de données
}else{
displayErrorFormat();
}
}else if(isset($_POST["ip"]) && $_POST["ip"] != ""){
if($radioValue === "hostIP"){
$ip = $_POST["ip"];
list($ip, $arrayHosts) = getHosts($ip);
displayHostsIP($ip, $arrayHosts);
}
}else if(isset($_POST["host"]) && $_POST["host"] != "" && isset($_POST["port"]) && $_POST["port"] != ""){
if($radioValue === "pingPort"){
$host = $_POST["host"];
$port = $_POST["port"];
$port = intval($port);
$arrayPing = array();
$arrayPing = pingWithPort($host, $port);
displayPingPort($arrayPing);
}
}else if(isset($_POST["host"]) && $_POST["host"] != ""){
if($radioValue === "ping"){
$host = $_POST["host"];
$arrayPing = array();
$arrayPing = pingWithoutPort($host);
displayPing($arrayPing);
}
}
$end = microtime(true); // Fin du chronomètre
displayExecutionTime($start, $end);
}
}
?>
| 43.88961 | 559 | 0.701583 |
bb142ee448f53fa3d002b99a2fbaf4e729c92008 | 6,716 | cs | C# | src/WindowsAccessBridgeInterop/Win32/UnmanagedLibrary.cs | jonathanbp/access-bridge-explorer | f6ed6e9ea68b283a9230a498b9107a100a446612 | [
"Apache-2.0"
] | 101 | 2016-03-02T20:59:42.000Z | 2022-02-23T02:55:16.000Z | src/WindowsAccessBridgeInterop/Win32/UnmanagedLibrary.cs | jonathanbp/access-bridge-explorer | f6ed6e9ea68b283a9230a498b9107a100a446612 | [
"Apache-2.0"
] | 23 | 2016-03-04T19:49:33.000Z | 2021-07-17T03:43:34.000Z | src/WindowsAccessBridgeInterop/Win32/UnmanagedLibrary.cs | jonathanbp/access-bridge-explorer | f6ed6e9ea68b283a9230a498b9107a100a446612 | [
"Apache-2.0"
] | 46 | 2016-04-15T07:35:20.000Z | 2022-03-24T08:40:04.000Z | // Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System;
using System.Diagnostics;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Text;
using Microsoft.Win32.SafeHandles;
namespace WindowsAccessBridgeInterop.Win32 {
/// <summary>
/// Utility class to wrap an unmanaged DLL and be responsible for freeing it.
/// </summary>
/// <remarks>
/// This is a managed wrapper over the native LoadLibrary, GetProcAddress, and
/// FreeLibrary calls.
/// </remarks>
public class UnmanagedLibrary : IDisposable {
// Unmanaged resource. CLR will ensure SafeHandles get freed, without requiring a finalizer on this class.
private readonly SafeLibraryHandle _libraryHandle;
/// <summary>
/// Constructor to load a dll and be responible for freeing it.
/// </summary>
/// <param name="fileName">full path name of dll to load</param>
/// <exception cref="System.IO.FileNotFoundException">if fileName can't be found</exception>
/// <remarks>Throws exceptions on failure. Most common failure would be file-not-found, or
/// that the file is not a loadable image.</remarks>
public UnmanagedLibrary(string fileName) {
_libraryHandle = NativeMethods.LoadLibrary(fileName);
if (_libraryHandle.IsInvalid) {
try {
var hr = Marshal.GetHRForLastWin32Error();
Marshal.ThrowExceptionForHR(hr);
} catch (Exception e) {
throw new Exception(string.Format("Error loading library \"{0}\"", fileName), e);
}
}
}
public string Path {
get {
if (_libraryHandle.IsInvalid) {
throw new InvalidOperationException("Cannot retrieve path because no library has been loaded yet");
}
var sb = new StringBuilder(4096);
var size = NativeMethods.GetModuleFileName(_libraryHandle, sb, (uint)sb.Capacity);
if (size == 0) {
throw new InvalidOperationException("Error retrieving library path");
}
return sb.ToString(0, (int)size);
}
}
public FileVersionInfo Version {
get { return FileVersionInfo.GetVersionInfo(Path); }
}
/// <summary>
/// Dynamically lookup a function in the dll via kernel32!GetProcAddress.
/// </summary>
/// <param name="functionName">raw name of the function in the export table.</param>
/// <returns>null if function is not found. Else a delegate to the unmanaged function.
/// </returns>
/// <remarks>GetProcAddress results are valid as long as the dll is not yet unloaded. This
/// is very very dangerous to use since you need to ensure that the dll is not unloaded
/// until after you're done with any objects implemented by the dll. For example, if you
/// get a delegate that then gets an IUnknown implemented by this dll,
/// you can not dispose this library until that IUnknown is collected. Else, you may free
/// the library and then the CLR may call release on that IUnknown and it will crash.</remarks>
public TDelegate GetUnmanagedFunction<TDelegate>(string functionName) where TDelegate : class {
var p = NativeMethods.GetProcAddress(_libraryHandle, functionName);
// Failure is a common case, especially for adaptive code.
if (p == IntPtr.Zero) {
return null;
}
Delegate function = Marshal.GetDelegateForFunctionPointer(p, typeof(TDelegate));
// Ideally, we'd just make the constraint on TDelegate be
// System.Delegate, but compiler error CS0702 (constrained can't be System.Delegate)
// prevents that. So we make the constraint system.object and do the cast from object-->TDelegate.
object o = function;
return (TDelegate)o;
}
public Delegate GetUnmanagedFunction(string functionName, Type type) {
var p = NativeMethods.GetProcAddress(_libraryHandle, functionName);
// Failure is a common case, especially for adaptive code.
if (p == IntPtr.Zero) {
return null;
}
return Marshal.GetDelegateForFunctionPointer(p, type);
}
/// <summary>
/// Call FreeLibrary on the unmanaged dll. All function pointers
/// handed out from this class become invalid after this.
/// </summary>
/// <remarks>This is very dangerous because it suddenly invalidate
/// everything retrieved from this dll. This includes any functions
/// handed out via GetProcAddress, and potentially any objects returned
/// from those functions (which may have an implemention in the
/// dll).</remarks>
public void Dispose() {
if (!_libraryHandle.IsClosed) {
_libraryHandle.Close();
}
}
// See http://msdn.microsoft.com/msdnmag/issues/05/10/Reliability/ for more about safe handles.
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
private sealed class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid {
private SafeLibraryHandle() : base(true) { }
protected override bool ReleaseHandle() {
return NativeMethods.FreeLibrary(handle);
}
}
static class NativeMethods {
const string SKernel = "kernel32";
[DllImport(SKernel, CharSet = CharSet.Auto, BestFitMapping = false, SetLastError = true)]
public static extern SafeLibraryHandle LoadLibrary(string fileName);
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[DllImport(SKernel, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FreeLibrary(IntPtr hModule);
[DllImport(SKernel)]
public static extern IntPtr GetProcAddress(SafeLibraryHandle hModule, string procname);
[DllImport(SKernel, CharSet = CharSet.Auto, BestFitMapping = false, SetLastError = true)]
public static extern uint GetModuleFileName(
[In]SafeLibraryHandle hModule,
[Out]StringBuilder lpFilename,
[In]uint nSize);
}
}
} | 42.238994 | 111 | 0.678678 |
14f233d9c45a39681fd7728662e668dbf448cef5 | 2,102 | ts | TypeScript | src/domain/repos.ts | progre/nrf | a0b02e3b89d7388f0e151f7c2234ca77ba564e53 | [
"MIT"
] | 12 | 2017-01-08T14:46:30.000Z | 2021-02-27T22:15:46.000Z | src/domain/repos.ts | progre/nrf | a0b02e3b89d7388f0e151f7c2234ca77ba564e53 | [
"MIT"
] | 7 | 2016-12-04T03:23:10.000Z | 2017-09-25T12:49:31.000Z | src/domain/repos.ts | progre/nrf | a0b02e3b89d7388f0e151f7c2234ca77ba564e53 | [
"MIT"
] | null | null | null | export const SERVICES = [
{
name: 'restreamio',
icon: 'https://restream.io/favicon.ico',
url: 'https://restream.io/',
label: 'Restream.io',
pushBy: null,
supportedByRestreamIo: false,
},
{
name: 'twitch',
icon: 'https://www.twitch.tv/favicon.ico',
url: 'https://www.twitch.tv/',
label: 'Twitch',
pushBy: null,
supportedByRestreamIo: true,
},
{
name: 'peercaststation',
// tslint:disable-next-line:no-http-string
icon: 'http://127.0.0.1:7144/html/favicon.ico',
// tslint:disable-next-line:no-http-string
url: 'http://www.pecastation.org/',
label: 'PeerCastStation',
pushBy: 'nginx',
supportedByRestreamIo: false,
},
{
name: 'youtube',
icon: 'https://s.ytimg.com/yts/img/favicon_32-vfl8NGn4k.png',
url: 'https://www.youtube.com/',
label: 'YouTube',
pushBy: 'ffmpeg',
supportedByRestreamIo: true,
},
{
name: 'fresh',
icon: 'https://freshlive.tv/assets/1479961350/favicon.ico',
url: 'https://freshlive.tv/',
label: 'FRESH!',
pushBy: null,
supportedByRestreamIo: false,
},
{
name: 'cavetube',
icon: 'https://www.cavelis.net/favicon.ico',
url: 'https://www.cavelis.net/',
label: 'CaveTube',
pushBy: 'ffmpeg',
supportedByRestreamIo: true,
},
{
name: 'livecodingtv',
icon: 'https://www.livecoding.tv/favicon.ico',
url: 'https://www.livecoding.tv/',
label: 'Livecoding.tv',
pushBy: null,
supportedByRestreamIo: true,
},
{
name: 'niconico',
icon: 'https://www.nicovideo.jp/favicon.ico',
url: 'https://live.nicovideo.jp/',
label: 'niconico',
pushBy: null,
supportedByRestreamIo: true,
},
{
name: 'other1',
icon: '',
url: '',
label: 'Other 1',
pushBy: null,
supportedByRestreamIo: false,
},
{
name: 'other2',
icon: '',
url: '',
label: 'Other 2',
pushBy: null,
supportedByRestreamIo: false,
},
{
name: 'other3',
icon: '',
url: '',
label: 'Other 3',
pushBy: null,
supportedByRestreamIo: false,
},
];
| 22.602151 | 65 | 0.584681 |
bc6324b46000ca49f60ae5205dfa046e0aa768d9 | 2,046 | swift | Swift | Sources/Hope/Hope.swift | thousandyears/ThousandExtensions | 91c1b21a64301d285e13ac1c23243ba754fc16d4 | [
"MIT"
] | 6 | 2020-12-11T16:04:06.000Z | 2022-03-02T19:46:46.000Z | Sources/Hope/Hope.swift | thousandyears/ThousandExtensions | 91c1b21a64301d285e13ac1c23243ba754fc16d4 | [
"MIT"
] | 4 | 2020-05-21T09:19:30.000Z | 2020-11-15T11:34:20.000Z | Sources/Hope/Hope.swift | thousandyears/ThousandExtensions | 91c1b21a64301d285e13ac1c23243ba754fc16d4 | [
"MIT"
] | 1 | 2020-12-01T14:03:04.000Z | 2020-12-01T14:03:04.000Z | @_exported import XCTest
infix operator ± : RangeFormationPrecedence
public typealias hope = Test
public struct Test<T> {
public let value: () throws -> T
public let file: StaticString
public let line: UInt
}
extension Test {
public init(
_ value: @escaping @autoclosure () throws -> T,
file: StaticString = #file,
line: UInt = #line
) {
self.value = value
self.file = file
self.line = line
}
}
extension Test where T: Equatable {
@inlinable
public static func == (l: Test, r: @autoclosure () throws -> T) {
XCTAssertEqual(try l.value(), try r(), file: l.file, line: l.line)
}
@inlinable
public static func != (l: Test, r: @autoclosure () throws -> T) {
XCTAssertNotEqual(try l.value(), try r(), file: l.file, line: l.line)
}
}
extension Test where T: Comparable {
@inlinable
public static func > (l: Test, r: @autoclosure () throws -> T) {
XCTAssertGreaterThan(try l.value(), try r(), file: l.file, line: l.line)
}
@inlinable
public static func < (l: Test, r: @autoclosure () throws -> T) {
XCTAssertLessThan(try l.value(), try r(), file: l.file, line: l.line)
}
@inlinable
public static func >= (l: Test, r: @autoclosure () throws -> T) {
XCTAssertGreaterThanOrEqual(try l.value(), try r(), file: l.file, line: l.line)
}
@inlinable
public static func <= (l: Test, r: @autoclosure () throws -> T) {
XCTAssertLessThanOrEqual(try l.value(), try r(), file: l.file, line: l.line)
}
}
extension Test where T: FloatingPoint {
@inlinable
public static func ~= (l: Test<T>, r: ClosedRange<T>) {
let e = (r.upperBound - r.lowerBound) / 2
XCTAssertEqual(try l.value(), r.lowerBound + e, accuracy: e, file: l.file, line: l.line)
}
}
extension FloatingPoint {
@inlinable public static func ± (l: Self, r: Self) -> ClosedRange<Self> {
(l - abs(r)) ... (l + abs(r))
}
}
| 26.571429 | 96 | 0.581134 |
20be771f816a28cfadc3ec8d0c918bab3a054018 | 459 | py | Python | proxy/examples/simple/libraries/data_transfer/mqtt_transfer.py | Smart-IoT-Systems/FaaS4IoT | 094609808cf377d948ef99d2b752b806d05c756e | [
"Apache-2.0"
] | null | null | null | proxy/examples/simple/libraries/data_transfer/mqtt_transfer.py | Smart-IoT-Systems/FaaS4IoT | 094609808cf377d948ef99d2b752b806d05c756e | [
"Apache-2.0"
] | null | null | null | proxy/examples/simple/libraries/data_transfer/mqtt_transfer.py | Smart-IoT-Systems/FaaS4IoT | 094609808cf377d948ef99d2b752b806d05c756e | [
"Apache-2.0"
] | 1 | 2021-08-17T08:38:00.000Z | 2021-08-17T08:38:00.000Z | import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
print("Connected to mqtt broker with result code"+str(rc))
def publish(client,topic,dataToPublish):
#client = mqtt.Client()
client.publish(topic,dataToPublish,0)
#print("here we are in publish method",dataToPublish)
def configConnection(host_name,broker_port):
client = mqtt.Client()
client.on_connect = on_connect
client.connect(host_name, broker_port,60)
return client
| 28.6875 | 59 | 0.777778 |
c3aea2003046a9b268751a56caf456dd008d5fa3 | 187 | cs | C# | src/Day20/TransformKinds.cs | qbit86/advent-of-code-2020-public | ba8e5925b67064a5b90e8a31fbc6b65fabab5a3b | [
"MIT"
] | null | null | null | src/Day20/TransformKinds.cs | qbit86/advent-of-code-2020-public | ba8e5925b67064a5b90e8a31fbc6b65fabab5a3b | [
"MIT"
] | null | null | null | src/Day20/TransformKinds.cs | qbit86/advent-of-code-2020-public | ba8e5925b67064a5b90e8a31fbc6b65fabab5a3b | [
"MIT"
] | null | null | null | using System;
namespace AdventOfCode2020
{
[Flags]
public enum TransformKinds
{
None = 0,
FlipX = 1,
FlipY = 0b10,
Transpose = 0b100
}
}
| 13.357143 | 30 | 0.529412 |
455199a498d300b4645fc0b3734da54bee4fb8c0 | 4,026 | py | Python | NippoKun/report/tests/test_search.py | KIKUYA-Takumi/Nippokun | aa82f97aaf5b61d94b213425f28314a248914eb9 | [
"MIT"
] | null | null | null | NippoKun/report/tests/test_search.py | KIKUYA-Takumi/Nippokun | aa82f97aaf5b61d94b213425f28314a248914eb9 | [
"MIT"
] | 4 | 2016-10-19T00:23:21.000Z | 2016-11-04T01:29:08.000Z | NippoKun/report/tests/test_search.py | KIKUYA-Takumi/NippoKun | aa82f97aaf5b61d94b213425f28314a248914eb9 | [
"MIT"
] | null | null | null | from django.contrib.auth.models import User
from django.db.models import Q
from django.test import TestCase, Client, RequestFactory
from ..models import Report
# Create your tests here.
class SearchTest(TestCase):
def setUp(self):
self.client = Client()
self.client.post('/report/user_register/',
{'username': 'john',
'password1': 'johnpass',
'password2': 'johnpass'})
self.client.login(username='john', password='johnpass')
request_factory = RequestFactory()
self.request = request_factory.get('/report/mypage/')
self.request.user = User.objects.get(pk=1)
self.client.post('/report/report_entries/',
{'report_author': self.request.user,
'report_title': 'test title',
'report_content': 'test'
})
self.client.post('/report/report_entries/',
{'report_author': self.request.user,
'report_title': 'search test',
'report_content': 'search'
})
def test_search_one_word(self):
query_search_word = 'search'
search_words = query_search_word.split()
search_reports = []
for i in range(len(search_words)):
search_reports += Report.objects.filter(Q(report_content__contains=search_words[i]))
count = len(search_reports)
self.assertEqual(count, 1)
def test_search_many_words(self):
query_search_word = 'test search'
search_words = query_search_word.split()
search_reports = []
for i in range(len(search_words)):
search_reports += Report.objects.filter(Q(report_content__contains=search_words[i]))
count = len(search_reports)
self.assertEqual(count, 2)
def test_search_no_hit_word(self):
query_search_word = 'python'
search_words = query_search_word.split()
search_reports = []
for i in range(len(search_words)):
search_reports += Report.objects.filter(Q(report_content__contains=search_words[i]))
count = len(search_reports)
self.assertEqual(count, 0)
class SearchReportsTest(TestCase):
def setUp(self):
self.client = Client()
self.client.post('/report/user_register/',
{'username': 'john',
'password1': 'johnpass',
'password2': 'johnpass'})
self.client.login(username='john', password='johnpass')
request_factory = RequestFactory()
self.request = request_factory.get('/report/mypage/')
self.request.user = User.objects.get(pk=1)
self.client.post('/report/report_entries/',
{'report_author': self.request.user,
'report_title': 'test title',
'report_content': 'test'
})
self.client.post('/report/report_entries/',
{'report_author': self.request.user,
'report_title': 'search test',
'report_content': 'search'
})
self.client.post('/report/report_entries/',
{'report_author': self.request.user,
'report_title': 'search ',
'report_content': 'This is search '
})
"""
status_code = 302: created new score.
status_code = 200: not create new score.
"""
def test_search(self):
query_search_word = 'search'
search_words = query_search_word.split()
search_reports = []
for i in range(len(search_words)):
search_reports += Report.objects.filter(Q(report_content__contains=search_words[i]))
count = len(search_reports)
self.assertEqual(count, 2)
| 39.470588 | 96 | 0.55539 |
4d246f00c4617394e93f4718ad95b5c003c9d867 | 286 | sh | Shell | code/run_test_denoiser.sh | RulinShao/denoised-smoothing | 644d335ad8c3348c32f5b5b4779f0e80e0c54d73 | [
"MIT"
] | null | null | null | code/run_test_denoiser.sh | RulinShao/denoised-smoothing | 644d335ad8c3348c32f5b5b4779f0e80e0c54d73 | [
"MIT"
] | null | null | null | code/run_test_denoiser.sh | RulinShao/denoised-smoothing | 644d335ad8c3348c32f5b5b4779f0e80e0c54d73 | [
"MIT"
] | null | null | null |
export IMAGENET_DIR=/home/xc150/certify/discrete/smoothing-master
python test_denoiser.py \
--dataset imagenet \
--noise_sd 0.25 \
--denoiser denoiser/resnet152/sigma_25/best.pth.tar \
--clf resnet152 \
--outdir test_deno/resnet152/sigma_25 \
--batch 128 \
--gpu 0,1,2,3 | 26 | 65 | 0.72028 |
9376b61a21ae5b5a375e0f74ef6c2f453a4c152c | 3,917 | cs | C# | Assets/Scripts/Handlers/MultiTouchCurvedNoteDetector.cs | nopponaim603/BMP-U | 52072a1134d8a4304a41013c3b8d141da8a348a9 | [
"Artistic-2.0"
] | 74 | 2016-05-29T21:06:53.000Z | 2022-02-11T11:42:44.000Z | Assets/Scripts/Handlers/MultiTouchCurvedNoteDetector.cs | nopponaim603/BMP-U | 52072a1134d8a4304a41013c3b8d141da8a348a9 | [
"Artistic-2.0"
] | 1 | 2020-08-02T13:00:14.000Z | 2020-08-02T13:00:14.000Z | Assets/Scripts/Handlers/MultiTouchCurvedNoteDetector.cs | nopponaim603/BMP-U | 52072a1134d8a4304a41013c3b8d141da8a348a9 | [
"Artistic-2.0"
] | 17 | 2017-06-30T13:20:39.000Z | 2021-12-28T02:58:50.000Z | using UnityEngine;
using System.Collections.Generic;
using BMS;
using BMS.Visualization;
[RequireComponent(typeof(NoteSpawnerSP))]
public class MultiTouchCurvedNoteDetector : MonoBehaviour {
public Camera hitTestCamera;
public NoteDetector noteDetector;
public NoteSpawnerSP noteSpawner;
public float startLength, endLength;
readonly Dictionary<int, int> touchMapping = new Dictionary<int, int>();
int mouseMapping;
bool previousMouseState;
Vector3 previousMousePosition;
void Start() {
Input.multiTouchEnabled = true;
if(Input.touchSupported) Input.simulateMouseWithTouches = false;
}
void Update() {
IList<int> mapping = noteSpawner.MappedChannels;
int idx;
bool touchHandled = false;
foreach(var touch in Touches.Instance) {
switch(touch.phase) {
case TouchPhase.Began:
idx = DetectIndex(touch.position, mapping);
touchMapping[touch.fingerId] = idx;
HandleTouch(idx, mapping, true);
break;
case TouchPhase.Moved:
idx = DetectIndex(touch.position, mapping);
if(idx != touchMapping[touch.fingerId]) {
HandleTouch(touchMapping[touch.fingerId], mapping, false);
HandleTouch(idx, mapping, true);
touchMapping[touch.fingerId] = idx;
}
break;
case TouchPhase.Ended:
case TouchPhase.Canceled:
idx = DetectIndex(touch.position, mapping);
HandleTouch(idx, mapping, false);
touchMapping[touch.fingerId] = -1;
break;
}
touchHandled = true;
}
if(!touchHandled) {
bool currentMouseState = Input.GetMouseButton(0);
Vector3 currentMousePosition = Input.mousePosition;
if(currentMouseState != previousMouseState) {
idx = DetectIndex(currentMousePosition, mapping);
HandleTouch(idx, mapping, currentMouseState);
mouseMapping = currentMouseState ? idx : -1;
} else if(currentMousePosition != previousMousePosition && currentMouseState) {
idx = DetectIndex(currentMousePosition, mapping);
if(idx != mouseMapping) {
HandleTouch(mouseMapping, mapping, false);
HandleTouch(idx, mapping, true);
mouseMapping = idx;
}
}
previousMouseState = currentMouseState;
previousMousePosition = currentMousePosition;
}
}
int DetectIndex(Vector3 position, IList<int> mapping) {
int mappingCount = mapping.Count;
if(mappingCount <= 0) return -1;
Vector3 localPosition = hitTestCamera.ScreenToWorldPoint(position, Vector3.Distance(hitTestCamera.transform.position, noteSpawner.centroid));
float distance = Vector2.Distance(localPosition, noteSpawner.centroid);
if(distance < startLength || distance > endLength) return -1;
float anglePerSlot = (noteSpawner.clampRangeEnd - noteSpawner.clampRangeStart) / mappingCount;
float angle = Mathf.Repeat(Mathf.Atan2(localPosition.y - noteSpawner.centroid.y, localPosition.x - noteSpawner.centroid.x) * Mathf.Rad2Deg, 360F) + anglePerSlot / 2;
if(angle < noteSpawner.clampRangeStart || angle > noteSpawner.clampRangeEnd + anglePerSlot) return -1;
return Mathf.FloorToInt(Mathf.Clamp(Mathf.InverseLerp(noteSpawner.clampRangeStart, noteSpawner.clampRangeEnd + anglePerSlot, angle) * mappingCount, 0, mappingCount - 1));
}
void HandleTouch(int i, IList<int> mapping, bool isDown) {
if(i >= 0) noteDetector.OnClick(mapping[i], isDown);
}
}
| 44.011236 | 178 | 0.615777 |
7f90f064bc8353a357a69a285f0f502041fcffa2 | 498 | php | PHP | config/dependencies.php | ingenerator/pigeonhole | ac83220dbf5ace02afab4b4cc736ca8ea38fffe0 | [
"BSD-3-Clause"
] | null | null | null | config/dependencies.php | ingenerator/pigeonhole | ac83220dbf5ace02afab4b4cc736ca8ea38fffe0 | [
"BSD-3-Clause"
] | null | null | null | config/dependencies.php | ingenerator/pigeonhole | ac83220dbf5ace02afab4b4cc736ca8ea38fffe0 | [
"BSD-3-Clause"
] | null | null | null | <?php
/**
* Dependency container configuration for pigeonhole, to use
* with https://github.com/zeelot/kohana-dependencies
*/
return array(
'pigeonhole' => array(
'_settings' => array(
'class' => 'Ingenerator\Pigeonhole\Pigeonhole',
'arguments' => array('%session%'),
'shared' => TRUE,
),
),
'session' => array(
'_settings' => array(
'class' => 'Session',
'constructor' => 'instance',
'arguments' => array(),
'shared' => TRUE,
),
),
); | 22.636364 | 61 | 0.568273 |
8454cba942c0840c4d03e85a8497e5d8e5a2330d | 135 | lua | Lua | src/items/keys/document.lua | snpster/hawkthorne-journey | 123632f84602f34b51fc514106fdde2d296ebc15 | [
"MIT"
] | null | null | null | src/items/keys/document.lua | snpster/hawkthorne-journey | 123632f84602f34b51fc514106fdde2d296ebc15 | [
"MIT"
] | null | null | null | src/items/keys/document.lua | snpster/hawkthorne-journey | 123632f84602f34b51fc514106fdde2d296ebc15 | [
"MIT"
] | null | null | null | return{
name = "document",
description = "Document",
type = "key",
info = "An important- looking document",
MAX_ITEMS = 1,
}
| 16.875 | 42 | 0.622222 |
b782ae90c712d56dc5301eed9c6d2457122afd3f | 999 | cpp | C++ | Common01/Source/Common/Log/LogConsumerConsole.cpp | DavidCoenFish/game02 | 3011cf2fe069b579759aa95333cb406a8ff52d53 | [
"Unlicense"
] | null | null | null | Common01/Source/Common/Log/LogConsumerConsole.cpp | DavidCoenFish/game02 | 3011cf2fe069b579759aa95333cb406a8ff52d53 | [
"Unlicense"
] | null | null | null | Common01/Source/Common/Log/LogConsumerConsole.cpp | DavidCoenFish/game02 | 3011cf2fe069b579759aa95333cb406a8ff52d53 | [
"Unlicense"
] | null | null | null | #include "CommonPCH.h"
#include "Common/Log/LogConsumerConsole.h"
#include "Common/Log/Log.h"
#include "Common/Util/Utf8.h"
LogConsumerConsole::LogConsumerConsole(const std::vector<bool>& topicFilterArrayOrEmpty)
: m_topicFilterArrayOrEmpty(topicFilterArrayOrEmpty)
{
if (TRUE == AttachConsole(ATTACH_PARENT_PROCESS))
{
FILE* pFileOut = nullptr;
freopen_s(&pFileOut, "conout$","w",stdout);
LOG_MESSAGE("AttachConsole");
}
}
LogConsumerConsole::~LogConsumerConsole()
{
//nop
}
void LogConsumerConsole::AddMessage(const LogTopic topic, const std::string& message )
{
std::string text = std::to_string((int)topic) + std::string(":") + message + "\n";
OutputDebugStringW(Utf8::Utf8ToUtf16(text).c_str());
printf(text.c_str());
}
const bool LogConsumerConsole::AcceptsTopic(const LogTopic topic)
{
if ((0 <= (int)topic) && ((int)topic < m_topicFilterArrayOrEmpty.size()))
{
return m_topicFilterArrayOrEmpty[(int)topic];
}
return true;
}
| 24.975 | 88 | 0.703704 |
0aca4d9ca5d5daedfddfc1eb3ea153eb4faf9265 | 267 | cs | C# | SkyStore.Api/Mapping/ModelDTOMapProfile.cs | lowellrueca/SkyStore | 5b57b2f55674372f1525f4d61171eba1709bf5cf | [
"MIT"
] | 1 | 2022-01-09T04:04:54.000Z | 2022-01-09T04:04:54.000Z | SkyStore.Api/Mapping/ModelDTOMapProfile.cs | lowellrueca/SkyStore | 5b57b2f55674372f1525f4d61171eba1709bf5cf | [
"MIT"
] | null | null | null | SkyStore.Api/Mapping/ModelDTOMapProfile.cs | lowellrueca/SkyStore | 5b57b2f55674372f1525f4d61171eba1709bf5cf | [
"MIT"
] | null | null | null | using AutoMapper;
using SkyStore.DB.Models;
using SkyStore.Shared.DTO;
namespace SkyStore.Api.Mapping
{
public class ModelDTOMapProfile : Profile
{
public ModelDTOMapProfile()
{
CreateMap<Product, ProductDTO>();
}
}
}
| 17.8 | 45 | 0.640449 |
5db18a3a6b19a7799cfc90c49021f84d6f461dad | 255 | cpp | C++ | problem/01000~09999/01110/1110.cpp14.cpp | njw1204/BOJ-AC | 1de41685725ae4657a7ff94e413febd97a888567 | [
"MIT"
] | 1 | 2019-04-19T16:37:44.000Z | 2019-04-19T16:37:44.000Z | problem/01000~09999/01110/1110.cpp14.cpp | njw1204/BOJ-AC | 1de41685725ae4657a7ff94e413febd97a888567 | [
"MIT"
] | 1 | 2019-04-20T11:42:44.000Z | 2019-04-20T11:42:44.000Z | problem/01000~09999/01110/1110.cpp14.cpp | njw1204/BOJ-AC | 1de41685725ae4657a7ff94e413febd97a888567 | [
"MIT"
] | 3 | 2019-04-19T16:37:47.000Z | 2021-10-25T00:45:00.000Z | #include <iostream>
using namespace std;
int main(){
int N, val1, val2, count=0;
cin >> N;
int val3 = N;
do{
val1 = val3%10;
val2 = (val3/10+val1)%10;
val3 = val1*10+val2;
count++;
}while(val3!=N);
cout << count;
return 0;
} | 15.9375 | 29 | 0.556863 |
cafa32593f45942227a9b45c8a158b34b99e9c9c | 1,166 | rb | Ruby | lib/zeus/api_client/result.rb | CiscoZeus/ruby-zeusclient | 83721e5e30f7ef3ef71ef5d80cd4858686bb096a | [
"Apache-2.0"
] | null | null | null | lib/zeus/api_client/result.rb | CiscoZeus/ruby-zeusclient | 83721e5e30f7ef3ef71ef5d80cd4858686bb096a | [
"Apache-2.0"
] | 8 | 2016-10-19T21:36:08.000Z | 2021-05-24T05:12:01.000Z | lib/zeus/api_client/result.rb | CiscoZeus/ruby-zeusclient | 83721e5e30f7ef3ef71ef5d80cd4858686bb096a | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 Cisco Systems, Inc.
#
# 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.
require 'json'
module Zeus
# Wrapper to interface with return values from the api
class Result
# constructor for Result class
def initialize(response)
@response = response
end
# request is successed?
def success?
@response.code == 200 || @response.code == 201
end
# request is error?
def error?
!success?
end
# response code
def code
@response.code
end
# response header
def header
@response.headers
end
# response body
def data
JSON.parse(@response)
end
end
end
| 22.862745 | 74 | 0.684391 |
071ad69f4ddd62617b322e26202b5e7731a0772f | 378 | css | CSS | admin/src/main/webapp/app/css/app.css | remibantos/jeeshop | 8d24d210090c57fcb5580c4a9f25afe3532cdc95 | [
"Apache-2.0"
] | 45 | 2015-01-21T18:44:50.000Z | 2019-03-27T18:02:43.000Z | admin/src/main/webapp/app/css/app.css | remibantos/jeeshop | 8d24d210090c57fcb5580c4a9f25afe3532cdc95 | [
"Apache-2.0"
] | 28 | 2015-01-02T18:44:37.000Z | 2020-11-30T13:39:02.000Z | admin/src/main/webapp/app/css/app.css | remibantos/jeeshop | 8d24d210090c57fcb5580c4a9f25afe3532cdc95 | [
"Apache-2.0"
] | 45 | 2015-01-13T13:45:00.000Z | 2019-01-28T05:58:19.000Z | #loaderDiv {
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
z-index:1100;
}
.ajax-loader {
position: absolute;
left: 50%;
top: 50%;
margin-left: -32px; /* -1 * image width / 2 */
margin-top: -32px; /* -1 * image height / 2 */
display: block;
}
.side_menu_item_title {
margin-left:1.5em;
}
th a{
color: #333;
} | 15.12 | 51 | 0.539683 |
e2f603c5ae6e42e16ccac0c3158c3b5c4e70a4e6 | 1,514 | py | Python | coarseactin/utils/HexGrid.py | cabb99/CoarseGrainedActin | 037dfddec2b985e529620e1b83d1cc48bd930b93 | [
"MIT"
] | 1 | 2021-03-02T22:45:04.000Z | 2021-03-02T22:45:04.000Z | coarseactin/utils/HexGrid.py | cabb99/CoarseGrainedActin | 037dfddec2b985e529620e1b83d1cc48bd930b93 | [
"MIT"
] | 1 | 2021-09-17T18:21:39.000Z | 2021-09-17T18:21:39.000Z | coarseactin/utils/HexGrid.py | cabb99/CoarseGrainedActin | 037dfddec2b985e529620e1b83d1cc48bd930b93 | [
"MIT"
] | null | null | null | import numpy as np
class HexGrid():
deltas = [[1, 0, -1], [0, 1, -1], [-1, 1, 0], [-1, 0, 1], [0, -1, 1], [1, -1, 0]]
a0 = 0
a1 = np.pi / 3
a2 = -np.pi / 3
vecs = np.array([[np.sqrt(3) * np.cos(a0), np.sin(a0) / np.sqrt(3)],
[np.sqrt(3) * np.cos(a1), np.sin(a1) / np.sqrt(3)],
[np.sqrt(3) * np.cos(a2), np.sin(a2) / np.sqrt(3)]])
def __init__(self, radius):
self.radius = radius
self.tiles = {(0, 0, 0): "X"}
for r in range(radius):
a = 0
b = -r
c = +r
for j in range(6):
num_of_hexas_in_edge = r
for i in range(num_of_hexas_in_edge):
a = a + self.deltas[j][0]
b = b + self.deltas[j][1]
c = c + self.deltas[j][2]
self.tiles[a, b, c] = "X"
def coords(self):
tiles = np.array([a for a in self.tiles.keys()])
coords = np.dot(tiles, self.vecs)
return coords
def show(self):
l = []
for y in range(20):
l.append([])
for x in range(60):
l[y].append(".")
for (a, b, c), tile in self.tiles.items():
l[self.radius - 1 - b][a - c + (2 * (self.radius - 1))] = self.tiles[a, b, c]
mapString = ""
for y in range(len(l)):
for x in range(len(l[y])):
mapString += l[y][x]
mapString += "\n"
print(mapString) | 34.409091 | 89 | 0.416116 |
da39c25d42d745d254b4f452fd16665d80bb7a62 | 292 | rb | Ruby | lib/specinfra/command/freebsd/base/service.rb | mrkn/specinfra | 5eb0940fa837445aa51160884c5951ca594206fa | [
"MIT"
] | 163 | 2015-08-10T05:17:24.000Z | 2022-02-12T07:18:22.000Z | lib/specinfra/command/freebsd/base/service.rb | mrkn/specinfra | 5eb0940fa837445aa51160884c5951ca594206fa | [
"MIT"
] | 276 | 2015-07-28T15:23:30.000Z | 2022-03-31T03:13:46.000Z | lib/specinfra/command/freebsd/base/service.rb | mrkn/specinfra | 5eb0940fa837445aa51160884c5951ca594206fa | [
"MIT"
] | 239 | 2015-07-29T22:13:10.000Z | 2022-03-31T02:44:53.000Z | class Specinfra::Command::Freebsd::Base::Service < Specinfra::Command::Base::Service
class << self
def check_is_enabled(service, level=3)
"service #{escape(service)} enabled"
end
def check_is_running(service)
"service #{escape(service)} onestatus"
end
end
end
| 26.545455 | 84 | 0.688356 |
07902274af48a517e7c57dc6771c65324dd94f23 | 4,178 | hpp | C++ | src/eos/radiationProperties/zimmer.hpp | ubdsgroup/ablate | c469c1f8f334e37a8d33b22f5d30ee7801806c4b | [
"BSD-3-Clause"
] | null | null | null | src/eos/radiationProperties/zimmer.hpp | ubdsgroup/ablate | c469c1f8f334e37a8d33b22f5d30ee7801806c4b | [
"BSD-3-Clause"
] | null | null | null | src/eos/radiationProperties/zimmer.hpp | ubdsgroup/ablate | c469c1f8f334e37a8d33b22f5d30ee7801806c4b | [
"BSD-3-Clause"
] | null | null | null | #ifndef ABLATELIBRARY_RADIATIONPROPERTIESZIMMER_H
#define ABLATELIBRARY_RADIATIONPROPERTIESZIMMER_H
#include "eos/radiationProperties/radiationProperties.hpp"
#include "finiteVolume/compressibleFlowFields.hpp"
#include "radiationProperties.hpp"
#include "solver/cellSolver.hpp"
#include "utilities/mathUtilities.hpp"
namespace ablate::eos::radiationProperties {
/** A radiation gas absorption model which computes the absorptivity based on the presence of certain species. */
class Zimmer : public RadiationModel {
private:
struct FunctionContext {
PetscInt densityYiH2OOffset;
PetscInt densityYiCO2Offset;
PetscInt densityYiCOOffset;
PetscInt densityYiCH4Offset;
const ThermodynamicFunction temperatureFunction;
const ThermodynamicFunction densityFunction;
};
/**
* Eos is needed to compute field values
*/
const std::shared_ptr<eos::EOS> eos;
/** Some constants that are used in the Zimmer gas absorption model */
constexpr static double kapparef = 1; //!< Reference absorptivity
constexpr static double Tsurf = 300.; //!< Reference temperature in Kelvin
/** These are the constants stored for the model. */
constexpr static std::array<double, 7> H2O_coeff = {0.22317e1, -.15829e1, .1329601e1, -.50707, .93334e-1, -0.83108e-2, 0.28834e-3};
constexpr static std::array<double, 7> CO2_coeff = {0.38041E1, -0.27808E1, 0.11672E1, -0.284910E0, 0.38163E-1, -0.26292E-2, 0.73662E-4}; //!< polynomial coefficients for H2O
constexpr static std::array<double, 5> CH4_coeff = {6.6334E0, -3.5686E-3, 1.6682E-8, 2.5611E-10, -2.6558E-14}; //!< polynomial coefficients for CH4
constexpr static std::array<double, 5> CO_1_coeff = {4.7869E0, -6.953E-2, 2.95775E-4, -4.25732E-7, 2.02894E-10}; //!< polynomial coefficients for CO with T <= 750 K
constexpr static std::array<double, 5> CO_2_coeff = {1.0091E1, -1.183E-2, 4.7753E-6, -5.87209E-10, -2.5334E-14}; //!< polynomial coefficients for CO with T > 750 K
constexpr static double MWC = 1.2010700e+01;
constexpr static double MWO = 1.599940e+01;
constexpr static double MWH = 1.007940e+00;
constexpr static double UGC = 8314.4; //!< Universal Gas Constant J/(K kmol)
constexpr static double MWCO = MWC + MWO;
constexpr static double MWCO2 = MWC + 2. * MWO;
constexpr static double MWCH4 = MWC + 4. * MWH;
constexpr static double MWH2O = 2. * MWH + MWO;
/**
* private static function for evaluating constant properties without temperature
* @param conserved
* @param property
* @param ctx
*/
static PetscErrorCode ZimmerFunction(const PetscReal conserved[], PetscReal* property, void* ctx);
/**
* private static function for evaluating constant properties without temperature
* @param conserved
* @param property
* @param ctx
*/
static PetscErrorCode ZimmerTemperatureFunction(const PetscReal conserved[], PetscReal temperature, PetscReal* property, void* ctx);
public:
explicit Zimmer(std::shared_ptr<eos::EOS> eosIn);
explicit Zimmer(const Zimmer&) = delete;
void operator=(const Zimmer&) = delete;
/**
* Single function to produce radiation properties function for any property based upon the available fields
* @param property
* @param fields
* @return
*/
[[nodiscard]] ThermodynamicFunction GetRadiationPropertiesFunction(RadiationProperty property, const std::vector<domain::Field>& fields) const override;
/**
* Single function to produce thermodynamic function for any property based upon the available fields and temperature
* @param property
* @param fields
* @return
*/
[[nodiscard]] ThermodynamicTemperatureFunction GetRadiationPropertiesTemperatureFunction(RadiationProperty property, const std::vector<domain::Field>& fields) const override;
PetscInt GetFieldComponentOffset(const std::string& str, const domain::Field& field) const;
};
} // namespace ablate::eos::radiationProperties
#endif // ABLATELIBRARY_RADIATIONPROPERTIESZIMMER_H
| 46.422222 | 193 | 0.702489 |
05a1ba3132402582cd7e2a98818df2839f7bfe6e | 436 | py | Python | 201214/step_01.py | kurganITteacher/python-basics | a398c0e90ee76969d3fa4b8a0aa0a9cdd43f7af0 | [
"Apache-2.0"
] | null | null | null | 201214/step_01.py | kurganITteacher/python-basics | a398c0e90ee76969d3fa4b8a0aa0a9cdd43f7af0 | [
"Apache-2.0"
] | null | null | null | 201214/step_01.py | kurganITteacher/python-basics | a398c0e90ee76969d3fa4b8a0aa0a9cdd43f7af0 | [
"Apache-2.0"
] | 1 | 2020-10-11T16:05:00.000Z | 2020-10-11T16:05:00.000Z | def show_user(user):
print('имя:', user[0])
print('фамилия:', user[2])
print('возраст:', user[3])
user_1 = ['Иван', 'Иванович', 'Иванов', 21, 'г.Курган']
# 0 1 2 3 4
user_2 = ['Петр', 'Петрович', 'Петров', 19, 'г.Далматово']
user_3 = ['Сидорова', 'Валерьевна', 'Оксана', 23, 'г.Шадринск']
# show_user(user_1)
# show_user(user_2)
# show_user(user_3)
for el in user_1:
print(el)
| 24.222222 | 63 | 0.557339 |
72791327bac731b1386e62d4939ff3721725b99b | 1,828 | h | C | ext/phalcon/encryption/crypt/padfactory.zep.h | tidytrax/cphalcon | f2dbbb86bbc3e9929878549a2dedbbb67211b9d1 | [
"BSD-3-Clause"
] | 2 | 2021-11-22T07:57:29.000Z | 2021-12-01T07:07:35.000Z | ext/phalcon/encryption/crypt/padfactory.zep.h | tidytrax/cphalcon | f2dbbb86bbc3e9929878549a2dedbbb67211b9d1 | [
"BSD-3-Clause"
] | 1 | 2019-03-02T21:31:55.000Z | 2019-03-02T21:31:55.000Z | ext/phalcon/encryption/crypt/padfactory.zep.h | tidytrax/cphalcon | f2dbbb86bbc3e9929878549a2dedbbb67211b9d1 | [
"BSD-3-Clause"
] | 3 | 2019-02-14T15:19:42.000Z | 2021-04-22T18:08:27.000Z |
extern zend_class_entry *phalcon_encryption_crypt_padfactory_ce;
ZEPHIR_INIT_CLASS(Phalcon_Encryption_Crypt_PadFactory);
PHP_METHOD(Phalcon_Encryption_Crypt_PadFactory, __construct);
PHP_METHOD(Phalcon_Encryption_Crypt_PadFactory, newInstance);
PHP_METHOD(Phalcon_Encryption_Crypt_PadFactory, padNumberToService);
PHP_METHOD(Phalcon_Encryption_Crypt_PadFactory, getServices);
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_encryption_crypt_padfactory___construct, 0, 0, 0)
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, services, IS_ARRAY, 0, "[]")
#else
ZEND_ARG_ARRAY_INFO(0, services, 0)
#endif
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_encryption_crypt_padfactory_newinstance, 0, 1, Phalcon\\Encryption\\Crypt\\Padding\\PadInterface, 0)
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_encryption_crypt_padfactory_padnumbertoservice, 0, 1, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, number, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_encryption_crypt_padfactory_getservices, 0, 0, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEPHIR_INIT_FUNCS(phalcon_encryption_crypt_padfactory_method_entry) {
PHP_ME(Phalcon_Encryption_Crypt_PadFactory, __construct, arginfo_phalcon_encryption_crypt_padfactory___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_ME(Phalcon_Encryption_Crypt_PadFactory, newInstance, arginfo_phalcon_encryption_crypt_padfactory_newinstance, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Encryption_Crypt_PadFactory, padNumberToService, arginfo_phalcon_encryption_crypt_padfactory_padnumbertoservice, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Encryption_Crypt_PadFactory, getServices, arginfo_phalcon_encryption_crypt_padfactory_getservices, ZEND_ACC_PROTECTED)
PHP_FE_END
};
| 49.405405 | 155 | 0.885667 |
a35f0bf74d01270835b2680df59fb26ce1440e4c | 1,596 | java | Java | zuul-auth-api-reward/src/main/java/com/linrry/auth/zuul/reward/api/controller/FundsController.java | YangDiA/spring-cloud-zuul-authentication | 24b562c7d4827f125523543d1b859f151d9ab541 | [
"Apache-2.0"
] | 8 | 2018-09-01T13:27:21.000Z | 2020-11-22T07:59:55.000Z | zuul-auth-api-reward/src/main/java/com/linrry/auth/zuul/reward/api/controller/FundsController.java | YangDiA/spring-cloud-zuul-authentication | 24b562c7d4827f125523543d1b859f151d9ab541 | [
"Apache-2.0"
] | null | null | null | zuul-auth-api-reward/src/main/java/com/linrry/auth/zuul/reward/api/controller/FundsController.java | YangDiA/spring-cloud-zuul-authentication | 24b562c7d4827f125523543d1b859f151d9ab541 | [
"Apache-2.0"
] | 4 | 2018-06-29T02:38:35.000Z | 2019-07-30T00:56:50.000Z | package com.linrry.auth.zuul.reward.api.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.linrry.auth.zuul.common.Result;
import com.linrry.auth.zuul.common.controller.CrudController;
import com.linrry.auth.zuul.reward.api.entity.Funds;
import com.linrry.auth.zuul.reward.api.service.IFundsService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* <p>
* 资金流水表 前端控制器
* </p>
*
* @author linrry
* @since 2018-09-24
*/
@Controller
@RequestMapping("/reward/funds")
public class FundsController extends CrudController<Funds,IFundsService> {
@Autowired
private IFundsService fundsService;
@ResponseBody
@RequestMapping("/page")
public Result page(
@RequestParam(required = true, defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer limit, String userId) {
Result result = Result.ok();
EntityWrapper<Funds> ew = new EntityWrapper<Funds>();
if (StringUtils.isNotBlank(userId)) {
ew.eq("user_id", userId);
}
Page<Funds> pageData = fundsService.selectPage(new Page<Funds>(page, limit), ew);
result.setData(pageData.getRecords()).setCount(pageData.getTotal());
return result;
}
}
| 31.92 | 89 | 0.731203 |
d4e7f3bb260ab4b7b8c5cf6802e0fe315d592dbc | 2,031 | ts | TypeScript | packages/mint-components/src/components/sqm-portal-change-password/usePortalChangePassword.ts | saasquatch/program-tools | b06e5d9daf5f913d312e1a93657b9f41f0e1c595 | [
"MIT"
] | null | null | null | packages/mint-components/src/components/sqm-portal-change-password/usePortalChangePassword.ts | saasquatch/program-tools | b06e5d9daf5f913d312e1a93657b9f41f0e1c595 | [
"MIT"
] | 127 | 2019-03-08T01:02:44.000Z | 2022-03-03T19:08:53.000Z | packages/mint-components/src/components/sqm-portal-change-password/usePortalChangePassword.ts | saasquatch/program-tools | b06e5d9daf5f913d312e1a93657b9f41f0e1c595 | [
"MIT"
] | null | null | null | import { useEffect, useState } from "@saasquatch/universal-hooks";
import { PortalChangePassword } from "./sqm-portal-change-password";
import jsonpointer from "jsonpointer";
import {
useChangePasswordMutation,
useUserIdentity,
} from "@saasquatch/component-boilerplate";
export function usePortalChangePassword(props: PortalChangePassword) {
const [request, { loading, errors, data }] = useChangePasswordMutation();
const [open, setOpen] = useState(false);
const [error, setError] = useState("");
const [success, setSuccess] = useState(false);
const user = useUserIdentity();
const submit = async (event: any) => {
setSuccess(false);
const formData = event.detail?.formData;
formData?.forEach((value, key) => {
jsonpointer.set(formData, key, value);
});
if (!user?.jwt) {
setError("Please log in again to change your password.");
return;
}
if (formData.password !== formData.confirmPassword) {
setError("Passwords do not match.");
return;
}
setError("");
const variables = {
password: formData.password,
};
await request(variables);
};
useEffect(() => {
if (data?.changeManagedIdentityPassword?.success) {
setSuccess(true);
}
}, [data?.changeManagedIdentityPassword?.success]);
return {
states: {
open,
loading,
success,
error: error || errors?.response?.errors?.[0]?.message,
content: {
modalChangePasswordHeader: props.modalChangePasswordHeader,
cancelText: props.cancelText,
changePasswordButtonText: props.changePasswordButtonText,
passwordFieldLabel: props.passwordFieldLabel,
confirmPasswordFieldLabel: props.confirmPasswordFieldLabel,
successMessage: props.successMessage,
portalChangePasswordHeader: props.portalChangePasswordHeader,
portalChangePasswordButtonText: props.portalChangePasswordButtonText,
},
},
data: {},
callbacks: {
setOpen,
submit,
},
};
}
| 28.605634 | 77 | 0.669621 |
df3a4e06dd287d783fb0af7f02c6d126eaf8ce20 | 5,620 | cs | C# | GothosDC/LowLevel/SegmentArrayDictionary.cs | gothos-folly/TeraDataTools | e676b7145765da64dd8194ba7e1f807be3945666 | [
"MIT"
] | 15 | 2015-11-28T20:44:40.000Z | 2021-11-12T20:30:14.000Z | GothosDC/LowLevel/SegmentArrayDictionary.cs | Sheigetsu/TeraDataTools | d19fe8297967318a7d9781061794c16a1d7340d9 | [
"MIT"
] | 1 | 2015-12-27T13:26:46.000Z | 2015-12-27T13:26:46.000Z | GothosDC/LowLevel/SegmentArrayDictionary.cs | Sheigetsu/TeraDataTools | d19fe8297967318a7d9781061794c16a1d7340d9 | [
"MIT"
] | 20 | 2015-11-13T09:38:33.000Z | 2021-05-14T03:59:44.000Z | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace GothosDC.LowLevel
{
internal class VirtualReadOnlyCollection<T> : ICollection<T>
{
private readonly IEnumerable<T> _sequence;
private readonly int _count;
public VirtualReadOnlyCollection(IEnumerable<T> sequence, int count)
{
_sequence = sequence;
_count = count;
}
public void Add(T item)
{
throw new NotSupportedException();
}
public void Clear()
{
throw new NotSupportedException();
}
public bool Contains(T item)
{
return _sequence.Contains(item);
}
public void CopyTo(T[] array, int arrayIndex)
{
foreach (var item in _sequence)
{
array[arrayIndex++] = item;
}
}
public int Count
{
get { return _count; }
}
public bool IsReadOnly
{
get { return true; }
}
public bool Remove(T item)
{
throw new NotSupportedException();
}
public IEnumerator<T> GetEnumerator()
{
return _sequence.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
internal class SegmentAddressDictionary<TValue> : IDictionary<SegmentAddress, TValue>
{
private readonly TValue[] _data;
private readonly BitArray _used;
public int Capacity { get { return _data.Length; } }
public int Count { get; private set; }
public SegmentAddressDictionary(IEnumerable<KeyValuePair<SegmentAddress, TValue>> sequence, SegmentAddress max)
{
_data = new TValue[max.ToInt() + 1];
_used = new BitArray(_data.Length, false);
foreach (var pair in sequence)
{
var index = pair.Key.ToInt();
_data[index] = pair.Value;
_used[index] = true;
Count++;
}
Keys = new VirtualReadOnlyCollection<SegmentAddress>(this.Select(x => x.Key), Count);
Values = new VirtualReadOnlyCollection<TValue>(this.Select(x => x.Value), Count);
}
bool ICollection<KeyValuePair<SegmentAddress, TValue>>.Contains(KeyValuePair<SegmentAddress, TValue> item)
{
TValue value;
if (!TryGetValue(item.Key, out value))
return false;
return EqualityComparer<TValue>.Default.Equals(value, item.Value);
}
public void CopyTo(KeyValuePair<SegmentAddress, TValue>[] array, int arrayIndex)
{
var data = _data;
for (int i = 0; i <= data.Length; i++)
{
if (!_used[i])
continue;
array[i + arrayIndex] = new KeyValuePair<SegmentAddress, TValue>(new SegmentAddress((uint)i), data[i]);
}
}
public IEnumerator<KeyValuePair<SegmentAddress, TValue>> GetEnumerator()
{
var data = _data;
for (int i = 0; i < data.Length; i++)
{
if (!_used[i])
continue;
yield return new KeyValuePair<SegmentAddress, TValue>(new SegmentAddress((uint)i), data[i]);
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public bool ContainsKey(SegmentAddress key)
{
var index = key.ToInt();
if ((uint)index >= _used.Length)
return false;
return _used[index];
}
public bool TryGetValue(SegmentAddress key, out TValue value)
{
if (!ContainsKey(key))
{
value = default(TValue);
return false;
}
value = _data[key.ToInt()];
return true;
}
public TValue this[SegmentAddress key]
{
get
{
TValue value;
if (!TryGetValue(key, out value))
throw new KeyNotFoundException();
return value;
}
set { throw new NotSupportedException(); }
}
public ICollection<SegmentAddress> Keys { get; private set; }
public ICollection<TValue> Values { get; private set; }
public void Add(SegmentAddress key, TValue value)
{
throw new NotSupportedException();
}
public bool Remove(SegmentAddress key)
{
throw new NotSupportedException();
}
void ICollection<KeyValuePair<SegmentAddress, TValue>>.Add(KeyValuePair<SegmentAddress, TValue> item)
{
throw new NotSupportedException();
}
void ICollection<KeyValuePair<SegmentAddress, TValue>>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<KeyValuePair<SegmentAddress, TValue>>.Remove(KeyValuePair<SegmentAddress, TValue> item)
{
throw new NotSupportedException();
}
bool ICollection<KeyValuePair<SegmentAddress, TValue>>.IsReadOnly
{
get { return true; }
}
}
}
| 29.424084 | 120 | 0.516192 |
2010875eda11f714f96416d6f3cc34078f62de39 | 588 | py | Python | astra/response.py | gurleen/astra-web | 901715bcce3439921d82cb362f9e1a0f6625fda3 | [
"Unlicense"
] | null | null | null | astra/response.py | gurleen/astra-web | 901715bcce3439921d82cb362f9e1a0f6625fda3 | [
"Unlicense"
] | null | null | null | astra/response.py | gurleen/astra-web | 901715bcce3439921d82cb362f9e1a0f6625fda3 | [
"Unlicense"
] | null | null | null | """
astra web framework
author: Gurleen Singh<[email protected]>
"""
import json
import typing
DEFAULT_HEADERS = [
("Content-type", "text/plain"),
]
STATUS_CODES = {
200: "200 OK",
301: "301 Moved Permanently",
404: "404 Not Found",
405: "405 Method Not Allowed"
}
class Response:
def __init__(self, content, code=200, headers=DEFAULT_HEADERS):
if type(content) in [dict, list]:
content = json.dumps(content)
self.content = content.encode("ascii")
self.code = STATUS_CODES.get(code, "200 OK")
self.headers = headers
| 21 | 67 | 0.634354 |
f4b5d7f1ff4ff21b7867cfbdcbedf37bbb23d519 | 519 | ts | TypeScript | src/blockers/blocker.model.ts | dukaludic/task-manager-api | 7c4d5fb43c18ad29fd1824dc5541ec9c26198892 | [
"MIT"
] | null | null | null | src/blockers/blocker.model.ts | dukaludic/task-manager-api | 7c4d5fb43c18ad29fd1824dc5541ec9c26198892 | [
"MIT"
] | null | null | null | src/blockers/blocker.model.ts | dukaludic/task-manager-api | 7c4d5fb43c18ad29fd1824dc5541ec9c26198892 | [
"MIT"
] | null | null | null | import * as mongoose from 'mongoose';
export const BlockerSchema = new mongoose.Schema(
{
title: { type: String, required: true },
task_id: { type: String, required: true },
description: { type: String, required: true },
comments: { type: Array, required: true },
user_id: { type: String, required: true },
},
{ versionKey: false },
);
export interface Blocker extends mongoose.Document {
title: string;
task_id: string;
description: string;
comments: string[];
user_id: string;
}
| 24.714286 | 52 | 0.662813 |
0d36f1d9b9a915debcac4d12e07eee5d7d8cab16 | 4,512 | cs | C# | CSharp Advanced/CSharp Advanced Exams/CSharp Advanced Exam - 19 June 2016/01. Cubic Artillery/Program.cs | stoyanovmiroslav/CSharp-Fundamentals | f941c73adc341e39a696ad5a5563c845ca296141 | [
"MIT"
] | null | null | null | CSharp Advanced/CSharp Advanced Exams/CSharp Advanced Exam - 19 June 2016/01. Cubic Artillery/Program.cs | stoyanovmiroslav/CSharp-Fundamentals | f941c73adc341e39a696ad5a5563c845ca296141 | [
"MIT"
] | null | null | null | CSharp Advanced/CSharp Advanced Exams/CSharp Advanced Exam - 19 June 2016/01. Cubic Artillery/Program.cs | stoyanovmiroslav/CSharp-Fundamentals | f941c73adc341e39a696ad5a5563c845ca296141 | [
"MIT"
] | null | null | null | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace _01._Cubic_Artillery
{
class Program
{
static void Main(string[] args)
{
int bunkersCapacity = int.Parse(Console.ReadLine());
string input = "";
var dict = new Dictionary<string, Queue<int>>();
List<string> bunkers = new List<string>();
while ((input = Console.ReadLine()) != "Bunker Revision")
{
string[] splitInput = input.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < splitInput.Length; i++)
{
if (IsNumerics(splitInput[i]))
{
int weapon = int.Parse(splitInput[i]);
StoreWeapons(bunkers, dict, weapon, bunkersCapacity);
}
else
{
string bunker = splitInput[i];
bunkers.Add(bunker);
dict.Add(bunker, new Queue<int>());
}
if (bunkers.Count > 1)
{
bool bunkerIsFull = IsBunkerFull(bunkers, dict, bunkersCapacity);
if (bunkerIsFull)
{
Console.WriteLine($"{bunkers[0]} -> {string.Join(", ", dict[bunkers[0]])}");
dict.Remove(bunkers[0]);
bunkers.RemoveAt(0);
}
}
}
}
}
private static bool IsBunkerFull(List<string> bunkers, Dictionary<string, Queue<int>> dict, int bunkersCapacity)
{
if (dict[bunkers[0]].Sum() == bunkersCapacity)
{
return true;
}
else
{
return false;
}
}
private static void StoreWeapons(List<string> bunkers, Dictionary<string, Queue<int>> dict, int weapon, int bunkersCapacity)
{
if (bunkers.Count > 0 && bunkersCapacity >= weapon)
{
for (int i = 0; i < bunkers.Count; i++)
{
string bunkerName = bunkers[i];
if (IsWeaponsCanFit(dict, weapon, bunkerName, bunkersCapacity))
{
dict[bunkerName].Enqueue(weapon);
break;
}
else if (bunkers.Count > 1)
{
Console.WriteLine($"{bunkers[0]} -> {string.Join(", ", dict[bunkers[0]])}");
dict.Remove(bunkers[0]);
bunkers.RemoveAt(0);
i--;
}
else if (bunkers.Count == 1)
{
OrderLastBunker(bunkers, dict, weapon, bunkersCapacity);
}
}
}
else if (bunkers.Count > 1)
{
if (dict[bunkers[0]].Sum() > 0)
{
Console.WriteLine($"{bunkers[0]} -> {string.Join(", ", dict[bunkers[0]])}");
}
else
{
Console.WriteLine($"{bunkers[0]} -> Empty");
}
dict.Remove(bunkers[0]);
bunkers.RemoveAt(0);
}
}
private static bool IsWeaponsCanFit(Dictionary<string, Queue<int>> dict, int weapon, string bunkerName, int bunkersCapacity)
{
int currentSumWeapons = dict[bunkerName].Sum();
int capacity = weapon + currentSumWeapons;
return capacity <= bunkersCapacity;
}
private static void OrderLastBunker(List<string> bunkers, Dictionary<string, Queue<int>> dict, int weapon, int bunkersCapacity)
{
int n = dict[bunkers[0]].Count;
for (int i = 0; i < n; i++)
{
dict[bunkers[0]].Dequeue();
if (IsWeaponsCanFit(dict, weapon, bunkers[0], bunkersCapacity))
{
dict[bunkers[0]].Enqueue(weapon);
break;
}
}
}
private static bool IsNumerics(string value)
{
return value.All(char.IsNumber);
}
}
}
| 34.442748 | 135 | 0.432624 |
b26c21a1e276e0ce22e91394dbddfa8d5b61e2bf | 816 | css | CSS | Universe.W3Top/ClientApp/src/components/MyC3.css | devizer/KernelManagementLab | 31380d5d0d24e6efd6cd482443d6f5219b76920d | [
"MIT"
] | 4 | 2019-04-20T06:44:29.000Z | 2021-08-02T03:21:54.000Z | Universe.W3Top/ClientApp/src/components/MyC3.css | devizer/KernelManagementLab | 31380d5d0d24e6efd6cd482443d6f5219b76920d | [
"MIT"
] | 9 | 2020-01-28T21:22:18.000Z | 2022-03-17T11:30:34.000Z | Universe.W3Top/ClientApp/src/components/MyC3.css | devizer/KernelManagementLab | 31380d5d0d24e6efd6cd482443d6f5219b76920d | [
"MIT"
] | null | null | null | .inactive-chart { opacity: 0.5}
text.c3-axis-x-label {
color: gray !important;
fill: gray !important;
}
text.c3-axis-y-label, text.c3-axis-y2-label {
color: #111 !important;
fill: #111 !important;
font-size: 11px !important;
}
.c3-line {
stroke-width: 3px !important;
}
#chart __circle { r: 1.5 !important;}
/*it doesnt work*/
#chart .c3-axis-x .tick:first-child text {
text-anchor: start !important;
}
/*aaa.c3-circle._expanded_ {*/
/*stroke-width: 1px;*/
/*stroke: white;*/
/*}*/
/*aaa.c3-selected-circle {*/
/*stroke-width: 8px !important;*/
/*}*/
/*.c3-target.c3-focused path.c3-line, .c3-target.c3-focused path.c3-step {*/
/*stroke-width: 4px !important;*/
/*}*/
/*.c3-selected-circle {*/
/*fill: white;*/
/*stroke-width: 11px !important;*/
/*}*/
| 18.976744 | 76 | 0.605392 |
b0d74d87e094d09c0881fb214c8227631dbb222d | 4,864 | py | Python | speech_enhance/utils/utils.py | hit-thusz-RookieCJ/FullSubNet-plus | a6c89083cd083e729ca3def9a291743e8c3b516b | [
"Apache-2.0"
] | 41 | 2022-01-23T12:45:13.000Z | 2022-03-31T03:04:26.000Z | speech_enhance/utils/utils.py | hit-thusz-RookieCJ/FullSubNet-plus | a6c89083cd083e729ca3def9a291743e8c3b516b | [
"Apache-2.0"
] | 5 | 2022-01-24T07:05:01.000Z | 2022-03-29T12:58:07.000Z | speech_enhance/utils/utils.py | hit-thusz-RookieCJ/FullSubNet-plus | a6c89083cd083e729ca3def9a291743e8c3b516b | [
"Apache-2.0"
] | 10 | 2022-01-23T01:40:18.000Z | 2022-03-29T12:11:11.000Z | import os
import shutil
import yaml
import numpy as np
import torch
import torch.nn.functional as F
from .logger import log
def touch_dir(d):
os.makedirs(d, exist_ok=True)
def is_file_exists(f):
return os.path.exists(f)
def check_file_exists(f):
if not os.path.exists(f):
log(f"not found file: {f}")
assert False, f"not found file: {f}"
def read_lines(data_path):
lines = []
with open(data_path, encoding="utf-8") as fr:
for line in fr.readlines():
if len(line.strip().replace(" ", "")):
lines.append(line.strip())
# log("read {} lines from {}".format(len(lines), data_path))
# log("example(last) {}\n".format(lines[-1]))
return lines
def write_lines(data_path, lines):
with open(data_path, "w", encoding="utf-8") as fw:
for line in lines:
fw.write("{}\n".format(line))
# log("write {} lines to {}".format(len(lines), data_path))
# log("example(last line): {}\n".format(lines[-1]))
return
def get_name_from_path(abs_path):
return ".".join(os.path.basename(abs_path).split(".")[:-1])
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = self
return
def load_hparams(yaml_path):
with open(yaml_path, encoding="utf-8") as yaml_file:
hparams = yaml.safe_load(yaml_file)
return AttrDict(hparams)
def dump_hparams(yaml_path, hparams):
touch_dir(os.path.dirname(yaml_path))
with open(yaml_path, "w") as fw:
yaml.dump(hparams, fw)
log("save hparams to {}".format(yaml_path))
return
def get_all_wav_path(file_dir):
wav_list = []
for path, dir_list, file_list in os.walk(file_dir):
for file_name in file_list:
if file_name.endswith(".wav") or file_name.endswith(".WAV"):
wav_path = os.path.join(path, file_name)
wav_list.append(wav_path)
return sorted(wav_list)
def clean_and_new_dir(data_dir):
if os.path.exists(data_dir):
shutil.rmtree(data_dir)
os.makedirs(data_dir)
return
def generate_dir_tree(synth_dir, dir_name_list, del_old=False):
os.makedirs(synth_dir, exist_ok=True)
dir_path_list = []
if del_old:
shutil.rmtree(synth_dir, ignore_errors=True)
for name in dir_name_list:
dir_path = os.path.join(synth_dir, name)
dir_path_list.append(dir_path)
os.makedirs(dir_path, exist_ok=True)
return dir_path_list
def str2bool(v):
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
def pad(input_ele, mel_max_length=None):
if mel_max_length:
max_len = mel_max_length
else:
max_len = max([input_ele[i].size(0) for i in range(len(input_ele))])
out_list = list()
for i, batch in enumerate(input_ele):
if len(batch.shape) == 1:
one_batch_padded = F.pad(
batch, (0, max_len - batch.size(0)), "constant", 0.0
)
elif len(batch.shape) == 2:
one_batch_padded = F.pad(
batch, (0, 0, 0, max_len - batch.size(0)), "constant", 0.0
)
out_list.append(one_batch_padded)
out_padded = torch.stack(out_list)
return out_padded
def pad_1D(inputs, PAD=0):
def pad_data(x, length, PAD):
x_padded = np.pad(
x, (0, length - x.shape[0]), mode="constant", constant_values=PAD
)
return x_padded
max_len = max((len(x) for x in inputs))
padded = np.stack([pad_data(x, max_len, PAD) for x in inputs])
return padded
def pad_2D(inputs, maxlen=None):
def pad(x, max_len):
PAD = 0
if np.shape(x)[0] > max_len:
raise ValueError("not max_len")
s = np.shape(x)[1]
x_padded = np.pad(
x, (0, max_len - np.shape(x)[0]), mode="constant", constant_values=PAD
)
return x_padded[:, :s]
if maxlen:
output = np.stack([pad(x, maxlen) for x in inputs])
else:
max_len = max(np.shape(x)[0] for x in inputs)
output = np.stack([pad(x, max_len) for x in inputs])
return output
def get_mask_from_lengths(lengths, max_len=None):
batch_size = lengths.shape[0]
if max_len is None:
max_len = torch.max(lengths).item()
ids = torch.arange(0, max_len).unsqueeze(0).expand(batch_size, -1).to(lengths.device)
mask = ids >= lengths.unsqueeze(1).expand(-1, max_len)
return mask
if __name__ == '__main__':
pass
| 27.636364 | 90 | 0.58861 |
fba0df225d55a18ed604db073f7197cf3d8284a6 | 20,684 | ps1 | PowerShell | Tests/Unit/MSFT_AdfsGlobalWebcontent.Tests.ps1 | Yvand/AdfsDsc | f506bb96d49976c26c23660f728bfb0d2aba3191 | [
"MIT"
] | 6 | 2019-10-23T17:19:20.000Z | 2021-11-18T09:27:04.000Z | Tests/Unit/MSFT_AdfsGlobalWebcontent.Tests.ps1 | Yvand/AdfsDsc | f506bb96d49976c26c23660f728bfb0d2aba3191 | [
"MIT"
] | 51 | 2019-10-23T17:27:09.000Z | 2021-08-11T18:27:20.000Z | Tests/Unit/MSFT_AdfsGlobalWebcontent.Tests.ps1 | Yvand/AdfsDsc | f506bb96d49976c26c23660f728bfb0d2aba3191 | [
"MIT"
] | 3 | 2019-10-24T00:53:28.000Z | 2021-03-22T14:06:00.000Z | $script:dscModuleName = 'AdfsDsc'
$global:psModuleName = 'ADFS'
$script:dscResourceName = 'MSFT_AdfsGlobalWebContent'
function Invoke-TestSetup
{
try
{
Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop'
}
catch [System.IO.FileNotFoundException]
{
throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks build" first.'
}
$script:testEnvironment = Initialize-TestEnvironment `
-DSCModuleName $script:dscModuleName `
-DSCResourceName $script:dscResourceName `
-ResourceType 'Mof' `
-TestType 'Unit'
}
function Invoke-TestCleanup
{
Restore-TestEnvironment -TestEnvironment $script:testEnvironment
}
# Begin Testing
Invoke-TestSetup
try
{
InModuleScope $script:dscResourceName {
Set-StrictMode -Version 2.0
# Import Stub Module
Import-Module (Join-Path -Path $PSScriptRoot -ChildPath "Stubs\$($global:psModuleName)Stub.psm1") -Force
# Define Resource Commands
$ResourceCommand = @{
Get = 'Get-AdfsGlobalWebContent'
Set = 'Set-AdfsGlobalWebContent'
}
$mockResource = @{
FederationServiceName = 'sts.contoso.com'
Locale = 'en-US'
CompanyName = 'Contoso'
HelpDeskLink = 'https://www.contoso.com/helpdesk'
HelpDeskLinkText = 'Contoso Helpdesk'
HomeLink = 'https://www.contoso.com'
HomeLinkText = 'Contoso home'
HomeRealmDiscoveryOtherOrganizationDescriptionText = 'Contoso Home Realm Other Organization'
HomeRealmDiscoveryPageDescriptionText = 'Contoso Home Realm'
OrganizationalNameDescriptionText = 'Contoso Company'
PrivacyLink = 'https://www.contoso.com/privacy'
PrivacyLinkText = 'Contoso Privacy Policy'
CertificatePageDescriptionText = 'Contoso Certificate'
SignInPageDescriptionText = 'Contoso Signin'
SignOutPageDescriptionText = 'Contoso Signout'
ErrorPageDescriptionText = 'Contoso Error'
ErrorPageGenericErrorMessage = 'Contoso Generic Error'
ErrorPageAuthorizationErrorMessage = 'Contoso Authorization Error'
ErrorPageDeviceAuthenticationErrorMessage = 'Contoso Device Authentication Error'
ErrorPageSupportEmail = '[email protected]'
UpdatePasswordPageDescriptionText = 'Contoso Update Password'
SignInPageAdditionalAuthenticationDescriptionText = 'Contoso Additional Sign In'
}
$mockChangedResource = @{
CompanyName = 'Fabrikam'
HelpDeskLink = 'https://www.fabrikam.com/helpdesk'
HelpDeskLinkText = 'Fabrikam Helpdesk'
HomeLink = 'https://www.fabrikam.com'
HomeLinkText = 'Fabrikam home'
HomeRealmDiscoveryOtherOrganizationDescriptionText = 'Fabrikam Home Realm Other Organization'
HomeRealmDiscoveryPageDescriptionText = 'Fabrikam Home Realm'
OrganizationalNameDescriptionText = 'Fabrikam Company'
PrivacyLink = 'https://www.fabrikam.com/privacy'
PrivacyLinkText = 'Fabrikam Privacy Policy'
CertificatePageDescriptionText = 'Fabrikam Certificate'
SignInPageDescriptionText = 'Fabrikam Signin'
SignOutPageDescriptionText = 'Fabrikam Signout'
ErrorPageDescriptionText = 'Fabrikam Error'
ErrorPageGenericErrorMessage = 'Fabrikam Generic Error'
ErrorPageAuthorizationErrorMessage = 'Fabrikam Authorization Error'
ErrorPageDeviceAuthenticationErrorMessage = 'Fabrikam Device Authentication Error'
ErrorPageSupportEmail = '[email protected]'
UpdatePasswordPageDescriptionText = 'Fabrikam Update Password'
SignInPageAdditionalAuthenticationDescriptionText = 'Fabrikam Additional Sign In'
}
$mockGetTargetResourceResult = @{
FederationServiceName = $mockResource.FederationServiceName
Locale = $mockResource.Locale
CompanyName = $mockResource.CompanyName
HelpDeskLink = $mockResource.HelpDeskLink
HelpDeskLinkText = $mockResource.HelpDeskLinkText
HomeLink = $mockResource.HomeLink
HomeLinkText = $mockResource.HomeLinkText
HomeRealmDiscoveryOtherOrganizationDescriptionText = $mockResource.HomeRealmDiscoveryOtherOrganizationDescriptionText
HomeRealmDiscoveryPageDescriptionText = $mockResource.HomeRealmDiscoveryPageDescriptionText
OrganizationalNameDescriptionText = $mockResource.OrganizationalNameDescriptionText
PrivacyLink = $mockResource.PrivacyLink
PrivacyLinkText = $mockResource.PrivacyLinkText
CertificatePageDescriptionText = $mockResource.CertificatePageDescriptionText
SignInPageDescriptionText = $mockResource.SignInPageDescriptionText
SignOutPageDescriptionText = $mockResource.SignOutPageDescriptionText
ErrorPageDescriptionText = $mockResource.ErrorPageDescriptionText
ErrorPageGenericErrorMessage = $mockResource.ErrorPageGenericErrorMessage
ErrorPageAuthorizationErrorMessage = $mockResource.ErrorPageAuthorizationErrorMessage
ErrorPageDeviceAuthenticationErrorMessage = $mockResource.ErrorPageDeviceAuthenticationErrorMessage
ErrorPageSupportEmail = $mockResource.ErrorPageSupportEmail
UpdatePasswordPageDescriptionText = $mockResource.UpdatePasswordPageDescriptionText
SignInPageAdditionalAuthenticationDescriptionText = $mockResource.SignInPageAdditionalAuthenticationDescriptionText
}
Describe 'MSFT_AdfsGlobalWebContent\Get-TargetResource' -Tag 'Get' {
BeforeAll {
$getTargetResourceParameters = @{
FederationServiceName = $mockResource.FederationServiceName
Locale = $mockResource.Locale
}
$mockGetResourceCommandResult = @{
CompanyName = $mockResource.CompanyName
HelpDeskLink = $mockResource.HelpDeskLink
HelpDeskLinkText = $mockResource.HelpDeskLinkText
HomeLink = $mockResource.HomeLink
HomeLinkText = $mockResource.HomeLinkText
HomeRealmDiscoveryOtherOrganizationDescriptionText = $mockResource.HomeRealmDiscoveryOtherOrganizationDescriptionText
HomeRealmDiscoveryPageDescriptionText = $mockResource.HomeRealmDiscoveryPageDescriptionText
OrganizationalNameDescriptionText = $mockResource.OrganizationalNameDescriptionText
PrivacyLink = $mockResource.PrivacyLink
PrivacyLinkText = $mockResource.PrivacyLinkText
CertificatePageDescriptionText = $mockResource.CertificatePageDescriptionText
SignInPageDescriptionText = $mockResource.SignInPageDescriptionText
SignOutPageDescriptionText = $mockResource.SignOutPageDescriptionText
ErrorPageDescriptionText = $mockResource.ErrorPageDescriptionText
ErrorPageGenericErrorMessage = $mockResource.ErrorPageGenericErrorMessage
ErrorPageAuthorizationErrorMessage = $mockResource.ErrorPageAuthorizationErrorMessage
ErrorPageDeviceAuthenticationErrorMessage = $mockResource.ErrorPageDeviceAuthenticationErrorMessage
ErrorPageSupportEmail = $mockResource.ErrorPageSupportEmail
UpdatePasswordPageDescriptionText = $mockResource.UpdatePasswordPageDescriptionText
SignInPageAdditionalAuthenticationDescriptionText = $mockResource.SignInPageAdditionalAuthenticationDescriptionText
}
Mock -CommandName Assert-Module
Mock -CommandName "Assert-$($global:psModuleName)Service"
Mock -CommandName $ResourceCommand.Get -MockWith { $mockGetResourceCommandResult }
$result = Get-TargetResource @getTargetResourceParameters
}
foreach ($property in $mockResource.Keys)
{
It "Should return the correct $property property" {
$result.$property | Should -Be $mockResource.$property
}
}
It 'Should call the expected mocks' {
Assert-MockCalled -CommandName Assert-Module `
-ParameterFilter { $ModuleName -eq $global:psModuleName } `
-Exactly -Times 1
Assert-MockCalled -CommandName "Assert-$($global:psModuleName)Service" -Exactly -Times 1
Assert-MockCalled -CommandName $ResourceCommand.Get -Exactly -Times 1
}
Context "When $($ResourceCommand.Get) throws an exception" {
BeforeAll {
Mock -CommandName $ResourceCommand.Get -MockWith { Throw 'Error' }
}
It 'Should throw the correct exception' {
{ Get-TargetResource @getTargetResourceParameters } | Should -Throw (
$script:localizedData.GettingResourceErrorMessage -f
$getTargetResourceParameters.FederationServiceName, $getTargetResourceParameters.Locale )
}
}
}
Describe 'MSFT_AdfsGlobalWebContent\Set-TargetResource' -Tag 'Set' {
BeforeAll {
$setTargetResourceParameters = @{
FederationServiceName = $mockResource.FederationServiceName
Locale = $mockResource.Locale
CompanyName = $mockChangedResource.CompanyName
HelpDeskLink = $mockChangedResource.HelpDeskLink
HelpDeskLinkText = $mockChangedResource.HelpDeskLinkText
HomeLink = $mockChangedResource.HomeLink
HomeLinkText = $mockChangedResource.HomeLinkText
HomeRealmDiscoveryOtherOrganizationDescriptionText = $mockChangedResource.HomeRealmDiscoveryOtherOrganizationDescriptionText
HomeRealmDiscoveryPageDescriptionText = $mockChangedResource.HomeRealmDiscoveryPageDescriptionText
OrganizationalNameDescriptionText = $mockChangedResource.OrganizationalNameDescriptionText
PrivacyLink = $mockChangedResource.PrivacyLink
PrivacyLinkText = $mockChangedResource.PrivacyLinkText
CertificatePageDescriptionText = $mockChangedResource.CertificatePageDescriptionText
SignInPageDescriptionText = $mockChangedResource.SignInPageDescriptionText
SignOutPageDescriptionText = $mockChangedResource.SignOutPageDescriptionText
ErrorPageDescriptionText = $mockChangedResource.ErrorPageDescriptionText
ErrorPageGenericErrorMessage = $mockChangedResource.ErrorPageGenericErrorMessage
ErrorPageAuthorizationErrorMessage = $mockChangedResource.ErrorPageAuthorizationErrorMessage
ErrorPageDeviceAuthenticationErrorMessage = $mockChangedResource.ErrorPageDeviceAuthenticationErrorMessage
ErrorPageSupportEmail = $mockChangedResource.ErrorPageSupportEmail
UpdatePasswordPageDescriptionText = $mockChangedResource.UpdatePasswordPageDescriptionText
SignInPageAdditionalAuthenticationDescriptionText = $mockChangedResource.SignInPageAdditionalAuthenticationDescriptionText
}
Mock -CommandName $ResourceCommand.Set
Mock -CommandName Get-TargetResource -MockWith { $mockGetTargetResourceResult }
}
foreach ($property in $mockChangedResource.Keys)
{
Context "When $property has changed" {
BeforeAll {
$setTargetResourceParametersChangedProperty = $setTargetResourceParameters.Clone()
$setTargetResourceParametersChangedProperty.$property = $mockChangedResource.$property
}
It 'Should not throw' {
{ Set-TargetResource @setTargetResourceParametersChangedProperty } | Should -Not -Throw
}
It 'Should call the correct mocks' {
Assert-MockCalled -CommandName Get-TargetResource `
-ParameterFilter { `
$FederationServiceName -eq $setTargetResourceParametersChangedProperty.FederationServiceName } `
-Exactly -Times 1
Assert-MockCalled -CommandName $ResourceCommand.Set -Exactly -Times 1
}
}
}
Context "When $($ResourceCommand.Set) throws an exception" {
BeforeAll {
Mock -CommandName $ResourceCommand.Set -MockWith { Throw 'Error' }
}
It 'Should throw the correct exception' {
{ Set-TargetResource @setTargetResourceParameters } | Should -Throw (
$script:localizedData.SettingResourceErrorMessage -f
$setTargetResourceParameters.FederationServiceName, $setTargetResourceParameters.Locale )
}
}
}
Describe 'MSFT_AdfsGlobalWebContent\Test-TargetResource' -Tag 'Test' {
BeforeAll {
$testTargetResourceParameters = @{
FederationServiceName = $mockResource.FederationServiceName
Locale = $mockResource.Locale
CompanyName = $mockResource.CompanyName
HelpDeskLink = $mockResource.HelpDeskLink
HelpDeskLinkText = $mockResource.HelpDeskLinkText
HomeLink = $mockResource.HomeLink
HomeLinkText = $mockResource.HomeLinkText
HomeRealmDiscoveryOtherOrganizationDescriptionText = $mockResource.HomeRealmDiscoveryOtherOrganizationDescriptionText
HomeRealmDiscoveryPageDescriptionText = $mockResource.HomeRealmDiscoveryPageDescriptionText
OrganizationalNameDescriptionText = $mockResource.OrganizationalNameDescriptionText
PrivacyLink = $mockResource.PrivacyLink
PrivacyLinkText = $mockResource.PrivacyLinkText
CertificatePageDescriptionText = $mockResource.CertificatePageDescriptionText
SignInPageDescriptionText = $mockResource.SignInPageDescriptionText
SignOutPageDescriptionText = $mockResource.SignOutPageDescriptionText
ErrorPageDescriptionText = $mockResource.ErrorPageDescriptionText
ErrorPageGenericErrorMessage = $mockResource.ErrorPageGenericErrorMessage
ErrorPageAuthorizationErrorMessage = $mockResource.ErrorPageAuthorizationErrorMessage
ErrorPageDeviceAuthenticationErrorMessage = $mockResource.ErrorPageDeviceAuthenticationErrorMessage
ErrorPageSupportEmail = $mockResource.ErrorPageSupportEmail
UpdatePasswordPageDescriptionText = $mockResource.UpdatePasswordPageDescriptionText
SignInPageAdditionalAuthenticationDescriptionText = $mockResource.SignInPageAdditionalAuthenticationDescriptionText
}
Mock -CommandName Get-TargetResource -MockWith { $mockGetTargetResourceResult }
}
It 'Should not throw' {
{ Test-TargetResource @testTargetResourceParameters } | Should -Not -Throw
}
It 'Should call the expected mocks' {
Assert-MockCalled -CommandName Get-TargetResource `
-ParameterFilter { $FederationServiceName -eq $testTargetResourceParameters.FederationServiceName } `
-Exactly -Times 1
}
Context 'When all the resource properties are in the desired state' {
It 'Should return $true' {
Test-TargetResource @testTargetResourceParameters | Should -Be $true
}
}
foreach ($property in $mockChangedResource.Keys)
{
Context "When the $property resource property is not in the desired state" {
BeforeAll {
$testTargetResourceNotInDesiredStateParameters = $testTargetResourceParameters.Clone()
$testTargetResourceNotInDesiredStateParameters.$property = $mockChangedResource.$property
}
It 'Should return $false' {
Test-TargetResource @testTargetResourceNotInDesiredStateParameters | Should -Be $false
}
}
}
}
}
}
finally
{
Invoke-TestCleanup
}
| 65.455696 | 145 | 0.543028 |
24f979536a50fda65470572c2c74dca88ca9f7f7 | 53,940 | lua | Lua | assets/tiled/levels/cyberpunked.lua | mokalux/GDOC_03_B2D_PLATFORMER | 3bdcd33d62b9f7c7a2e7782ad167bbfded368fad | [
"MIT"
] | null | null | null | assets/tiled/levels/cyberpunked.lua | mokalux/GDOC_03_B2D_PLATFORMER | 3bdcd33d62b9f7c7a2e7782ad167bbfded368fad | [
"MIT"
] | null | null | null | assets/tiled/levels/cyberpunked.lua | mokalux/GDOC_03_B2D_PLATFORMER | 3bdcd33d62b9f7c7a2e7782ad167bbfded368fad | [
"MIT"
] | null | null | null | return {
version = "1.5",
luaversion = "5.1",
tiledversion = "2021.03.23",
orientation = "orthogonal",
renderorder = "right-down",
width = 276,
height = 44,
tilewidth = 16,
tileheight = 16,
nextlayerid = 19,
nextobjectid = 442,
properties = {},
tilesets = {},
layers = {
{
type = "imagelayer",
image = "cyberpunked/obj0006_result.png",
id = 11,
name = "Image Layer 1",
visible = false,
opacity = 0.5,
offsetx = 16,
offsety = 10,
parallaxx = 1,
parallaxy = 1,
properties = {}
},
{
type = "imagelayer",
image = "cyberpunked/obj0007_result.png",
id = 12,
name = "Image Layer 2",
visible = false,
opacity = 0.5,
offsetx = 2182,
offsety = -11,
parallaxx = 1,
parallaxy = 1,
properties = {}
},
{
type = "objectgroup",
draworder = "topdown",
id = 13,
name = "grounds",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 124,
name = "groundB",
type = "",
shape = "polygon",
x = -276,
y = 656,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 68, y = 16 },
{ x = 68, y = 32 },
{ x = 0, y = 16 }
},
properties = {}
},
{
id = 276,
name = "groundB",
type = "",
shape = "rectangle",
x = 16,
y = 688,
width = 4384,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 277,
name = "groundB",
type = "",
shape = "rectangle",
x = 0,
y = -80,
width = 16,
height = 784,
rotation = 0,
visible = true,
properties = {}
},
{
id = 278,
name = "groundB",
type = "",
shape = "rectangle",
x = 16,
y = -80,
width = 4384,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 279,
name = "groundB",
type = "",
shape = "rectangle",
x = 4400,
y = -80,
width = 16,
height = 784,
rotation = 0,
visible = true,
properties = {}
},
{
id = 280,
name = "groundB",
type = "",
shape = "rectangle",
x = 200,
y = 656,
width = 56,
height = 32,
rotation = 0,
visible = true,
properties = {}
},
{
id = 281,
name = "groundB",
type = "",
shape = "rectangle",
x = 288,
y = 608,
width = 236,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 282,
name = "groundB",
type = "",
shape = "rectangle",
x = 112,
y = 544,
width = 144,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 283,
name = "groundB",
type = "",
shape = "rectangle",
x = 288,
y = 480,
width = 236,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 284,
name = "groundB",
type = "",
shape = "rectangle",
x = 524,
y = 472,
width = 236,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 287,
name = "groundB",
type = "",
shape = "rectangle",
x = 486,
y = 116,
width = 86,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 291,
name = "groundB",
type = "",
shape = "rectangle",
x = 368,
y = 116,
width = 102,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 293,
name = "groundB",
type = "",
shape = "rectangle",
x = 880,
y = 536,
width = 236,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 294,
name = "groundB",
type = "",
shape = "rectangle",
x = 816,
y = 480,
width = 88,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 295,
name = "groundB",
type = "",
shape = "rectangle",
x = 192,
y = 64,
width = 128,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 297,
name = "groundB",
type = "",
shape = "rectangle",
x = 176,
y = 64,
width = 16,
height = 300,
rotation = 0,
visible = true,
properties = {}
},
{
id = 298,
name = "groundB",
type = "",
shape = "rectangle",
x = 192,
y = 208,
width = 112,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 299,
name = "groundB",
type = "",
shape = "rectangle",
x = 368,
y = 128,
width = 16,
height = 164,
rotation = 0,
visible = true,
properties = {}
},
{
id = 300,
name = "groundB",
type = "",
shape = "rectangle",
x = 256,
y = 280,
width = 112,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 301,
name = "groundB",
type = "",
shape = "rectangle",
x = 192,
y = 352,
width = 112,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 304,
name = "groundB",
type = "",
shape = "rectangle",
x = 352,
y = 408,
width = 112,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 305,
name = "groundB",
type = "",
shape = "rectangle",
x = 304,
y = 56,
width = 16,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 306,
name = "groundB",
type = "",
shape = "rectangle",
x = 256,
y = 136,
width = 112,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 308,
name = "groundB",
type = "",
shape = "rectangle",
x = 16,
y = 124,
width = 160,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 326,
name = "groundB",
type = "",
shape = "rectangle",
x = 352,
y = 124,
width = 16,
height = 12,
rotation = 0,
visible = true,
properties = {}
},
{
id = 327,
name = "groundB",
type = "",
shape = "rectangle",
x = 336,
y = 132,
width = 16,
height = 4,
rotation = 0,
visible = true,
properties = {}
},
{
id = 329,
name = "groundB",
type = "",
shape = "rectangle",
x = 486,
y = 235,
width = 86,
height = 12,
rotation = -15,
visible = true,
properties = {}
},
{
id = 330,
name = "groundB",
type = "",
shape = "rectangle",
x = 486,
y = 360,
width = 86,
height = 12,
rotation = -15,
visible = true,
properties = {}
},
{
id = 331,
name = "groundB",
type = "",
shape = "rectangle",
x = 388,
y = 272,
width = 86,
height = 12,
rotation = 15,
visible = true,
properties = {}
},
{
id = 333,
name = "groundB",
type = "",
shape = "rectangle",
x = 1152,
y = 460,
width = 88,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 334,
name = "groundB",
type = "",
shape = "rectangle",
x = 1240,
y = 452,
width = 88,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 335,
name = "groundB",
type = "",
shape = "rectangle",
x = 1372,
y = 452,
width = 68,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 336,
name = "groundB",
type = "",
shape = "rectangle",
x = 1504,
y = 452,
width = 88,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 338,
name = "groundB",
type = "",
shape = "rectangle",
x = 1684,
y = 448,
width = 500,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 339,
name = "groundB",
type = "",
shape = "rectangle",
x = 688,
y = 200,
width = 220.359,
height = 16,
rotation = 10,
visible = true,
properties = {}
},
{
id = 400,
name = "groundB",
type = "",
shape = "rectangle",
x = 1504,
y = 304,
width = 192,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 401,
name = "groundB",
type = "",
shape = "rectangle",
x = 1752,
y = 364,
width = 80,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 402,
name = "groundB",
type = "",
shape = "rectangle",
x = 1834,
y = 364,
width = 244.223,
height = 16,
rotation = 6,
visible = true,
properties = {}
},
{
id = 408,
name = "groundB",
type = "",
shape = "rectangle",
x = 1320,
y = 240,
width = 184,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 417,
name = "groundB",
type = "",
shape = "rectangle",
x = 2224,
y = 448,
width = 80,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 418,
name = "groundB",
type = "",
shape = "rectangle",
x = 2306,
y = 448,
width = 244.223,
height = 7.95237,
rotation = 10,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 8,
name = "sensors",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 232,
name = "ladder",
type = "",
shape = "rectangle",
x = 639,
y = 204,
width = 8,
height = 228,
rotation = 0,
visible = true,
properties = {}
},
{
id = 344,
name = "ladder",
type = "",
shape = "rectangle",
x = 943,
y = 243,
width = 8,
height = 253,
rotation = 0,
visible = true,
properties = {}
},
{
id = 361,
name = "ladder",
type = "",
shape = "rectangle",
x = 1272,
y = 244,
width = 8,
height = 168,
rotation = 0,
visible = true,
properties = {}
},
{
id = 384,
name = "exit",
type = "",
shape = "rectangle",
x = 4392,
y = 564,
width = 7,
height = 124,
rotation = 0,
visible = true,
properties = {}
},
{
id = 405,
name = "ladder",
type = "",
shape = "rectangle",
x = 2200,
y = 452,
width = 8,
height = 196,
rotation = 0,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 18,
name = "collectibles",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 310,
name = "c01",
type = "",
shape = "polygon",
x = 32,
y = 112,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 311,
name = "c01",
type = "",
shape = "polygon",
x = 40,
y = 104,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 312,
name = "c01",
type = "",
shape = "polygon",
x = 48,
y = 112,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 313,
name = "c01",
type = "",
shape = "polygon",
x = 56,
y = 104,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 314,
name = "c01",
type = "",
shape = "polygon",
x = 64,
y = 112,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 315,
name = "c01",
type = "",
shape = "polygon",
x = 72,
y = 104,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 316,
name = "c01",
type = "",
shape = "polygon",
x = 80,
y = 112,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 317,
name = "c01",
type = "",
shape = "polygon",
x = 88,
y = 104,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 318,
name = "c01",
type = "",
shape = "polygon",
x = 96,
y = 112,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 319,
name = "c01",
type = "",
shape = "polygon",
x = 104,
y = 104,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 320,
name = "c01",
type = "",
shape = "polygon",
x = 112,
y = 112,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 321,
name = "c01",
type = "",
shape = "polygon",
x = 120,
y = 104,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 322,
name = "c01",
type = "",
shape = "polygon",
x = 128,
y = 112,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 323,
name = "c01",
type = "",
shape = "polygon",
x = 136,
y = 104,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 324,
name = "c01",
type = "",
shape = "polygon",
x = 144,
y = 112,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 325,
name = "c01",
type = "",
shape = "polygon",
x = 152,
y = 104,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 345,
name = "c01",
type = "",
shape = "polygon",
x = 720,
y = 196,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 346,
name = "c01",
type = "",
shape = "polygon",
x = 752,
y = 201,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 347,
name = "c01",
type = "",
shape = "polygon",
x = 784,
y = 206,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 348,
name = "c01",
type = "",
shape = "polygon",
x = 816,
y = 212,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 349,
name = "c01",
type = "",
shape = "polygon",
x = 848,
y = 218,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 350,
name = "c01",
type = "",
shape = "polygon",
x = 880,
y = 224,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 364,
name = "c01",
type = "",
shape = "polygon",
x = 216,
y = 200,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 365,
name = "c01",
type = "",
shape = "polygon",
x = 248,
y = 200,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 366,
name = "c01",
type = "",
shape = "polygon",
x = 280,
y = 200,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 367,
name = "c01",
type = "",
shape = "polygon",
x = 344,
y = 272,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 368,
name = "c01",
type = "",
shape = "polygon",
x = 312,
y = 272,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 369,
name = "c01",
type = "",
shape = "polygon",
x = 280,
y = 272,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 370,
name = "c01",
type = "",
shape = "polygon",
x = 216,
y = 344,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 371,
name = "c01",
type = "",
shape = "polygon",
x = 248,
y = 344,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 372,
name = "c01",
type = "",
shape = "polygon",
x = 280,
y = 344,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 373,
name = "c01",
type = "",
shape = "polygon",
x = 528,
y = 340,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 374,
name = "c01",
type = "",
shape = "polygon",
x = 432,
y = 276,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 375,
name = "c01",
type = "",
shape = "polygon",
x = 528,
y = 216,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 376,
name = "c01",
type = "",
shape = "polygon",
x = 568,
y = 600,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 377,
name = "c01",
type = "",
shape = "polygon",
x = 616,
y = 600,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 378,
name = "c01",
type = "",
shape = "polygon",
x = 664,
y = 600,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 379,
name = "c01",
type = "",
shape = "polygon",
x = 712,
y = 600,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 380,
name = "c01",
type = "",
shape = "polygon",
x = 760,
y = 600,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
},
{
id = 381,
name = "c01",
type = "",
shape = "polygon",
x = 808,
y = 600,
width = 0,
height = 0,
rotation = 0,
visible = true,
polygon = {
{ x = 0, y = 0 },
{ x = 8, y = 0 },
{ x = 0, y = -8 },
{ x = -8, y = 0 },
{ x = 0, y = 8 },
{ x = 8, y = 0 }
},
properties = {}
}
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 17,
name = "ladders",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 231,
name = "ladder",
type = "",
shape = "rectangle",
x = 631,
y = 204,
width = 24,
height = 264,
rotation = 0,
visible = true,
properties = {}
},
{
id = 343,
name = "ladder",
type = "",
shape = "rectangle",
x = 936,
y = 243,
width = 24,
height = 289,
rotation = 0,
visible = false,
properties = {}
},
{
id = 359,
name = "ladder",
type = "",
shape = "rectangle",
x = 1264,
y = 244,
width = 24,
height = 205,
rotation = 0,
visible = false,
properties = {}
},
{
id = 403,
name = "ladder",
type = "",
shape = "rectangle",
x = 2192,
y = 452,
width = 24,
height = 232,
rotation = 0,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 16,
name = "ptpfs",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 286,
name = "ptpf",
type = "",
shape = "rectangle",
x = 600,
y = 200,
width = 88,
height = 4,
rotation = 0,
visible = true,
properties = {}
},
{
id = 342,
name = "ptpf",
type = "",
shape = "rectangle",
x = 905,
y = 239,
width = 85,
height = 4,
rotation = 0,
visible = true,
properties = {}
},
{
id = 354,
name = "ptpf",
type = "",
shape = "rectangle",
x = 524,
y = 611,
width = 324,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 360,
name = "ptpf",
type = "",
shape = "rectangle",
x = 1232,
y = 240,
width = 88,
height = 4,
rotation = 0,
visible = true,
properties = {}
},
{
id = 399,
name = "ptpf",
type = "",
shape = "rectangle",
x = 1397,
y = 375,
width = 55,
height = 15,
rotation = 0,
visible = true,
properties = {}
},
{
id = 404,
name = "ptpf",
type = "",
shape = "rectangle",
x = 2184,
y = 448,
width = 40,
height = 4,
rotation = 0,
visible = true,
properties = {}
},
{
id = 413,
name = "ptpf",
type = "",
shape = "rectangle",
x = 1684,
y = 620,
width = 508,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 414,
name = "ptpf",
type = "",
shape = "rectangle",
x = 1744,
y = 552,
width = 448,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 416,
name = "ptpf",
type = "",
shape = "rectangle",
x = 2384,
y = 620,
width = 668,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 419,
name = "ptpf",
type = "",
shape = "rectangle",
x = 2546,
y = 491,
width = 62,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 420,
name = "ptpf",
type = "",
shape = "rectangle",
x = 2546,
y = 552,
width = 62,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 428,
name = "ptpf",
type = "",
shape = "rectangle",
x = 3628,
y = 620,
width = 80,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 429,
name = "ptpf",
type = "",
shape = "rectangle",
x = 3760,
y = 560,
width = 80,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 430,
name = "ptpf",
type = "",
shape = "rectangle",
x = 3888,
y = 504,
width = 80,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 438,
name = "ptpf",
type = "",
shape = "rectangle",
x = 18,
y = 606,
width = 108,
height = 5.7629,
rotation = 19,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 2,
name = "mvpfs",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 288,
name = "mvpf_S84",
type = "",
shape = "rectangle",
x = 573,
y = 116,
width = 27,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 351,
name = "mvpf_N172",
type = "",
shape = "rectangle",
x = 1117,
y = 632,
width = 34,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 356,
name = "mvpf_E190",
type = "",
shape = "rectangle",
x = 991,
y = 239,
width = 50,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 382,
name = "mvpf_S180",
type = "",
shape = "rectangle",
x = 1336,
y = 452,
width = 28,
height = 8,
rotation = 0,
visible = true,
properties = {}
},
{
id = 411,
name = "mvpf_S164",
type = "",
shape = "rectangle",
x = 1655,
y = 448,
width = 28,
height = 8,
rotation = 0,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 14,
name = "playable",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 146,
name = "walkerA",
type = "",
shape = "ellipse",
x = 1192,
y = 624,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 147,
name = "walkerA",
type = "",
shape = "ellipse",
x = 1604,
y = 620,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 148,
name = "walkerA",
type = "",
shape = "ellipse",
x = 1972,
y = 628,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 149,
name = "walkerA",
type = "",
shape = "ellipse",
x = 2512,
y = 632,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 353,
name = "walkerA",
type = "",
shape = "ellipse",
x = 704,
y = 624,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 385,
name = "flyerA",
type = "",
shape = "rectangle",
x = 472,
y = 48,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 386,
name = "flyerKeepA",
type = "",
shape = "rectangle",
x = 96,
y = 0,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 390,
name = "flyerA",
type = "",
shape = "rectangle",
x = 712,
y = 264,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 392,
name = "flyerKeepA",
type = "",
shape = "rectangle",
x = 712,
y = 404,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 393,
name = "flyerA",
type = "",
shape = "rectangle",
x = 868,
y = 288,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 394,
name = "flyerA",
type = "",
shape = "rectangle",
x = 780,
y = 336,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 395,
name = "flyerKeepA",
type = "",
shape = "rectangle",
x = 868,
y = 428,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 396,
name = "flyerKeepA",
type = "",
shape = "rectangle",
x = 760,
y = 152,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 397,
name = "flyerKeepA",
type = "",
shape = "rectangle",
x = 856,
y = 168,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 398,
name = "flyerA",
type = "",
shape = "rectangle",
x = 1096,
y = 188,
width = 16,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 406,
name = "walkerA",
type = "",
shape = "ellipse",
x = 1836,
y = 292,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 415,
name = "walkerA",
type = "",
shape = "ellipse",
x = 2080,
y = 560,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 421,
name = "walkerA",
type = "",
shape = "ellipse",
x = 2720,
y = 560,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 422,
name = "walkerBossA",
type = "",
shape = "ellipse",
x = 4044,
y = 468,
width = 131,
height = 164,
rotation = 0,
visible = true,
properties = {}
},
{
id = 436,
name = "walkerA",
type = "",
shape = "ellipse",
x = 3405,
y = 609,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 441,
name = "player1",
type = "",
shape = "ellipse",
x = 20,
y = 532,
width = 51,
height = 48,
rotation = 0,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 7,
name = "fg",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {}
},
{
type = "objectgroup",
draworder = "topdown",
id = 10,
name = "test",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 87,
name = "player1",
type = "",
shape = "ellipse",
x = 312,
y = 648,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 223,
name = "player1",
type = "",
shape = "ellipse",
x = 2368,
y = 560,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 224,
name = "player1j",
type = "",
shape = "ellipse",
x = 1708,
y = 560,
width = 43,
height = 60,
rotation = 0,
visible = true,
properties = {}
},
{
id = 266,
name = "player1j",
type = "",
shape = "ellipse",
x = 2552,
y = 492,
width = 43,
height = 60,
rotation = 0,
visible = true,
properties = {}
},
{
id = 285,
name = "player1",
type = "",
shape = "ellipse",
x = 1112,
y = 648,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 296,
name = "player1",
type = "",
shape = "ellipse",
x = 200,
y = 88,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 307,
name = "player1j",
type = "",
shape = "ellipse",
x = 552,
y = 628,
width = 43,
height = 60,
rotation = 0,
visible = true,
properties = {}
},
{
id = 309,
name = "player1j",
type = "",
shape = "ellipse",
x = 444,
y = 300,
width = 43,
height = 60,
rotation = 0,
visible = true,
properties = {}
},
{
id = 362,
name = "player1",
type = "",
shape = "ellipse",
x = 1256,
y = 412,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 363,
name = "player1",
type = "",
shape = "ellipse",
x = 956,
y = 496,
width = 43,
height = 40,
rotation = 0,
visible = true,
properties = {}
},
{
id = 426,
name = "player1j",
type = "",
shape = "ellipse",
x = 3840,
y = 500,
width = 43,
height = 60,
rotation = 0,
visible = true,
properties = {}
}
}
}
}
}
| 22.953191 | 48 | 0.274212 |
75e8b7f6316b181fba760fd28dcc062744a01fcc | 74 | css | CSS | src/components/App/bootstrap-overrides.css | Aapzu/old-portfolio | f1e5dbbc5d937f34522308609b64ed3a709e3d20 | [
"Artistic-2.0"
] | null | null | null | src/components/App/bootstrap-overrides.css | Aapzu/old-portfolio | f1e5dbbc5d937f34522308609b64ed3a709e3d20 | [
"Artistic-2.0"
] | null | null | null | src/components/App/bootstrap-overrides.css | Aapzu/old-portfolio | f1e5dbbc5d937f34522308609b64ed3a709e3d20 | [
"Artistic-2.0"
] | null | null | null |
section > .row {
/* For some reason, this is needed */
width: 100%;
} | 14.8 | 39 | 0.581081 |
8eb979f891da269b26b76d780209cf85bcc1117b | 4,254 | h | C | Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h | jacadcaps/webkitty | 9aebd2081349f9a7b5d168673c6f676a1450a66d | [
"BSD-2-Clause"
] | 6 | 2021-07-05T16:09:39.000Z | 2022-03-06T22:44:42.000Z | Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h | jacadcaps/webkitty | 9aebd2081349f9a7b5d168673c6f676a1450a66d | [
"BSD-2-Clause"
] | 7 | 2022-03-15T13:25:39.000Z | 2022-03-15T13:25:44.000Z | Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h | jacadcaps/webkitty | 9aebd2081349f9a7b5d168673c6f676a1450a66d | [
"BSD-2-Clause"
] | null | null | null | /*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
*/
#pragma once
#if ENABLE(GPU_PROCESS)
#include "RemoteImageBufferMessageHandlerProxy.h"
#include <WebCore/ConcreteImageBuffer.h>
#include <WebCore/DisplayListReplayer.h>
namespace WebKit {
template<typename BackendType>
class RemoteImageBufferProxy : public WebCore::ConcreteImageBuffer<BackendType>, public RemoteImageBufferMessageHandlerProxy, public WebCore::DisplayList::Replayer::Delegate {
using BaseConcreteImageBuffer = WebCore::ConcreteImageBuffer<BackendType>;
using BaseConcreteImageBuffer::m_backend;
public:
static auto create(const WebCore::FloatSize& size, float resolutionScale, WebCore::ColorSpace colorSpace, RemoteRenderingBackendProxy& remoteRenderingBackendProxy, ImageBufferIdentifier imageBufferIdentifier)
{
return BaseConcreteImageBuffer::template create<RemoteImageBufferProxy>(size, resolutionScale, colorSpace, nullptr, remoteRenderingBackendProxy, imageBufferIdentifier);
}
RemoteImageBufferProxy(std::unique_ptr<BackendType>&& backend, RemoteRenderingBackendProxy& remoteRenderingBackendProxy, ImageBufferIdentifier imageBufferIdentifier)
: BaseConcreteImageBuffer(WTFMove(backend))
, RemoteImageBufferMessageHandlerProxy(remoteRenderingBackendProxy, imageBufferIdentifier)
{
createBackend(m_backend->logicalSize(), m_backend->backendSize(), m_backend->resolutionScale(), m_backend->colorSpace(), m_backend->createImageBufferBackendHandle());
}
private:
using BaseConcreteImageBuffer::flushDrawingContext;
using BaseConcreteImageBuffer::putImageData;
void flushDrawingContext(const WebCore::DisplayList::DisplayList& displayList) override
{
if (displayList.itemCount()) {
WebCore::DisplayList::Replayer replayer(BaseConcreteImageBuffer::context(), displayList, this);
replayer.replay();
}
}
void flushDrawingContextAndCommit(const WebCore::DisplayList::DisplayList& displayList, ImageBufferFlushIdentifier flushIdentifier) override
{
flushDrawingContext(displayList);
m_backend->flushContext();
commitFlushContext(flushIdentifier);
}
RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const override
{
return BaseConcreteImageBuffer::getImageData(outputFormat, srcRect);
}
bool apply(WebCore::DisplayList::Item& item, WebCore::GraphicsContext&) override
{
if (item.type() != WebCore::DisplayList::ItemType::PutImageData)
return false;
auto& putImageDataItem = static_cast<WebCore::DisplayList::PutImageData&>(item);
putImageData(putImageDataItem.inputFormat(), putImageDataItem.imageData(), putImageDataItem.srcRect(), putImageDataItem.destPoint(), putImageDataItem.destFormat());
return true;
}
};
} // namespace WebKit
#endif // ENABLE(GPU_PROCESS)
| 46.23913 | 212 | 0.766338 |
fd9d110c525840b6ff1503fea15c76c192593a7f | 506 | css | CSS | public/css/bootstrap-panel.css | softactor/challege_school | ec6f1aca6a405426875a0b3fa0636d2e591dc29c | [
"MIT"
] | null | null | null | public/css/bootstrap-panel.css | softactor/challege_school | ec6f1aca6a405426875a0b3fa0636d2e591dc29c | [
"MIT"
] | 5 | 2021-03-10T15:05:41.000Z | 2022-02-27T03:17:45.000Z | public/css/bootstrap-panel.css | softactor/challege_school | ec6f1aca6a405426875a0b3fa0636d2e591dc29c | [
"MIT"
] | null | null | null | .panel {
margin-bottom: 20px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
.panel-default {
border-color: #ddd;
}
.panel-default>.panel-heading {
color: #333;
background-color: #f5f5f5;
border-color: #ddd;
}
.panel-heading {
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel-body {
padding: 15px;
} | 21.083333 | 50 | 0.644269 |
444ab8aade30730cc88a7df30405f132f9e800cb | 679 | py | Python | twitch_uninstall_services.py | europaYuu/RaspiTwitchONAIR | 8fa7a5f457a297e9b06fb946e89c33a0d49e335f | [
"MIT"
] | null | null | null | twitch_uninstall_services.py | europaYuu/RaspiTwitchONAIR | 8fa7a5f457a297e9b06fb946e89c33a0d49e335f | [
"MIT"
] | null | null | null | twitch_uninstall_services.py | europaYuu/RaspiTwitchONAIR | 8fa7a5f457a297e9b06fb946e89c33a0d49e335f | [
"MIT"
] | null | null | null | import os
os.system('sudo systemctl disable twitch_onair_webserver_service')
os.system('sudo systemctl disable twitch_onair_neopixel_service')
os.system('sudo systemctl disable powerButton')
os.system('sudo systemctl disable functionButton')
os.system('sudo systemctl disable oled_service')
os.system('sudo rm /lib/systemd/system/twitch_onair_webserver_service.service')
os.system('sudo rm /lib/systemd/system/twitch_onair_neopixel_service.service')
os.system('sudo rm /lib/systemd/system/powerButton.service')
os.system('sudo rm /lib/systemd/system/functionButton.service')
os.system('sudo rm /lib/systemd/system/oled_service.service')
os.system('sudo systemctl daemon-reload') | 52.230769 | 79 | 0.821797 |
2caf4f07438e65cc804bea91704c942233c37e81 | 4,344 | cpp | C++ | Client/Client.cpp | laboox/Computer-Networks-CA3-S2015 | 1c6d6cd03be06c1978dda355bdeb2401d6d154d5 | [
"MIT"
] | null | null | null | Client/Client.cpp | laboox/Computer-Networks-CA3-S2015 | 1c6d6cd03be06c1978dda355bdeb2401d6d154d5 | [
"MIT"
] | null | null | null | Client/Client.cpp | laboox/Computer-Networks-CA3-S2015 | 1c6d6cd03be06c1978dda355bdeb2401d6d154d5 | [
"MIT"
] | null | null | null | /**
* File "Client.cpp"
* Created by Sina on Sun May 31 13:39:03 2015.
*/
#include "Client.h"
Client::Client(string name, address IP, address serverIp, int routerPort)
: SuperClient(IP, serverIp, routerPort)
{
this->name = name;
}
void Client::run(){
fd_set router_fds, read_fds;
FD_ZERO(&router_fds);
FD_ZERO(&read_fds);
FD_SET(0, &router_fds);
FD_SET(routerFd, &router_fds);
sh(routerFd);
int max_fd = routerFd;
while(true){
read_fds = router_fds;
if(select(max_fd+1, &read_fds, NULL, NULL, NULL) < 0)
throw Exeption("problem in sockets select!");
for(int client_fd=0; client_fd<=max_fd ; client_fd++)
{
try
{
if(FD_ISSET(client_fd , &read_fds))
{
if(client_fd==0)
{
//cerr<<"in recive\n";
string cmd;
getline(cin, cmd);
parseCmd(cmd);
}
else if(client_fd==routerFd)
{
//cerr<<"sock recive\n";
Packet p;
p.recive(routerFd);
parsePacket(p);
}
}
}
catch(Exeption ex)
{
cout<<ex.get_error()<<endl;
}
}
}
}
void Client::updateGroups(string data){
istringstream iss(data);
string name, addr;
while(iss>>name>>addr){
groups[name] = stringToAddr(addr);
}
}
void Client::parsePacket(Packet p){
if(p.getType() == GET_GROUPS_LIST){
cout<<"Groups are:\n";
cout<<p.getDataStr();
updateGroups(p.getDataStr());
}
else if(p.getType() == DATA){
//SuperClient::reciveUnicast(p);
cout<<"Data: "<<p.getDataStr()<<endl;
}
else if(p.getType() == SHOW_MY_GROUPS){
cout<<"i'm in groups:\n"<<p.getDataStr()<<endl;
}
}
void Client::parseCmd(string line){
string cmd0, cmd1, cmd2;
istringstream iss(line);
iss>>cmd0;
if(cmd0=="Get"){
if(iss>>cmd1>>cmd2 && cmd1=="group" && cmd2=="list"){
getGroupList();
cout<<"group list request sent.\n";
} else {
throw Exeption("invalid cmd");
}
}
else if(cmd0=="Select"){
if(iss>>cmd1){
selectGroup(cmd1);
} else {
throw Exeption("invalid cmd");
}
}
else if(cmd0=="Join"){
if(iss>>cmd1){
joinGroup(cmd1);
} else {
throw Exeption("invalid cmd");
}
}
else if(cmd0=="Send"){
if(iss>>cmd1 && cmd1=="message"){
string message;
getline(iss, message);
sendMessage(message);
} else {
throw Exeption("invalid cmd");
}
}
else if(cmd0=="Show"){
if(iss>>cmd1 && cmd1=="group"){
showGroup();
} else {
throw Exeption("invalid cmd");
}
}
else if(cmd0=="SendUniCast"){
if(iss>>cmd1>>cmd2){
SuperClient::sendUnicast(stringToAddr(cmd1), cmd2);
} else {
throw Exeption("invalid cmd");
}
}
}
void Client::sendMessage(string message){
if(selGroup == "")
throw Exeption("no Group selected!\n");
Packet p;
p.setType(SEND_MESSAGE);
p.setSource(IP);
p.setDest(groups[selGroup]);
p.setData(message);
p.send(routerFd);
}
void Client::getGroupList(){
Packet p;
p.setType(GET_GROUPS_LIST);
p.setSource(IP);
p.setDest(serverIP);
p.send(routerFd);
}
void Client::showGroup(){
Packet p;
p.setType(SHOW_MY_GROUPS);
p.setSource(IP);
p.setDest(serverIP);
p.send(routerFd);
}
void Client::selectGroup(string g){
if(groups.count(g)<=0)
throw Exeption("Group does not exist");
selGroup = g;
cout<<"group "<< g << " with ip " << addrToString( groups[g] ) <<" selected!\n";
}
void Client::joinGroup(string g){
if(groups.count(g)<=0)
throw Exeption("Group does not exist");
Packet p;
p.setType(REQ_JOIN);
p.setSource(IP);
p.setDest(serverIP);
p.setData(g);
p.send(routerFd);
cout<<"group "<< g << " with ip " << addrToString( groups[g] ) <<" joined!\n";
}
| 24.542373 | 84 | 0.508748 |
9a2dc92363264084f98d8ea7dc8c7c656edfb3b7 | 489 | lua | Lua | Carbon/Callisto/Tests/NamedArrayLookup.lua | lua-carbon/what-is-carbon | f1aaddba30651d4e4956242f8f650ce085867346 | [
"Zlib"
] | 38 | 2015-02-13T03:12:01.000Z | 2021-10-10T06:32:15.000Z | Carbon/Callisto/Tests/NamedArrayLookup.lua | lua-carbon/what-is-carbon | f1aaddba30651d4e4956242f8f650ce085867346 | [
"Zlib"
] | 101 | 2015-02-13T00:46:20.000Z | 2015-08-21T03:20:43.000Z | Carbon/Callisto/Tests/NamedArrayLookup.lua | lua-carbon/what-is-carbon | f1aaddba30651d4e4956242f8f650ce085867346 | [
"Zlib"
] | 8 | 2015-03-15T14:01:29.000Z | 2020-09-01T06:08:12.000Z | local Callisto = (...)
local TestUtil = Callisto.TestUtil
local settings = {}
local source = [=[
local vec = {1, 2, 3, 4}
Output.a = {vec->xyzw}
Output.b = {vec->wzyx}
Output.c = vec->x + vec->y + vec->z + vec->w
local x, y, z, w = vec->xywz * 2
Output.d = x + y + z + w
local b = {vec->xyzw + 1}
Output.e = b->x + b->y + b->z + b->w
]=]
local good_output = {
a = {1, 2, 3, 4},
b = {4, 3, 2, 1},
c = 10,
d = 20,
e = 14
}
return TestUtil.MakeTest(source, settings, good_output) | 16.862069 | 55 | 0.548057 |
58f3c7218f59c3954722c5f38978885816421166 | 4,717 | css | CSS | css/table.css | jonese1234/Csgo-Cases | ddb1dccf3bcaf68d74ae9ce22f104d05998005db | [
"MIT"
] | null | null | null | css/table.css | jonese1234/Csgo-Cases | ddb1dccf3bcaf68d74ae9ce22f104d05998005db | [
"MIT"
] | null | null | null | css/table.css | jonese1234/Csgo-Cases | ddb1dccf3bcaf68d74ae9ce22f104d05998005db | [
"MIT"
] | null | null | null | * {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
*:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
color: #5e5d52;
}
a {
color: #337aa8;
}
a:hover, a:focus {
color: #4b8ab2;
}
.container {
margin: 5% 3%;
background-color: ghostwhite
}
@media (min-width: 48em) {
.container {
margin: 2%;
}
}
@media (min-width: 75em) {
.container {
margin: 2em auto;
max-width: 80vw;
}
}
.responsive-table {
width: 100%;
margin-bottom: 1.5em;
border-spacing: 0;
}
@media (min-width: 48em) {
.responsive-table {
font-size: 0.9em;
}
}
@media (min-width: 62em) {
.responsive-table {
font-size: 1em;
}
}
.responsive-table thead {
position: absolute;
clip: rect(1px 1px 1px 1px);
/* IE6, IE7 */
padding: 0;
border: 0;
height: 1px;
width: 1px;
overflow: hidden;
}
@media (min-width: 48em) {
.responsive-table thead {
position: relative;
clip: auto;
height: auto;
width: auto;
overflow: auto;
}
}
.responsive-table thead th {
background-color: #1d96b2;
border: 1px solid #1d96b2;
font-weight: normal;
text-align: center;
color: white;
}
.responsive-table thead th:first-of-type {
text-align: left;
}
.responsive-table tbody,
.responsive-table tr,
.responsive-table th,
.responsive-table td {
display: block;
padding: 0;
text-align: left;
white-space: normal;
}
@media (min-width: 48em) {
.responsive-table tr {
display: table-row;
}
}
.responsive-table th,
.responsive-table td {
padding: 0.5em;
vertical-align: middle;
}
@media (min-width: 30em) {
.responsive-table th,
.responsive-table td {
padding: 0.75em 0.5em;
}
}
@media (min-width: 48em) {
.responsive-table th,
.responsive-table td {
display: table-cell;
padding: 0.5em;
}
}
@media (min-width: 62em) {
.responsive-table th,
.responsive-table td {
padding: 0.75em 0.5em;
}
}
@media (min-width: 75em) {
.responsive-table th,
.responsive-table td {
padding: 0.75em;
}
}
.responsive-table caption {
margin-bottom: 1em;
font-size: 1em;
font-weight: bold;
text-align: center;
}
@media (min-width: 48em) {
.responsive-table caption {
font-size: 1.5em;
}
}
.responsive-table tfoot {
font-size: 0.8em;
font-style: italic;
}
@media (min-width: 62em) {
.responsive-table tfoot {
font-size: 0.9em;
}
}
@media (min-width: 48em) {
.responsive-table tbody {
display: table-row-group;
}
}
.responsive-table tbody tr {
margin-bottom: 1em;
}
@media (min-width: 48em) {
.responsive-table tbody tr {
display: table-row;
border-width: 1px;
}
}
.responsive-table tbody tr:last-of-type {
margin-bottom: 0;
}
@media (min-width: 48em) {
.responsive-table tbody tr:nth-of-type(even) {
background-color: rgba(94, 93, 82, 0.1);
}
}
.responsive-table tbody th[scope="row"] {
background-color: #1d96b2;
color: white;
}
@media (min-width: 30em) {
.responsive-table tbody th[scope="row"] {
border-left: 1px solid #1d96b2;
border-bottom: 1px solid #1d96b2;
}
}
@media (min-width: 48em) {
.responsive-table tbody th[scope="row"] {
background-color: transparent;
color: #5e5d52;
text-align: left;
}
}
.responsive-table tbody td {
text-align: right;
}
@media (min-width: 48em) {
.responsive-table tbody td {
border-left: 1px solid #1d96b2;
border-bottom: 1px solid #1d96b2;
text-align: center;
}
}
@media (min-width: 48em) {
.responsive-table tbody td:last-of-type {
border-right: 1px solid #1d96b2;
}
}
.responsive-table tbody td[data-type="currency"] {
text-align: right;
}
.responsive-table tbody td:before {
float: left;
font-size: 0.8em;
color: rgba(94, 93, 82, 0.75);
}
@media (min-width: 30em) {
.responsive-table tbody td:before {
font-size: 0.9em;
}
}
@media (min-width: 48em) {
.responsive-table tbody td:before {
content: none;
}
}
td:nth-of-type(1):before { content: "Cost of Case ($)"; }
td:nth-of-type(2):before { content: "Cost of Key ($)"; }
td:nth-of-type(3):before { content: "Average Mill-spec ($)"; }
td:nth-of-type(4):before { content: "Average Restricted ($)"; }
td:nth-of-type(5):before { content: "Average Classified ($)"; }
td:nth-of-type(6):before { content: "Average Covert ($)"; }
td:nth-of-type(7):before { content: "Average Special ($)"; }
td:nth-of-type(8):before { content: "Average Return on case ($)"; }
td:nth-of-type(9):before { content: "Return on Investment (%)"; }
tfoot tr td:before{
content: "" !important;
}
.lowercap{
font-size: 0.7em;
font-weight: normal
} | 19.736402 | 76 | 0.635573 |
f148459294304ab7c6ed90b8831e65c6c456d4fd | 64 | rb | Ruby | lib/asciidoctor-latex/version.rb | jirutka/asciidoctor-latex | 120051b3146645717deb02cf3a01c734504f47df | [
"MIT"
] | null | null | null | lib/asciidoctor-latex/version.rb | jirutka/asciidoctor-latex | 120051b3146645717deb02cf3a01c734504f47df | [
"MIT"
] | null | null | null | lib/asciidoctor-latex/version.rb | jirutka/asciidoctor-latex | 120051b3146645717deb02cf3a01c734504f47df | [
"MIT"
] | null | null | null | module Asciidoctor
module LaTeX
VERSION = '1.5.0.dev'
end
end
| 10.666667 | 23 | 0.734375 |
66b5f4e7f2e41fb3addc6ccf03f906a29b33f67b | 912 | kt | Kotlin | app/src/main/java/com/fave/breezil/fave/repository/NetworkState.kt | breel93/Fave | a5b774548bb1c747bbb4a0263031f6935eca3c75 | [
"Apache-2.0"
] | 3 | 2019-05-01T15:41:54.000Z | 2019-05-16T05:03:46.000Z | app/src/main/java/com/fave/breezil/fave/repository/NetworkState.kt | breel93/Fave | a5b774548bb1c747bbb4a0263031f6935eca3c75 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/fave/breezil/fave/repository/NetworkState.kt | breel93/Fave | a5b774548bb1c747bbb4a0263031f6935eca3c75 | [
"Apache-2.0"
] | 2 | 2019-05-01T15:41:59.000Z | 2019-05-02T16:53:53.000Z | /**
* Designed and developed by Fave
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.fave.breezil.fave.repository
class NetworkState(val status: Status) {
enum class Status {
RUNNING,
SUCCESS,
FAILED,
NO_RESULT
}
companion object {
val LOADED: NetworkState = NetworkState(Status.SUCCESS)
val LOADING: NetworkState = NetworkState(Status.RUNNING)
}
}
| 27.636364 | 75 | 0.724781 |
1a8027fa13bfc3f9070de05f89dc571b7fabad99 | 242 | py | Python | srv-manuals/pyinfra/deploy.py | 0054/lab | da1637ecc334a716084de55fe01741f208859c3b | [
"MIT"
] | null | null | null | srv-manuals/pyinfra/deploy.py | 0054/lab | da1637ecc334a716084de55fe01741f208859c3b | [
"MIT"
] | null | null | null | srv-manuals/pyinfra/deploy.py | 0054/lab | da1637ecc334a716084de55fe01741f208859c3b | [
"MIT"
] | null | null | null | import pyinfra.operations as o
import pyinfra
from pyinfra.operations import yum, server, apt
server.shell(
name = 'Run shell command',
commands = 'df -h')
yum.packages(
packages = ['bash-completions']
)
| 15.125 | 47 | 0.632231 |
7969b32e76a8968588739686191811efd24dfa81 | 936 | php | PHP | php/topq.php | lostleaf/ccxt | da44f61e102fcaf07038dda05eb74ff24698d3dc | [
"MIT"
] | 3 | 2020-05-10T12:51:24.000Z | 2021-04-20T21:36:43.000Z | php/topq.php | lostleaf/ccxt | da44f61e102fcaf07038dda05eb74ff24698d3dc | [
"MIT"
] | null | null | null | php/topq.php | lostleaf/ccxt | da44f61e102fcaf07038dda05eb74ff24698d3dc | [
"MIT"
] | 2 | 2019-04-17T02:49:29.000Z | 2019-06-01T06:45:50.000Z | <?php
namespace ccxt;
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
use Exception; // a common import
class topq extends bw {
public function describe() {
return array_replace_recursive(parent::describe (), array(
'id' => 'topq',
'countries' => array( 'SG' ),
'name' => 'TOP.Q',
'hostname' => 'topliq.com',
'urls' => array(
'logo' => 'https://user-images.githubusercontent.com/1294454/74596147-50247000-505c-11ea-9224-4fd347cfbb49.jpg',
'api' => 'https://www.{hostname}',
'www' => 'https://www.topliq.com',
'doc' => 'https://github.com/topq-exchange/api_docs_en/wiki/REST_api_reference',
'fees' => 'https://www.topliq.com/feesRate',
),
));
}
}
| 33.428571 | 128 | 0.560897 |
2faf00b8e104742fdb683cc2c929e7980aa070a9 | 2,004 | py | Python | yolo/model/backbone/path_aggregation_network.py | f-fl0/YOLOv5-PyTorch | de5edc8f67ef355337faa8deb68c8a9ddeecdb33 | [
"MIT"
] | 125 | 2020-08-09T13:21:24.000Z | 2022-03-22T06:45:39.000Z | yolo/model/backbone/path_aggregation_network.py | f-fl0/YOLOv5-PyTorch | de5edc8f67ef355337faa8deb68c8a9ddeecdb33 | [
"MIT"
] | 7 | 2020-10-16T08:40:55.000Z | 2022-02-17T10:03:29.000Z | yolo/model/backbone/path_aggregation_network.py | f-fl0/YOLOv5-PyTorch | de5edc8f67ef355337faa8deb68c8a9ddeecdb33 | [
"MIT"
] | 25 | 2020-11-01T05:17:08.000Z | 2021-12-29T11:41:36.000Z | import torch
from torch import nn
from .utils import Conv, ConcatBlock
class PathAggregationNetwork(nn.Module):
def __init__(self, in_channels_list, depth):
super().__init__()
self.inner_blocks = nn.ModuleList()
self.layer_blocks = nn.ModuleList()
self.upsample_blocks = nn.ModuleList()
self.downsample_blocks = nn.ModuleList()
self.outer_blocks = nn.ModuleList()
for i, ch in enumerate(in_channels_list):
self.inner_blocks.append(ConcatBlock(2 * ch if i < 2 else in_channels_list[-1], ch, depth, False))
if i > 0:
in_channels = in_channels_list[i - 1]
self.layer_blocks.append(Conv(ch, in_channels, 1))
self.upsample_blocks.append(nn.Upsample(scale_factor=2))
self.downsample_blocks.append(Conv(in_channels, in_channels, 3, 2))
self.outer_blocks.append(ConcatBlock(ch, ch, depth, False))
#for m in self.modules():
# if isinstance(m, nn.Conv2d):
# nn.init.kaiming_uniform_(m.weight, a=1)
def forward(self, x):
results = []
last_inner = self.inner_blocks[-1](x[-1])
results.append(self.layer_blocks[-1](last_inner))
for i in range(len(x) - 2, -1, -1):
inner_top_down = self.upsample_blocks[i](results[0])
last_inner = self.inner_blocks[i](torch.cat((inner_top_down, x[i]), dim=1)) # official
#last_inner = self.inner_blocks[i](torch.cat((x[i], inner_top_down), dim=1)) # old
results.insert(0, last_inner if i == 0 else self.layer_blocks[i - 1](last_inner))
for i in range(len(x) - 1):
outer_bottom_up = self.downsample_blocks[i](results[i])
layer_result = results[i + 1]
results[i + 1] = self.outer_blocks[i](torch.cat((outer_bottom_up, layer_result), dim=1))
return results
| 40.897959 | 110 | 0.588822 |
794a98566e6efab5f2cac029a9a88f2ffd0a1b65 | 7,238 | php | PHP | app/Http/Controllers/PermissionsController.php | cheloynesh/trazenta | 457b15e9a9ee27850f3549cafc94eb74a3439f9e | [
"MIT"
] | null | null | null | app/Http/Controllers/PermissionsController.php | cheloynesh/trazenta | 457b15e9a9ee27850f3549cafc94eb74a3439f9e | [
"MIT"
] | null | null | null | app/Http/Controllers/PermissionsController.php | cheloynesh/trazenta | 457b15e9a9ee27850f3549cafc94eb74a3439f9e | [
"MIT"
] | null | null | null | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Profile;
use App\Permission;
use App\Section;
use App\User;
use DB;
class PermissionsController extends Controller
{
public function index(){
$profiles = Profile::pluck('name','id');
$profile = User::findProfile();
$perm = Permission::permView($profile,7);
$perm_btn =Permission::permBtns($profile,7);
$padre =Section::whereRaw('id = reference')->orderBy('order','ASC')->get();
// dd($padre);
$hijos = Section::whereRaw('id!=reference')->orderBy('order','ASC')->get();
// dd($hijos, $padre);
if($perm==0) {
return redirect()->route('home');
} else {
return view('admin.permission.permissions', compact('perm_btn','profile','padre','hijos','profiles'));
}
}
public function edit($id){
$per = Permission::where('fk_profile','=',$id)->get();
return response()->json($per);
}
public function update_store(Request $request){
// dd($request->all());
// dd($fk_section);
$perm = Permission::where('fk_profile','=',$request->id)->where('fk_section','=',$request->section)->count();
// dd($perm);
if($perm>0){
// dd($request->all());
// dd($request->id, $request->section, $request->btn, $request->reference);
Permission::updatePermission($request->id, $request->section, $request->btn, $request->reference);
}else{//no existe-crear permiso
switch ($request->btn) {
case 0://VER
$per_ = new Permission();
$per_ ->fk_profile=$request->id;
$per_ ->fk_section=$request->section;
$per_ ->view=1;
$per_->save();
$permisions = DB::table('Permissions as perm')
->join('Sections','Sections.id','=','perm.fk_section')
->where(['Sections.reference'=>$request->reference,'view'=>1,'fk_profile'=>$request->id])
->count();
if($permisions>0){
$findPermisions = Permission::where('fk_section','=',$request->reference)->where('fk_profile','=',$request->id)->get();
if($findPermisions->count() == 0){
$createPermision = new Permission();
$createPermision->fk_profile=$request->id;
$createPermision->fk_section=$request->reference;
$createPermision->view=1;
$createPermision->save();
}
}
break;
case 1://AGREGAR
// dd("entre");
$per_ = new Permission();
$per_ ->fk_profile=$request->id;
$per_ ->fk_section=$request->section;
$per_ ->view=1;
$per_ ->addition=1;
$per_->save();
$perms = Permission::where('fk_profile','=',$request->id)->where('fk_section','=',$request->section)->pluck('fk_section');
// dd($perms);
$permisions = DB::table('Permissions as perm')
->join('Sections','Sections.id','=','perm.fk_section')
->where(['Sections.reference'=>$request->reference,'view'=>1,'fk_profile'=>$request->id])
->count();
if($permisions>0){
$findPermisions = Permission::where('fk_section','=',$request->reference)->where('fk_profile','=',$request->id)->get();
if($findPermisions->count() == 0){
$createPermision = new Permission();
$createPermision->fk_profile=$request->id;
$createPermision->fk_section=$request->reference;
$createPermision->view=1;
$createPermision->save();
}
}
return response()->json(['data'=>$perms]);
break;
case 2://EDITAR
// dd($btn);
$per_ = new Permission();
$per_ ->fk_profile=$request->id;
$per_ ->fk_section=$request->section;
$per_ ->view=1;
$per_ ->modify=1;
$per_->save();
$perms = Permission::where('fk_profile','=',$request->id)->where('fk_section','=',$request->section)->pluck('fk_section');
$permisions = DB::table('Permissions as perm')
->join('Sections','Sections.id','=','perm.fk_section')
->where(['Sections.reference'=>$request->reference,'view'=>1,'fk_profile'=>$request->id])
->count();
if($permisions>0){
$findPermisions = Permission::where('fk_section','=',$request->reference)->where('fk_profile','=',$request->id)->get();
if($findPermisions->count() == 0){
$createPermision = new Permission();
$createPermision->fk_profile=$request->id;
$createPermision->fk_section=$request->reference;
$createPermision->view=1;
$createPermision->save();
}
}
return response()->json(['data'=>$perms]);
break;
case 3://ELIMINAR
$per_ = new Permission();
$per_ ->fk_profile=$request->id;
$per_ ->fk_section=$request->section;
$per_ ->view=1;
$per_ ->erase=1;
$per_->save();
$perms = Permission::where('fk_profile','=',$request->id)->where('fk_section','=',$request->section)->pluck('fk_section');
$permisions = DB::table('Permissions as perm')
->join('Sections','Sections.id','=','perm.fk_section')
->where(['Sections.reference'=>$request->reference,'view'=>1,'fk_profile'=>$request->id])
->count();
if($permisions>0){
$findPermisions = Permission::where('fk_section','=',$request->reference)->where('fk_profile','=',$request->id)->get();
if($findPermisions->count() == 0){
$createPermision = new Permission();
$createPermision->fk_profile=$request->id;
$createPermision->fk_section=$request->reference;
$createPermision->view=1;
$createPermision->save();
}
}
return response()->json(['data'=>$perms]);
break;
}
}
}
}
| 48.253333 | 143 | 0.453716 |
dfbb9614ff52bf3736fff5a4d3e2981c96a2d2c5 | 236 | cs | C# | Zombie/ZombieView.xaml.cs | HOKGroup/Zombie | c65d4ea8d6e7c8a8786a93139ca50415775b40df | [
"MIT"
] | 27 | 2018-07-03T16:13:55.000Z | 2021-04-20T10:02:37.000Z | Zombie/ZombieView.xaml.cs | HOKGroup/Zombie | c65d4ea8d6e7c8a8786a93139ca50415775b40df | [
"MIT"
] | 30 | 2018-07-03T21:28:59.000Z | 2020-08-11T04:05:33.000Z | Zombie/ZombieView.xaml.cs | HOKGroup/Zombie | c65d4ea8d6e7c8a8786a93139ca50415775b40df | [
"MIT"
] | 3 | 2018-07-09T22:12:02.000Z | 2020-04-19T19:32:58.000Z | namespace Zombie
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class ZombieView
{
public ZombieView()
{
InitializeComponent();
}
}
}
| 16.857143 | 45 | 0.529661 |
e27ec36e01ab918b82fb217fe1587fb07b2b95c0 | 9,769 | js | JavaScript | odoo-13.0/addons/web/static/src/js/fields/signature.js | VaibhavBhujade/Blockchain-ERP-interoperability | b5190a037fb6615386f7cbad024d51b0abd4ba03 | [
"MIT"
] | 12 | 2021-03-26T08:39:40.000Z | 2022-03-16T02:20:10.000Z | odoo-13.0/addons/web/static/src/js/fields/signature.js | VaibhavBhujade/Blockchain-ERP-interoperability | b5190a037fb6615386f7cbad024d51b0abd4ba03 | [
"MIT"
] | 13 | 2020-12-20T16:00:21.000Z | 2022-03-14T14:55:30.000Z | odoo-13.0/addons/web/static/src/js/fields/signature.js | VaibhavBhujade/Blockchain-ERP-interoperability | b5190a037fb6615386f7cbad024d51b0abd4ba03 | [
"MIT"
] | 17 | 2020-08-31T11:18:49.000Z | 2022-02-09T05:57:31.000Z | odoo.define('web.Signature', function (require) {
"use strict";
var AbstractFieldBinary = require('web.basic_fields').AbstractFieldBinary;
var core = require('web.core');
var Dialog = require('web.Dialog');
var field_utils = require('web.field_utils');
var NameAndSignature = require('web.name_and_signature').NameAndSignature;
var registry = require('web.field_registry');
var session = require('web.session');
var utils = require('web.utils');
var qweb = core.qweb;
var _t = core._t;
var _lt = core._lt;
// The goal of this dialog is to ask the user a signature request.
// It uses @see SignNameAndSignature for the name and signature fields.
var SignatureDialog = Dialog.extend({
template: 'web.signature_dialog',
xmlDependencies: Dialog.prototype.xmlDependencies.concat(
['/web/static/src/xml/name_and_signature.xml']
),
custom_events: {
'signature_changed': '_onChangeSignature',
},
/**
* @constructor
* @param {Widget} parent
* @param {Object} options
* @param {string} [options.title='Adopt Your Signature'] - modal title
* @param {string} [options.size='medium'] - modal size
* @param {Object} [options.nameAndSignatureOptions={}] - options for
* @see NameAndSignature.init()
*/
init: function (parent, options) {
var self = this;
options = options || {};
options.title = options.title || _t("Adopt Your Signature");
options.size = options.size || 'medium';
options.technical = false;
if (!options.buttons) {
options.buttons = [];
options.buttons.push({text: _t("Adopt and Sign"), classes: "btn-primary", disabled: true, click: function (e) {
self._onConfirm();
}});
options.buttons.push({text: _t("Cancel"), close: true});
}
this._super(parent, options);
this.nameAndSignature = new NameAndSignature(this, options.nameAndSignatureOptions);
},
/**
* Start the nameAndSignature widget and wait for it.
*
* @override
*/
willStart: function () {
return Promise.all([
this.nameAndSignature.appendTo($('<div>')),
this._super.apply(this, arguments)
]);
},
/**
* Initialize the name and signature widget when the modal is opened.
*
* @override
*/
start: function () {
var self = this;
this.$primaryButton = this.$footer.find('.btn-primary');
this.opened().then(function () {
self.$('.o_web_sign_name_and_signature').replaceWith(self.nameAndSignature.$el);
// initialize the signature area
self.nameAndSignature.resetSignature();
});
return this._super.apply(this, arguments);
},
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
/**
* Returns whether the drawing area is currently empty.
*
* @see NameAndSignature.isSignatureEmpty()
* @returns {boolean} Whether the drawing area is currently empty.
*/
isSignatureEmpty: function () {
return this.nameAndSignature.isSignatureEmpty();
},
//----------------------------------------------------------------------
// Handlers
//----------------------------------------------------------------------
/**
* Toggles the submit button depending on the signature state.
*
* @private
*/
_onChangeSignature: function () {
var isEmpty = this.nameAndSignature.isSignatureEmpty();
this.$primaryButton.prop('disabled', isEmpty);
},
/**
* Upload the signature image when confirm.
*
* @private
*/
_onConfirm: function (fct) {
this.trigger_up('upload_signature', {
name: this.nameAndSignature.getName(),
signatureImage: this.nameAndSignature.getSignatureImage(),
});
},
});
var FieldBinarySignature = AbstractFieldBinary.extend({
description: _lt("Signature"),
fieldDependencies: _.extend({}, AbstractFieldBinary.prototype.fieldDependencies, {
__last_update: {type: 'datetime'},
}),
resetOnAnyFieldChange: true,
custom_events: _.extend({}, AbstractFieldBinary.prototype.custom_events, {
upload_signature: '_onUploadSignature',
}),
events: _.extend({}, AbstractFieldBinary.prototype.events, {
'click .o_signature': '_onClickSignature',
}),
template: null,
supportedFieldTypes: ['binary'],
file_type_magic_word: {
'/': 'jpg',
'R': 'gif',
'i': 'png',
'P': 'svg+xml',
},
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
/**
* This widget must always have render even if there are no signature.
* In edit mode, the real value is return to manage required fields.
*
* @override
*/
isSet: function () {
if (this.mode === 'edit') {
return this.value;
}
return true;
},
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
/**
* Renders an empty signature or the saved signature. Both must have the same size.
*
* @override
* @private
*/
_render: function () {
var self = this;
var displaySignatureRatio = 3;
var url;
var $img;
var width = this.nodeOptions.size ? this.nodeOptions.size[0] : this.attrs.width;
var height = this.nodeOptions.size ? this.nodeOptions.size[1] : this.attrs.height;
if (this.value) {
if (!utils.is_bin_size(this.value)) {
// Use magic-word technique for detecting image type
url = 'data:image/' + (this.file_type_magic_word[this.value[0]] || 'png') + ';base64,' + this.value;
} else {
url = session.url('/web/image', {
model: this.model,
id: JSON.stringify(this.res_id),
field: this.nodeOptions.preview_image || this.name,
// unique forces a reload of the image when the record has been updated
unique: field_utils.format.datetime(this.recordData.__last_update).replace(/[^0-9]/g, ''),
});
}
$img = $(qweb.render("FieldBinarySignature-img", {widget: this, url: url}));
} else {
$img = $('<div class="o_signature o_signature_empty"><svg></svg><p>' + _t('SIGNATURE') + '</p></div>');
if (width && height) {
width = Math.min(width, displaySignatureRatio * height);
height = width / displaySignatureRatio;
} else if (width) {
height = width / displaySignatureRatio;
} else if (height) {
width = height * displaySignatureRatio;
}
}
if (width) {
$img.attr('width', width);
$img.css('max-width', width + 'px');
}
if (height) {
$img.attr('height', height);
$img.css('max-height', height + 'px');
}
this.$('> div').remove();
this.$('> img').remove();
this.$el.prepend($img);
$img.on('error', function () {
self._clearFile();
$img.attr('src', self.placeholder);
self.do_warn(_t("Image"), _t("Could not display the selected image."));
});
},
//--------------------------------------------------------------------------
// Handlers
//--------------------------------------------------------------------------
/**
* If the view is in edit mode, open dialog to sign.
*
* @private
*/
_onClickSignature: function () {
var self = this;
if (this.mode === 'edit') {
var nameAndSignatureOptions = {
mode: 'draw',
displaySignatureRatio: 3,
signatureType: 'signature',
noInputName: true,
};
if (this.nodeOptions.full_name) {
var signName;
if (this.fields[this.nodeOptions.full_name].type === 'many2one') {
// If m2o is empty, it will have falsy value in recordData
signName = this.recordData[this.nodeOptions.full_name] && this.recordData[this.nodeOptions.full_name].data.display_name;
} else {
signName = this.recordData[this.nodeOptions.full_name];
}
nameAndSignatureOptions.defaultName = (signName === '') ? undefined : signName;
}
nameAndSignatureOptions.defaultFont = this.nodeOptions.default_font || '';
this.signDialog = new SignatureDialog(self, {nameAndSignatureOptions: nameAndSignatureOptions});
this.signDialog.open();
}
},
/**
* Upload the signature image if valid and close the dialog.
*
* @private
*/
_onUploadSignature: function (ev) {
var signatureImage = ev.data.signatureImage;
if (signatureImage !== this.signDialog.emptySignature) {
var data = signatureImage[1];
var type = signatureImage[0].split('/')[1];
this.on_file_uploaded(data.length, ev.data.name, type, data);
}
this.signDialog.close();
}
});
registry.add('signature', FieldBinarySignature);
});
| 34.397887 | 140 | 0.521855 |
a3497b126f5eeaf68d308126449a9ab7432d6390 | 1,499 | java | Java | src/main/java/com/google/security/zynamics/binnavi/disassembly/AddressSpaces/CAddressSpaceListenerAdapter.java | bowlofstew/binnavi | 4565cbc7884d30ac0ca9ce379912bbd82b78f254 | [
"Apache-2.0"
] | 1 | 2021-09-29T01:49:00.000Z | 2021-09-29T01:49:00.000Z | src/main/java/com/google/security/zynamics/binnavi/disassembly/AddressSpaces/CAddressSpaceListenerAdapter.java | bowlofstew/binnavi | 4565cbc7884d30ac0ca9ce379912bbd82b78f254 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/google/security/zynamics/binnavi/disassembly/AddressSpaces/CAddressSpaceListenerAdapter.java | bowlofstew/binnavi | 4565cbc7884d30ac0ca9ce379912bbd82b78f254 | [
"Apache-2.0"
] | null | null | null | /*
Copyright 2015 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.google.security.zynamics.binnavi.disassembly.AddressSpaces;
import com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace;
/**
* A listener adapter for address space listeners that do not want to implement all methods of the
* regular address space listener.
*/
public class CAddressSpaceListenerAdapter implements IAddressSpaceListener {
@Override
public void closed(final INaviAddressSpace addressSpace, final CAddressSpaceContent content) {
// Empty default implementation
}
@Override
public boolean closing(final INaviAddressSpace addressSpace) {
// Empty default implementation
return true;
}
@Override
public void loaded(final INaviAddressSpace addressSpace) {
// Empty default implementation
}
@Override
public boolean loading(final AddressSpaceLoadEvents event, final int counter) {
// Empty default implementation
return true;
}
}
| 31.893617 | 98 | 0.779853 |
fa43abe574becae19946a822d743f83aaf3c239e | 561 | cpp | C++ | infer/tests/build_systems/deduplicate_template_warnings/src/templates.cpp | JacobBarthelmeh/infer | 12c582a69855e17a2cf9c7b6cdf7f8e9c71e5341 | [
"MIT"
] | 14,499 | 2015-06-11T16:00:28.000Z | 2022-03-31T23:43:54.000Z | infer/tests/build_systems/deduplicate_template_warnings/src/templates.cpp | JacobBarthelmeh/infer | 12c582a69855e17a2cf9c7b6cdf7f8e9c71e5341 | [
"MIT"
] | 1,529 | 2015-06-11T16:55:30.000Z | 2022-03-27T15:59:46.000Z | infer/tests/build_systems/deduplicate_template_warnings/src/templates.cpp | JacobBarthelmeh/infer | 12c582a69855e17a2cf9c7b6cdf7f8e9c71e5341 | [
"MIT"
] | 2,225 | 2015-06-11T16:36:10.000Z | 2022-03-31T05:16:59.000Z | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// we should only report one dead store warning on this file
template <class T>
T* unused_var_template_bad() {
int i = 42;
return 0;
}
int* unused_var_template1_bad() { return unused_var_template_bad<int>(); }
char* unused_var_template2_bad() { return unused_var_template_bad<char>(); }
long* unused_var_template3_bad() { return unused_var_template_bad<long>(); }
| 26.714286 | 76 | 0.736185 |
f5acdbe1175439e8bb8c041a191540d3b869f2b5 | 957 | css | CSS | packages/react-tc-ui-kit/src/components/NativeSelect/NativeSelect.css | TourmalineCore/React-Packages | a5cbbf334e30a191a54817c3320daf4e1872d67b | [
"MIT"
] | null | null | null | packages/react-tc-ui-kit/src/components/NativeSelect/NativeSelect.css | TourmalineCore/React-Packages | a5cbbf334e30a191a54817c3320daf4e1872d67b | [
"MIT"
] | 12 | 2021-01-26T05:21:21.000Z | 2021-06-17T09:48:32.000Z | packages/react-tc-ui-kit/src/components/NativeSelect/NativeSelect.css | TourmalineCore/React-Packages | a5cbbf334e30a191a54817c3320daf4e1872d67b | [
"MIT"
] | null | null | null | .tc-native-select__label {
display: block;
margin-bottom: 6px;
line-height: 1.2;
}
.tc-native-select__control {
border: 1px solid #bac4ca;
border-radius: 10px;
padding: 0 38px 0 16px;
width: 100%;
height: 42px;
box-sizing: border-box;
box-shadow: none;
font-family: inherit;
font-weight: inherit;
font-size: inherit;
color: inherit;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M506 124c-9-9-22-9-30 0L256 343 36 124a21 21 0 10-30 30l235 234a21 21 0 0030 0l235-234c8-9 8-22 0-30z' fill='%233C4A64'/%3E%3C/svg%3E%0A");
background-position: right 16px top 50%, 0 0;
background-size: 11px auto, 100%;
background-repeat: no-repeat, repeat;
background-color: #fff;
cursor: pointer;
appearance: none;
}
.tc-native-select__control:hover {
border-color: #81898e;
}
.tc-native-select__control:focus {
outline: none;
border-color: #2f3436;
}
| 26.583333 | 260 | 0.69488 |
e1f47856e8e72282c7ab646d364bda2cc40a97bc | 1,091 | cpp | C++ | stacks_queues/assignments/stock_span.cpp | ramchandra94/datastructures_in_cpp | 28274ff4f0d9736cfe690ef002b90b9ebbfaf2f7 | [
"MIT"
] | null | null | null | stacks_queues/assignments/stock_span.cpp | ramchandra94/datastructures_in_cpp | 28274ff4f0d9736cfe690ef002b90b9ebbfaf2f7 | [
"MIT"
] | null | null | null | stacks_queues/assignments/stock_span.cpp | ramchandra94/datastructures_in_cpp | 28274ff4f0d9736cfe690ef002b90b9ebbfaf2f7 | [
"MIT"
] | null | null | null | class Node {
public:
int data;
int index;
Node *next;
Node(int data, int index){
this -> data = data;
this -> index = index;
this -> next = NULL;
}
};
class Stack {
Node *stackArr;
int size;
public:
Stack(){
stackArr = NULL;
size = 0;
}
void push(int data, int index){
Node *newNode = new Node(data, index);
newNode -> next = stackArr;
stackArr = newNode;
size++;
}
void pop(){
Node *temp = stackArr -> next;
delete stackArr;
stackArr = temp;
}
Node * top(){
return stackArr;
}
};
int* stockSpan(int *price, int size) {
// Write your code here
Stack s;
int * spanArr = new int[size];
for(int i=0; i < size; i++){
while(s.top() != NULL && s.top() -> data < price[i]){
s.pop();
}
if(s.top() == NULL){
spanArr[i] = i+1;
}else{
spanArr[i] = i - s.top() -> index;
}
s.push(price[i], i);
}
return spanArr;
} | 19.140351 | 61 | 0.454629 |
bfe6f08eef6673970e6f98ce3f48086d501b7e76 | 1,774 | swift | Swift | Sources/SATSCore/DNA/Font/SATSFont-TextStyle.swift | healthfitnessnordic/SATSCore-iOS | 66ca055876bdc92c5df250d140e916d1575eab13 | [
"MIT"
] | 3 | 2021-05-18T07:31:59.000Z | 2022-03-20T10:07:32.000Z | Sources/SATSCore/DNA/Font/SATSFont-TextStyle.swift | healthfitnessnordic/SATSCore-iOS | 66ca055876bdc92c5df250d140e916d1575eab13 | [
"MIT"
] | 12 | 2021-08-02T08:53:22.000Z | 2022-03-23T10:44:28.000Z | Sources/SATSCore/DNA/Font/SATSFont-TextStyle.swift | healthfitnessnordic/SATSCore-iOS | 66ca055876bdc92c5df250d140e916d1575eab13 | [
"MIT"
] | null | null | null | import UIKit
public extension SATSFont {
/// Semantic style for text in order to define a hierarchy with text elements
struct TextStyle: Equatable, Hashable {
public let size: CGFloat
/// An equivalent text style in UIKit. Used for dynamic type support
public let nativeStyle: UIFont.TextStyle
/// Name of the style, for debugging purposes only
public let name: String
public init(size: CGFloat, nativeStyle: UIFont.TextStyle, name: String) {
self.size = size
self.nativeStyle = nativeStyle
self.name = name
}
}
}
// swiftlint:disable comma
public extension SATSFont.TextStyle {
/// 28 pts
static let h1 = SATSFont.TextStyle(size: 28, nativeStyle: .title1 , name: "h1")
/// 24 pts
static let h2 = SATSFont.TextStyle(size: 24, nativeStyle: .title2 , name: "h2")
/// 20 pts
static let h3 = SATSFont.TextStyle(size: 20, nativeStyle: .title3 , name: "h3")
/// 16 pts
static let large = SATSFont.TextStyle(size: 16, nativeStyle: .body , name: "large")
/// 14 pts
static let basic = SATSFont.TextStyle(size: 14, nativeStyle: .callout , name: "basic")
/// 12 pts
static let small = SATSFont.TextStyle(size: 12, nativeStyle: .footnote , name: "small")
/// 16 pts
static let section = SATSFont.TextStyle(size: 16, nativeStyle: .body , name: "section")
/// 14 pts
static let button = SATSFont.TextStyle(size: 14, nativeStyle: .subheadline , name: "button")
/// 16 pts
static let navigationTitle = SATSFont.TextStyle(size: 16, nativeStyle: .body , name: "navigationTitle")
}
| 41.255814 | 114 | 0.605411 |
db746d0d732951fbc1256b88c95d92c85a719f20 | 17,088 | php | PHP | config/router.php | fizk/kob-web | 50d0262df69922de4decc707c4e6863b1a4904a2 | [
"BSD-3-Clause"
] | null | null | null | config/router.php | fizk/kob-web | 50d0262df69922de4decc707c4e6863b1a4904a2 | [
"BSD-3-Clause"
] | null | null | null | config/router.php | fizk/kob-web | 50d0262df69922de4decc707c4e6863b1a4904a2 | [
"BSD-3-Clause"
] | null | null | null | <?php declare(strict_types=1);
use Mezzio\Helper\BodyParams\BodyParamsMiddleware;
use App\Handler;
use App\Middleware;
return [
'/' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\HomePageHandler::class
],
'heim'
],
],
'/home' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\HomePageHandler::class
],
'home'
],
],
'/listi/{year}' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Entry\EntriesPageHandler::class
],
'listi'
],
],
'/list/{year}' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Entry\EntriesPageHandler::class
],
'list'
],
],
'/verkefni' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Entry\ProjectsPageHandler::class
],
'verkefni'
],
],
'/projects' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Entry\ProjectsPageHandler::class
],
'projects'
],
],
'/syningar' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Entry\EntriesPageHandler::class
],
'syningar'
],
],
'/shows' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Entry\EntriesPageHandler::class
],
'entries'
],
],
'/syningar/{id}' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Entry\EntryPageHandler::class
],
'syning'
],
],
'/shows/{id}' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Entry\EntryPageHandler::class
],
'entry'
],
],
'/listamenn' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Author\AuthorsPageHandler::class
],
'listamenn'
],
],
'/authors' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Author\AuthorsPageHandler::class
],
'authors'
],
],
'/listamenn/{id}' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Author\AuthorPageHandler::class
],
'listamadur'
],
],
'/authors/{id}' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Author\AuthorPageHandler::class
],
'author'
],
],
'/um' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Page\ManifestoPageHandler::class
],
'um'
],
],
'/about' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Page\ManifestoPageHandler::class
],
'about'
],
],
'/verslun' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Store\StorePageHandler::class
],
'verslun'
],
],
'/store' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Store\StorePageHandler::class
],
'store'
],
],
'/velunnarar' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Page\SupportersPageHandler::class
],
'velunnarar'
],
],
'/supporters' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\Page\SupportersPageHandler::class
],
'supporters'
],
],
'/leit' => [
'GET' => [
[
Middleware\PrimaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\SearchPageHandler::class
],
'leit'
],
],
'/search' => [
'GET' => [
[
Middleware\SecondaryLanguageMiddleware::class,
Middleware\SessionMiddleware::class,
Middleware\MenuMiddleware::class,
Handler\SearchPageHandler::class
],
'search'
],
],
// - - - - - - - - - - - - - - - - - - - - - - - -
'/rss' => [
'GET' => [
Handler\Page\RssPageHandler::class,
'rss'
],
],
'/login' => [
'GET' => [
Handler\Login\LoginPageHandler::class,
'login',
],
'POST' => [
Handler\Login\LoginSubmitPageHandler::class,
'login-submit'
],
],
'/fb-login' => [
'GET' => [
Handler\Login\FbLoginSubmitPageHandler::class,
'fb-login-submit'
],
],
'/logout' => [
'GET' => [
Handler\Login\LogoutSubmitPageHandler::class,
'logout-submit'
],
],
'/img/{size}/{name}' => [
'GET' => [
Handler\Image\AssetPageHandler::class,
'asset'
],
],
'/image' => [
'POST' => [
[
Middleware\AuthenticationMiddleware::class,
Handler\Image\ImageSavePageHandler::class
],
'images-save'
],
],
//
//
//
//
'/update' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\DashboardPageHandler::class
],
'update'
],
],
'/update/entry' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Entry\EntryCreatePageHandler::class
],
'create-entry'
],
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
BodyParamsMiddleware::class,
Middleware\AdditionalDatesMiddleware::class,
Handler\Entry\EntrySavePageHandler::class
],
'new-entry'
],
],
'/update/entry/{id}' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Entry\EntryUpdatePageHandler::class
],
'update-entry'
],
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
BodyParamsMiddleware::class,
Middleware\AdditionalDatesMiddleware::class,
Handler\Entry\EntrySavePageHandler::class
],
'save-entry'
],
],
'/delete/entry/{id}' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Entry\EntryDeletePageHandler::class
],
'delete-entry'
],
],
'/update/store' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Store\StoreCreatePageHandler::class
],
'create-store'
],
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
BodyParamsMiddleware::class,
Middleware\AdditionalDatesMiddleware::class,
Handler\Store\StoreSavePageHandler::class
],
'new-store'
],
],
'/update/store/{id}' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Store\StoreUpdatePageHandler::class
],
'update-store'
],
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
BodyParamsMiddleware::class,
Middleware\AdditionalDatesMiddleware::class,
Handler\Store\StoreSavePageHandler::class
],
'save-store'
],
],
'/delete/store/{id}' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Store\StoreDeletePageHandler::class
],
'delete-store'
],
],
'/update/author/{id}' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Author\AuthorUpdatePageHandler::class
],
'update-author'
],
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
BodyParamsMiddleware::class,
Middleware\AdditionalDatesMiddleware::class,
Handler\Author\AuthorSavePageHandler::class
],
'save-author'
],
],
'/update/author' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Author\AuthorCreatePageHandler::class
],
'create-author'
],
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
BodyParamsMiddleware::class,
Middleware\AdditionalDatesMiddleware::class,
Handler\Author\AuthorSavePageHandler::class
],
'new-author'
],
],
'/delete/author/{id}' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Author\AuthorDeletePageHandler::class
],
'delete-author'
],
],
'/update/page/{id}' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\Page\PageUpdatePageHandler::class
],
'update-page'
],
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
BodyParamsMiddleware::class,
Middleware\AdditionalDatesMiddleware::class,
Handler\Page\PageSavePageHandler::class
],
'new-page'
],
],
'/update/image/{id}' => [
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
BodyParamsMiddleware::class,
Handler\Image\ImageUpdatePageHandler::class
],
'update-image'
],
],
'/update/user' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\User\UsersPageHandler::class
],
'create-user'
],
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
BodyParamsMiddleware::class,
Middleware\AdditionalDatesMiddleware::class,
Handler\User\UsersCreatePageHandler::class
],
'new-user'
],
],
'/delete/user/{id}' => [
'GET' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdminMenuMiddleware::class,
Handler\User\UsersDeletePageHandler::class
],
'delete-user'
],
],
'/api/authors' => [
'POST' => [
[
Middleware\DetectLanguageMiddleware::class,
Middleware\AuthenticationMiddleware::class,
Middleware\AdditionalDatesMiddleware::class,
Handler\Api\AuthorSaveHandler::class
],
'api-authors-save'
]
],
'/api/authors/search' => [
'GET' => [
Handler\Api\AuthorsSearchHandler::class,
'author-search'
],
],
'/api/search' => [
'GET' => [
Handler\ApiSearchPageHandler::class,
'api-search'
],
],
];
| 28.244628 | 62 | 0.478991 |
8e6e0b7954dad646286291450f9849384e524478 | 478 | rb | Ruby | app/helpers/top_helper.rb | fuji-nakahara/genron-sf-app | fbc5184706ed90decf24fc54b9c43488c8f1c48f | [
"MIT"
] | null | null | null | app/helpers/top_helper.rb | fuji-nakahara/genron-sf-app | fbc5184706ed90decf24fc54b9c43488c8f1c48f | [
"MIT"
] | 16 | 2018-07-21T05:21:40.000Z | 2020-06-16T12:05:47.000Z | app/helpers/top_helper.rb | fuji-nakahara/genron-school-sf-app | fbc5184706ed90decf24fc54b9c43488c8f1c48f | [
"MIT"
] | null | null | null | module TopHelper
SubjectLabel = Struct.new(:theme, :text)
def subject_state_label(subject)
theme, text = case
when subject.comment_date&.>(Time.zone.today)
%w[primary 梗概提出]
when subject.work_comment_date&.>(Time.zone.today)
%w[success 実作提出]
else
%w[secondary 終了]
end
content_tag(:span, text, class: "badge badge-#{theme}")
end
end
| 29.875 | 68 | 0.527197 |
Subsets and Splits