identifier
stringlengths
42
383
collection
stringclasses
1 value
open_type
stringclasses
1 value
license
stringlengths
0
1.81k
date
float64
1.99k
2.02k
title
stringlengths
0
100
creator
stringlengths
1
39
language
stringclasses
157 values
language_type
stringclasses
2 values
word_count
int64
1
20k
token_count
int64
4
1.32M
text
stringlengths
5
1.53M
__index_level_0__
int64
0
57.5k
https://github.com/Shofiul-Alam/magento-app/blob/master/src/setup/src/Magento/Setup/Test/Unit/Model/Cron/JobFactoryTest.php
Github Open Source
Open Source
LicenseRef-scancode-unknown-license-reference, AFL-2.1, AFL-3.0, OSL-3.0, MIT
2,019
magento-app
Shofiul-Alam
PHP
Code
337
2,239
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Setup\Test\Unit\Model\Cron; use Magento\Backend\Console\Command\CacheDisableCommand; use Magento\Backend\Console\Command\CacheEnableCommand; use Magento\Setup\Console\Command\MaintenanceDisableCommand; use Magento\Setup\Console\Command\MaintenanceEnableCommand; use Magento\Setup\Model\Cron\JobFactory; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class JobFactoryTest extends \PHPUnit\Framework\TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\ObjectManagerInterface */ private $objectManager; /** * @var JobFactory */ private $jobFactory; public function setUp() { $serviceManager = $this->getMockForAbstractClass(\Zend\ServiceManager\ServiceLocatorInterface::class, [], '', false); $status = $this->createMock(\Magento\Setup\Model\Cron\Status::class); $status->expects($this->once())->method('getStatusFilePath')->willReturn('path_a'); $status->expects($this->once())->method('getLogFilePath')->willReturn('path_b'); $objectManagerProvider = $this->createMock(\Magento\Setup\Model\ObjectManagerProvider::class); $this->objectManager = $this->getMockForAbstractClass( \Magento\Framework\ObjectManagerInterface::class, [], '', false ); $objectManagerProvider->expects($this->atLeastOnce())->method('get')->willReturn($this->objectManager); $upgradeCommand = $this->createMock(\Magento\Setup\Console\Command\UpgradeCommand::class); $moduleUninstaller = $this->createMock(\Magento\Setup\Model\ModuleUninstaller::class); $moduleRegistryUninstaller = $this->createMock(\Magento\Setup\Model\ModuleRegistryUninstaller::class); $moduleEnabler = $this->createMock(\Magento\Setup\Console\Command\ModuleEnableCommand::class); $moduleDisabler = $this->createMock(\Magento\Setup\Console\Command\ModuleDisableCommand::class); $maintenanceDisabler = $this->createMock(MaintenanceDisableCommand::class); $maintenanceEnabler = $this->createMock(MaintenanceEnableCommand::class); $updater = $this->createMock(\Magento\Setup\Model\Updater::class); $queue = $this->createMock(\Magento\Setup\Model\Cron\Queue::class); $returnValueMap = [ [\Magento\Setup\Model\Updater::class, $updater], [\Magento\Setup\Model\Cron\Status::class, $status], [\Magento\Setup\Console\Command\UpgradeCommand::class, $upgradeCommand], [\Magento\Setup\Model\ObjectManagerProvider::class, $objectManagerProvider], [\Magento\Setup\Model\ModuleUninstaller::class, $moduleUninstaller], [\Magento\Setup\Model\ModuleRegistryUninstaller::class, $moduleRegistryUninstaller], [\Magento\Setup\Console\Command\ModuleDisableCommand::class, $moduleDisabler], [\Magento\Setup\Console\Command\ModuleEnableCommand::class, $moduleEnabler], [MaintenanceDisableCommand::class, $maintenanceDisabler], [MaintenanceEnableCommand::class, $maintenanceEnabler], [\Magento\Setup\Model\Cron\Queue::class, $queue] ]; $serviceManager->expects($this->atLeastOnce()) ->method('get') ->will($this->returnValueMap($returnValueMap)); $this->jobFactory = new JobFactory($serviceManager); } public function testUpgrade() { $this->assertInstanceOf( \Magento\Setup\Model\Cron\AbstractJob::class, $this->jobFactory->create('setup:upgrade', []) ); } public function testRollback() { $valueMap = [ [ \Magento\Framework\App\State\CleanupFiles::class, $this->createMock(\Magento\Framework\App\State\CleanupFiles::class) ], [ \Magento\Framework\App\Cache::class, $this->createMock(\Magento\Framework\App\Cache::class) ], [ \Magento\Framework\Setup\BackupRollbackFactory::class, $this->createMock(\Magento\Framework\Setup\BackupRollbackFactory::class) ], ]; $this->objectManager->expects($this->any()) ->method('get') ->will($this->returnValueMap($valueMap)); $this->assertInstanceOf( \Magento\Setup\Model\Cron\AbstractJob::class, $this->jobFactory->create('setup:rollback', []) ); } public function testComponentUninstall() { $valueMap = [ [ \Magento\Framework\Module\PackageInfoFactory::class, $this->createMock(\Magento\Framework\Module\PackageInfoFactory::class) ], [ \Magento\Framework\Composer\ComposerInformation::class, $this->createMock(\Magento\Framework\Composer\ComposerInformation::class) ], [ \Magento\Theme\Model\Theme\ThemeUninstaller::class, $this->createMock(\Magento\Theme\Model\Theme\ThemeUninstaller::class) ], [ \Magento\Theme\Model\Theme\ThemePackageInfo::class, $this->createMock(\Magento\Theme\Model\Theme\ThemePackageInfo::class) ], ]; $this->objectManager->expects($this->any()) ->method('get') ->will($this->returnValueMap($valueMap)); $this->assertInstanceOf( \Magento\Setup\Model\Cron\JobComponentUninstall::class, $this->jobFactory->create('setup:component:uninstall', []) ); } /** * @expectedException \RuntimeException * @expectedExceptionMessage job is not supported */ public function testCreateUnknownJob() { $this->jobFactory->create('unknown', []); } public function testCacheEnable() { $valueMap = [ [ CacheEnableCommand::class, $this->getMockBuilder(CacheEnableCommand::class) ->disableOriginalConstructor() ->getMock() ] ]; $this->objectManager->expects($this->any()) ->method('get') ->will($this->returnValueMap($valueMap)); $this->assertInstanceOf( \Magento\Setup\Model\Cron\JobSetCache::class, $this->jobFactory->create('setup:cache:enable', []) ); } public function testCacheDisable() { $valueMap = [ [ \Magento\Backend\Console\Command\CacheDisableCommand::class, $this->getMockBuilder(CacheDisableCommand::class) ->disableOriginalConstructor() ->getMock() ] ]; $this->objectManager->expects($this->any())->method('get')->will($this->returnValueMap($valueMap)); $this->assertInstanceOf( \Magento\Setup\Model\Cron\JobSetCache::class, $this->jobFactory->create('setup:cache:disable', []) ); } public function testMaintenanceModeEnable() { $this->assertInstanceOf( \Magento\Setup\Model\Cron\JobSetMaintenanceMode::class, $this->jobFactory->create(JobFactory::JOB_MAINTENANCE_MODE_ENABLE, []) ); } public function testMaintenanceModeDisable() { $this->assertInstanceOf( \Magento\Setup\Model\Cron\JobSetMaintenanceMode::class, $this->jobFactory->create(JobFactory::JOB_MAINTENANCE_MODE_DISABLE, []) ); } } // functions to override native php functions namespace Magento\Setup\Model\Cron; /** * @return string */ function fopen() { return 'filestream'; } /** * @return bool */ function is_resource() { return true; } /** * @return string */ function get_resource_type() { return 'stream'; }
6,911
https://github.com/sigemp/domino-ui/blob/master/domino-ui/src/main/java/org/dominokit/domino/ui/datatable/plugins/RowClickPlugin.java
Github Open Source
Open Source
Apache-2.0
2,019
domino-ui
sigemp
Java
Code
53
276
package org.dominokit.domino.ui.datatable.plugins; import org.dominokit.domino.ui.datatable.DataTable; import org.dominokit.domino.ui.datatable.TableRow; import org.dominokit.domino.ui.utils.DominoElement; import org.jboss.gwt.elemento.core.EventType; public class RowClickPlugin<T> implements DataTablePlugin<T> { private ClickHandler<T> handler; public RowClickPlugin(ClickHandler<T> handler) { this.handler = handler; } @Override public void onRowAdded(DataTable<T> dataTable, TableRow<T> tableRow) { DominoElement.of(tableRow.asElement()).styler(style -> style.setCursor("pointer")); tableRow.asElement().addEventListener(EventType.click.getName(), evt -> handler.onClick(tableRow)); } @FunctionalInterface public interface ClickHandler<T> { void onClick(TableRow<T> tableRow); } }
47,717
https://github.com/tootsweet/react_native_sdk/blob/master/test/lib/ios/AdjustSdkTest/ASTCommandListener.h
Github Open Source
Open Source
MIT
2,022
react_native_sdk
tootsweet
C
Code
37
100
// // ASTCommandListener.h // Adjust SDK Test // // Created by Abdullah Obaied (@obaied) on 20th February 2018. // Copyright © 2018 Adjust GmbH. All rights reserved. // #import <Foundation/Foundation.h> #import "ATLTestLibrary.h" @interface ASTCommandListener : NSObject<AdjustCommandDelegate> @end
11,400
https://github.com/EasyDynamics/oscal-rest-service/blob/master/oscal-object-service/src/main/java/com/easydynamics/oscal/service/RepositoryConfig.java
Github Open Source
Open Source
MIT
2,022
oscal-rest-service
EasyDynamics
Java
Code
21
85
package com.easydynamics.oscal.service; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; /** * Spring configuration class for repositories. */ @Configuration @ComponentScan("com.easydynamics.oscal.data") public class RepositoryConfig { }
21,269
https://github.com/Surya-98/Snapcuit/blob/master/NGSpice/ngspice-30/src/spicelib/devices/nbjt2/nbt2init.h
Github Open Source
Open Source
MIT
null
Snapcuit
Surya-98
C
Code
32
109
#ifndef _NBJT2INIT_H #define _NBJT2INIT_H extern IFparm NBJT2pTable[ ]; extern IFparm NBJT2mPTable[ ]; extern char *NBJT2names[ ]; extern int NBJT2pTSize; extern int NBJT2mPTSize; extern int NBJT2nSize; extern int NBJT2iSize; extern int NBJT2mSize; #endif
1,352
https://github.com/somushivam1991/Personal-Angular-Ui/blob/master/client/modules/shared/core/services/text-value-pair.service.ts
Github Open Source
Open Source
Apache-2.0
2,016
Personal-Angular-Ui
somushivam1991
TypeScript
Code
211
563
/// <reference path="../../../../../typings/lib.d.ts" /> /// <reference path="../../../../../typings/app.d.ts" /> namespace shared.services { export class TextValuePairService { /** * Gets the text of the text-value pair in a text-value pair array whose value is equal * to the specified value. * @param {TextValuePair<TValue>[]} The text-value pair array. * @param {value} The value to search for. * @returns {string} The text of the matched text-value pair or undefined if no match found. */ public getText<TValue>(pairs: TextValuePair<TValue>[], value: TValue): string { if (!pairs || pairs.length === 0) { return undefined; } for (let i: number = 0; i < pairs.length; i++) { if (pairs[i].value === value) { return pairs[i].text; } } return undefined; } public getAllTexts<TValue>(pairs: TextValuePair<TValue>[], values: TValue[]): string[] { if (!pairs || pairs.length === 0) { return []; } return pairs.reduce((output: string[], pair: TextValuePair<TValue>) => { if (values.some((val: TValue) => val === pair.value)) { output.push(pair.text); } return output; }, []); } public transformToPairs<T>(array: T[], valuePicker: (item: T) => string, textPicker?: (item: T) => string): TextPair[] { return (array || []).reduce((results: TextPair[], item: T) => { let value: string = valuePicker(item); let text: string = Boolean(textPicker) ? textPicker(item) : value; if (!results.some((pair: TextPair) => pair.value === value)) { results.push(<TextPair>{ text: text, value: value }); } return results; }, []); } } sharedModule.service('textValuePairService', TextValuePairService); }
5,577
https://github.com/tcdorg/sonarscratch-checker/blob/master/content/src/test/java/sonarscratch/checker/test/TestException.java
Github Open Source
Open Source
MIT
null
sonarscratch-checker
tcdorg
Java
Code
53
113
/** * sonarscratch.checker project * Copyright (c) tcdorg community. All rights reserved. * Licensed under the MIT License. See LICENSE.txt in the project root for license information. */ package sonarscratch.checker.test; public class TestException extends Exception { private static final long serialVersionUID = 1L; public TestException(String message, Throwable cause) { super(message, cause); } }
48,698
https://github.com/chrisrayrayne/yatzy/blob/master/src/ch/chrisrayrayne/game/Yathzee.java
Github Open Source
Open Source
Apache-2.0
null
yatzy
chrisrayrayne
Java
Code
21
74
package ch.chrisrayrayne.game; public class Yathzee { public static void main(String[] args) { Game g = new BeginnerGame(); g.init(Game.RULESET_YATZHEE); g.play(); } }
20,913
https://github.com/EunoiaGames/Eunoia-Dev/blob/master/Eunoia-Engine/Res/Shaders/GLSL-450/3D/Deferred/BloomThreshold.glsl
Github Open Source
Open Source
Apache-2.0
null
Eunoia-Dev
EunoiaGames
GLSL
Code
106
300
#EU_Vertex #version 450 layout(location = 0) in vec2 Pos; void main() { gl_Position = vec4(Pos, 0.0, 1.0); } #EU_Fragment #version 450 layout (input_attachment_index = 0, set = 0, binding = 0) uniform subpassInput Input; layout(location = 0) out vec4 OutColor; layout(set = 1, binding = 0) uniform ThresholdBuffer { float Threshold; }; void main() { float Gamma = 2.2; vec4 Color = subpassLoad(Input); float Brightness = dot(Color.rgb, vec3(0.2126, 0.7152, 0.0722)); //Brightness = Brightness / (Brightness + 1.0); //Brightness = pow(Brightness, 1.0 / Gamma); vec4 O; if(Brightness > Threshold) { O = Color; } else { O = vec4(0.0, 0.0, 0.0, 1.0); } OutColor = O; }
28,922
https://github.com/simplerr/UtopianEngine/blob/master/source/utopian/core/ScriptExports.cpp
Github Open Source
Open Source
MIT
2,022
UtopianEngine
simplerr
C++
Code
240
1,159
#include "core/ScriptExports.h" #include "core/AssetLoader.h" #include "core/components/Actor.h" #include "core/components/CRenderable.h" #include "core/components/CTransform.h" #include "core/renderer/Renderer.h" #include "core/Log.h" #include "utility/Common.h" namespace Utopian { PerlinNoise<float> ScriptExports::mPerlinNoise; Terrain* ScriptExports::mTerrain; SharedPtr<LuaPlus::LuaFunction<float>> ScriptImports::get_terrain_height; void ScriptExports::Register() { LuaPlus::LuaObject globals = gLuaManager().GetGlobalVars(); globals.RegisterDirect("debug_print", &ScriptExports::DebugPrint); globals.RegisterDirect("add_asset", &ScriptExports::AddAsset); globals.RegisterDirect("add_instanced_asset", &ScriptExports::AddInstancedAsset); globals.RegisterDirect("build_instance_buffers", &ScriptExports::BuildInstanceBuffers); globals.RegisterDirect("clear_instance_groups", &ScriptExports::ClearInstanceGroups); globals.RegisterDirect("seed_noise", &ScriptExports::SeedNoise); globals.RegisterDirect("get_noise", &ScriptExports::GetNoise); globals.RegisterDirect("get_terrain_height", &ScriptExports::GetTerrainHeight); //globals.RegisterDirect("get_terrain_normal", &ScriptExports::GetTerrainNormal); } void ScriptExports::DebugPrint(const char* text) { UTO_LOG(text); } void ScriptExports::AddAsset(uint32_t assetId, float x, float y, float z, float rx, float ry, float rz, float scale) { SharedPtr<Actor> actor = Actor::Create("Lua asset"); CTransform* transform = actor->AddComponent<CTransform>(glm::vec3(x, y, z)); transform->AddRotation(glm::vec3(rx, ry, rz)); transform->SetScale(glm::vec3(scale)); CRenderable* renderable = actor->AddComponent<CRenderable>(); renderable->SetModel(gAssetLoader().LoadAsset(assetId)); } void ScriptExports::AddInstancedAsset(uint32_t assetId, float x, float y, float z, float rx, float ry, float rz, float scale, bool animated, bool castShadow) { gRenderer().AddInstancedAsset(assetId, glm::vec3(x, y, z), glm::vec3(rx, ry, rz), glm::vec3(scale), animated, castShadow); } void ScriptExports::BuildInstanceBuffers() { gRenderer().BuildAllInstances(); } void ScriptExports::ClearInstanceGroups() { gRenderer().ClearInstanceGroups(); } void ScriptExports::SeedNoise(uint32_t seed) { mPerlinNoise.Seed(seed); } float ScriptExports::GetNoise(float x, float y, float z) { return mPerlinNoise.Noise(x, y, z); } float ScriptExports::GetTerrainHeight(float x, float z) { return mTerrain->GetHeight(x, z); } //glm::vec3 ScriptExports::GetTerrainNormal(float x, float z) //{ // return mTerrain->GetNormal(x, z); //} void ScriptExports::SetTerrain(Terrain* terrain) { mTerrain = terrain; } void ScriptImports::Register() { LuaPlus::LuaObject object = gLuaManager().GetGlobalVars()["get_terrain_height"]; if (object.IsFunction()) { get_terrain_height = std::make_shared<LuaPlus::LuaFunction<float>>(object); } else { UTO_LOG("get_terrain_height() functin not found in Lua"); } } float ScriptImports::GetTerrainHeight(float x, float z) { // Note: Function from Lua is retrieved in Register() to speed it up float height = get_terrain_height.get()->operator()(x, z); return height; } }
31,907
https://github.com/newbeginningxzm/WeChatChoosen/blob/master/app/src/main/java/com/bupt/paragon/wechatchoosen/adapter/NewsListAdapter.java
Github Open Source
Open Source
Apache-2.0
null
WeChatChoosen
newbeginningxzm
Java
Code
51
221
package com.bupt.paragon.wechatchoosen.adapter; import android.content.Context; import com.bupt.paragon.wechatchoosen.model.News; import java.util.List; /** * Created by Paragon on 2016/5/28. */ public class NewsListAdapter<T> extends MultiItemCommonAdapter<T>{ private NewsConverter mConveter; public NewsListAdapter(Context context, List<T> datas, MultiItemTypeSupport<T> multiItemTypeSupport,DataConverter<T> converter){ super(context,datas,multiItemTypeSupport); this.mConveter= (NewsConverter) converter; mConveter.setContext(context); } @Override public void convert(ViewHolder holder, T t) { mConveter.convert(holder, (News) t); } }
45,661
https://github.com/dregnaught/brew-printer/blob/master/src/main/java/com/frank/brewprinter/controller/BrewsApi.java
Github Open Source
Open Source
MIT
2,021
brew-printer
dregnaught
Java
Code
168
786
package com.frank.brewprinter.controller; import java.awt.print.PrinterException; import java.util.List; import java.util.Optional; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.frank.brewprinter.LabelWriter; import com.frank.brewprinter.model.Brew; import com.frank.brewprinter.repository.BrewRepository; @RestController() @RequestMapping("/brews") public class BrewsApi { public BrewsApi(BrewRepository brewRepo, LabelWriter labelWriter) { super(); this.brewRepo = brewRepo; this.labelWriter = labelWriter; } private BrewRepository brewRepo; private LabelWriter labelWriter; @GetMapping public List<Brew> getBrews() { return brewRepo.findAll(); } @PutMapping @Transactional public Brew updateBrew(@RequestBody Brew brew) { return brewRepo.save(brew); } @PostMapping("/{id}") public Brew printBrewById(@PathVariable("id") String id) throws PrinterException { Optional<Brew> myBrew = brewRepo.findById(Integer.valueOf(id)); labelWriter.printLabel(myBrew.get().getName(), myBrew.get().getAbv()); return myBrew.get(); } // pre-populate if needed. // @PostConstruct // public void create() { // brewRepo.save(new Brew(1, "Thunderbolt IPA", "6.5")); // brewRepo.save(new Brew(2, "Straight River IPA", "6.3")); // brewRepo.save(new Brew(3, "Cinder Hill Cream Ale", "4.4")); // brewRepo.save(new Brew(4, "Cornell Scotch", "5.6")); // brewRepo.save(new Brew(5, "Emmett & Phyllis Amber", "5.0")); // brewRepo.save(new Brew(6, "Hope Chocolate Milk Stout", "4.1")); // brewRepo.save(new Brew(7, "Kaplan's Kolsch", "6.1")); // brewRepo.save(new Brew(8, "Sullivan Stout", "4.2")); // brewRepo.save(new Brew(9, "Rye Ale", "5.6")); // } }
18,419
https://github.com/zybbigpy/VaspCZ/blob/master/vtstscripts-939/neighbors.pl
Github Open Source
Open Source
MIT
2,022
VaspCZ
zybbigpy
Perl
Code
252
842
#!/usr/bin/env perl #;-*- Perl -*- # Calculates the distance, with periodic boundary conditions, # from a specific atom to all other atoms in the file. use FindBin qw($Bin); use lib "$Bin"; use Vasp; # variables needed by the script @args = @ARGV; @args==2 || die "usage: neighbor.pl <POSCAR filename> <central atom>\n"; # Open up and read the poscar file. $poscarfile = $args[0]; $central_atom = $args[1]; ($coordinates,$basis,$lattice,$num_atoms,$total_atoms,$selectiveflag,$selective) = read_poscar($poscarfile); # Calculate the distance from atom # $ARGV[1] to all other atoms and # sort them in ascending order. open OUT , ">out.tmp"; for ($i=0; $i<$total_atoms; $i++) { for ($j=0; $j<3; $j++) { $cart_coord->[0][$j] = $coordinates->[$i][$j]; $difference->[0][$j] = pbc($coordinates->[$central_atom-1][$j]-$coordinates->[$i][$j]); } $difference = dirkar($difference,$basis,$lattice,"1"); $mag_difference = magnitude($difference,"1"); $cart_coord = dirkar($cart_coord,$basis,$lattice,"1"); printf OUT "%4d %13.7f %13.7f %13.7f ... %13.7f\n",$i+1, $cart_coord->[0][0],$cart_coord->[0][1],$cart_coord->[0][2],$mag_difference; } close OUT; # Here we get the distances and index them. open IN , "out.tmp" ; $i = 0 ; while ($line=<IN>) { $file .= $line; chomp($line); $line =~ s/^\s+//g; @line = split /\s+/,$line; $d[$i] = $line[5]; $indx[$i] = $i; $i++; } close IN; unlink "out.tmp"; # Sort with selection sort. for ($i=0; $i<$total_atoms; $i++) { $iptr = $i; for ($j=$i+1; $j<$total_atoms; $j++) { if($d[$j] < $d[$iptr]) { $iptr = $j; } } if ($i != $iptr) { $tmp = $d[$i]; $d[$i] = $d[$iptr]; $d[$iptr] = $tmp; $tmp = $indx[$i]; $indx[$i] = $indx[$iptr]; $indx[$iptr] = $tmp; } } # Print out the sorted data. open OUT, ">neighdist.dat"; @file = split /\n/ , $file; for ($i=0; $i<$total_atoms; $i++) { print OUT $i," ",$file[$indx[$i]],"\n"; } close OUT;
20,007
https://github.com/alessandrofrancesconi/ebl/blob/master/ebl/core/js_src/state/state.js
Github Open Source
Open Source
MIT
2,018
ebl
alessandrofrancesconi
JavaScript
Code
134
342
// These two object contain information about the state of Ebl var GlobalState = Base.extend({ constructor: function() { this.isAdmin = false; this.authToken = null; this.docTitle = null; this.container = null; // default config this.config = { template: 'default', language: 'en', postsPerPage: 5, pageTitleFormat: "{ebl_title} | {doc_title}", // callbacks onBlogLoaded: null, onPostOpened: null, onPageChanged: null }; } }); var LocalState = Base.extend({ constructor: function() { this.page = 0; this.post = null; this.editors = null; } }); var PostStatus = { NEW: 0, DRAFT: 1, PUBLISHED: 2, parse: function (s) { if (s.toLowerCase() == "new") return 0; if (s.toLowerCase() == "draft") return 1; if (s.toLowerCase() == "published") return 2; return null; } }; var gState = new GlobalState(); // state shared among the entire session var lState = new LocalState(); // state of the current view
34,229
https://github.com/LoongYou/Wanda/blob/master/com4j-20120426-2/samples/excel/build/src/office/PickerResult.java
Github Open Source
Open Source
BSD-2-Clause
2,021
Wanda
LoongYou
Java
Code
532
1,512
package office ; import com4j.*; @IID("{000C03E4-0000-0000-C000-000000000046}") public interface PickerResult extends office._IMsoDispObj { // Methods: /** * <p> * Getter method for the COM property "Id" * </p> * @return Returns a value of type java.lang.String */ @DISPID(1) //= 0x1. The runtime will prefer the VTID if present @VTID(9) java.lang.String getId(); /** * <p> * Getter method for the COM property "DisplayName" * </p> * @return Returns a value of type java.lang.String */ @DISPID(2) //= 0x2. The runtime will prefer the VTID if present @VTID(10) java.lang.String getDisplayName(); /** * <p> * Setter method for the COM property "DisplayName" * </p> * @param displayName Mandatory java.lang.String parameter. */ @DISPID(2) //= 0x2. The runtime will prefer the VTID if present @VTID(11) void setDisplayName( java.lang.String displayName); /** * <p> * Getter method for the COM property "Type" * </p> * @return Returns a value of type java.lang.String */ @DISPID(3) //= 0x3. The runtime will prefer the VTID if present @VTID(12) java.lang.String getType(); /** * <p> * Setter method for the COM property "Type" * </p> * @param type Mandatory java.lang.String parameter. */ @DISPID(3) //= 0x3. The runtime will prefer the VTID if present @VTID(13) void setType( java.lang.String type); /** * <p> * Getter method for the COM property "SIPId" * </p> * @return Returns a value of type java.lang.String */ @DISPID(4) //= 0x4. The runtime will prefer the VTID if present @VTID(14) java.lang.String getSIPId(); /** * <p> * Setter method for the COM property "SIPId" * </p> * @param sipId Mandatory java.lang.String parameter. */ @DISPID(4) //= 0x4. The runtime will prefer the VTID if present @VTID(15) void setSIPId( java.lang.String sipId); /** * <p> * Getter method for the COM property "ItemData" * </p> * @return Returns a value of type java.lang.Object */ @DISPID(5) //= 0x5. The runtime will prefer the VTID if present @VTID(16) @ReturnValue(type=NativeType.VARIANT) java.lang.Object getItemData(); /** * <p> * Setter method for the COM property "ItemData" * </p> * @param itemData Mandatory java.lang.Object parameter. */ @DISPID(5) //= 0x5. The runtime will prefer the VTID if present @VTID(17) void setItemData( @MarshalAs(NativeType.VARIANT) java.lang.Object itemData); /** * <p> * Getter method for the COM property "SubItems" * </p> * @return Returns a value of type java.lang.Object */ @DISPID(6) //= 0x6. The runtime will prefer the VTID if present @VTID(18) @ReturnValue(type=NativeType.VARIANT) java.lang.Object getSubItems(); /** * <p> * Setter method for the COM property "SubItems" * </p> * @param subItems Mandatory java.lang.Object parameter. */ @DISPID(6) //= 0x6. The runtime will prefer the VTID if present @VTID(19) void setSubItems( @MarshalAs(NativeType.VARIANT) java.lang.Object subItems); /** * <p> * Getter method for the COM property "DuplicateResults" * </p> * @return Returns a value of type java.lang.Object */ @DISPID(7) //= 0x7. The runtime will prefer the VTID if present @VTID(20) @ReturnValue(type=NativeType.VARIANT) java.lang.Object getDuplicateResults(); /** * <p> * Getter method for the COM property "Fields" * </p> * @return Returns a value of type office.PickerFields */ @DISPID(8) //= 0x8. The runtime will prefer the VTID if present @VTID(21) office.PickerFields getFields(); @VTID(21) @ReturnValue(defaultPropertyThrough={office.PickerFields.class}) office.PickerField getFields( int index); /** * <p> * Setter method for the COM property "Fields" * </p> * @param fields Mandatory office.PickerFields parameter. */ @DISPID(8) //= 0x8. The runtime will prefer the VTID if present @VTID(22) void setFields( office.PickerFields fields); // Properties: }
19,645
https://github.com/gbif/portal16/blob/master/app/controllers/sitemaps/pager.js
Github Open Source
Open Source
CC-BY-3.0, Apache-2.0
2,023
portal16
gbif
JavaScript
Code
216
701
'use strict'; let apiConfig = rootRequire('app/models/gbifdata/apiConfig'), querystring = require('querystring'), request = rootRequire('app/helpers/request'), _ = require('lodash'); module.exports = { installation: {intervals: getInstallationIntervals, list: getInstallationList}, dataset: {intervals: getDatasetIntervals, list: getDatasetList}, node: {intervals: getNodeIntervals, list: getNodeList}, network: {intervals: getNetworkIntervals, list: getNetworkList}, publisher: {intervals: getPublisherIntervals, list: getPublisherList} }; function getDatasetIntervals() { return getIntervals(apiConfig.datasetSearch.url, {}); } function getDatasetList(query) { return getList(apiConfig.datasetSearch.url, query); } function getPublisherIntervals() { return getIntervals(apiConfig.publisher.url, {isEndorsed: true}); } function getPublisherList(query) { let q = _.assign({isEndorsed: true}, query); return getList(apiConfig.publisher.url, q); } function getInstallationIntervals() { return getIntervals(apiConfig.installation.url, {}); } function getInstallationList(query) { return getList(apiConfig.installation.url, query); } function getNetworkIntervals() { return getIntervals(apiConfig.network.url, {}); } function getNetworkList(query) { return getList(apiConfig.network.url, query); } function getNodeIntervals() { return getIntervals(apiConfig.node.url, {}); } function getNodeList(query) { return getList(apiConfig.node.url, query); } async function getIntervals(url, query, limit) { limit = limit || 1000; let options = { url: url + '?' + querystring.stringify(query), method: 'GET', fullResponse: true, json: true }; let response = await request(options); if (response.statusCode !== 200) { throw response; } let ranges = _.range(0, response.body.count, limit); return ranges.map(function(e) { return {limit: limit, offset: e}; }); } async function getList(url, query) { let options = { url: url + '?' + querystring.stringify(query), method: 'GET', fullResponse: true, json: true }; let response = await request(options); if (response.statusCode !== 200) { throw response; } return response.body; }
7,130
https://github.com/StefanV-Neurony/first-puppy/blob/master/resources/views/despre.blade.php
Github Open Source
Open Source
MIT
null
first-puppy
StefanV-Neurony
PHP
Code
345
1,024
@extends('layouts.app') @section('content') <div class="about-section"> <h1>Despre noi</h1> <p> Drumul acesta frumos pe de o parte, dar foarte greu pe de alta parte a debutat in momentul cand am adoptat un catel de pe internet pe nume Leon. La scurt timp, am gasit in fata blocului, o mamica cu 4 pui. Ciudat, pana atunci nu "ii vazusem pe strazi", cand si cand mai duceam mancare in fata blocului stiind ca sunt animale pe strada, dar fara sa "le vedem, sa le cunoastem si sa le simtim". Atunci s-a intamplat un declic ... catelul nostru proaspat adoptat fusese si el pe strada precum cei 4 catei din fata blocului ... nu am stat mult pe ganduri, i-am luat de acolo si le-am gasit familii, unul dintre ei ramanand la noi, iar pe pisica am sterilizat-o... bucurie mare ca scapasem de problema, doar ca socoteala de acasa nu se potriveste cu cea din targ. La scurt timp a aparut un alt pui si apoi altul si altul, apoi am descoperit cateii... Erau si ai nimanui... nici pe ei "nu-i mai vazusem" pana atunci. O data constientizata problema, durerea si suferinta lor, nu ne-am mai oprit, unul si inca unul... ajungand sa avem constant in grija in jur de 115 animalute cu eforturi, sacrificii, costuri lunare mult peste ce putem duce noi. O vorba spune ca inapoi nu te mai poti intoarce, deci mergem inainte, dar avem nevoie de sustinere ca sa putem continua misiunea. Orice donatie poate face la un moment dat diferenta intre viata si moartea. Fiti alaturi de noi, ajutati-ne pt a putea ajuta animalele nimanui. Multumim!​​ </p> </div> <h2 style="text-align:center">Echipa noastra</h2> <div class="row-about"> <div class="column-about"> <div class="card"> <img src="/w3images/team1.jpg" alt="Stefan" style="width:100%"> <div class="container-about"> <h2>Stefan Alexandru</h2> <p class="title-about">CEO & Fondator</p> <p>stefanalexandru@firstpuppy.com</p> <a href="{{route('contact.create')}}"><p><button class="button-about">Contact</button></p></a> </div> </div> </div> <div class="column-about"> <div class="card"> <img src="/w3images/team2.jpg" alt="Eva" style="width:100%"> <div class="container-about"> <h2>Eva Zamfir</h2> <p class="title-about">Director admitere animale</p> <p>evazamfir@firstpuppy.com</p> <a href="{{route('contact.create')}}"><p><button class="button-about">Contact</button></p></a> </div> </div> </div> <div class="column-about"> <div class="card"> <img src="/w3images/team3.jpg" alt="Robert" style="width:100%"> <div class="container-about"> <h2>Robert Matei</h2> <p class="title-about">Director departament ingrijire medicala animale</p> <p>robertmatei@firstpuppy.com</p> <a href="{{route('contact.create')}}"><p><button class="button-about">Contact</button></p></a> </div> </div> </div> </div> @endsection
745
https://github.com/Irsalhamdi/vocasia-web/blob/master/app/Models/CommentModel.php
Github Open Source
Open Source
MIT
null
vocasia-web
Irsalhamdi
PHP
Code
150
483
<?php namespace App\Models; use CodeIgniter\Model; class CommentModel extends Model { protected $DBGroup = 'default'; protected $table = 'comment'; protected $primaryKey = 'id'; protected $useAutoIncrement = true; protected $insertID = 0; protected $returnType = 'array'; protected $useSoftDeletes = false; protected $protectFields = true; protected $allowedFields = ['body','user_id','commentable_id','commentable_type','date_added','last_modified']; // Dates protected $useTimestamps = true; protected $dateFormat = 'int'; protected $createdField = 'date_added'; protected $updatedField = 'last_modified'; protected $deletedField = 'deleted_at'; // Validation protected $validationRules = [ 'user_id' => 'required' ]; protected $validationMessages = []; protected $skipValidation = false; protected $cleanValidationRules = true; // Callbacks protected $allowCallbacks = true; protected $beforeInsert = []; protected $afterInsert = []; protected $beforeUpdate = []; protected $afterUpdate = []; protected $beforeFind = []; protected $afterFind = []; protected $beforeDelete = []; protected $afterDelete = []; public function get_comment_by_course($id_course = null) { return $this->db->table('comment a')->select("a.*,b.first_name, b.last_name, c.title")->join('users b', 'b.id = a.user_id')->join('courses c', 'c.id = a.commentable_id')->where('a.commentable_id', $id_course)->get()->getResult(); } }
25,740
https://github.com/Quansight/graphql-schema-org/blob/master/src/targetUrl.js
Github Open Source
Open Source
BSD-3-Clause
2,021
graphql-schema-org
Quansight
JavaScript
Code
24
53
import datatypes from './datatype' export default { type: datatypes['Url'], description: 'The URL of a node in an established educational framework.', name: 'Target Url', }
22,743
https://github.com/mehdi2960/Digika/blob/master/resources/views/livewire/home/product/buybox/review.blade.php
Github Open Source
Open Source
MIT
null
Digika
mehdi2960
PHP
Code
783
3,766
<div class="c-content-expert js-product-tab-content is-active" id="expert_review" data-method="expert_review"> <article> <div class="o-box__header"><span class="o-box__title">نقد و بررسی تخصصی</span><span class="o-box__header-desc">Nokia 3310 (2017) Dual SIM Mobile Phone</span> </div> <div class="c-content-short__review"><p>استفاده از قابلیت­‌هایی جدید و منحصربه‌فرد برای فروش محصولات را هر روز در تولید گوشی­‌های رنگارنگ بازار می­‌بینیم. اما نوکیا سعی کرده از مورد دیگری برای فروش بیشتر کمک بگیرد؛ تجربه و نوستالژی، امتیازهایی هستند که تنها شرکت‌هایی به بزرگی نوکیا می­‌توانند از آن‌ها برای فروش بیشتر استفاده کنند. استفاده از نام و طراحی محصولی که بار اول در سال 2000 روانه­‌ی بازار شده، هنوز بعد از 17 سال برای طرف­داران این برند فنلاندی جذاب است. گوشی «نوکیا 3310 مدل 2017» (Nokia 3310 (2017) Dual SIM) دقیقا همان محصولی است که می­‌خواهد با استفاده از همین فرمول، فروش بالایی را در بازار تجربه کند.</p></div> <div class="c-content-expert__articles js-product-review-container"> <section class="c-content-expert__article js-expert-article is-active"><h3 class="c-content-expert__title">به خدمت گرفتن نوستالژی برای تصاحب بازار</h3> <div class="c-content-expert__text c-content-expert__text--center"> <div class="c-content-expert__img c-content-expert__img--center"> <img data-src="https://dkstatics-public.digikala.com/digikala-reviews/1407467.jpg?x-oss-process=image/resize,w_960/quality,q_70" src="https://dkstatics-public.digikala.com/digikala-reviews/1407467.jpg?x-oss-process=image/resize,w_960/quality,q_70" loading="lazy"></div> </div> <div class="c-content-expert__text"><p></p> <p>در مقایسه با چیزی که در سال 2000 دیده بودیم، گوشی جدید 3310 باریک‌­تر و ظریف‌­تر طراحی‌ شده است؛ حتی شاید بتوان گفت یکی از باریک‌­ترین گوشی‌­های همراه با صفحه­‌کلید بازار است. نوکیا سعی کرده با حفظ همان عناصر قدیمی، طراحی 3310 جدید را تا جای ممکن به طراحی­‌های امروزی نزدیک کند. استفاده از رنگ­‌های شاد و متنوع، نمایشگر بزرگ‌­تر، کلید­هایی که راحت­‌تر می‌­توان با آن‌­ها تایپ کرد، کاهش ابعاد و بهبود کارایی مواردی هستند که گوشی 3310 جدید به‌راحتی در نگاه اول به شما منتقل می‌­کند.</p> <p></p></div> <div class="c-content-expert__text c-content-expert__text--center"> <div class="c-content-expert__img c-content-expert__img--center"> <img data-src="https://dkstatics-public.digikala.com/digikala-reviews/1401005.jpg?x-oss-process=image/resize,w_960/quality,q_70" src="https://dkstatics-public.digikala.com/digikala-reviews/1401005.jpg?x-oss-process=image/resize,w_960/quality,q_70" loading="lazy"></div> </div> <div class="c-content-expert__text"><p></p> <p>کلید­ها نسب به قبل، در زمان فشردن صدای کمتری تولید می­‌کنند، فاصله‌ آن­‌ها از هم بیشتر شده و همچنین نوع قرار گرفتن­شان هم به تایپ راحت کمک می­‌کند. طراحی مدرن گوشی را می‌­توان از لبه‌های گرد، کلید­هایی با ارگونومی بهتر، احساس خوب دردست‌گرفتن گوشی، جنس متمایز پلاستیک استفاده‌شده برای قسمت­‌های بیرونی و همچنین وزن سبک آن حس کرد.</p> <p></p></div> <div class="c-content-expert__text c-content-expert__text--center"> <div class="c-content-expert__img c-content-expert__img--center"> <img data-src="https://dkstatics-public.digikala.com/digikala-reviews/1425538.jpg?x-oss-process=image/resize,w_960/quality,q_70" src="https://dkstatics-public.digikala.com/digikala-reviews/1425538.jpg?x-oss-process=image/resize,w_960/quality,q_70" loading="lazy"></div> </div> <div class="c-content-expert__text"><p></p> <p>همه‌­ی این تغییرات خوب به دردست‌گرفتن ساده‌­ی گوشی و کارکردن راحت با آن، حمل بدون­ دردسرش در کیف یا جیب و همچنین کیفیت بالای مکالمه کمک کرده و این گوشی زیبا را بیشتر به چیزی که مطلوب خریداران باشد، تبدیل کرده است.</p> <p></p></div> </section> <section class="c-content-expert__article js-expert-article is-active"><h3 class="c-content-expert__title">کارایی کلی</h3> <div class="c-content-expert__text"><p></p> <p>به لطف کلید­های نرم که فاصله‌­ی مناسبی هم دارند، کیفیت و سرعت تایپ با 3310 جدید بالا رفته است؛ روی کلید­های این گوشی حروف فارسی حک‌ شده است و این کمک می­‌کند تا به­‌راحتی با آن فارسی تایپ کنید. حتی می‌­توانید از منوی فارسی استفاده کنید؛ مشکلی که برطرف‌شدن آن برای کسانی که با این زبان مشکل دارند، خبری خوبی است. قراردادن برنامه­‌هایی مثل آب­و­هوا، پخش‌­کننده موزیک و ویدئو، بازی‌­های پیش­‌فرض، مرورگر و همچنین رادیو به کاربر این اطمینان را می­‌دهد که با خرید 3310 جدید، چیزی بیشتر از یک موبایل معمولی را به دست گرفته است که می‌­تواند با آن از تمام فایل­‌های مولتی­‌مدیا استفاده کند.</p> <p></p></div> <div class="c-content-expert__blockquote"><p>تماس تلفنی و ارسال پیامک تنها چیزی است که خریداران گوشی‌های دارای صفحه‌کلید انتظارش را دارند. نوکیا 3310 جدید نه‌تنها از پس انجام‌دادن این کارها به‌خوبی برمی‌آید؛ بلکه با آن می‌توان صفحات وب را مرور کرد، بازی کرد، موزیک گوش داد و از همه مهم‌تر حتی برنامه یا بازی‌هایی را که دوست دارید، دانلود کنید و از آن لذت ببرید. </p></div> <div class="c-content-expert__text c-content-expert__text--center"> <div class="c-content-expert__img c-content-expert__img--center"> <img data-src="https://dkstatics-public.digikala.com/digikala-reviews/1392014.jpg?x-oss-process=image/resize,w_960/quality,q_70" src="https://dkstatics-public.digikala.com/digikala-reviews/1392014.jpg?x-oss-process=image/resize,w_960/quality,q_70" loading="lazy"></div> </div> </section> <section class="c-content-expert__article js-expert-article is-active"><h3 class="c-content-expert__title">نمایشگر</h3> <div class="c-content-expert__text"><p></p> <p>استفاده از نمایشگر بزرگ در 3310 جدید شاید برای کسانی که از گوشی­‌های هوشمند با نمایشگرهای بزرگ استفاده می­‌کنند، به‌­اندازه­‌ی کافی جذاب نباشد؛ اما باعث خوشحالی کسانی می­‌شود که قبلا از گوشی‌های دارای صفحه­‌کلید استفاده کرده­‌اند. نمایشگری 2.4اینچی که رزولوشن مطلوبی دارد و رنگی است، برای 3310 نسخه‌­ی 2017 در نظر گرفته‌ شده تا کاربر بتواند تعامل خوبی با صفحات وب، فیلم و بازی­‌ها داشته باشد.</p> <p></p></div> <div class="c-content-expert__text c-content-expert__text--center"> <div class="c-content-expert__img c-content-expert__img--center"> <img data-src="https://dkstatics-public.digikala.com/digikala-reviews/1371560.jpg?x-oss-process=image/resize,w_960/quality,q_70" src="https://dkstatics-public.digikala.com/digikala-reviews/1371560.jpg?x-oss-process=image/resize,w_960/quality,q_70" loading="lazy"></div> </div> <div class="c-content-expert__blockquote"><p>2</p></div> <div class="c-content-expert__text"><p></p> <p>این نمایشگر برای هر چیزی که از 3310 جدید انتظار دارید، کافی به نظر می‌­رسد و کاربر را در هر شرایطی متقاعد می­‌کند.</p> <p></p></div> </section> <section class="c-content-expert__article js-expert-article is-active"><h3 class="c-content-expert__title">قابلیت‌ها</h3> <div class="c-content-expert__text c-content-expert__text--center"> <div class="c-content-expert__img c-content-expert__img--center"> <img data-src="https://dkstatics-public.digikala.com/digikala-reviews/1380734.jpg?x-oss-process=image/resize,w_960/quality,q_70" src="https://dkstatics-public.digikala.com/digikala-reviews/1380734.jpg?x-oss-process=image/resize,w_960/quality,q_70" loading="lazy"></div> </div> <div class="c-content-expert__text"><p></p> <p>این تمام چیزی نیست که 3310 جدید با خود همراه آورده است؛ بلکه نوکیا سعی کرده تا جای ممکن به این گوشی ساده، قابلیت اضافه کند. استفاده از دوربینی با سنسور 2 مگاپیکسل همراه با فلش روی قاب پشتی به کاربر اطمینان می‌­دهد که می‌تواند عکس‌­هایی نه­‌چندان باکیفیت اما مناسب را ثبت کند؛ همچنین قراردادن جک 3.5میلی­‌متری صدا و اسپیکری قدرتمند همه به برتری این گوشی در مقایسه با سایر گوشی­‌های هم­رده­‌اش اشاره دارند.</p> <p></p></div> </section> <a class="o-btn o-btn--link-blue-sm o-btn--l-expand-more o-btn--no-x-padding js-open-product-expert"> نمایش کامل نقد و بررسی تخصصی </a></div> </article> </div>
5,996
https://github.com/newlysoft/mt0-oauth2/blob/master/src/main/java/com/hw/aggregate/user/AppBizUserApplicationService.java
Github Open Source
Open Source
Apache-2.0
2,020
mt0-oauth2
newlysoft
Java
Code
182
919
package com.hw.aggregate.user; import com.hw.aggregate.pending_user.AppPendingUserApplicationService; import com.hw.aggregate.user.command.AppCreateBizUserCommand; import com.hw.aggregate.user.command.AppForgetBizUserPasswordCommand; import com.hw.aggregate.user.command.AppResetBizUserPasswordCommand; import com.hw.aggregate.user.model.BizUser; import com.hw.aggregate.user.representation.AppBizUserCardRep; import com.hw.aggregate.user.representation.AppBizUserRep; import com.hw.shared.rest.RoleBasedRestfulService; import com.hw.shared.rest.VoidTypedClass; import com.hw.shared.sql.RestfulQueryRegistry; import com.hw.shared.sql.SumPagedRep; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import java.util.Map; @Slf4j @Service public class AppBizUserApplicationService extends RoleBasedRestfulService<BizUser, AppBizUserCardRep, AppBizUserRep, VoidTypedClass> implements UserDetailsService { { entityClass = BizUser.class; role = RestfulQueryRegistry.RoleEnum.APP; } @Autowired private BCryptPasswordEncoder encoder; @Autowired private RevokeBizUserTokenService tokenRevocationService; @Autowired private PwdResetEmailService emailService; @Autowired private AppPendingUserApplicationService pendingUserApplicationService; @Override public BizUser replaceEntity(BizUser bizUser, Object command) { bizUser.replace(command, emailService, tokenRevocationService, encoder); return bizUser; } @Override public AppBizUserCardRep getEntitySumRepresentation(BizUser bizUser) { return new AppBizUserCardRep(bizUser); } @Override public AppBizUserRep getEntityRepresentation(BizUser bizUser) { return new AppBizUserRep(bizUser); } public void sendForgetPassword(AppForgetBizUserPasswordCommand command, String changeId) { BizUser.createForgetPwdToken(command, this, changeId); } public void resetPassword(AppResetBizUserPasswordCommand command, String changeId) { BizUser.resetPwd(command, this, changeId); } @Override protected BizUser createEntity(long id, Object command) { return BizUser.create(id, (AppCreateBizUserCommand) command, encoder, pendingUserApplicationService, this); } @Override public UserDetails loadUserByUsername(String usernameOrId) { try { return readById(Long.parseLong(usernameOrId)); } catch (NumberFormatException ex) { SumPagedRep<AppBizUserCardRep> appBizUserCardRepSumPagedRep = readByQuery("email:" + usernameOrId, null, null); if (appBizUserCardRepSumPagedRep.getData().isEmpty()) return null; return readById(appBizUserCardRepSumPagedRep.getData().get(0).getId()); } } }
31,235
https://github.com/positive-js/tslint-config/blob/master/src/walker.ts
Github Open Source
Open Source
MIT
2,021
tslint-config
positive-js
TypeScript
Code
97
320
import * as Lint from 'tslint'; import * as ts from 'typescript'; export abstract class AbstractReturnStatementWalker<T> extends Lint.AbstractWalker<T> { public walk(sourceFile: ts.SourceFile) { const cb = (node: ts.Node): void => { if (node.kind === ts.SyntaxKind.ReturnStatement) { this._checkReturnStatement(<ts.ReturnStatement> node); } return ts.forEachChild(node, cb); }; return ts.forEachChild(sourceFile, cb); } /* tslint:disable:function-name */ protected abstract _checkReturnStatement(node: ts.ReturnStatement): void; } export abstract class AbstractIfStatementWalker<T> extends Lint.AbstractWalker<T> { public walk(sourceFile: ts.SourceFile) { const cb = (node: ts.Node): void => { if (node.kind === ts.SyntaxKind.IfStatement) { this._checkIfStatement(<ts.IfStatement> node); } return ts.forEachChild(node, cb); }; return ts.forEachChild(sourceFile, cb); } protected abstract _checkIfStatement(node: ts.IfStatement): void; }
39,075
https://github.com/honeyimholm/three.js/blob/master/src/core/UniformsGroup.d.ts
Github Open Source
Open Source
MIT
2,022
three.js
honeyimholm
TypeScript
Code
50
124
import { EventDispatcher } from './EventDispatcher'; import { Uniform } from './Uniform'; export class UniformsGroup extends EventDispatcher { constructor(); name: string; dynamic: boolean; uniforms: Uniform[]; add( uniform: Uniform ): this; clone(): UniformsGroup; copy( source: UniformsGroup ): this; dispose(): this; remove( uniform: Uniform ): this; setName( name: string ): this; }
25,102
https://github.com/ResurrectionRemix/Resurrection_packages_apps_Settings/blob/master/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetail.java
Github Open Source
Open Source
Apache-2.0
2,021
Resurrection_packages_apps_Settings
ResurrectionRemix
Java
Code
858
3,466
/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settings.fuelgauge; import android.annotation.UserIdInt; import android.app.Activity; import android.app.ActivityManager; import android.app.settings.SettingsEnums; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.BatteryStats; import android.os.Bundle; import android.os.UserHandle; import android.text.TextUtils; import android.util.Log; import android.view.View; import androidx.annotation.VisibleForTesting; import androidx.preference.Preference; import com.android.internal.os.BatterySipper; import com.android.internal.os.BatteryStatsHelper; import com.android.internal.util.ArrayUtils; import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settings.Utils; import com.android.settings.applications.appinfo.AppButtonsPreferenceController; import com.android.settings.applications.appinfo.ButtonActionDialogFragment; import com.android.settings.core.InstrumentedPreferenceFragment; import com.android.settings.core.SubSettingLauncher; import com.android.settings.dashboard.DashboardFragment; import com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController; import com.android.settings.fuelgauge.batterytip.tips.BatteryTip; import com.android.settings.widget.EntityHeaderController; import com.android.settingslib.applications.AppUtils; import com.android.settingslib.applications.ApplicationsState; import com.android.settingslib.core.AbstractPreferenceController; import com.android.settingslib.utils.StringUtil; import com.android.settingslib.widget.LayoutPreference; import java.util.ArrayList; import java.util.List; /** * Power usage detail fragment for each app, this fragment contains * * 1. Detail battery usage information for app(i.e. usage time, usage amount) * 2. Battery related controls for app(i.e uninstall, force stop) */ public class AdvancedPowerUsageDetail extends DashboardFragment implements ButtonActionDialogFragment.AppButtonsDialogListener, BatteryTipPreferenceController.BatteryTipListener { public static final String TAG = "AdvancedPowerDetail"; public static final String EXTRA_UID = "extra_uid"; public static final String EXTRA_PACKAGE_NAME = "extra_package_name"; public static final String EXTRA_FOREGROUND_TIME = "extra_foreground_time"; public static final String EXTRA_BACKGROUND_TIME = "extra_background_time"; public static final String EXTRA_LABEL = "extra_label"; public static final String EXTRA_ICON_ID = "extra_icon_id"; public static final String EXTRA_POWER_USAGE_PERCENT = "extra_power_usage_percent"; public static final String EXTRA_POWER_USAGE_AMOUNT = "extra_power_usage_amount"; private static final String KEY_PREF_FOREGROUND = "app_usage_foreground"; private static final String KEY_PREF_BACKGROUND = "app_usage_background"; private static final String KEY_PREF_HEADER = "header_view"; private static final int REQUEST_UNINSTALL = 0; private static final int REQUEST_REMOVE_DEVICE_ADMIN = 1; @VisibleForTesting LayoutPreference mHeaderPreference; @VisibleForTesting ApplicationsState mState; @VisibleForTesting ApplicationsState.AppEntry mAppEntry; @VisibleForTesting BatteryUtils mBatteryUtils; @VisibleForTesting Preference mForegroundPreference; @VisibleForTesting Preference mBackgroundPreference; private AppButtonsPreferenceController mAppButtonsPreferenceController; private BackgroundActivityPreferenceController mBackgroundActivityPreferenceController; private String mPackageName; @VisibleForTesting static void startBatteryDetailPage(Activity caller, BatteryUtils batteryUtils, InstrumentedPreferenceFragment fragment, BatteryStatsHelper helper, int which, BatteryEntry entry, String usagePercent) { // Initialize mStats if necessary. helper.getStats(); final Bundle args = new Bundle(); final BatterySipper sipper = entry.sipper; final BatteryStats.Uid uid = sipper.uidObj; final boolean isTypeApp = sipper.drainType == BatterySipper.DrainType.APP; final long foregroundTimeMs = isTypeApp ? batteryUtils.getProcessTimeMs( BatteryUtils.StatusType.FOREGROUND, uid, which) : sipper.usageTimeMs; final long backgroundTimeMs = isTypeApp ? batteryUtils.getProcessTimeMs( BatteryUtils.StatusType.BACKGROUND, uid, which) : 0; if (ArrayUtils.isEmpty(sipper.mPackages)) { // populate data for system app args.putString(EXTRA_LABEL, entry.getLabel()); args.putInt(EXTRA_ICON_ID, entry.iconId); args.putString(EXTRA_PACKAGE_NAME, null); } else { // populate data for normal app args.putString(EXTRA_PACKAGE_NAME, entry.defaultPackageName != null ? entry.defaultPackageName : sipper.mPackages[0]); } args.putInt(EXTRA_UID, sipper.getUid()); args.putLong(EXTRA_BACKGROUND_TIME, backgroundTimeMs); args.putLong(EXTRA_FOREGROUND_TIME, foregroundTimeMs); args.putString(EXTRA_POWER_USAGE_PERCENT, usagePercent); args.putInt(EXTRA_POWER_USAGE_AMOUNT, (int) sipper.totalPowerMah); new SubSettingLauncher(caller) .setDestination(AdvancedPowerUsageDetail.class.getName()) .setTitleRes(R.string.battery_details_title) .setArguments(args) .setSourceMetricsCategory(fragment.getMetricsCategory()) .setUserHandle(new UserHandle(getUserIdToLaunchAdvancePowerUsageDetail(sipper))) .launch(); } private static @UserIdInt int getUserIdToLaunchAdvancePowerUsageDetail(BatterySipper bs) { if (bs.drainType == BatterySipper.DrainType.USER) { return ActivityManager.getCurrentUser(); } return UserHandle.getUserId(bs.getUid()); } public static void startBatteryDetailPage(Activity caller, InstrumentedPreferenceFragment fragment, BatteryStatsHelper helper, int which, BatteryEntry entry, String usagePercent) { startBatteryDetailPage(caller, BatteryUtils.getInstance(caller), fragment, helper, which, entry, usagePercent); } public static void startBatteryDetailPage(Activity caller, InstrumentedPreferenceFragment fragment, String packageName) { final Bundle args = new Bundle(3); final PackageManager packageManager = caller.getPackageManager(); args.putString(EXTRA_PACKAGE_NAME, packageName); args.putString(EXTRA_POWER_USAGE_PERCENT, Utils.formatPercentage(0)); try { args.putInt(EXTRA_UID, packageManager.getPackageUid(packageName, 0 /* no flag */)); } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, "Cannot find package: " + packageName, e); } new SubSettingLauncher(caller) .setDestination(AdvancedPowerUsageDetail.class.getName()) .setTitleRes(R.string.battery_details_title) .setArguments(args) .setSourceMetricsCategory(fragment.getMetricsCategory()) .launch(); } @Override public void onAttach(Activity activity) { super.onAttach(activity); mState = ApplicationsState.getInstance(getActivity().getApplication()); mBatteryUtils = BatteryUtils.getInstance(getContext()); } @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); mPackageName = getArguments().getString(EXTRA_PACKAGE_NAME); mForegroundPreference = findPreference(KEY_PREF_FOREGROUND); mBackgroundPreference = findPreference(KEY_PREF_BACKGROUND); mHeaderPreference = (LayoutPreference) findPreference(KEY_PREF_HEADER); if (mPackageName != null) { mAppEntry = mState.getEntry(mPackageName, UserHandle.myUserId()); } } @Override public void onResume() { super.onResume(); initHeader(); initPreference(); } @VisibleForTesting void initHeader() { final View appSnippet = mHeaderPreference.findViewById(R.id.entity_header); final Activity context = getActivity(); final Bundle bundle = getArguments(); EntityHeaderController controller = EntityHeaderController .newInstance(context, this, appSnippet) .setRecyclerView(getListView(), getSettingsLifecycle()) .setButtonActions(EntityHeaderController.ActionType.ACTION_NONE, EntityHeaderController.ActionType.ACTION_NONE); if (mAppEntry == null) { controller.setLabel(bundle.getString(EXTRA_LABEL)); final int iconId = bundle.getInt(EXTRA_ICON_ID, 0); if (iconId == 0) { controller.setIcon(context.getPackageManager().getDefaultActivityIcon()); } else { controller.setIcon(context.getDrawable(bundle.getInt(EXTRA_ICON_ID))); } } else { mState.ensureIcon(mAppEntry); controller.setLabel(mAppEntry); controller.setIcon(mAppEntry); boolean isInstantApp = AppUtils.isInstant(mAppEntry.info); controller.setIsInstantApp(AppUtils.isInstant(mAppEntry.info)); } controller.done(context, true /* rebindActions */); } @VisibleForTesting void initPreference() { final Bundle bundle = getArguments(); final Context context = getContext(); final long foregroundTimeMs = bundle.getLong(EXTRA_FOREGROUND_TIME); final long backgroundTimeMs = bundle.getLong(EXTRA_BACKGROUND_TIME); mForegroundPreference.setSummary( TextUtils.expandTemplate(getText(R.string.battery_used_for), StringUtil.formatElapsedTime(context, foregroundTimeMs, false))); mBackgroundPreference.setSummary( TextUtils.expandTemplate(getText(R.string.battery_active_for), StringUtil.formatElapsedTime(context, backgroundTimeMs, false))); } @Override public int getMetricsCategory() { return SettingsEnums.FUELGAUGE_POWER_USAGE_DETAIL; } @Override protected String getLogTag() { return TAG; } @Override protected int getPreferenceScreenResId() { return R.xml.power_usage_detail; } @Override protected List<AbstractPreferenceController> createPreferenceControllers(Context context) { final List<AbstractPreferenceController> controllers = new ArrayList<>(); final Bundle bundle = getArguments(); final int uid = bundle.getInt(EXTRA_UID, 0); final String packageName = bundle.getString(EXTRA_PACKAGE_NAME); mBackgroundActivityPreferenceController = new BackgroundActivityPreferenceController( context, this, uid, packageName); controllers.add(mBackgroundActivityPreferenceController); controllers.add(new BatteryOptimizationPreferenceController( (SettingsActivity) getActivity(), this, packageName)); mAppButtonsPreferenceController = new AppButtonsPreferenceController( (SettingsActivity) getActivity(), this, getSettingsLifecycle(), packageName, mState, REQUEST_UNINSTALL, REQUEST_REMOVE_DEVICE_ADMIN); controllers.add(mAppButtonsPreferenceController); return controllers; } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (mAppButtonsPreferenceController != null) { mAppButtonsPreferenceController.handleActivityResult(requestCode, resultCode, data); } } @Override public void handleDialogClick(int id) { if (mAppButtonsPreferenceController != null) { mAppButtonsPreferenceController.handleDialogClick(id); } } @Override public void onBatteryTipHandled(BatteryTip batteryTip) { mBackgroundActivityPreferenceController.updateSummary( findPreference(mBackgroundActivityPreferenceController.getPreferenceKey())); } }
42,088
https://github.com/Hekku2/k-lan-playlist-user-service/blob/master/src/handlers/user-handler.js
Github Open Source
Open Source
MIT
null
k-lan-playlist-user-service
Hekku2
JavaScript
Code
95
363
var userOperations = require('../db/user-operations.js'); exports.list = function(req, res) { var query = userOperations.users(); var success = function(result) { res.json(result); }; var error = function(){ res.sendStatus(500); }; query.then(success).caught(error); }; exports.single = function(req, res){ var query = userOperations.user(req.params.id); var success = function(result) { if(!result){ res.sendStatus(404); return; } res.json(result); }; var error = function(){ res.sendStatus(500); }; query.then(success).caught(error); }; exports.update = function(req, res){ //TODO Validate user var updated = { id: req.params.id, username: req.body.username, role: req.body.role }; var success = function(result) { if(result[0] == 1){ res.sendStatus(200); return; } res.sendStatus(404); }; var error = function(error){ console.log(error); res.sendStatus(500); }; userOperations.update(updated).then(success).caught(error); };
29,123
https://github.com/WigWagCo/alljoyn/blob/master/alljoyn/alljoyn_core/alljoyn_android/alljoyn/src/org/alljoyn/bus/alljoyn/AllJoynService.java
Github Open Source
Open Source
0BSD
2,018
alljoyn
WigWagCo
Java
Code
282
819
/* * Copyright (c) 2010-2011, AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package org.alljoyn.bus.alljoyn; import android.app.Notification; import android.app.Service; import android.content.Intent; import android.app.PendingIntent; import android.os.IBinder; import android.util.Log; import android.net.wifi.WifiManager; public class AllJoynService extends Service { private static final String TAG = "alljoyn.AllJoynService"; public IBinder onBind(Intent intent) { Log.i(TAG, "onBind()"); return null; } public void onCreate() { super.onCreate(); Log.i(TAG, "onCreate()"); WifiManager wifi = (android.net.wifi.WifiManager)getSystemService(android.content.Context.WIFI_SERVICE); mMulticastLock = wifi.createMulticastLock("AllJoynService"); mMulticastLock.setReferenceCounted(false); mMulticastLock.acquire(); CharSequence title = "AllJoyn"; CharSequence message = "Service started."; Intent intent = new Intent(this, AllJoynActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0); Notification notification = new Notification(R.drawable.icon, null, System.currentTimeMillis()); notification.setLatestEventInfo(this, title, message, pendingIntent); notification.flags |= Notification.DEFAULT_SOUND | Notification.FLAG_ONGOING_EVENT | Notification.FLAG_NO_CLEAR; Log.i(TAG, "onCreate(): startForeground()"); startForeground(NOTIFICATION_ID, notification); } public void onDestroy() { super.onDestroy(); Log.i(TAG, "onDestroy()"); if (mMulticastLock != null) { mMulticastLock.release(); mMulticastLock = null; } } WifiManager.MulticastLock mMulticastLock = null; public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); Log.i(TAG, "onStartCommand()"); return START_STICKY; } private static final int NOTIFICATION_ID = 0xdefaced; }
39,940
https://github.com/wingchen/elasticsearch-hadoop/blob/master/spark/src/main/scala/org/elasticsearch/spark/sql/RowValueReader.scala
Github Open Source
Open Source
Apache-2.0
null
elasticsearch-hadoop
wingchen
Scala
Code
89
342
package org.elasticsearch.spark.sql import scala.collection.JavaConverters.asScalaBufferConverter import scala.collection.mutable.ArrayBuffer import scala.collection.mutable.LinkedHashMap import org.elasticsearch.hadoop.cfg.Settings import org.elasticsearch.hadoop.serialization.SettingsAware import org.elasticsearch.hadoop.util.StringUtils private[sql] trait RowValueReader extends SettingsAware { private var rowOrder = new LinkedHashMap[String, Int] abstract override def setSettings(settings: Settings) = { super.setSettings(settings) val csv = settings.getScrollFields() if (StringUtils.hasText(csv)) { val fields = StringUtils.tokenize(csv).asScala for (i <- 0 until fields.length) { rowOrder.put(fields(i), i) } } } def createBuffer: ArrayBuffer[AnyRef] = { if (rowOrder.isEmpty) new ArrayBuffer() else ArrayBuffer.fill(rowOrder.size)(null) } def addToBuffer(buffer: ArrayBuffer[AnyRef], key: AnyRef, value: AnyRef) { if (rowOrder.isEmpty) buffer.append(value) else { rowOrder(key.toString); buffer.update(rowOrder(key.toString), value) } } }
196
https://github.com/civic-eagle/bobsled/blob/master/docker/upload.sh
Github Open Source
Open Source
MIT
2,022
bobsled
civic-eagle
Shell
Code
13
52
#!/bin/sh set -e docker build -t jamesturk/bobsled-forever -f Dockerfile.forever . docker push jamesturk/bobsled-forever
15,516
https://github.com/iootclab/openjdk/blob/master/openjdk11/test/jdk/tools/jar/multiRelease/data/test05/v9/version/Extra.java
Github Open Source
Open Source
Apache-2.0
2,018
openjdk
iootclab
Java
Code
24
54
package version; public class Extra { public int getVersion() { return 9; } protected void doNothing() { } private void anyName() { } }
23,726
https://github.com/0xc14m1z/git-timesheet/blob/master/lib/graph/index.js
Github Open Source
Open Source
MIT
2,018
git-timesheet
0xc14m1z
JavaScript
Code
14
35
const draw = require("./draw") const save = require("./save") module.exports = { draw, save }
49,711
https://github.com/brandonhudson/onesignal-php-api/blob/master/.gitignore
Github Open Source
Open Source
MIT
2,020
onesignal-php-api
brandonhudson
Ignore List
Code
6
33
/.idea /vendor phpunit.xml composer.lock .php_cs.cache .phpunit.result.cache
30,606
https://github.com/promaster171019/angular-aisel/blob/master/frontend/web/app/Aisel/Page/controllers/page.js
Github Open Source
Open Source
MIT
null
angular-aisel
promaster171019
JavaScript
Code
82
199
'use strict'; /** * This file is part of the Aisel package. * * (c) Ivan Proskuryakov * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * @name AiselPage * @description ... */ define(['app'], function (app) { app.controller('PageCtrl', ['$location', '$state', '$scope', '$stateParams', 'resourceService', '$controller', function ($location, $state, $scope, $stateParams, resourceService, $controller) { var pageService = new resourceService('page'); angular.extend(this, $controller('AbstractCollectionCtrl', { $scope: $scope, itemService: pageService })); } ]); });
15,998
https://github.com/richtermark/MEDTrip---Healthcareabroad/blob/master/src/HealthCareAbroad/AdminBundle/Resources/views/AdminUserRole/index.html.twig
Github Open Source
Open Source
MIT
null
MEDTrip---Healthcareabroad
richtermark
Twig
Code
155
558
{% extends 'AdminBundle::layout.html.twig' %} {% set selectedTab = 'settings'%} {% set user_typeLabel = getClassLabel('user_type') %} {% block content %} <div class="span3"> {% include 'AdminBundle:Widgets:settingsTasks.html.twig'%} </div> <div id="content" class="span9"> <!-- start page-heading --> {% embed 'HelperBundle:Widgets:section.html.twig' with { title: user_typeLabel.plural | title, actions:[ {link: path('admin_userType_index'), label: 'View all '~ user_typeLabel.plural | title, 'icon' : 'icon-list' } , {link: path('admin_settings'), label: 'Back To Admin Settings', 'icon' : 'icon-list' }] } %} {% block sectionContent %} {% include '::notice.admin.html.twig' %} <table class="table table-bordered sortable-list"> <tr> <th width="200" id="column-label"><a href="{{ app.request.uri }}" class="{{ 'sort-' ~ app.request.get('sortOrder', 'asc') }}">Permission</a></th> <th> <a href="#">Linked user types</a></th> </tr> {% for each in userRoles %} <tr> <td>{{ each.label | title }}</td> <td> <ul style="list-style:none; padding: 0 15px;"> {% for userType in each.adminUserTypes %} <li> <a href="{{ path('admin_userRole_viewByUserType', {'id': userType.id}) }}">{{ each.name | title }}</a></li> {% endfor %} </ul> </td> </tr> {% endfor %} </table> {% endblock %} {% endembed %} </div> {% endblock %}
38,461
https://github.com/hafron/dokuwiki-plugin-bez/blob/master/ctl/start.php
Github Open Source
Open Source
MIT
2,017
dokuwiki-plugin-bez
hafron
PHP
Code
405
1,749
<?php /** @var action_plugin_bez $this */ use \dokuwiki\plugin\bez; if ($this->model->get_level() < BEZ_AUTH_USER) { throw new bez\meta\PermissionDeniedException(); } class Timeline { protected $timeline = array(); protected function datetime($iso8601) { $timestamp = strtotime($iso8601); $date = date('Y-m-d', $timestamp); $time = date('H:i', $timestamp); return array($date, $time); } public function push($datetime, $type, $author, $entity) { list($date, $time) = $this->datetime($datetime); if (!isset($this->timeline[$date])) $timeline[$date] = array(); $this->timeline[$date][] = array('time' => $time, 'type' => $type, 'author' => $author, 'entity' => $entity); } public function get_assoc() { //sort dates, iso8601 can be compared as strings krsort($this->timeline); //sort times foreach ($this->timeline as &$elm) { usort($elm, function ($a, $b) { return -1 * strcmp($a['time'], $b['time']); }); } return $this->timeline; } } $month_earlier = date('c', strtotime('-1 month')); $filter = array(); $filter['create_date'] = array('>=', $month_earlier, array('date')); $threads = $this->model->threadFactory->get_all($filter, 'create_date DESC'); $thread_comments = $this->model->thread_commentFactory->get_all($filter, 'create_date DESC'); $tasks = $this->model->taskFactory->get_all($filter, 'create_date DESC'); $task_comments = $this->model->task_commentFactory->get_all($filter, 'create_date DESC'); $timeline = new Timeline(); foreach ($threads as $thread) { if ($thread->acl_of('id') < BEZ_PERMISSION_VIEW) continue; $project = ''; if ($thread->type == 'project') { $project = '_project'; } if ($thread->state == 'proposal') { $timeline->push($thread->create_date, 'thread_proposal' . $project, $thread->original_poster, $thread); } else { $timeline->push($thread->create_date, 'thread_opened' . $project, $thread->coordinator, $thread); } if ($thread->state == 'done') { $timeline->push($thread->last_activity_date, 'thread_done' . $project, $thread->coordinator, $thread); } elseif ($thread->state == 'closed') { $timeline->push($thread->last_activity_date, 'thread_closed' . $project, $thread->coordinator, $thread); } elseif ($thread->state == 'rejected') { $timeline->push($thread->last_activity_date, 'thread_rejected' . $project, $thread->coordinator, $thread); } } foreach ($thread_comments as $thread_comment) { if ($thread_comment->thread->acl_of('id') < BEZ_PERMISSION_VIEW) continue; if ($thread_comment->type == 'comment') { $timeline->push($thread_comment->create_date, 'thread_comment_added', $thread_comment->author, $thread_comment); } else { $timeline->push($thread_comment->create_date, 'thread_comment_cause_added', $thread_comment->author, $thread_comment); } } foreach ($tasks as $task) { if ($task->acl_of('id') < BEZ_PERMISSION_VIEW) continue; $timeline->push($task->create_date, 'task_opened', $task->assignee, $task); if ($task->state == 'done') { $timeline->push($task->last_activity_date, 'task_done', $task->assignee, $task); } } foreach ($task_comments as $task_comment) { if ($task_comment->task->acl_of('id') < BEZ_PERMISSION_VIEW) continue; $timeline->push($task_comment->create_date, 'task_comment_added', $task_comment->author, $task_comment); } $this->tpl->set('timeline', $timeline->get_assoc()); $orderby = array('sort', 'priority DESC', 'create_date DESC'); $filter = array('state' => 'proposal'); $proposals = $this->model->threadFactory->get_all($filter, $orderby); $this->tpl->set('proposals', $proposals); $this->tpl->set('proposals_count', $this->model->threadFactory->count($filter)); $orderby = array('sort', 'priority DESC', 'create_date DESC'); $filter = array('state' => 'opened', 'coordinator' => $this->model->user_nick); $my_threads = $this->model->threadFactory->get_all($filter, $orderby); $this->tpl->set('my_threads', $my_threads); $this->tpl->set('my_threads_count', $this->model->threadFactory->count($filter)); $orderby = array('priority DESC', 'plan_date'); $filter = array('state' => 'opened', 'assignee' => $this->model->user_nick); $my_tasks = $this->model->taskFactory->get_all($filter, $orderby); $this->tpl->set('my_tasks', $my_tasks); $this->tpl->set('my_tasks_count', $this->model->taskFactory->count($filter)); $orderby = array('sort', 'priority DESC', 'create_date DESC'); $filter = array('state' => 'opened', 'original_poster' => $this->model->user_nick); $reported_threads = $this->model->threadFactory->get_all($filter, $orderby); $this->tpl->set('reported_threads', $reported_threads); $this->tpl->set('reported_threads_count', $this->model->threadFactory->count($filter)); $orderby = array('priority DESC', 'plan_date'); $filter = array('state' => 'opened', 'original_poster' => $this->model->user_nick); $reported_tasks = $this->model->taskFactory->get_all($filter, $orderby); $this->tpl->set('reported_tasks', $reported_tasks); $this->tpl->set('reported_tasks_count', $this->model->taskFactory->count($filter));
17,633
https://github.com/georgeholt1/epoch-generate-particles-files/blob/master/epoch_generate_particles_files/generate_3d.py
Github Open Source
Open Source
MIT
null
epoch-generate-particles-files
georgeholt1
Python
Code
364
977
# Author: George K. Holt # License: MIT # Version: 0.1 """ Part of EPOCH Generate Particles Files. This generates particle data by sampling a 3-dimensional number density distribution. """ import numpy as np try: from distributions.d3 import number_density_3d except ImportError: raise SystemExit("Failed to import number density distribution funciton.") def generate_3d(xmin, xmax, ymin, ymax, zmin, zmax, nx, ny, nz, ppc, progress=False, n_min=0): '''Generate particles in 3D space. Parameters ---------- xmin, xmax : float Boundaries in the x-direction. ymin, ymax : float Boundaries in the y-direction. zmin, zmax : float Boundaries in the z-direction. nx, ny, nz : int Number of cell in the x-, y- and z-directions. ppc : int Number of particles per cell. progress : bool, optional Whether or not to print a progress bar with tqdm. Defaults to False. n_min : float, optional Minimum number density value. Particles are not generated if the number density at the sample point is lower than this threshold. Defaults to zero (i.e. particles are created at all sample positions; even ones with zero weight). ''' cell_size_x = (xmax - xmin) / nx cell_size_y = (ymax - ymin) / ny cell_size_z = (zmax - zmin) / nz cell_vol = cell_size_x * cell_size_y * cell_size_z # initialise lists to be populated x_list = [] y_list = [] z_list = [] n_list = [] w_list = [] # start at lower boundary x_current = xmin y_current = ymin z_current = zmin # sample the cells if progress: try: from tqdm import tqdm except ImportError: print("No tqdm found.") progress = False if progress: pbar = tqdm(total=np.ceil((xmax-xmin)/cell_size_x)) while x_current < xmax: while y_current < ymax: while z_current < zmax: # randomly sample cell space x_rands = np.random.uniform(0, cell_size_x, ppc) x_rands += x_current y_rands = np.random.uniform(0, cell_size_y, ppc) y_rands += y_current z_rands = np.random.uniform(0, cell_size_z, ppc) z_rands += z_current # get number density values n_samp = number_density_3d(x_rands, y_rands, z_rands) # add particles to list if they exceed the minimum n for i in range(ppc): if n_samp[i] >= n_min: x_list.append(x_rands[i]) y_list.append(y_rands[i]) z_list.append(z_rands[i]) n_list.append(n_samp[i]) w_list.append(n_samp[i] * cell_vol / ppc) z_current += cell_size_y z_current = zmin y_current += cell_size_y y_current = ymin x_current += cell_size_x if progress: pbar.update(1) return x_list, y_list, z_list, n_list, w_list
26,835
https://github.com/prisma-korea/prisma-engines/blob/master/libs/datamodel/core/tests/attributes/postgres_indices/cockroachdb.rs
Github Open Source
Open Source
Apache-2.0
2,020
prisma-engines
prisma-korea
Rust
Code
527
2,215
use crate::{common::*, with_header, Provider}; #[test] fn array_field_default_ops() { let dml = indoc! {r#" model A { id Int @id a Int[] @@index([a], type: Gin) } "#}; let schema = with_header(dml, Provider::Cockroach, &["cockroachDb"]); let schema = parse(&schema); let field = IndexField::new_in_model("a"); schema.assert_has_model("A").assert_has_index(IndexDefinition { name: None, db_name: Some("A_a_idx".to_string()), fields: vec![field], tpe: IndexType::Normal, defined_on_field: false, algorithm: Some(IndexAlgorithm::Gin), clustered: None, }); } #[test] fn no_ops_json_prisma_type() { let dml = indoc! {r#" model A { id Int @id a Json @@index([a], type: Gin) } "#}; let schema = with_header(dml, Provider::Cockroach, &["cockroachDb"]); let schema = parse(&schema); let field = IndexField::new_in_model("a"); schema.assert_has_model("A").assert_has_index(IndexDefinition { name: None, db_name: Some("A_a_idx".to_string()), fields: vec![field], tpe: IndexType::Normal, defined_on_field: false, algorithm: Some(IndexAlgorithm::Gin), clustered: None, }); } #[test] fn with_raw_unsupported() { let dml = indoc! {r#" model A { id Int @id a Unsupported("geometry") @@index([a], type: Gin) } "#}; let schema = with_header(dml, Provider::Cockroach, &["cockroachDb"]); let schema = parse(&schema); let field = IndexField::new_in_model("a"); schema.assert_has_model("A").assert_has_index(IndexDefinition { name: None, db_name: Some("A_a_idx".to_string()), fields: vec![field], tpe: IndexType::Normal, defined_on_field: false, algorithm: Some(IndexAlgorithm::Gin), clustered: None, }); } #[test] fn jsonb_column_as_the_last_in_index() { let dml = indoc! {r#" model A { id Int @id a Json b Int[] @@index([b, a], type: Gin) } "#}; let schema = with_header(dml, Provider::Cockroach, &["cockroachDb"]); let schema = parse(&schema); let b = IndexField::new_in_model("b"); let a = IndexField::new_in_model("a"); schema.assert_has_model("A").assert_has_index(IndexDefinition { name: None, db_name: Some("A_b_a_idx".to_string()), fields: vec![b, a], tpe: IndexType::Normal, defined_on_field: false, algorithm: Some(IndexAlgorithm::Gin), clustered: None, }); } #[test] fn jsonb_column_must_be_the_last_in_index() { let dml = indoc! {r#" model A { id Int @id a Json b Int[] @@index([a, b], type: Gin) } "#}; let schema = with_header(dml, Provider::Cockroach, &["cockroachDb"]); let error = datamodel::parse_schema(&schema).map(drop).unwrap_err(); let expectation = expect![[r#" error: Error parsing attribute "@@index": A `Json` column is only allowed as the last column of an inverted index. --> schema.prisma:16  |  15 |  16 |  @@index([a, b], type: Gin)  |  "#]]; expectation.assert_eq(&error) } #[test] fn custom_ops_not_supported() { let dml = indoc! {r#" model A { id Int @id a Json @@index([a(ops: JsonbOps)], type: Gin) } "#}; let schema = with_header(dml, Provider::Cockroach, &["cockroachDb"]); let error = datamodel::parse_schema(&schema).map(drop).unwrap_err(); let expectation = expect![[r#" error: Error parsing attribute "@@index": Custom operator classes are not supported with the current connector. --> schema.prisma:15  |  14 |  15 |  @@index([a(ops: JsonbOps)], type: Gin)  |  "#]]; expectation.assert_eq(&error) } #[test] fn raw_ops_not_supported() { let dml = indoc! {r#" model A { id Int @id a Json @@index([a(ops: raw("jsonb_ops"))], type: Gin) } "#}; let schema = with_header(dml, Provider::Cockroach, &["cockroachDb"]); let error = datamodel::parse_schema(&schema).map(drop).unwrap_err(); let expectation = expect![[r#" error: Error parsing attribute "@@index": Custom operator classes are not supported with the current connector. --> schema.prisma:15  |  14 |  15 |  @@index([a(ops: raw("jsonb_ops"))], type: Gin)  |  "#]]; expectation.assert_eq(&error) } #[test] fn wrong_field_type() { let dml = indoc! {r#" model A { id Int @id a String @@index([a], type: Gin) } "#}; let schema = with_header(dml, Provider::Cockroach, &["cockroachDb"]); let error = datamodel::parse_schema(&schema).map(drop).unwrap_err(); let expectation = expect![[r#" error: Error parsing attribute "@@index": The Gin index type does not support the type of the field `a`. --> schema.prisma:15  |  14 |  15 |  @@index([a], type: Gin)  |  "#]]; expectation.assert_eq(&error) }
3,651
https://github.com/joyskmathew/hooka/blob/master/test/server/logPrinter/create.spec.js
Github Open Source
Open Source
MIT
2,022
hooka
joyskmathew
JavaScript
Code
32
130
import create from '../../../src/server/logPrinter/create'; describe('logPrinter create', () => { it('should expose the logger API', () => { const logger = create('example'); const methods = Object.keys(logger); expect(methods.length).toBe(4); expect(methods).toContain('log'); expect(methods).toContain('logError'); expect(methods).toContain('logStart'); expect(methods).toContain('logExit'); }); });
28,502
https://github.com/ShaoNianL/danyuan-application/blob/master/src/main/resources/static/pages/softm/dic/index.js
Github Open Source
Open Source
Apache-2.0
2,021
danyuan-application
ShaoNianL
JavaScript
Code
1,124
5,449
//验证 function userAddFormValidator(){ $('#dicName_add_form').bootstrapValidator({ message : '验证失败消息', feedbackIcons : {/* 输入框不同状态,显示图片的样式 */ valid : 'glyphicon glyphicon-ok', invalid : 'glyphicon glyphicon-remove', validating : 'glyphicon glyphicon-refresh' }, fields : {/* 验证 */ code : {/* 键名username和input name值对应 */ validators : { notEmpty : {/* 非空提示 */ message : '代码不能为空' // } , // remote: { // message: '已经有了', // url: '/sysDicName/checkCode', // type: 'POST',//请求方式 // delay:2000 //这里特别要说明,必须要加此属性,否则用户输入一个字就会访问后台一次,会消耗大量的系统资源, } } }, name: { validators: { notEmpty : {/* 非空提示 */ message : '名称不能为空' }, stringLength : {/* 长度提示 */ max : 10, message : '名称必须在10之' } } }, type : {/* 键名username和input name值对应 */ validators : { notEmpty : {/* 非空提示 */ message : '类型不能为空' } } } } }); } //验证 function dicKeyAddFormValidator(){ $('#dickey_add_form').bootstrapValidator({ message : '验证失败消息', feedbackIcons : {/* 输入框不同状态,显示图片的样式 */ valid : 'glyphicon glyphicon-ok', invalid : 'glyphicon glyphicon-remove', validating : 'glyphicon glyphicon-refresh' }, fields : {/* 验证 */ keyword : {/* 键名username和input name值对应 */ validators : { notEmpty : {/* 非空提示 */ message : '不能为空' // } , // remote: { // message: '已经有了', // url: '/sysDicName/checkCode', // type: 'POST',//请求方式 // delay:2000 //这里特别要说明,必须要加此属性,否则用户输入一个字就会访问后台一次,会消耗大量的系统资源, } } }, keyValue: { validators: { notEmpty : {/* 非空提示 */ message : '不能为空' } } }, keyOrder : {/* 键名username和input name值对应 */ validators : { notEmpty : {/* 非空提示 */ message : '类型不能为空' }, numeric:{ min:1, message : '必须是数字型的' } } } } }); } $(function() { $('#addnew_user').click(function() { $('#add_dicName_uuid').val(""); $('#add_dicName_name').val(""); $('#add_dicName_code').val(""); $('#add_dicName_buttonType').find("input:first").parent().click(); // 模态框 $('#admin_dicName_add_modal').modal({ show:true, }); userAddFormValidator() }); // 绑定 批量删除事件 $('#deleteold_user').click(function() { var data = $('#admin_dicName_datagrid').bootstrapTable('getAllSelections'); if(data.length == 0){ alert("先选中数据"); }else if(data.length > 0){ bootbox.setLocale("zh_CN"); bootbox.confirm({ message : "确定要删除选定行", title : "系统提示", callback : function(result) { if (result) { var param = { "list":data, }; // 重载 var url = "/sysDicName/deleteAll"; ajaxPost(url, param, successDelete, 1000, findError); } } }); } }); // 绑定 修改事件 $('#editold_user').click(function() { var data = $('#admin_dicName_datagrid').bootstrapTable('getAllSelections'); if(data.length == 0||data.length >1){ alert("必须选中一条数据"); }else if(data.length > 0){ $('#add_dicName_uuid').val(data[0].uuid); $('#add_dicName_name').val(data[0].name); $('#add_dicName_code').val(data[0].code); $('#add_dicName_buttonType').find("input[value='"+data[0].buttonType+"']").parent().click(); // 模态框 $('#admin_dicName_add_modal').modal({ show:true, }); userAddFormValidator() } }); $('#admin_dicName_add_save_button').click(function() { $('#dicName_add_form').data("bootstrapValidator").validate(); var flag = $('#dicName_add_form').data("bootstrapValidator").isValid(); if (flag) { var params ={ uuid:$('#add_dicName_uuid').val(), name:$('#add_dicName_name').val(), code:$('#add_dicName_code').val(), buttonType:$('#add_dicName_buttonType').find('input:checked').val(), createUser:username, updateUser:username, }; console.log(params); ajaxPost("/sysDicName/save", params, successDelete, 10000, findError); } }); // ------------------------------------------------------------------------------------ $('#addnew_dickey').click(function() { var row = $('#admin_dicName_datagrid').bootstrapTable('getAllSelections')[0]; $('#add_dickey_nameUuid').val(row.uuid); $('#add_dickey_keyword').val(""); $('#add_dickey_keyValue').val(""); $('#add_dickey_uuid').val(""); $('#add_dickey_keyOrder').val(""); // 模态框 $('#admin_dickey_add_modal').modal({ show:true, }); dicKeyAddFormValidator() }); // 绑定 批量删除事件 $('#deleteold_dickey').click(function() { var data = $('#admin_dicKeyList_datagrid').bootstrapTable('getAllSelections'); if(data.length == 0){ alert("先选中数据"); }else if(data.length > 0){ bootbox.setLocale("zh_CN"); bootbox.confirm({ message : "确定要删除选定行", title : "系统提示", callback : function(result) { if (result) { var param = { "list":data, }; // 重载 var url = "/sysDicKeyList/deleteAll"; ajaxPost(url, param, successDeletekey, 1000, findError); } } }); } }); // 绑定 修改事件 $('#editold_dickey').click(function() { var data = $('#admin_dicKeyList_datagrid').bootstrapTable('getAllSelections'); if(data.length == 0||data.length >1){ alert("必须选中一条数据"); }else if(data.length > 0){ $('#add_dickey_keyword').val(data[0].keyword); $('#add_dickey_keyValue').val(data[0].keyValue); $('#add_dickey_uuid').val(data[0].uuid); $('#add_dickey_keyOrder').val(data[0].keyOrder); $('#add_dickey_nameUuid').val(data[0].nameUuid); // 模态框 $('#admin_dickey_add_modal').modal({ show:true, }); dicKeyAddFormValidator() } }); $('#admin_dickey_add_save_button').click(function() { $('#dickey_add_form').data("bootstrapValidator").validate(); var flag = $('#dickey_add_form').data("bootstrapValidator").isValid(); if (flag) { var params ={ keyword:$('#add_dickey_keyword').val(), keyValue:$('#add_dickey_keyValue').val(), keyOrder:$('#add_dickey_keyOrder').val(), uuid:$('#add_dickey_uuid').val(), nameUuid:$('#add_dickey_nameUuid').val(), createUser:username, updateUser:username, }; ajaxPost("/sysDicKeyList/save", params, successDeletekey, 10000, findError); } }); // bootstrap table $('#admin_dicName_datagrid').bootstrapTable({ url : "/sysDicName/page", dataType : "json", toolbar : '#dicName_toolbar', // 工具按钮用哪个容器 cache : true, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) sortable : true, // 是否启用排序 sortOrder : "asc", // 排序方式 pagination : true, // 分页 pageNumber : 1, // 初始化加载第一页,默认第一页 pageSize : 10, // 每页的记录行数(*) pageList : [ 10, 25, 50, 100 ], // 可供选择的每页的行数(*) strictSearch : true, showColumns : true, // 是否显示所有的列 showRefresh : true, // 是否显示刷新按钮 // showExport : true, // 是否显示导出 showToggle : true, // 是否显示详细视图和列表视图的切换按钮 minimumCountColumns : 2, // 最少允许的列数 clickToSelect : true, // 是否启用点击选中行 height : 600, // 行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度 uniqueId : "uuid", // 每一行的唯一标识,一般为主键列 cardView : false, // 是否显示详细视图 detailView : false, // 是否显示父子表 singleSelect : true, exportDataType : "all", // basic', 'all', 'selected'. locales : "zh-CN", // 表格汉化 search : true, // 显示搜索框 refresh : true, striped : true, // 是否显示行间隔色 sidePagination: "server", // 服务端处理分页 queryParamsType : "undefined", contentType: "application/json", method: "post", //使用get请求到服务器获取数据 queryParams: function queryParams(params) { var param = { pageNumber: params.pageNumber, pageSize: params.pageSize, info:{name: params.searchText}, sortOrder:params.sortOrder, sortName:params.sortName }; return param; }, columns : [ {title : '全选',checkbox : true, align : 'center',valign : 'middle' }, // {title : 'id',field : 'uuid',align : 'center',sortable : true,valign : 'middle' }, {title : '名称',field : 'name',sortable : true,align : 'left' }, {title : '调用代码',field : 'code',align : 'left',sortable : true,valign : 'middle' }, {title : '控件类型',field : 'buttonType',align : 'left',sortable : true,valign : 'middle', formatter:buttonTypeFormatter }, {title : '录入时间',field : 'createTime',align : 'left',sortable : true,valign : 'middle' ,visible:false }, {title : '更新时间',field : 'updateTime',align : 'center' ,visible:false }, ] , responseHandler: function(result){ // 成功时执行 return {rows:result.data.content,total:result.data.totalElements}; }, onClickRow:function(row){ $("#admin_dicKeyList_datagrid").bootstrapTable("destroy"); InitSubRoleTable(row); }, }).on('dbl-click-row.bs.table', function (e, row, ele,field) { }).on('click-row.bs.table', function (e, row, ele,field) { $(".info").removeClass("info"); $(ele).addClass("info"); }); }); // 窗口大小改变时 重设表头 $(window).resize(function() { $('#admin_dicName_role_datagrid').bootstrapTable('resetView'); }); ////Modal验证销毁重构 $('#admin_userBase_add_modal').on('hidden.bs.modal', function() { $("#dicName_add_form").data('bootstrapValidator').destroy(); $('#dicName_add_form').data('bootstrapValidator', null); }); ////Modal验证销毁重构 $('#admin_dickey_add_modal').on('hidden.bs.modal', function() { $("#dickey_add_form").data('bootstrapValidator').destroy(); $('#dickey_add_form').data('bootstrapValidator', null); }); // 格式化-------------------------------------------- function buttonTypeFormatter(e,row,index){ if(row.buttonType=='selected'){return "下拉选项"} else if (row.buttonType=='radio'){return "单选按钮"} else if (row.buttonType=='checked'){return "多选按钮"} } // -------------------------------------------------- function InitSubRoleTable(row) { $("#admin_dicKeyList_datagrid").bootstrapTable({ url:'/sysDicKeyList/page', dataType : "json", toolbar : '#dickey_toolbar', // 工具按钮用哪个容器 cache : true, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) sortable : true, // 是否启用排序 sortOrder : "asc", // 排序方式 pagination : true, // 分页 pageNumber : 1, // 初始化加载第一页,默认第一页 pageSize : 10, // 每页的记录行数(*) pageList : [ 10, 25, 50, 100 ], // 可供选择的每页的行数(*) strictSearch : true, showColumns : true, // 是否显示所有的列 showRefresh : true, // 是否显示刷新按钮 minimumCountColumns : 2, // 最少允许的列数 clickToSelect : true, // 是否启用点击选中行 height : 500, // 行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度 uniqueId : "uuid", // 每一行的唯一标识,一般为主键列 showToggle : true, // 是否显示详细视图和列表视图的切换按钮 cardView : false, // 是否显示详细视图 detailView : false, // 是否显示父子表 singleSelect : false, locales : "zh-CN", // 表格汉化 // search : true, // 显示搜索框 sidePagination: "server", // 服务端处理分页 server //设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder //设置为limit可以获取limit, offset, search, sort, order queryParamsType : "undefined", contentType: "application/json", method: "post", //使用get请求到服务器获取数据 queryParams: function queryParams(params) { var param = { pageNumber: params.pageNumber, pageSize: params.pageSize, info:{nameUuid:row.uuid}, sortOrder:params.sortOrder, sortName:params.sortName }; return param; }, columns : [ {title : 'checked',field : 'checked',checkbox : true,align : 'center',valign : 'middle' }, // {title : 'uuid',field : 'uuid', align : 'center',sortable : true,valign : 'middle'}, // {title : '部门名称',field : 'departmentId',sortable : true,align : 'center'}, {title : '显示数据',field : 'keyword',sortable : true,align : 'left'}, {title : '值',field : 'keyValue',sortable : true,align : 'left'}, {title : '排序',field : 'keyOrder',sortable : true,align : 'left',sortable:true}, {title : '记录时间',field : 'createTime',align : 'center', sortable : true,valign : 'middle',visible:false}, {title : '更新时间',field : 'updateTime',sortable : true,align : 'center',visible:false}, // {title : '标记', field : 'deleteFlag', sortable : true,align : 'center'} ], responseHandler: function(result){ // 成功时执行 return {rows:result.data.content,total:result.data.totalElements}; }, onLoadSuccess: function(){ //加载成功时执行 }, onLoadError: function(){ //加载失败时执行 }, // onExpandRow:function(index, row, $detail) { // //InitSubTable(index, row, $detail); // } // onClickRow:function(index){ // console.log(index); // }, // onCheck: function (row) { // updateUserRole(row,index); // },onUncheck: function (row) { // updateUserRole(row,index); // }, }); } function successDelete(result){ $('#admin_dicName_datagrid').bootstrapTable('refresh'); $('#admin_dicName_add_modal').modal('hide'); } function successDeletekey(result){ $('#admin_dicKeyList_datagrid').bootstrapTable('refresh'); $('#admin_dickey_add_modal').modal('hide'); }
39,358
https://github.com/bmbarker90/Semantic-UI-React/blob/master/docs/src/examples/views/Item/Content/ItemExampleDescriptions.js
Github Open Source
Open Source
MIT
null
Semantic-UI-React
bmbarker90
JavaScript
Code
111
363
import React from 'react' import { Item } from 'semantic-ui-react' const description = [ 'Cute dogs come in a variety of shapes and sizes. Some cute dogs are cute for their adorable faces, others for their', 'tiny stature, and even others for their massive size.', ].join(' ') const ItemExampleDescriptions = () => ( <Item.Group> <Item> <Item.Image size='small' src='/assets/images/wireframe/image.png' /> <Item.Content> <Item.Header as='a'>Cute Dog</Item.Header> <Item.Description> <p>{description}</p> <p>Many people also have their own barometers for what makes a cute dog.</p> </Item.Description> </Item.Content> </Item> <Item> <Item.Image size='small' src='/assets/images/wireframe/image.png' /> <Item.Content> <Item.Header as='a'>Cute Dog</Item.Header> <Item.Description content={description} /> </Item.Content> </Item> <Item> <Item.Image size='small' src='/assets/images/wireframe/image.png' /> <Item.Content header='Cute Dog' description={description} /> </Item> </Item.Group> ) export default ItemExampleDescriptions
2,470
https://github.com/srahmani786/Projects/blob/master/Python/flappy_bird/snowy_bird_final.py
Github Open Source
Open Source
Apache-2.0
2,021
Projects
srahmani786
Python
Code
412
1,710
import pygame ,sys ,random def draw_floor(): screen.blit(floor_surface,(floor_x_pos,250)) screen.blit(floor_surface,(floor_x_pos + 400,250)) def create_pipe(): random_pipe_pos = random.choice(pipe_height) #create random heighted pipes from defined list new_pipe = pipe_surface.get_rect(midtop =(400,random_pipe_pos))#half coordinates of our display screen return new_pipe def move_pipes(pipes): for pipe in pipes: pipe.centerx -= 5 return pipes def draw_pipes(pipes): for pipe in pipes: screen.blit(pipe_surface,pipe) def check_collision(pipes): for pipe in pipes: if bird_rect.colliderect(pipe): #checking for coliisions of bird and pipe rectangles death_sound.play() return False if bird_rect.top <= -300 or bird_rect.bottom >= 1000: print ("boom") death_sound.play() return False return True def rotate_bird(bird): new_bird = pygame.transform.rotozoom(bird,-bird_movement *3 ,1) return new_bird def score_display(game_state): if game_state == 'main_game': score_surface = game_font.render(str(int(score)),True,(255,255,255))#255 255 255 are red green blue tupples and gives font colour score_rect = score_surface.get_rect(center = (200,50)) screen.blit(score_surface,score_rect) if game_state == 'game_over': score_surface = game_font.render(f'Score: {int(score)}',True,(255,255,255)) score_rect = score_surface.get_rect(center = (200,50)) screen.blit(score_surface,score_rect) high_score_surface = game_font.render(f'High Score: {int(high_score)}',True,(255,255,255)) high_score_rect = high_score_surface.get_rect(center = (200,80)) screen.blit(high_score_surface,high_score_rect) def update_score(score,high_score): if score > high_score: high_score = score return high_score #pygame.mixer.pre_init(frequency = 44100,size 16 ,channels =1, buffer = 512) pygame.init() screen = pygame.display.set_mode((400,330))#pixels for display screen clock = pygame.time.Clock() #this clock is used for limiting our FPS game_font = pygame.font.Font('./KelsonSans-Bold.ttf',30) #Game variables gravity = 0.32 bird_movement = 0 game_active = True score = 0 high_score = 0 bg_surface = pygame.image.load('./background.jpg').convert() bg_surface = pygame.transform.scale2x(bg_surface) floor_surface = pygame.image.load('./base.png').convert() floor_surface = pygame.transform.scale2x(floor_surface) floor_x_pos = 0 bird_surface = pygame.image.load('./bird.png').convert_alpha() #bird_surface = pygame.transform.scale2x(bird_surface) bird_rect = bird_surface.get_rect(center=(30,115)) pipe_surface = pygame.image.load('./bpipe.png').convert() #pipe_surface = pygame.transform.scale2x(pipe_surface) pipe_list = [] SPAWNPIPE = pygame.USEREVENT pygame.time.set_timer(SPAWNPIPE,1200)#timer for pipes in ms pipe_height = [100,120,150,250,20,50,300,405] game_over_surface =( pygame.image.load('./game over.png').convert_alpha()) game_over_rect = game_over_surface.get_rect(center =( 200,165)) #SOUNDS flap_sound = pygame.mixer.Sound('./swoosh.wav') death_sound = pygame.mixer.Sound('./hit.wav') score_sound = pygame.mixer.Sound('./point.wav') score_sound_countdown = 100 while True: #image of player 1 #background image #EVENT LOOP for event in pygame.event.get(): #cmd look for any events occuring if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type == pygame.KEYDOWN: #this checks if any key is pressed if event.key == pygame.K_SPACE and game_active: #this checks which key is pressed bird_movement=0 bird_movement -= 11 flap_sound.play() if event.key == pygame.K_SPACE and game_active == False: game_active =True pipe_list.clear() bird_rect.center = (30,115) bird_movement=0 score = 0 if event.type == SPAWNPIPE: pipe_list.append(create_pipe()) screen.blit(bg_surface,(0,0)) #GAME LOOP if game_active: #BIRDS bird_movement += 0.8*gravity # for making bird fall rotated_bird = rotate_bird(bird_surface) bird_rect.centery += bird_movement #this allows bird to fall continously screen.blit(rotated_bird,bird_rect) game_active = check_collision(pipe_list) #PIPES pipe_list = move_pipes(pipe_list) draw_pipes(pipe_list) score += 0.03 score_display('main_game') score_sound_countdown -=1 if score_sound_countdown <=0: score_sound.play() score_sound_countdown = 80 else: screen.blit(game_over_surface,game_over_rect) high_score = update_score(score,high_score) score_display('game_over') #FLOOR floor_x_pos -=3 draw_floor() if floor_x_pos<= -400: floor_x_pos = 0 pygame.display.update() clock.tick(120)
10,690
https://github.com/Knh238/BookMarker/blob/master/client/components/SampleSeries.js
Github Open Source
Open Source
MIT
null
BookMarker
Knh238
JavaScript
Code
131
512
import React from 'react' import PropTypes from 'prop-types' import {connect} from 'react-redux' import Card from '@material-ui/core/Card' import CardActionArea from '@material-ui/core/CardActionArea' import CardActions from '@material-ui/core/CardActions' import CardContent from '@material-ui/core/CardContent' import CardMedia from '@material-ui/core/CardMedia' import {getSeries} from '../store/booksReducer' import {Link} from 'react-router-dom' import Typography from '@material-ui/core/Typography' class SampleSeries extends React.Component { constructor(props) { super(props) // this.state = {list: {}} } componentDidMount() { this.props.gotCurrentSeries('52637') } render() { console.log(this.props) const books = this.props.currentSeries console.log('these books', books) return ( <Card key={item.book.id._text}> <Typography align="center">{item.book.title._text}</Typography> <Typography align="center"> {item.book.authors.author.name._text} </Typography> <CardContent> <Typography>{item.book.description._text.slice(13, 200)}</Typography> </CardContent> <CardMedia component="img" // className={styles.media} image={item.book.image_url._text} title="Contemplative Reptile" /> </Card> ) } } const mapStateToProps = state => { return { ...state, user: state.user.current, series: state.books.currentSeries } } const mapDispatchToProps = dispatch => { return { gotCurrentSeries: id => dispatch(getSeries(id)) } } export default connect(mapStateToProps, mapDispatchToProps)(SampleSeries)
7,062
https://github.com/donavon/lambdog-server/blob/master/__tests__/applyMiddleware.test.js
Github Open Source
Open Source
MIT
2,020
lambdog-server
donavon
JavaScript
Code
148
401
import { applyMiddleware } from '../src/applyMiddleware'; describe('applyMiddleware', () => { const args = { event: {}, }; it('resolves when middleware calls next()', async () => { const sampleMiddleware = (req, res, next) => { req.count = (req.count || 0) + 1; next(); }; await applyMiddleware([sampleMiddleware], args); expect(args.req.count).toBe(1); }); it('can execute an array of middleware', async () => { const sampleMiddleware = (req, res, next) => { req.count = (req.count || 0) + 1; next(); }; await applyMiddleware([sampleMiddleware, sampleMiddleware], args); expect(args.req.count).toBe(2); }); it('throws when middleware calls next(anything)', async () => { const sampleMiddleware = (req, res, next) => { next({}); }; try { await applyMiddleware([sampleMiddleware], args); } catch (ex) { expect(ex).toEqual(expect.objectContaining({ body: undefined })); } }); it('throws when middleware calls next(Error)', async () => { const sampleMiddleware = (req, res, next) => { next(new Error('foo')); }; try { await applyMiddleware([sampleMiddleware], args); } catch (ex) { expect(ex.message).toEqual(ex.body); } }); });
32,112
https://github.com/Evil1991/bitrixdock/blob/master/www/html/bitrix/modules/advertising/install/components/bitrix/advertising.banner/templates/nivo/lang/en/.parameters.php
Github Open Source
Open Source
MIT
2,020
bitrixdock
Evil1991
PHP
Code
47
220
<? $MESS["ADV_NIVO_EFFECT"] = "Slide change effect"; $MESS["ADV_NIVO_EFFECT_RANDOM"] = "random"; $MESS["ADV_NIVO_CYCLING"] = "Auto advance"; $MESS["ADV_NIVO_INTERVAL"] = "Slide advance speed (msec)"; $MESS["ADV_NIVO_PAUSE"] = "Pause on hover"; $MESS["ADV_NIVO_SPEED"] = "Animation length (msec.)"; $MESS["ADV_NIVO_JQUERY"] = "Auto include jQuery"; $MESS["ADV_NIVO_DIRECTION_NAV"] = "Show navigation control on slide"; $MESS["ADV_NIVO_CONTROL_NAV"] = "Show paginator control"; ?>
13,434
https://github.com/FredAss/OpenResKit-Danger-Android/blob/master/.gitignore
Github Open Source
Open Source
Apache-2.0
2,016
OpenResKit-Danger-Android
FredAss
Ignore List
Code
4
16
.classpath bin/ libs/ .settings/
8,191
https://github.com/pjlorenzo/fluentassertions.ioc.ninject/blob/master/src/FluentAssertions.Ioc.Ninject.Sample/SampleModule.cs
Github Open Source
Open Source
Apache-2.0
2,019
fluentassertions.ioc.ninject
pjlorenzo
C#
Code
51
298
using FluentAssertions.Ioc.Samples.Core; using FluentAssertions.Ioc.Samples.Core.Providers; using FluentAssertions.Ioc.Samples.Data; using Ninject.Extensions.Conventions; using Ninject.Modules; namespace FluentAssertions.Ioc.Ninject.Sample { public class SampleModule : NinjectModule { public override void Load() { // Services Kernel.Bind(x => x.FromAssemblyContaining<SampleService>().SelectAllClasses() .InNamespaceOf<SampleService>() .EndingWith("Service") .BindAllInterfaces()); // Providers Kernel.Bind(x => x.FromAssemblyContaining<FooProvider>().SelectAllClasses() .InNamespaceOf<FooProvider>() .EndingWith("Provider") .BindAllInterfaces()); // Repositories Kernel.Bind(x => x.FromAssemblyContaining<SampleRepository>().SelectAllClasses() .InNamespaceOf<SampleRepository>() .EndingWith("Repository") .BindAllInterfaces()); } } }
15,016
https://github.com/Devalent/facial-recognition-service/blob/master/app/store/recognition/index.ts
Github Open Source
Open Source
MIT
null
facial-recognition-service
Devalent
TypeScript
Code
371
1,058
import { createSlice } from '@reduxjs/toolkit'; import randomColor from 'randomcolor'; import config from '../../config'; import { changeState } from '../demo'; export type Room = { id:string; connection:string; }; export type Recognition = { x:number; y:number; width:number; height:number; image:string; encodings:number[]; }; export type RecognitionMatch = { id:number; personId:number; created:number; image:string; name:string; color:string; encodings:number[]; distance?:number; similarity?:number; }; type RecognitionCandidate = { match:RecognitionMatch; distance:number; }; const colors = Array.from(Array(100)).map(() => randomColor({ luminosity: 'dark' })); export const slice = createSlice({ name: 'recognition', initialState: { colors, threshold: config.recognition_threshold, uniques: 0, lastId: 0, matches: [] as RecognitionMatch[], }, reducers: { addRecognitions: (state, action) => { const existingFaces = state.matches; const newFaces:Recognition[] = action.payload; const facesToAdd:RecognitionMatch[] = []; for (const newFace of newFaces) { const candidates:RecognitionCandidate[] = []; // Compare each new face with all existing faces for (const existing of existingFaces) { // Calculate the Euclidean distance, which is a measure // of how two faces are similar to each other. // The lower the distance, the more similarity they share. // See https://en.wikipedia.org/wiki/Euclidean_distance const sum = existing.encodings.reduce((res, x1, i) => { const x2 = newFace.encodings[i]; return res + ((x1 - x2) ** 2); }, 0) const distance = Math.sqrt(sum); // Only consider faces that are similar enough (distance < 0.6) if (distance >= 0 && distance < state.threshold) { candidates.push({ match: existing, distance, }); } } // Find a face with the shortest euclidean distance const candidate = candidates .sort((a, b) => a.distance - b.distance)[0]; const personId = candidate ? candidate.match.personId : ++state.uniques; let similarity = undefined; // Calculate the similarity percentage // See https://github.com/ageitgey/face_recognition/wiki/Calculating-Accuracy-as-a-Percentage if (candidate) { const linear = 1.0 - (candidate.distance / (state.threshold * 2.0)); const score = linear + ((1.0 - linear) * Math.pow((linear - 0.5) * 2, 0.2)); similarity = Math.round(score * 100); } const addItem:RecognitionMatch = { personId, similarity, id: ++state.lastId, created: Date.now(), encodings: newFace.encodings, image: newFace.image, name: `Person #${personId}`, color: state.colors[personId % state.colors.length], distance: candidate?.distance, }; facesToAdd.push(addItem); } state.matches = [ ...existingFaces, ...facesToAdd, ] .sort((a, b) => a.created - b.created) .filter((x, i) => i < 100); }, }, extraReducers: (builder) => { builder.addCase(changeState, (state, action) => { state.matches = []; state.uniques = 0; state.lastId = 0; }); }, }) export default slice.reducer; export const { addRecognitions } = slice.actions;
28,566
https://github.com/davegurnell/validation/blob/master/shared/src/main/scala/io/underscore/validation/ValidationResultImplicits.scala
Github Open Source
Open Source
Apache-2.0
2,021
validation
davegurnell
Scala
Code
93
262
package io.underscore.validation trait ValidationResultImplicits { implicit class SeqValidationResultOps(results: Seq[ValidationResult]) { def hasErrors: Boolean = results exists (_.isError) def hasWarnings: Boolean = results exists (_.isWarning) def errors: Seq[ValidationResult] = results collect { case error if error.isError => error } def warnings: Seq[ValidationResult] = results collect { case warn if warn.isWarning => warn } def toErrors: Seq[ValidationResult] = results map (_.toError) def toWarnings: Seq[ValidationResult] = results map (_.toWarning) def prefix[A: ValidationPathPrefix](prefixes: A *): Seq[ValidationResult] = for { result <- results prefix <- prefixes } yield result.prefix(prefix) def withValue[A](in: A): Validated[A] = Validated[A](in, results) } }
32,590
https://github.com/HLSW/DeltaEngine/blob/master/Logging/Tests/NetworkLoggerWithLogServiceTests.cs
Github Open Source
Open Source
Apache-2.0
2,022
DeltaEngine
HLSW
C#
Code
104
301
using System; using System.Threading; using DeltaEngine.Core; using DeltaEngine.Mocks; using DeltaEngine.Networking.Tcp; using NUnit.Framework; namespace DeltaEngine.Logging.Tests { public class NetworkLoggerWithLogServiceTests { //ncrunch: no coverage start [Test, Ignore] public static void LogToRealLogServer() { var ready = false; var connection = new OnlineServiceConnection(new MockSettings(), () => {}); connection.ServerErrorHappened += error => { throw new ServerErrorReceived(error); }; connection.ContentReady += () => ready = true; using (var logClient = new NetworkLogger(connection)) { for (int timeoutMs = 1000; timeoutMs > 0 && !ready; timeoutMs -= 10) Thread.Sleep(10); logClient.Write(Logger.MessageType.Info, "Hello TestWorld from " + Environment.MachineName); } } public class ServerErrorReceived : Exception { public ServerErrorReceived(string error) : base(error) {} } } }
22,675
https://github.com/jliottard/OthelloGame/blob/master/src/InterfacePlayer.java
Github Open Source
Open Source
MIT
null
OthelloGame
jliottard
Java
Code
15
37
public interface InterfacePlayer { public Position getPosition(); public CellContent getColor(); public void setPosition(Position p); }
28,382
https://github.com/fadilatur11/newscrawl/blob/master/resources/views/home/index.blade.php
Github Open Source
Open Source
MIT
null
newscrawl
fadilatur11
PHP
Code
231
1,260
<x-headerhome /> <div class="view view-main view-init ios-edges" data-url="/"> <!-- navbar --> <div class="page page-home"> <div class="page-content"> <!-- navbar top --> <div class="navbar-top"> <div class="container"> <div class="row"> <div class="col-100"> <div class="text-align-center"> <a href="{{url('/')}}" class="external"> <h3>ngabarin.id</h3> </a> </div> </div> <div class="col-100 mt--10"> <x-search /> </div> </div> </div> </div> <!-- end navbar top --> <!-- slider --> <div class="slider-home2"> <div class="container"> <div class="swiper-container swiper-init" data-prevent-clicks="false" data-pagination='{"el": ".swiper-pagination"}' data-space-between="10"> <div class="swiper-pagination"></div> <div class="swiper-wrapper"> @foreach($slider as $getslider) <div class="swiper-slide"> <img src="{{$getslider['image']}}" alt="{{$getslider['title']}}" onerror="this.onerror=null; this.src='{{ asset("/images/404.jpg") }}'"> <div class="mask"></div> <div class="caption"> <span>{{$getslider['author']}}</span> <a class="external" href="javascript:void(0)" onclick="showOptionRead('{{ url('/detail/'.$getslider['id'].'/'.$getslider['slug']) }}', '{{ $getslider['link'] }}')"> <h4>{{$getslider['title']}}</h4> </a> </div> </div> @endforeach </div> </div> </div> </div> <!-- end slider --> <!-- post --> <div class="post segments"> <div class="container"> @foreach($getarticle as $article) <div class="row"> <div class="col-50"> <div class="content"> <a class="external" href="javascript:void(0)" onclick="showOptionRead('{{ url('/detail/'.$article['id'].'/'.$article['slug']) }}', '{{ $article['link'] }}')"> <img src="{{$article['image']}}" alt="{{$article['title']}}" onerror="this.onerror=null; this.src='{{ asset("/images/404.jpg") }}'"> </a> </div> </div> <div class="col-50"> <div class="content-text"> <span>{{$article['author']}}</span> <a class="external" href="javascript:void(0)" onclick="showOptionRead('{{ url('/detail/'.$article['id'].'/'.$article['slug']) }}', '{{ $article['link'] }}')"> <h5>{{$article['title']}}</h5> </a> <p class="date">{{Carbon\Carbon::parse(date('Y-m-d',$article['published_at']))->diffForHumans()}}</p> </div> </div> </div> @endforeach <div id="setmore"></div> <br> <div class="link-more"> <button type="button" class="button button-custom loadmore">Selanjutnya</button> <input type="hidden" id="more" value="6"> </div> </div> </div> <!-- end post --> </div> <div class="block-modal"> <div class="block-modal__option"> <div class="block-modal__option-box"> <div class="block-modal__option-box-container"> <div class="block-modal__option-box-container-title"> Kamu ingin baca dimana ? </div> <div class="block-modal__option-box-container-action"> <div> <a class="block-modal__option-box-container-action-button block-modal__option-box-container-action-button--enabled external">Baca Instan</a> </div> <div> <a class="block-modal__option-box-container-action-button block-modal__option-box-container-action-button--disabled external" target="blank">Baca Sumber</a> </div> </div> </div> </div> </div> </div> </div> <x-footer /> <script src="{{url('/assets')}}/js/datascript.js"></script>
10,161
https://github.com/bivas/pygradle/blob/master/pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/util/internal/ExecutablePathUtils.java
Github Open Source
Open Source
Apache-2.0, Python-2.0
2,016
pygradle
bivas
Java
Code
185
404
/* * Copyright 2016 LinkedIn Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.linkedin.gradle.python.util.internal; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; public class ExecutablePathUtils { private ExecutablePathUtils() { //private constructor for util class } public static File getExecutable(List<File> pathList, String exeName) { for (File dir : pathList) { File candidate = new File(dir, exeName); if (candidate.isFile()) { return candidate; } } return null; } public static List<File> getPath() { List<File> entries = new ArrayList<>(); String path = System.getenv("PATH"); if (path == null) { return entries; } for (String entry : path.split(Pattern.quote(File.pathSeparator))) { entries.add(new File(entry)); } return entries; } }
4,395
https://github.com/AlexSwensen/pi-gen-auto/blob/master/export-image/00-allow-rerun/00-run.sh
Github Open Source
Open Source
BSD-3-Clause
2,022
pi-gen-auto
AlexSwensen
Shell
Code
13
61
#!/bin/bash -e if [ ! -x "${ROOTFS_DIR}/usr/bin/qemu-arm-static" ]; then cp /usr/bin/qemu-arm-static "${ROOTFS_DIR}/usr/bin/" fi
50,821
https://github.com/Lizamil/Trello_QA21_LMil/blob/master/trello_web/src/test/java/trello_tests/manager/UserHelper.java
Github Open Source
Open Source
Apache-2.0
2,019
Trello_QA21_LMil
Lizamil
Java
Code
103
514
package trello_tests.manager; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import java.io.File; public class UserHelper extends HelperBase { public UserHelper(WebDriver driver) { super(driver); } public void clickOnAvatar() { click(By.cssSelector(".js-open-header-member-menu")); } public void clickOnProfile() { click(By.cssSelector("[data-test-id='header-member-menu-profile']")); } public void addPicture(String pathname) { attach(new File(pathname)); // Thread.sleep(1000); } public void clickOnChangeLanguage() { click(By.cssSelector("[data-test-id='header-member-menu-lang']")); } public void changeLangageTo(String toLang) { int countOfLang = driver.findElements(By.xpath("//*[@data-test-id='header-member-menu-popover']//li")).size(); for (int i = 1; i <= countOfLang; i++) { String lang = driver.findElement(By.xpath("//div[@class='_3n2uNSrVwAmo1u _3lA-VqbTFB0ciD']//li[" + i + "]")).getText(); if (lang.equals(toLang)) { click(By.xpath("//div[@class='_3n2uNSrVwAmo1u _3lA-VqbTFB0ciD']//li[" + i + "]")); return; } } } public String currentLang() { return driver.findElement(By.xpath("//*[@name=\"check\"]/..")).getText(); } public void closeMenuProfile() { click(By.cssSelector("[data-test-id='popover-close']")); } }
9,334
https://github.com/mogul/cg-provision/blob/master/scripts/bootstrap/destroy-02-bootstrap-concourse.sh
Github Open Source
Open Source
CC0-1.0
2,020
cg-provision
mogul
Shell
Code
116
506
#!/bin/bash # # This script is used to really destroy everything in step 2 # including the volume that has postgres on it so that there # is no state getting in the way. # set -eux az=$(aws ec2 describe-availability-zones | jq -r '.AvailabilityZones[0].ZoneName') # Collect AWS variables bosh interpolate \ ./bosh/varsfiles/collect-aws-variables.yml \ -l ${WORKSPACE_DIR}/terraform-outputs.json \ -l ${WORKSPACE_DIR}/aws-keypair.json \ > ${WORKSPACE_DIR}/aws-variables.yml # Deploy bootstrap concourse bosh delete-env ../concourse-deployment/lite/concourse.yml \ --state ${WORKSPACE_DIR}/bootstrap-concourse-state.json \ --vars-store ${WORKSPACE_DIR}/bootstrap-concourse-creds.yml \ -o ../concourse-deployment/lite/infrastructures/aws.yml \ -o ./bosh/opsfiles/basic-auth.yml \ -o ./bosh/opsfiles/self-signed-tls.yml \ -o ./bosh/opsfiles/iam-instance-profile.yml \ -o ./bosh/opsfiles/bootstrap-instance-size.yml \ -l ../concourse-deployment/versions.yml \ -o ./bosh/opsfiles/ssh-tunnel.yml \ -o ./bosh/opsfiles/vip-network.yml \ -l ${WORKSPACE_DIR}/aws-variables.yml \ -v region=${AWS_DEFAULT_REGION} \ -v default_key_name=bootstrap \ -v az=${az} \ -v access_key_id=${AWS_ACCESS_KEY_ID} \ -v secret_access_key=${AWS_SECRET_ACCESS_KEY}
30,060
https://github.com/kzvd4729/Problem-Solving/blob/master/codeforces/A - Dreamoon Likes Coloring/Wrong answer on test 53 (2).cpp
Github Open Source
Open Source
MIT
2,022
Problem-Solving
kzvd4729
C++
Code
83
457
/**************************************************************************************** * @author: kzvd4729 created: Apr/13/2020 10:54 * solution_verdict: Wrong answer on test 53 language: GNU C++14 * run_time: 61 ms memory_used: 7800 KB * problem: https://codeforces.com/contest/1329/problem/A ****************************************************************************************/ #include<bits/stdc++.h> #define long long long using namespace std; const int N=1e6; int aa[N+2],ans[N+2]; void no() { cout<<-1<<endl,exit(0); } int main() { ios_base::sync_with_stdio(0);cin.tie(0); int n,m;cin>>n>>m; for(int i=1;i<=m;i++) { cin>>aa[i]; if(i+aa[i]-1>n)no(); } int em=n; for(int i=1;i<=m;i++) em=min(em,n-(i+aa[i]-1)); int ad=0,mx=0; for(int i=1;i<=m;i++) { ans[i]=i+ad;//if(i==m)continue; mx=max(mx,ans[i]+aa[i]-1); if(aa[i]-1<em)em-=(aa[i]-1),ad+=aa[i]-1; else {ad+=em;em=0;} } if(mx>n)assert(0); if(mx!=n)no(); for(int i=1;i<=m;i++)cout<<ans[i]<<" "; cout<<endl; return 0; }
2,525
https://github.com/mwiebe/dynd-python/blob/master/dynd/src/numpy_type_interop.cpp
Github Open Source
Open Source
BSD-2-Clause
2,021
dynd-python
mwiebe
C++
Code
1,301
5,795
// // Copyright (C) 2011-16 DyND Developers // BSD 2-Clause License, see LICENSE.txt // // This header defines some functions to // interoperate with numpy // #include "numpy_type_interop.hpp" #if DYND_NUMPY_INTEROP #include <dynd/types/struct_type.hpp> #include <numpy/arrayscalars.h> using namespace std; PyArray_Descr *pydynd::numpy_dtype_from__type(const dynd::ndt::type &tp) { switch (tp.get_id()) { case dynd::bool_id: return PyArray_DescrFromType(NPY_BOOL); case dynd::int8_id: return PyArray_DescrFromType(NPY_INT8); case dynd::int16_id: return PyArray_DescrFromType(NPY_INT16); case dynd::int32_id: return PyArray_DescrFromType(NPY_INT32); case dynd::int64_id: return PyArray_DescrFromType(NPY_INT64); case dynd::uint8_id: return PyArray_DescrFromType(NPY_UINT8); case dynd::uint16_id: return PyArray_DescrFromType(NPY_UINT16); case dynd::uint32_id: return PyArray_DescrFromType(NPY_UINT32); case dynd::uint64_id: return PyArray_DescrFromType(NPY_UINT64); case dynd::float32_id: return PyArray_DescrFromType(NPY_FLOAT32); case dynd::float64_id: return PyArray_DescrFromType(NPY_FLOAT64); case dynd::complex_float32_id: return PyArray_DescrFromType(NPY_CFLOAT); case dynd::complex_float64_id: return PyArray_DescrFromType(NPY_CDOUBLE); case dynd::fixed_string_id: { const dynd::ndt::fixed_string_type *ftp = tp.extended<dynd::ndt::fixed_string_type>(); PyArray_Descr *result; switch (ftp->get_encoding()) { case dynd::string_encoding_ascii: result = PyArray_DescrNewFromType(NPY_STRING); result->elsize = (int)ftp->get_data_size(); return result; case dynd::string_encoding_utf_32: result = PyArray_DescrNewFromType(NPY_UNICODE); result->elsize = (int)ftp->get_data_size(); return result; default: break; } break; } /* case tuple_id: { const tuple_type *ttp = tp.extended<tuple_type>(); const vector<ndt::type>& fields = ttp->get_fields(); size_t num_fields = fields.size(); const vector<size_t>& offsets = ttp->get_offsets(); // TODO: Deal with the names better pyobject_ownref names_obj(PyList_New(num_fields)); for (size_t i = 0; i < num_fields; ++i) { stringstream ss; ss << "f" << i; PyList_SET_ITEM((PyObject *)names_obj, i, PyString_FromString(ss.str().c_str())); } pyobject_ownref formats_obj(PyList_New(num_fields)); for (size_t i = 0; i < num_fields; ++i) { PyList_SET_ITEM((PyObject *)formats_obj, i, (PyObject *)numpy_dtype_from__type(fields[i])); } pyobject_ownref offsets_obj(PyList_New(num_fields)); for (size_t i = 0; i < num_fields; ++i) { PyList_SET_ITEM((PyObject *)offsets_obj, i, PyLong_FromSize_t(offsets[i])); } pyobject_ownref itemsize_obj(PyLong_FromSize_t(tp.get_data_size())); pyobject_ownref dict_obj(PyDict_New()); PyDict_SetItemString(dict_obj, "names", names_obj); PyDict_SetItemString(dict_obj, "formats", formats_obj); PyDict_SetItemString(dict_obj, "offsets", offsets_obj); PyDict_SetItemString(dict_obj, "itemsize", itemsize_obj); PyArray_Descr *result = NULL; if (PyArray_DescrConverter(dict_obj, &result) != NPY_SUCCEED) { throw dynd::type_error("failed to convert tuple dtype into numpy dtype via dict"); } return result; } case struct_id: { const struct_type *ttp = tp.extended<struct_type>(); size_t field_count = ttp->get_field_count(); size_t max_numpy_alignment = 1; std::vector<uintptr_t> offsets(field_count); struct_type::fill_default_data_offsets(field_count, ttp->get_field_types_raw(), offsets.data()); pyobject_ownref names_obj(PyList_New(field_count)); for (size_t i = 0; i < field_count; ++i) { const string_type_data& fname = ttp->get_field_name(i); #if PY_VERSION_HEX >= 0x03000000 pyobject_ownref name_str(PyUnicode_FromStringAndSize( fname.begin, fname.end - fname.begin)); #else pyobject_ownref name_str(PyString_FromStringAndSize( fname.begin, fname.end - fname.begin)); #endif PyList_SET_ITEM((PyObject *)names_obj, i, name_str.release()); } pyobject_ownref formats_obj(PyList_New(field_count)); for (size_t i = 0; i < field_count; ++i) { PyArray_Descr *npdt = numpy_dtype_from__type(ttp->get_field_type(i)); max_numpy_alignment = max(max_numpy_alignment, (size_t)npdt->alignment); PyList_SET_ITEM((PyObject *)formats_obj, i, (PyObject *)npdt); } pyobject_ownref offsets_obj(PyList_New(field_count)); for (size_t i = 0; i < field_count; ++i) { PyList_SET_ITEM((PyObject *)offsets_obj, i, PyLong_FromSize_t(offsets[i])); } pyobject_ownref itemsize_obj(PyLong_FromSize_t(tp.get_default_data_size())); pyobject_ownref dict_obj(PyDict_New()); PyDict_SetItemString(dict_obj, "names", names_obj); PyDict_SetItemString(dict_obj, "formats", formats_obj); PyDict_SetItemString(dict_obj, "offsets", offsets_obj); PyDict_SetItemString(dict_obj, "itemsize", itemsize_obj); // This isn't quite right, but the rules between numpy and dynd // differ enough to make this tricky. if (max_numpy_alignment > 1 && max_numpy_alignment == tp.get_data_alignment()) { Py_INCREF(Py_True); PyDict_SetItemString(dict_obj, "aligned", Py_True); } PyArray_Descr *result = NULL; if (PyArray_DescrConverter(dict_obj, &result) != NPY_SUCCEED) { stringstream ss; ss << "failed to convert dtype " << tp << " into numpy dtype via dict"; throw dynd::type_error(ss.str()); } return result; } case fixed_dim_id: { ndt::type child_tp = tp; vector<intptr_t> shape; do { const cfixed_dim_type *ttp = child_tp.extended<cfixed_dim_type>(); shape.push_back(ttp->get_fixed_dim_size()); if (child_tp.get_data_size() != ttp->get_element_type().get_data_size() * shape.back()) { stringstream ss; ss << "Cannot convert dynd type " << tp << " into a numpy dtype because it is not C-order"; throw dynd::type_error(ss.str()); } child_tp = ttp->get_element_type(); } while (child_tp.get_id() == cfixed_dim_id); pyobject_ownref dtype_obj((PyObject *)numpy_dtype_from__type(child_tp)); pyobject_ownref shape_obj(intptr_array_as_tuple((int)shape.size(), &shape[0])); pyobject_ownref tuple_obj(PyTuple_New(2)); PyTuple_SET_ITEM(tuple_obj.get(), 0, dtype_obj.release()); PyTuple_SET_ITEM(tuple_obj.get(), 1, shape_obj.release()); PyArray_Descr *result = NULL; if (PyArray_DescrConverter(tuple_obj, &result) != NPY_SUCCEED) { throw dynd::type_error("failed to convert dynd type into numpy subarray dtype"); } return result; } */ default: break; } stringstream ss; ss << "cannot convert dynd type " << tp << " into a Numpy dtype"; throw dynd::type_error(ss.str()); } PyArray_Descr *pydynd::numpy_dtype_from__type(const dynd::ndt::type &tp, const char *arrmeta) { switch (tp.get_id()) { case dynd::struct_id: { throw std::runtime_error("converting"); if (arrmeta == NULL) { stringstream ss; ss << "Can only convert dynd type " << tp << " into a numpy dtype with array arrmeta"; throw dynd::type_error(ss.str()); } const dynd::ndt::struct_type *stp = tp.extended<dynd::ndt::struct_type>(); const uintptr_t *arrmeta_offsets = stp->get_arrmeta_offsets_raw(); const uintptr_t *offsets = reinterpret_cast<const uintptr_t *>(arrmeta); size_t field_count = stp->get_field_count(); size_t max_numpy_alignment = 1; pyobject_ownref names_obj(PyList_New(field_count)); for (size_t i = 0; i < field_count; ++i) { const dynd::string &fname = stp->get_field_name(i); #if PY_VERSION_HEX >= 0x03000000 pyobject_ownref name_str(PyUnicode_FromStringAndSize(fname.begin(), fname.end() - fname.begin())); #else pyobject_ownref name_str(PyString_FromStringAndSize(fname.begin(), fname.end() - fname.begin())); #endif PyList_SET_ITEM((PyObject *)names_obj, i, name_str.release()); } pyobject_ownref formats_obj(PyList_New(field_count)); for (size_t i = 0; i < field_count; ++i) { PyArray_Descr *npdt = numpy_dtype_from__type(stp->get_field_type(i), arrmeta + arrmeta_offsets[i]); max_numpy_alignment = max(max_numpy_alignment, (size_t)npdt->alignment); PyList_SET_ITEM((PyObject *)formats_obj, i, (PyObject *)npdt); } pyobject_ownref offsets_obj(PyList_New(field_count)); for (size_t i = 0; i < field_count; ++i) { PyList_SET_ITEM((PyObject *)offsets_obj, i, PyLong_FromSize_t(offsets[i])); } pyobject_ownref itemsize_obj(PyLong_FromSize_t(tp.get_data_size())); pyobject_ownref dict_obj(PyDict_New()); PyDict_SetItemString(dict_obj, "names", names_obj); PyDict_SetItemString(dict_obj, "formats", formats_obj); PyDict_SetItemString(dict_obj, "offsets", offsets_obj); PyDict_SetItemString(dict_obj, "itemsize", itemsize_obj); // This isn't quite right, but the rules between numpy and dynd // differ enough to make this tricky. if (max_numpy_alignment > 1 && max_numpy_alignment == tp.get_data_alignment()) { Py_INCREF(Py_True); PyDict_SetItemString(dict_obj, "aligned", Py_True); } PyArray_Descr *result = NULL; if (PyArray_DescrConverter(dict_obj, &result) != NPY_SUCCEED) { throw dynd::type_error("failed to convert dtype into numpy struct dtype via dict"); } return result; } default: return numpy_dtype_from__type(tp); } } int pydynd::_type_from_numpy_scalar_typeobject(PyTypeObject *obj, dynd::ndt::type &out_d) { if (obj == &PyBoolArrType_Type) { out_d = dynd::ndt::make_type<dynd::bool1>(); } else if (obj == &PyByteArrType_Type) { out_d = dynd::ndt::make_type<npy_byte>(); } else if (obj == &PyUByteArrType_Type) { out_d = dynd::ndt::make_type<npy_ubyte>(); } else if (obj == &PyShortArrType_Type) { out_d = dynd::ndt::make_type<npy_short>(); } else if (obj == &PyUShortArrType_Type) { out_d = dynd::ndt::make_type<npy_ushort>(); } else if (obj == &PyIntArrType_Type) { out_d = dynd::ndt::make_type<npy_int>(); } else if (obj == &PyUIntArrType_Type) { out_d = dynd::ndt::make_type<npy_uint>(); } else if (obj == &PyLongArrType_Type) { out_d = dynd::ndt::make_type<npy_long>(); } else if (obj == &PyULongArrType_Type) { out_d = dynd::ndt::make_type<npy_ulong>(); } else if (obj == &PyLongLongArrType_Type) { out_d = dynd::ndt::make_type<npy_longlong>(); } else if (obj == &PyULongLongArrType_Type) { out_d = dynd::ndt::make_type<npy_ulonglong>(); } else if (obj == &PyFloatArrType_Type) { out_d = dynd::ndt::make_type<npy_float>(); } else if (obj == &PyDoubleArrType_Type) { out_d = dynd::ndt::make_type<npy_double>(); } else if (obj == &PyCFloatArrType_Type) { out_d = dynd::ndt::make_type<dynd::complex<float>>(); } else if (obj == &PyCDoubleArrType_Type) { out_d = dynd::ndt::make_type<dynd::complex<double>>(); } else { return -1; } return 0; } dynd::ndt::type pydynd::_type_of_numpy_scalar(PyObject *obj) { if (PyArray_IsScalar(obj, Bool)) { return dynd::ndt::make_type<dynd::bool1>(); } else if (PyArray_IsScalar(obj, Byte)) { return dynd::ndt::make_type<npy_byte>(); } else if (PyArray_IsScalar(obj, UByte)) { return dynd::ndt::make_type<npy_ubyte>(); } else if (PyArray_IsScalar(obj, Short)) { return dynd::ndt::make_type<npy_short>(); } else if (PyArray_IsScalar(obj, UShort)) { return dynd::ndt::make_type<npy_ushort>(); } else if (PyArray_IsScalar(obj, Int)) { return dynd::ndt::make_type<npy_int>(); } else if (PyArray_IsScalar(obj, UInt)) { return dynd::ndt::make_type<npy_uint>(); } else if (PyArray_IsScalar(obj, Long)) { return dynd::ndt::make_type<npy_long>(); } else if (PyArray_IsScalar(obj, ULong)) { return dynd::ndt::make_type<npy_ulong>(); } else if (PyArray_IsScalar(obj, LongLong)) { return dynd::ndt::make_type<npy_longlong>(); } else if (PyArray_IsScalar(obj, ULongLong)) { return dynd::ndt::make_type<npy_ulonglong>(); } else if (PyArray_IsScalar(obj, Float)) { return dynd::ndt::make_type<float>(); } else if (PyArray_IsScalar(obj, Double)) { return dynd::ndt::make_type<double>(); } else if (PyArray_IsScalar(obj, CFloat)) { return dynd::ndt::make_type<dynd::complex<float>>(); } else if (PyArray_IsScalar(obj, CDouble)) { return dynd::ndt::make_type<dynd::complex<double>>(); } throw dynd::type_error("could not deduce a pydynd type from the numpy scalar object"); } dynd::ndt::type pydynd::array_from_numpy_array2(PyArrayObject *obj) { PyArray_Descr *dtype = PyArray_DESCR(obj); if (PyDataType_FLAGCHK(dtype, NPY_ITEM_HASOBJECT)) { return dynd::ndt::make_type(PyArray_NDIM(obj), PyArray_SHAPE(obj), pydynd::_type_from_numpy_dtype(dtype).get_canonical_type()); } else { // Get the dtype of the array dynd::ndt::type d = pydynd::_type_from_numpy_dtype(PyArray_DESCR(obj), get_alignment_of(obj)); return dynd::ndt::make_type(PyArray_NDIM(obj), PyArray_DIMS(obj), d); } } dynd::ndt::type pydynd::array_from_numpy_scalar2(PyObject *obj) { if (PyArray_IsScalar(obj, Bool)) { return dynd::ndt::make_type<bool>(); } if (PyArray_IsScalar(obj, Byte)) { return dynd::ndt::make_type<signed char>(); } if (PyArray_IsScalar(obj, UByte)) { return dynd::ndt::make_type<unsigned char>(); } if (PyArray_IsScalar(obj, Short)) { return dynd::ndt::make_type<short>(); } if (PyArray_IsScalar(obj, UShort)) { return dynd::ndt::make_type<unsigned short>(); } if (PyArray_IsScalar(obj, Int)) { return dynd::ndt::make_type<int>(); } if (PyArray_IsScalar(obj, UInt)) { return dynd::ndt::make_type<unsigned int>(); } if (PyArray_IsScalar(obj, Long)) { return dynd::ndt::make_type<long>(); } if (PyArray_IsScalar(obj, ULong)) { return dynd::ndt::make_type<unsigned long>(); } if (PyArray_IsScalar(obj, LongLong)) { return dynd::ndt::make_type<long long>(); } if (PyArray_IsScalar(obj, ULongLong)) { return dynd::ndt::make_type<unsigned long long>(); } if (PyArray_IsScalar(obj, Float)) { return dynd::ndt::make_type<float>(); } if (PyArray_IsScalar(obj, Double)) { return dynd::ndt::make_type<double>(); } if (PyArray_IsScalar(obj, CFloat)) { return dynd::ndt::make_type<dynd::complex<float>>(); } if (PyArray_IsScalar(obj, CDouble)) { return dynd::ndt::make_type<dynd::complex<double>>(); } if (PyArray_IsScalar(obj, Void)) { return dynd::ndt::make_type<void>(); } stringstream ss; pyobject_ownref obj_tp(PyObject_Repr((PyObject *)Py_TYPE(obj))); ss << "could not create a dynd array from the numpy scalar object"; ss << " of type " << pydynd::pystring_as_string(obj_tp.get()); throw dynd::type_error(ss.str()); } bool pydynd::is_numpy_dtype(PyObject *o) { return PyArray_DescrCheck(o); } #endif
12,541
https://github.com/R-N/sistem_gaji_vue_thrift/blob/master/frontend/src/components/overlay/LoadingOverlay.vue
Github Open Source
Open Source
MIT
null
sistem_gaji_vue_thrift
R-N
Vue
Code
162
619
<template> <v-overlay :value="busy"> <v-container class="fill-height" fluid > <v-row align="center" justify="center" class="flex-column" > <v-progress-circular indeterminate :size="circleSize"> <refresh-button icon large v-if="mayRefresh"/> </v-progress-circular> </v-row> </v-container> </v-overlay> </template> <script> import { appStore } from '@/store/modules/app'; import { Component, Prop, Watch } from 'vue-property-decorator'; import { WorkingComponent } from '@/components/WorkingComponent'; import RefreshButton from '@/components/general/RefreshButton'; @Component({ name: "LoadingOverlay", components: { RefreshButton } }) class LoadingOverlay extends WorkingComponent { @Prop({ default: 96 }) circleSizeRefresh @Prop({ default: 64 }) circleSizeNormal @Prop({ default: 5 }) mayRefreshWait mayRefresh = false; mayRefreshTimer = null; mounted(){ console.log("mayRefreshWait: " + this.mayRefreshWait); this.setTimer(this.busy); } get mayRefreshWaitMillis(){ return this.mayRefreshWait * 1000; } get circleSize(){ return this.mayRefresh ? this.circleSizeRefresh : this.circleSizeNormal; } @Watch('busy') onBusyChanged(val, oldVal){ console.log("Busy changed: " + val); if (val != oldVal){ this.setTimer(val); } } setTimer(busy){ if (this.mayRefreshTimer) window.clearTimeout(this.mayRefreshTimer); if (busy){ const comp = this; this.mayRefreshTimer = window.setTimeout(function(){ comp.mayRefresh = true; }, this.mayRefreshWaitMillis); } else { this.mayRefreshTimer = null; this.mayRefresh = false; } } } export { LoadingOverlay } export default LoadingOverlay </script> <style scoped> </style>
48,340
https://github.com/eval-apply/Gauche/blob/master/lib/srfi-143.scm
Github Open Source
Open Source
BSD-3-Clause
2,022
Gauche
eval-apply
Scheme
Code
8
28
;; srfi-143 became scheme.fixnum (define-module srfi-143 (extend scheme.fixnum))
12,248
https://github.com/gravicle/hacker/blob/master/Models/MappableArrayOfManagedObjects.swift
Github Open Source
Open Source
MIT
2,020
hacker
gravicle
Swift
Code
63
168
import Mapper import CoreData extension Mapper { func from<T: JSONDecodable>(_ field: String, in context: NSManagedObjectContext) throws -> [T] { let value = try self.JSONFromField(field) guard let JSON = value as? [NSDictionary] else { throw MapperError.typeMismatchError(field: field, value: value, type: [NSDictionary].self) } return JSON.flatMap { do { return try T(map: Mapper(JSON: $0), context: context) } catch { print(error) return nil } } } }
43,416
https://github.com/bloXroute-Labs/bxcommon/blob/master/test/unit/utils/test_limited_size_set.py
Github Open Source
Open Source
MIT
2,022
bxcommon
bloXroute-Labs
Python
Code
76
389
from bxcommon.test_utils.abstract_test_case import AbstractTestCase from bxcommon.utils.limited_size_set import LimitedSizeSet class LimitedSizeSetTest(AbstractTestCase): def setUp(self) -> None: self.sut = LimitedSizeSet(5) for i in range(5): self.sut.add(i) def test_contains(self): for i in range(5): self.assertIn(i, self.sut) def test_expiring_items(self): self.sut.add(6) self.assertEqual(5, len(self.sut)) self.assertNotIn(0, self.sut) self.assertIn(1, self.sut) def test_overfilled_set(self): for i in range(5, 10): self.sut.add(i) self.sut.add(10) self.assertEqual(5, len(self.sut)) for i in range(6): self.assertNotIn(i, self.sut) for i in range(7, 11): self.assertIn(i, self.sut) def test_set_handles_duplicate_items(self): for i in range(0, 5): self.sut.add(i) self.sut.add(4) self.assertEqual(5, len(self.sut)) self.assertIn(0, self.sut)
30,072
https://github.com/devcafe-latte/deadbolt/blob/master/src/model/middlewares.ts
Github Open Source
Open Source
MIT
null
deadbolt
devcafe-latte
TypeScript
Code
179
461
import { Request, Response } from 'express'; import container from './DiContainer'; import { hasProperties } from './helpers'; // Injects _user and _indentifier into request.params export const userMiddleware = async (req: Request, res: Response, next: Function) => { if (req.body) { const body = req.body; const identifier = req.params.identifier || body.identifier || body.uuid || body.username || body.email || body.id || req.query.identifier; if (!identifier) { return res .status(400) .send({ status: "failed", reason: "Missing identifier" }) } req.params._identifier = identifier; req.params._user = await container.um.getUser(identifier); if (!req.params._user) { return res .status(404) .send({ status: "failed", reason: "User not found" }) } next(); } }; export const userActiveMiddleware = async (req: Request, res: Response, next: Function) => { if (!req.params._user) { return res .status(404) .send({ status: "failed", reason: "User not found" }) } if (!req.params._user.active) { return res .status(422) .send({ status: "failed", reason: "User not active" }) } next(); } export function requiredBody(...args: any[]) { return async (req: Request, res: Response, next: Function) => { if (!hasProperties(req.body, args)) { return res .status(400) .send({ status: "failed", reason: "Missing arguments", required: args }); } next(); }; }
14,454
https://github.com/jpmckinney/multi_mail/blob/master/lib/multi_mail/postmark/message.rb
Github Open Source
Open Source
MIT
2,020
multi_mail
jpmckinney
Ruby
Code
211
733
module MultiMail module Message # @see http://developer.postmarkapp.com/developer-build.html#message-format class Postmark < MultiMail::Message::Base attr_accessor :mailboxhash, :messageid, :tag # Returns the message headers in Postmark format. # # @return [Array<Hash>] the message headers in Postmark format def postmark_headers array = [] header_fields.each do |field| key = field.name.downcase # @see https://github.com/wildbit/postmark-gem/blob/master/lib/postmark/message_extensions/mail.rb#L74 # @see https://github.com/wildbit/postmark-gem/pull/36#issuecomment-22298955 unless %w(from to cc bcc reply-to subject tag content-type date).include?(key) || (Array === field.value && field.value.size > 1) array << {'Name' => field.name, 'Value' => field.value} end end array end # Returns the message's attachments in Postmark format. # # @return [Array<Hash>] the attachments in Postmark format # @see http://developer.postmarkapp.com/developer-build.html#attachments def postmark_attachments attachments.map do |attachment| hash = { 'ContentType' => attachment.content_type, 'Name' => attachment.filename, 'Content' => Base64.encode64(attachment.body.decoded) } if attachment.content_type.start_with?('image/') hash['ContentID'] = attachment.filename end hash end end # Returns the message as parameters to POST to Postmark. # # @return [Hash] the message as parameters to POST to Postmark def to_postmark_hash hash = {} %w(from subject).each do |field| if self[field] hash[postmark_key(field)] = self[field].value end end %w(to cc bcc reply_to).each do |field| if self[field] value = self[field].value hash[postmark_key(field)] = value.respond_to?(:join) ? value.join(', ') : value end end hash['TextBody'] = body_text hash['HtmlBody'] = body_html hash['Headers'] = postmark_headers hash['Attachments'] = postmark_attachments hash['Tag'] = tags.first normalize(hash) end private def postmark_key(string) string.downcase.split(/[_-]/).map(&:capitalize).join end end end end
39,870
https://github.com/alavit-d/mod1/blob/master/ground.js
Github Open Source
Open Source
MIT
null
mod1
alavit-d
JavaScript
Code
477
1,668
var ImprovedNoise = function () { var p = [151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10, 23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87, 174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211, 133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208, 89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5, 202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119, 248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232, 178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249, 14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205, 93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180]; for (var i=0; i < 256 ; i++) { p[256+i] = p[i]; } function fade(t) { return t * t * t * (t * (t * 6 - 15) + 10); } function lerp(t, a, b) { return a + t * (b - a); } function grad(hash, x, y, z) { var h = hash & 15; var u = h < 8 ? x : y, v = h < 4 ? y : h == 12 || h == 14 ? x : z; return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v : -v); } return { noise: function (x, y, z) { var floorX = ~~x, floorY = ~~y, floorZ = ~~z; var X = floorX & 255, Y = floorY & 255, Z = floorZ & 255; x -= floorX; y -= floorY; z -= floorZ; var xMinus1 = x -1, yMinus1 = y - 1, zMinus1 = z - 1; var u = fade(x), v = fade(y), w = fade(z); var A = p[X]+Y, AA = p[A]+Z, AB = p[A+1]+Z, B = p[X+1]+Y, BA = p[B]+Z, BB = p[B+1]+Z; return lerp(w, lerp(v, lerp(u, grad(p[AA], x, y, z), grad(p[BA], xMinus1, y, z)), lerp(u, grad(p[AB], x, yMinus1, z), grad(p[BB], xMinus1, yMinus1, z))), lerp(v, lerp(u, grad(p[AA+1], x, y, zMinus1), grad(p[BA+1], xMinus1, y, z-1)), lerp(u, grad(p[AB+1], x, yMinus1, zMinus1), grad(p[BB+1], xMinus1, yMinus1, zMinus1)))); } } } function generateNoise( ground, width, coef, no1, no2 ) { perlin = new ImprovedNoise(), size = width * width, quality = 2, z = Math.random() * 100; for ( var j = 0; j < 4; j ++ ) { quality *= 4; for ( var i = 0; i < size; i ++ ) { var x = i % width, y = ~~ ( i / width ); ground[ i ] += Math.abs( perlin.noise( x / quality, y / quality, z ) * coef ) * quality + 10; } } //return ground; } function generateHill(ground, width, x1, y1, r) { for (var i = 0; i < width * width; i++) { var x = i % width, y = Math.floor(i / width); tmp = Math.pow(r, 2) - (Math.pow(x - x1, 2) + Math.pow(y - y1, 2)); ground[i] += (tmp > 0 ? Math.floor(tmp/1000) : 0); } //return ground; } function generateGround(width, operationList) { var ground = new Float64Array(width * width, 0); for(var i = 0; i < operationList.length; i++) { operationList[i].gen(ground, width, operationList[i].arg[0], operationList[i].arg[1], operationList[i].arg[2]); } return ground; } //define globals here var width = 1024; var operationList = [ {gen: generateNoise, arg: [0.1, 0, 0]}, {gen: generateHill, arg: [564, 564, 400]}, {gen: generateHill, arg: [800, 100, 300]}, {gen: generateHill, arg: [0, 100, 300]} ]; var ground = generateGround(width, operationList);
15,264
https://github.com/yonashub/karrot-frontend/blob/master/src/activities/api/activities.js
Github Open Source
Open Source
MIT
2,022
karrot-frontend
yonashub
JavaScript
Code
354
1,192
import axios, { parseCursor } from '@/base/api/axios' import { convert as convertConversation } from '@/messages/api/conversations' import { absoluteURL } from '@/utils/absoluteURL' import { toFormData, underscorizeKeys } from '@/utils/utils' export default { async create (activity) { return convert((await axios.post('/api/activities/', await toFormData(convertDateToRange(activity)))).data) }, async get (activityId) { return convert((await axios.get(`/api/activities/${activityId}/`)).data) }, async getByPublicId (activityPublicId) { return convert((await axios.get(`/api/public-activities/${activityPublicId}/`)).data) }, async list (filter) { const params = filter || { dateMin: new Date() } const response = (await axios.get('/api/activities/', { params: underscorizeKeys(params) })).data return { ...response, next: parseCursor(response.next), results: convert(response.results), } }, async listPublic (filter) { const params = filter || { dateMin: new Date() } const response = (await axios.get('/api/public-activities/', { params: underscorizeKeys(params) })).data return { ...response, next: parseCursor(response.next), results: convert(response.results), } }, async listByGroupId (groupId) { return this.list({ group: groupId, dateMin: new Date() }) }, async listByPlaceId (placeId) { return this.list({ place: placeId, dateMin: new Date() }) }, async listBySeriesId (seriesId) { return this.list({ series: seriesId, dateMin: new Date() }) }, async listFeedbackPossible (groupId) { return this.list({ feedbackPossible: true, group: groupId }) }, icsUrl (filter) { return axios.getUri({ params: filter, url: absoluteURL('/api/activities/ics/'), }) }, publicIcsUrl (filter) { return axios.getUri({ params: filter, url: absoluteURL('/api/public-activities/ics/'), }) }, async getICSAuthToken () { return (await axios.get('/api/activities/ics_token/')).data }, async refreshICSAuthToken () { return (await axios.post('/api/activities/ics_token_refresh/')).data }, async save (activity) { return convert((await axios.patch(`/api/activities/${activity.id}/`, await toFormData(convertDateToRange(activity)))).data) }, async checkSave (activity) { const { id } = activity return (await axios.patch(`/api/activities/${id}/check/`, convertDateToRange(activity))).data }, async join ({ activityId, participantTypeId }) { return convert((await axios.post(`/api/activities/${activityId}/add/`, { participantType: participantTypeId })).data) }, async leave (activityId) { return convert((await axios.post(`/api/activities/${activityId}/remove/`, {})).data) }, async conversation (activityId) { return convertConversation((await axios.get(`/api/activities/${activityId}/conversation/`)).data) }, async dismissFeedback (activityId) { await axios.post(`/api/activities/${activityId}/dismiss_feedback/`, {}) }, } export function convert (val) { if (Array.isArray(val)) { return val.map(convert) } else { const result = { ...val } if (val.feedbackDue) { result.feedbackDue = new Date(val.feedbackDue) } if (val.date) { result.date = new Date(val.date[0]) result.dateEnd = new Date(val.date[1]) } return result } } export function convertDateToRange (activity) { const result = { ...activity } if (activity.date) { result.date = [activity.date] } if (activity.dateEnd) { if (!result.date) result.date = [] result.date[1] = activity.dateEnd delete result.dateEnd } return result }
2,221
https://github.com/Ultrawipf/actools/blob/master/AcTools.Render/Kn5SpecificForward/Materials/Kn5MaterialSimpleAtNm.cs
Github Open Source
Open Source
MS-PL
2,022
actools
Ultrawipf
C#
Code
74
289
using AcTools.Render.Base; using AcTools.Render.Base.Objects; using AcTools.Render.Kn5Specific.Materials; using AcTools.Render.Kn5Specific.Textures; using JetBrains.Annotations; namespace AcTools.Render.Kn5SpecificForward.Materials { public class Kn5MaterialSimpleAtNm : Kn5MaterialSimple { private IRenderableTexture _txNormal; public Kn5MaterialSimpleAtNm([NotNull] Kn5MaterialDescription description) : base(description) { } protected override void Initialize(IDeviceContextHolder contextHolder) { _txNormal = GetTexture("txNormal", contextHolder); base.Initialize(contextHolder); } public override bool Prepare(IDeviceContextHolder contextHolder, SpecialRenderMode mode) { if (!base.Prepare(contextHolder, mode)) return false; Effect.FxNormalMap.SetResource(_txNormal); return true; } public override void Draw(IDeviceContextHolder contextHolder, int indices, SpecialRenderMode mode) { Effect.TechAtNm.DrawAllPasses(contextHolder.DeviceContext, indices); } } }
7,462
https://github.com/EMSL-NMR-EPR/Ruby-Bruker-TopSpin-Library/blob/master/lib/bruker/top_spin.rb
Github Open Source
Open Source
ECL-2.0
2,019
Ruby-Bruker-TopSpin-Library
EMSL-NMR-EPR
Ruby
Code
23
135
module Bruker ### # Bruker TopSpin # # @see https://www.bruker.com/products/mr/nmr/nmr-software/software/topspin/overview.html module TopSpin autoload :PeakList, 'bruker/top_spin/peak_list' autoload :Shifts, 'bruker/top_spin/shifts' autoload :T1Peaks, 'bruker/top_spin/t1_peaks' end end
617
https://github.com/anarh/demo-scss-npm-module/blob/master/test/index.js
Github Open Source
Open Source
MIT
2,017
demo-scss-npm-module
anarh
JavaScript
Code
16
51
'use strict'; var test = require('tape'); test('base:function:test', function (t) { t.ok(typeof test === 'function'); t.end(); });
38,579
https://github.com/taiki-e/portable-atomic/blob/master/src/imp/interrupt/avr.rs
Github Open Source
Open Source
Apache-2.0, MIT
2,022
portable-atomic
taiki-e
Rust
Code
111
411
// Adapted from https://github.com/Rahix/avr-device. #[cfg(not(portable_atomic_no_asm))] use core::arch::asm; #[inline] pub(super) fn is_enabled() -> bool { let sreg: u8; unsafe { #[cfg(not(portable_atomic_no_asm))] asm!("in {},0x3F", out(reg) sreg, options(nomem, nostack, preserves_flags)); #[cfg(portable_atomic_no_asm)] llvm_asm!("in $0,0x3F" :"=r"(sreg) ::: "volatile"); } sreg & 0x80 != 0 } #[inline] pub(super) fn disable() { unsafe { // Do not use `nomem` because prevent subsequent memory accesses from being reordered before interrupts are disabled. #[cfg(not(portable_atomic_no_asm))] asm!("cli", options(nostack)); #[cfg(portable_atomic_no_asm)] llvm_asm!("cli" ::: "memory" : "volatile"); } } #[inline] pub(super) unsafe fn enable() { unsafe { // Do not use `nomem` because prevent preceding memory accesses from being reordered after interrupts are enabled. #[cfg(not(portable_atomic_no_asm))] asm!("sei", options(nostack)); #[cfg(portable_atomic_no_asm)] llvm_asm!("sei" ::: "memory" : "volatile"); } }
13,536
https://github.com/caryll/node-tin/blob/master/lib/libcff/charstring-il.c
Github Open Source
Open Source
Apache-2.0
2,022
node-tin
caryll
C
Code
2,283
7,860
#include "charstring-il.h" #include "table/glyf.h" // Glyph building static void ensureThereIsSpace(cff_CharstringIL *il) { if (il->free) return; il->free = 0x100; RESIZE(il->instr, il->length + il->free); } void il_push_operand(cff_CharstringIL *il, double x) { ensureThereIsSpace(il); il->instr[il->length].type = IL_ITEM_OPERAND; il->instr[il->length].d = x; il->instr[il->length].arity = 0; il->length++; il->free--; } void il_push_VQ(cff_CharstringIL *il, VQ x) { il_push_operand(il, iVQ.getStill(x)); } void il_push_special(cff_CharstringIL *il, int32_t s) { ensureThereIsSpace(il); il->instr[il->length].type = IL_ITEM_SPECIAL; il->instr[il->length].i = s; il->instr[il->length].arity = 0; il->length++; il->free--; } void il_push_op(cff_CharstringIL *il, int32_t op) { ensureThereIsSpace(il); il->instr[il->length].type = IL_ITEM_OPERATOR; il->instr[il->length].i = op; il->instr[il->length].arity = cff_getStandardArity(op); il->length++; il->free--; } static void il_moveto(cff_CharstringIL *il, VQ dx, VQ dy) { il_push_VQ(il, dx); il_push_VQ(il, dy); il_push_op(il, op_rmoveto); } static void il_lineto(cff_CharstringIL *il, VQ dx, VQ dy) { il_push_VQ(il, dx); il_push_VQ(il, dy); il_push_op(il, op_rlineto); } static void il_curveto(cff_CharstringIL *il, VQ dx1, VQ dy1, VQ dx2, VQ dy2, VQ dx3, VQ dy3) { il_push_VQ(il, dx1); il_push_VQ(il, dy1); il_push_VQ(il, dx2); il_push_VQ(il, dy2); il_push_VQ(il, dx3); il_push_VQ(il, dy3); il_push_op(il, op_rrcurveto); } static void _il_push_maskgroup(cff_CharstringIL *il, // il seq glyf_MaskList *masks, // masks array uint16_t contours, // contous drawn uint16_t points, // points drawn uint16_t nh, uint16_t nv, // quantity of stems uint16_t *jm, // index of cur mask int32_t op) { // mask operator shapeid_t n = masks->length; while (*jm < n && (masks->items[*jm].contoursBefore < contours || (masks->items[*jm].contoursBefore == contours && masks->items[*jm].pointsBefore <= points))) { il_push_op(il, op); uint8_t maskByte = 0; uint8_t bits = 0; for (uint16_t j = 0; j < nh; j++) { maskByte = maskByte << 1 | (masks->items[*jm].maskH[j] & 1); bits += 1; if (bits == 8) { il_push_special(il, maskByte); bits = 0; } } for (uint16_t j = 0; j < nv; j++) { maskByte = maskByte << 1 | (masks->items[*jm].maskV[j] & 1); bits += 1; if (bits == 8) { il_push_special(il, maskByte); bits = 0; } } if (bits) { maskByte = maskByte << (8 - bits); il_push_special(il, maskByte); } *jm += 1; } } static void il_push_masks(cff_CharstringIL *il, glyf_Glyph *g, // meta uint16_t contours, // contours sofar uint16_t points, // points sofar uint16_t *jh, // index of pushed cmasks uint16_t *jm // index of pushed hmasks ) { if (!g->stemH.length && !g->stemV.length) return; _il_push_maskgroup(il, &g->contourMasks, contours, points, // g->stemH.length, g->stemV.length, jh, op_cntrmask); _il_push_maskgroup(il, &g->hintMasks, contours, points, // g->stemH.length, g->stemV.length, jm, op_hintmask); } static void _il_push_stemgroup(cff_CharstringIL *il, // il seq glyf_StemDefList *stems, // stem array bool hasmask, bool haswidth, int32_t ophm, int32_t oph) { if (!stems || !stems->length) return; pos_t ref = 0; uint16_t nn = haswidth ? 1 : 0; for (uint16_t j = 0; j < stems->length; j++) { il_push_operand(il, stems->items[j].position - ref); il_push_operand(il, stems->items[j].width); ref = stems->items[j].position + stems->items[j].width; nn++; if (nn >= type2_argument_stack) { if (hasmask) { il_push_op(il, op_hstemhm); } else { il_push_op(il, op_hstem); } il->instr[il->length - 1].arity = nn; nn = 0; } } if (hasmask) { il_push_op(il, ophm); } else { il_push_op(il, oph); } il->instr[il->length - 1].arity = nn; } static void il_push_stems(cff_CharstringIL *il, glyf_Glyph *g, bool hasmask, bool haswidth) { _il_push_stemgroup(il, &g->stemH, hasmask, haswidth, op_hstemhm, op_hstem); _il_push_stemgroup(il, &g->stemV, hasmask, haswidth, op_vstemhm, op_vstem); } cff_CharstringIL *cff_compileGlyphToIL(glyf_Glyph *g, uint16_t defaultWidth, uint16_t nominalWidth) { cff_CharstringIL *il; NEW(il); // Convert absolute positions to deltas glyf_Contour *tempContours = NULL; { VQ x = iVQ.neutral(); VQ y = iVQ.neutral(); NEW(tempContours, g->contours.length); for (uint16_t c = 0; c < g->contours.length; c++) { glyf_Contour *contour = &(g->contours.items[c]); glyf_Contour *newcontour = &(tempContours[c]); glyf_iContour.init(newcontour); for (shapeid_t j = 0; j < contour->length; j++) { glyf_iContour.push(newcontour, glyf_iPoint.dup(contour->items[j])); } if (newcontour->length > 2 && !newcontour->items[newcontour->length - 1].onCurve) { // Duplicate first point for proper CurveTo generation glyf_iContour.push(newcontour, glyf_iPoint.dup(newcontour->items[0])); } for (shapeid_t j = 0; j < newcontour->length; j++) { VQ dx = iVQ.minus(newcontour->items[j].x, x); VQ dy = iVQ.minus(newcontour->items[j].y, y); iVQ.copyReplace(&x, newcontour->items[j].x); iVQ.copyReplace(&y, newcontour->items[j].y); iVQ.replace(&newcontour->items[j].x, dx); iVQ.replace(&newcontour->items[j].y, dy); } } iVQ.dispose(&x); iVQ.dispose(&y); } bool hasmask = g->hintMasks.length || g->contourMasks.length; // we have hint masks or contour masks const pos_t glyphADWConst = iVQ.getStill(g->advanceWidth); bool haswidth = glyphADWConst != defaultWidth; // we have width operand here // Write IL if (haswidth) { il_push_operand(il, (int)(glyphADWConst) - (int)(nominalWidth)); } il_push_stems(il, g, hasmask, haswidth); // Write contour shapeid_t contoursSofar = 0; shapeid_t pointsSofar = 0; shapeid_t jh = 0; shapeid_t jm = 0; if (hasmask) il_push_masks(il, g, contoursSofar, pointsSofar, &jh, &jm); for (shapeid_t c = 0; c < g->contours.length; c++) { glyf_Contour *contour = &(tempContours[c]); shapeid_t n = contour->length; if (n == 0) continue; il_moveto(il, contour->items[0].x, contour->items[0].y); pointsSofar++; if (hasmask) il_push_masks(il, g, contoursSofar, pointsSofar, &jh, &jm); // TODO: Generate BLENDs for (shapeid_t j = 1; j < n; j++) { if (contour->items[j].onCurve) { // A line-to il_lineto(il, contour->items[j].x, contour->items[j].y); pointsSofar += 1; } else if (j < n - 2 // have enough points && !contour->items[j + 1].onCurve // next is offcurve && contour->items[j + 2].onCurve // and next is oncurve ) { // means this is an bezier curve strand il_curveto(il, contour->items[j].x, contour->items[j].y, // dz1 contour->items[j + 1].x, contour->items[j + 1].y, // dz2 contour->items[j + 2].x, contour->items[j + 2].y); // dz3 pointsSofar += 3; j += 2; } else { // invalid offcurve, treat as oncurve il_lineto(il, contour->items[j].x, contour->items[j].y); pointsSofar++; } if (hasmask) il_push_masks(il, g, contoursSofar, pointsSofar, &jh, &jm); } contoursSofar += 1; pointsSofar = 0; } il_push_op(il, op_endchar); // delete temp contour array for (shapeid_t c = 0; c < g->contours.length; c++) { glyf_iContour.dispose(&tempContours[c]); } FREE(tempContours); return il; } // Pattern-based peephole optimization static bool il_matchtype(cff_CharstringIL *il, uint32_t j, uint32_t k, cff_InstructionType t) { if (k >= il->length) return false; for (uint32_t m = j; m < k; m++) { if (il->instr[m].type != t) return false; } return true; } static bool il_matchop(cff_CharstringIL *il, uint32_t j, int32_t op) { if (il->instr[j].type != IL_ITEM_OPERATOR) return false; if (il->instr[j].i != op) return false; return true; } static uint8_t zroll(cff_CharstringIL *il, uint32_t j, int32_t op, int32_t op2, ...) { uint8_t arity = cff_getStandardArity(op); if (arity > 16 || j + arity >= il->length) return 0; if ((j == 0 || // We are at the beginning of charstring !il_matchtype(il, j - 1, j, IL_ITEM_PHANTOM_OPERATOR)) // .. or we are right after a solid operator && il_matchop(il, j + arity, op) // The next operator is <op> && il_matchtype(il, j, j + arity, IL_ITEM_OPERAND) // And we have correct number of operands ) { va_list ap; uint8_t check = true; uint8_t resultArity = arity; bool mask[16]; va_start(ap, op2); for (uint32_t m = 0; m < arity; m++) { int checkzero = va_arg(ap, int); mask[m] = checkzero; if (checkzero) { resultArity -= 1; check = check && il->instr[j + m].d == 0; } } va_end(ap); if (check) { for (uint32_t m = 0; m < arity; m++) { if (mask[m]) { il->instr[j + m].type = IL_ITEM_PHANTOM_OPERAND; } } il->instr[j + arity].i = op2; il->instr[j + arity].arity = resultArity; return arity; } else { return 0; } } else { return 0; } } static uint8_t opop_roll(cff_CharstringIL *il, uint32_t j, int32_t op1, int32_t arity, int32_t op2, int32_t resultop) { if (j + 1 + arity >= il->length) return 0; cff_CharstringInstruction *current = &(il->instr[j]); cff_CharstringInstruction *nextop = &(il->instr[j + 1 + arity]); if (il_matchop(il, j, op1) // match this operator && il_matchtype(il, j + 1, j + 1 + arity, IL_ITEM_OPERAND) // match operands && il_matchop(il, j + 1 + arity, op2) // match next operator && current->arity + nextop->arity <= type2_argument_stack // stack is not full ) { current->type = IL_ITEM_PHANTOM_OPERATOR; nextop->i = resultop; nextop->arity += current->arity; return arity + 1; } else { return 0; } } static uint8_t hvlineto_roll(cff_CharstringIL *il, uint32_t j) { if (j + 3 >= il->length) return 0; cff_CharstringInstruction *current = &(il->instr[j]); // We will check whether operand <checkdelta> is zero // ODD EVEN -- current arity // hlineto X Y // vlineto Y X uint32_t checkdelta = ((bool)(current->arity & 1) ^ (bool)(current->i == op_vlineto) ? 1 : 2); if ((il_matchop(il, j, op_hlineto) || il_matchop(il, j, op_vlineto)) // a hlineto/vlineto && il_matchop(il, j + 3, op_rlineto) // followed by a lineto && il_matchtype(il, j + 1, j + 3, IL_ITEM_OPERAND) // have enough operands && il->instr[j + checkdelta].d == 0 // and it is a h/v && current->arity + 1 <= type2_argument_stack // we have enough stack space ) { il->instr[j + checkdelta].type = IL_ITEM_PHANTOM_OPERAND; il->instr[j].type = IL_ITEM_PHANTOM_OPERATOR; il->instr[j + 3].i = current->i; il->instr[j + 3].arity = current->arity + 1; return 3; } else { return 0; } } static uint8_t hvvhcurve_roll(cff_CharstringIL *il, uint32_t j) { if (!il_matchop(il, j, op_hvcurveto) && !il_matchop(il, j, op_vhcurveto)) return 0; cff_CharstringInstruction *current = &(il->instr[j]); // Exit in case of array not long enough or we have already ended if (j + 7 >= il->length || current->arity & 1) return 0; bool hvcase = (bool)((current->arity >> 2) & 1) ^ (bool)(current->i == op_hvcurveto); // We will check whether operand <checkdelta> is zero // ODD EVEN -- current arity divided by 4 // hvcurveto X Y // vhcurveto Y X uint32_t checkdelta1 = hvcase ? 2 : 1; uint32_t checkdelta2 = hvcase ? 5 : 6; if (il_matchop(il, j + 7, op_rrcurveto) // followed by a curveto && il_matchtype(il, j + 1, j + 7, IL_ITEM_OPERAND) // have enough operands && il->instr[j + checkdelta1].d == 0 // and it is a h/v ) { if (il->instr[j + checkdelta2].d == 0 && current->arity + 4 <= type2_argument_stack) { // The Standard case il->instr[j + checkdelta1].type = IL_ITEM_PHANTOM_OPERAND; il->instr[j + checkdelta2].type = IL_ITEM_PHANTOM_OPERAND; il->instr[j].type = IL_ITEM_PHANTOM_OPERATOR; il->instr[j + 7].i = current->i; il->instr[j + 7].arity = current->arity + 4; return 7; } else if (current->arity + 5 <= type2_argument_stack) { // The trailing case il->instr[j + checkdelta1].type = IL_ITEM_PHANTOM_OPERAND; il->instr[j].type = IL_ITEM_PHANTOM_OPERATOR; il->instr[j + 7].i = current->i; il->instr[j + 7].arity = current->arity + 5; if (hvcase) { // Swap the last two operands because hvcurveto's trailing operand is in y-x order double t = il->instr[j + 5].d; il->instr[j + 5].d = il->instr[j + 6].d; il->instr[j + 6].d = t; } return 7; } else { return 0; } } else { return 0; } } static uint8_t hhvvcurve_roll(cff_CharstringIL *il, uint32_t j) { if (!il_matchop(il, j, op_hhcurveto) && !il_matchop(il, j, op_vvcurveto)) return 0; cff_CharstringInstruction *current = &(il->instr[j]); // Exit in case of array not long enough or we have already ended if (j + 7 >= il->length) return 0; bool hh = current->i == op_hhcurveto; uint32_t checkdelta1 = hh ? 2 : 1; uint32_t checkdelta2 = hh ? 6 : 5; if (il_matchop(il, j + 7, op_rrcurveto) // followed by a curveto && il_matchtype(il, j + 1, j + 7, IL_ITEM_OPERAND) // have enough operands && il->instr[j + checkdelta1].d == 0 // and it is a h/v && il->instr[j + checkdelta2].d == 0 // and it is a h/v && current->arity + 4 <= type2_argument_stack) { il->instr[j + checkdelta1].type = IL_ITEM_PHANTOM_OPERAND; il->instr[j + checkdelta2].type = IL_ITEM_PHANTOM_OPERAND; il->instr[j].type = IL_ITEM_PHANTOM_OPERATOR; il->instr[j + 7].i = current->i; il->instr[j + 7].arity = current->arity + 4; return 7; } else { return 0; } } static uint32_t nextstop(cff_CharstringIL *il, uint32_t j) { uint32_t delta = 0; for (; j + delta < il->length && il->instr[j + delta].type == IL_ITEM_OPERAND; delta++) ; return delta; } #define ROLL_FALL(x) \ if ((r = (x))) return r; static uint8_t decideAdvance(cff_CharstringIL *il, uint32_t j, uint8_t optimizeLevel) { uint8_t r = 0; ROLL_FALL(zroll(il, j, op_rlineto, op_hlineto, 0, 1)); // rlineto -> hlineto ROLL_FALL(zroll(il, j, op_rlineto, op_vlineto, 1, 0)); // rlineto -> vlineto ROLL_FALL(zroll(il, j, op_rmoveto, op_hmoveto, 0, 1)); // rmoveto -> hmoveto ROLL_FALL(zroll(il, j, op_rmoveto, op_vmoveto, 1, 0)); // rmoveto -> vmoveto ROLL_FALL(zroll(il, j, op_rrcurveto, op_hvcurveto, 0, 1, 0, 0, 1, 0)); // rrcurveto->hvcurveto ROLL_FALL(zroll(il, j, op_rrcurveto, op_vhcurveto, 1, 0, 0, 0, 0, 1)); // rrcurveto->vhcurveto ROLL_FALL(zroll(il, j, op_rrcurveto, op_hhcurveto, 0, 1, 0, 0, 0, 1)); // rrcurveto->hhcurveto ROLL_FALL(zroll(il, j, op_rrcurveto, op_vvcurveto, 1, 0, 0, 0, 1, 0)); // rrcurveto->vvcurveto ROLL_FALL(opop_roll(il, j, op_rrcurveto, 6, op_rrcurveto, op_rrcurveto)); // rrcurveto roll ROLL_FALL(opop_roll(il, j, op_rrcurveto, 2, op_rlineto, op_rcurveline)); // rcurveline roll ROLL_FALL(opop_roll(il, j, op_rlineto, 6, op_rrcurveto, op_rlinecurve)); // rlinecurve roll ROLL_FALL(opop_roll(il, j, op_rlineto, 2, op_rlineto, op_rlineto)); // rlineto roll ROLL_FALL(opop_roll(il, j, op_hstemhm, 0, op_hintmask, op_hintmask)); // hintmask roll ROLL_FALL(opop_roll(il, j, op_vstemhm, 0, op_hintmask, op_hintmask)); // hintmask roll ROLL_FALL(opop_roll(il, j, op_hstemhm, 0, op_cntrmask, op_cntrmask)); // cntrmask roll ROLL_FALL(opop_roll(il, j, op_vstemhm, 0, op_cntrmask, op_cntrmask)); // cntrmask roll ROLL_FALL(hvlineto_roll(il, j)); // hlineto-vlineto roll ROLL_FALL(hhvvcurve_roll(il, j)); // hhcurveto-vvcurveto roll ROLL_FALL(hvvhcurve_roll(il, j)); // hvcurveto-vhcurveto roll ROLL_FALL(nextstop(il, j)); // move to next stop for operand match return 1; // nothing match } void cff_optimizeIL(cff_CharstringIL *il, const otfcc_Options *options) { if (!options->cff_rollCharString) return; uint32_t j = 0; while (j < il->length) { j += decideAdvance(il, j, options->cff_rollCharString); } } // IL to buffer conversion caryll_Buffer *cff_build_IL(cff_CharstringIL *il) { caryll_Buffer *blob = bufnew(); for (uint16_t j = 0; j < il->length; j++) { switch (il->instr[j].type) { case IL_ITEM_OPERAND: { cff_mergeCS2Operand(blob, il->instr[j].d); break; } case IL_ITEM_OPERATOR: { cff_mergeCS2Operator(blob, il->instr[j].i); break; } case IL_ITEM_SPECIAL: { cff_mergeCS2Special(blob, il->instr[j].i); break; } default: break; } } return blob; } cff_CharstringIL *cff_shrinkIL(cff_CharstringIL *il) { cff_CharstringIL *out; NEW(out); for (uint16_t j = 0; j < il->length; j++) { switch (il->instr[j].type) { case IL_ITEM_OPERAND: { il_push_operand(out, il->instr[j].d); break; } case IL_ITEM_OPERATOR: { il_push_op(out, il->instr[j].i); break; } case IL_ITEM_SPECIAL: { il_push_special(out, il->instr[j].i); break; } default: break; } } return out; } void cff_ILmergeIL(cff_CharstringIL *self, cff_CharstringIL *il) { for (uint16_t j = 0; j < il->length; j++) { switch (il->instr[j].type) { case IL_ITEM_OPERAND: { il_push_operand(self, il->instr[j].d); break; } case IL_ITEM_OPERATOR: { il_push_op(self, il->instr[j].i); break; } case IL_ITEM_SPECIAL: { il_push_special(self, il->instr[j].i); break; } default: break; } } } bool instruction_eq(cff_CharstringInstruction *z1, cff_CharstringInstruction *z2) { if (z1->type == z2->type) { if (z1->type == IL_ITEM_OPERAND || z1->type == IL_ITEM_PHANTOM_OPERAND) { return z1->d == z2->d; } else { return z1->i == z2->i; } } else { return false; } } bool cff_ilEqual(cff_CharstringIL *a, cff_CharstringIL *b) { if (!a || !b) return false; if (a->length != b->length) return false; for (uint32_t j = 0; j < a->length; j++) if (!instruction_eq(a->instr + j, b->instr + j)) { return false; } return true; }
28,807
https://github.com/cnr-isti-vclab/nexus/blob/master/src/nxsbuild/meshstream.cpp
Github Open Source
Open Source
MIT
2,022
nexus
cnr-isti-vclab
C++
Code
792
2,618
/* Nexus Copyright(C) 2012 - Federico Ponchio ISTI - Italian National Research Council - Visual Computing Lab This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License (http://www.gnu.org/licenses/gpl.txt) for more details. */ #include <QDebug> #include <QFileInfo> #include "meshstream.h" #include "meshloader.h" #include "plyloader.h" #include "tsploader.h" #include "objloader.h" #include "stlloader.h" #include "vcgloadermesh.h" #include "vcgloader.h" #include <iostream> using namespace std; Stream::Stream(): has_colors(false), has_normals(false), has_textures(false), vertex_quantization(0), current_triangle(0), current_block(0) { } void Stream::setVertexQuantization(double q) { vertex_quantization = q; } MeshLoader *Stream::getLoader(QString file, QString material) { MeshLoader *loader = nullptr; if(file.endsWith(".ply")) loader = new PlyLoader(file); else if(file.endsWith(".tsp")) loader = new TspLoader(file); else if(file.endsWith(".obj")) loader = new ObjLoader(file, material); else if(file.endsWith(".stl")) loader = new STLLoader(file); else loader = new VcgLoader<VcgMesh>(file); /* else if(file.endsWith(".off")) loader = new OffLoader(file, vertex_quantization, max_memory);*/ // else // throw QString("Input format for file " + file + " is not supported at the moment"); return loader; } vcg::Box3d Stream::getBox(QStringList paths) { vcg::Box3d box; quint32 length = (1<<20); //times 52 bytes. (128Mb of data) Splat *vertices = new Splat[length]; foreach(QString file, paths) { qDebug() << "Computing box for " << qPrintable(file); MeshLoader *loader = getLoader(file, QString()); loader->setMaxMemory(512*(1<<20)); //read only once... does'nt really matter. while(true) { int count = loader->getVertices(length, vertices); if(count == 0) break; } box.Add(loader->box); delete loader; } delete []vertices; return box; } void Stream::load(MeshLoader *loader) { loader->setVertexQuantization(vertex_quantization); loader->origin = origin; loadMesh(loader); has_colors &= loader->hasColors(); has_normals &= loader->hasNormals(); has_textures &= loader->hasTextures(); if(has_textures) { for(auto tex: loader->texture_filenames) { textures.push_back(tex); } } } void Stream::load(QStringList paths, QString material) { has_colors = true; has_normals = true; has_textures = true; foreach(QString file, paths) { qDebug() << "Reading" << qPrintable(file); MeshLoader *loader = getLoader(file, material); load(loader); //box.Add(loader->box); //this lineB AFTER the mesh is streamed delete loader; } current_triangle = 0; flush(); } void Stream::clear() { clearVirtual(); levels.clear(); order.clear(); textures.clear(); current_triangle = 0; current_block = 0; box = vcg::Box3f(); } //bit twiddling hacks quint64 Stream::getLevel(qint64 v) { static const int MultiplyDeBruijnBitPosition[32] = { 0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9 }; return MultiplyDeBruijnBitPosition[((unsigned int)((v & -v) * 0x077CB531U)) >> 27]; } void Stream::computeOrder() { order.clear(); for(int level = levels.size()-1; level >= 0; level--) { std::vector<quint64> &level_blocks = levels[level]; for(uint i = 0; i < level_blocks.size(); i++) { order.push_back(level_blocks[i]); } } } //SOUP StreamSoup::StreamSoup(QString prefix): VirtualTriangleSoup(prefix) { } void StreamSoup::loadMesh(MeshLoader *loader) { loader->setMaxMemory(maxMemory()); loader->texOffset = textures.size(); //get 128Mb of data quint32 length = (1<<20); //times 52 bytes. Triangle *triangles = new Triangle[length]; while(true) { int count = loader->getTriangles(length, triangles); if(count == 0) break; for(int i = 0; i < count; i++) { assert(triangles[i].node == 0); pushTriangle(triangles[i]); } } delete []triangles; } void StreamSoup::pushTriangle(Triangle &triangle) { //ignore degenerate faces vcg::Point3f v[3]; for(int k = 0; k < 3; k++) { v[k] = vcg::Point3f(triangle.vertices[k].v); box.Add(v[k]); } /* MOVED TO LOADER AND SIMPLIFIER */ /*ignore degenerate faces if(v[0] == v[1] || v[1] == v[2] || v[2] == v[0]) return; */ quint64 level = getLevel(current_triangle); assert(levels.size() >= level); quint64 block = 0; if(levels.size() == level) { //need to add a level levels.push_back(std::vector<quint64>()); block = addBlock(level); } else { block = levels[level].back(); if(isBlockFull(block)) block = addBlock(level); } Soup soup = get(block); soup.push_back(triangle); current_triangle++; } Soup StreamSoup::streamTriangles() { if(current_block == 0) computeOrder(); if(current_block == order.size()) return Soup(NULL, NULL, 0); flush(); //save memory quint64 block = order[current_block]; current_block++; return get(block); } void StreamSoup::clearVirtual() { VirtualTriangleSoup::clear(); } quint64 StreamSoup::addBlock(quint64 level) { quint64 block = VirtualTriangleSoup::addBlock(); levels[level].push_back(block); return block; } //Cloud StreamCloud::StreamCloud(QString prefix): VirtualVertexCloud(prefix) { } void StreamCloud::loadMesh(MeshLoader *loader) { loader->setMaxMemory(maxMemory()); //get 128Mb of data quint32 length = (1<<20); //times 52 bytes. Splat *vertices = new Splat[length]; while(true) { int count = loader->getVertices(length, vertices); if(count == 0) break; for(int i = 0; i < count; i++) { assert(vertices[i].node == 0); pushVertex(vertices[i]); } } delete []vertices; } void StreamCloud::pushVertex(Splat &vertex) { //ignore degenerate faces vcg::Point3f p(vertex.v); box.Add(p); quint64 level = getLevel(current_triangle); assert(levels.size() >= level); quint64 block = 0; if(levels.size() == level) { //need to add a level levels.push_back(std::vector<quint64>()); block = addBlock(level); } else { block = levels[level].back(); if(isBlockFull(block)) block = addBlock(level); } Cloud cloud = get(block); cloud.push_back(vertex); current_triangle++; } Cloud StreamCloud::streamVertices() { if(current_block == 0) computeOrder(); if(current_block == order.size()) return Cloud(NULL, NULL, 0); flush(); //save memory quint64 block = order[current_block]; current_block++; return get(block); } void StreamCloud::clearVirtual() { VirtualVertexCloud::clear(); } quint64 StreamCloud::addBlock(quint64 level) { quint64 block = VirtualVertexCloud::addBlock(); levels[level].push_back(block); return block; }
3,932
https://github.com/WikiWatershed/gwlf-e/blob/master/test/unittests/test_StreamFlow.py
Github Open Source
Open Source
Apache-2.0
2,021
gwlf-e
WikiWatershed
Python
Code
85
506
import numpy as np from .VariableUnitTest import VariableUnitTest from gwlfe.MultiUse_Fxns.Discharge import StreamFlow class TestStreamFlow(VariableUnitTest): def test_StreamFlow(self): z = self.z np.testing.assert_array_almost_equal( StreamFlow.StreamFlow_f(z.NYrs, z.DaysMonth, z.Temp, z.InitSnow_0, z.Prec, z.NRur, z.NUrb, z.Area, z.CNI_0, z.AntMoist_0, z.Grow_0, z.CNP_0, z.Imper, z.ISRR, z.ISRA, z.CN, z.UnsatStor_0, z.KV, z.PcntET, z.DayHrs, z.MaxWaterCap, z.SatStor_0, z.RecessionCoef, z.SeepCoef, z.Qretention, z.PctAreaInfil, z.n25b, z.Landuse, z.TileDrainDensity, z.PointFlow, z.StreamWithdrawal, z.GroundWithdrawal), StreamFlow.StreamFlow(z.NYrs, z.DaysMonth, z.Temp, z.InitSnow_0, z.Prec, z.NRur, z.NUrb, z.Area, z.CNI_0, z.AntMoist_0, z.Grow_0, z.CNP_0, z.Imper, z.ISRR, z.ISRA, z.CN, z.UnsatStor_0, z.KV, z.PcntET, z.DayHrs, z.MaxWaterCap, z.SatStor_0, z.RecessionCoef, z.SeepCoef, z.Qretention, z.PctAreaInfil, z.n25b, z.Landuse, z.TileDrainDensity, z.PointFlow, z.StreamWithdrawal, z.GroundWithdrawal), decimal=7)
40,376
https://github.com/antonpolishko/google-research/blob/master/drawtext/wikispell/data/th.dev.bottom_50_pct.tsv
Github Open Source
Open Source
Apache-2.0, CC-BY-4.0
2,023
google-research
antonpolishko
TSV
Code
9,171
25,412
จาระบี จ า ร ะ บ ี การเทศน์ ก า ร เ ท ศ น ์ ชลิตา ช ล ิ ต า ไอซียู ไ อ ซ ี ย ู การปิดสวิตช์ ก า ร ป ิ ด ส ว ิ ต ช ์ ต้มยำกุ้ง ต ้ ม ย ำ ก ุ ้ ง พืชใบเลี้ยงคู่ พ ื ช ใ บ เ ล ี ้ ย ง ค ู ่ อาบูจา อ า บ ู จ า ตะบองเพชร ต ะ บ อ ง เ พ ช ร หญิงงามเมือง ห ญ ิ ง ง า ม เ ม ื อ ง เบนิน เ บ น ิ น การละเว้น ก า ร ล ะ เ ว ้ น เฃ้า เ ฃ ้ า นาฬิกาแดด น า ฬ ิ ก า แ ด ด ภาษาศาสตร์ ภ า ษ า ศ า ส ต ร ์ ที่สิบเก้า ท ี ่ ส ิ บ เ ก ้ า เขี้ยว เ ข ี ้ ย ว สุนทรียภาพ ส ุ น ท ร ี ย ภ า พ รถถีบ ร ถ ถ ี บ โอลีฟ โ อ ล ี ฟ ยูทาห์ ย ู ท า ห ์ มัตสยา ม ั ต ส ย า มาดากัสการ์ ม า ด า ก ั ส ก า ร ์ จารกรรมทางอุตสาหกรรม จ า ร ก ร ร ม ท า ง อ ุ ต ส า ห ก ร ร ม ไข้รากสาดใหญ่ ไ ข ้ ร า ก ส า ด ใ ห ญ ่ โสษ โ ส ษ เกรี้ยว เ ก ร ี ้ ย ว การถวายพระพร ก า ร ถ ว า ย พ ร ะ พ ร ตัวดำ ต ั ว ด ำ คู่สัญญา ค ู ่ ส ั ญ ญ า พส. พ ส . ความแบ๊ว ค ว า ม แ บ ๊ ว ทำแท้ง ท ำ แ ท ้ ง สอยมะม่วง ส อ ย ม ะ ม ่ ว ง ส้มโอ ส ้ ม โ อ ทัวร์ลง ท ั ว ร ์ ล ง หนุนหลัง ห น ุ น ห ล ั ง ยาเสพย์ติด ย า เ ส พ ย ์ ต ิ ด กฎหมายปกครอง ก ฎ ห ม า ย ป ก ค ร อ ง ศตภาค ศ ต ภ า ค บุหรี่พระราม บ ุ ห ร ี ่ พ ร ะ ร า ม ปฏิกิริยาเคมี ป ฏ ิ ก ิ ร ิ ย า เ ค ม ี ทวิภาค ท ว ิ ภ า ค ลายมือชื่อ ล า ย ม ื อ ช ื ่ อ เรคยาวิก เ ร ค ย า ว ิ ก เหลือเฟือ เ ห ล ื อ เ ฟ ื อ การกราบ ก า ร ก ร า บ วันชาติ ว ั น ช า ต ิ ตกตะกอน ต ก ต ะ ก อ น เฮลซิงกิ เ ฮ ล ซ ิ ง ก ิ ค่ายทหาร ค ่ า ย ท ห า ร ภัยการระเบิด ภ ั ย ก า ร ร ะ เ บ ิ ด ยี่สิบแปด ย ี ่ ส ิ บ แ ป ด ลำใย ล ำ ใ ย จีนกลาง จ ี น ก ล า ง อาฆาต อ า ฆ า ต ลูกหลง ล ู ก ห ล ง โคอาลา โ ค อ า ล า ยิหวา ย ิ ห ว า เพื่อว่า เ พ ื ่ อ ว ่ า อาร์ทิโชก อ า ร ์ ท ิ โ ช ก ใจไม้ไส้ระกำ ใ จ ไ ม ้ ไ ส ้ ร ะ ก ำ ความโย่ง ค ว า ม โ ย ่ ง กายกรรม ก า ย ก ร ร ม ไซโคลน ไ ซ โ ค ล น ประเวณี ป ร ะ เ ว ณ ี ซาเกร็บ ซ า เ ก ร ็ บ ช้อนซุป ช ้ อ น ซ ุ ป เรี่ยม เ ร ี ่ ย ม จำศีล จ ำ ศ ี ล พระวรสาร พ ร ะ ว ร ส า ร หัวร่อ ห ั ว ร ่ อ หินหนืด ห ิ น ห น ื ด การพิพากษา ก า ร พ ิ พ า ก ษ า ฃวด ฃ ว ด นกหวีด น ก ห ว ี ด ตาปู ต า ป ู นิ้วก้อย น ิ ้ ว ก ้ อ ย แฟนพันธุ์แท้ แ ฟ น พ ั น ธ ุ ์ แ ท ้ เลสเบียน เ ล ส เ บ ี ย น ทุบหม้อข้าว ท ุ บ ห ม ้ อ ข ้ า ว ตกผลึก ต ก ผ ล ึ ก อนุสาวรีย์เทพีเสรีภาพ อ น ุ ส า ว ร ี ย ์ เ ท พ ี เ ส ร ี ภ า พ ลมดาวฤกษ์ ล ม ด า ว ฤ ก ษ ์ หูกวาง ห ู ก ว า ง รันทด ร ั น ท ด พินอิน พ ิ น อ ิ น ฟืน ฟ ื น สำรับ ส ำ ร ั บ ส่าหรี ส ่ า ห ร ี หนึ่งในตองอู ห น ึ ่ ง ใ น ต อ ง อ ู ทาลลินน์ ท า ล ล ิ น น ์ คราใด ค ร า ใ ด ติดเก้ง ต ิ ด เ ก ้ ง แทะ แ ท ะ แป๊ก แ ป ๊ ก คาร์เนชั่น ค า ร ์ เ น ช ั ่ น ควินซ์ ค ว ิ น ซ ์ ดาราจักร ด า ร า จ ั ก ร นีติกรรม น ี ต ิ ก ร ร ม ยานโกน ย า น โ ก น ช่างเครื่อง ช ่ า ง เ ค ร ื ่ อ ง สฤคาล ส ฤ ค า ล พุดซ้อน พ ุ ด ซ ้ อ น การมั่ว ก า ร ม ั ่ ว กระดาษเช็ดปาก ก ร ะ ด า ษ เ ช ็ ด ป า ก รากดิน ร า ก ด ิ น คอหอยอักเสบ ค อ ห อ ย อ ั ก เ ส บ อือออ อ ื อ อ อ วิดีทัศน์ ว ิ ด ี ท ั ศ น ์ หอมต้นเดี่ยว ห อ ม ต ้ น เ ด ี ่ ย ว อัลไล อ ั ล ไ ล จันอับ จ ั น อ ั บ โมเพด โ ม เ พ ด อาหารเที่ยง อ า ห า ร เ ท ี ่ ย ง กะโถน ก ะ โ ถ น ทัพพี ท ั พ พ ี พรแสวง พ ร แ ส ว ง เยื่อใย เ ย ื ่ อ ใ ย เคนยา เ ค น ย า เกี้ยว เ ก ี ้ ย ว เหน็บชา เ ห น ็ บ ช า ปลั๊กอเนกประสงค์ ป ล ั ๊ ก อ เ น ก ป ร ะ ส ง ค ์ หนังตา ห น ั ง ต า กระตือรือล้น ก ร ะ ต ื อ ร ื อ ล ้ น ดิ่ว ด ิ ่ ว คริสตศก ค ร ิ ส ต ศ ก นาคเล่นน้ำ น า ค เ ล ่ น น ้ ำ ก๋วยจั๊บ ก ๋ ว ย จ ั ๊ บ ทัศนาจร ท ั ศ น า จ ร นักเต้น น ั ก เ ต ้ น ฅีน ฅ ี น ไอโอวา ไ อ โ อ ว า พรหมจรรย์ พ ร ห ม จ ร ร ย ์ ฤๅทัย ฤ ๅ ท ั ย กักกัน ก ั ก ก ั น มีอันจะกิน ม ี อ ั น จ ะ ก ิ น ภูติ ภ ู ต ิ หม่อมราชวงศ์ ห ม ่ อ ม ร า ช ว ง ศ ์ โสเภณี โ ส เ ภ ณ ี สี่สิบเอ็ด ส ี ่ ส ิ บ เ อ ็ ด โชห่วย โ ช ห ่ ว ย หม้าย ห ม ้ า ย ภารวี ภ า ร ว ี แกลเลียม แ ก ล เ ล ี ย ม นักเลงคีย์บอร์ด น ั ก เ ล ง ค ี ย ์ บ อ ร ์ ด เรณู เ ร ณ ู อนิยมสรรพนาม อ น ิ ย ม ส ร ร พ น า ม เขบ็ต เ ข บ ็ ต ไคโร ไ ค โ ร อุปไมย อ ุ ป ไ ม ย เป็นหวัด เ ป ็ น ห ว ั ด พีเรียด พ ี เ ร ี ย ด ขลุม ข ล ุ ม ลีโอนาร์โด ล ี โ อ น า ร ์ โ ด แมสซาชูเซตส์ แ ม ส ซ า ช ู เ ซ ต ส ์ ล่ำสัน ล ่ ำ ส ั น ดังโงะ ด ั ง โ ง ะ การขโมย ก า ร ข โ ม ย สรรพ์ ส ร ร พ ์ ปืนพก ป ื น พ ก เอปไซลอน เ อ ป ไ ซ ล อ น รถด่วน ร ถ ด ่ ว น ภมร ภ ม ร นักบินอวกาศ น ั ก บ ิ น อ ว ก า ศ ไม่เห็นโลงศพไม่หลั่งน้ำตา ไ ม ่ เ ห ็ น โ ล ง ศ พ ไ ม ่ ห ล ั ่ ง น ้ ำ ต า เสร่อ เ ส ร ่ อ ตั๋วสัญญาใช้เงิน ต ั ๋ ว ส ั ญ ญ า ใ ช ้ เ ง ิ น ถอดถอน ถ อ ด ถ อ น มาเลศ ม า เ ล ศ กลีบดอก ก ล ี บ ด อ ก คาบาเร่ต์ ค า บ า เ ร ่ ต ์ เวทย์มนตร์ เ ว ท ย ์ ม น ต ร ์ ชวนหัว ช ว น ห ั ว หุ่นเชิด ห ุ ่ น เ ช ิ ด สิทธัตถ ส ิ ท ธ ั ต ถ น้ำใจนักกีฬา น ้ ำ ใ จ น ั ก ก ี ฬ า บุณฑริก บ ุ ณ ฑ ร ิ ก ผู้สืบสันดาน ผ ู ้ ส ื บ ส ั น ด า น แมวมอง แ ม ว ม อ ง ข้อแก้ตัว ข ้ อ แ ก ้ ต ั ว กลศาสตร์ ก ล ศ า ส ต ร ์ แม่กุญแจ แ ม ่ ก ุ ญ แ จ ศฤคาล ศ ฤ ค า ล แฮ็กเกอร์ แ ฮ ็ ก เ ก อ ร ์ ติ่งหู ต ิ ่ ง ห ู ดาวแคระดำ ด า ว แ ค ร ะ ด ำ ญิบ ญ ิ บ ดั้น ด ั ้ น คาสเซ็ต ค า ส เ ซ ็ ต มารวิชัย ม า ร ว ิ ช ั ย กลีบหิน ก ล ี บ ห ิ น สัตว์กินเนื้อ ส ั ต ว ์ ก ิ น เ น ื ้ อ ทู่ ท ู ่ กางเขน ก า ง เ ข น คู่หมั้น ค ู ่ ห ม ั ้ น บัณฑูร บ ั ณ ฑ ู ร กมรเตงอัญ ก ม ร เ ต ง อ ั ญ เสือผู้หญิง เ ส ื อ ผ ู ้ ห ญ ิ ง หลงผิด ห ล ง ผ ิ ด วาสุกรี ว า ส ุ ก ร ี ทแยง ท แ ย ง การนิรมิต ก า ร น ิ ร ม ิ ต ตราอาร์ม ต ร า อ า ร ์ ม ดุบเนียม ด ุ บ เ น ี ย ม ขัดใจ ข ั ด ใ จ ขันทองพยาบาท ข ั น ท อ ง พ ย า บ า ท หน้าใบไม้ร่วง ห น ้ า ใ บ ไ ม ้ ร ่ ว ง สดับตรับฟัง ส ด ั บ ต ร ั บ ฟ ั ง กระดูกสันอก ก ร ะ ด ู ก ส ั น อ ก ชาอูหลง ช า อ ู ห ล ง ทุกหย่อมหญ้า ท ุ ก ห ย ่ อ ม ห ญ ้ า กุณฑี ก ุ ณ ฑ ี เนตรนารี เ น ต ร น า ร ี ท่อลอด ท ่ อ ล อ ด พร้อมมูล พ ร ้ อ ม ม ู ล กินแกลบ ก ิ น แ ก ล บ สุริยุปราคา ส ุ ร ิ ย ุ ป ร า ค า กบดาน ก บ ด า น รัฐประศาสนศาสตร์ ร ั ฐ ป ร ะ ศ า ส น ศ า ส ต ร ์ สารหนู ส า ร ห น ู การเชื่อฟัง ก า ร เ ช ื ่ อ ฟ ั ง มรณกรรม ม ร ณ ก ร ร ม นักมานุษยวิทยา น ั ก ม า น ุ ษ ย ว ิ ท ย า อธิวาส อ ธ ิ ว า ส นักแสดงพากย์ น ั ก แ ส ด ง พ า ก ย ์ ขาดคอช้าง ข า ด ค อ ช ้ า ง เอป เ อ ป เวิลด์ไวด์เว็บ เ ว ิ ล ด ์ ไ ว ด ์ เ ว ็ บ กระดูกซี่โครง ก ร ะ ด ู ก ซ ี ่ โ ค ร ง สมมุติฐาน ส ม ม ุ ต ิ ฐ า น ปลาสนาการ ป ล า ส น า ก า ร คอร์นวอลล์ ค อ ร ์ น ว อ ล ล ์ สาคเรศ ส า ค เ ร ศ ยูนิฟอร์ม ย ู น ิ ฟ อ ร ์ ม เงื้อมมือ เ ง ื ้ อ ม ม ื อ เบญจา เ บ ญ จ า ข่มขืนกระทำชำเรา ข ่ ม ข ื น ก ร ะ ท ำ ช ำ เ ร า ขนมเข่ง ข น ม เ ข ่ ง ดานูบ ด า น ู บ ซีบอร์เกียม ซ ี บ อ ร ์ เ ก ี ย ม ค่าอุปการะเลี้ยงดู ค ่ า อ ุ ป ก า ร ะ เ ล ี ้ ย ง ด ู ซองจดหมาย ซ อ ง จ ด ห ม า ย ซ็อกเก็ต ซ ็ อ ก เ ก ็ ต ภารโรง ภ า ร โ ร ง กองทัพมด ก อ ง ท ั พ ม ด จกตา จ ก ต า นางตะเคียน น า ง ต ะ เ ค ี ย น ปฏิกูล ป ฏ ิ ก ู ล วายร้าย ว า ย ร ้ า ย ยุกระบัตร ย ุ ก ร ะ บ ั ต ร กำราบ ก ำ ร า บ ฮินดี ฮ ิ น ด ี หรึ่ง ห ร ึ ่ ง กุยช่าย ก ุ ย ช ่ า ย ความรอด ค ว า ม ร อ ด เจ็บไข้ เ จ ็ บ ไ ข ้ การฆ่าฟัน ก า ร ฆ ่ า ฟ ั น คนโท ค น โ ท ซาชิมิ ซ า ช ิ ม ิ ลามกอนาจาร ล า ม ก อ น า จ า ร เลนิน เ ล น ิ น ลิ้นจี่ ล ิ ้ น จ ี ่ ทุระยศ ท ุ ร ะ ย ศ ยุคมืด ย ุ ค ม ื ด คอโมโรส ค อ โ ม โ ร ส จานเสียง จ า น เ ส ี ย ง พอดคาสต์ พ อ ด ค า ส ต ์ กล้องสองตา ก ล ้ อ ง ส อ ง ต า มัตถลุงค์ ม ั ต ถ ล ุ ง ค ์ พระกิตติคุณ พ ร ะ ก ิ ต ต ิ ค ุ ณ หน่วยก้าน ห น ่ ว ย ก ้ า น คนธรรพ์ ค น ธ ร ร พ ์ เถาปั๊ว เ ถ า ป ั ๊ ว ตำน้ำพริกละลายแม่น้ำ ต ำ น ้ ำ พ ร ิ ก ล ะ ล า ย แ ม ่ น ้ ำ ปักษี ป ั ก ษ ี รัฐกันชน ร ั ฐ ก ั น ช น การแซะ ก า ร แ ซ ะ ฐานรองดอก ฐ า น ร อ ง ด อ ก สวาซิแลนด์ ส ว า ซ ิ แ ล น ด ์ สดมภ์ ส ด ม ภ ์ ซาลาเปา ซ า ล า เ ป า ท้องร่วง ท ้ อ ง ร ่ ว ง สถานพินิจ ส ถ า น พ ิ น ิ จ จังกอบ จ ั ง ก อ บ ไต้ฝุ่น ไ ต ้ ฝ ุ ่ น การใช้บังคับ ก า ร ใ ช ้ บ ั ง ค ั บ เยื่อหุ้มเมล็ด เ ย ื ่ อ ห ุ ้ ม เ ม ล ็ ด บ๊ะจ่าง บ ๊ ะ จ ่ า ง ดาร์กช็อกโกแลต ด า ร ์ ก ช ็ อ ก โ ก แ ล ต สามสิบเอ็ด ส า ม ส ิ บ เ อ ็ ด นิติรัฐ น ิ ต ิ ร ั ฐ ใบอนุญาตขับขี่ ใ บ อ น ุ ญ า ต ข ั บ ข ี ่ กษีรสาคาร ก ษ ี ร ส า ค า ร ศุภอักษร ศ ุ ภ อ ั ก ษ ร แฮฟเนียม แ ฮ ฟ เ น ี ย ม อาราธนา อ า ร า ธ น า คำพ้องเสียง ค ำ พ ้ อ ง เ ส ี ย ง ประเคน ป ร ะ เ ค น ผัดพริกขิง ผ ั ด พ ร ิ ก ข ิ ง โนเบเลียม โ น เ บ เ ล ี ย ม นักภาษาศาสตร์ น ั ก ภ า ษ า ศ า ส ต ร ์ คงตัว ค ง ต ั ว การรีดเอาทรัพย์ ก า ร ร ี ด เ อ า ท ร ั พ ย ์ สะเต๊ะ ส ะ เ ต ๊ ะ ความเกลียดกลัวต่างชาติ ค ว า ม เ ก ล ี ย ด ก ล ั ว ต ่ า ง ช า ต ิ สายเปย์ ส า ย เ ป ย ์ โชว์ห่วย โ ช ว ์ ห ่ ว ย นิบาต น ิ บ า ต ครัวซองต์ ค ร ั ว ซ อ ง ต ์ ฅุ๋ม ฅ ุ ๋ ม เกล้ากระหม่อมฉัน เ ก ล ้ า ก ร ะ ห ม ่ อ ม ฉ ั น วานาเดียม ว า น า เ ด ี ย ม ช่างปั้น ช ่ า ง ป ั ้ น สลาฟ ส ล า ฟ อาบูดาบี อ า บ ู ด า บ ี ไนเจอร์ ไ น เ จ อ ร ์ ตรีศก ต ร ี ศ ก วุ้นมะพร้าว ว ุ ้ น ม ะ พ ร ้ า ว ใบ้หวย ใ บ ้ ห ว ย บอลเชวิค บ อ ล เ ช ว ิ ค กองหนุน ก อ ง ห น ุ น ภัตต์ ภ ั ต ต ์ เปลื้อง เ ป ล ื ้ อ ง พสุธา พ ส ุ ธ า จบเห่ จ บ เ ห ่ อัมมาน อ ั ม ม า น ภัจ ภ ั จ ปาดหน้า ป า ด ห น ้ า ไอยคุปต์ ไ อ ย ค ุ ป ต ์ โอนอ่อน โ อ น อ ่ อ น องครักษ์ อ ง ค ร ั ก ษ ์ กาบหอยแครง ก า บ ห อ ย แ ค ร ง เวิ้ง เ ว ิ ้ ง เอกภพ เ อ ก ภ พ น่ามคาน น ่ า ม ค า น ไข่ทอด ไ ข ่ ท อ ด ไฟจราจร ไ ฟ จ ร า จ ร ประคองข้าง ป ร ะ ค อ ง ข ้ า ง โยนี โ ย น ี บัญชีหนังหมา บ ั ญ ช ี ห น ั ง ห ม า ลูกไฟ ล ู ก ไ ฟ ขี้ราดโทษล่อง ข ี ้ ร า ด โ ท ษ ล ่ อ ง ตงฉิน ต ง ฉ ิ น การไว้วางใจ ก า ร ไ ว ้ ว า ง ใ จ ทัณฑสถาน ท ั ณ ฑ ส ถ า น ซาลาแมนเดอร์ ซ า ล า แ ม น เ ด อ ร ์ บักเตรี บ ั ก เ ต ร ี คอร์รับชั่น ค อ ร ์ ร ั บ ช ั ่ น กระดี่ได้น้ำ ก ร ะ ด ี ่ ไ ด ้ น ้ ำ ปาเลสไตน์ ป า เ ล ส ไ ต น ์ ระบบประสาทอิสระ ร ะ บ บ ป ร ะ ส า ท อ ิ ส ร ะ เกษียร เ ก ษ ี ย ร หมูกะโจ๊ก ห ม ู ก ะ โ จ ๊ ก ทันควัน ท ั น ค ว ั น เกรเนดา เ ก ร เ น ด า ตีตรา ต ี ต ร า ขี้ลืม ข ี ้ ล ื ม การเกรียน ก า ร เ ก ร ี ย น โศผะ โ ศ ผ ะ พาสตา พ า ส ต า มีผลใช้บังคับ ม ี ผ ล ใ ช ้ บ ั ง ค ั บ ฐานันดร ฐ า น ั น ด ร สิบเจ็ด ส ิ บ เ จ ็ ด หล่อหลอม ห ล ่ อ ห ล อ ม การลักทรัพย์ ก า ร ล ั ก ท ร ั พ ย ์ มิคกี้เมาส์ ม ิ ค ก ี ้ เ ม า ส ์ ข้าวผัดกระเพรา ข ้ า ว ผ ั ด ก ร ะ เ พ ร า ทารุณกรรม ท า ร ุ ณ ก ร ร ม ขยะแขยง ข ย ะ แ ข ย ง คุณศัพท์ ค ุ ณ ศ ั พ ท ์ ใสศานต์ ใ ส ศ า น ต ์ กำพืด ก ำ พ ื ด อียู อ ี ย ู เพื่อนร่วมชาติ เ พ ื ่ อ น ร ่ ว ม ช า ต ิ อาหารข้างถนน อ า ห า ร ข ้ า ง ถ น น ทวย ท ว ย เส็งเคร็ง เ ส ็ ง เ ค ร ็ ง ฐานบท ฐ า น บ ท โดนัต โ ด น ั ต ลองกอง ล อ ง ก อ ง บะซอลต์ บ ะ ซ อ ล ต ์ เทพย์ เ ท พ ย ์ แหนม แ ห น ม เวรัมภะ เ ว ร ั ม ภ ะ เปลี่ยว เ ป ล ี ่ ย ว เด็กอนามัย เ ด ็ ก อ น า ม ั ย แอลฟา แ อ ล ฟ า สถานีบริการน้ำมัน ส ถ า น ี บ ร ิ ก า ร น ้ ำ ม ั น ปีมะโว้ ป ี ม ะ โ ว ้ เบ็นโต เ บ ็ น โ ต ท่อน้ำเลี้ยง ท ่ อ น ้ ำ เ ล ี ้ ย ง วิทยาการหุ่นยนต์ ว ิ ท ย า ก า ร ห ุ ่ น ย น ต ์ การถึงแก่ความตาย ก า ร ถ ึ ง แ ก ่ ค ว า ม ต า ย การปัดฝุ่น ก า ร ป ั ด ฝ ุ ่ น หม้อข้าวหม้อแกงลิง ห ม ้ อ ข ้ า ว ห ม ้ อ แ ก ง ล ิ ง เดือดเนื้อร้อนใจ เ ด ื อ ด เ น ื ้ อ ร ้ อ น ใ จ เยื่อตา เ ย ื ่ อ ต า บาทวิถี บ า ท ว ิ ถ ี ลูกตุ้ม ล ู ก ต ุ ้ ม ยุคสำริด ย ุ ค ส ำ ร ิ ด โตโก โ ต โ ก เรื่อยไป เ ร ื ่ อ ย ไ ป แฟ้บ แ ฟ ้ บ หอกข้างแคร่ ห อ ก ข ้ า ง แ ค ร ่ การสังหารหมู่ ก า ร ส ั ง ห า ร ห ม ู ่ วีซา ว ี ซ า กฎหมายมหาชน ก ฎ ห ม า ย ม ห า ช น โต๊ะจีน โ ต ๊ ะ จ ี น แต้จิ๋ว แ ต ้ จ ิ ๋ ว สัปเยกต์ ส ั ป เ ย ก ต ์ แม่สื่อ แ ม ่ ส ื ่ อ อิตเทรียม อ ิ ต เ ท ร ี ย ม พู่กัน พ ู ่ ก ั น ขนมจีบ ข น ม จ ี บ สหราชอาณาจักรเกรตบริเตน ส ห ร า ช อ า ณ า จ ั ก ร เ ก ร ต บ ร ิ เ ต น เครื่องเงิน เ ค ร ื ่ อ ง เ ง ิ น เซเลรี่ เ ซ เ ล ร ี ่ ติรานา ต ิ ร า น า วิกาล ว ิ ก า ล มะเฟือง ม ะ เ ฟ ื อ ง ไก่โห่ ไ ก ่ โ ห ่ ความทรมาน ค ว า ม ท ร ม า น กากกะรุน ก า ก ก ะ ร ุ น มินนิโซตา ม ิ น น ิ โ ซ ต า แอกคอร์เดียน แ อ ก ค อ ร ์ เ ด ี ย น กู่ ก ู ่ เช็กบิล เ ช ็ ก บ ิ ล แต๊ะเอีย แ ต ๊ ะ เ อ ี ย มุทราศาสตร์ ม ุ ท ร า ศ า ส ต ร ์ สมณะ ส ม ณ ะ นักตกปลา น ั ก ต ก ป ล า กัสสป ก ั ส ส ป คนดำ ค น ด ำ ขายตัว ข า ย ต ั ว แมงกานีส แ ม ง ก า น ี ส องค์จาตุคามรามเทพ อ ง ค ์ จ า ต ุ ค า ม ร า ม เ ท พ การรุกราน ก า ร ร ุ ก ร า น ไนต์คลับ ไ น ต ์ ค ล ั บ สัปเยก ส ั ป เ ย ก ตราสารเปลี่ยนมือ ต ร า ส า ร เ ป ล ี ่ ย น ม ื อ นามานุประโยค น า ม า น ุ ป ร ะ โ ย ค ภาระการพิสูจน์ ภ า ร ะ ก า ร พ ิ ส ู จ น ์ โทรลล์ โ ท ร ล ล ์ ตะลิงปลิง ต ะ ล ิ ง ป ล ิ ง จริยา จ ร ิ ย า สี่สิบเก้า ส ี ่ ส ิ บ เ ก ้ า บัญชีดำ บ ั ญ ช ี ด ำ ยาถ่าย ย า ถ ่ า ย สะกดจิต ส ะ ก ด จ ิ ต การแจง ก า ร แ จ ง เฟอร์เมียม เ ฟ อ ร ์ เ ม ี ย ม แพ้พ่าย แ พ ้ พ ่ า ย ฮวงซุ้ย ฮ ว ง ซ ุ ้ ย ยกบัตร์ ย ก บ ั ต ร ์ เซอร์โคเนียม เ ซ อ ร ์ โ ค เ น ี ย ม จิตเวชศาสตร์ จ ิ ต เ ว ช ศ า ส ต ร ์ ทางม้าลาย ท า ง ม ้ า ล า ย หน้ากระดาน ห น ้ า ก ร ะ ด า น โลงหิน โ ล ง ห ิ น เด็กเมื่อวานซืน เ ด ็ ก เ ม ื ่ อ ว า น ซ ื น สัจพจน์ ส ั จ พ จ น ์ ตบมือ ต บ ม ื อ คนกลุ่มน้อย ค น ก ล ุ ่ ม น ้ อ ย ชาตินิยม ช า ต ิ น ิ ย ม ความเป๊ะ ค ว า ม เ ป ๊ ะ โบรมีน โ บ ร ม ี น เกียจคร้าน เ ก ี ย จ ค ร ้ า น งานแปล ง า น แ ป ล ริษยา ร ิ ษ ย า ชิงชัน ช ิ ง ช ั น รัตณะ ร ั ต ณ ะ ปฏิกริยา ป ฏ ิ ก ร ิ ย า เทวาธิปไตย เ ท ว า ธ ิ ป ไ ต ย กระจกตา ก ร ะ จ ก ต า แยแส แ ย แ ส สรเสริญ ส ร เ ส ร ิ ญ ลาปาซ ล า ป า ซ แทงก์ แ ท ง ก ์ สาฬุระ ส า ฬ ุ ร ะ หัวโขน ห ั ว โ ข น ความมั่นคงปลอดภัย ค ว า ม ม ั ่ น ค ง ป ล อ ด ภ ั ย ใครขายไข่ไก่ ใ ค ร ข า ย ไ ข ่ ไ ก ่ นัยยะ น ั ย ย ะ ภารดี ภ า ร ด ี สหสัมพันธ์ ส ห ส ั ม พ ั น ธ ์ ฝักใฝ่ ฝ ั ก ใ ฝ ่ ล้มเลิก ล ้ ม เ ล ิ ก ฮวน ฮ ว น ไต่เต้า ไ ต ่ เ ต ้ า หน้าแตก ห น ้ า แ ต ก อุตราษาฒ อ ุ ต ร า ษ า ฒ ทฤษฎีบทค่าเฉลี่ย ท ฤ ษ ฎ ี บ ท ค ่ า เ ฉ ล ี ่ ย ระบบประสาทนอกส่วนกลาง ร ะ บ บ ป ร ะ ส า ท น อ ก ส ่ ว น ก ล า ง การแป้ก ก า ร แ ป ้ ก ชิงชัง ช ิ ง ช ั ง งิ้ว ง ิ ้ ว ทมิฬ ท ม ิ ฬ นักธรณีวิทยา น ั ก ธ ร ณ ี ว ิ ท ย า ข้าวเช้า ข ้ า ว เ ช ้ า การต้ม ก า ร ต ้ ม นักวิจารณ์ น ั ก ว ิ จ า ร ณ ์ เมนส์ เ ม น ส ์ ราชครู ร า ช ค ร ู ข้าวแดงแกงร้อน ข ้ า ว แ ด ง แ ก ง ร ้ อ น ตระกูลของภาษา ต ร ะ ก ู ล ข อ ง ภ า ษ า นาฬิกาอะตอม น า ฬ ิ ก า อ ะ ต อ ม ฉันทลักษณ์ ฉ ั น ท ล ั ก ษ ณ ์ เชลย เ ช ล ย สลอด ส ล อ ด อาศเลษา อ า ศ เ ล ษ า โอ่อ่า โ อ ่ อ ่ า ละโบม ล ะ โ บ ม หยวก ห ย ว ก บาแก็ต บ า แ ก ็ ต เสรีนิยม เ ส ร ี น ิ ย ม ละตินอเมริกา ล ะ ต ิ น อ เ ม ร ิ ก า กระโจม ก ร ะ โ จ ม จาวา จ า ว า อัญชัน อ ั ญ ช ั น ม้าหมุน ม ้ า ห ม ุ น เบคอน เ บ ค อ น เซลล์ไข่ เ ซ ล ล ์ ไ ข ่ สรีสฤบ ส ร ี ส ฤ บ โคคา-โคล่า โ ค ค า - โ ค ล ่ า ม๊อบ ม ๊ อ บ บิดเบี้ยว บ ิ ด เ บ ี ้ ย ว นิติภาวะ น ิ ต ิ ภ า ว ะ เง่า เ ง ่ า สุขศึกษา ส ุ ข ศ ึ ก ษ า ประจุบัน ป ร ะ จ ุ บ ั น อิริเดียม อ ิ ร ิ เ ด ี ย ม สงครามตัวแทน ส ง ค ร า ม ต ั ว แ ท น รามเกียรติ์ ร า ม เ ก ี ย ร ต ิ ์ โต๊ะญี่ปุ่น โ ต ๊ ะ ญ ี ่ ป ุ ่ น การซัดทอด ก า ร ซ ั ด ท อ ด แฟรงก์ แ ฟ ร ง ก ์ เคหะสถาน เ ค ห ะ ส ถ า น ยาดอง ย า ด อ ง ลิ้นทะเล ล ิ ้ น ท ะ เ ล กุ๊ย ก ุ ๊ ย ไก่ฟ้า ไ ก ่ ฟ ้ า เจ้าของภาษา เ จ ้ า ข อ ง ภ า ษ า กระดูกโกลน ก ร ะ ด ู ก โ ก ล น ตะแคง ต ะ แ ค ง ฟิจิ ฟ ิ จ ิ ทะเลสาป ท ะ เ ล ส า ป การบีบคั้น ก า ร บ ี บ ค ั ้ น เงินปี เ ง ิ น ป ี วาทกรรม ว า ท ก ร ร ม น้ำกลั่น น ้ ำ ก ล ั ่ น โบโนโบ โ บ โ น โ บ ชาติชาย ช า ต ิ ช า ย มหาราชา ม ห า ร า ช า แคปไซซิน แ ค ป ไ ซ ซ ิ น สายจูง ส า ย จ ู ง หนังประโมทัย ห น ั ง ป ร ะ โ ม ท ั ย มายอต ม า ย อ ต หอมแดง ห อ ม แ ด ง ไรแว้ ไ ร แ ว ้ ผีอำ ผ ี อ ำ ทับแพ ท ั บ แ พ วิปลาส ว ิ ป ล า ส เมียน้อย เ ม ี ย น ้ อ ย พุทธพาณิชย์ พ ุ ท ธ พ า ณ ิ ช ย ์ ห้องใต้หลังคา ห ้ อ ง ใ ต ้ ห ล ั ง ค า ห้วน ห ้ ว น ใหลตาย ใ ห ล ต า ย แค้นใจ แ ค ้ น ใ จ ต่อมน้ำลาย ต ่ อ ม น ้ ำ ล า ย วลาดีมีร์ ว ล า ด ี ม ี ร ์ ยูเรเนียม ย ู เ ร เ น ี ย ม การจูบ ก า ร จ ู บ เล็ดลอด เ ล ็ ด ล อ ด โหนกแก้ม โ ห น ก แ ก ้ ม ทองคำเปลว ท อ ง ค ำ เ ป ล ว แมลงปีกแข็ง แ ม ล ง ป ี ก แ ข ็ ง ความชั่วร้าย ค ว า ม ช ั ่ ว ร ้ า ย อัศเจรีย์ อ ั ศ เ จ ร ี ย ์ สัญญาซื้อขายล่วงหน้า ส ั ญ ญ า ซ ื ้ อ ข า ย ล ่ ว ง ห น ้ า ให้ยืม ใ ห ้ ย ื ม ถ้ำหลวง ถ ้ ำ ห ล ว ง ผายลม ผ า ย ล ม พิริยะ พ ิ ร ิ ย ะ ขี้ตา ข ี ้ ต า สิทธัตถะ ส ิ ท ธ ั ต ถ ะ การเสียดสี ก า ร เ ส ี ย ด ส ี นักขี่ม้า น ั ก ข ี ่ ม ้ า สินธี ส ิ น ธ ี ไวตามิน ไ ว ต า ม ิ น กุมปันหยี ก ุ ม ป ั น ห ย ี หยอกเอิน ห ย อ ก เ อ ิ น เจ็ดเหลี่ยม เ จ ็ ด เ ห ล ี ่ ย ม แกงไตปลา แ ก ง ไ ต ป ล า ศักดินา ศ ั ก ด ิ น า ค่าคงตัว ค ่ า ค ง ต ั ว โอยัวะ โ อ ย ั ว ะ ระบบประสาทกลาง ร ะ บ บ ป ร ะ ส า ท ก ล า ง รถม้า ร ถ ม ้ า ปฐมกรรม ป ฐ ม ก ร ร ม ขนนก ข น น ก ลูกขุน ล ู ก ข ุ น เจ็บใจ เ จ ็ บ ใ จ เจ้าพญา เ จ ้ า พ ญ า คนพุทธ ค น พ ุ ท ธ ลวดหนาม ล ว ด ห น า ม ลาก่อย ล า ก ่ อ ย แพรประดับ แ พ ร ป ร ะ ด ั บ คีร์กีซสถาน ค ี ร ์ ก ี ซ ส ถ า น หมดตูด ห ม ด ต ู ด ตกเบ็ด ต ก เ บ ็ ด กอลลัม ก อ ล ล ั ม การฝังเข็ม ก า ร ฝ ั ง เ ข ็ ม ตัวกินมด ต ั ว ก ิ น ม ด ซิมบับเว ซ ิ ม บ ั บ เ ว เจ้าแผ่นดิน เ จ ้ า แ ผ ่ น ด ิ น หนวดเสือ ห น ว ด เ ส ื อ เอื้อนเอ่ย เ อ ื ้ อ น เ อ ่ ย ทองคำขาว ท อ ง ค ำ ข า ว อักษรวิจิตร อ ั ก ษ ร ว ิ จ ิ ต ร เทวโลก เ ท ว โ ล ก กราดภาพ ก ร า ด ภ า พ กะปิ ก ะ ป ิ ท้ายทอย ท ้ า ย ท อ ย จองกฐิน จ อ ง ก ฐ ิ น อุปรากร อ ุ ป ร า ก ร กะลาแลนด์ ก ะ ล า แ ล น ด ์ ปั้มน้ำมัน ป ั ้ ม น ้ ำ ม ั น วังหน้า ว ั ง ห น ้ า อารยะขัดขืน อ า ร ย ะ ข ั ด ข ื น โคตม โ ค ต ม ยางใน ย า ง ใ น ยักษิณี ย ั ก ษ ิ ณ ี ธรรมะธัมโม ธ ร ร ม ะ ธ ั ม โ ม แอ็สการ์โก แ อ ็ ส ก า ร ์ โ ก มฆะ ม ฆ ะ แม่แรง แ ม ่ แ ร ง การลอยตัว ก า ร ล อ ย ต ั ว ทรอมโบน ท ร อ ม โ บ น เจื๋อน เ จ ื ๋ อ น เบญจเพศ เ บ ญ จ เ พ ศ มหึมา ม ห ึ ม า ขออำไพ ข อ อ ำ ไ พ เฟื่องฟ้า เ ฟ ื ่ อ ง ฟ ้ า เด็กแว๊น เ ด ็ ก แ ว ๊ น รังผึ้ง ร ั ง ผ ึ ้ ง สุดโต่ง ส ุ ด โ ต ่ ง คนขายเนื้อ ค น ข า ย เ น ื ้ อ อัมพวา อ ั ม พ ว า ตรีทูต ต ร ี ท ู ต อัยกี อ ั ย ก ี เกาะหินโด่ง เ ก า ะ ห ิ น โ ด ่ ง รัฐบาลผสม ร ั ฐ บ า ล ผ ส ม พลูโทเนียม พ ล ู โ ท เ น ี ย ม ทสมี ท ส ม ี การเลี้ยวเบน ก า ร เ ล ี ้ ย ว เ บ น กังไส ก ั ง ไ ส กระเป๋าธนบัตร ก ร ะ เ ป ๋ า ธ น บ ั ต ร เก๊กฮวย เ ก ๊ ก ฮ ว ย แคร็กเกอร์ แ ค ร ็ ก เ ก อ ร ์ ม้วย ม ้ ว ย มอเรเวีย ม อ เ ร เ ว ี ย ชักแม่น้ำทั้งห้า ช ั ก แ ม ่ น ้ ำ ท ั ้ ง ห ้ า สาธารณสมบัติ ส า ธ า ร ณ ส ม บ ั ต ิ ช่ะ ช ่ ะ ยิ้มอ่อน ย ิ ้ ม อ ่ อ น กระดูกงู ก ร ะ ด ู ก ง ู ขมับ ข ม ั บ ศศะ ศ ศ ะ ตู้รถไฟ ต ู ้ ร ถ ไ ฟ โต้คลื่น โ ต ้ ค ล ื ่ น เมษบาล เ ม ษ บ า ล เจื้อยแจ้ว เ จ ื ้ อ ย แ จ ้ ว เท่งทึง เ ท ่ ง ท ึ ง นีติบุคคล น ี ต ิ บ ุ ค ค ล ต่อมไร้ท่อ ต ่ อ ม ไ ร ้ ท ่ อ อัตโนมือ อ ั ต โ น ม ื อ หัวแร้ง ห ั ว แ ร ้ ง สงครามโลกครั้งที่สอง ส ง ค ร า ม โ ล ก ค ร ั ้ ง ท ี ่ ส อ ง สนามรบ ส น า ม ร บ ยี่ปั๊ว ย ี ่ ป ั ๊ ว ช่องบาดาล ช ่ อ ง บ า ด า ล หน้าจั่ว ห น ้ า จ ั ่ ว ทบวง ท บ ว ง นามปากกา น า ม ป า ก ก า ผีฟ้า ผ ี ฟ ้ า ตะวันออกไกล ต ะ ว ั น อ อ ก ไ ก ล สางห่า ส า ง ห ่ า กลมเกลียว ก ล ม เ ก ล ี ย ว รูปคดี ร ู ป ค ด ี นักปรัชญา น ั ก ป ร ั ช ญ า กริยาวิเศษณานุประโยค ก ร ิ ย า ว ิ เ ศ ษ ณ า น ุ ป ร ะ โ ย ค คฤหบดี ค ฤ ห บ ด ี โทพีกา โ ท พ ี ก า เหือด เ ห ื อ ด กริยาช่วย ก ร ิ ย า ช ่ ว ย ข้อบทปฏิบัติการ ข ้ อ บ ท ป ฏ ิ บ ั ต ิ ก า ร ศึกษาศาสตร์ ศ ึ ก ษ า ศ า ส ต ร ์ ขี้แพ้ ข ี ้ แ พ ้ จูบา จ ู บ า ประชาบดี ป ร ะ ช า บ ด ี จารกรรม จ า ร ก ร ร ม นายงาน น า ย ง า น ตกเขียว ต ก เ ข ี ย ว เมสสิยาห์ เ ม ส ส ิ ย า ห ์ บรัยส์ บ ร ั ย ส ์ เห็นกงจักรเป็นดอกบัว เ ห ็ น ก ง จ ั ก ร เ ป ็ น ด อ ก บ ั ว เลือดเนื้อเชื้อไข เ ล ื อ ด เ น ื ้ อ เ ช ื ้ อ ไ ข เส้นศูนย์สูตร เ ส ้ น ศ ู น ย ์ ส ู ต ร เจ็ดสิบ เ จ ็ ด ส ิ บ อาหารไม่ย่อย อ า ห า ร ไ ม ่ ย ่ อ ย เหนื่อยใจ เ ห น ื ่ อ ย ใ จ กาลักน้ำ ก า ล ั ก น ้ ำ แป้นเกลียว แ ป ้ น เ ก ล ี ย ว ฑาก ฑ า ก องค์กรระหว่างประเทศ อ ง ค ์ ก ร ร ะ ห ว ่ า ง ป ร ะ เ ท ศ ชยันโต ช ย ั น โ ต ขงจื๊อ ข ง จ ื ๊ อ ฮั่นจื้อ ฮ ั ่ น จ ื ้ อ มะรืน ม ะ ร ื น กระดูกอ่อน ก ร ะ ด ู ก อ ่ อ น กฎมนเทียรบาล ก ฎ ม น เ ท ี ย ร บ า ล เอเธนส์ เ อ เ ธ น ส ์ จำเริญ จ ำ เ ร ิ ญ อัฐศก อ ั ฐ ศ ก ตัวทำปฏิกิริยา ต ั ว ท ำ ป ฏ ิ ก ิ ร ิ ย า ไทใต้คง ไ ท ใ ต ้ ค ง การถอดเสียง ก า ร ถ อ ด เ ส ี ย ง แห้ว แ ห ้ ว ประมุขแห่งรัฐ ป ร ะ ม ุ ข แ ห ่ ง ร ั ฐ จองศาลา จ อ ง ศ า ล า ความเลอะเทอะ ค ว า ม เ ล อ ะ เ ท อ ะ บวว บ ว ว การร้อนรน ก า ร ร ้ อ น ร น โบลิเวีย โ บ ล ิ เ ว ี ย อะหิวาตะกะโรค อ ะ ห ิ ว า ต ะ ก ะ โ ร ค แอลจีเรีย แ อ ล จ ี เ ร ี ย เศษส่วน เ ศ ษ ส ่ ว น ความโกลาหล ค ว า ม โ ก ล า ห ล แทนทาลัม แ ท น ท า ล ั ม โทศก โ ท ศ ก กระเซิง ก ร ะ เ ซ ิ ง แกล้ม แ ก ล ้ ม ริดรอน ร ิ ด ร อ น จุงเบย จ ุ ง เ บ ย ปีหน้าฟ้าใหม่ ป ี ห น ้ า ฟ ้ า ใ ห ม ่ เซเล็บ เ ซ เ ล ็ บ อสรพิษ อ ส ร พ ิ ษ ตกฟาก ต ก ฟ า ก ลงแขก ล ง แ ข ก พยุหบาตรา พ ย ุ ห บ า ต ร า เข็มหมุด เ ข ็ ม ห ม ุ ด ไดไฮโดรเจนมอนอกไซด์ ไ ด ไ ฮ โ ด ร เ จ น ม อ น อ ก ไ ซ ด ์ เปลือกสมอง เ ป ล ื อ ก ส ม อ ง คนรับใช้ ค น ร ั บ ใ ช ้ ยาม้า ย า ม ้ า ที่เปิดขวด ท ี ่ เ ป ิ ด ข ว ด ห่าน ห ่ า น สบายดีไหม ส บ า ย ด ี ไ ห ม โอเมกา โ อ เ ม ก า บิณฑบาต บ ิ ณ ฑ บ า ต ผู้แปล ผ ู ้ แ ป ล ซอสหอยนางรม ซ อ ส ห อ ย น า ง ร ม ตั้งไข่ ต ั ้ ง ไ ข ่ มติมหาชน ม ต ิ ม ห า ช น การศรัทธา ก า ร ศ ร ั ท ธ า ความเปรี้ยว ค ว า ม เ ป ร ี ้ ย ว พณิช พ ณ ิ ช ผ้าอนามัย ผ ้ า อ น า ม ั ย ภริยาน้อย ภ ร ิ ย า น ้ อ ย ปวยร์โตริโก ป ว ย ร ์ โ ต ร ิ โ ก หัสต ห ั ส ต ความกดอากาศ ค ว า ม ก ด อ า ก า ศ เขตบริหารพิเศษฮ่องกง เ ข ต บ ร ิ ห า ร พ ิ เ ศ ษ ฮ ่ อ ง ก ง บูรพทิศ บ ู ร พ ท ิ ศ ธัมมทัสสี ธ ั ม ม ท ั ส ส ี แพะรับบาป แ พ ะ ร ั บ บ า ป ชะมด ช ะ ม ด เงื่อนไขบังคับหลัง เ ง ื ่ อ น ไ ข บ ั ง ค ั บ ห ล ั ง มันฝรั่งบด ม ั น ฝ ร ั ่ ง บ ด ผ้ากันเปื้อน ผ ้ า ก ั น เ ป ื ้ อ น นิวแฮมป์เชียร์ น ิ ว แ ฮ ม ป ์ เ ช ี ย ร ์ หลอดไฟฟ้า ห ล อ ด ไ ฟ ฟ ้ า ตรรกศาสตร์ ต ร ร ก ศ า ส ต ร ์ หญ้าฝรั่น ห ญ ้ า ฝ ร ั ่ น สายล่อฟ้า ส า ย ล ่ อ ฟ ้ า ยูเอ็น ย ู เ อ ็ น กอดเก้าอี้ ก อ ด เ ก ้ า อ ี ้ การร่วมเพศ ก า ร ร ่ ว ม เ พ ศ นฤบดินทร์ น ฤ บ ด ิ น ท ร ์ ปัทมา ป ั ท ม า พืชกินสัตว์ พ ื ช ก ิ น ส ั ต ว ์ พรหมลิขิต พ ร ห ม ล ิ ข ิ ต โสณ โ ส ณ ลูทีเทียม ล ู ท ี เ ท ี ย ม ฤาษีแปลงสาร ฤ า ษ ี แ ป ล ง ส า ร บรรพภาค บ ร ร พ ภ า ค บากู บ า ก ู ชั่วนาตาปี ช ั ่ ว น า ต า ป ี ฤๅ ฤ ๅ ก้าวล่วง ก ้ า ว ล ่ ว ง ภาพปลากรอบ ภ า พ ป ล า ก ร อ บ คัพภวิทยา ค ั พ ภ ว ิ ท ย า ปากกาหมึกแห้ง ป า ก ก า ห ม ึ ก แ ห ้ ง จขกท. จ ข ก ท . แว่นขยาย แ ว ่ น ข ย า ย กระดูกน่อง ก ร ะ ด ู ก น ่ อ ง โรฮิงยา โ ร ฮ ิ ง ย า โคโซโว โ ค โ ซ โ ว ซองขาว ซ อ ง ข า ว นูร์-ซุลตัน น ู ร ์ - ซ ุ ล ต ั น เข้าเกณฑ์ เ ข ้ า เ ก ณ ฑ ์ คฤหาสน์ ค ฤ ห า ส น ์ เจ้ากรรมนายเวร เ จ ้ า ก ร ร ม น า ย เ ว ร อัฒภาค อ ั ฒ ภ า ค น้ำยาบ้วนปาก น ้ ำ ย า บ ้ ว น ป า ก กะพริบ ก ะ พ ร ิ บ วางสาย ว า ง ส า ย หลู่ ห ล ู ่ โพรงเยื่อหุ้มปอด โ พ ร ง เ ย ื ่ อ ห ุ ้ ม ป อ ด แอ๊ว แ อ ๊ ว ลูกดิ่ง ล ู ก ด ิ ่ ง ท่อนจันทน์ ท ่ อ น จ ั น ท น ์ แอ่ง แ อ ่ ง เบอร์คีเลียม เ บ อ ร ์ ค ี เ ล ี ย ม คะน้า ค ะ น ้ า สะเอว ส ะ เ อ ว บั้ง บ ั ้ ง วัฏภาค ว ั ฏ ภ า ค น้ำตาลกรวด น ้ ำ ต า ล ก ร ว ด องค์กรนอกภาครัฐ อ ง ค ์ ก ร น อ ก ภ า ค ร ั ฐ อนิจกรรม อ น ิ จ ก ร ร ม อณู อ ณ ู สถานกงสุล ส ถ า น ก ง ส ุ ล นาฬิกาทราย น า ฬ ิ ก า ท ร า ย บราติสลาวา บ ร า ต ิ ส ล า ว า ฆ่าแกง ฆ ่ า แ ก ง เบลโมแพน เ บ ล โ ม แ พ น ตะมอย ต ะ ม อ ย โทรทรรศน์ โ ท ร ท ร ร ศ น ์ อัศวินี อ ั ศ ว ิ น ี บริเตนใหญ่ บ ร ิ เ ต น ใ ห ญ ่ เปิงมางคอก เ ป ิ ง ม า ง ค อ ก ประตัก ป ร ะ ต ั ก แอบอิง แ อ บ อ ิ ง น้ำใสใจคอ น ้ ำ ใ ส ใ จ ค อ ห้าเหลี่ยม ห ้ า เ ห ล ี ่ ย ม คนเลี้ยงผึ้ง ค น เ ล ี ้ ย ง ผ ึ ้ ง อัสดร อ ั ส ด ร โลกธรรม โ ล ก ธ ร ร ม ทายาทโดยธรรม ท า ย า ท โ ด ย ธ ร ร ม เครือข่ายสังคม เ ค ร ื อ ข ่ า ย ส ั ง ค ม โทเนอร์ โ ท เ น อ ร ์ เรียบอาวุธ เ ร ี ย บ อ า ว ุ ธ ฮั้ว ฮ ั ้ ว แขวะ แ ข ว ะ ต้องราชประสงค์ ต ้ อ ง ร า ช ป ร ะ ส ง ค ์ พุทธะ พ ุ ท ธ ะ ฟังขึ้น ฟ ั ง ข ึ ้ น องค์กรอาชญากรรม อ ง ค ์ ก ร อ า ช ญ า ก ร ร ม สนามไฟฟ้า ส น า ม ไ ฟ ฟ ้ า การลั่น ก า ร ล ั ่ น ฟันกรามน้อย ฟ ั น ก ร า ม น ้ อ ย ควันออกหู ค ว ั น อ อ ก ห ู เฝือก เ ฝ ื อ ก ความชง ค ว า ม ช ง นานทีปีหน น า น ท ี ป ี ห น กบเหลา ก บ เ ห ล า ฟลุต ฟ ล ุ ต เราเตอร์ เ ร า เ ต อ ร ์ การมอบตัว ก า ร ม อ บ ต ั ว ตุ๊กตุ๊ก ต ุ ๊ ก ต ุ ๊ ก อภิไธย อ ภ ิ ไ ธ ย วิปัสสนาธุระ ว ิ ป ั ส ส น า ธ ุ ร ะ กวัก ก ว ั ก หมึกสาย ห ม ึ ก ส า ย ซาตาน ซ า ต า น เคมีอินทรีย์ เ ค ม ี อ ิ น ท ร ี ย ์ อกตัญญู อ ก ต ั ญ ญ ู แตงเม แ ต ง เ ม บันดาร์เซอรีเบอกาวัน บ ั น ด า ร ์ เ ซ อ ร ี เ บ อ ก า ว ั น เจ้าสำนักโรงแรม เ จ ้ า ส ำ น ั ก โ ร ง แ ร ม อำนาจปกครอง อ ำ น า จ ป ก ค ร อ ง พฤฒสภา พ ฤ ฒ ส ภ า เครื่องลายคราม เ ค ร ื ่ อ ง ล า ย ค ร า ม วิทยาการเอ็มบริโอ ว ิ ท ย า ก า ร เ อ ็ ม บ ร ิ โ อ ขำขัน ข ำ ข ั น สระเอ ส ร ะ เ อ สทุม ส ท ุ ม เลื่องฦๅ เ ล ื ่ อ ง ฦ ๅ อภัยโทษ อ ภ ั ย โ ท ษ ยาสระผม ย า ส ร ะ ผ ม ปอร์โตแปรงซ์ ป อ ร ์ โ ต แ ป ร ง ซ ์ ฟ้าแลบ ฟ ้ า แ ล บ มืดฟ้ามัวดิน ม ื ด ฟ ้ า ม ั ว ด ิ น เส้นรุ้ง เ ส ้ น ร ุ ้ ง กวางผา ก ว า ง ผ า มะแมศก ม ะ แ ม ศ ก ตูวา ต ู ว า จวัก จ ว ั ก ปิกนิก ป ิ ก น ิ ก กำหนัด ก ำ ห น ั ด นาฬิกาปลุก น า ฬ ิ ก า ป ล ุ ก แอริโซนา แ อ ร ิ โ ซ น า สุเมธ ส ุ เ ม ธ นกเขา น ก เ ข า ซูเฟล ซ ู เ ฟ ล อยากรู้อยากเห็น อ ย า ก ร ู ้ อ ย า ก เ ห ็ น ความรักชาติ ค ว า ม ร ั ก ช า ต ิ พิซซา พ ิ ซ ซ า จุลชีพ จ ุ ล ช ี พ อลวน อ ล ว น การประเชิญ ก า ร ป ร ะ เ ช ิ ญ ติดหู ต ิ ด ห ู กรินทร์ ก ร ิ น ท ร ์ เสือสิงห์กระทิงแรด เ ส ื อ ส ิ ง ห ์ ก ร ะ ท ิ ง แ ร ด ทรราช ท ร ร า ช เมาค้าง เ ม า ค ้ า ง บ่อน้ำร้อน บ ่ อ น ้ ำ ร ้ อ น มดแดงแฝงพวงมะม่วง ม ด แ ด ง แ ฝ ง พ ว ง ม ะ ม ่ ว ง สอดรู้สอดเห็น ส อ ด ร ู ้ ส อ ด เ ห ็ น ระบอบนาซี ร ะ บ อ บ น า ซ ี คำหับ ค ำ ห ั บ พระเจ้าห้าพระองค์ พ ร ะ เ จ ้ า ห ้ า พ ร ะ อ ง ค ์ ติดดิน ต ิ ด ด ิ น รำฦก ร ำ ฦ ก เหลือใจ เ ห ล ื อ ใ จ เวสสภู เ ว ส ส ภ ู เส้นเลือดฝอย เ ส ้ น เ ล ื อ ด ฝ อ ย ใข่ ใ ข ่ คลื่นความโน้มถ่วง ค ล ื ่ น ค ว า ม โ น ้ ม ถ ่ ว ง ไม้เซลฟี่ ไ ม ้ เ ซ ล ฟ ี ่ ยูทูบเบอร์ ย ู ท ู บ เ บ อ ร ์ ลาวหล่ม ล า ว ห ล ่ ม เฆี่ยน เ ฆ ี ่ ย น หยาดน้ำฟ้า ห ย า ด น ้ ำ ฟ ้ า ศรีธนญชัย ศ ร ี ธ น ญ ช ั ย วันพฤหัสฯ ว ั น พ ฤ ห ั ส ฯ ฉ้อราษฎร์บังหลวง ฉ ้ อ ร า ษ ฎ ร ์ บ ั ง ห ล ว ง สามสิบหก ส า ม ส ิ บ ห ก รัฐเอกราช ร ั ฐ เ อ ก ร า ช จันทรุปราคา จ ั น ท ร ุ ป ร า ค า เข้าชื่อ เ ข ้ า ช ื ่ อ อาดดิสอาบาบา อ า ด ด ิ ส อ า บ า บ า มวยปล้ำ ม ว ย ป ล ้ ำ หมู่เลือด ห ม ู ่ เ ล ื อ ด นิวเม็กซิโก น ิ ว เ ม ็ ก ซ ิ โ ก สีชอล์ค ส ี ช อ ล ์ ค สกรรมกริยา ส ก ร ร ม ก ร ิ ย า เน็คไท เ น ็ ค ไ ท ความชื้นสัมพัทธ์ ค ว า ม ช ื ้ น ส ั ม พ ั ท ธ ์ กระเรียน ก ร ะ เ ร ี ย น โทรจิต โ ท ร จ ิ ต ลูกน้ำ ล ู ก น ้ ำ เป็นชู้ เ ป ็ น ช ู ้ เครื่องเรือน เ ค ร ื ่ อ ง เ ร ื อ น คลื่นใต้น้ำ ค ล ื ่ น ใ ต ้ น ้ ำ ความจงใจ ค ว า ม จ ง ใ จ เครื่องพิมพ์ดีด เ ค ร ื ่ อ ง พ ิ ม พ ์ ด ี ด แฟลเจลลัม แ ฟ ล เ จ ล ล ั ม ราชาศัพท์ ร า ช า ศ ั พ ท ์ สต็อกโฮล์ม ส ต ็ อ ก โ ฮ ล ์ ม เล่นไม่ซื่อ เ ล ่ น ไ ม ่ ซ ื ่ อ น้ำมันก๊าด น ้ ำ ม ั น ก ๊ า ด สปาเกตตี ส ป า เ ก ต ต ี เรื่องขำขัน เ ร ื ่ อ ง ข ำ ข ั น ห้ามสูบบุหรี่ ห ้ า ม ส ู บ บ ุ ห ร ี ่ ดินนวล ด ิ น น ว ล สหภาพโซเวียต ส ห ภ า พ โ ซ เ ว ี ย ต สิบแปด ส ิ บ แ ป ด รถเวียน ร ถ เ ว ี ย น ด้ำ ด ้ ำ ข้าวยากหมากแพง ข ้ า ว ย า ก ห ม า ก แ พ ง โห่ โ ห ่ ขนมปังกรอบ ข น ม ป ั ง ก ร อ บ สมณะกระทรวง ส ม ณ ะ ก ร ะ ท ร ว ง ยาจุดกันยุง ย า จ ุ ด ก ั น ย ุ ง ตารางธาตุ ต า ร า ง ธ า ต ุ ปิตา ป ิ ต า วาสลีน ว า ส ล ี น กระจกนาฬิกา ก ร ะ จ ก น า ฬ ิ ก า แกลบ แ ก ล บ เห็ดหอม เ ห ็ ด ห อ ม เอร็ด เ อ ร ็ ด ลำนำนิทาน ล ำ น ำ น ิ ท า น มหาศักราช ม ห า ศ ั ก ร า ช ยานัตถุ์ ย า น ั ต ถ ุ ์ ตลับดินสอ ต ล ั บ ด ิ น ส อ เรือแจว เ ร ื อ แ จ ว น่ารักน่าชัง น ่ า ร ั ก น ่ า ช ั ง เดลาแวร์ เ ด ล า แ ว ร ์ สโนว์ไวต์ ส โ น ว ์ ไ ว ต ์ ฬ่อ ฬ ่ อ จอมเผด็จการ จ อ ม เ ผ ด ็ จ ก า ร แซคราเมนโต แ ซ ค ร า เ ม น โ ต ฟักแม้ว ฟ ั ก แ ม ้ ว สมเด็จบรมบพิตรพระราชสมภารเจ้า ส ม เ ด ็ จ บ ร ม บ พ ิ ต ร พ ร ะ ร า ช ส ม ภ า ร เ จ ้ า ประโยคความรวม ป ร ะ โ ย ค ค ว า ม ร ว ม กอปร ก อ ป ร ผักกาดก้านขาว ผ ั ก ก า ด ก ้ า น ข า ว
26,908
https://github.com/b-cube/bcube-triplestore/blob/master/ttl/7c/7c66f702ae48f75b3df90d3dba4f869cafb4dc5a_triples.ttl
Github Open Source
Open Source
MIT
null
bcube-triplestore
b-cube
Turtle
Code
403
1,847
@prefix bcube: <http://purl.org/BCube/#> . @prefix bibo: <http://purl.org/ontology/bibo/#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix dcat: <http://www.w3.org/TR/vocab-dcat/#> . @prefix dcterms: <http://purl.org/dc/terms/> . @prefix esip: <http://purl.org/esip/#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix vcard: <http://www.w3.org/TR/vcard-rdf/#> . @prefix xml: <http://www.w3.org/XML/1998/namespace> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . <urn:uuid:4a538437-b9ae-4f05-8112-9e2e65b0d9d4> a "ISO 19115:2003/19139" ; bcube:dateCreated "2015-03-06T04:13:14.896Z" ; bcube:lastUpdated "2015-03-06T04:13:14.896Z" ; bcube:originatedFrom <urn:uuid:91945e58-5c31-47ae-bf21-98fe3e85f884> ; owl:a dcat:CatalogRecord ; foaf:primaryTopic <urn:uuid:d86b2938-854b-4476-bc80-6f84bd0bae15> . <urn:uuid:59cf2de9-fe83-4688-b07f-bd4ec881e437> bcube:hasType "theme" ; bcube:hasValue "Geophysical", "drift buoy", "ocean currents" ; dc:partOf "none" ; owl:a bcube:thesaurusSubset . <urn:uuid:91945e58-5c31-47ae-bf21-98fe3e85f884> bcube:HTTPStatusCodeValue 200 ; bcube:HTTPStatusFamilyCode 200 ; bcube:HTTPStatusFamilyType "Success message" ; bcube:atTime "2015-03-06T04:13:14.896Z" ; bcube:hasConfidence "Good" ; bcube:hasUrlSource "Harvested" ; bcube:reasonPhrase "OK" ; bcube:validatedOn "2015-03-06T04:13:14.896Z" ; dc:identifier "urn:sha:3bce8a483a8bdc0c59de16c6298bd5e63b8894866a0c2a7d8cf5d83c" ; owl:a bcube:Url ; vcard:hasUrl "http://catalog.data.gov/harvest/object/afc3cfa4-59d6-4d2b-b6b1-ff0b3607c823" . <urn:uuid:d86b2938-854b-4476-bc80-6f84bd0bae15> bcube:dateCreated "2015-03-06T04:13:14.896Z" ; bcube:hasMetadataRecord <urn:uuid:4a538437-b9ae-4f05-8112-9e2e65b0d9d4> ; bcube:lastUpdated "2015-03-06T04:13:14.896Z" ; dc:conformsTo <urn:uuid:59cf2de9-fe83-4688-b07f-bd4ec881e437>, <urn:uuid:e57f3183-b558-4522-9671-49503d6351a0> ; dc:description "This is one data set of a data package consisting of thirteen point data sets that have as attributes the direction and velocity of ocean currents in the 'eastern' Gulf of Mexico as determined by drift buoys from February 1996 to June 1997. The data are summarized by quarter degree cells and represent the time weighted average of drift direction and velocity for all drift buoys that entered the cell during the summary time period. Twelve of the data sets are one month averages, one data set is a one year average from all the months. The area covered is nominally the eastern Gulf of Mexico, but during the course of the study, the buoys drifted as far west as Texas. These spatial extent, object count and range attribute metadata items apply in particular to the one-year average data set, however the general characteristics of the dataset (coordinate system, attributes and attribute definitions) apply to all thirteen." ; dc:spatial "POLYGON ((-97.875 23.875,-97.875 30.375,-81.125 30.375,-81.125 23.875,-97.875 23.875))" ; dcterms:references <urn:uuid:f4c51c8f-fa7c-42d9-a6a1-072ef574456e> ; dcterms:title "Eastern Gulf of Mexico, February 1996 to June 1997 Average Ocean Currents, Geographic NAD83, MMS (1999) [ocean_currents_egom_AVG_MMS_1997]" ; esip:eastBound "-81.125"^^xsd:float ; esip:endDate "1997-06-28"^^xsd:date ; esip:northBound "30.375"^^xsd:float ; esip:southBound "23.875"^^xsd:float ; esip:startDate "1996-02-05"^^xsd:date ; esip:westBound "-97.875"^^xsd:float ; owl:a dcat:Dataset . <urn:uuid:e57f3183-b558-4522-9671-49503d6351a0> bcube:hasType "place" ; bcube:hasValue "Alabama", "Florida", "Gulf of Mexico", "Louisiana", "Mississippi" ; dc:partOf "none" ; owl:a bcube:thesaurusSubset . <urn:uuid:f4c51c8f-fa7c-42d9-a6a1-072ef574456e> bcube:HTTPStatusCodeValue 200 ; bcube:HTTPStatusFamilyCode 200 ; bcube:HTTPStatusFamilyType "Success message" ; bcube:atTime "2015-03-06T04:13:14.896Z" ; bcube:hasConfidence "Good" ; bcube:hasUrlSource "Harvested" ; bcube:reasonPhrase "OK" ; bcube:validatedOn "2015-03-06T04:13:14.896Z" ; dc:identifier "urn:sha:110c39273f6f1f96b898b4d887c2ae938f071d5eb7b911b287cf2f47" ; owl:a bcube:Url ; vcard:hasUrl "http://lagic.lsu.edu/data/losco/ocean_currents_egom_AVG_MMS_1997.zip" .
41,266
https://github.com/JamesYang-7/MyRenderer/blob/master/src/sphere.cpp
Github Open Source
Open Source
MIT
2,022
MyRenderer
JamesYang-7
C++
Code
228
642
#include "sphere.h" bool Sphere::hit(const Ray& ray, double t_min, double t_max, HitRecord& rec) const { double root = 0; // Solve t^2*d.*d + 2*t*(o-c).*d + (o-c).*(o-c)-R^2 = 0 double eps = 0; Vec3 oc = ray.origin() - center; double b = dot(oc, ray.direction()); double delta = b * b - dot(oc, oc) + radius * radius; if (delta < 0) return 0; double delta_sqrt = sqrt(delta); root = -b - delta_sqrt; if (root < t_min || root > t_max) { root = -b + delta_sqrt; if (root < t_min || root > t_max) { return false; } } rec.t = root; rec.p = ray.at(root); rec.normal = (rec.p - center) / radius; rec.mat_ptr = mat_ptr; Vec3 outward_normal = (rec.p - center) / radius; rec.set_face_normal(ray, outward_normal); get_sphere_uv(outward_normal, rec.u, rec.v); return true; } bool Sphere::bounding_box(double time0, double time1, AABB& output_box) const { double absr = fabs(radius); output_box = AABB(center - Vec3(absr, absr, absr), center + Vec3(absr, absr, absr)); return true; } double Sphere::pdf_value(const Point3& origin, const Vec3& direction) const { HitRecord hrec; if (!this->hit(Ray(origin, direction), 1e-4, infinity, hrec)) { return 0; } double cos_theta_max = sqrt(1 - radius * radius / (center - origin).length_squared()); double solid_angle = 2 * PI * (1 - cos_theta_max); return 1 / solid_angle; } Vec3 Sphere::generate_random(const Vec3& origin) const { Vec3 direction = center - origin; auto distance_squared = direction.length_squared(); ONB uvw; uvw.build_from_w(direction); return uvw.local(random_to_sphere(radius, distance_squared)); }
3,900
https://github.com/tylde/emblem-ui/blob/master/packages/data/src/components/Table/Table.tsx
Github Open Source
Open Source
MIT
2,020
emblem-ui
tylde
TypeScript
Code
48
152
import React from 'react'; import {EmblemUITheme, useTheme} from '@emblem-ui/styles'; import {StyledTable} from './Table.styles'; interface Table extends React.HTMLAttributes<HTMLDivElement> { children: React.ReactNode; } const Table: React.FC<Table> = ({ children, ...otherProps }) => { const theme: EmblemUITheme = useTheme(); return ( <StyledTable theme={theme} {...otherProps}> {children} </StyledTable> ); }; export default Table;
35,836
https://github.com/sumanth712bs/aws-toolkit-jetbrains/blob/master/jetbrains-core/src/software/aws/toolkits/jetbrains/ui/ProgressPanel.kt
Github Open Source
Open Source
Apache-2.0
2,020
aws-toolkit-jetbrains
sumanth712bs
Kotlin
Code
142
527
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package software.aws.toolkits.jetbrains.ui import com.intellij.openapi.progress.util.AbstractProgressIndicatorExBase import com.intellij.openapi.wm.ex.ProgressIndicatorEx import com.intellij.ui.components.JBLabel import com.intellij.util.ui.UIUtil.invokeLaterIfNeeded import javax.swing.JButton import javax.swing.JLabel import javax.swing.JPanel import javax.swing.JProgressBar class ProgressPanel(progressIndicator: ProgressIndicatorEx) : AbstractProgressIndicatorExBase() { private lateinit var text2Label: JBLabel private lateinit var textLabel: JLabel private lateinit var progressBar: JProgressBar private lateinit var cancelButton: JButton private lateinit var content: JPanel init { progressIndicator.addStateDelegate(this) setModalityProgress(null) cancelButton.addActionListener { progressIndicator.cancel() } } override fun setText(text: String?) { super.setText(text) invokeLaterIfNeeded { textLabel.text = text } } override fun setFraction(fraction: Double) { super.setFraction(fraction) invokeLaterIfNeeded { val value = (100 * fraction).toInt() progressBar.value = value progressBar.string = "$value%" } } override fun setText2(text: String?) { super.setText2(text) invokeLaterIfNeeded { text2Label.text = text } } override fun setIndeterminate(indeterminate: Boolean) { invokeLaterIfNeeded { progressBar.isIndeterminate = indeterminate } } override fun cancel() { super.cancel() cancelButton.isEnabled = false } }
35,151
https://github.com/piller-imre/notte/blob/master/models.py
Github Open Source
Open Source
MIT
null
notte
piller-imre
Python
Code
148
483
import json from app import db class Note(db.Model): """A note about an information item""" __tablename__ = 'notes' id = db.Column(db.Integer, primary_key=True) location = db.Column(db.String, nullable=None) description = db.Column(db.String) tags = db.Column(db.String) def to_dict(self): """Returns with the dictionary representation of the note""" fields = { 'id': self.id, 'location': self.location, 'description': self.description, 'tags': self.tags } return fields def to_json(self): """Returns with the JSON representation of the note""" return json.dumps(self.to_dict()) class Tag(db.Model): """Tag as a label or keyword""" __tablename__ = 'tags' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, nullable=None) def to_dict(self): """Returns with the dictionary representation of the tag""" fields = { 'id': self.id, 'name': self.location } return fields def to_json(self): """Returns with the JSON representation of the tag""" return json.dumps(self.to_dict()) class Association(db.Model): """Association which binds the notes and tags""" __tablename__ = 'associations' note_id = db.Column(db.Integer, db.ForeignKey('notes.id'), primary_key=True) tag_id = db.Column(db.Integer, db.ForeignKey('tags.id'), primary_key=True) note = db.relationship('Note', backref='tag_association') tag = db.relationship('Tag', backref='note_association')
7,091
https://github.com/eqillibrium/top-app-api/blob/master/src/page/page.controller.ts
Github Open Source
Open Source
MIT
null
top-app-api
eqillibrium
TypeScript
Code
187
732
import { Body, Controller, Delete, Get, HttpCode, NotFoundException, Param, Patch, Post, UseGuards, UsePipes, ValidationPipe } from '@nestjs/common'; import { PageModel } from './page.model'; import { FindPageDto } from './dto/find-page.dto'; import { PageService } from './page.service'; import { CreatePageDto } from './dto/created-page.dto'; import { IdValidationPipe } from '../pipes/id-validation.pipe'; import { NOT_FOUND_PAGE_ERROR } from './page.constants'; import { JwtAuthGuard } from '../auth/guards/jwt.guard'; @Controller('page') export class PageController { constructor(private readonly pageService: PageService) {} @UseGuards(JwtAuthGuard) @Post('create') async create(@Body() dto: CreatePageDto) { return this.pageService.create(dto) } @UseGuards(JwtAuthGuard) @Get(':id') async get(@Param('id', IdValidationPipe) id: string) { const page = this.pageService.findByID(id) if (!page) { throw new NotFoundException(NOT_FOUND_PAGE_ERROR) } return page } @Get('byAlias/:alias') async getByAlias(@Param('alias') alias: string) { const page = this.pageService.findByAlias(alias) if (!page) { throw new NotFoundException(NOT_FOUND_PAGE_ERROR) } return page } @UseGuards(JwtAuthGuard) @Delete(':id') async delete(@Param('id', IdValidationPipe) id: string) { const deletedPage = this.pageService.deleteByID(id) if (!deletedPage) { throw new NotFoundException(NOT_FOUND_PAGE_ERROR) } } @UseGuards(JwtAuthGuard) @Patch(':id') async patch(@Param('id') id: string, @Body() dto: CreatePageDto) { const updatedPage = this.pageService.updateByID(id, dto) if (!updatedPage) { throw new NotFoundException(NOT_FOUND_PAGE_ERROR) } } @UsePipes(new ValidationPipe()) @HttpCode(200) @Post('find') async find(@Body() dto: FindPageDto) { return this.pageService.findByCategory(dto.firstCategory) } @Get('textSearch/:text') async textSearch (@Param('text') text: string) { return this.pageService.findByText(text) } }
6,725
https://github.com/marklogic/java-client-api/blob/master/ml-development-tools/src/test/java/com/marklogic/client/test/gradle/EndpointProxiesGenTaskTest.java
Github Open Source
Open Source
Apache-2.0, EPL-1.0, Classpath-exception-2.0, LGPL-2.1-or-later, LGPL-2.1-only, LicenseRef-scancode-mit-old-style, OFL-1.1, BSD-4-Clause, LicenseRef-scancode-rsa-1990, BSD-3-Clause, JSON, CC-BY-4.0, LicenseRef-scancode-mit-no-advert-export-control, LicenseRef-scancode-generic-cla, LicenseRef-scancode-free-unknown, WTFPL, CC-BY-SA-3.0, LicenseRef-scancode-other-permissive, OFL-1.0, EPL-2.0, CDDL-1.0, CDDL-1.1, LicenseRef-scancode-jdom, MIT, LicenseRef-scancode-mit-modification-obligations, GCC-exception-3.1, MIT-CMU, CC0-1.0, GPL-2.0-or-later, LicenseRef-scancode-proprietary-license, LicenseRef-scancode-michigan-disclaimer, LicenseRef-scancode-khronos, CC-BY-3.0, LicenseRef-scancode-rsa-md4, ISC, zlib-acknowledgement, OLDAP-2.8, GPL-2.0-only, MPL-1.0, LicenseRef-scancode-unknown-license-reference, Unlicense, LicenseRef-scancode-unicode, LicenseRef-scancode-nrl-permission, LicenseRef-scancode-brian-gladman-3-clause, W3C, FSFULLRWD, FreeBSD-DOC, LicenseRef-scancode-public-domain, CPL-1.0, LicenseRef-scancode-unknown, BSD-2-Clause, BSD-4-Clause-UC, MPL-2.0, CC-PDDC, RSA-MD
2,023
java-client-api
marklogic
Java
Code
469
2,002
/* * Copyright (c) 2022 MarkLogic Corporation * * 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.marklogic.client.test.gradle; import org.gradle.testkit.runner.BuildResult; import org.gradle.testkit.runner.GradleRunner; import org.junit.Rule; import org.junit.rules.TemporaryFolder; import org.junit.Test; import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; public class EndpointProxiesGenTaskTest { @Rule public TemporaryFolder testDir = new TemporaryFolder(); boolean isInitialized = false; TestDir testEnv; class TestDir { File srcDir; File serviceDir; File javaBaseDir; File buildFile; File propsFile; File outClass; TestDir(TemporaryFolder testDir) throws IOException { String sourcePath = "ml-modules/root/dbfunctiondef/positive/sessions/"; srcDir = testDir.newFolder("src"); serviceDir = new File(srcDir, sourcePath); javaBaseDir = new File(srcDir, "main/java"); buildFile = testDir.newFile("build.gradle"); propsFile = testDir.newFile("gradle.properties"); outClass = new File(javaBaseDir, "com/marklogic/client/test/dbfunction/positive/SessionsBundle.java"); serviceDir.mkdirs(); GradleTestUtil.copyFiles(new File("src/test/" + sourcePath), serviceDir); javaBaseDir.mkdirs(); } } public void initTestEnv() throws IOException { if (!isInitialized) { testEnv = new TestDir(testDir); isInitialized = true; } } @Test public void testTaskInit() throws IOException { initTestEnv(); StringBuilder buildText = new StringBuilder() .append("plugins {\n") .append(" id 'com.marklogic.ml-development-tools'\n") .append("}\n") .append("task generateTestProxy(type: com.marklogic.client.tools.gradle.EndpointProxiesGenTask) {\n") .append(" serviceDeclarationFile = '"+testEnv.serviceDir.getPath()+"/service.json'\n") .append(" javaBaseDirectory = '"+testEnv.javaBaseDir.getPath()+"'\n") .append("}\n"); writeBuildFile(buildText); BuildResult result = GradleRunner .create() .withProjectDir(testDir.getRoot()) .withPluginClasspath() .withArguments("generateTestProxy") .withDebug(true) .build(); assertTrue("task init did not generate "+testEnv.outClass.getPath(), testEnv.outClass.exists()); testEnv.buildFile.delete(); testEnv.outClass.delete(); } @Test public void testCommandLineInit() throws IOException { initTestEnv(); StringBuilder buildText = new StringBuilder() .append("plugins {\n") .append(" id 'com.marklogic.ml-development-tools'\n") .append("}\n"); writeBuildFile(buildText); BuildResult result = GradleRunner .create() .withProjectDir(testDir.getRoot()) .withPluginClasspath() .withArguments( "-PserviceDeclarationFile="+testEnv.serviceDir.getPath()+"/service.json", "-PjavaBaseDirectory="+testEnv.javaBaseDir.getPath(), "generateEndpointProxies" ) .withDebug(true) .build(); assertTrue("command line did not generate "+testEnv.outClass.getPath(), testEnv.outClass.exists()); testEnv.buildFile.delete(); testEnv.outClass.delete(); } @Test public void testPropertiesFile() throws IOException { initTestEnv(); StringBuilder fileText = new StringBuilder() .append("plugins {\n") .append(" id 'com.marklogic.ml-development-tools'\n") .append("}\n"); writeBuildFile(fileText); fileText = new StringBuilder() .append("serviceDeclarationFile="+testEnv.serviceDir.getPath()+"/service.json\n") .append("javaBaseDirectory="+testEnv.javaBaseDir.getPath()+"\n") .append("}\n"); GradleTestUtil.writeTextFile(fileText.toString(), testEnv.propsFile); BuildResult result = GradleRunner .create() .withProjectDir(testDir.getRoot()) .withPluginClasspath() .withArguments("generateEndpointProxies") .withDebug(true) .build(); assertTrue("config did not generate "+testEnv.outClass.getPath(), testEnv.outClass.exists()); testEnv.buildFile.delete(); testEnv.propsFile.delete(); testEnv.outClass.delete(); } @Test public void testConfig() throws IOException { initTestEnv(); StringBuilder buildText = new StringBuilder() .append("plugins {\n") .append(" id 'com.marklogic.ml-development-tools'\n") .append("}\n") .append("ext {\n") .append(" endpointProxiesConfig {\n") .append(" serviceDeclarationFile = '"+testEnv.serviceDir.getPath()+"/service.json'\n") .append(" javaBaseDirectory = '"+testEnv.javaBaseDir.getPath()+"'\n") .append(" }\n") .append("}\n"); writeBuildFile(buildText); BuildResult result = GradleRunner .create() .withProjectDir(testDir.getRoot()) .withPluginClasspath() .withArguments("generateEndpointProxies") .withDebug(true) .build(); assertTrue("config did not generate "+testEnv.outClass.getPath(), testEnv.outClass.exists()); testEnv.buildFile.delete(); testEnv.outClass.delete(); } @Test public void testJavaDefault() throws IOException { initTestEnv(); StringBuilder buildText = new StringBuilder() .append("plugins {\n") .append(" id 'com.marklogic.ml-development-tools'\n") .append("}\n") .append("task generateTestProxy(type: com.marklogic.client.tools.gradle.EndpointProxiesGenTask) {\n") .append(" serviceDeclarationFile = '"+testEnv.serviceDir.getPath()+"/service.json'\n") .append("}\n"); writeBuildFile(buildText); BuildResult result = GradleRunner .create() .withProjectDir(testDir.getRoot()) .withPluginClasspath() .withArguments("generateTestProxy") .withDebug(true) .build(); assertTrue("buildscript did not generate "+testEnv.outClass.getPath(), testEnv.outClass.exists()); testEnv.buildFile.delete(); testEnv.outClass.delete(); } public void writeBuildFile(StringBuilder text) throws IOException { GradleTestUtil.writeTextFile(text.toString(), testEnv.buildFile); } }
373
https://github.com/HighEncryption/SyncPro/blob/master/SyncPro.UI/Dialogs/EncryptionSettingsDialogViewModel.cs
Github Open Source
Open Source
MIT
2,022
SyncPro
HighEncryption
C#
Code
277
960
namespace SyncPro.UI.Dialogs { using System.ComponentModel; using System.Diagnostics; using System.Security.Cryptography.X509Certificates; using System.Windows.Input; using SyncPro.UI.Framework; using SyncPro.UI.Framework.MVVM; public class EncryptionSettingsDialogViewModel : ViewModelBase, IRequestClose { public ICommand OKCommand { get; } public ICommand CancelCommand { get; } public ICommand CloseWindowCommand { get; } public ICommand OpenCertificateCommand { get; } public EncryptionSettingsDialogViewModel() { this.OKCommand = new DelegatedCommand(o => this.HandleClose(true), this.CanOkCommandExecute); this.CancelCommand = new DelegatedCommand(o => this.HandleClose(false)); this.CloseWindowCommand = new DelegatedCommand(o => this.HandleClose(false)); this.OpenCertificateCommand = new DelegatedCommand( o => this.OpenCertificate(), o => this.LoadExistingCertificate); this.CreateNewCertificate = true; } [DebuggerBrowsable(DebuggerBrowsableState.Never)] private bool isCreateMode; public bool IsCreateMode { get { return this.isCreateMode; } set { this.SetProperty(ref this.isCreateMode, value); } } [DebuggerBrowsable(DebuggerBrowsableState.Never)] private bool isEncryptionEnabled; public bool IsEncryptionEnabled { get { return this.isEncryptionEnabled; } set { this.SetProperty(ref this.isEncryptionEnabled, value); } } [DebuggerBrowsable(DebuggerBrowsableState.Never)] private bool createNewCertificate; public bool CreateNewCertificate { get { return this.createNewCertificate; } set { this.SetProperty(ref this.createNewCertificate, value); } } [DebuggerBrowsable(DebuggerBrowsableState.Never)] private bool loadExistingCertificate; public bool LoadExistingCertificate { get { return this.loadExistingCertificate; } set { this.SetProperty(ref this.loadExistingCertificate, value); } } [DebuggerBrowsable(DebuggerBrowsableState.Never)] private bool existingCertificateIsValid; public bool ExistingCertificateIsValid { get { return this.existingCertificateIsValid; } set { this.SetProperty(ref this.existingCertificateIsValid, value); } } [DebuggerBrowsable(DebuggerBrowsableState.Never)] private X509Certificate2 existingCertificate; public X509Certificate2 ExistingCertificate { get { return this.existingCertificate; } set { this.SetProperty(ref this.existingCertificate, value); } } private void OpenCertificate() { } private bool CanOkCommandExecute(object o) { return !this.IsEncryptionEnabled || (this.IsEncryptionEnabled && this.CreateNewCertificate) || (this.IsEncryptionEnabled && this.LoadExistingCertificate && this.ExistingCertificateIsValid); } private void HandleClose(bool dialogResult) { this.RequestClose?.Invoke(this, new RequestCloseEventArgs(dialogResult)); } #region IRequestClose public event RequestCloseEventHandler RequestClose; public void WindowClosing(CancelEventArgs e) { if (this.MustClose) { // We are being forced to close, so don't show the confirmation message. e.Cancel = false; } } public bool MustClose { get; set; } #endregion IRequestClose } }
47,987
https://github.com/kagawa23/openui5/blob/master/src/sap.ui.webc.common/src/sap/ui/webc/common/thirdparty/icons/v4/mirrored-task-circle-2.js
Github Open Source
Open Source
Apache-2.0, LicenseRef-scancode-unknown-license-reference
2,022
openui5
kagawa23
JavaScript
Code
101
476
sap.ui.define(['sap/ui/webc/common/thirdparty/base/asset-registries/Icons'], function (Icons) { 'use strict'; const name = "mirrored-task-circle-2"; const pathData = "M62 255q-6 1-11-3.5T45 241q-1-7 3.5-11.5T60 224h57q-1-1-2-1.5t-2-1.5q-13-6-30-17t-32-26.5-25-36T16 96t8-43.5 21.5-30T75 5.5 108 0h14q6 0 11 4.5t5 11.5q0 16-16 16h1q-15 1-28.5 3.5t-24 9.5T54 64t-6 32q0 19 7.5 34T76 157t30 21.5 36 18.5l-5-58q-1-6 3.5-11t11.5-6q16 0 16 15l8 84q0 14-8 23.5T146 256zM272 32q46 0 87 17.5t71.5 48 48 71.5 17.5 87-17.5 87-48 71.5-71.5 48-87 17.5q-40 0-76-13.5T131 429t-49.5-56.5T53 302q3 1 7 1l88 1 3-1q31-3 52.5-27t20.5-56v-2l-8-85q-2-25-20-42t-44-17h-10q28-20 61-31t69-11z"; const ltr = false; const collection = "SAP-icons"; const packageName = "@ui5/webcomponents-icons"; Icons.registerIcon(name, { pathData, ltr, collection, packageName }); var pathDataV5 = { pathData }; return pathDataV5; });
40,468
https://github.com/i-gaven/Just_a_dumper/blob/master/all_headers/团800-团购大全-6.1.2(越狱应用)_headers/QSStrings.h
Github Open Source
Open Source
MIT
2,018
Just_a_dumper
i-gaven
Objective-C
Code
60
272
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <Foundation/NSObject.h> @interface QSStrings : NSObject { } + (id)decodeBase64WithString:(id)arg1; + (id)encodeBase64WithData:(id)arg1; + (id)encodeBase64WithString:(id)arg1; + (id)encodeBase64UrlWithBase64:(id)arg1; + (id)xmlDateStringForDate:(id)arg1; + (id)escapeForXml:(id)arg1; + (id)htmlEntities:(id)arg1; + (id)trimString:(id)arg1; + (id)implodeArray:(id)arg1 WithGlue:(id)arg2; + (id)implodeObjectArray:(id)arg1 WithSelector:(SEL)arg2 Glue:(id)arg3; @end
31,133
https://github.com/jackass0528/FirebaseUI-Android/blob/master/internal/lint/src/main/java/com/firebaseui/lint/LintIssueRegistry.kt
Github Open Source
Open Source
Apache-2.0, LicenseRef-scancode-generic-cla
2,018
FirebaseUI-Android
jackass0528
Kotlin
Code
24
84
package com.firebaseui.lint import com.android.tools.lint.client.api.IssueRegistry /** * Registry for custom FirebaseUI lint checks. */ class LintIssueRegistry : IssueRegistry() { override fun getIssues() = listOf(NonGlobalIdDetector.NON_GLOBAL_ID) }
40,957
https://github.com/hexiaoyuan/log4cplus/blob/master/src/ndc.cxx
Github Open Source
Open Source
Apache-2.0
2,020
log4cplus
hexiaoyuan
C++
Code
738
2,444
// Module: Log4CPLUS // File: ndc.cxx // Created: 6/2001 // Author: Tad E. Smith // // // Copyright 2001-2015 Tad E. Smith // // 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 <log4cplus/ndc.h> #include <log4cplus/internal/internal.h> #include <utility> #include <algorithm> #if defined (LOG4CPLUS_WITH_UNIT_TESTS) #include <catch.hpp> #endif namespace log4cplus { /////////////////////////////////////////////////////////////////////////////// // log4cplus::DiagnosticContext ctors /////////////////////////////////////////////////////////////////////////////// namespace { static void init_full_message (log4cplus::tstring & fullMessage, log4cplus::tstring const & message, DiagnosticContext const * parent) { if (parent) { fullMessage.reserve (parent->fullMessage.size () + 1 + message.size ()); fullMessage = parent->fullMessage; fullMessage += LOG4CPLUS_TEXT(" "); fullMessage += message; } else fullMessage = message; } } // namespace DiagnosticContext::DiagnosticContext(const log4cplus::tstring& message_, DiagnosticContext const * parent) : message(message_) , fullMessage() { init_full_message (fullMessage, message, parent); } DiagnosticContext::DiagnosticContext(tchar const * message_, DiagnosticContext const * parent) : message(message_) , fullMessage() { init_full_message (fullMessage, message, parent); } DiagnosticContext::DiagnosticContext(const log4cplus::tstring& message_) : message(message_) , fullMessage(message) { } DiagnosticContext::DiagnosticContext(tchar const * message_) : message(message_) , fullMessage(message) { } DiagnosticContext::DiagnosticContext (DiagnosticContext const & other) : message (other.message) , fullMessage (other.fullMessage) { } DiagnosticContext & DiagnosticContext::operator = ( DiagnosticContext const & other) { DiagnosticContext (other).swap (*this); return *this; } DiagnosticContext::DiagnosticContext (DiagnosticContext && other) : message (std::move (other.message)) , fullMessage (std::move (other.fullMessage)) { } DiagnosticContext & DiagnosticContext::operator = (DiagnosticContext && other) { DiagnosticContext (std::move (other)).swap (*this); return *this; } void DiagnosticContext::swap (DiagnosticContext & other) { using std::swap; swap (message, other.message); swap (fullMessage, other.fullMessage); } /////////////////////////////////////////////////////////////////////////////// // log4cplus::NDC ctor and dtor /////////////////////////////////////////////////////////////////////////////// NDC::NDC() { } NDC::~NDC() { } /////////////////////////////////////////////////////////////////////////////// // log4cplus::NDC public methods /////////////////////////////////////////////////////////////////////////////// void NDC::clear() { DiagnosticContextStack* ptr = getPtr(); DiagnosticContextStack ().swap (*ptr); } void NDC::remove() { clear(); } DiagnosticContextStack NDC::cloneStack() const { DiagnosticContextStack* ptr = getPtr(); return DiagnosticContextStack(*ptr); } void NDC::inherit(const DiagnosticContextStack& stack) { DiagnosticContextStack* ptr = getPtr(); DiagnosticContextStack (stack).swap (*ptr); } log4cplus::tstring const & NDC::get() const { DiagnosticContextStack* ptr = getPtr(); if(!ptr->empty()) return ptr->back().fullMessage; else return internal::empty_str; } std::size_t NDC::getDepth() const { DiagnosticContextStack* ptr = getPtr(); return ptr->size(); } log4cplus::tstring NDC::pop() { DiagnosticContextStack* ptr = getPtr(); if(!ptr->empty()) { tstring message; message.swap (ptr->back ().message); ptr->pop_back(); return message; } else return log4cplus::tstring (); } void NDC::pop_void () { DiagnosticContextStack* ptr = getPtr (); if (! ptr->empty ()) ptr->pop_back (); } log4cplus::tstring const & NDC::peek() const { DiagnosticContextStack* ptr = getPtr(); if(!ptr->empty()) return ptr->back().message; else return internal::empty_str; } void NDC::push(const log4cplus::tstring& message) { push_worker (message); } void NDC::push(tchar const * message) { push_worker (message); } template <typename StringType> void NDC::push_worker (StringType const & message) { DiagnosticContextStack* ptr = getPtr(); if (ptr->empty()) ptr->push_back( DiagnosticContext(message, nullptr) ); else { DiagnosticContext const & dc = ptr->back(); ptr->push_back( DiagnosticContext(message, &dc) ); } } void NDC::setMaxDepth(std::size_t maxDepth) { DiagnosticContextStack* ptr = getPtr(); while(maxDepth < ptr->size()) ptr->pop_back(); } DiagnosticContextStack* NDC::getPtr() { internal::per_thread_data * ptd = internal::get_ptd (); return &ptd->ndc_dcs; } // // // NDCContextCreator::NDCContextCreator(const log4cplus::tstring& msg) { getNDC().push(msg); } NDCContextCreator::NDCContextCreator(tchar const * msg) { getNDC().push(msg); } NDCContextCreator::~NDCContextCreator() { getNDC().pop_void(); } #if defined (LOG4CPLUS_WITH_UNIT_TESTS) CATCH_TEST_CASE ("NDC", "[NDC]") { NDC & ndc = getNDC (); ndc.clear (); static tchar const CONTEXT1[] = LOG4CPLUS_TEXT ("c1"); static tchar const CONTEXT2[] = LOG4CPLUS_TEXT ("c2"); static tchar const CONTEXT3[] = LOG4CPLUS_TEXT ("c3"); static tstring const C1C2 = tstring (CONTEXT1) + LOG4CPLUS_TEXT (' ') + CONTEXT2; static tstring const C1C2C3 = C1C2 + LOG4CPLUS_TEXT (' ') + CONTEXT3; CATCH_SECTION ("basic") { CATCH_REQUIRE (ndc.get ().empty ()); CATCH_REQUIRE (ndc.peek ().empty ()); CATCH_REQUIRE (ndc.getDepth () == 0); NDCContextCreator c1 (CONTEXT1); CATCH_REQUIRE (ndc.peek () == CONTEXT1); CATCH_REQUIRE (ndc.get () == CONTEXT1); CATCH_REQUIRE (ndc.getDepth () == 1); { NDCContextCreator c2 (LOG4CPLUS_C_STR_TO_TSTRING (CONTEXT2)); CATCH_REQUIRE (ndc.get () == C1C2); CATCH_REQUIRE (ndc.getDepth () == 2); CATCH_REQUIRE (ndc.peek () == CONTEXT2); ndc.push (CONTEXT3); CATCH_REQUIRE (ndc.get () == C1C2C3); CATCH_REQUIRE (ndc.peek () == CONTEXT3); CATCH_REQUIRE (ndc.pop () == CONTEXT3); } CATCH_REQUIRE (ndc.peek () == CONTEXT1); CATCH_REQUIRE (ndc.get () == CONTEXT1); CATCH_REQUIRE (ndc.getDepth () == 1); } CATCH_SECTION ("remove") { ndc.push (CONTEXT1); CATCH_REQUIRE (ndc.peek () == CONTEXT1); CATCH_REQUIRE (ndc.get () == CONTEXT1); CATCH_REQUIRE (ndc.getDepth () == 1); ndc.remove (); CATCH_REQUIRE (ndc.get ().empty ()); CATCH_REQUIRE (ndc.peek ().empty ()); CATCH_REQUIRE (ndc.getDepth () == 0); } } #endif } // namespace log4cplus
36,981
https://github.com/Astroleander/codash/blob/master/src/code/leetcode/array.209.minimum-size-subarray-sum.medium/solution.slide_window.ts
Github Open Source
Open Source
MIT
null
codash
Astroleander
TypeScript
Code
133
338
import { Solution } from '@/pojo/Solution'; function minSubArrayLen(s: number, nums: number[]): number { let p_low = 0, p_high = -1; let sum = 0, count = 0; let result_low= -1, result_high = Infinity; const len = nums.length; while (p_low < len) { console.log(nums.slice(p_low, p_high + 1), sum) if (sum >= s && count < result_high + 1 - result_low) { result_low = p_low; result_high = p_high; } /** slide high */ if (sum < s && p_high < len) { p_high ++; sum += nums[p_high]; count ++; } /** slide low */ else { sum -= nums[p_low]; count --; p_low ++; } } if (result_high === Infinity) return 0; return result_high - result_low + 1; }; export default Solution.create( minSubArrayLen, [ // 222, [2, 3, 1, 2, 4, 3] 11, [1,2,3,4,5] ], )
30,416
https://github.com/Donkemezuo/9square/blob/master/9squareApp/Controllers/DetailViewController.swift
Github Open Source
Open Source
MIT
null
9square
Donkemezuo
Swift
Code
481
1,595
// // DetailViewController.swift // 9squareApp // // Created by Donkemezuo Raymond Tariladou on 2/14/19. // Copyright © 2019 EnProTech Group. All rights reserved. // import UIKit class DetailViewController: UIViewController { private let detailView = DetailView() private var venue: VenueStruct! private let venueTipPlaceHolder = "Add a note about this venue..." override func viewDidLoad() { super.viewDidLoad() view.addSubview(detailView) detailView.venueName.text = venue.name detailView.venueDescription.text = venue.location.formattedAddress[0] + "\n" + venue.location.formattedAddress[1] getVenueImage() view.backgroundColor = #colorLiteral(red: 0.3176470697, green: 0.07450980693, blue: 0.02745098062, alpha: 1) detailView.venueTip.delegate = self addVenue() setupKeyboardToolbar() } fileprivate func getVenueImage() { if let linkExists = venue.imageLink { if let imageIsInCache = ImageHelper.fetchImageFromCache(urlString: linkExists) { detailView.venueImage.image = imageIsInCache detailView.activityIndicator.stopAnimating() } else { ImageHelper.fetchImageFromNetwork(urlString: linkExists) { (appError, image) in if let appError = appError { print("imageHelper in detail vc error = \(appError)") } else if let image = image { self.detailView.venueImage.image = image self.detailView.activityIndicator.stopAnimating() print("Detail VC made network call for image") } } } } else { ImageAPIClient.getImages(venueID: venue.id) { (appError, link) in if let appError = appError { print("detailVC imageAPIClient error = \(appError)") } else if let link = link { if let imageIsInCache = ImageHelper.fetchImageFromCache(urlString: link) { self.detailView.venueImage.image = imageIsInCache self.detailView.activityIndicator.stopAnimating() } else { ImageHelper.fetchImageFromNetwork(urlString: link) { (appError, image) in if let appError = appError { print("imageHelper in detail vc error = \(appError)") } else if let image = image { self.detailView.venueImage.image = image self.detailView.activityIndicator.stopAnimating() print("Detail VC made network call for image bc link wasn't available") } } } } } } } fileprivate func setupKeyboardToolbar() { let toolbar = UIToolbar(frame: CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: 30)) let flexSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) let doneBtn: UIBarButtonItem = UIBarButtonItem(title: "Done", style: .done , target: self, action: #selector(doneButtonAction)) toolbar.setItems([flexSpace, doneBtn], animated: false) toolbar.sizeToFit() detailView.venueTip.inputAccessoryView = toolbar } @objc private func doneButtonAction() { self.view.endEditing(true) } private func addVenue(){ if let _ = venue { let tabBarButton = UIBarButtonItem.init(barButtonSystemItem: .add, target: self, action: #selector(addToCollection)) navigationItem.rightBarButtonItem = tabBarButton } } @objc private func addToCollection(){ let alertController = UIAlertController(title: "", message: "Please enter a category name", preferredStyle: .alert) let save = UIAlertAction(title: "Submit", style: .default) { (alert) in let savingDate = Date.getISOTimestamp() guard let collectionName = alertController.textFields?.first?.text else {return} var venueTip: String? if self.detailView.venueTip.text != self.venueTipPlaceHolder { venueTip = self.detailView.venueTip.text } if let imageData = self.detailView.venueImage.image { let favoritedVenueImage = imageData.jpegData(compressionQuality: 0.5) let collectionToSave = CollectionsModel.init(collectionName: collectionName) CollectionsDataManager.add(newCollection: collectionToSave) let venueToSet = FaveRestaurant.init(collectionName: collectionName, restaurantName: self.venue.name, favoritedAt: savingDate, imageData: favoritedVenueImage , venueTip: venueTip, description: self.venue.name, address: self.venue.location.modifiedAddress) RestaurantDataManager.addRestaurant(newFavoriteRestaurant: venueToSet, collection: "\(collectionName).plist") self.showAlert(title: "Saved", message: "Successfully favorited to \(collectionName) collection") } } let cancel = UIAlertAction(title: "Cancel", style: .cancel, handler: nil) alertController.addTextField {(textfield) in textfield.placeholder = "Enter collection name" textfield.textAlignment = .center } alertController.addAction(save) alertController.addAction(cancel) present(alertController, animated: true) } init(restuarant: VenueStruct){ super.init(nibName: nil, bundle: nil) self.venue = restuarant } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } } extension DetailViewController: UITextViewDelegate { func textViewDidBeginEditing(_ textView: UITextView) { if textView.text == venueTipPlaceHolder { textView.text = "" } } }
44,788
https://github.com/annaone/quickstart-nubeva-tlsdecrypt/blob/master/docs/partner_editable/_settings.adoc
Github Open Source
Open Source
Apache-2.0
null
quickstart-nubeva-tlsdecrypt
annaone
AsciiDoc
Code
31
142
:quickstart-project-name: quickstart-nubeva-tlsdecrypt :partner-product-name: Nubeva TLS Decrypt :partner-product-short-name: TLS Decrypt :partner-company-name: Nubeva :doc-month: June :doc-year: 2021 :partner-contributors: Erik Freeland, {partner-company-name} :quickstart-contributors: Dylan Owen, Amazon Web Services :deployment_time: 30 minutes :default_deployment_region: us-east-1 :parameters_as_appendix:
12,066
https://github.com/pablo-parra/hey/blob/master/src/main/java/utils/impl/NotificationManagerImpl.java
Github Open Source
Open Source
MIT
null
hey
pablo-parra
Java
Code
372
1,451
package utils.impl; import java.awt.AWTException; import java.awt.Image; import java.awt.MenuItem; import java.awt.PopupMenu; import java.awt.SystemTray; import java.awt.Toolkit; import java.awt.TrayIcon; import java.awt.TrayIcon.MessageType; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.stereotype.Component; import com.google.common.base.Optional; import core.Main; import utils.api.FileManager; import utils.api.NetManager; import utils.api.NotificationManager; import utils.api.PropertyManager; @Component("notificationManager") public class NotificationManagerImpl implements NotificationManager { String IMG_OK = "/resources/img/ok.png"; String IMG_KO = "/resources/img/ko.png"; private String AVAILABLE = "The site is available."; private String UNAVAILABLE = "The site is unavailable"; private String HEY = "HEY"; private String URL = "url"; private String USER_DIR = "user.home"; private AbstractApplicationContext context; private PropertyManager propertyManager; public void notifyAvailability() { Optional<TrayIcon> heyIcon = getHeyIcon(); if(heyIcon.isPresent()){ changeHeyIcon(heyIcon.get(), true); }else{ Optional<TrayIcon> newHeyIcon = createHeyIcon(true); heyIcon = newHeyIcon; } showNotification(heyIcon.get(), true); } public void notifyUnavailability() { Optional<TrayIcon> heyIcon = getHeyIcon(); if(heyIcon.isPresent()){ changeHeyIcon(heyIcon.get(), false); }else{ Optional<TrayIcon> newHeyIcon = createHeyIcon(false); heyIcon = newHeyIcon; } showNotification(heyIcon.get(), false); } private Optional<TrayIcon> getHeyIcon(){ TrayIcon heyIcon = null; try { SystemTray tray = SystemTray.getSystemTray(); TrayIcon[] icons = tray.getTrayIcons(); for (TrayIcon trayIcon : icons) { if (trayIcon.getToolTip().equals(HEY)) heyIcon = trayIcon; } return Optional.of(heyIcon); } catch (Exception e) { //System.out.println("No HEY icon..."); return Optional.absent(); } } private Optional<TrayIcon> createHeyIcon(boolean webIsAvailable){ context = new AnnotationConfigApplicationContext(Main.class); propertyManager = (PropertyManager)context.getBean("propertyManager"); try{ SystemTray tray = SystemTray.getSystemTray(); String image = webIsAvailable ? IMG_OK : IMG_KO; Image img = Toolkit.getDefaultToolkit().getImage(getClass().getResource(image)); //popupmenu PopupMenu trayPopupMenu = new PopupMenu(); //1t menuitem for popupmenu MenuItem info = new MenuItem("Info"); info.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "You are checking the site: " + propertyManager.getProperty(URL)); } }); trayPopupMenu.add(info); //2nd menuitem for popupmenu MenuItem configuration = new MenuItem("Configuration"); configuration.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(null, "You can change the site to be checked and its interval editing the config.json file in "+System.getProperty(USER_DIR)+"\\.hey\\"); } }); trayPopupMenu.add(configuration); //3nd menuitem of popupmenu MenuItem close = new MenuItem("Close"); close.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); trayPopupMenu.add(close); //setting tray icon TrayIcon trayIcon = new TrayIcon(img, "HEY", trayPopupMenu); trayIcon.setImageAutoSize(true); tray.add(trayIcon); return Optional.of(trayIcon); }catch(AWTException awtException){ awtException.printStackTrace(); return Optional.absent(); }finally{ if (context != null) context.close(); } } private void changeHeyIcon(TrayIcon heyIcon, boolean webIsAvailable) { String image = webIsAvailable ? IMG_OK : IMG_KO; Image img = Toolkit.getDefaultToolkit().getImage(getClass().getResource(image)); heyIcon.setImage(img); } private void showNotification(TrayIcon heyIcon, boolean available){ String text = available ? AVAILABLE : UNAVAILABLE; heyIcon.displayMessage(HEY, text, MessageType.INFO); } }
4,132
https://github.com/rising-anti-malware-team/lame/blob/master/python/lame.mt.scanner.py
Github Open Source
Open Source
CNRI-Python, Info-ZIP, 0BSD
2,022
lame
rising-anti-malware-team
Python
Code
618
2,412
import os import sys # import thread import threading import time from lame import * def format_bstring(bstr, CodePage=None): if 3 == sys.version_info.major: if CodePage is None: return bstr.decode() else: return bstr.decode(CodePage) else: return bstr class lame_mt_util: __locker = threading.Lock() @classmethod def DisplayScanResult(cls, fname, result): cls.__locker.acquire() sys.stdout.write(fname) if result is not None: sys.stdout.write(" " + " Infected: " + format_bstring(result.vname) + " (" + format_bstring(result.engid) + ")") sys.stdout.write('\n') cls.__locker.release() class safeq: def __init__(self, size = 100): self.__size = size self.__locker = threading.Lock() self.__queue = list() def enqueue(self, s, force = True): if s is None: return False ret = False if force: while True: self.__locker.acquire() if len(self.__queue) < self.__size: self.__queue.append(s) ret = True self.__locker.release() if ret: return True time.sleep(0.1) else : self.__locker.acquire() if len(self.__queue) < self.__size: self.__queue.append(s) ret = True self.__locker.release() return ret def dequeue(self): vl = None self.__locker.acquire() if len(self.__queue) > 0: vl = self.__queue[0] self.__queue.remove(vl) self.__locker.release() return vl def Count(self): _count = 0 self.__locker.acquire() _count = len(self.__queue) self.__locker.release() return _count class travel_worker: def __init__(self, fq): self.__scan_file_queue = fq self.__travel_path_queue = safeq() self._thread = None self._event = threading.Event() def run(self): self._thread = threading.Thread(target = self.__run, args = ()) self._thread.start() self._event.set() def append_scan_path(self, path): if path is None: return False self.__travel_path_queue.enqueue(path) return True def wait(self): if self._thread is None: return if not self._thread.isAlive(): return self._event.wait() return def __run(self): self._event.wait() self._event.clear() while True: _path = self.__travel_path_queue.dequeue() if _path is None: self.__scan_file_queue.enqueue("exit") break self.__travel(_path) self._event.set() return def __travel(self, path): if path is None: return if os.path.isdir(path): files = os.listdir(path) for _file in files: _path = os.path.join(path, _file) if os.path.isfile(_path): self.__scan_file_queue.enqueue(_path) elif os.path.isdir(_path): self.__travel(_path) else: pass elif os.path.isfile(path): self.__scan_file_queue.enqueue(path) else: pass return class scan_worker: def __init__(self,lamep,fq): self.__scan_file_queue = fq self.__lame = Lame(lamep) self.__running = False self.__thread = None self.file_count = 0 self.virus_count = 0 self.elapse_time = 0 self.__event = threading.Event() def run(self, dbf, param_lst): if self.__running: return True if dbf is None: return False for param in param_lst: self.__lame.SetParam(param) if not self.__lame.Load(dbf): return False self.__running = True self.__thread = threading.Thread(target = self.__scan, args = ()) self.__thread.start() self.__event.set() return True def wait(self): if self.__thread is None: return if not self.__thread.isAlive(): return self.__event.wait() return def __scan(self): self.__event.wait() self.__event.clear() _start_time = time.time() while True: _path = self.__scan_file_queue.dequeue() if _path is None: time.sleep(0.1) continue if _path == 'exit': self.__scan_file_queue.enqueue("exit") break self.file_count += 1 result = self.__lame.ScanFile(_path) if result is not None: self.virus_count += 1 lame_mt_util.DisplayScanResult(_path, result) self.elapse_time = time.time() - _start_time self.__lame.Unload() self.__event.set() return class scanner: def __init__(self, lpath): self._lpath = lpath self._scan_path_queue = safeq() self._vdb = None self._param_lst = None self._travel_worker = travel_worker(self._scan_path_queue) self._workers = list() def load(self, param_lst): if self._lpath is None: return False self._vdb = VirusDb(self._lpath) if not self._vdb.OpenVdb(None): return False self._param_lst = param_lst return True def unload(self): if self._vdb is not None: return self._vdb.CloseVdb() return def run(self, sc): if self._lpath is None: return if self._vdb is None: return self._travel_worker.run() idx = 0 while idx < sc: _scan_work = scan_worker(self._lpath, self._scan_path_queue) _scan_work.run(self._vdb, self._param_lst) self._workers.append(_scan_work) idx += 1 self._travel_worker.wait() _scan_file_count = 0 _virus_count = 0 _elapse_time = 0 for _scan_work in self._workers: _scan_work.wait() _scan_file_count += _scan_work.file_count _virus_count += _scan_work.virus_count if _elapse_time < _scan_work.elapse_time: _elapse_time = _scan_work.elapse_time print("") print("Files: " + str(_scan_file_count)) print("Virus: " + str(_virus_count)) print("elapse: " + str(_elapse_time) + "(s)") return def append_scan_path(self, path): if path is None: return self._travel_worker.append_scan_path(path) def main(lame_path, argv): _lame_path = lame_path _scanner = scanner(_lame_path) _worker_count = 4 _param_lst = [] for param in argv: if param.startswith('-'): idx = param.find("-workers=") if idx == 0: if len(param) == 9: continue vl = param[9:] _vl = int(vl) if _vl > 0 and _vl < 10: _worker_count = _vl else: _param_lst.append(param[1:]) else: _scanner.append_scan_path(param) if not _scanner.load(_param_lst): return _scanner.run(_worker_count) _scanner.unload() return # sys.argv.append('D:\\MyJob\\SDK\\produce\\make\\lame-win-x64') # sys.argv.append('D:\\rsdata\\1\\11') # sys.argv.append('-kill') # sys.argv.append('-workers=8') def exit(signum, frame): sys.exit() if __name__ == '__main__': signal.signal(signal.SIGINT, exit) signal.signal(signal.SIGTERM, exit) main(sys.argv[1], sys.argv[2:])
24,733
https://github.com/beru/oglsc/blob/master/lib/texenv.c
Github Open Source
Open Source
Artistic-2.0
2,013
oglsc
beru
C
Code
331
1,384
/* ** ------------------------------------------------------------------------- ** Vincent SC 1.0 Rendering Library ** ** Texture Environment Functions ** ** Copyright (C) 2008 Vincent Pervasive Media Technologies, LLC. ** ** Licensed under the Artistic License 2.0. ** ------------------------------------------------------------------------- */ #include "common.h" #include "GL/gl.h" #include "context.h" /* ** ------------------------------------------------------------------------- ** Exported API entry points ** ------------------------------------------------------------------------- */ void VPMT_ExecActiveTexture(VPMT_Context * context, GLenum texture) { GLint index; VPMT_NOT_RENDERING(context); if (texture < GL_TEXTURE0 || texture > GL_TEXTURE31) { VPMT_INVALID_ENUM(context); return; } index = texture - GL_TEXTURE0; if (index >= VPMT_MAX_TEX_UNITS) { VPMT_INVALID_VALUE(context); return; } context->activeTexture = texture; context->activeTextureIndex = index; } void VPMT_ExecBindTexture(VPMT_Context * context, GLenum target, GLuint name) { VPMT_Texture2D *texture; VPMT_NOT_RENDERING(context); texture = VPMT_HashTableFind(&context->textures, name); if (!texture) { texture = VPMT_Texture2DAllocate(name); if (!texture) { VPMT_OUT_OF_MEMORY(context); return; } if (!VPMT_HashTableInsert(&context->textures, name, texture)) { VPMT_Texture2DDeallocate(texture); VPMT_OUT_OF_MEMORY(context); return; } } context->texUnits[context->activeTextureIndex].boundTexture = texture; context->texUnits[context->activeTextureIndex].boundTexture2D = texture->name; } void VPMT_ExecGetTexEnvfv(VPMT_Context * context, GLenum target, GLenum pname, GLfloat * params) { VPMT_NOT_RENDERING(context); if (target != GL_TEXTURE_ENV) { VPMT_INVALID_ENUM(context); return; } if (!params) { VPMT_INVALID_VALUE(context); return; } switch (pname) { case GL_TEXTURE_ENV_COLOR: VPMT_Vec4Copy(params, context->texUnits[context->activeTextureIndex].envColor); break; default: VPMT_INVALID_ENUM(context); return; } } void VPMT_ExecGetTexEnviv(VPMT_Context * context, GLenum target, GLenum pname, GLint * params) { VPMT_NOT_RENDERING(context); if (target != GL_TEXTURE_ENV) { VPMT_INVALID_ENUM(context); return; } if (!params) { VPMT_INVALID_VALUE(context); return; } switch (pname) { case GL_TEXTURE_ENV_MODE: *params = context->texUnits[context->activeTextureIndex].envMode; break; default: VPMT_INVALID_VALUE(context); return; } } void VPMT_ExecTexEnvfv(VPMT_Context * context, GLenum target, GLenum pname, const GLfloat * params) { VPMT_NOT_RENDERING(context); if (target != GL_TEXTURE_ENV) { VPMT_INVALID_ENUM(context); return; } if (!params) { VPMT_INVALID_VALUE(context); return; } switch (pname) { case GL_TEXTURE_ENV_COLOR: VPMT_Vec4Copy(context->texUnits[context->activeTextureIndex].envColor, params); context->texUnits[context->activeTextureIndex].envColor4us = VPMT_ConvertVec4ToColor4us(context->texUnits[context->activeTextureIndex].envColor); break; default: VPMT_INVALID_VALUE(context); return; } } void VPMT_ExecTexEnvi(VPMT_Context * context, GLenum target, GLenum pname, GLint param) { VPMT_NOT_RENDERING(context); if (target != GL_TEXTURE_ENV) { VPMT_INVALID_ENUM(context); return; } switch (pname) { case GL_TEXTURE_ENV_MODE: if (param != GL_MODULATE && param != GL_REPLACE && param != GL_DECAL && param != GL_BLEND && param != GL_ADD) { VPMT_INVALID_VALUE(context); return; } context->texUnits[context->activeTextureIndex].envMode = param; break; default: VPMT_INVALID_VALUE(context); return; } } /* $Id: texenv.c 74 2008-11-23 07:25:12Z hmwill $ */
28,430
https://github.com/MatthiasZepper/CoCo-SciLifeLab-Commute/blob/master/talk/data/mapedgesmap.js
Github Open Source
Open Source
MIT
null
CoCo-SciLifeLab-Commute
MatthiasZepper
JavaScript
Code
13
191
export const datamapedgesmap = ` .vx0,.vx1,edge_,.vx0_x,.vx0_y,.vx1_x,.vx1_y,zmn 155926,5642911845,r163bRnuX2,17.9903194,59.2968574,17.9905155,59.2968533,37 5642911845,159027,ImXOAjOwR4,17.9905155,59.2968533,17.991698,59.2968287,38.5 159027,2207882121,xqe7oUs9QU,17.991698,59.2968287,17.991879,59.2968129,40 `; export default datamapedgesmap
12,430
https://github.com/cofoundry-cms/cofoundry/blob/master/src/Cofoundry.Domain/Domain/Pages/Queries/SearchPageRenderSummariesQuery.cs
Github Open Source
Open Source
MIT
2,023
cofoundry
cofoundry-cms
C#
Code
201
369
namespace Cofoundry.Domain; /// <summary> /// Search page data returning the PageRenderSummary projection, which is /// a lighter weight projection designed for rendering to a site when the /// templates, region and block data is not required. The query is /// version-sensitive and defaults to returning published versions only, but /// this behavior can be controlled by the PublishStatus query property. /// </summary> public class SearchPageRenderSummariesQuery : SimplePageableQuery , IQuery<PagedQueryResult<PageRenderSummary>> { /// <summary> /// Locale id to filter the results by, if null then only entities /// with a null locale are shown /// </summary> public int? LocaleId { get; set; } /// <summary> /// By default the query will filter to published pages only. Use this option /// to change this behaviour. /// </summary> public PublishStatusQuery PublishStatus { get; set; } /// <summary> /// Optionally filter by the directory the page is parented to. /// </summary> public int? PageDirectoryId { get; set; } /// <summary> /// Option to reverse the direction of the sort. /// </summary> public SortDirection SortDirection { get; set; } /// <summary> /// The default sort is title ordering, but it can be changed /// with this option. /// </summary> public PageQuerySortType SortBy { get; set; } }
25,453
https://github.com/chuckwondo/iter-tools/blob/master/src/test/$wrap/wrap.d.ts
Github Open Source
Open Source
MIT
2,022
iter-tools
chuckwondo
TypeScript
Code
75
181
/** * @generated-from ./$wrap.d.ts * This file is autogenerated from a template. Please do not edit it directly. * To rebuild it from its template use the command * > npm run generate * More information can be found in CONTRIBUTING.md */ import { Wrappable, IterableIterator } from '../../types/iterable'; declare function wrap<T>(array: Wrappable<T>): IterableIterator<T>; declare function wrap(string: string): IterableIterator<string>; declare function wrapDeep<T>( array: Wrappable<T | Wrappable<T | Wrappable<T>>>, ): IterableIterator<IterableIterator<T>>; export { wrap, wrapDeep };
12,456
https://github.com/greekwelfaresa/idempiere-test/blob/master/au.org.greekwelfaresa.idempiere.test.assertj/src/au/org/greekwelfaresa/idempiere/test/assertj/ad_process/AD_ProcessAssert.java
Github Open Source
Open Source
Apache-2.0
null
idempiere-test
greekwelfaresa
Java
Code
59
231
/** Generated Assertion Class - DO NOT CHANGE */ package au.org.greekwelfaresa.idempiere.test.assertj.ad_process; import javax.annotation.Generated; import org.compiere.model.X_AD_Process; /** Generated assertion class for AD_Process * @author idempiere-test model assertion generator * @version Release 6.2 - $Id: fc094b99781a572fa1c2a08875add3f6abe3b1c4 $ */ @Generated("class au.org.greekwelfaresa.idempiere.test.generator.ModelAssertionGenerator") public class AD_ProcessAssert extends AbstractAD_ProcessAssert<AD_ProcessAssert, X_AD_Process> { /** Standard Constructor */ public AD_ProcessAssert (X_AD_Process actual) { super (actual, AD_ProcessAssert.class); } }
18,781
https://github.com/byrcoder/sps/blob/master/src/url/sps_url.cpp
Github Open Source
Open Source
MIT
2,022
sps
byrcoder
C++
Code
637
1,894
/***************************************************************************** MIT License Copyright (c) 2021 byrcoder Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *****************************************************************************/ #include <sps_url.hpp> #include <http_parser.h> #include <sps_log.hpp> namespace sps { RequestHeader::RequestHeader() {} RequestHeader::RequestHeader(const std::string &key, const std::string &value) { this->key = key; this->value = value; } error_t RequestUrl::from(const std::string &url, PRequestUrl &req) { req = std::make_shared<RequestUrl>(); return req->parse_url(url); } error_t RequestUrl::parse_url(const std::string& url) { struct http_parser_url u; if (http_parser_parse_url(url.c_str(), url.size(), 0, &u) != 0) { sp_error("parser url failed:%s", url.c_str()); return -1; } if (u.field_set & (1 << UF_SCHEMA)) { schema = url.substr(u.field_data[UF_SCHEMA].off, u.field_data[UF_SCHEMA].len); } if (u.field_set & (1 << UF_PORT)) { port = u.port; } else if (schema == "http") { port = 80; } else if (schema == "rtmp") { port = 1935; } else { sp_warn("not found default port for schema:%s", schema.c_str()); port = 0; // unknown port } if (u.field_set & (1 << UF_HOST)) { host = url.substr(u.field_data[UF_HOST].off, u.field_data[UF_HOST].len); } if (u.field_set & (1 << UF_PATH)) { path = url.substr(u.field_data[UF_PATH].off, u.field_data[UF_PATH].len); } if (u.field_set & (1 << UF_QUERY)) { params = url.substr(u.field_data[UF_QUERY].off, u.field_data[UF_QUERY].len); } auto off_pre = 0; do { auto off_key = params.find_first_of('=', off_pre); if (off_key == std::string::npos) break; std::string key = params.substr(off_pre, off_key - off_pre), value; off_pre = off_key + 1; auto off_value = params.find_first_of('&', off_pre); if (off_value == std::string::npos) { value = params.substr(off_pre); pp.push_back(RequestHeader(key, value)); sp_debug("%lu, &:%u, [%s]=[%s], final:%u", off_key, -1, key.c_str(), value.c_str(), off_pre); break; } value = params.substr(off_pre, off_value - off_pre); off_pre = off_value + 1; sp_debug("%lu, &:%lu, [%s]=[%s], final:%u", off_key, off_value, key.c_str(), value.c_str(), off_pre); pp.push_back(RequestParam(key, value)); } while (true); auto n = path.rfind("."); if (n != std::string::npos) { ext = path.substr(n+1); } if (method.empty()) { method = "GET"; } this->url = path + (params.empty() ? "" : "?" + params); if (schema == "file") { this->url = url.substr(sizeof("file://")); this->path = url; this->params = ""; this->port = -1; } sp_info("url:%s -> [%s] [%s:%d] [%s] [%s] [%s] [%s]", url.c_str(), schema.c_str(), host.c_str(), port, path.c_str(), ext.c_str(), params.c_str(), this->url.c_str()); return SUCCESS; } const char* RequestUrl::get_schema() { return schema.c_str(); } const char* RequestUrl::get_url() { return url.c_str(); } const char* RequestUrl::get_host() { return host.c_str(); } int RequestUrl::get_port() { return port; } const char* RequestUrl::get_path() { return path.c_str(); } const char* RequestUrl::get_params() { return params.c_str(); } const char* RequestUrl::get_method() { return method.c_str(); } const char * RequestUrl::get_ext() { return ext.c_str(); } std::string RequestUrl::get_header(const std::string& key) { for (auto& h : headers) { if (h.key == key) return h.value; } return ""; } void RequestUrl::erase_header(const std::string &key) { for (auto it = headers.begin(); it != headers.end(); ++it) { if (it->key == key) { headers.erase(it); return; } } } std::string RequestUrl::get_param(const std::string& key) { for (auto& h : pp) { if (h.key == key) return h.value; } return ""; } bool RequestUrl::is_chunked() { return get_header("Transfer-Encoding") == "chunked"; } int RequestUrl::get_content_length() { std::string cl = get_header("Content-Length"); if (cl.empty()) { return -1; } return atoi(cl.c_str()); } utime_t RequestUrl::get_timeout() { return tm; } std::string RequestUrl::get_ip() { return ip; } } // namespace sps
32,841
https://github.com/atptro/alibabacloud-sdk/blob/master/vod-20170321/java/src/main/java/com/aliyun/vod20170321/models/DescribeVodDomainBpsDataRequest.java
Github Open Source
Open Source
Apache-2.0
null
alibabacloud-sdk
atptro
Java
Code
66
257
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.vod20170321.models; import com.aliyun.tea.*; public class DescribeVodDomainBpsDataRequest extends TeaModel { @NameInMap("OwnerId") public Long ownerId; @NameInMap("DomainName") public String domainName; @NameInMap("StartTime") public String startTime; @NameInMap("EndTime") public String endTime; @NameInMap("Interval") public String interval; @NameInMap("IspNameEn") public String ispNameEn; @NameInMap("LocationNameEn") public String locationNameEn; public static DescribeVodDomainBpsDataRequest build(java.util.Map<String, ?> map) throws Exception { DescribeVodDomainBpsDataRequest self = new DescribeVodDomainBpsDataRequest(); return TeaModel.build(map, self); } }
14,935
https://github.com/boid-com/eosdac-client/blob/master/src/components/controls/vote-delegation.vue
Github Open Source
Open Source
MIT
2,021
eosdac-client
boid-com
Vue
Code
364
1,490
<template> <div v-if="getAccountName && wpcats.length"> <!-- <div class="bg-bg1 round-borders shadow-4 q-pa-md q-mb-md"> My Category Delegations </div> --> <!-- {{ getCatDelegations }} --> <div class="relative-position bg-bg1 bg-logo q-pa-md round-borders shadow-4" > <div class="row gutter-sm "> <div class="col-xs-12 col-md-6 col-xl-4" v-for="(cat, i) in wpcats" :key="`wpcat${i}`" > <q-item class=" bg-bg2 q-pa-md round-borders full-height animate-pop " > <q-item-main> <q-icon v-if=" getAccountName && cat.delegatee && getAccountName != cat.delegatee " :name="$configFile.icon.check" size="24px" color="positive" class="q-pa-sm absolute-top-right" /> <q-item-tile class="text-text1" label>{{ $t(`${cat.label}`) }}</q-item-tile> <div class="q-caption text-text2 q-my-xs"> {{ $t(`${cat.desc}`) }} </div> <member-select itsme="UNDELEGATE" @change="handleCatDelegation(cat.value, $event)" v-model="cat.delegatee" :accountnames="getCustNames" placeholder="Select to Delegate" /> </q-item-main> </q-item> </div> </div> </div> </div> </template> <script> import memberSelect from "components/controls/member-select"; import wpcats from "../../extensions/statics/config/wp_categories.json"; import { mapGetters } from "vuex"; export default { // name: 'ComponentName', components: { memberSelect }, data() { return { wpcats: [] }; }, computed: { ...mapGetters({ getCustodians: "dac/getCustodians", getAccountName: "user/getAccountName", getIsDark: "ui/getIsDark", getAuth: "user/getAuth", getCatDelegations: "user/getCatDelegations" }), getCustNames() { if (this.getCustodians) { return this.getCustodians.map(c => { return c.cust_name; }); } else { return []; } } }, methods: { async setWpCats(force_reload = false) { let mycatvotes; if (!this.getCatDelegations || force_reload) { mycatvotes = await this.$store.dispatch( "user/fetchCatDelegations", this.getAccountName ); console.log("my catvotes", mycatvotes); } else { mycatvotes = this.getCatDelegations; console.log("my stored catvotes", mycatvotes); } this.wpcats = JSON.parse(JSON.stringify(wpcats)).map(wpc => { let checkdelegation = mycatvotes.find( cv => cv.category_id == wpc.value ); if (checkdelegation) { wpc.delegatee = checkdelegation.delegatee; } else { wpc.delegatee = this.getAccountName; } return wpc; }); }, async handleCatDelegation(cat_id, delegatee) { let actions = []; let delegate = { account: this.$configFile.get("wpcontract"), name: "delegatecat", authorization: [ { actor: this.getAccountName, permission: this.getAuth }, { actor: this.$configFile.get("authaccount"), permission: "one" } ], data: { custodian: this.getAccountName, category: cat_id, delegatee_custodian: delegatee.new, dac_id: this.$configFile.get("dacscope") } }; let undelegate = { account: this.$configFile.get("wpcontract"), name: "undelegateca", authorization: [ { actor: this.getAccountName, permission: this.getAuth }, { actor: this.$configFile.get("authaccount"), permission: "one" } ], data: { custodian: this.getAccountName, category: cat_id, dac_id: this.$configFile.get("dacscope") } }; if (this.getAccountName === delegatee.new) { actions.push(undelegate); } else { actions.push(delegate); } let result = await this.$store.dispatch("user/transact", { actions: actions }); if (result) { } else { this.wpcats.find(w => w.value == cat_id).delegatee = delegatee.old; } } }, mounted() { if (this.getAccountName) { this.setWpCats(true); } }, watch: { getAccountName: function() { this.setWpCats(true); } } }; </script>
27,063
https://github.com/booleancoercion/computercraft/blob/master/quarry.lua
Github Open Source
Open Source
MIT
2,021
computercraft
booleancoercion
Lua
Code
1,030
2,347
--[[ quarry.lua - a simple quarry script. The turtle running this script must satisfy the following conditions: * there must be a chest behind the turtle in which it will put the collected goods * there must be a chest to the right of the turtle from which it will draw fuel * at spawn, the turtle must be facing east (this is only so that the internal values make sense. If you want the turtle to be confined within one chunk, do this and put the turtle at the left-back corner of the chunk, while facing east of course) Made by boolean_coercion. ]] -- The side length of the square hole that the turtle will be digging. local SIDE_LENGTH = 16 local disp = {x = 0, y = 0, z = 0} --[[ This variable keeps track of the turtle's orientation. North = 1, and the value increases going Counter-Clockwise We assume the turtle is facing with the positive direction of the X axis (AKA east) ]] local NORTH, WEST, SOUTH, EAST = 1, 2, 3, 4 local facing = EAST local cached_facing = facing -- used by the goBack function -- this variable keeps track of the overall Z direction travel local going_north = true --[[ Determine whether the turtle has enough fuel to continue going, or whether it should start heading back/refuel. ]] function canContinue() local distance = math.abs(disp.x) + math.abs(disp.y) + math.abs(disp.z) local fuel_remaining = turtle.getFuelLevel() return (fuel_remaining - 1) > (distance + 1) end --[[ Try to move the turtle down, digging if there's a block in the way. Returns the value passed from turtle.down() along with digDown's reason, if any. ]] function moveDigDown() local reason if turtle.detectDown() then _, reason = turtle.digDown() end local moved = turtle.down() if moved then disp.y = disp.y - 1 end return moved, reason end local movements = {[NORTH] = {0, -1}, [WEST] = {-1, 0}, [SOUTH] = {0, 1}, [EAST] = {1, 0}} --[[ Try to move the turtle forwards, digging if there's a block in the way. Returns the value passed from turtle.forward() along with dig's reason, if any. ]] function moveDigForward() local reason if turtle.detect() then _, reason = turtle.dig() end local moved = turtle.forward() if moved then local movement_array = movements[facing] disp.x = disp.x + movement_array[1] disp.z = disp.z + movement_array[2] end return moved, reason end local valuable_infixes = {"_ore", "coal", "diamond", "emerald", "redstone", "lapis"} --[[ Note about the dropJunk and dropCoal functions: we call turtle.select(1) at the end of each one to ensure that the item pointer will always be in the first slot while the turtle is digging. This ensures that items get stacked properly in the turtle's inventory. ]] --[[ Searches the turtle's inventory for junk (anything that isn't an ore or other valuable item) and drops it. Return value indicates whether the turtle has any free spots after this operation has completed. ]] function dropJunk() local hasEmpty = false for slot=1,16 do local item = turtle.getItemDetail(slot) if item == nil then hasEmpty = true else local dump = true for _, infix in ipairs(valuable_infixes) do if string.find(item.name, infix) ~= nil then dump = false break end end if dump then turtle.select(slot) turtle.drop() hasEmpty = true end end end turtle.select(1) return hasEmpty end --[[ Drops all of the coal in the turtle's inventory. If invert == true, does the opposite: drop all of the *non* coal in the turtle's inventory. ]] function dropCoal(invert) for slot=1,16 do local item = turtle.getItemDetail(slot) if item ~= nil then if (string.find(item.name, "coal") == nil) == invert then turtle.select(slot) turtle.drop() end end end turtle.select(1) end --[[ This function calls turtle.turnRight and changes the facing variable accordingly. ]] function turnRight() turtle.turnRight() -- effectively subtracts 1 while staying in the range [1, 4] facing = (facing + 2) % 4 + 1 end --[[ This function calls turtle.turnLeft and changes the facing variable accordingly. ]] function turnLeft() turtle.turnLeft() facing = (facing % 4) + 1 end --[[ Takes the turtle home (displacement 0), while preserving the disp table for easy go-back-ery. Also updates the cached_facing variable to be used with goBack. ]] function goHome() print("Going home...") cached_facing = facing for _=disp.y,-1 do turtle.up() end repeat turnRight() until facing == SOUTH for _=disp.z,-1 do turtle.forward() end turnRight() -- now facing west for _=disp.x,1,-1 do turtle.forward() end dropCoal(true) turnLeft() -- now facing south again dropCoal(false) end --[[ Goes back to the place stored in the displacement table, in order for operation to continue as if nothing happened. ]] function goBack() repeat turnRight() until facing == EAST for _=disp.x,1,-1 do turtle.forward() end turnLeft() -- now facing north for _=disp.z,-1 do turtle.forward() end repeat turnRight() until facing == cached_facing for _=disp.y,-1 do turtle.down() end end function refresh() goHome() -- now facing south print("Refreshing...") turtle.suck() turtle.refuel() if turtle.getFuelLevel() < 50 then error("Not enough fuel for normal operation! Aborting.") end goBack() end function turnAround() local turn_left = (facing == EAST and going_north) or (facing == WEST and not going_north) if turn_left then turnLeft() else turnRight() end local couldMove = true print("turning around at disp.z = " .. disp.z .. " and disp.x = " .. disp.x) if (going_north and disp.z ~= -(SIDE_LENGTH-1)) or (not going_north and disp.z ~= 0) then couldMove = moveDigForward() end if turn_left then turnLeft() else turnRight() end return couldMove end function main() if turtle.getFuelLevel() < 50 then -- Get fuel from the fuel chest turnRight() turtle.suck() turnLeft() -- TODO: maybe find the fuel in case it's not in the selected spot turtle.refuel() if turtle.getFuelLevel() < 50 then error("Not enough fuel for normal operation! Aborting.") end end while true do if not moveDigDown() then goHome() print("Cannot move or dig down, finishing...") return end if not canContinue() then refresh() end --[[ X's loop has one less iteration because Z's loop basically does the first iteration for free. ]] for _=1,SIDE_LENGTH do for _=1,(SIDE_LENGTH-1) do if not moveDigForward() then goHome() print("Cannot move or dig forwards, finishing...") return end if not canContinue() then refresh() end end local hasEmptySpots = dropJunk() if not hasEmptySpots or not canContinue() then refresh() end if not turnAround() then goHome() print("Cannot continue operation, finishing...") return end if not canContinue() then refresh() end end going_north = not going_north end end main()
51,098
https://github.com/feeday/feeday.github.io/blob/master/py/rmf999.py
Github Open Source
Open Source
MIT, Apache-2.0
2,023
feeday.github.io
feeday
Python
Code
33
201
import os import glob # 获取当前文件夹名 current_folder = os.path.basename(os.getcwd()) # 获取当前文件夹下的所有文件 files = glob.glob('*') # 对文件名进行升序排序 files.sort() # 遍历文件列表,对每个文件执行重命名操作 for i, file in enumerate(files): # 获得新文件名 new_file_name = f"{current_folder}_{str(i+1).zfill(3)}{os.path.splitext(file)[1]}" # 执行重命名操作 os.rename(file, new_file_name)
30,273
https://github.com/RoydeZomer/Soccer-Visualisation-/blob/master/Judge.java
Github Open Source
Open Source
MIT
null
Soccer-Visualisation-
RoydeZomer
Java
Code
514
1,531
import processing.core.*; import processing.*; import java.util.*; public class Judge { private float GAME_DURATION = 60 * 90; private float ROBOT_TAKEN_OUTSIDE_TIME = GAME_DURATION; private float BALL_OUTSIDE_TIME_LIMIT = GAME_DURATION; private GameController controller; private GameSimulator simulator; // Robots that have been taken out of field for some reason private HashSet<Robot> takenOutRobots = new HashSet<Robot>(); private HashMap<Robot, Timer> takenOutTimers = new HashMap<Robot, Timer>(); Judge(GameController controller) { this.controller = controller; } // Set the time for the entire game (defaults to 5min) float duration = GAME_DURATION; public void setDuration(float duration) { this.duration = duration; } // The actual game half time (1st, 2nd...) int gameHalf = 1; float time; float realTime = 0; public void judge(float time, PVector[] ballpositions, int frame, int[] sections) { // Integrate time, only if no glitches and simulation is running if ( controller.isRunning()) realTime += time - this.time; this.time = time; // Skip Judging if is paused if (!controller.isRunning()) return; // Check if Ball is outside field for a long time checkBallOutside(); // Check if scored goals checkGoal(ballpositions, frame, time); // Check end of Half checkEndOfHalf(sections, frame); } /* Returns the time to show in the UI */ public float getCurrentTime() { return time; } /* Returns the current state */ public String getCurrentState() { String running = controller.isRunning() ? "Running" : "Stopped"; String half = gameHalf + " half"; if (gameHalf > 2) half = "ENDED"; return half + " - " + running; } private void setHalf(int half) { if (half == 2) { controller.initTeamSides(false); controller.restartPositions(TeamSide.LEFT); controller.resumeGame(); } if (half > 2) { System.out.println("einde wedstrijd"); System.out.println(controller.getPointsFor(TeamSide.LEFT)+"links - rechts"+controller.getPointsFor(TeamSide.RIGHT)); System.exit(1); return; } gameHalf = half; } private Timer ballOutsideTimer = new Timer(BALL_OUTSIDE_TIME_LIMIT, true); private boolean isOut = false; private void checkBallOutside() { Ball b = simulator.ball; if (b.colliding(simulator.fieldArea)) { ballOutsideTimer.reset(time); } else { if (ballOutsideTimer.triggered(time)) { System.out.println("uitbal"); } } } float goal; //kijk of er een aftrap is in de komende minuut boolean actualGoal(PVector[] pos, int ball, float time) { return true; // if (pos[ball].z < 2.44f) { // for ( int i = ball; i < ball+1500; i++) { // // if (pos[i].x > 50 && pos[i].x < 55 && pos[i].y > 32 && pos[i].y < 36 && ball+1500 > goal) { // goal = ball; // return true; // } // } // } // return false; } private void checkGoal(PVector[] ballpositions, int ball, float time) { Ball b = simulator.ball; if (actualGoal(ballpositions, ball, time) && b.colliding(simulator.goalLeft) && !b.colliding(simulator.fieldArea)) { controller.addPointsFor(TeamSide.RIGHT, 1); } else if (actualGoal(ballpositions, ball, time) && b.colliding(simulator.goalRight) && !b.colliding(simulator.fieldArea)) { controller.addPointsFor(TeamSide.LEFT, 1); } } private void checkEndOfHalf(int[] sections, int frame) { duration = (sections[0]+sections[1])/25; if (frame>sections[0] && gameHalf!=2 && frame < (sections[0]+sections[1] -10 )) { setHalf(2); System.out.println("Tweede helft begint"); } else if (frame>=(sections[0]+sections[1] -10 )) { // 3 Means end; setHalf(3); } } /* Did reset everything */ public void onGameControllerReseted() { simulator = controller.getSimulator(); takenOutRobots.clear(); setHalf(1); time = realTime = 0; } public void onRobotRegistered(Robot r, TeamSide side) { takenOutRobots.add(r); takenOutTimers.put(r, new Timer(ROBOT_TAKEN_OUTSIDE_TIME)); } public void onRobotUnegistered(Robot r) { takenOutRobots.remove(r); } public void onRobotPlaced(Robot r) { takenOutRobots.remove(r); } public void onRobotRemoved(Robot r) { takenOutRobots.add(r); takenOutTimers.get(r).reset(time); } }
2,160