hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
98 values
lang
stringclasses
21 values
max_stars_repo_path
stringlengths
3
945
max_stars_repo_name
stringlengths
4
118
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
368k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
945
max_issues_repo_name
stringlengths
4
118
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
945
max_forks_repo_name
stringlengths
4
135
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
1.05M
avg_line_length
float64
1
1.03M
max_line_length
int64
2
1.03M
alphanum_fraction
float64
0
1
d3060785e59b40cd1cc01ba444984a1c5f2cee77
255
cs
C#
EntityFrameworkCore/EntityFrameworkCore/RepositoryResult.cs
meyer-common/EntityFrameworkCore
7cda579b906fe85ed33a6490550e9f1467746557
[ "MIT" ]
null
null
null
EntityFrameworkCore/EntityFrameworkCore/RepositoryResult.cs
meyer-common/EntityFrameworkCore
7cda579b906fe85ed33a6490550e9f1467746557
[ "MIT" ]
null
null
null
EntityFrameworkCore/EntityFrameworkCore/RepositoryResult.cs
meyer-common/EntityFrameworkCore
7cda579b906fe85ed33a6490550e9f1467746557
[ "MIT" ]
null
null
null
namespace Meyer.Common.EntityFrameworkCore; /// <summary> /// An enumeration of status results /// </summary> public enum ResultStatus { Undefined, Success, Partial, Error, Conflict, NotFound, Added, Updated, Deleted }
15
43
0.65098
93d3334cf8197e365bdc6890d9efecc30df21dc1
239
swift
Swift
app/Chatkit Quickstart/AppDelegate.swift
pusher/chatkit-getting-started-swift
a1602116cbe62a071885324bdbdb4845d1cfeb10
[ "MIT" ]
null
null
null
app/Chatkit Quickstart/AppDelegate.swift
pusher/chatkit-getting-started-swift
a1602116cbe62a071885324bdbdb4845d1cfeb10
[ "MIT" ]
null
null
null
app/Chatkit Quickstart/AppDelegate.swift
pusher/chatkit-getting-started-swift
a1602116cbe62a071885324bdbdb4845d1cfeb10
[ "MIT" ]
null
null
null
import UIKit //TODO import PusherChatkit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? //TODO: add initChatkit function! } //TODO: add ChatManagerDelegate extension
14.9375
55
0.740586
938aa6513213d71b320e326a176f24c5a74cb358
212
cs
C#
ClinicManagementSystem/ClinicManagementSystemDOL/Enums/Gender.cs
skgtrx/CMS
7fc46336ffe55f833750aeaf6009934a8dc3532d
[ "MIT" ]
1
2019-11-25T03:17:40.000Z
2019-11-25T03:17:40.000Z
ClinicManagementSystem/ClinicManagementSystemDOL/Enums/Gender.cs
skgtrx/CMS
7fc46336ffe55f833750aeaf6009934a8dc3532d
[ "MIT" ]
null
null
null
ClinicManagementSystem/ClinicManagementSystemDOL/Enums/Gender.cs
skgtrx/CMS
7fc46336ffe55f833750aeaf6009934a8dc3532d
[ "MIT" ]
null
null
null
using System.ComponentModel; namespace ClinicManagementSystemDOL.Enums { public enum Gender { [Description("Male")] Male = 1, [Description("Female")] Female = 2 } }
15.142857
41
0.584906
dd97b6f32afb4a831167081afae7a64e909c8cf8
921
java
Java
src/main/java/com/thallium/sdvm/util/cca/MyComponents.java
AshIndigo/StardewValley-1.16.5
4a78eae16c739d946c32645b22f9a63e91d458b9
[ "CC0-1.0" ]
null
null
null
src/main/java/com/thallium/sdvm/util/cca/MyComponents.java
AshIndigo/StardewValley-1.16.5
4a78eae16c739d946c32645b22f9a63e91d458b9
[ "CC0-1.0" ]
null
null
null
src/main/java/com/thallium/sdvm/util/cca/MyComponents.java
AshIndigo/StardewValley-1.16.5
4a78eae16c739d946c32645b22f9a63e91d458b9
[ "CC0-1.0" ]
null
null
null
package com.thallium.sdvm.util.cca; import com.thallium.sdvm.StardewValley; import dev.onyxstudios.cca.api.v3.component.ComponentKey; import dev.onyxstudios.cca.api.v3.component.ComponentRegistryV3; import dev.onyxstudios.cca.api.v3.entity.EntityComponentFactoryRegistry; import dev.onyxstudios.cca.api.v3.entity.EntityComponentInitializer; import nerdhub.cardinal.components.api.util.RespawnCopyStrategy; import net.minecraft.util.Identifier; public final class MyComponents implements EntityComponentInitializer { public static final ComponentKey<IMoneyComponent> MONEY = ComponentRegistryV3.INSTANCE.getOrCreate(new Identifier(StardewValley.Mod_ID, "money"), IMoneyComponent.class); @Override public void registerEntityComponentFactories(EntityComponentFactoryRegistry registry) { registry.registerForPlayers(MONEY, MoneyComponent::new, RespawnCopyStrategy.ALWAYS_COPY); } }
41.863636
123
0.819761
a329b6110b64d28945913ea9c349600a197299a0
737
java
Java
src/main/java/dev/fiki/forgehax/api/color/Colors.java
OverFloyd/ForgeHax
cb91df4591c5756a8058775c68d66247fdeb151b
[ "MIT" ]
1
2021-09-26T14:01:47.000Z
2021-09-26T14:01:47.000Z
src/main/java/dev/fiki/forgehax/api/color/Colors.java
orsondmc/ForgeHax
726cf27665571bd735d340e7e4bd6530addf5e25
[ "MIT" ]
null
null
null
src/main/java/dev/fiki/forgehax/api/color/Colors.java
orsondmc/ForgeHax
726cf27665571bd735d340e7e4bd6530addf5e25
[ "MIT" ]
null
null
null
package dev.fiki.forgehax.api.color; /** * Created on 2/6/2018 by fr1kin */ public interface Colors { ColorMap MAP = new ColorMap(); static ColorMap map() { return MAP; } Color WHITE = MAP.getNonNull("white"); Color BLACK = MAP.getNonNull("black"); Color RED = MAP.getNonNull("red"); Color GREEN = MAP.getNonNull("green"); Color BLUE = MAP.getNonNull("blue"); Color CYAN = MAP.getNonNull("cyan"); Color ORANGE = MAP.getNonNull("orange"); Color PURPLE = MAP.getNonNull("purple"); Color MAGENTA = MAP.getNonNull("magenta"); Color GRAY = MAP.getNonNull("gray"); Color DARK_RED = MAP.getNonNull("dark_red"); Color DARK_GRAY = MAP.getNonNull("dark_gray"); Color YELLOW = MAP.getNonNull("yellow"); }
27.296296
48
0.678426
d115d28611e68794ed59226f9e240fca914185ae
948
swift
Swift
Benji/BenjiParser.swift
aa-wong/benji
94662eb5d90028c746c6e4d89fdfe7939e91e54a
[ "MIT" ]
2
2020-04-16T15:11:30.000Z
2020-04-26T00:38:29.000Z
Benji/BenjiParser.swift
aa-wong/Benji
94662eb5d90028c746c6e4d89fdfe7939e91e54a
[ "MIT" ]
null
null
null
Benji/BenjiParser.swift
aa-wong/Benji
94662eb5d90028c746c6e4d89fdfe7939e91e54a
[ "MIT" ]
null
null
null
// // BenjiParser.swift // Benji // // Created by Aaron Wong on 2019-11-21. // Copyright © 2019 Aaron Wong. All rights reserved. // import UIKit public class BenjiParser: NSObject { public static func dataFromObject(object: Any, completion: (_ error: Error?, _ data: Data?) -> Void) { do { let jsonData = try JSONSerialization.data(withJSONObject: object, options: []) return completion(nil, jsonData) } catch let error { return completion(error, nil) } } public static func objectFromData(data: Data, completion: (_ error: Error?, _ json: Any?) -> Void) { do { let json = try JSONSerialization.jsonObject(with: data, options: []) return completion(nil, json) } catch let error { return completion(error, nil) } } }
28.727273
93
0.543249
c9d442a59f46f3415c9f7b5b482752b1fac4325c
780
tsx
TypeScript
src/containers/About/index.tsx
draperunner/Kramster
973343f7b71d5fb944b91001e33ad1545b8f3dbb
[ "Apache-2.0" ]
13
2015-05-24T17:55:06.000Z
2018-11-29T11:54:58.000Z
src/containers/About/index.tsx
draperunner/Kramster
973343f7b71d5fb944b91001e33ad1545b8f3dbb
[ "Apache-2.0" ]
6
2015-11-19T18:50:15.000Z
2019-10-01T13:33:06.000Z
src/containers/About/index.tsx
draperunner/Kramster
973343f7b71d5fb944b91001e33ad1545b8f3dbb
[ "Apache-2.0" ]
1
2019-10-01T05:55:26.000Z
2019-10-01T05:55:26.000Z
import React from 'react' import styles from './About.css' const About = (): JSX.Element => ( <div> <div className={styles.about}> <h1 className={styles.title}>Cram with Kramster!</h1> <p> Kramster helps making exam preparation a little more fun. Select your school and course and cram for your exam by doing the multiple choice questions with instant feedback. </p> <p> Kramster is made by <a href="https://byrkje.land">Mats Byrkjeland</a>{' '} and it is{' '} <a href="https://github.com/draperunner/Kramster">open source</a>. Do you enjoy Kramster? Star it on{' '} <a href="https://github.com/draperunner/kramster">GitHub</a>! </p> </div> </div> ) export default About
30
82
0.614103
ff58152c8cc351d8f022fe6500b499f8d31b7dba
1,631
py
Python
setup.py
eli-collins/jinja2-htmlcompress
b23ed607ebb7b7ad11fb8292e8ff0b31f7ec505a
[ "BSD-3-Clause" ]
6
2017-07-16T14:03:29.000Z
2020-12-22T18:28:09.000Z
setup.py
eli-collins/jinja2-htmlcompress
b23ed607ebb7b7ad11fb8292e8ff0b31f7ec505a
[ "BSD-3-Clause" ]
null
null
null
setup.py
eli-collins/jinja2-htmlcompress
b23ed607ebb7b7ad11fb8292e8ff0b31f7ec505a
[ "BSD-3-Clause" ]
1
2019-02-27T06:55:44.000Z
2019-02-27T06:55:44.000Z
#!/usr/bin/env python """ jinja2htmlcompress setup script """ #============================================================================= # imports #============================================================================= from setuptools import setup, find_packages #============================================================================= # static text #============================================================================= SUMMARY = "a Jinja2 extension that removes whitespace between HTML tags." DESCRIPTION = open("README").read() KEYWORDS = "jinja2" CLASSIFIERS = """ Intended Audience :: Developers Operating System :: OS Independent Programming Language :: Python :: 2 Programming Language :: Python :: 3 License :: OSI Approved :: BSD License Topic :: Software Development :: Libraries """.strip().splitlines() #============================================================================= # setup #============================================================================= setup( # metadata name="jinja2htmlcompress", version="1.1", author="Armin Ronacher", author_email="armin.ronacher@active-4.com", url="https://github.com/mitsuhiko/jinja2-htmlcompress", description=SUMMARY, long_description=DESCRIPTION, keywords=KEYWORDS, classifiers=CLASSIFIERS, # package info zip_safe=True, py_modules=["jinja2htmlcompress"], #packages=find_packages(), #package_data={}, ) #============================================================================= # eof #=============================================================================
29.654545
78
0.433476
a149d35d5c441bd80b7a3b4bc8ab5394537175bf
3,336
ts
TypeScript
src/__tests__/store/actions/streamDetails.test.ts
torerikal/streamlab-1
c29d9b74cf39ab9bdcc67dfd2e47a5256f478743
[ "Apache-2.0" ]
12
2021-04-26T19:56:22.000Z
2022-01-19T17:12:55.000Z
src/__tests__/store/actions/streamDetails.test.ts
torerikal/streamlab-1
c29d9b74cf39ab9bdcc67dfd2e47a5256f478743
[ "Apache-2.0" ]
null
null
null
src/__tests__/store/actions/streamDetails.test.ts
torerikal/streamlab-1
c29d9b74cf39ab9bdcc67dfd2e47a5256f478743
[ "Apache-2.0" ]
2
2020-11-25T07:40:03.000Z
2021-01-11T02:08:31.000Z
import { DRM_CERTIFICATE_RESOURCE_FIELD_CHANGE, DRM_LICENSE_RESOURCE_FIELD_CHANGE, APPLY_BROWSER_ENVIRONMENT, applyBrowserEnvironment, START_OFFSET_FIELD_CHANGE, STREAM_RESOURCE_FIELD_CHANGE, SUBTITLES_RESOURCE_FIELD_CHANGE, updateStreamDetailsField, } from '../../../store/actions/streamDetails'; import { BaseTech, DrmTechnology } from '../../../store/model/streamDetails'; describe('Stream details Redux actions', () => { test('Stream field updates', () => { expect( updateStreamDetailsField({ streamResource: { url: 'https://example.com/stream.m3u8', }, }) ).toEqual({ type: STREAM_RESOURCE_FIELD_CHANGE, value: { url: 'https://example.com/stream.m3u8', }, }); expect( updateStreamDetailsField({ drmLicenseResource: { useProxy: true, technology: DrmTechnology.PLAYREADY, }, }) ).toEqual({ type: DRM_LICENSE_RESOURCE_FIELD_CHANGE, value: { useProxy: true, technology: DrmTechnology.PLAYREADY, }, }); expect( updateStreamDetailsField({ drmCertificateResource: { url: 'https://example.com/certificate', technology: DrmTechnology.FAIRPLAY, }, }) ).toEqual({ type: DRM_CERTIFICATE_RESOURCE_FIELD_CHANGE, value: { url: 'https://example.com/certificate', technology: DrmTechnology.FAIRPLAY, }, }); expect( updateStreamDetailsField({ subtitlesResource: { url: 'https://example.com/subs.ttml', useProxy: false, }, }) ).toEqual({ type: SUBTITLES_RESOURCE_FIELD_CHANGE, value: { url: 'https://example.com/subs.ttml', useProxy: false, }, }); expect( updateStreamDetailsField({ startOffset: 123.456, }) ).toEqual({ type: START_OFFSET_FIELD_CHANGE, value: 123.456, }); expect( updateStreamDetailsField({ startOffset: '', }) ).toEqual({ type: START_OFFSET_FIELD_CHANGE, value: '', }); }); test('Setting browser specific stream details', () => { expect( applyBrowserEnvironment( 'Mozilla/5.0 (Macintosh; Intel Mac OS X ' + '10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Safari/605.1.15', '' ) ).toEqual({ type: APPLY_BROWSER_ENVIRONMENT, value: { supportedDrmTechnologies: [DrmTechnology.FAIRPLAY], urlSetup: undefined, }, }); expect( applyBrowserEnvironment( 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.44', '?s={%22streamDetails%22:{%22streamResource%22:{%22url%22:%22https:%2F%2Fexample.com%2Fstream.m3u8%22,%22tech' + 'nology%22:0}}}' ) ).toEqual({ type: APPLY_BROWSER_ENVIRONMENT, value: { supportedDrmTechnologies: [DrmTechnology.PLAYREADY, DrmTechnology.WIDEVINE], urlSetup: { streamDetails: { streamResource: { url: 'https://example.com/stream.m3u8', technology: BaseTech.AUTO, }, }, }, }, }); }); });
27.121951
120
0.582734
f4abf0023ad7014c5a127f6b0a530819d63e160b
2,804
ts
TypeScript
core/src/plugins/plugin.spec.ts
Taranys/cuillere
59d99eb070d36e9e9e4caff0d93a49fd15c40e15
[ "Apache-2.0" ]
null
null
null
core/src/plugins/plugin.spec.ts
Taranys/cuillere
59d99eb070d36e9e9e4caff0d93a49fd15c40e15
[ "Apache-2.0" ]
null
null
null
core/src/plugins/plugin.spec.ts
Taranys/cuillere
59d99eb070d36e9e9e4caff0d93a49fd15c40e15
[ "Apache-2.0" ]
null
null
null
import cuillere, { Cuillere, Plugin, next } from '..' describe('plugin', () => { const test = async (cllr: Cuillere, expected = 'test') => { function* func() { return 'test' } expect(await cllr.call(func)).toBe(expected) } it('should work with no plugins', async () => { const cllr = cuillere() await test(cllr) }) it('should call plugins for call operation', async () => { const plugin1Fn = jest.fn() const plugin1: Plugin = { handlers: { * '@cuillere/core/call'(operation) { plugin1Fn() return yield next(operation) }, }, } const plugin2Fn = jest.fn() const plugin2: Plugin = { handlers: { * '@cuillere/core/call'(operation) { plugin2Fn() return yield next(operation) }, }, } const cllr = cuillere(plugin1, plugin2) await test(cllr) expect(plugin1Fn).toBeCalled() expect(plugin2Fn).toBeCalled() }) it('should be able to catch exception from plugin (https://bugs.chromium.org/p/v8/issues/detail?id=10238)', async () => { const error = new Error('test') let catched: Error async function* test() { try { yield { kind: '@cuillere/test/throw' } } catch (e) { catched = e } } const plugin: Plugin = { namespace: '@cuillere/test', handlers: { async* throw() { throw error }, }, } await expect(cuillere(plugin).call(test)).resolves.toBeUndefined() expect(catched).toBe(error) }) it('should not allow unqualified handlers on plugins w/o namespace', () => { let catched: any try { cuillere({ handlers: { * test() { // unqualified handler }, }, }) } catch (e) { catched = e } expect(catched).toStrictEqual(TypeError('Plugin without namespace must have only qualified handlers, found "test"')) }) it('should not allow validators on plugins w/o namespace', () => { let catched: any try { cuillere({ handlers: {}, validators: { test() { // validator }, }, }) } catch (e) { catched = e } expect(catched).toStrictEqual(TypeError('Plugin without namespace must not have validators')) }) it('should not allow qualified validators', () => { let catched: any try { cuillere({ namespace: '@cuillere/test', handlers: {}, validators: { '@cuillere/core/call'() { // validator }, }, }) } catch (e) { catched = e } expect(catched).toStrictEqual(TypeError('Qualified validators are forbidden, found "@cuillere/core/call"')) }) })
22.796748
123
0.537803
8d94678e2c43c37ee7352f0f1554647428901baa
129
js
JavaScript
src/js/stores/tokens/tokenGetters.js
percipioglobal/craft
802a3fe80fd1966e0e051ce97e43a2bec07e056e
[ "MIT" ]
5
2020-07-15T09:47:35.000Z
2022-01-07T13:45:11.000Z
src/js/stores/tokens/tokenGetters.js
percipioglobal/craft
802a3fe80fd1966e0e051ce97e43a2bec07e056e
[ "MIT" ]
69
2020-06-29T11:32:01.000Z
2021-12-15T09:47:33.000Z
src/js/stores/tokens/tokenGetters.js
percipioglobal/craft
802a3fe80fd1966e0e051ce97e43a2bec07e056e
[ "MIT" ]
6
2020-07-23T19:35:27.000Z
2022-03-09T10:46:02.000Z
export const CSRF_TOKEN = (state) => { return state.csrf } export const GQL_TOKEN = (state) => { return state.gqlToken }
18.428571
38
0.658915
a3b87a51829aa358bfb440d5c48cca6b697b5d82
9,989
kt
Kotlin
app/src/main/java/me/digitalby/lr5/MainActivity.kt
digitalby/University-Project-Battleships
b86b4eb4e29f0a56e28c31d4e3d1c3a57b81fbd8
[ "MIT" ]
3
2020-12-14T21:04:20.000Z
2020-12-14T21:11:37.000Z
app/src/main/java/me/digitalby/lr5/MainActivity.kt
digitalby/University-Project-Battleships
b86b4eb4e29f0a56e28c31d4e3d1c3a57b81fbd8
[ "MIT" ]
null
null
null
app/src/main/java/me/digitalby/lr5/MainActivity.kt
digitalby/University-Project-Battleships
b86b4eb4e29f0a56e28c31d4e3d1c3a57b81fbd8
[ "MIT" ]
null
null
null
package me.digitalby.lr5 import android.content.Context import android.content.Intent import android.content.SharedPreferences import android.content.pm.ActivityInfo import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.text.InputType import android.util.Log import android.widget.EditText import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.fragment.app.Fragment import com.google.android.material.snackbar.Snackbar import com.google.firebase.auth.FirebaseAuth import com.google.firebase.database.DataSnapshot import com.google.firebase.database.DatabaseError import com.google.firebase.database.FirebaseDatabase import com.google.firebase.database.ValueEventListener import kotlinx.android.synthetic.main.fragment_lobby.* import java.io.* class MainActivity : AppCompatActivity(), ConstructionFragmentListener, FieldFragmentListener, LobbyFragmentListener{ private val auth = FirebaseAuth.getInstance() override var currentUser = auth.currentUser val database = FirebaseDatabase.getInstance() val reference = database.reference override lateinit var blueprint: Blueprint val fieldSize = Vector2(10, 10) val shipRules: HashMap<ShipType, Int> = hashMapOf( ShipType.Ship1 to 4, ShipType.Ship2 to 3, ShipType.Ship3 to 2, ShipType.Ship4 to 1 ) override lateinit var field: Field private lateinit var uid: String private lateinit var sharedPreferences: SharedPreferences private var selectedShipType: ShipType? = null private lateinit var fieldFragment: FieldFragment private lateinit var lobbyFragment: LobbyFragment override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE sharedPreferences = getSharedPreferences("me.digitalby.lr5", Context.MODE_PRIVATE) fieldFragment = supportFragmentManager.findFragmentById(R.id.mainFieldFragment) as FieldFragment fieldFragment.listener = this lobbyFragment = supportFragmentManager.findFragmentById(R.id.mainLobbyFragment) as LobbyFragment lobbyFragment.listener = this blueprint = Blueprint(fieldSize, shipRules, loadShips() ?: arrayListOf()) updateFieldFromBlueprint() ConstructionFragment.instance.listener = this val bundle: Bundle? = intent.extras if(bundle != null) { uid = bundle.getString("uid")!! } else if(savedInstanceState != null) { uid = savedInstanceState.getString("uid")!! } else { uid = sharedPreferences.getString("uid", null)!! } if (uid.isNotEmpty()) { lobbyFragment.uid = uid } } override fun onSaveInstanceState(outState: Bundle) { outState.putString("uid", uid) super.onSaveInstanceState(outState) } private fun tryPlaceShip(ship: Ship) { try { blueprint.tryAddShip(ship) } catch (e: BlueprintException) { Snackbar.make(findViewById(android.R.id.content), e.message!!, Snackbar.LENGTH_SHORT ).show() return } finally { selectedShipType = null updateFieldFromBlueprint() } } private fun loadShips(): ArrayList<Ship>? { return try { val fileInputStream = openFileInput("ships.lr5") val objectInputStream = ObjectInputStream(fileInputStream) val blueprintShips = objectInputStream.readObject() as ArrayList<Ship> objectInputStream.close() fileInputStream.close() blueprintShips } catch (e: FileNotFoundException) { null } } private fun saveShips() { try { val fileOutputStream = openFileOutput("ships.lr5", Context.MODE_PRIVATE) val objectOutputStream = ObjectOutputStream(fileOutputStream) objectOutputStream.writeObject(blueprint.getShips()) objectOutputStream.close() fileOutputStream.close() } catch(e: InvalidClassException) { Log.e("LR5", "The class is not valid. $e") } catch (e: NotSerializableException) { Log.e("LR5", "The class is not serializable. $e") } catch (e: IOException) { Log.e("LR5", "$e") } } private fun updateFieldFromBlueprint() { field = blueprint.makeField() fieldFragment.drawField(field) ConstructionFragment.instance.didChangeShips(blueprint) if(blueprint.valid) { textViewError.text = "" buttonCreateGame.isEnabled = true buttonJoinGame.isEnabled = true } else { textViewError.text = getString(R.string.lobby_place_ships) buttonCreateGame.isEnabled = false buttonJoinGame.isEnabled = false } } override fun didSelectCell(sender: FieldFragment, position: Vector2) { if (selectedShipType == null) { blueprint.removeShip(position) updateFieldFromBlueprint() } else { val selectedConstructionShipType = this.selectedShipType!! val size = Ship.shipTypeToSize(selectedConstructionShipType) val ship = Ship(position, size!!) ship.type = Ship.simplifyShipType(selectedConstructionShipType) tryPlaceShip(ship) } saveShips() } override fun didSelectShip(sender: ConstructionFragment, ship: ShipType?) { if(selectedShipType == ship) { selectedShipType = null sender.setSelected(null) } else { selectedShipType = ship sender.setSelected(ship) } } override fun didRequestLogout(sender: Fragment) { blueprint.clearShips() saveShips() auth.signOut() val intent = Intent(this, LoginActivity::class.java) startActivity(intent) finish() } override fun didRequestStats(sender: Fragment) { val edit = sharedPreferences.edit() edit.putString("uid", uid) edit.apply() val intent = Intent(this, StatsActivity::class.java) intent.putExtra("uid", uid) startActivity(intent) } override fun didRequestCreateGame(sender: Fragment) { if(!blueprint.valid) return val intent = Intent(this, CreateGameActivity::class.java) intent.putExtra("uid", uid) val fieldString = Field.toFieldString(field) intent.putExtra("fieldString", fieldString) val parcelableShips = Blueprint.toParcelable(blueprint) intent.putExtra("ships", parcelableShips) val edit = sharedPreferences.edit() edit.putString("uid", uid) edit.apply() startActivity(intent) } private fun readyToPlay(gameId: String) { //TODO: initialize the receiver val intent = Intent(this, GameActivity::class.java) intent.putExtra("uid", uid) val fieldString = Field.toFieldString(field) intent.putExtra("fieldString", fieldString) intent.putExtra("gameId", gameId) intent.putExtra("myTurn", 2L) val parcelableShips = Blueprint.toParcelable(blueprint) intent.putExtra("ships", parcelableShips) startActivity(intent) finish() } override fun didRequestJoinGame(sender: Fragment) { if(!blueprint.valid) return buttonCreateGame.isEnabled = false buttonJoinGame.isEnabled = false val builder = AlertDialog.Builder(this) val inputView = EditText(this) inputView.inputType = InputType.TYPE_CLASS_TEXT builder.setMessage("Enter the game's code to join it.") .setTitle("Join Game") .setView(inputView) .setPositiveButton(getString(android.R.string.ok)) { _, _ -> val gameToJoin = inputView.text.toString().trim() if(gameToJoin.isEmpty()) { Toast.makeText( applicationContext, "The game code is empty.", Toast.LENGTH_SHORT ).show() buttonCreateGame.isEnabled = true buttonJoinGame.isEnabled = true return@setPositiveButton } val gameReference = reference .child("PendingGames") .child(gameToJoin) gameReference.addListenerForSingleValueEvent(object:ValueEventListener { override fun onDataChange(p0: DataSnapshot) { if(p0.exists()) { gameReference.setValue(true) reference.child("CurrentGames").child(gameToJoin).child("Player2").setValue(uid) reference.child("CurrentGames").child(gameToJoin) readyToPlay(gameToJoin) } else { Toast.makeText( applicationContext, "The game with this code does not exist.", Toast.LENGTH_SHORT ).show() buttonCreateGame.isEnabled = true buttonJoinGame.isEnabled = true } } override fun onCancelled(p0: DatabaseError) { } }) }.setNegativeButton(getString(android.R.string.cancel)) {_, _ -> buttonCreateGame.isEnabled = true buttonJoinGame.isEnabled = true }.setCancelable(false) .show() } }
36.061372
108
0.613475
310ffc07f80750fa644c1c9b4abd7acc4ace5de1
2,229
rb
Ruby
app/controllers/imgs_controller.rb
Stephanie041996/Image_Repository
006e5ab6368a63ff9c4234a86a007a2215ae6454
[ "MIT" ]
5
2021-06-17T12:44:07.000Z
2021-06-17T19:03:33.000Z
app/controllers/imgs_controller.rb
Stephanie041996/Image_Repository
006e5ab6368a63ff9c4234a86a007a2215ae6454
[ "MIT" ]
null
null
null
app/controllers/imgs_controller.rb
Stephanie041996/Image_Repository
006e5ab6368a63ff9c4234a86a007a2215ae6454
[ "MIT" ]
null
null
null
class ImgsController < ApplicationController before_action :set_img, only: %i[ show edit update destroy ] before_action :authenticate_user!, except: %i[index show] before_action :correct_user, only: %i[ edit update destroy ] # GET /imgs or /imgs.json def index @imgs = Img.order(created_at: :desc).limit(20) end # GET /imgs/1 or /imgs/1.json def show end def correct_user @img = current_user.imgs.find_by(id: params[:id]) redirect_to imgs_path, notice:"Not Authorized to edit this Image" if @img.nil? end def search @imgs = Img.where("lower(caption) LIKE?", "%" + params[:q] + "%") end # GET /imgs/new def new # @img = current_user.img.build @img = Img.new end # GET /imgs/1/edit def edit end # POST /imgs or /imgs.json def create @img = current_user.imgs.build(img_params) # @img = Img.new(img_params) respond_to do |format| if @img.save format.html { redirect_to @img, notice: "Img was successfully created." } format.json { render :show, status: :created, location: @img } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @img.errors, status: :unprocessable_entity } end end end # PATCH/PUT /imgs/1 or /imgs/1.json def update respond_to do |format| if @img.update(img_params) format.html { redirect_to @img, notice: "Img was successfully updated." } format.json { render :show, status: :ok, location: @img } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @img.errors, status: :unprocessable_entity } end end end # DELETE /imgs/1 or /imgs/1.json def destroy @img.destroy respond_to do |format| format.html { redirect_to imgs_url, notice: "Img was successfully destroyed." } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_img @img = Img.find(params[:id]) end # Only allow a list of trusted parameters through. def img_params params.require(:img).permit(:caption, :image, :user_id) end end
26.535714
85
0.650965
12633aa1ab4870eadd35b2c3af5d1d7821aa1dbe
1,601
cs
C#
TODOList.Domain.Services/Handlers/Querys/GetAllTaskItemsQueryHandler.cs
pedro-octavio/TODOList
a27ca9478026ecfd49ce062527317a45eb4a3631
[ "MIT" ]
1
2021-02-22T11:47:59.000Z
2021-02-22T11:47:59.000Z
TODOList.Domain.Services/Handlers/Querys/GetAllTaskItemsQueryHandler.cs
pedro-octavio/TODOList
a27ca9478026ecfd49ce062527317a45eb4a3631
[ "MIT" ]
null
null
null
TODOList.Domain.Services/Handlers/Querys/GetAllTaskItemsQueryHandler.cs
pedro-octavio/TODOList
a27ca9478026ecfd49ce062527317a45eb4a3631
[ "MIT" ]
null
null
null
using AutoMapper; using MediatR; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using TODOList.Data.Core.Repositories; using TODOList.Domain.Models.RequestModels.QueryRequestModels; using TODOList.Domain.Models.ResponseModels.QueryResponseModels; namespace TODOList.Domain.Services.Handlers.Querys { public class GetAllTaskItemsQueryHandler : IRequestHandler<GetAllTaskItemsQueryRequestModel, IEnumerable<GetAllTaskItemsQueryResponseModel>> { public GetAllTaskItemsQueryHandler(ITaskItemRepository taskItemRepository, ITaskListRepository taskListRepository, IMapper mapper) { this.taskItemRepository = taskItemRepository; this.taskListRepository = taskListRepository; this.mapper = mapper; } private readonly ITaskItemRepository taskItemRepository; private readonly ITaskListRepository taskListRepository; private readonly IMapper mapper; public async Task<IEnumerable<GetAllTaskItemsQueryResponseModel>> Handle(GetAllTaskItemsQueryRequestModel requestModel, CancellationToken cancellationToken) { var taskList = await taskListRepository.GetByIdAsync(requestModel.TaskListId); switch (taskList != null) { case true: return mapper.Map<IEnumerable<GetAllTaskItemsQueryResponseModel>>(await taskItemRepository.GetAllAsync(requestModel.CreateDate, requestModel.TaskListId)); case false: throw new Exception("Task List doens't exists."); } } } }
42.131579
181
0.750156
9f4f3638bd4d70d74a08b74dc4211fa6ea15cbba
2,154
kt
Kotlin
samples/firebase/src/main/kotlin/io/mehow/laboratory/sample/firebase/Application.kt
MiSikora/laboratory
3700c4e1df4e0ac20d553ae075bb33f5e64cf96f
[ "Apache-2.0" ]
70
2020-11-16T02:20:38.000Z
2022-03-30T03:11:37.000Z
samples/firebase/src/main/kotlin/io/mehow/laboratory/sample/firebase/Application.kt
MiSikora/laboratory
3700c4e1df4e0ac20d553ae075bb33f5e64cf96f
[ "Apache-2.0" ]
57
2020-10-25T12:28:30.000Z
2022-02-19T19:02:35.000Z
samples/firebase/src/main/kotlin/io/mehow/laboratory/sample/firebase/Application.kt
MiSikora/laboratory
3700c4e1df4e0ac20d553ae075bb33f5e64cf96f
[ "Apache-2.0" ]
3
2020-12-03T16:18:58.000Z
2022-03-30T03:11:40.000Z
package io.mehow.laboratory.sample.firebase import android.content.Context import androidx.datastore.core.DataStoreFactory import com.google.firebase.database.DataSnapshot import com.google.firebase.database.DatabaseError import com.google.firebase.database.ValueEventListener import com.google.firebase.database.ktx.database import com.google.firebase.ktx.Firebase import io.mehow.laboratory.FeatureFactory import io.mehow.laboratory.FeatureStorage import io.mehow.laboratory.Laboratory import io.mehow.laboratory.OptionFactory import io.mehow.laboratory.datastore.FeatureFlagsSerializer import io.mehow.laboratory.datastore.dataStore import io.mehow.laboratory.inspector.LaboratoryActivity import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.GlobalScope import java.io.File import android.app.Application as AndroidApplication class Application : AndroidApplication() { private lateinit var laboratory: Laboratory override fun onCreate() { super.onCreate() val localDataStore = DataStoreFactory.create(FeatureFlagsSerializer) { File(filesDir, "datastore/local") } val localStorage = FeatureStorage.dataStore(localDataStore) val firebaseDataStore = DataStoreFactory.create(FeatureFlagsSerializer) { File(filesDir, "datastore/firebase") } val firebaseStorage = FeatureStorage.dataStore(firebaseDataStore) val sourcedStorage = FeatureStorage.sourcedBuilder(localStorage) .firebaseSource(firebaseStorage) .build() laboratory = Laboratory.create(sourcedStorage) LaboratoryActivity.configure(laboratory, FeatureFactory.featureGenerated()) val synchronizer = FirebaseSynchronizer( databaseReference = Firebase.database(firebaseUrl).reference.child("featureFlags"), optionFactory = OptionFactory.generated(), featureStorage = firebaseStorage, ) @OptIn(DelicateCoroutinesApi::class) synchronizer.synchronize(GlobalScope) } companion object { private const val firebaseUrl = "https://laboratory-sample-default-rtdb.europe-west1.firebasedatabase.app" val Context.laboratory get() = (applicationContext as Application).laboratory } }
42.235294
116
0.808728
a457fe5319cb9d2b3b37a585fb6848ae3f0df5ac
12,849
php
PHP
storage/framework/views/e133cf88430da2a514848f96a5a951f817a7c1a4.php
mohanadhilles/foodsplus
328a3940a94f2dc98521b2be922c086241f6e9e8
[ "MIT" ]
null
null
null
storage/framework/views/e133cf88430da2a514848f96a5a951f817a7c1a4.php
mohanadhilles/foodsplus
328a3940a94f2dc98521b2be922c086241f6e9e8
[ "MIT" ]
null
null
null
storage/framework/views/e133cf88430da2a514848f96a5a951f817a7c1a4.php
mohanadhilles/foodsplus
328a3940a94f2dc98521b2be922c086241f6e9e8
[ "MIT" ]
null
null
null
<?php $userinfo = app('App\UserInfo'); ?> <?php $settings = app('App\Settings'); ?> <?php $lang = app('App\Lang'); ?> <?php $__env->startSection('content'); ?> <div class="header"> <div class="row clearfix"> <div class="col-md-6 "> <h4 class=""><?php echo e($lang->get(25)); ?></h4> </div> <div class="col-md-push-6 pull-right" > <div style="margin-right: 30px"> <a href="mediaSetType?medialib_type=small"> <?php if($medialib_type == 'small'): ?> <button type="button" class="btn bg-amber waves-effect"> <?php else: ?> <button type="button" class="btn btn-default waves-effect"> <?php endif; ?> <img src="img/tile0.png" width="25px"> </button> </a> <a href="mediaSetType?medialib_type=medium"> <?php if($medialib_type == 'medium'): ?> <button type="button" class="btn bg-amber waves-effect"> <?php else: ?> <button type="button" class="btn btn-default waves-effect"> <?php endif; ?> <img src="img/tile1.png" width="25px"> </button> </a> <a href="mediaSetType?medialib_type=big"> <?php if($medialib_type == 'big'): ?> <button type="button" class="btn bg-amber waves-effect"> <?php else: ?> <button type="button" class="btn btn-default waves-effect"> <?php endif; ?> <img src="img/tile2.png" width="25px" > </button> </a> </div> </div> </div> <div class="row clearfix"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div class="body"> <div class="row clearfix"> <div class="col-md-12"> <?php $__currentLoopData = $petani; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <?php if($medialib_type == 'small'): ?> <div id="tbl<?php echo e($data->id); ?>" class="col-lg-2 col-md-2 col-sm-2 col-xs-2"> <?php endif; ?> <?php if($medialib_type == 'medium'): ?> <div id="tbl<?php echo e($data->id); ?>" class="col-lg-4 col-md-4 col-sm-4 col-xs-4"> <?php endif; ?> <?php if($medialib_type == 'big'): ?> <div id="tbl<?php echo e($data->id); ?>" class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <?php endif; ?> <div class="thumbnail"> <div style="background-image: url('images/<?php echo e($data->filename); ?>'); width: auto; height: 200px; background-size: cover; background-position: center; "> </div> <div class="caption"> <p style="overflow: hidden; white-space: nowrap;" ><?php echo e($data->shortName); ?></p> <p><?php echo e($data->updated_at); ?></p> <p> <?php if($userinfo->getUserPermission("MediaLibrary::Delete")): ?> <button type="button" onclick="deleteFile('<?php echo e($data->filename); ?>', '<?php echo e($data->id); ?>')" class="btn bg-red waves-effect"><?php echo e($lang->get(308)); ?></button> <?php endif; ?> <?php if($data->count == 0): ?> <button type="button" onclick="fileInfo('<?php echo e($data->id); ?>')" class="btn bg-red waves-effect"><?php echo e($lang->get(496)); ?></button> <?php else: ?> <button type="button" onclick="fileInfo('<?php echo e($data->id); ?>')" class="btn bg-teal waves-effect"><?php echo e($lang->get(495)); ?></button> <?php endif; ?> </p> </div> </div> </div> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?> </div> </div> </div> </div> </div> <script type="text/javascript"> function deleteFile(fileName, id) { swal({ title: "<?php echo e($lang->get(81)); ?>", text: "<?php echo e($lang->get(82)); ?>", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "<?php echo e($lang->get(83)); ?>", cancelButtonText: "<?php echo e($lang->get(84)); ?>", closeOnConfirm: true, closeOnCancel: true }, function (isConfirm) { if (isConfirm) { console.log("delete file:", fileName); console.log("id:", id); <?php if($settings->isDemoMode()): ?> return showNotification("bg-red", "<?php echo e($lang->get(307)); ?>", "bottom", "center", "", ""); <?php else: ?> $.ajax({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') }, type: 'POST', url: '<?php echo e(url("image/delete")); ?>', data: {filename: fileName}, success: function (data){ document.getElementById("tbl" + id).remove(); }, error: function(e) { console.log(e); }} ); <?php endif; ?> } else { } }); } function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } function fileInfo(id){ $.ajax({ headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') }, type: 'POST', url: '<?php echo e(url("imageInfo")); ?>', data: { id: id }, success: function (data){ console.log(data); fileInfoDialog(data); }, error: function(e) { console.log(e); }} ); } function fileInfoDialog(data){ // foods var foods = ""; data.foods.forEach(function(item, i, arr) { foods += `<tr><td>id: ${item.id}</td><td>${item.name}</td></tr>`; }); if (foods == "") foods = `<tr><td><?php echo e($lang->get(493)); ?></td><td></td></tr>`; // categories var categories = ""; data.categories.forEach(function(item, i, arr) { categories += `<tr><td>id: ${item.id}</td><td>${item.name}</td></tr>`; }); if (categories == "") categories = `<tr><td><?php echo e($lang->get(493)); ?></td><td></td></tr>`; // extras var extras = ""; data.extras.forEach(function(item, i, arr) { extras += `<tr><td>id: ${item.id}</td><td>${item.name}</td></tr>`; }); if (extras == "") extras = `<tr><td><?php echo e($lang->get(493)); ?></td><td></td></tr>`; // restaurants var restaurants = ""; data.restaurants.forEach(function(item, i, arr) { restaurants += `<tr><td>id: ${item.id}</td><td>${item.name}</td></tr>`; }); if (restaurants == "") restaurants = `<tr><td><?php echo e($lang->get(493)); ?></td><td></td></tr>`; // banners var banners = ""; data.banners.forEach(function(item, i, arr) { banners += `<tr><td>id: ${item.id}</td><td>${item.name}</td></tr>`; }); if (banners == "") banners = `<tr><td><?php echo e($lang->get(493)); ?></td><td></td></tr>`; // users var users = ""; data.users.forEach(function(item, i, arr) { users += `<tr><td>id: ${item.id}</td><td>${item.name}</td></tr>`; }); if (users == "") users = `<tr><td><?php echo e($lang->get(493)); ?></td><td></td></tr>`; // orders var orders = ""; data.orders.forEach(function(item, i, arr) { orders += `<tr><td>id: ${item.id}</td><td>${item.updated_at}</td></tr>`; }); if (orders == "") orders = `<tr><td><?php echo e($lang->get(493)); ?></td><td></td></tr>`; var text = `<div id="div1" style="height: 400px;position:relative;"> <div id="div2" style="max-height:100%;overflow:auto;border:1px solid grey; border-radius: 10px; height: 97%;"> <div id="foodslist" class="row" style="position: relative; top: 10px; left: 20px; right: 10px; bottom: 20px;width: 97%; "> <table class="table table-bordered"> <tbody> <tr style="background-color: paleturquoise; width=50%" > <td> <?php echo e($lang->get(11)); ?> </td> <td></td> </tr> ${users} <tr style="background-color: paleturquoise; width=50%" > <td> <?php echo e($lang->get(3)); ?> </td> <td></td> </tr> ${foods} <tr style="background-color: paleturquoise; width=50%"> <td> <?php echo e($lang->get(2)); ?> </td> <td></td> </tr> ${categories} <tr style="background-color: paleturquoise;"> <td> <?php echo e($lang->get(4)); ?> </td> <td></td> </tr> ${extras} <tr style="background-color: paleturquoise;"> <td> <?php echo e($lang->get(8)); ?> </td> <td></td> </tr> ${restaurants} <tr style="background-color: paleturquoise;"> <td> <?php echo e($lang->get(505)); ?> </td> <td></td> </tr> ${banners} <tr style="background-color: paleturquoise;"> <td> <?php echo e($lang->get(14)); ?> </td> <td></td> </tr> ${orders} </tbody> </table> </div></div></div>`; swal({ title: "<?php echo e($lang->get(494)); ?>", // Using the picture text: text, confirmButtonColor: "#DD6B55", customClass: 'swal-wide', html: true }, function (isConfirm) { if (isConfirm) { } else { } }) } </script> <?php $__env->stopSection(); ?> <?php echo $__env->make('bsb.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\restaurants\resources\views/imageupload.blade.php ENDPATH**/ ?>
43.262626
233
0.377539
5aa75b3ccc310f9699ba20bfb39ac7a4eccaa438
5,215
dart
Dart
lib/d_stack.dart
DuYuanye/d_stack
d88898904a364e7a6b278646c2107d80ddfedf9d
[ "MIT" ]
null
null
null
lib/d_stack.dart
DuYuanye/d_stack
d88898904a364e7a6b278646c2107d80ddfedf9d
[ "MIT" ]
null
null
null
lib/d_stack.dart
DuYuanye/d_stack
d88898904a364e7a6b278646c2107d80ddfedf9d
[ "MIT" ]
null
null
null
/* * Created with Android Studio. * User: whqfor * Date: 2020-02-03 * Time: 14:20 * email: wanghuaqiang@tal.com * tartget: plugin人口 */ import 'package:d_stack/channel/dchannel.dart'; import 'package:d_stack/navigator/dnavigator_gesture_observer.dart'; import 'package:d_stack/navigator/dnavigator_manager.dart'; import 'package:d_stack/observer/life_cycle_observer.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; enum PageType { native, flutter } typedef DStackWidgetBuilder = WidgetBuilder Function(Map params); typedef AnimatedPageBuilder = AnimatedWidget Function( BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, WidgetBuilder widgetBuilder); class DStack { static DChannel _stackChannel; static final DStack _instance = DStack(); static DStack get instance { final MethodChannel _methodChannel = MethodChannel("d_stack"); _stackChannel = DChannel(_methodChannel); return _instance; } DChannel get channel => _stackChannel; /// navigatorKey final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>(); /// 路由observer final DStackNavigatorObserver dStackNavigatorObserver = DStackNavigatorObserver(); /// 用来监听 应用生命周期 DLifeCycleObserver dLifeCycleObserver; final Map<String, DStackWidgetBuilder> _pageBuilders = <String, DStackWidgetBuilder>{}; /// 注册DStack /// builders 路由的builder /// observer 生命周期监听者 void register( {Map<String, DStackWidgetBuilder> builders, DLifeCycleObserver observer}) { if (builders?.isNotEmpty == true) { _pageBuilders.addAll(builders); } dLifeCycleObserver = observer; } /// 获取一个 DStackWidgetBuilder /// pageName 路由 DStackWidgetBuilder pageBuilder(String pageName) { DStackWidgetBuilder builder = _pageBuilders[pageName]; if (builder != null) { return builder; } else { throw Exception('not in the PageRoute'); } } /// 获取节点列表 Future<List<DStackNode>> nodeList() { return channel.getNodeList(); } /// 推出一个页面 /// routeName 路由名, /// pageType native或者flutter, /// params 参数 /// animated 是否有进场动画 static Future push(String routeName, PageType pageType, {Map params, bool maintainState = true, bool animated = true}) { return DNavigatorManager.push( routeName, pageType, params, maintainState, animated); } /// 弹出一个页面 /// animated 是否有进场动画 static Future present(String routeName, PageType pageType, {Map params, bool maintainState = true, bool animated = true}) { return DNavigatorManager.present( routeName, pageType, params, maintainState, animated); } /// 自定义转场动画进入页面 /// flutter页面通过animatedBuilder自定义动画 /// native页面会转发到native,由native自行接入实现 /// replace:true flutter的pushReplacement实现 /// replace:false flutter的push实现 static Future animationPage( String routeName, PageType pageType, AnimatedPageBuilder animatedBuilder, { Map params, Duration transitionDuration, bool opaque = true, bool barrierDismissible = false, Color barrierColor, String barrierLabel, bool maintainState = true, bool fullscreenDialog = false, bool replace = false, }) { return DNavigatorManager.animationPage( routeName, pageType, animatedBuilder, params, transitionDuration, opaque, barrierDismissible, barrierColor, barrierLabel, maintainState, fullscreenDialog, replace); } /// 等同push /// builder 页面builder /// animated 是否有进场动画 static Future pushBuild( String routeName, PageType pageType, WidgetBuilder builder, {Map params, bool maintainState = true, bool fullscreenDialog = false, bool animated = true}) { return DNavigatorManager.pushBuild(routeName, pageType, builder, params, maintainState, fullscreenDialog, animated); } /// 只支持flutter使用,替换flutter页面 /// animated 是否有进场动画 static Future replace(String routeName, PageType pageType, {Map params, bool maintainState = true, bool fullscreenDialog = false, bool animated = true}) { return DNavigatorManager.replace( routeName, pageType, params, maintainState, animated); } /// pop /// 可以不传路由信息 /// result 返回值,可为空 static void pop({Map result}) { DNavigatorManager.pop(result); } /// popTo指定页面 /// 无法popTo到根页面 /// 要popTo到根页面请调用popToRoot static void popTo(String routeName, PageType pageType, {Map result}) { DNavigatorManager.popTo(routeName, pageType, result); } /// 回到根页面 static void popToRoot() { DNavigatorManager.popToNativeRoot(); } /// pop同一组页面 static void popSkip(String skipName, {Map result}) { DNavigatorManager.popSkip(skipName, result); } /// 关闭一个页面 /// 如果是push进入的,等同pop /// 如果是present进入的,效果是从上往下缩回去 static void dismiss([Map result]) { DNavigatorManager.dismiss(result); } @Deprecated('已废弃,请调用popToRoot') static void popToNativeRoot() { DNavigatorManager.popToNativeRoot(); } } class DStackNode { final String route; final String pageType; DStackNode({this.route, this.pageType}); }
26.338384
77
0.699521
2cc71182d45ec6e07d0045564180be4b28e8ae80
336
py
Python
openlayers/views.py
bianchimro/django-openlayers
883d0b5876f66fc6f83caa3cb3c4af86c08beecf
[ "BSD-3-Clause" ]
4
2015-12-30T07:16:10.000Z
2020-04-12T19:24:21.000Z
openlayers/views.py
bianchimro/django-openlayers
883d0b5876f66fc6f83caa3cb3c4af86c08beecf
[ "BSD-3-Clause" ]
null
null
null
openlayers/views.py
bianchimro/django-openlayers
883d0b5876f66fc6f83caa3cb3c4af86c08beecf
[ "BSD-3-Clause" ]
5
2015-04-29T07:36:16.000Z
2022-03-26T20:15:21.000Z
# Create your views here. from django.http import HttpResponse, HttpResponseRedirect from django.template import RequestContext, loader from django.shortcuts import render_to_response, redirect from models import * def map(request, id): map = Map.objects.get(pk=id) return render_to_response("map.html", {'map' : map })
25.846154
58
0.755952
255c8533a05e1ee03ed2436f84322f9161dc9797
183
js
JavaScript
dokumentacja/html/search/classes_1.js
KPO-2020-2021/zad5_1-Patidzon
b9aac04c5a5fe91a259c9d7205f6447c11a0c7cb
[ "Unlicense" ]
null
null
null
dokumentacja/html/search/classes_1.js
KPO-2020-2021/zad5_1-Patidzon
b9aac04c5a5fe91a259c9d7205f6447c11a0c7cb
[ "Unlicense" ]
null
null
null
dokumentacja/html/search/classes_1.js
KPO-2020-2021/zad5_1-Patidzon
b9aac04c5a5fe91a259c9d7205f6447c11a0c7cb
[ "Unlicense" ]
null
null
null
var searchData= [ ['basic_5fostream_1006',['basic_ostream',['../classbasic__ostream.html',1,'']]], ['brylawzorcowa_1007',['brylawzorcowa',['../classbrylawzorcowa.html',1,'']]] ];
30.5
82
0.677596
386c622512dd300295ec58f3088941950db6d1c2
1,120
php
PHP
application/views/login.php
LeticiaSandoval/SPA-UAMI_V1
e9bd1069781ff504b6ca7d97957d864451b194a2
[ "MIT" ]
null
null
null
application/views/login.php
LeticiaSandoval/SPA-UAMI_V1
e9bd1069781ff504b6ca7d97957d864451b194a2
[ "MIT" ]
null
null
null
application/views/login.php
LeticiaSandoval/SPA-UAMI_V1
e9bd1069781ff504b6ca7d97957d864451b194a2
[ "MIT" ]
null
null
null
<div class="jumbotron"> <div class="container"> <h1>SPA-UAM-I</h1> <p>Sistema de productividad académica</p> </div> </div> <div class="row"> <div class="col-sm-4 col-sm-offset-4 myform-cont" > <div class="myform-top"> <div class="myform-top-left"> <h3>Ingresar</h3> <p class="regis">Digita tu usuario y contraseña:</p> </div> </div> <div class="myform-bottom"> <form role="form" action="<?= base_url()?>login" method="post"> <div class="form-group"> <input type="text" name="correo" placeholder="Correo electronico..." class="form-control" id="form-username"> </div> <div class="form-group"> <input type="password" name="contraseña" placeholder="Contraseña..." class="form-control" id="form-password"> </div> <button type="submit" class="mybtn">Entrar</button> </form> </div> </div> </div> <br>
38.62069
127
0.483929
546b55ade586abd850ad48d54acb3b010dca745b
725
css
CSS
src/css/popup.css
magnasilvar/google-consent-bypass
5a3930b81e46d0af1ab4ea7e17659c7b67090bb7
[ "MIT" ]
1
2021-07-30T12:08:55.000Z
2021-07-30T12:08:55.000Z
src/css/popup.css
magnasilvar/google-consent-bypass
5a3930b81e46d0af1ab4ea7e17659c7b67090bb7
[ "MIT" ]
4
2021-06-12T17:13:33.000Z
2021-09-06T22:07:58.000Z
src/css/popup.css
magnasilvar/google-consent-bypass
5a3930b81e46d0af1ab4ea7e17659c7b67090bb7
[ "MIT" ]
2
2021-06-11T07:56:32.000Z
2021-09-05T14:47:28.000Z
body { text-align: center; font-family: Helvetica, Arial, sans-serif; font-size: .9rem; line-height: 1.5rem; margin: 0; width: 23rem; } header { display: flex; align-items: center; justify-content: space-evenly; padding: 1rem 0 0 0; } header h1 { margin: 0; font-size: 1.4rem; } main { width: 100%; } main #content { border-radius: 15px; padding: 1rem; margin: 1rem 1rem 0 1rem; } .consent-panel-hidden { background: #73ad21; } .consent-panel-unknown { background: yellow; } .not-supported { border: 1px solid #ccc; } a { color: #585252; font-size: .8rem; outline: none; text-decoration: none; } a:hover { text-decoration: underline; } footer { padding: 0.4rem 1.5rem; }
13.942308
44
0.645517
6a25a304b55edec2030af40b894275d693fc356d
1,081
sql
SQL
server/backend/src/main/resources/db/migration/V4__AddUserForWorkEventAndWorkPeriod.sql
opate/office-thing
01f6c9a494967f9bc501b2288ac711ef3129edf1
[ "Apache-2.0" ]
1
2019-07-02T18:51:44.000Z
2019-07-02T18:51:44.000Z
server/backend/src/main/resources/db/migration/V4__AddUserForWorkEventAndWorkPeriod.sql
opate/office-thing
01f6c9a494967f9bc501b2288ac711ef3129edf1
[ "Apache-2.0" ]
null
null
null
server/backend/src/main/resources/db/migration/V4__AddUserForWorkEventAndWorkPeriod.sql
opate/office-thing
01f6c9a494967f9bc501b2288ac711ef3129edf1
[ "Apache-2.0" ]
null
null
null
-- Add column userid to workevent. Remove column rfid_uid from workevent. DO $$ BEGIN BEGIN ALTER TABLE workevent ADD COLUMN user_id BIGINT; EXCEPTION WHEN duplicate_column THEN RAISE NOTICE 'column user_id already exists in workevent.'; END; END$$; -- Add column userid to workperiod. Remove column rfid_uid from workperiod. DO $$ BEGIN BEGIN ALTER TABLE workperiod ADD COLUMN user_id BIGINT; EXCEPTION WHEN duplicate_column THEN RAISE NOTICE 'column user_id already exists in workperiod.'; END; END$$; -- Create startedworkperiod table instead of rfidinuse CREATE TABLE IF NOT EXISTS startedworkperiod ( id BIGSERIAL PRIMARY KEY, user_id BIGINT NOT NULL, work_period_id BIGINT NOT NULL, FOREIGN KEY (work_period_id) REFERENCES workperiod (id) ); -- Remove workevent constraints ALTER TABLE workevent ALTER COLUMN rfid_tag_id DROP NOT NULL; ALTER TABLE workperiod ALTER COLUMN rfid_uid DROP NOT NULL; ALTER TABLE workperiod ALTER COLUMN work_date DROP NOT NULL;
30.885714
99
0.721554
05ad50727941c958a6a4cefe1e0b137c33ad2ed0
1,979
rs
Rust
duna-core/src/architectures/riscv/registers.rs
noloerino/mars
38a44eb118c812aafa870ade9e9be4b1c55ab261
[ "MIT" ]
null
null
null
duna-core/src/architectures/riscv/registers.rs
noloerino/mars
38a44eb118c812aafa870ade9e9be4b1c55ab261
[ "MIT" ]
8
2020-12-04T01:26:02.000Z
2022-02-27T11:08:00.000Z
duna-core/src/architectures/riscv/registers.rs
noloerino/mars
38a44eb118c812aafa870ade9e9be4b1c55ab261
[ "MIT" ]
null
null
null
use crate::{data_structures::*, program_state::IRegister}; use std::fmt; #[derive(Copy, Clone, PartialEq, Debug)] pub enum RiscVRegister { Zero = 0, Ra, Sp, Gp, Tp, T0, T1, T2, S0, S1, A0, A1, A2, A3, A4, A5, A6, A7, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11, T3, T4, T5, T6, } impl fmt::Display for RiscVRegister { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let mut s = format!("{:?}", self); s.make_ascii_lowercase(); write!(f, "{}", s) } } impl From<u8> for RiscVRegister { fn from(value: u8) -> RiscVRegister { RiscVRegister::REG_ARRAY[value as usize] } } impl RiscVRegister { #[allow(non_upper_case_globals)] pub const Fp: RiscVRegister = RiscVRegister::S0; pub const REG_ARRAY: [RiscVRegister; 32] = [ RiscVRegister::Zero, RiscVRegister::Ra, RiscVRegister::Sp, RiscVRegister::Gp, RiscVRegister::Tp, RiscVRegister::T0, RiscVRegister::T1, RiscVRegister::T2, RiscVRegister::Fp, RiscVRegister::S1, RiscVRegister::A0, RiscVRegister::A1, RiscVRegister::A2, RiscVRegister::A3, RiscVRegister::A4, RiscVRegister::A5, RiscVRegister::A6, RiscVRegister::A7, RiscVRegister::S2, RiscVRegister::S3, RiscVRegister::S4, RiscVRegister::S5, RiscVRegister::S6, RiscVRegister::S7, RiscVRegister::S8, RiscVRegister::S9, RiscVRegister::S10, RiscVRegister::S11, RiscVRegister::T3, RiscVRegister::T4, RiscVRegister::T5, RiscVRegister::T6, ]; pub const fn to_bit_str(self) -> BitStr32 { BitStr32::new(self as u32, 5) } } impl IRegister for RiscVRegister { fn to_usize(self) -> usize { self as usize } }
19.594059
58
0.544214
5d31ec742b2c9a137651e966d42d1d182ac107d2
1,577
rb
Ruby
spec/factories.rb
chatgris/blabbr
485f2031b1ee3fe50cba103b8c797a744d9c870a
[ "MIT" ]
3
2015-11-05T08:05:02.000Z
2016-09-02T18:16:01.000Z
spec/factories.rb
chatgris/blabbr
485f2031b1ee3fe50cba103b8c797a744d9c870a
[ "MIT" ]
null
null
null
spec/factories.rb
chatgris/blabbr
485f2031b1ee3fe50cba103b8c797a744d9c870a
[ "MIT" ]
null
null
null
# encoding: utf-8 Factory.define :user do |u| u.nickname "One user" u.email "mail@email.com" u.locale "fr" u.password "password" u.password_confirmation "password" u.posts_count 12 end Factory.define :invited, :class => "user" do |u| u.nickname "Invited member" u.email "newmail@email.com" u.locale "fr" u.password "password" u.password_confirmation "password" u.posts_count 0 end Factory.define :creator, :class => "user" do |u| u.nickname "creator" u.email "email@email.com" u.locale "fr" u.password "password" u.password_confirmation "password" u.posts_count 12 end Factory.define :post do |p| p.creator Factory.build(:creator) p.body "Some content" end Factory.define :topic do |t| t.title "One topic" t.creator "creator" t.user Factory.build(:creator) t.after_build do |tp| tp.posts.push(Factory.build(:post)) end end Factory.define :member do |s| s.nickname "Member" end Factory.define:smiley do |s| s.code "doc" s.added_by "One user" s.height 20 s.width 20 s.image File.open(Rails.root.join("image.jpg")) end
28.672727
69
0.479391
a7733c6a126bd64577ca5c4512530d0a7ecef5af
1,852
dart
Dart
lib/editor/main/widgets/editor_grid_overlay.dart
jeffsieu/blocked
6bdc6429ed9f905bc6d6ecee1f29a0bed41111bc
[ "MIT" ]
5
2022-03-15T02:55:42.000Z
2022-03-31T06:46:09.000Z
lib/editor/main/widgets/editor_grid_overlay.dart
jeffsieu/blocked
6bdc6429ed9f905bc6d6ecee1f29a0bed41111bc
[ "MIT" ]
null
null
null
lib/editor/main/widgets/editor_grid_overlay.dart
jeffsieu/blocked
6bdc6429ed9f905bc6d6ecee1f29a0bed41111bc
[ "MIT" ]
null
null
null
import 'package:blocked/puzzle/board_constants.dart'; import 'package:blocked/resizable/resizable.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class EditorGridOverlay extends StatelessWidget { const EditorGridOverlay( {Key? key, this.color = const Color(0x66777777), this.child}) : super(key: key); final Color color; final Widget? child; @override Widget build(BuildContext context) { return RepaintBoundary( child: CustomPaint( willChange: false, foregroundPainter: _GridOverlayPainter(color), child: child, ), ); } } class _GridOverlayPainter extends CustomPainter { _GridOverlayPainter(this.color); final Color color; @override void paint(Canvas canvas, Size size) { final paint = Paint() ..color = color ..strokeWidth = 2 ..style = PaintingStyle.stroke; for (var x = kHandleSize; x + kWallWidth <= size.width; x += kBlockSizeInterval) { for (var y = kHandleSize; y + kWallWidth <= size.height; y += kBlockSizeInterval) { canvas.drawRRect( RRect.fromRectAndRadius(Rect.fromLTWH(x, y, kWallWidth, kWallWidth), const Radius.circular(2)), paint); } } for (var x = kHandleSize + kWallWidth + kBlockGap; x + kBlockSize <= size.width; x += kBlockSizeInterval) { for (var y = kHandleSize + kWallWidth + kBlockGap; y + kBlockSize <= size.height; y += kBlockSizeInterval) { canvas.drawRRect( RRect.fromRectAndRadius(Rect.fromLTWH(x, y, kBlockSize, kBlockSize), const Radius.circular(2)), paint); } } } @override bool shouldRepaint(covariant CustomPainter oldDelegate) { return false; } }
26.84058
80
0.62581
0f1522943f7f321a57c9b884aa53dfb156e4f292
2,451
sql
SQL
employeeTrackerSeeds.sql
BrandonEJenkins/MySQL-Employee-Tracker
747ed4310e1ed0ece0107d3c2219758f1602bbee
[ "MIT" ]
null
null
null
employeeTrackerSeeds.sql
BrandonEJenkins/MySQL-Employee-Tracker
747ed4310e1ed0ece0107d3c2219758f1602bbee
[ "MIT" ]
null
null
null
employeeTrackerSeeds.sql
BrandonEJenkins/MySQL-Employee-Tracker
747ed4310e1ed0ece0107d3c2219758f1602bbee
[ "MIT" ]
null
null
null
DROP DATABASE IF EXISTS employee_trackerdb; CREATE DATABASE employee_trackerDB; use employee_trackerDB; -- name is department name CREATE TABLE department ( id INT NOT NULL AUTO_INCREMENT, name VARCHAR(30) NULL, PRIMARY KEY (id) ); CREATE TABLE role ( id INT NOT NULL AUTO_INCREMENT, title VARCHAR(30) NULL, salary DECIMAL(10,2) NULL, department_id INT NULL, PRIMARY KEY (id) ); CREATE TABLE employee ( id INT NOT NULL AUTO_INCREMENT, first_name VARCHAR(30) NULL, last_name VARCHAR(30) NULL, role_id INT NULL, manager_id INT NULL, PRIMARY KEY (id) ); INSERT INTO department (name) VALUES('Sales'); INSERT INTO department (name) VALUES('Engineering'); INSERT INTO department (name) VALUES('Finance'); INSERT INTO department (name) VALUES('Legal'); -- INSERT INTO department (name) VALUES(); -- INSERT INTO department (name) VALUES(); -- INSERT INTO department (name) VALUES(); -- INSERT INTO department (name) VALUES(); INSERT INTO role (title, salary, department_id) VALUES('Sales Lead', 150000, 1); INSERT INTO role (title, salary, department_id) VALUES('Salesperson', 85000, 1); INSERT INTO role (title, salary, department_id) VALUES('Lead Engineer',185000, 2); INSERT INTO role (title, salary, department_id) VALUES('Software Engineer', 125000, 2); INSERT INTO role (title, salary, department_id) VALUES('Accountant', 135000, 3); INSERT INTO role (title, salary, department_id) VALUES('Legal Team Lead', 210000, 4); INSERT INTO role (title, salary, department_id) VALUES('Lawyer', 190000, 4); INSERT INTO role (title, salary, department_id) VALUES('Lead Engineer', 175000, 2); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES('April', 'Ennis', 1, null); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES('Christina', 'Smith', 2, 1); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES('Brandon', 'Jenkins', 3, null); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES('Karmen', 'Wills', 4, 3); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES('Louis', 'Frederickson', 5, 6); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES('Yashira', 'Wallace', 6, null); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES('Dani', 'Aveden', 7, 6); INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES('Ashley', 'Johnson', 8, 3);
43
104
0.735618
7bfa51cd85ab7ce66cf0773192b7639a6a65b034
9,917
cc
C++
application/common/application_file_util.cc
shaochangbin/crosswalk
a4e189b2ab8ca33555a90601476d59c9c291942f
[ "BSD-3-Clause" ]
1
2019-01-16T06:49:57.000Z
2019-01-16T06:49:57.000Z
application/common/application_file_util.cc
shaochangbin/crosswalk
a4e189b2ab8ca33555a90601476d59c9c291942f
[ "BSD-3-Clause" ]
null
null
null
application/common/application_file_util.cc
shaochangbin/crosswalk
a4e189b2ab8ca33555a90601476d59c9c291942f
[ "BSD-3-Clause" ]
null
null
null
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "xwalk/application/common/application_file_util.h" #include <algorithm> #include <map> #include <vector> #include "base/command_line.h" #include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" #include "base/file_util.h" #include "base/json/json_file_value_serializer.h" #include "base/logging.h" #include "base/metrics/histogram.h" #include "base/path_service.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/threading/thread_restrictions.h" #include "net/base/escape.h" #include "net/base/file_stream.h" #include "third_party/libxml/src/include/libxml/tree.h" #include "ui/base/l10n/l10n_util.h" #include "xwalk/application/common/application_data.h" #include "xwalk/application/common/application_manifest_constants.h" #include "xwalk/application/common/constants.h" #include "xwalk/application/common/install_warning.h" #include "xwalk/application/common/manifest.h" #include "xwalk/application/common/manifest_handler.h" namespace errors = xwalk::application_manifest_errors; namespace keys = xwalk::application_manifest_keys; namespace widget_keys = xwalk::application_widget_keys; namespace { const char kAttributePrefix[] = "@"; const char kNamespaceKey[] = "@namespace"; const char kTextKey[] = "#text"; } namespace xwalk { namespace application { inline char* ToCharPointer(void* ptr) { return reinterpret_cast<char *>(ptr); } inline const char* ToConstCharPointer(const void* ptr) { return reinterpret_cast<const char*>(ptr); } // Load XML node into Dictionary structure. // The keys for the XML node to Dictionary mapping are described below: // XML Dictionary // <e></e> "e":{"#text": ""} // <e>textA</e> "e":{"#text":"textA"} // <e attr="val">textA</e> "e":{ "@attr":"val", "#text": "textA"} // <e> <a>textA</a> <b>textB</b> </e> "e":{ // "a":{"#text":"textA"} // "b":{"#text":"textB"} // } // <e> <a>textX</a> <a>textY</a> </e> "e":{ // "a":[ {"#text":"textX"}, // {"#text":"textY"}] // } // <e> textX <a>textY</a> </e> "e":{ "#text":"textX", // "a":{"#text":"textY"} // } // // For elements that are specified under a namespace, the dictionary // will add '@namespace' key for them, e.g., // XML: // <e xmln="linkA" xmlns:N="LinkB"> // <sub-e1> text1 </sub-e> // <N:sub-e2 text2 /> // </e> // will be saved in Dictionary as, // "e":{ // "#text": "", // "@namespace": "linkA" // "sub-e1": { // "#text": "text1", // "@namespace": "linkA" // }, // "sub-e2": { // "#text":"text2" // "@namespace": "linkB" // } // } base::DictionaryValue* LoadXMLNode(xmlNode* root) { scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); if (root->type != XML_ELEMENT_NODE) return NULL; xmlAttr* prop = NULL; for (prop = root->properties; prop; prop = prop->next) { char* prop_value = ToCharPointer(xmlNodeListGetString( root->doc, prop->children, 1)); value->SetString( std::string(kAttributePrefix) + ToConstCharPointer(prop->name), prop_value); xmlFree(prop_value); } if (root->ns) value->SetString(kNamespaceKey, ToConstCharPointer(root->ns->href)); for (xmlNode* node = root->children; node; node = node->next) { std::string sub_node_name(ToConstCharPointer(node->name)); base::DictionaryValue* sub_value = LoadXMLNode(node); if (!sub_value) continue; if (!value->HasKey(sub_node_name)) { value->Set(sub_node_name, sub_value); continue; } base::Value* temp; value->Get(sub_node_name, &temp); DCHECK(temp); if (temp->IsType(base::Value::TYPE_LIST)) { base::ListValue* list; temp->GetAsList(&list); list->Append(sub_value); } else { DCHECK(temp->IsType(base::Value::TYPE_DICTIONARY)); base::DictionaryValue* dict; temp->GetAsDictionary(&dict); base::DictionaryValue* prev_value(new base::DictionaryValue()); prev_value = dict->DeepCopy(); base::ListValue* list = new base::ListValue(); list->Append(prev_value); list->Append(sub_value); value->Set(sub_node_name, list); } } char* text = ToCharPointer( xmlNodeListGetString(root->doc, root->children, 1)); if (!text) { value->SetString(kTextKey, std::string()); } else { value->SetString(kTextKey, text); } xmlFree(text); return value.release(); } scoped_refptr<ApplicationData> LoadApplication( const base::FilePath& application_path, Manifest::SourceType source_type, std::string* error) { return LoadApplication(application_path, std::string(), source_type, error); } scoped_refptr<ApplicationData> LoadApplication( const base::FilePath& application_path, const std::string& application_id, Manifest::SourceType source_type, std::string* error) { scoped_ptr<base::DictionaryValue> manifest( LoadManifest(application_path, error)); if (!manifest.get()) return NULL; scoped_refptr<ApplicationData> application = ApplicationData::Create( application_path, source_type, *manifest, application_id, error); if (!application.get()) return NULL; std::vector<InstallWarning> warnings; ManifestHandlerRegistry* registry = manifest->HasKey(widget_keys::kWidgetKey) ? ManifestHandlerRegistry::GetInstance(Manifest::TYPE_WGT) : ManifestHandlerRegistry::GetInstance(Manifest::TYPE_XPK); if (!registry->ValidateAppManifest(application, error, &warnings)) return NULL; if (!warnings.empty()) { LOG(WARNING) << "There are some warnings when validating the application " << application->ID(); } return application; } static base::DictionaryValue* LoadManifestXpk( const base::FilePath& manifest_path, std::string* error) { JSONFileValueSerializer serializer(manifest_path); scoped_ptr<base::Value> root(serializer.Deserialize(NULL, error)); if (!root.get()) { if (error->empty()) { // If |error| is empty, than the file could not be read. // It would be cleaner to have the JSON reader give a specific error // in this case, but other code tests for a file error with // error->empty(). For now, be consistent. *error = base::StringPrintf("%s", errors::kManifestUnreadable); } else { *error = base::StringPrintf("%s %s", errors::kManifestParseError, error->c_str()); } return NULL; } if (!root->IsType(base::Value::TYPE_DICTIONARY)) { *error = base::StringPrintf("%s", errors::kManifestUnreadable); return NULL; } base::DictionaryValue* dv = static_cast<base::DictionaryValue*>(root.release()); #if defined(OS_TIZEN) // Ignore any Tizen application ID, as this is automatically generated. dv->Remove(keys::kTizenAppIdKey, NULL); #endif return dv; } static base::DictionaryValue* LoadManifestWgt( const base::FilePath& manifest_path, std::string* error) { xmlDoc * doc = NULL; xmlNode* root_node = NULL; doc = xmlReadFile(manifest_path.MaybeAsASCII().c_str(), NULL, 0); if (doc == NULL) { *error = base::StringPrintf("%s", errors::kManifestUnreadable); return NULL; } root_node = xmlDocGetRootElement(doc); base::DictionaryValue* dv = LoadXMLNode(root_node); scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue); if (dv) result->Set(ToConstCharPointer(root_node->name), dv); return result.release(); } base::DictionaryValue* LoadManifest(const base::FilePath& application_path, std::string* error) { base::FilePath manifest_path; manifest_path = application_path.Append(kManifestXpkFilename); if (base::PathExists(manifest_path)) return LoadManifestXpk(manifest_path, error); manifest_path = application_path.Append(kManifestWgtFilename); if (base::PathExists(manifest_path)) return LoadManifestWgt(manifest_path, error); *error = base::StringPrintf("%s", errors::kManifestUnreadable); return NULL; } base::FilePath ApplicationURLToRelativeFilePath(const GURL& url) { std::string url_path = url.path(); if (url_path.empty() || url_path[0] != '/') return base::FilePath(); // Drop the leading slashes and convert %-encoded UTF8 to regular UTF8. std::string file_path = net::UnescapeURLComponent(url_path, net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS); size_t skip = file_path.find_first_not_of("/\\"); if (skip != file_path.npos) file_path = file_path.substr(skip); base::FilePath path = #if defined(OS_POSIX) base::FilePath(file_path); #elif defined(OS_WIN) base::FilePath(base::UTF8ToWide(file_path)); #else base::FilePath(); NOTIMPLEMENTED(); #endif // It's still possible for someone to construct an annoying URL whose path // would still wind up not being considered relative at this point. // For example: app://id/c:////foo.html if (path.IsAbsolute()) return base::FilePath(); return path; } } // namespace application } // namespace xwalk
32.837748
78
0.628618
f5ccfcabf9a7e7c3b0b07d41ca0eed20db0241c3
754
css
CSS
src/components/interclub/interclub.module.css
jonathanvouilloz/bccChenois
0894a6c9daf7ceba8b533b48e3da2d3df56471b0
[ "MIT" ]
null
null
null
src/components/interclub/interclub.module.css
jonathanvouilloz/bccChenois
0894a6c9daf7ceba8b533b48e3da2d3df56471b0
[ "MIT" ]
null
null
null
src/components/interclub/interclub.module.css
jonathanvouilloz/bccChenois
0894a6c9daf7ceba8b533b48e3da2d3df56471b0
[ "MIT" ]
null
null
null
.aboutInter { margin: auto; margin-left: 10px; margin-right: 10px; } .aboutInter h2 { text-decoration: underline; } li { color: #696969; } .saison { font-size: 1.5rem; text-transform: uppercase; color: var(--primaryColor); font-size: 1.3rem; padding: 1rem 1.5rem; border-color: var(--primaryColor); border-style: solid; border-width: 2.5px; transition: 0.2s; } .saison:hover { color: var(--mainBlack); border-color: var(--mainBlack); } .saisonFinie { font-size: 1.5rem; color: red; text-decoration: line-through; } .calendar { width: 60%; margin-left: auto; margin-right: auto; } @media screen and (max-width: 740px) { .aboutInter { width: 95%; margin-left: auto; margin-right: auto; } }
15.08
38
0.639257
051d11c52442026e3b007d1ef5518bfdbe61f81c
2,009
css
CSS
packages/examples/src/examples/hooks/style.css
wixplosives/tsx-air
367e016288e5090a833a2149bc20d81a211f16cc
[ "MIT" ]
4
2019-07-30T20:28:37.000Z
2020-08-04T18:30:24.000Z
packages/examples/src/examples/hooks/style.css
wixplosives/tsx-air
367e016288e5090a833a2149bc20d81a211f16cc
[ "MIT" ]
13
2020-01-25T10:56:28.000Z
2021-08-31T17:52:00.000Z
packages/examples/src/examples/hooks/style.css
wixplosives/tsx-air
367e016288e5090a833a2149bc20d81a211f16cc
[ "MIT" ]
null
null
null
* { font-family: sans-serif; } .eye { border: #000 solid 0.1em; margin: 5%; border-radius: 50%; background-color: white; display: flex; align-content: center; align-items: center; justify-content: center; width: 100%; height: 100%; } .eye > div { border-radius: 50%; height: 50%; width: 50%; background-color: black; transform-origin: 50% 50%; position: relative; overflow: hidden; } .eye > div::after { content: ''; position: absolute; width: 100%; height: 100%; transform: rotate(313deg) translate(91% ,10%)scale(1,0.2) rotate(45deg); background-color: white; } .eye:first-child { height: 70%; width: 70%; } .face { place-items: center center; background-color: yellow; border-radius: 50%; border: black solid 0.1em; display: grid; grid-template-columns: 1fr 1fr; column-gap: 10%; grid-template-rows: 1fr 1fr; width: 10em; height: 12em; margin: 0; padding: 0; } .smile:hover { transform: translate(7%, -19%) rotate(-65deg); } .smile { position: relative; grid-column: span 2; place-self: center center; width: 5em; height: 5em; border-radius: 50%; /* border-bottom-left-radius: 100%; */ border: solid 1em red; transform: translate(-5%, -19%) rotate(-19deg); border-right: transparent solid 1em; border-top: transparent solid 1em; overflow: hidden; transition: transform 0.3s cubic-bezier(0.215, 0.610, 0.355, 1); } .smile::before { content: ''; bottom: 0; top: 50%; width: 110%; left: 50%; background-color: white; transform: rotate(45deg) translate(-50%, 92%); display: block; z-index: -2; position: absolute; } .smile::after { content: '\2502\2502\2502\2502\2502'; transform: rotate(45deg) translate(17%, 106%); font-size: 200%; color: black; display: block; z-index: -1; position: absolute; border-top: solid black; }
20.71134
76
0.598805
389aa9a6ef948ccf91d65c4d599f456df9ab1033
23,404
php
PHP
dars_2/uyga_vazifa_2.php
Umidjon017/php-mini-logic-projects
c34d8af4591936e81430f1f59f6530fa1ae37630
[ "BSD-3-Clause" ]
1
2022-02-28T18:15:14.000Z
2022-02-28T18:15:14.000Z
dars_2/uyga_vazifa_2.php
Umidjon017/php-mini-logic-projects
c34d8af4591936e81430f1f59f6530fa1ae37630
[ "BSD-3-Clause" ]
null
null
null
dars_2/uyga_vazifa_2.php
Umidjon017/php-mini-logic-projects
c34d8af4591936e81430f1f59f6530fa1ae37630
[ "BSD-3-Clause" ]
null
null
null
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Uyga vazifa | PHP shart amallar</title> <!-- Bootstrap CSS link --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <link rel="stylesheet" href="../index.css"> </head> <body class="body2"> <!-- Navbar --> <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <div class="container-fluid"> <a class="navbar-brand" href="../index.php"><h1> <?= 'PHP darslari' ?></h1></a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav m-auto mb-2 mb-lg-0"> <li class="nav-item"> <a class="nav-link active" aria-current="page" href="../index.php">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Link</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Vazifalar </a> <ul class="dropdown-menu" aria-labelledby="navbarDropdown"> <li><a class="dropdown-divider" href="#">1-Matematik amallar</a></li> <li><a class="dropdown-item" href="../dars_1/uyga_vazifa_1.php">Uyga vazifa-1</a></li> <li><a class="dropdown-divider" href="#">2-PHP shart amallar</a></li> <li><a class="dropdown-item" href="uyga_vazifa_2.php">Uyga vazifa-2</a></li> <li><a class="dropdown-divider" href="#">3-PHP arraylar</a></li> <li><a class="dropdown-item" href="../dars_3/uyga_vazifa_3.php">Uyga vazifa-3</a></li> <li><a class="dropdown-divider" href="#">4-GET, POST, REQUEST</a></li> <li><a class="dropdown-item" href="../dars_4/uyga_vazifa_4.php">Uyga vazifa-4</a></li> <li><a class="dropdown-divider" href="#">5-SERVER requests</a></li> <li><a class="dropdown-item" href="../dars_5/uyga_vazifa_5.php">Uyga vazifa-5</a></li> <li><a class="dropdown-divider" href="#">6 - PHP Upload files</a></li> <li><a class="dropdown-item" href="../dars_6/uyga_vazifa_6.php">Uyga vazifa-6</a></li> <li><a class="dropdown-divider" href="#">7 - Regular Expressions</a></li> <li><a class="dropdown-item" href="../dars_7/uyga_vazifa_7.php">Uyga vazifa-7</a></li> <li><hr class="dropdown-divider"></li> <li><a class="dropdown-item" href="#">Something else here</a></li> </ul> </li> <li class="nav-item"> <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a> </li> </ul> <form class="d-flex"> <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"> <button class="btn btn-outline-success" type="submit">Search</button> </form> </div> </div> </nav> <!-- /Navbar --> <div class="container-fluid"> <!-- Card --> <?php $li1 = 'Bosh sahifa'; $li2 = 'menu 1'; $li3 = 'menu 2'; $li4 = 'menu 3'; $li5 = 'menu 4'; #region RULES FOR CARD $card1 = 'Misol 1'; $card11 = "Oy raqamlari va nomi"; $card12 = 3; $card2 = 'Misol 2'; $card21 = "Katta va kichigini topuvchi"; $card22 = 50; $card23 = 40; $card24 = 10; $card25 = "a = $card22, b = $card23, c = $card24"; $card3 = 'Misol 3'; $card31 = "Manfiy/musbatini topuvchi"; $card32 = 10; $card33 = -5; $card34 = 1; $card35 = "a = $card32, b = $card33, c = $card34"; $card4 = 'Misol 4'; $card41 = "Tel nomer kodi -> Companiya?"; $card42 = 33; $card5 = 'Misol 5'; $card51 = "'a' - soni musbat/manfiymi?"; $card52 = 10; $card53 = "a = $card52"; $card6 = 'Misol 6'; $card61 = "'a' - sonini 'b' marta chiqarish"; $card62 = 10; $card63 = 3; $card64 = "a = $card52, b = $card63"; $card7 = 'Misol 7'; $card71 = "Maxsulot narxlari"; $card72 = 1; $card73 = 1000; $card74 = 3; $card75 = "1 kg konfet = $card73 so'm"; $card8 = 'Misol 8'; $card81 = "Maxsulot narxlari"; $card82 = 1; $card83 = 1000; $card84 = 0.3; $card85 = "1 kg konfet = $card73 so'm"; $card9 = 'Misol 9'; $card91 = "Karra jadvali"; $card92 = 1; $card93 = 5; $card94 = 10; $card95 = "$card93 - karra-karra"; $card10 = 'Misol 10'; $card101 = "Juft va toq sonlar"; $card102 = 1; $card103 = 11; $card1111 = 'Misol 11'; $card111 = "Heading taglar"; $card112 = 6; $card113 = 1; $card121 = 'Misol 12'; $card122 = "Funcitons"; $cardbt = "To'g'ri"; $cardbf = "Noto'g'ri"; #endregion ?> <section class="bs2"> <div class="container"> <h1 class="display-2">PHP shart amallar</h1> <div class="row"> <div class="col-sm-3"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h3 class="card-title"><?= $card1 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card11 . ':'; ?> </h5> <p class="card-text"> <?= "$card12 - oy qaysi faslga tegishli?"; ?> <br> <?php if ($card12 == 1 || $card12 == 2 || $card12 == 12) { echo "$card12 - oy Qish oyi!"; } elseif ($card12 == 3 || $card12 == 4 || $card12 == 5) { echo "$card12 - oy Bahor oyi!"; } elseif ($card12 == 6 || $card12 == 7 || $card12 == 8) { echo "$card12 - oy Yoz oyi!"; } elseif ($card12 == 9 || $card12 == 10 || $card12 == 11) { echo "$card12 - oy Kuz oyi!"; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> <div class="col-sm-3"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h3 class="card-title"><?= $card2 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card21 . ':'; ?> </h5> <p class="card-text"> <?= $card25; ?> </p> <p class="card-text"> <?= "Qaysi biri eng katta/kichik son?"; ?> <br> <?php if ($card22 < $card23 && $card22 < $card24) { echo "'a' - eng kichik son"; } elseif ($card23 < $card22 && $card23 < $card24) { echo "'b' - eng kichik son"; } elseif ($card24 < $card22 && $card24 < $card23) { echo "'c' - eng kichik son"; } elseif ($card22 > $card23 && $card22 > $card24) { echo "'a' - eng katta son"; } elseif ($card23 > $card22 && $card23 > $card24) { echo "'b' - eng katta son"; } elseif ($card24 > $card22 && $card24 > $card23) { echo "'c' - eng katta son"; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> <div class="col-sm-3"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h3 class="card-title"><?= $card3 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card31 . ':'; ?> </h5> <p class="card-text"> <?= $card35; ?> </p> <p class="card-text"> <?= "Nechta musbat/manfiy sonlar bor?"; ?> <br> <?php if ($card32 < 0 && $card33 < 0 && $card34 <0) { echo "manfiy sonlar: 'a', 'b', 'c'"; } elseif ($card32 > 0 && $card33 > 0 && $card34 > 0) { echo "musbat sonlar: 'a', 'b', 'c'"; } elseif ($card32 < 0 && $card33 > 0 && $card34 > 0) { echo "musbat sonlar: 'b', 'c' <br> manfiy son: 'a'"; } elseif ($card32 > 0 && $card33 < 0 && $card34 > 0) { echo "musbat sonlar: 'a', 'c' <br> manfiy son: 'b'"; } elseif ($card32 > 0 && $card33 > 0 && $card34 < 0) { echo "musbat sonlar: 'a', 'b' <br> manfiy son: 'c'"; } elseif ($card32 > 0 && $card33 < 0 && $card34 < 0) { echo "musbat son: 'a' <br> manfiy sonlar: 'b', 'c'"; } elseif ($card32 < 0 && $card33 > 0 && $card34 < 0) { echo "musbat son: 'b' <br> manfiy sonlar: 'a', 'c'"; } elseif ($card32 < 0 && $card33 < 0 && $card34 > 0) { echo "musbat son: 'c' <br> manfiy sonlar: 'a', 'b'"; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> <div class="col-sm-3"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h3 class="card-title"><?= $card4 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card41 . ':'; ?> </h5> <p class="card-text"> <?= "$card42 kodi - Qaysi companiyaga tegishli?"; ?> <br> <?php switch ($card42) { case $card42 == 90 || $card42 == 91: echo "$card42 kodi - Beelinega tegishli!"; break; case $card42 == 93 || $card42 == 94 || $card42 == 55: echo "$card42 kodi - Ucellga tegishli!"; break; case $card42 == 95 || $card42 == 99: echo "$card42 kodi - Uzmobilega tegishli!"; break; case $card42 == 97 || $card42 == 33: echo "$card42 kodi - USMga tegishli!"; break; default: echo "$card42 - bunday kod bilan boshlanuvchi kompaniya mavjud emas!"; break; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> </div> <div class="row"> <div class="col-sm-3"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h3 class="card-title"><?= $card5 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card51 . ':'; ?> </h5> <p class="card-text"> <?= "$card53"; ?> <br> <?php if ($card52 % 2 == 1) { echo "$card52 - musbat toq son"; } elseif ($card52 % 2 == 0 && $card52 != 0) { echo "$card52 - musbat juft son"; } elseif ($card52 == 0) { echo "$card52 - aniqlanmadi"; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> <div class="col-sm-3"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h3 class="card-title"><?= $card6 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card61 . ':'; ?> </h5> <p class="card-text"> <?= "$card64"; ?> <br> <?php for ($i = 1; $i <= $card63; $i++) { echo $i . ' - '. "$card62; <br>"; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> <div class="col-sm-3"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h3 class="card-title"><?= $card7 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card71 . ':'; ?> </h5> <p class="card-text"> <?= "$card75"; ?> <br> <?php for ($i = 1; $i <= $card74; $i++) { echo $i . ' - '. $card73 * $i . " so'm <br>"; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> <div class="col-sm-3"> <div class="card" style="width: 18rem;"> <div class="card-body"> <h3 class="card-title"><?= $card8 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card81 . ':'; ?> </h5> <p class="card-text"> <?= "$card85"; ?> <br> <?php for ($i = 0.1; $i <= $card84; $i+=0.1) { echo $i.' - '.$card83 * $i ."<br>"; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> </div> <div class="row"> <div class="col-sm-2 cal-9"> <div class="card" style="width: 16rem;"> <div class="card-body"> <h3 class="card-title"><?= $card9 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card91 . ':'; ?> </h5> <p class="card-text"> <?= "$card95"; ?> <br> <?php $nat = 0; for ($i = $card92; $i <= $card94; $i++) { $nat = $card93 * $i; echo $card93 . ' x ' . $i . ' = ' . $nat . "<br>"; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> <div class="col-sm-2 cal-10"> <div class="card" style="width: 16rem;"> <div class="card-body"> <h3 class="card-title"><?= $card10 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card101 . ':'; ?> </h5> <p class="card-text"> <?php for ($i = $card102; $i <= $card103; $i++) { if ($i % 2 == 1) { echo $i . " - soni toq son <br>"; } elseif ($i % 2 == 0) { echo $i . " - soni juft son <br>"; } } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> <div class="col-sm-4"> <div class="card" style="width: 30rem;"> <div class="card-body"> <h3 class="card-title"><?= $card1111 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card111 . ':'; ?> </h5> <p class="card-text"> <?php for ($i = 6; $i >= 1; $i--) { echo "<h$i> - Salom PHP. <h$i>"; } ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> <div class="col-sm-2 cal-12"> <div class="card" style="width: 16rem;"> <div class="card-body"> <h3 class="card-title"><?= $card121 . ':'; ?></h3> <h5 class="card-subtitle mb-2"> <?= $card122 . ':'; ?> </h5> <p class="card-text"> <?php function daraja(int $n, $d) { if (gettype($n) == "string" || gettype($d) == "string") { return "String turidagi ma'lumotlar mavjud"; } else { return pow($n, $d); } } echo daraja(3, 3); ?> </p> <a href="#" class="card-link btn btn-dark"><?= $cardbt; ?> </a> <a href="#" class="card-link btn btn-dark"><?= $cardbf; ?> </a> </div> </div> </div> </div> </div> </div> </section> <!-- /Card --> </div> <!-- Bootstrap JS link --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> </body> </html>
53.070295
218
0.328405
ee475273a06ff118938732b344d5d3d4ce4726cc
130
rb
Ruby
lib/kata/kyu7/binary_addition/binary_addition.rb
Madh93/codewars_rb
57417a206cef28f6f62b4c600c5a9d7572b4251f
[ "MIT" ]
null
null
null
lib/kata/kyu7/binary_addition/binary_addition.rb
Madh93/codewars_rb
57417a206cef28f6f62b4c600c5a9d7572b4251f
[ "MIT" ]
null
null
null
lib/kata/kyu7/binary_addition/binary_addition.rb
Madh93/codewars_rb
57417a206cef28f6f62b4c600c5a9d7572b4251f
[ "MIT" ]
null
null
null
module Kata module Kyu7 class << self def binary_addition(a, b) (a + b).to_s(2) end end end end
10.833333
31
0.523077
b742ad6d6fd4c70b7d107a608f8fa7ce5bb1c65d
11,874
cs
C#
SerilogAnalyzer/SerilogAnalyzer/Resources.Designer.cs
PTW-Freiburg/SerilogAnalyzer
bf62860f502db19bc45fd0f46541f383ef3a4455
[ "Apache-2.0" ]
1
2021-03-31T23:09:40.000Z
2021-03-31T23:09:40.000Z
SerilogAnalyzer/SerilogAnalyzer/Resources.Designer.cs
PTW-Freiburg/SerilogAnalyzer
bf62860f502db19bc45fd0f46541f383ef3a4455
[ "Apache-2.0" ]
null
null
null
SerilogAnalyzer/SerilogAnalyzer/Resources.Designer.cs
PTW-Freiburg/SerilogAnalyzer
bf62860f502db19bc45fd0f46541f383ef3a4455
[ "Apache-2.0" ]
null
null
null
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ namespace SerilogAnalyzer { using System.Reflection; /// <summary> /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> // This class was auto-generated by the StronglyTypedResourceBuilder // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SerilogAnalyzer.Resources", typeof(Resources).GetTypeInfo().Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Overrides the current thread's CurrentUICulture property for all /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Looks up a localized string similar to Checks that MessageTemplates are constant values which is recommended practice. /// </summary> internal static string ConstantMessageTemplateAnalyzerDescription { get { return ResourceManager.GetString("ConstantMessageTemplateAnalyzerDescription", resourceCulture); } } /// <summary> /// Looks up a localized string similar to MessageTemplate argument {0} is not constant. /// </summary> internal static string ConstantMessageTemplateAnalyzerMessageFormat { get { return ResourceManager.GetString("ConstantMessageTemplateAnalyzerMessageFormat", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Constant MessageTemplate verifier. /// </summary> internal static string ConstantMessageTemplateAnalyzerTitle { get { return ResourceManager.GetString("ConstantMessageTemplateAnalyzerTitle", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Checks that properties that are passed anonymous objects use the destructuring hint. /// </summary> internal static string DestructureAnonymousObjectsAnalyzerDescription { get { return ResourceManager.GetString("DestructureAnonymousObjectsAnalyzerDescription", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Property &apos;{0}&apos; should use destructuring because the argument is an anonymous object. /// </summary> internal static string DestructureAnonymousObjectsAnalyzerMessageFormat { get { return ResourceManager.GetString("DestructureAnonymousObjectsAnalyzerMessageFormat", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Anonymous objects use destructuring hint verifier. /// </summary> internal static string DestructureAnonymousObjectsAnalyzerTitle { get { return ResourceManager.GetString("DestructureAnonymousObjectsAnalyzerTitle", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Exceptions should be passed in the Exception Parameter. /// </summary> internal static string ExceptionAnalyzerDescription { get { return ResourceManager.GetString("ExceptionAnalyzerDescription", resourceCulture); } } /// <summary> /// Looks up a localized string similar to The exception &apos;{0}&apos; should be passed as first argument. /// </summary> internal static string ExceptionAnalyzerMessageFormat { get { return ResourceManager.GetString("ExceptionAnalyzerMessageFormat", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Exception not passed as first argument. /// </summary> internal static string ExceptionAnalyzerTitle { get { return ResourceManager.GetString("ExceptionAnalyzerTitle", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Checks that all property names in a MessageTemplates are Pascal Case. /// </summary> internal static string PascalPropertyNameAnalyzerDescription { get { return ResourceManager.GetString("PascalPropertyNameAnalyzerDescription", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Property name &apos;{0}&apos; should be pascal case. /// </summary> internal static string PascalPropertyNameAnalyzerMessageFormat { get { return ResourceManager.GetString("PascalPropertyNameAnalyzerMessageFormat", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Pascal Property name verifier. /// </summary> internal static string PascalPropertyNameAnalyzerTitle { get { return ResourceManager.GetString("PascalPropertyNameAnalyzerTitle", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Checks wether properties and arguments match up. /// </summary> internal static string PropertyBindingAnalyzerDescription { get { return ResourceManager.GetString("PropertyBindingAnalyzerDescription", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Error while binding properties: {0}. /// </summary> internal static string PropertyBindingAnalyzerMessageFormat { get { return ResourceManager.GetString("PropertyBindingAnalyzerMessageFormat", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Property binding verifier. /// </summary> internal static string PropertyBindingAnalyzerTitle { get { return ResourceManager.GetString("PropertyBindingAnalyzerTitle", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Checks for errors in the MessageTemplate. /// </summary> internal static string TemplateAnalyzerDescription { get { return ResourceManager.GetString("TemplateAnalyzerDescription", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Error while parsing MessageTemplate: {0}. /// </summary> internal static string TemplateAnalyzerMessageFormat { get { return ResourceManager.GetString("TemplateAnalyzerMessageFormat", resourceCulture); } } /// <summary> /// Looks up a localized string similar to MessageTemplate verifier. /// </summary> internal static string TemplateAnalyzerTitle { get { return ResourceManager.GetString("TemplateAnalyzerTitle", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Checks that all property names in a MessageTemplates are unique. /// </summary> internal static string UniquePropertyNameAnalyzerDescription { get { return ResourceManager.GetString("UniquePropertyNameAnalyzerDescription", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Property name &apos;{0}&apos; is not unique in this MessageTemplate. /// </summary> internal static string UniquePropertyNameAnalyzerMessageFormat { get { return ResourceManager.GetString("UniquePropertyNameAnalyzerMessageFormat", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Unique Property name verifier. /// </summary> internal static string UniquePropertyNameAnalyzerTitle { get { return ResourceManager.GetString("UniquePropertyNameAnalyzerTitle", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Checks that loggers are initialized with the current class as ForContext. /// </summary> internal static string UseCorrectContextualLoggerAnalyzerDescription { get { return ResourceManager.GetString("UseCorrectContextualLoggerAnalyzerDescription", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Logger &apos;{0}&apos; should use {1} instead of {2}. /// </summary> internal static string UseCorrectContextualLoggerAnalyzerMessageFormat { get { return ResourceManager.GetString("UseCorrectContextualLoggerAnalyzerMessageFormat", resourceCulture); } } /// <summary> /// Looks up a localized string similar to Contextual loggers use the correct context verifier. /// </summary> internal static string UseCorrectContextualLoggerAnalyzerTitle { get { return ResourceManager.GetString("UseCorrectContextualLoggerAnalyzerTitle", resourceCulture); } } } }
42.256228
184
0.606872
49917025b5391af044654bc61bf168869c1ed2e5
926
py
Python
core/admin.py
hackforthesea/hackforthesea.tech
33b7522c13d87b26a39e9dfbdcad4067b44cda06
[ "BSD-3-Clause" ]
1
2018-09-17T04:35:06.000Z
2018-09-17T04:35:06.000Z
core/admin.py
hackforthesea/hackforthesea.tech
33b7522c13d87b26a39e9dfbdcad4067b44cda06
[ "BSD-3-Clause" ]
5
2021-04-08T18:28:06.000Z
2022-02-10T08:24:03.000Z
core/admin.py
hackforthesea/hackforthesea.tech
33b7522c13d87b26a39e9dfbdcad4067b44cda06
[ "BSD-3-Clause" ]
1
2018-09-17T04:35:08.000Z
2018-09-17T04:35:08.000Z
from django.contrib import admin # from .models import Sponsor, CommunityPartner, Location, Team, Participant, \ # Submission, FrequentlyAskedQuestion # class SponsorAdmin(admin.ModelAdmin): # pass # class CommunityPartnerAdmin(admin.ModelAdmin): # pass # class LocationAdmin(admin.ModelAdmin): # pass # class SubmissionAdmin(admin.ModelAdmin): # pass # class TeamAdmin(admin.ModelAdmin): # pass # class ParticipantAdmin(admin.ModelAdmin): # pass # class FrequentlyAskedQuestionAdmin(admin.ModelAdmin): # pass # admin.site.register(Sponsor,SponsorAdmin) # admin.site.register(CommunityPartner,CommunityPartnerAdmin) # admin.site.register(Location,LocationAdmin) # admin.site.register(Participant,ParticipantAdmin) # admin.site.register(Team,TeamAdmin) # admin.site.register(Submission,SubmissionAdmin) # admin.site.register(FrequentlyAskedQuestion,FrequentlyAskedQuestionAdmin)
22.585366
79
0.774298
e585f29632c9bd441764baff58d9f5df3de40c3b
7,619
lua
Lua
src/lua-game/configs/animation_config.lua
oprochazka/spiderAgonyRpg
8c4f7ed9255ea381d6b802f090b56f642d176dd2
[ "Apache-2.0" ]
null
null
null
src/lua-game/configs/animation_config.lua
oprochazka/spiderAgonyRpg
8c4f7ed9255ea381d6b802f090b56f642d176dd2
[ "Apache-2.0" ]
null
null
null
src/lua-game/configs/animation_config.lua
oprochazka/spiderAgonyRpg
8c4f7ed9255ea381d6b802f090b56f642d176dd2
[ "Apache-2.0" ]
1
2021-06-21T23:08:30.000Z
2021-06-21T23:08:30.000Z
_ANIMATION_HERO = { -- ["move_x"] = -15, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_HERO .. "model_move.png", ["clipx"] = 8, ["clipy"] = 8, }, ["fight_sprite"] = { ["path"] = PATH_HERO .. "model_fight.png", ["clipx"] = 6, ["clipy"] = 8, }, }, ["sounds"] = { ["move_sound"] = { ["path"] = PATH_SOUNDS .. "move1.ogg" }, ["spell_sound"] = { ["path"] = PATH_SOUNDS .. "scratch.wav" } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {2,3,4,5,6,7}}, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["attack"] = { ["sprite"] = "fight_sprite", ["frames"] = {0,1,2,3,4,5}, ["sound"] = { ["sound"] = "move_sound", ["sound_start"] = {1}}}, ["spell"] = { ["sprite"] = "fight_sprite", ["frames"] = {0,1,2,3,4,5}, ["sound"] = { ["sound"] = "spell_sound", ["sound_start"] = {1}}}, } } _ANIMATION_TUNIC = { ["move_x"] = 12, ["move_y"] = 24, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_HERO .. "tunic_comprim.png", ["clipx"] = 8, ["clipy"] = 8, }, ["fight_sprite"] = { ["path"] = PATH_HERO .. "tunic_fight.png", ["clipx"] = 6, ["clipy"] = 8, }, }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {2,3,4,5,6,7} }, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["attack"] = { ["sprite"] = "fight_sprite", ["frames"] = {0,1,2,3,4,5} }, } } _ANIMATION_TROUSERS = { ["move_x"] = 19, ["move_y"] = 40, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_HERO .. "trousers_comprim.png", ["clipx"] = 8, ["clipy"] = 8, }, ["fight_sprite"] = { ["path"] = PATH_HERO .. "trousers_fight.png", ["clipx"] = 6, ["clipy"] = 8, } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {2,3,4,5,6,7} }, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["attack"] = { ["sprite"] = "fight_sprite", ["frames"] = {0,1,2,3,4,5} }, } } _ANIMATION_HELMET = { ["move_x"] = 22, ["move_y"] = 10, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_HERO .. "helmet.png", ["clipx"] = 8, ["clipy"] = 8, }, ["fight_sprite"] = { ["path"] = PATH_HERO .. "helmet_fight.png", ["clipx"] = 6, ["clipy"] = 8, } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {2,3,4,5,6,7} }, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["attack"] = { ["sprite"] = "fight_sprite", ["frames"] = {0,1,2,3,4,5} }, } } _ANIMATION_HAIR = { ["move_x"] = 37-15, ["move_y"] = 1, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_HERO .. "hair_comprim.png", ["clipx"] = 8, ["clipy"] = 8, } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {2,3,4,5,6,7} }, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}} } } _ANIMATION_BOOTS = { ["move_x"] = 0, ["move_y"] = 45, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_HERO .. "boots_comprim.png", ["clipx"] = 8, ["clipy"] = 8, }, ["fight_sprite"] = { ["path"] = PATH_HERO .. "boots_fight.png", ["clipx"] = 6, ["clipy"] = 8, } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {2,3,4,5,6,7} }, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["attack"] = { ["sprite"] = "fight_sprite", ["frames"] = {0,1,2,3,4,5} }, } } _ANIMATION_SWORD = { ["move_x"] = -33, ["move_y"] = -3, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_HERO .. "sword_comprim.png", ["clipx"] = 8, ["clipy"] = 8, }, ["fight_sprite"] = { ["path"] = PATH_HERO .. "sword_fight.png", ["clipx"] = 6, ["clipy"] = 8, } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {2,3,4,5,6,7} }, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["attack"] = { ["sprite"] = "fight_sprite", ["frames"] = {0,1,2,3,4,5} }, } } _BINDING_EQUIPMENT = { {"model","trousers","boots","tunic","hair","hat","right_gloves","left_gloves", "right_hand","left_hand"}, {"right_gloves","right_hand","model","trousers","boots","tunic","hair","hat", "left_hand","left_gloves"}, {"right_gloves","right_hand","model","trousers","boots","tunic","hair","hat", "left_hand","left_gloves"}, {"right_gloves","right_hand","model","trousers","boots","tunic","hair","hat", "left_hand","left_gloves"}, {"left_hand","right_hand","right_gloves","left_gloves","model","trousers","boots", "tunic","hair","hat"}, {"left_gloves","left_hand","model","trousers","boots","tunic","hair","hat", "right_hand","right_gloves"}, {"left_gloves","left_hand","model","trousers","boots","tunic","hair","hat", "right_hand","right_gloves"}, {"left_gloves","left_hand","model","trousers","boots","tunic","hair","hat", "right_hand","right_gloves"}, } _ANIMATION_AMAZON = { ["move_x"] = -15, ["move_y"] = 0, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_SPRITES .. "amazon.png", ["clipx"] = 8, ["clipy"] = 8, } }, ["sounds"] = { ["move_sound"] = { ["path"] = PATH_SOUNDS .. "scratch.wav" } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {2,3,4,5,6,7}, ["sound"] = { ["sound"] = "move_sound", ["sound_start"] = {1}}, }, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}} } } _ANIMATION_SPIDERMUT = { ["move_x"] = -50, ["move_y"] = 50, ["matricies_collision"] = 2, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_SPRITES .. "spidermut.png", ["clipx"] = 11, ["clipy"] = 8, } }, ["sounds"] = { ["move_sound"] = { ["path"] = PATH_SOUNDS .. "scratch.wav" } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {1,2,3,4,5}, }, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["attack"] = { ["sprite"] = "move_sprite", ["frames"] = {6,7,8,9,10}}, } } _ANIMATION_SPIDER = { ["move_x"] = -30, ["move_y"] = 10, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_SPRITES .. "spider_test.png", ["clipx"] = 12, ["clipy"] = 8, } }, ["sounds"] = { ["move_sound"] = { ["path"] = PATH_SOUNDS .. "scratch.wav" } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {1,2,3,4,5,6,7}}, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["attack"] = { ["sprite"] = "move_sprite", ["frames"] = {7,8,9,10,11}}, } } _ANIMATION_FIREBALL = { ["move_x"] = 0, ["move_y"] = -40, ["sprites"] = { ["move_sprite"] = { ["path"] = PATH_SPRITES .. "fireball.png", ["clipx"] = 1, ["clipy"] = 8, } }, ["sounds"] = { ["move_sound"] = { ["path"] = PATH_SOUNDS .. "scratch.wav" } }, ["animations"] = { ["move"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["stay"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, ["attack"] = { ["sprite"] = "move_sprite", ["frames"] = {0}}, } }
20.931319
85
0.443234
e06042848f25c86013aeb481a4c46ece1d0d1048
2,448
go
Go
formjson_test.go
boonep/go-json-rest-middleware-formjson
e265010182a05b57ecac48a92cf0b6c742c23a36
[ "MIT" ]
6
2016-03-17T16:24:26.000Z
2017-06-12T03:48:55.000Z
formjson_test.go
boonep/go-json-rest-middleware-formjson
e265010182a05b57ecac48a92cf0b6c742c23a36
[ "MIT" ]
null
null
null
formjson_test.go
boonep/go-json-rest-middleware-formjson
e265010182a05b57ecac48a92cf0b6c742c23a36
[ "MIT" ]
1
2020-03-09T19:40:15.000Z
2020-03-09T19:40:15.000Z
package formjson import ( "bytes" "net/http" "net/url" "strconv" "testing" "github.com/ant0ine/go-json-rest/rest" "github.com/ant0ine/go-json-rest/rest/test" ) type JSON map[string]interface{} func simpleGetEndpoint(w rest.ResponseWriter, r *rest.Request) { body := map[string]interface{}{ "status": "success", } w.WriteJson(body) } func simplePostEndpoint(w rest.ResponseWriter, r *rest.Request) { var body map[string]interface{} r.DecodeJsonPayload(&body) w.WriteJson(body) } func NewSimpleAPI(mw *MiddleWare) http.Handler { api := rest.NewApi() api.Use(mw) router, _ := rest.MakeRouter( rest.Post("/", simplePostEndpoint), rest.Get("/", simpleGetEndpoint), ) api.SetApp(router) return api.MakeHandler() } func TestPostValidFormData(t *testing.T) { handler := NewSimpleAPI(&MiddleWare{}) data := url.Values{} data.Set("name", "foo") data.Add("surname", "bar") r, _ := http.NewRequest("POST", "http://localhost/", bytes.NewBufferString(data.Encode())) // <-- URL-encoded payload r.Header.Add("Content-Type", "application/x-www-form-urlencoded") r.Header.Add("Content-Length", strconv.Itoa(len(data.Encode()))) recordedPost := test.RunRequest(t, handler, r) recordedPost.CodeIs(http.StatusOK) recordedPost.BodyIs(`{"name":"foo","surname":"bar"}`) } func TestPostInvalidFormData(t *testing.T) { handler := NewSimpleAPI(&MiddleWare{}) data := "mal&formed" r, _ := http.NewRequest("POST", "http://localhost/", bytes.NewBufferString(data)) // <-- URL-encoded payload r.Header.Add("Content-Type", "application/x-www-form-urlencoded") r.Header.Add("Content-Length", strconv.Itoa(len(data))) recordedPost := test.RunRequest(t, handler, r) recordedPost.CodeIs(http.StatusInternalServerError) recordedPost.BodyIs(`{"Error":"Error Converting Form Data"}`) } func TestGet(t *testing.T) { handler := NewSimpleAPI(&MiddleWare{}) req := test.MakeSimpleRequest("GET", "http://localhost/", nil) recorded := test.RunRequest(t, handler, req) recorded.CodeIs(http.StatusOK) recorded.BodyIs(`{"status":"success"}`) } func TestPostJSON(t *testing.T) { handler := NewSimpleAPI(&MiddleWare{}) simplePostData := map[string]interface{}{ "john": "doe", "age": 30, } postRequest := test.MakeSimpleRequest("POST", "https://localhost/", simplePostData) recordedPost := test.RunRequest(t, handler, postRequest) recordedPost.CodeIs(http.StatusOK) recordedPost.BodyIs(`{"age":30,"john":"doe"}`) }
25.5
118
0.704248
38d7dc88e9a77cba1ca37cc8be219374a1f76933
11,244
php
PHP
application/controllers/inventarisasi_sungaiqq.php
Ardiyan16/sisungaisolo
cfc063b4d4244098dc2fcebeacb7642ba12afe8f
[ "MIT" ]
null
null
null
application/controllers/inventarisasi_sungaiqq.php
Ardiyan16/sisungaisolo
cfc063b4d4244098dc2fcebeacb7642ba12afe8f
[ "MIT" ]
null
null
null
application/controllers/inventarisasi_sungaiqq.php
Ardiyan16/sisungaisolo
cfc063b4d4244098dc2fcebeacb7642ba12afe8f
[ "MIT" ]
null
null
null
<?php class Inventarisasi_sungai extends CI_Controller { function __construct() { parent::__construct(); $this->load->library(array('ion_auth')); if (!$this->ion_auth->logged_in()) { redirect('/auth', 'refresh'); } } function index() { $this->load->view('admin/inv_sungai'); } function get_inv_sungai() { $tb_inv_sungai = new Tb_inventarisasi_sungai(); $data = $tb_inv_sungai->get_json(); echo json_encode($data); } //function edit($id){ // $tb_inv_sungai=new Tb_inventarisasi_sungai(); // $tb_inv_sungai->where('id_inventarisasi_sungai',$id); // $data['inventarisasi_sungai']=$tb_inv_sungai->get(); // $this->load->view('admin/edit_inv_sungai',$data); //} function view_tambah() { $this->load->view('admin/tambah_inv_sungai'); } function simpan_data() { $tb_inv_sungai = new Tb_inventarisasi_sungai(); $tb_inv_sungai->nama_sungai = $this->input->post('nama_sungai'); $tb_inv_sungai->no_patok = $this->input->post('no_patok'); $tb_inv_sungai->desa = $this->input->post('desa'); $tb_inv_sungai->kecamatan = $this->input->post('kecamatan'); $tb_inv_sungai->kabupaten = $this->input->post('kabupaten'); $tb_inv_sungai->sempadan_kiri = $this->input->post('sempadan_kiri'); $tb_inv_sungai->lereng_luar_kiri = $this->input->post('lereng_luar_kiri'); $tb_inv_sungai->jalan_inspeksi_kiri = $this->input->post('jalan_inspeksi_kiri'); $tb_inv_sungai->lereng_dalam_kiri = $this->input->post('lereng_dalam_kiri'); $tb_inv_sungai->dasar_sungai = $this->input->post('dasar_sungai'); $tb_inv_sungai->lereng_dalam_kanan = $this->input->post('lereng_luar_kanan'); $tb_inv_sungai->jalan_inspeksi_kanan = $this->input->post('jalan_inspeksi_kanan'); $tb_inv_sungai->lereng_luar_kanan = $this->input->post('lereng_luar_kanan'); $tb_inv_sungai->sempadan_kanan = $this->input->post('sempadan_kanan'); $tb_inv_sungai->pekerjaan = $this->input->post('pekerjaan'); $tb_inv_sungai->sket = basename($_FILES["sket"]["name"]); if ($this->upload_sket('sket')) { $tb_inv_sungai->save(); $a = $tb_inv_sungai->select_max('id_inventarisasi_sungai')->get(); $tb_gambar_inv_sungai = new Tb_gambar_inventarisasi_sungai(); $foto = $this->multiple_upload_foto(); for ($x = 0; $x < count($foto); $x++) { $tb_gambar_inv_sungai->id_inventarisasi_sungai = $a->id_inventarisasi_sungai; $tb_gambar_inv_sungai->gambar = $foto[$x]; $tb_gambar_inv_sungai->save(); } $this->session->set_flashdata('item', '<div class="alert alert-success" role="alert">Data berhasil ditambahkan</div>'); redirect('inventarisasi_sungai'); } else{ $this->session->set_flashdata('item', '<div class="alert alert-warning" role="alert">'.'Gambar Sket Terlalu Besar, max 5 MB dan format file sket harus jpg|png|gif|bmp'.'</div>'); redirect('inventarisasi_sungai/view_tambah'); } } function upload_sket($nama_post) { $valid_formats = array("jpg", "png", "gif", "bmp", "PNG", "JPG", "jpeg", "JPEG"); $max_file_size = 1024 * 5000; //5 MB $path = "../image/sket/"; // Upload directory $target_file = $path . basename($_FILES["$nama_post"]["name"]); if ($_FILES["$nama_post"]["error"] == 0) { if ($_FILES["$nama_post"]["size"] > $max_file_size) { $message['pesan'] = "Ukuran Gambar Terlalu Besar, max 5 MB"; } elseif (!in_array(pathinfo($_FILES["$nama_post"]["name"], PATHINFO_EXTENSION), $valid_formats)) { $message['pesan'] = "Format file tidak diizinkan, format harus jpg/png/gif/bmp/jpeg"; } else { if (move_uploaded_file($_FILES["$nama_post"]["tmp_name"], $target_file)) { return TRUE; } } } } function multiple_upload_foto() { $valid_formats = array("jpg", "png", "gif", "bmp", "PNG", "JPG", "jpeg", "JPEG"); $max_file_size = 1024 * 5000; //5 MB $path = "../image/"; // Upload directory $message['pesan'] = ""; $i = 0; // Loop $_FILES to exeicute all files foreach ($_FILES['foto']['name'] as $f => $name) { if ($_FILES['foto']['error'][$f] == 4) { break; // stop file if any error found } if ($_FILES['foto']['error'][$f] == 0) { $target_file = $path . basename($_FILES["foto"]["name"][$f]); $nama_file[$i] = basename($_FILES["foto"]["name"][$f]); if ($_FILES['foto']['size'][$f] > $max_file_size) { $message['pesan'] .= "Ukuran $name Terlalu Besar, max 5 MB\n"; continue; } elseif (!in_array(pathinfo($name, PATHINFO_EXTENSION), $valid_formats)) { $message['pesan'] .= "$name format tak sesuai, format file harus jpg/png/gif/bmp \n"; continue; } else { if (!move_uploaded_file($_FILES["foto"]["tmp_name"][$f], $target_file)) { return FALSE; } } } $i++; } return $nama_file; } function view_edit($id){ $tb_Inventarisasi_Sungai=new Tb_inventarisasi_sungai(); $tb_Inventarisasi_Sungai->where('id_inventarisasi_sungai',$id); $data['inv_sungai']=$tb_Inventarisasi_Sungai->get(); $tb_gambar_inv_sungai = new Tb_gambar_inventarisasi_sungai(); $tb_gambar_inv_sungai->where('id_inventarisasi_sungai',$id); $tb_gambar_inv_sungai->get(); $i = 0; foreach($tb_gambar_inv_sungai as $a) { $data["gambar"][$i]= $a->gambar; $i++; } //echo empty($data['gambar1']); $this->load->view('admin/edit_inv_sungai',$data); } function simpan_edit() { if(basename($_FILES["sket"]["name"]) == NULL) { $sket = $this->input->post('file_sket'); $kondisiUploadSket = FALSE; } else { $file_lama = $this->input->post('file_sket'); $sket = basename($_FILES["sket"]["name"]); $kondisiUploadSket = $this->upload_sket('sket'); unlink("../../image/sket/$file_lama"); } $foto = $this->multiple_upload_foto(); echo $kondisiUploadSket; echo $sket; $update = array( 'nama_sungai' => $this->input->post('nama_sungai'), 'no_patok' => $this->input->post('no_patok'), 'desa' => $this->input->post('desa'), 'kecamatan' => $this->input->post('kecamatan'), 'kabupaten' => $this->input->post('kabupaten'), 'sket' => $sket, 'sempadan_kiri' => $this->input->post('sempadan_kiri'), 'lereng_luar_kiri' => $this->input->post('lereng_luar_kiri'), 'jalan_inspeksi_kiri' => $this->input->post('jalan_inspeksi_kiri'), 'lereng_dalam_kiri' => $this->input->post('lereng_dalam_kiri'), 'dasar_sungai' => $this->input->post('dasar_sungai'), 'lereng_dalam_kanan' => $this->input->post('lereng_dalam_kanan'), 'jalan_inspeksi_kanan' => $this->input->post('jalan_inspeksi_kanan'), 'lereng_luar_kanan' => $this->input->post('lereng_luar_kanan'), 'sempadan_kanan' => $this->input->post('sempadan_kanan'), 'pekerjaan' => $this->input->post('pekerjaan') ); $tb_Inventarisasi_Sungai=new Tb_inventarisasi_sungai(); $tb_Inventarisasi_Sungai->where('id_inventarisasi_sungai',$this->input->post('id_inv_sungai')); $kondisiUpdate = $tb_Inventarisasi_Sungai->update($update); if(!empty($foto)) { $tb_gambar_inv_sungai = new Tb_gambar_inventarisasi_sungai(); for ($x = 0; $x < count($foto); $x++) { $tb_gambar_inv_sungai->id_inventarisasi_sungai =$this->input->post('id_inv_sungai'); $tb_gambar_inv_sungai->gambar = $foto[$x]; $tb_gambar_inv_sungai->save(); } } if($kondisiUpdate) { $this->session->set_flashdata('item', '<div class="alert alert-success" role="alert">Data berhasil diubah</div>'); redirect('inventarisasi_sungai/view_edit/' . $this->input->post('id_inv_sungai')); } } function delete($id_inventarisasi_sungai=null){ $tb_inv_sungai=new Tb_inventarisasi_sungai(); $a = $tb_inv_sungai->delete($id_inventarisasi_sungai); $tb_gambar = new Tb_gambar_inventarisasi_sungai(); $b = $tb_gambar->delete($id_inventarisasi_sungai); if($a && $b) { $this->session->set_flashdata('item', '<div class="alert alert-success" role="alert">Data berhasil dihapus</div>'); redirect('Inventarisasi_sungai'); } } function delete_sket($id_inventarisasi_sungai = null, $sket = null, $foto = null) { $path = "../image/sket/$foto"; $tb_inv_sungai = new Tb_inventarisasi_sungai(); $tb_inv_sungai->where('id_inventarisasi_sungai', $id_inventarisasi_sungai); $tb_inv_sungai->update($sket, ''); unlink($path); $this->session->set_flashdata('item', '<div class="alert alert-success" role="alert">Foto berhasil dihapus</div>'); //redirect('inventarisasi_sungai/edit/'.$id_inventarisasi_sungai); } function delete_photo($id_gambar_inventarisasi_sungai = null, $foto = null, $foto = null) { $path = "../../image/$foto"; $bangunan = new Tb_gambar_inventarisasi_sungai(); $bangunan->where('id_gambar_inventarisasi_sungai', $id_gambar_inventarisasi_sungai); $bangunan->update($foto, ''); unlink($path); $this->session->set_flashdata('item', '<div class="alert alert-success" role="alert">Foto berhasil dihapus</div>'); redirect('inventarisasi_sungai/edit/'.$id_gambar_inventarisasi_sungai); } function delete_foto($id_invent_sungai = null,$nama_foto = null) { $path = "../image/$nama_foto"; $foto = new Tb_gambar_inventarisasi_sungai(); if($foto->delete($id_invent_sungai)) { unlink($path); $this->session->set_flashdata('item', '<div class="alert alert-info" role="alert">Foto berhasil dihapus</div>'); redirect('inventarisasi_sungai/view_edit/'.$id_invent_sungai); } else { $this->session->set_flashdata('item', '<div class="alert alert-danger" role="alert">Foto gagal dihapus</div>'); redirect('inventarisasi_sungai/view_edit/'.$id_invent_sungai); } } } ?>
45.156627
191
0.564479
7df57e26176676a5997ad211bf864af197ac976d
355
lua
Lua
resources/[esx]/[base]/esx_barbershop/locales/fr.lua
tracid56/Bristols
307e9ae5fd46747b924d41b480ce539bd7c8b714
[ "MIT" ]
null
null
null
resources/[esx]/[base]/esx_barbershop/locales/fr.lua
tracid56/Bristols
307e9ae5fd46747b924d41b480ce539bd7c8b714
[ "MIT" ]
null
null
null
resources/[esx]/[base]/esx_barbershop/locales/fr.lua
tracid56/Bristols
307e9ae5fd46747b924d41b480ce539bd7c8b714
[ "MIT" ]
null
null
null
Locales['fr'] = { ['valid_purchase'] = 'valider cet achat ?', ['yes'] = 'oui', ['no'] = 'non', ['not_enough_money'] = 'vous n\'avez pas assez d\'argent sur vous ni sur votre carte bancaire', ['press_access'] = 'Appuyez sur ~INPUT_CONTEXT~ pour accéder au menu', ['barber_blip'] = 'barbier', ['you_paid'] = 'vous avez payé ', }
35.5
99
0.588732
7f78e0ff17d5a030d15d64a08343d7fbb0ba7dfc
8,371
php
PHP
app/Http/Controllers/Web/WebController.php
KanuPeace/transitOption
ef09570eb6a6385e937d8fef5b34329910dd1a35
[ "MIT" ]
null
null
null
app/Http/Controllers/Web/WebController.php
KanuPeace/transitOption
ef09570eb6a6385e937d8fef5b34329910dd1a35
[ "MIT" ]
null
null
null
app/Http/Controllers/Web/WebController.php
KanuPeace/transitOption
ef09570eb6a6385e937d8fef5b34329910dd1a35
[ "MIT" ]
null
null
null
<?php namespace App\Http\Controllers\Web; use App\Http\Controllers\Controller; use App\Models\VehicleImage; use Illuminate\Http\Request; class WebController extends Controller { public function index(){ $sliderImages = VehicleImage::whereHas("vehicle")->inRandomOrder()->limit(5)->get(); return view('web.pages.index' , compact("sliderImages")); } public function aboutUs(){ return view('web.pages.about_us'); } public function contactUs(){ return view('web.pages.contact_us'); } public function portfolio(){ return view('web.pages.our_portfolio'); } public function read_file($file){ return getFileFromPrivateStorage(readFileUrl("descrypt" , $file)); } public function sendContact(Request $request){ if($request->isMethod('post')){ $data = $request->all(); $this->validate($request, [ 'name' => 'required', 'email' => 'required|email', 'phone' => 'required', 'subject' => 'required', 'message' => 'required' ]); $data = array( "name" => $request->name, "email" => $request->email, "phone" => $request->phone, "subject" => $request->subject, "bodyMessage" => $request->message ); $email = 'contact@wusobtech.com'; // Send An Email Mail::to($email)->send(new ContactFormMail($data)); toastr()->success('Mail Sent Successfully!.'); return redirect()->back(); } } public function services(){ return view('web.pages.services'); } public function our_blog(Request $request){ $search_keywords = $request->keywords; $category_id = $request->category_id; // $categories = BlogCategory::orderby('title')->limit(5)->inRandomOrder()->get(); // $recent_posts = Blog::orderby('created_at' , 'desc')->limit(5)->inRandomOrder()->get(); // $builder = Blog::where('status' , 1)->orderBy('created_at' , 'desc'); // if(empty($category_id)){ // $posts = $builder->where('title', 'like' , '%'.$search_keywords.'%')->paginate(20); // } // else{ // $posts = $builder->where('title', 'like' , '%'.$search_keywords.'%') // ->where('post_category_id' , $category_id )->paginate(20); // $category_id = BlogCategory::find($category_id); // } // return view('web.pages.blog' , compact('posts' , 'categories' , 'search_keywords' , 'recent_posts' )); return view('web.pages.blog'); } public function blog_info($id){ $post = Blog::findorfail($id); $post['social_links'] = $this->post_share_links($post); $categories = BlogCategory::orderby('title')->limit(5)->inRandomOrder()->get(); $recent_posts = Blog::orderby('created_at' , 'desc')->limit(5)->inRandomOrder()->get(); $comments = BlogComments::where('blog_id',$post->id)->where('status',1)->orderby('id','desc')->get(); return view('web.pages.blog_info' , compact('post' , 'categories' , 'recent_posts', 'comments')); } public function blog_category_posts(Request $request , $id){ $category = $this->PostCategory->find($id); if(!empty($category)){ $request['category_id'] = $id; return $this->blogsView($request); } } public function blogsComment(Request $request){ $validator = Validator::make($request->all(),[ 'name' => 'required|string', 'email' => 'nullable|string', 'website' => 'nullable|string', 'blog_id' => 'required|string', 'comment' => 'required|string', ]); if($validator->fails()){ return response()->json([ 'success'=> false , 'msg' => 'Comment could not be added!', 'data' => null, ]); } else{ $data = $validator->validated(); $comment = BlogComments::create($data); return response()->json([ 'success'=> true , 'msg' => 'Comment added successfully!', 'data' => [ 'avatar' => $comment->getAvatar() , 'name' => $comment->name, 'date' => date('d M Y h:i:A',strtotime($comment->created_at)), 'comment' => $comment->comment, ], ]); } } public function share_post($id) { $post = Post::findorfail($id); return view('web.pages.share',compact('post')); } public function make_comment(Request $request){ //dd($request->all()); $data = $request->validate([ 'blog_id' => 'required', 'name' => 'required|string', 'email' => 'required|string', 'body' => 'required|string', ]); $data['status'] = 1; $comment = BlogComments::create($data); $comment['post_date'] = date('d/m/y',strtotime($comment->created_at)); $comment['name'] = $comment->name; $comment['email'] = $comment->email; $comment['body'] = $comment->body; return response()->json($comment); } function post_share_links($post){ $title = $post->title; $url = route('blog_info',['id'=>$post->id,'slug'=>$post->slug]); $message = $post->message; return [ [ 'type' => 'Facebook', 'label' => "Like", 'logo' => "fa fa-facebook-f", 'shareUrl' => "https://facebook.com/sharer/sharer.php?u=".$url."", 'countUrl' => "https://graph.facebook.com/?id={url}", 'shareIn'=> "_blank", 'color' => '#3b5998', ], [ 'type' => 'Twitter', 'label' => "Tweet", 'logo' => "fa fa-twitter", 'shareUrl' => "https://twitter.com/share?url=".$url."&text=".$title."&via=twitter&hashtags=wusobtech", 'countUrl' => "", 'shareIn'=> "_blank", 'color' => '#3490F3', ], // [ // 'type' => 'Instagram', // 'label'=> "Instagram", // 'logo'=> "fa fa-instagram", // 'shareUrl'=> "https://www.instagram.com/share?url=".$url."", // 'countUrl'=> "", // 'shareIn'=> "_blank", // 'color' => '#00aced', // ], [ 'type' => 'LinkedIn', 'label' => "Share", 'logo' => "fa fa-linkedin", 'shareUrl' => "https://www.linkedin.com/shareArticle?mini=true&url=".$url."", 'countUrl' => "https://www.linkedin.com/countserv/count/share?format=jsonp&url=".$url."&callback=?", 'shareIn'=> "_blank", 'color' => '#007bb6', ], [ 'type' => 'Whatsapp', 'label' => "WhatsApp", 'logo' => "fa fa-whatsapp", 'shareUrl' => "whatsapp://send?text=".$url." ".$title."", 'countUrl' => "", 'shareIn' => "self", 'color' => 'green', ], ]; } public function subscribe(Request $request){ $data = $request->validate([ 'email' => 'required|email' ]); $check = Subscriber::where('email',$data['email'])->count(); if($check > 0){ return response()->json(['msg' => 'You already subscribed.Thanks!']); } Subscriber::create($data); Mail::to($data['email'])->send(new NewsLetter($data)); return response()->json(['msg' => 'Subscribed successfully!']); } public function unsubscribe($email){ $find_email = Subscriber::where('email',$email)->first(); if(empty($find_email)){ $msg = 'Sorry, your email wasn`t found on our list! '; } $find_email->delete(); $msg = 'You have successfully unsubscribed from our mailing list!'; } }
33.754032
118
0.485725
40428bc8be3e86f177af9f72fb5a23d72aa248cf
758
rb
Ruby
spec/influxdb_spec.rb
PTC-Global/sensu-extensions-influxdb
96f0c6e58473829c71b92b65a3729b5080f7bb95
[ "Apache-2.0" ]
4
2017-10-11T20:59:01.000Z
2018-02-02T07:25:44.000Z
spec/influxdb_spec.rb
PTC-Global/sensu-extensions-influxdb
96f0c6e58473829c71b92b65a3729b5080f7bb95
[ "Apache-2.0" ]
79
2018-04-06T07:06:58.000Z
2021-06-25T15:16:41.000Z
spec/influxdb_spec.rb
PTC-Global/sensu-extensions-influxdb
96f0c6e58473829c71b92b65a3729b5080f7bb95
[ "Apache-2.0" ]
3
2017-05-22T09:22:39.000Z
2017-08-09T10:06:45.000Z
require File.join(File.dirname(__FILE__), 'helpers') require 'sensu/extensions/influxdb2' require 'socket' describe 'Sensu::Extension::InfluxDB2' do include Helpers before do @extension = Sensu::Extension::InfluxDB2.new @extension.settings = { 'influxdb' => { 'database' => 'test', 'host' => '127.0.0.1', 'port' => 8087, 'strip_metric' => 'rpsec_strip', 'timeout' => 15, 'buffer_max_size' => 1, 'buffer_max_age' => 1 } } end # it 'can run, returning raw event data' do # async_wrapper do # @extension.safe_run(event_template) do |output, status| # expect(output).to eq('template') # expect(status).to eq(0) # end # end # end end
23.6875
63
0.580475
12c86eff0f0ba3db37ae52b1a5a3e12f6f110a6f
1,870
cs
C#
src/Service.IntrestManager/Jobs/InterestManagerJob.cs
MyJetWallet/Service.IntrestManager
779faec4d15174679da2df72cfad3c17bf6d3f2e
[ "MIT" ]
null
null
null
src/Service.IntrestManager/Jobs/InterestManagerJob.cs
MyJetWallet/Service.IntrestManager
779faec4d15174679da2df72cfad3c17bf6d3f2e
[ "MIT" ]
null
null
null
src/Service.IntrestManager/Jobs/InterestManagerJob.cs
MyJetWallet/Service.IntrestManager
779faec4d15174679da2df72cfad3c17bf6d3f2e
[ "MIT" ]
null
null
null
using System; using System.Threading.Tasks; using Autofac; using Microsoft.Extensions.Logging; using MyJetWallet.Sdk.Service.Tools; using Service.IntrestManager.Engines; namespace Service.IntrestManager.Jobs { public class InterestManagerJob { private readonly ILogger<InterestManagerJob> _logger; private readonly MyTaskTimer _timer; private readonly InterestCalculationEngine _interestCalculationEngine; private readonly PaidCalculationEngine _paidCalculationEngine; private readonly InterestProcessingEngine _interestProcessingEngine; public InterestManagerJob(ILogger<InterestManagerJob> logger, InterestCalculationEngine interestCalculationEngine, PaidCalculationEngine paidCalculationEngine, InterestProcessingEngine interestProcessingEngine) { _logger = logger; _interestCalculationEngine = interestCalculationEngine; _paidCalculationEngine = paidCalculationEngine; _interestProcessingEngine = interestProcessingEngine; _timer = new MyTaskTimer(nameof(InterestManagerJob), TimeSpan.FromSeconds(Program.Settings.InterestManagerTimerInSeconds), _logger, DoTime); _logger.LogInformation($"InterestManagerJob timer: {TimeSpan.FromSeconds(Program.Settings.InterestManagerTimerInSeconds)}"); } private async Task DoTime() { try { await _interestCalculationEngine.Execute(); await _paidCalculationEngine.Execute(); await _interestProcessingEngine.Execute(); } catch (Exception ex) { _logger.LogError(ex, ex.Message); } } public void Start() { _timer.Start(); } } }
35.283019
136
0.670053
6b73eecf47129547fad678c4586273d94d5b13e7
382
js
JavaScript
spot-mobile-app/app/utils/permissionsUtils.js
Marethyu1/spot
cf0ede0852a71afd4493468a40138520dc947a43
[ "MIT" ]
1
2019-09-04T14:25:28.000Z
2019-09-04T14:25:28.000Z
spot-mobile-app/app/utils/permissionsUtils.js
Marethyu1/spot
cf0ede0852a71afd4493468a40138520dc947a43
[ "MIT" ]
6
2020-09-04T11:26:15.000Z
2021-05-07T18:36:52.000Z
spot-mobile-app/app/utils/permissionsUtils.js
Marethyu1/spot
cf0ede0852a71afd4493468a40138520dc947a43
[ "MIT" ]
null
null
null
import { Permissions } from 'expo' const GRANTED = 'granted' const _hasPermission = async (permission) => { const { status } = await Permissions.askAsync(permission) return status === GRANTED } export const hasCameraPermission = async () => await _hasPermission(Permissions.CAMERA) export const hasLocationPermission = async () => await _hasPermission(Permissions.LOCATION)
29.384615
91
0.753927
dbf2b4280fb7eceb8860294659297a738ecfecca
5,684
php
PHP
application/models/DbTable/DbMoneyTransactions.php
samlanh/loansystem
485fcd04cc545ec8981efcb3b711903246fb7dfb
[ "Apache-2.0" ]
null
null
null
application/models/DbTable/DbMoneyTransactions.php
samlanh/loansystem
485fcd04cc545ec8981efcb3b711903246fb7dfb
[ "Apache-2.0" ]
null
null
null
application/models/DbTable/DbMoneyTransactions.php
samlanh/loansystem
485fcd04cc545ec8981efcb3b711903246fb7dfb
[ "Apache-2.0" ]
null
null
null
<?php class Application_Model_DbTable_DbMoneyTransactions extends Zend_Db_Table_Abstract { protected $_name = 'cs_money_transactions'; public function init() { header('content-type: text/html; charset=utf8'); defined('BASE_URL') || define('BASE_URL', Zend_Controller_Front::getInstance()->getBaseUrl()); } function getTransactionLis($search){ $db = $this->getAdapter(); $session_user=new Zend_Session_Namespace(SYSTEM_SES); $from_date =(empty($search['start_date']))? '1': " send_date >= '".$search['start_date']." 00:00:00'"; $to_date = (empty($search['end_date']))? '1': " send_date <= '".$search['end_date']." 23:59:59'"; $where = " WHERE ".$from_date." AND ".$to_date; $sql = " SELECT `id`,`sender_name`,`sender_tel`,`reciever_tel`, (SELECT name_en FROM `ln_view` WHERE key_code =`tran_type` AND TYPE= 27) AS tran_type, (SELECT name_en FROM `ln_view` WHERE key_code =`currencty_type` AND TYPE= 15) AS currencty_type, `amount_tranfer`,`commission`,`send_date`,status FROM ln_transfer "; if (!empty($search['adv_search'])){ $s_where = array(); $s_search = trim(addslashes($search['adv_search'])); $s_where[] = " sender_tel LIKE '%{$s_search}%'"; $s_where[] = " reciever_tel LIKE '%{$s_search}%'"; $s_where[] = " amount_tranfer LIKE '%{$s_search}%'"; $where .=' AND ('.implode(' OR ',$s_where).')'; } if($search['status']>-1){ $where.= " AND status = ".$search['status']; } if($search['currency_type']>-1){ $where.= " AND currencty_type = ".$search['currency_type']; } $order=" order by id desc "; return $db->fetchAll($sql.$where.$order); } function getTransactionDetailByID($id){ $db = $this->getAdapter(); $sql = "SELECT * FROM ln_transfer WHERE `id` = ". $id; return $db->fetchRow($sql); } function insertTransfer($data) { $this->_name='ln_transfer'; $send_date = $data['send_date'].' '.date('h:i:s'); $exp_date = $data['epx_date'].' '.date('h:i:s'); $session_user=new Zend_Session_Namespace(SYSTEM_SES); $db = $this->getAdapter(); $db->beginTransaction(); try { $_data=array( 'tran_type'=>$data['tran_type'], 'sender_name'=>$data['sender'], 'sender_tel'=>$data['sender_tel'], 'reciever_tel'=>$data['reciever_tel'], 'amount_tranfer'=>$data['invoice_no'], 'currencty_type'=>$data['type_money'], 'send_date'=>$data['send_date'], 'recieved_date'=>$data['type_money'], 'expire_date'=>$data['epx_date'], 'amount_tranfer'=>$data['amount'], 'commission'=>$data['commission'], 'total_commission'=>$data['totalcommission'], 'user_id'=>$session_user->user_id ); if(!empty($data['id'])){ $where=" id= ".$data['id']; $this->update($_data, $where); }else{ $this->insert($_data); } // print_r($_data);exit(); return $db->commit(); } catch (Exception $e) { $db->rollBack(); } } function getTransactionReport($search){ $db = $this->getAdapter(); $session_user=new Zend_Session_Namespace(SYSTEM_SES); $from_date =(empty($search['start_date']))? '1': " send_date >= '".$search['start_date']." 00:00:00'"; $to_date = (empty($search['end_date']))? '1': " send_date <= '".$search['end_date']." 23:59:59'"; $where = " WHERE ".$from_date." AND ".$to_date; $sql = " SELECT `id`,`sender_name`,`sender_tel`,`reciever_tel`, (SELECT name_en FROM `ln_view` WHERE key_code =`tran_type` AND TYPE= 27) AS tran_type, tran_type AS transaction_type, (SELECT name_en FROM `ln_view` WHERE key_code =`currencty_type` AND TYPE= 15) AS currencty_type, currencty_type As curr_type, `amount_tranfer`,`commission`, `total_commission`,`send_date`,status FROM ln_transfer "; if (!empty($search['adv_search'])){ $s_where = array(); $s_search = trim(addslashes($search['adv_search'])); $s_where[] = " sender_tel LIKE '%{$s_search}%'"; $s_where[] = " reciever_tel LIKE '%{$s_search}%'"; $s_where[] = " amount_tranfer LIKE '%{$s_search}%'"; $where .=' AND ('.implode(' OR ',$s_where).')'; } if($search['status']>-1){ $where.= " AND status = ".$search['status']; } if($search['currency_type']>-1){ $where.= " AND currencty_type = ".$search['currency_type']; } $order=" order by id desc "; // echo $sql.$where.$order;exit(); return $db->fetchAll($sql.$where.$order); } function getTranferFee($data){ $db = $this->getAdapter(); $amount=$data['amount']; $currency=$data['type_money']; $sql=" SELECT tr.*, (SELECT CONCAT(c.curr_namekh,' ',c.symbol ) FROM `ln_currency` AS c WHERE c.id = tr.`currency_id` LIMIT 1) AS currencyKH FROM `ln_transfercondiction` AS tr WHERE $amount > tr.`fromAmount` AND $amount <= tr.`toAmount` AND tr.`currency_id`=$currency LIMIT 1 "; $row = $db->fetchRow($sql); if (empty($row) && $amount > 0){ $sql=" SELECT tr.*, (SELECT CONCAT(c.curr_namekh,' ',c.symbol ) FROM `ln_currency` AS c WHERE c.id = tr.`currency_id` LIMIT 1) AS currencyKH FROM `ln_transfercondiction` AS tr WHERE tr.`currency_id`=$currency ORDER BY tr.`toAmount` DESC LIMIT 1 "; $row = $db->fetchRow($sql); } return $row; } }
36.670968
125
0.571077
c6523ecdc7ba5aab8e3e38cc6168d52c0b8ec202
2,100
css
CSS
demo_iascemr/css/animate_custom.css
jackdna/EMR-PM-Software
2e4eeda208659196f35f1046aa12713e3acfd380
[ "MIT" ]
1
2021-11-24T21:00:00.000Z
2021-11-24T21:00:00.000Z
demo_iascemr/css/animate_custom.css
jackdna/EMR-PM-Software
2e4eeda208659196f35f1046aa12713e3acfd380
[ "MIT" ]
null
null
null
demo_iascemr/css/animate_custom.css
jackdna/EMR-PM-Software
2e4eeda208659196f35f1046aa12713e3acfd380
[ "MIT" ]
null
null
null
@charset "utf-8"; /* CSS Document */ /* slide in left */ .slideinlEft { } .slideinlEft { -webkit-animation: slideinlEft 1.2s 1 ease-in; -moz-animation: slideinlEft 1.2s 1 ease-in; -o-animation: slideinlEft 1.2s 1 ease-in; } @-webkit-keyframes slideinlEft { from {-webkit-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; -moz-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; -o-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; } to {-webkit-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; -moz-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; -o-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; } } @-moz-keyframes slideinlEft { from {-webkit-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; -moz-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; -o-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; } to {-webkit-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; -moz-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; -o-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; } } @-o-keyframes slideinlEft { from {-webkit-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; -moz-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; -o-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; } to {-webkit-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; -moz-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; -o-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; } } @-ms-keyframes slideinlEft { from {-ms-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; -ms-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; -o-transform: rotate(0deg) scale(1) skew(-180deg) translate(-100%) ; } to {-ms-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; -ms-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; -o-transform: rotate(0deg) scale(1) skew(-180deg) translate(0px) ; } }
39.622642
79
0.699524
e90a8cadf6fac122e137da0e1823ba73cbffd090
26,001
sql
SQL
data/postprocessing/high/0010.prep.roads.sql
tkardi/kahhelgramm
7a061f3d842f9ef3fd2e959eb92fd7d7c8dd5718
[ "CC0-1.0" ]
null
null
null
data/postprocessing/high/0010.prep.roads.sql
tkardi/kahhelgramm
7a061f3d842f9ef3fd2e959eb92fd7d7c8dd5718
[ "CC0-1.0" ]
null
null
null
data/postprocessing/high/0010.prep.roads.sql
tkardi/kahhelgramm
7a061f3d842f9ef3fd2e959eb92fd7d7c8dd5718
[ "CC0-1.0" ]
null
null
null
/* fixing some z-levels beforehand, derive pseudo z-levels from z coordinates. */ /* although these might be broken aswell... */ /* using these simply as backup. */ /* ... and a later try tells us, that these are so broken that they will lead nowhere */ /* and will cause more problems than solve currently. but will keep this calc */ /* in here anyway... maybe sometime later.*/ alter table vectiles_input.e_501_tee_j add column z_coord_from int; alter table vectiles_input.e_501_tee_j add column z_coord_to int; alter table vectiles_input.e_501_tee_j add column xyz_from varchar; alter table vectiles_input.e_501_tee_j add column xyz_to varchar; alter table vectiles_input.e_501_tee_j add column z_from int; alter table vectiles_input.e_501_tee_j add column z_to int; update vectiles_input.e_501_tee_j set z_coord_from = st_z(st_startpoint(geom))::int; update vectiles_input.e_501_tee_j set z_coord_to = st_z(st_endpoint(geom))::int; update vectiles_input.e_501_tee_j set xyz_from = (st_x(st_startpoint(geom))*100)::bigint::varchar||(st_y(st_startpoint(geom))*100)::bigint::varchar; update vectiles_input.e_501_tee_j set xyz_to = (st_x(st_endpoint(geom))*100)::bigint::varchar||(st_y(st_endpoint(geom))*100)::bigint::varchar; create index idx__e_501_tee_j__xyz_from on vectiles_input.e_501_tee_j (xyz_from); create index idx__e_501_tee_j__xyz_to on vectiles_input.e_501_tee_j (xyz_to); /* ... BUT back to z_levels business */ /* create a quasi-tmp table of all intersections and roads. */ drop table if exists vectiles_input.tee_tmp; create table vectiles_input.tee_tmp as select gid as tee_gid, (array[1, st_numpoints(geom)])[i] as ord, elem as z, st_numpoints(geom) as numpoints, case when i = 1 then st_startpoint(geom) else st_endpoint(geom) end as geom, (array[xyz_from, xyz_to])[i] as xyz, tee, teeosa from vectiles_input.e_501_tee_j join lateral unnest(array[a_tasand, l_tasand]) with ordinality d(elem, i) on true ; alter table vectiles_input.tee_tmp add column oid serial; alter table vectiles_input.tee_tmp add constraint pk__tee_tmp primary key (oid); create index sidx__tee_tmp on vectiles_input.tee_tmp using gist (geom); create index idx__tee_tmp__xyz on vectiles_input.tee_tmp (xyz); alter table vectiles_input.tee_tmp add column total_per_z int; alter table vectiles_input.tee_tmp add column total int; update vectiles_input.tee_tmp set total = f.count from ( select xyz, count(1) from vectiles_input.tee_tmp group by xyz ) f where f.xyz = tee_tmp.xyz ; update vectiles_input.tee_tmp set total_per_z = f.count from ( select xyz, z, count(1) from vectiles_input.tee_tmp group by xyz, z ) f where f.xyz = tee_tmp.xyz and f.z = tee_tmp.z ; /* problem solving with a hammer: */ /* if it's not on a bridge, and it's not a path/bikeroad (as these have a lot of bridges missing from the input) */ /* and it's claiming to be z-level > 0 then most probably it's not! */ drop table if exists vectiles_input.tee_tmp_new_z; create table vectiles_input.tee_tmp_new_z as select t.* from vectiles_input.tee_tmp t, vectiles_input.e_501_tee_j j where j.gid = t.tee_gid and t.z > 0 and not exists ( select 1 from vectiles_input.bridges b where st_within(t.geom, b.geom) ) and total_per_z = 1 and ((total = 1 and a_tasand != l_tasand) or total > 1) order by xyz ; create index idx__tee_tmp_new_z__xyz on vectiles_input.tee_tmp_new_z (xyz); create index idx__tee_tmp_new_z__tee_gid on vectiles_input.tee_tmp_new_z (tee_gid); update vectiles_input.e_501_tee_j set a_tasand = 0 from vectiles_input.tee_tmp_new_z c where c.tee_gid = e_501_tee_j.gid and c.xyz = e_501_tee_j.xyz_from ; update vectiles_input.e_501_tee_j set l_tasand = 0 from vectiles_input.tee_tmp_new_z c where c.tee_gid = e_501_tee_j.gid and c.xyz = e_501_tee_j.xyz_to ; /* DONE. recreate temp */ drop table if exists vectiles_input.tee_tmp; create table vectiles_input.tee_tmp as select gid as tee_gid, (array[1, st_numpoints(geom)])[i] as ord, elem as z, st_numpoints(geom) as numpoints, case when i = 1 then st_startpoint(geom) else st_endpoint(geom) end as geom, (array[xyz_from, xyz_to])[i] as xyz, tee, teeosa from vectiles_input.e_501_tee_j join lateral unnest(array[a_tasand, l_tasand]) with ordinality d(elem, i) on true ; alter table vectiles_input.tee_tmp add column oid serial; alter table vectiles_input.tee_tmp add constraint pk__tee_tmp primary key (oid); create index sidx__tee_tmp on vectiles_input.tee_tmp using gist (geom); create index idx__tee_tmp__xyz on vectiles_input.tee_tmp (xyz); alter table vectiles_input.tee_tmp add column total_per_z int; alter table vectiles_input.tee_tmp add column total int; update vectiles_input.tee_tmp set total = f.count from ( select xyz, count(1) from vectiles_input.tee_tmp group by xyz ) f where f.xyz = tee_tmp.xyz ; update vectiles_input.tee_tmp set total_per_z = f.count from ( select xyz, z, count(1) from vectiles_input.tee_tmp group by xyz, z ) f where f.xyz = tee_tmp.xyz and f.z = tee_tmp.z ; /* hammer continues... */ /* xyz has two roads associated but only one xyz per z */ /* if there's a bridge present lift everything on this xyz to z=1 otherwise 0 */ drop table if exists vectiles_input.tee_tmp_new_z; create table vectiles_input.tee_tmp_new_z as select xyz, array_agg(z), count(1), (array_agg(st_within(f.geom, b.geom)))[1] as is_bridge, (array_agg(f.geom))[1] as geom from ( select xyz, z, count(1), min(geom)::geometry(pointzm, 3301) as geom from vectiles_input.tee_tmp group by xyz, z having count(1) = 1 order by z ) f left join vectiles_input.bridges b on st_within(f.geom, b.geom) group by xyz having count(1) = 2 order by 2 ; create index idx__tee_tmp_new_z__xyz on vectiles_input.tee_tmp_new_z (xyz); update vectiles_input.e_501_tee_j set a_tasand = case when f.is_bridge is true then 1 else 0 end from vectiles_input.tee_tmp_new_z f where f.xyz = e_501_tee_j.xyz_from ; update vectiles_input.e_501_tee_j set l_tasand = case when f.is_bridge is true then 1 else 0 end from vectiles_input.tee_tmp_new_z f where f.xyz = e_501_tee_j.xyz_to ; /* recreate temp */ drop table if exists vectiles_input.tee_tmp; create table vectiles_input.tee_tmp as select gid as tee_gid, (array[1, st_numpoints(geom)])[i] as ord, elem as z, st_numpoints(geom) as numpoints, case when i = 1 then st_startpoint(geom) else st_endpoint(geom) end as geom, (array[xyz_from, xyz_to])[i] as xyz, tee, teeosa from vectiles_input.e_501_tee_j join lateral unnest(array[a_tasand, l_tasand]) with ordinality d(elem, i) on true ; alter table vectiles_input.tee_tmp add column oid serial; alter table vectiles_input.tee_tmp add constraint pk__tee_tmp primary key (oid); create index sidx__tee_tmp on vectiles_input.tee_tmp using gist (geom); create index idx__tee_tmp__xyz on vectiles_input.tee_tmp (xyz); alter table vectiles_input.tee_tmp add column total_per_z int; alter table vectiles_input.tee_tmp add column total int; update vectiles_input.tee_tmp set total = f.count from ( select xyz, count(1) from vectiles_input.tee_tmp group by xyz ) f where f.xyz = tee_tmp.xyz ; update vectiles_input.tee_tmp set total_per_z = f.count from ( select xyz, z, count(1) from vectiles_input.tee_tmp group by xyz, z ) f where f.xyz = tee_tmp.xyz and f.z = tee_tmp.z ; drop table if exists vectiles_input.tee_tmp_new_z; create table vectiles_input.tee_tmp_new_z as select t.* from vectiles_input.tee_tmp t, vectiles_input.e_501_tee_j j where j.gid = t.tee_gid and t.z > 0 and exists ( select 1 from vectiles_input.bridges b where st_within(t.geom, b.geom) ) and total_per_z = 1 and ((total = 1 and a_tasand != l_tasand) or total > 1) order by xyz ; create index idx__tee_tmp_new_z__xyz on vectiles_input.tee_tmp_new_z (xyz); create index idx__tee_tmp_new_z__tee_gid on vectiles_input.tee_tmp_new_z (tee_gid); update vectiles_input.e_501_tee_j set a_tasand = 1 from vectiles_input.tee_tmp_new_z c where c.xyz = e_501_tee_j.xyz_from and c.total < 4 ; update vectiles_input.e_501_tee_j set l_tasand = 1 from vectiles_input.tee_tmp_new_z c where c.xyz = e_501_tee_j.xyz_to and c.total < 4 ; /* recreate temp */ drop table if exists vectiles_input.tee_tmp; create table vectiles_input.tee_tmp as select gid as tee_gid, (array[1, st_numpoints(geom)])[i] as ord, elem as z, st_numpoints(geom) as numpoints, case when i = 1 then st_startpoint(geom) else st_endpoint(geom) end as geom, (array[xyz_from, xyz_to])[i] as xyz, tee, teeosa from vectiles_input.e_501_tee_j join lateral unnest(array[a_tasand, l_tasand]) with ordinality d(elem, i) on true ; alter table vectiles_input.tee_tmp add column oid serial; alter table vectiles_input.tee_tmp add constraint pk__tee_tmp primary key (oid); create index sidx__tee_tmp on vectiles_input.tee_tmp using gist (geom); create index idx__tee_tmp__xyz on vectiles_input.tee_tmp (xyz); alter table vectiles_input.tee_tmp add column total_per_z int; alter table vectiles_input.tee_tmp add column total int; update vectiles_input.tee_tmp set total = f.count from ( select xyz, count(1) from vectiles_input.tee_tmp group by xyz ) f where f.xyz = tee_tmp.xyz ; update vectiles_input.tee_tmp set total_per_z = f.count from ( select xyz, z, count(1) from vectiles_input.tee_tmp group by xyz, z ) f where f.xyz = tee_tmp.xyz and f.z = tee_tmp.z ; /* ASSUMPTIONS: */ /* 1) a road segment with a natinal identifier should essentially pass a xyz intersection only once in the same z-level */ /* except for those rare occasions when it doesn't. like a link road starting from under the bridge and finishing on top... */ drop table if exists vectiles_input.tee_tmp_new_z; create table vectiles_input.tee_tmp_new_z as select y.xyz, y.tee, y.zs, y.count, y.tee_gids, y.count_per_z, y.current_z, t.count as tee_count, t.ts, coalesce( case -- intersects a bridge (on top or under), count of roads == 2 and intersects any of water of waterlines then use higher available when b.gid is not null and t.count = 2 and (vvk.etak_ids is not null or rail_and_bridge.etak_ids is not null) then y.zs[2] -- intersects a bridge (on top or under), count of roads > 2 then manage it somehow later on but mark it differently when b.gid is not null and t.count > 2 and (vvk.etak_ids is not null or rail_and_bridge.etak_ids is not null) then -2 -- intersects a bridge (on top or under) and count of roads == 2, but no waterline or railroad (ecoducts!!! or not... ??? not all of them at least) when b.gid is not null and t.count= 2 and (vvk.etak_ids is null and rail_and_bridge.etak_ids is null) then 0 -- all as before, but number of intersecting roads is > 2 when b.gid is not null and t.count > 2 and (vvk.etak_ids is null and rail_and_bridge.etak_ids is null) then -3 -- everything else, pass on when b.gid is null and vvk.etak_ids is not null then null when b.gid is null and vvk.etak_ids is null then null end, case -- this way crosses railroads, so opt for the smaller (there was no bridge here!) when y.zs[1] < 0 and rail.etak_ids is not null then y.zs[1] -- there's no rail, take a chance, go for bigger one as the original was -1 when y.zs[1] < 0 and rail.etak_ids is null then y.zs[2] else y.zs[1] end ) as new_z, case when b.gid is null then false else true end as xyz_on_bridge, case when vvk.etak_ids is null then false else true end as road_crosses_a_river, case when rail_and_bridge.etak_ids is null then false else true end as road_crosses_a_railway, b.gid as bridge_gid, b.water_etak_ids, rail_and_bridge.etak_ids as rail_etak_ids, l.roads_per_z as roads_per_lower_z, h.roads_per_z as roads_per_higher_z, t.geom as road_geom, y.geom as xyz_geom from ( select xyz, tee, array_agg(distinct z) as zs, count(1), array_agg(z order by g) as current_z, min(geom)::geometry(pointzm, 3301) as geom, array_agg(g order by g) as tee_gids, array_agg(d.c order by g) as count_per_z from ( select xyz, tee, z, geom, array_agg(tee_gid) as tee_gids from vectiles_input.tee_tmp where tee is not null group by xyz, tee, z, geom ) x join lateral unnest(tee_gids) g on true join lateral ( select count(1) c from vectiles_input.tee_tmp t where t.xyz=x.xyz and t.tee=x.tee and t.z = x.z ) d on true group by xyz, tee having array_upper(array_agg(distinct z), 1)>1 ) y left join vectiles_input.bridges b on st_within(y.geom, b.geom) left join lateral ( select st_union(t.geom) as geom, count(1), array_agg(distinct tee) as ts from vectiles_input.e_501_tee_j t where t.gid = any(y.tee_gids)) t on true left join lateral ( select array_agg(etak_id) as etak_ids from vectiles_input.e_203_vooluveekogu_j j where j.etak_id = any(b.water_etak_ids) and st_intersects(j.geom, t.geom)) vvk on true left join lateral ( select array_agg(etak_id) as etak_ids from vectiles_input.e_502_roobastee_j r where r.etak_id = any(b.rail_etak_ids) and st_intersects(r.geom, t.geom)) rail_and_bridge on true left join lateral ( select array_agg(etak_id) as etak_ids from vectiles_input.e_502_roobastee_j r where st_intersects(r.geom, t.geom)) rail on true left join lateral ( select count(1) as roads_per_z from vectiles_input.tee_tmp low where low.xyz = y.xyz and low.z = y.zs[1] and coalesce(low.tee,-1) != y.tee) l on true left join lateral ( select count(1) as roads_per_z from vectiles_input.tee_tmp high where high.xyz = y.xyz and high.z = y.zs[2] and coalesce(high.tee,-1) != y.tee) h on true where /* assuming road identifiers 'tee' are not messed up */ /* if a road segments finishes at xyz and exits it at a z, everything is fine */ 2 != any(y.count_per_z) order by xyz ; create index idx__tee_tmp_new_z__xyz on vectiles_input.tee_tmp_new_z (xyz); create index idx__tee_tmp_new_z__tee_gids on vectiles_input.tee_tmp_new_z using gin (tee_gids); update vectiles_input.e_501_tee_j set a_tasand = f.new_z from vectiles_input.tee_tmp_new_z f where f.xyz = e_501_tee_j.xyz_from and e_501_tee_j.gid = any(f.tee_gids) and f.new_z > -2 ; update vectiles_input.e_501_tee_j set l_tasand = f.new_z from vectiles_input.tee_tmp_new_z f where f.xyz = e_501_tee_j.xyz_to and e_501_tee_j.gid = any(f.tee_gids) and f.new_z > -2 ; /* recreat temp */ drop table if exists vectiles_input.tee_tmp; create table vectiles_input.tee_tmp as select gid as tee_gid, (array[1, st_numpoints(geom)])[i] as ord, elem as z, st_numpoints(geom) as numpoints, case when i = 1 then st_startpoint(geom) else st_endpoint(geom) end as geom, (array[xyz_from, xyz_to])[i] as xyz, tee, teeosa from vectiles_input.e_501_tee_j join lateral unnest(array[a_tasand, l_tasand]) with ordinality d(elem, i) on true ; alter table vectiles_input.tee_tmp add column oid serial; alter table vectiles_input.tee_tmp add constraint pk__tee_tmp primary key (oid); create index sidx__tee_tmp on vectiles_input.tee_tmp using gist (geom); create index idx__tee_tmp__xyz on vectiles_input.tee_tmp (xyz); alter table vectiles_input.tee_tmp add column total_per_z int; alter table vectiles_input.tee_tmp add column total int; update vectiles_input.tee_tmp set total = f.count from ( select xyz, count(1) from vectiles_input.tee_tmp group by xyz ) f where f.xyz = tee_tmp.xyz ; update vectiles_input.tee_tmp set total_per_z = f.count from ( select xyz, z, count(1) from vectiles_input.tee_tmp group by xyz, z ) f where f.xyz = tee_tmp.xyz and f.z = tee_tmp.z ; /* comparing NULL road identifiers makes no sense */ /* instead let's calculate the turn angle between roads intersecting at */ /* xyz and assume that the "straightest" pairs are on the same z-level. */ drop table if exists vectiles_input.tee_tmp_new_z; create table vectiles_input.tee_tmp_new_z as select fix.*, y.geom, y.count_per_z from ( select xyz, array_agg(distinct z) as zs, count(1), array_agg(z order by g) as current_z, min(geom)::geometry(pointzm, 3301) as geom, array_agg(g order by g) as tee_gids, array_agg(d.c order by g) as count_per_z from ( select xyz, z, min(geom)::geometry(pointzm, 3301) as geom, array_agg(tee_gid) as tee_gids from vectiles_input.tee_tmp group by xyz, z ) x join lateral unnest(tee_gids) g on true join lateral ( select count(1) c from vectiles_input.tee_tmp t where t.xyz=x.xyz /*and coalesce(t.tee,-1) = coalesce(x.tee,-1)*/ and t.z = x.z ) d on true group by xyz having array_upper(array_agg(distinct z), 1)>1 ) y left join vectiles_input.bridges b on st_within(y.geom, b.geom) left join lateral ( select st_union(t.geom) as geom, count(1), array_agg(distinct tee) as ts from vectiles_input.e_501_tee_j t where t.gid = any(y.tee_gids)) t on true left join lateral ( select array_agg(etak_id) as etak_ids from vectiles_input.e_203_vooluveekogu_j j where j.etak_id = any(b.water_etak_ids) and st_intersects(j.geom, t.geom)) vvk on true left join lateral ( select array_agg(etak_id) as etak_ids from vectiles_input.e_502_roobastee_j r where r.etak_id = any(b.rail_etak_ids) and st_intersects(r.geom, t.geom)) rail_and_bridge on true left join lateral ( select array_agg(etak_id) as etak_ids from vectiles_input.e_502_roobastee_j r where st_intersects(r.geom, t.geom)) rail on true join lateral vectiles_input.azimuth_based_z_level_fix(y.xyz, y.tee_gids) fix on true where /* if a road segments finishes at xyz and exits it at a z, everything is fine */ 1 = any(y.count_per_z) order by xyz ; create index idx__tee_tmp_new_z__xyz on vectiles_input.tee_tmp_new_z (xyz); create index idx__tee_tmp_new_z__tee_gids on vectiles_input.tee_tmp_new_z using gin (tee_gids); update vectiles_input.e_501_tee_j set a_tasand = f.new_z from vectiles_input.tee_tmp_new_z f where f.xyz = e_501_tee_j.xyz_from and e_501_tee_j.gid = any(f.tee_gids) and f.new_z > -2 ; update vectiles_input.e_501_tee_j set l_tasand = f.new_z from vectiles_input.tee_tmp_new_z f where f.xyz = e_501_tee_j.xyz_to and e_501_tee_j.gid = any(f.tee_gids) and f.new_z > -2 ; /* and recreate temp... */ drop table if exists vectiles_input.tee_tmp; create table vectiles_input.tee_tmp as select gid as tee_gid, (array[1, st_numpoints(geom)])[i] as ord, elem as z, st_numpoints(geom) as numpoints, case when i = 1 then st_startpoint(geom) else st_endpoint(geom) end as geom, (array[xyz_from, xyz_to])[i] as xyz, tee, teeosa from vectiles_input.e_501_tee_j join lateral unnest(array[a_tasand, l_tasand]) with ordinality d(elem, i) on true ; alter table vectiles_input.tee_tmp add column oid serial; alter table vectiles_input.tee_tmp add constraint pk__tee_tmp primary key (oid); create index sidx__tee_tmp on vectiles_input.tee_tmp using gist (geom); create index idx__tee_tmp__xyz on vectiles_input.tee_tmp (xyz); alter table vectiles_input.tee_tmp add column total_per_z int; alter table vectiles_input.tee_tmp add column total int; update vectiles_input.tee_tmp set total = f.count from ( select xyz, count(1) from vectiles_input.tee_tmp group by xyz ) f where f.xyz = tee_tmp.xyz ; update vectiles_input.tee_tmp set total_per_z = f.count from ( select xyz, z, count(1) from vectiles_input.tee_tmp group by xyz, z ) f where f.xyz = tee_tmp.xyz and f.z = tee_tmp.z ; /* an intersection at z=-1 and z=0 and nothing on z=1 */ /* and it intersects A BRIDGE */ /* +1 to z-levels at current z=0 */ update vectiles_input.e_501_tee_j set a_tasand = 1 from ( select t.xyz, t.z, tee_gid, total_per_z, count(1) filter(where z=1) over (partition by xyz) as z1_count, t.geom from vectiles_input.tee_tmp t, vectiles_input.bridges b where st_within (t.geom, b.geom) and exists ( select 1 from vectiles_input.tee_tmp a where a.xyz = t.xyz and a.z = -1 ) ) b where b.z1_count = 0 and b.z = 0 and e_501_tee_j.gid = b.tee_gid and e_501_tee_j.xyz_from = b.xyz and e_501_tee_j.a_tasand = 0; update vectiles_input.e_501_tee_j set l_tasand = 1 from ( select t.xyz, t.z, tee_gid, total_per_z, count(1) filter(where z=1) over (partition by xyz) as z1_count, t.geom from vectiles_input.tee_tmp t, vectiles_input.bridges b where st_within (t.geom, b.geom) and exists ( select 1 from vectiles_input.tee_tmp a where a.xyz = t.xyz and a.z = -1 ) ) b where b.z1_count = 0 and b.z = 0 and e_501_tee_j.gid = b.tee_gid and e_501_tee_j.xyz_to = b.xyz and e_501_tee_j.l_tasand = 0; ; /* and recreate temp... */ drop table if exists vectiles_input.tee_tmp; create table vectiles_input.tee_tmp as select gid as tee_gid, (array[1, st_numpoints(geom)])[i] as ord, elem as z, st_numpoints(geom) as numpoints, case when i = 1 then st_startpoint(geom) else st_endpoint(geom) end as geom, (array[xyz_from, xyz_to])[i] as xyz, tee, teeosa from vectiles_input.e_501_tee_j join lateral unnest(array[a_tasand, l_tasand]) with ordinality d(elem, i) on true ; alter table vectiles_input.tee_tmp add column oid serial; alter table vectiles_input.tee_tmp add constraint pk__tee_tmp primary key (oid); create index sidx__tee_tmp on vectiles_input.tee_tmp using gist (geom); create index idx__tee_tmp__xyz on vectiles_input.tee_tmp (xyz); alter table vectiles_input.tee_tmp add column total_per_z int; alter table vectiles_input.tee_tmp add column total int; update vectiles_input.tee_tmp set total = f.count from ( select xyz, count(1) from vectiles_input.tee_tmp group by xyz ) f where f.xyz = tee_tmp.xyz ; update vectiles_input.tee_tmp set total_per_z = f.count from ( select xyz, z, count(1) from vectiles_input.tee_tmp group by xyz, z ) f where f.xyz = tee_tmp.xyz and f.z = tee_tmp.z ; /* and intersection at a bridge with four road segments at z=0 and none at z=1 */ /* but one (and only one) of the segments has another end at z=1 */ /* clc azimuth based pairs and assign z=1 to the one pairing */ drop table if exists vectiles_input.tee_tmp_new_z; create table vectiles_input.tee_tmp_new_z as select * from ( select fix.*, c.other_gid from ( select xyz, array_agg(tee_gid) as tee_gids, (array_agg(distinct o))[1] as other_gid from ( select t.xyz, t.z, tee_gid, total_per_z, count(1) filter(where z=1) over (partition by xyz) as z1_count, t.geom, j.gid as o from vectiles_input.tee_tmp t, vectiles_input.bridges b, vectiles_input.e_501_tee_j j where z = 0 and total_per_z > 3 and st_within (t.geom, b.geom) and ((j.l_tasand = 1 and j.xyz_from = t.xyz ) or (j.a_tasand = 1 and j.xyz_to = t.xyz)) ) b /* but only if we're currently z=0 and there's nothing on z=1 */ where b.z1_count = 0 and b.z = 0 group by xyz /* and only if there's 1 other that's partly z=1 */ having array_upper(array_agg(distinct o), 1) = 1 ) c join lateral vectiles_input.azimuth_based_z_level_fix(c.xyz, c.tee_gids) fix on true ) d where other_gid = any(tee_gids) ; create index idx__tee_tmp_new_z__xyz on vectiles_input.tee_tmp_new_z (xyz); create index idx__tee_tmp_new_z__tee_gids on vectiles_input.tee_tmp_new_z using gin (tee_gids); update vectiles_input.e_501_tee_j set l_tasand = f.new_z from vectiles_input.tee_tmp_new_z f where f.xyz = e_501_tee_j.xyz_to and e_501_tee_j.gid = any(f.tee_gids) ; update vectiles_input.e_501_tee_j set a_tasand = f.new_z from vectiles_input.tee_tmp_new_z f where f.xyz = e_501_tee_j.xyz_from and e_501_tee_j.gid = any(f.tee_gids) ; /* and recreate temp... */ drop table if exists vectiles_input.tee_tmp; create table vectiles_input.tee_tmp as select gid as tee_gid, (array[1, st_numpoints(geom)])[i] as ord, elem as z, st_numpoints(geom) as numpoints, case when i = 1 then st_startpoint(geom) else st_endpoint(geom) end as geom, (array[xyz_from, xyz_to])[i] as xyz, tee, teeosa from vectiles_input.e_501_tee_j join lateral unnest(array[a_tasand, l_tasand]) with ordinality d(elem, i) on true ; alter table vectiles_input.tee_tmp add column oid serial; alter table vectiles_input.tee_tmp add constraint pk__tee_tmp primary key (oid); create index sidx__tee_tmp on vectiles_input.tee_tmp using gist (geom); create index idx__tee_tmp__xyz on vectiles_input.tee_tmp (xyz); alter table vectiles_input.tee_tmp add column total_per_z int; alter table vectiles_input.tee_tmp add column total int; update vectiles_input.tee_tmp set total = f.count from ( select xyz, count(1) from vectiles_input.tee_tmp group by xyz ) f where f.xyz = tee_tmp.xyz ; update vectiles_input.tee_tmp set total_per_z = f.count from ( select xyz, z, count(1) from vectiles_input.tee_tmp group by xyz, z ) f where f.xyz = tee_tmp.xyz and f.z = tee_tmp.z ;
33.943864
159
0.714703
ccff330ae25a2d5456f6a8fc63ec40972966b616
2,539
sql
SQL
controlRoom_server/server/scripts/sql/SERVICE_RATE/DAILY_SERVICE_RATE_CAPTURE.sql
benamrou/controlRoom
2786d79d7a5aa1550fe638c1c6710ef667c00cde
[ "MIT" ]
null
null
null
controlRoom_server/server/scripts/sql/SERVICE_RATE/DAILY_SERVICE_RATE_CAPTURE.sql
benamrou/controlRoom
2786d79d7a5aa1550fe638c1c6710ef667c00cde
[ "MIT" ]
31
2020-02-06T20:28:48.000Z
2022-03-02T05:04:32.000Z
controlRoom_server/server/scripts/sql/SERVICE_RATE/DAILY_SERVICE_RATE_CAPTURE.sql
benamrou/controlRoom
2786d79d7a5aa1550fe638c1c6710ef667c00cde
[ "MIT" ]
null
null
null
set termout off set feed off set head off set echo off INSERT INTO service_rate WITH ITEM_SCOPE AS (SELECT DISTINCT FOUCNUF, foucfin, ARACEXR, ARACINR, ARASITE, ARASEQVL FROM ARTUC, FOUDGENE WHERE ARACFIN = FOUCFIN AND aradfin >= TRUNC(SYSDATE-365)), ORDERS AS (SELECT SC.FOUCNUF, ARASITE, DCDCEXCDE, DCDCINCDE, DCDSITE, DCDCINR, DCDDLIV, ARACEXR, DCDUAUVC, SUM(DCDQTEC / DCDUAUVC) QTY_ORDERED FROM CDEDETCDE, ITEM_SCOPE SC WHERE DCDCFIN = FOUCFIN AND DCDCINR = ARACINR AND dcdseqvl=ARASEQVL AND DCDETAT > 5 AND TRUNC(DCDDCOM) >= TRUNC(SYSDATE-2) AND NOT EXISTS (SELECT 1 FROM SERVICE_RATE WHERE PO_NUM_INT=dcdcincde AND item_code=aracexr) GROUP BY SC.FOUCNUF, ARASITE, DCDCINCDE, DCDCINR, ARACEXR, DCDDLIV, DCDSITE,DCDUAUVC), RECEIPT AS (SELECT FOUCNUF VENDOR_CODE, ARASITE WHS_CODE, ARACEXR ITEM_CODE, QTY_ORDERED, DCDSITE, DCDCINCDE, DCDCEXCDE, DCDUAUVC, NVL((SELECT TRUNC(ORD.SDRSDRC) FROM STODETRE ORD WHERE SDRCINCDE = DCDCINCDE AND SDRCINR = DCDCINR AND ROWNUM = 1), TRUNC(DCDDLIV)) RECEIVING_DAY, NVL((SELECT SUM(NVL(ORD.SDRQTEA, 0) / ORD.SDRUAUVC) FROM STODETRE ORD WHERE SDRCINCDE = DCDCINCDE AND SDRCINR = DCDCINR), 0) QTY_RECEIVED FROM ORDERS) SELECT WHS_CODE, VENDOR_CODE, DCDSITE STORE_CODE,DCDCINCDE PO_NUM_INT, ITEM_CODE, RECEIVING_DAY, DCDUAUVC SKU_PU, QTY_ORDERED, QTY_RECEIVED, 0 FILL_RATE, DCDCEXCDE FROM RECEIPT RCP; /** Service rate update */ MERGE INTO service_rate dst USING ( SELECT sercincde PO_INT, foucnuf, sersite, sdrcexr, TRUNC(serdrec) RECEIVING_DAY, SUM(sdrqteo) sdrqteo, SUM(sdrqtea) sdrqtea, sdruauvc FROM stodetre@heinens_custom_prod, stoentre@heinens_custom_prod, foudgene@HEINENS_CUSTOM_PROD WHERE sercinrec=sdrcinrec AND TRUNC(serdrec)=TRUNC(SYSDATE) AND sercfin=foucfin GROUP BY sercincde,foucnuf,sersite,sdrcexr,sdruauvc, TRUNC(serdrec) ) src ON (src.PO_INT = dst.PO_NUM_INT AND src.sdrcexr=dst.item_code) WHEN MATCHED THEN UPDATE SET dst.qty_received = src.sdrqtea/src.sdruauvc, fill_rate=DECODE(qty_ordered,0,1,qty_received/qty_ordered); COMMIT; exit success
25.908163
97
0.634502
ff416437733d4f2a3fd0e393952944af84d22b8b
357
py
Python
setup.py
fkmclane/armagetron.py
3e033b6c7cfd2f7509de27ab6945eb02f0493c68
[ "MIT" ]
null
null
null
setup.py
fkmclane/armagetron.py
3e033b6c7cfd2f7509de27ab6945eb02f0493c68
[ "MIT" ]
null
null
null
setup.py
fkmclane/armagetron.py
3e033b6c7cfd2f7509de27ab6945eb02f0493c68
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 from setuptools import setup, find_packages setup( name='armagetron.py', version='0.0.1', description='a scripting library for Armagetron Advanced', license='MIT', url='https://github.com/fkmclane/armagetron.py', author='Foster McLane', author_email='fkmclane@gmail.com', packages=find_packages(), )
23.8
62
0.694678
79b09321894b1856b6fdb79f4fa4fc7a858d3694
56
cpp
C++
engine/SkinAnim.cpp
shanysheng/orange3d
9ee081a98e14fdeb3aaafd6bbb49fe027d4cd3c0
[ "BSD-2-Clause" ]
11
2017-06-06T17:22:30.000Z
2022-03-23T11:56:49.000Z
engine/SkinAnim.cpp
shanysheng/orange3d
9ee081a98e14fdeb3aaafd6bbb49fe027d4cd3c0
[ "BSD-2-Clause" ]
null
null
null
engine/SkinAnim.cpp
shanysheng/orange3d
9ee081a98e14fdeb3aaafd6bbb49fe027d4cd3c0
[ "BSD-2-Clause" ]
5
2018-02-07T02:48:59.000Z
2021-08-23T05:16:59.000Z
#include "SkinAnim.h" namespace pipeline { }
8
21
0.589286
239bde87fbbed7655436b2b071a182562305b13a
1,965
js
JavaScript
contracts/validator/migrations/2_validators.js
GovTechSG/private-network
e31be1090a72e02d21245d0797e66e3b55001e53
[ "Apache-2.0" ]
4
2018-04-26T17:08:04.000Z
2021-02-12T14:06:23.000Z
contracts/validator/migrations/2_validators.js
GovTechSG/private-network
e31be1090a72e02d21245d0797e66e3b55001e53
[ "Apache-2.0" ]
2
2018-01-25T02:42:45.000Z
2018-01-27T06:14:00.000Z
contracts/validator/migrations/2_validators.js
GovTechSG/private-network
e31be1090a72e02d21245d0797e66e3b55001e53
[ "Apache-2.0" ]
3
2018-11-01T19:15:51.000Z
2020-08-06T07:29:07.000Z
const OuterSet = artifacts.require("./OuterSet.sol"); const InnerSetInitial = artifacts.require("./InnerSetInitial.sol"); const InnerMajoritySet = artifacts.require("./InnerMajoritySet"); const AddressVotes = artifacts.require("./libraries/AddressVotes.sol"); const genesisOuterSetAddress = "0x0000000000000000000000000000000000000005"; const parityInitialValidators = [ "0xfC4C1475C4DaBfcBB49dc2138337F9db8eedfF58", "0xa2557aB1F214600A7AD1fA12fCad0C97135eeEA6", "0x442290b65483DB5F2520b1E8609Bd3e47fd3F3C4" ]; function deployInnerMajoritySet(deployer, outerSetAddress, initialPending) { return deployer .deploy(AddressVotes) .then(() => deployer.link(AddressVotes, InnerMajoritySet)) .then(() => deployer.deploy(InnerMajoritySet, outerSetAddress, initialPending) ) .then(() => OuterSet.at(outerSetAddress)) .then(instance => instance.setInner(InnerMajoritySet.address)); } // In a development environment, we need to deploy `OuterSet` manually. // `InnerSetInitial` can be skipped async function deployDevelopment(deployer, _network, accounts) { await deployer // Arbitrary decision to use only three accounts. Otherwise we will run out of gas. .deploy(InnerSetInitial, accounts.slice(0, 3), 3) .then(() => deployer.deploy(OuterSet, InnerSetInitial.address, 0)) .then(() => OuterSet.deployed()) .then(() => deployInnerMajoritySet(deployer, OuterSet.address, accounts.slice(0, 3)) ); } async function deployParity(deployer, _network, _accounts) { await deployInnerMajoritySet( deployer, genesisOuterSetAddress, parityInitialValidators ); } const networkDeployers = { development: deployDevelopment, docker_ci: deployDevelopment, parity_master: deployParity, parity_authority1: () => {}, parity_authority2: () => {}, parity_authority3: () => {} }; module.exports = (deployer, network, accounts) => { networkDeployers[network](deployer, network, accounts); };
33.87931
87
0.743003
95e97782f9c70941c2c5763f56e003afa553efc2
9,903
rb
Ruby
web/config/seee_config.rb
breunigs/gnt-eval
c24e9935b9a4e50ef7a4d6295c967cfe8873c173
[ "0BSD" ]
10
2015-02-13T09:38:13.000Z
2020-11-02T17:02:26.000Z
web/config/seee_config.rb
breunigs/gnt-eval
c24e9935b9a4e50ef7a4d6295c967cfe8873c173
[ "0BSD" ]
2
2017-03-21T20:08:29.000Z
2017-07-06T09:13:17.000Z
web/config/seee_config.rb
breunigs/gnt-eval
c24e9935b9a4e50ef7a4d6295c967cfe8873c173
[ "0BSD" ]
null
null
null
# encoding: utf-8 ######################################################################## # HOW 2 CONFIG ######################################################################## # This is the default configuration file, which is checked into the # repository. It will load the system and user configuration files, if # they exist, from the following locations: system_config = "/etc/gnt-eval-seee.rb" user_config = "~/.gnt-eval-seee.rb" # The user’s one takes precedence over the system wide one which takes # precedence over this default file. Here’s a skeleton to start your own # configuration file: # # module Seee # module Config # @@custom_builds.merge!({ # :some_setting => "jasper ist doof", # note the comma! # :some_other_setting => "stefan ist doof" # }) # @@application_paths.merge!({ # :some_setting => "oliver/ist/doof" # }) # @@external_database.merge!({ # }) # @@settings.merge!({ # }) # @@file_paths.merge!({ # }) # @@commands.merge!({ # }) # end # end ######################################################################## require 'rails/all' require 'pathname' if not defined?(RAILS_ROOT) RAILS_ROOT = File.join(File.dirname(__FILE__), "..") end module Seee module Config mattr_accessor :application_paths, :file_paths, :commands, :external_database, :settings, :custom_builds # paths for custom-ImageMagick/RMagick builds @@custom_builds = { # subfolder to save all build-related stuff to :dir => File.join(RAILS_ROOT, "..", "custom_build"), } @@custom_builds.merge!({ # paths to the sources. The * saves us from having to change the # config on upstream updates :src_img_magick => File.join(@@custom_builds[:dir], "ImageMagick*"), :src_r_magick => File.join(@@custom_builds[:dir], "RMagick*"), :src_zbar => File.join(@@custom_builds[:dir], "zbarimg_hackup/zbar-0.10"), # defines the paths where the builds should be installed to. This should # not match on the * from above. :bld_img_magick => File.join(@@custom_builds[:dir], "build_imagemagick"), :bld_r_magick => File.join(@@custom_builds[:dir], "build_rmagick"), :bld_zbar => File.join(@@custom_builds[:dir], "build_zbar"), }) @@custom_builds.merge!({ # contains the path to the custom RMagick.rb if it has been built. It's # nil otherwise. While this is not actually a pref, it seems to be in a # good place. :rmagick_rb => Dir.glob(File.join(@@custom_builds[:bld_r_magick], "**", "RMagick.rb"), File::FNM_DOTMATCH)[0], # see also: @@file_paths[:rmagick] }) @@application_paths = { :hunspell => 'hunspell', :pdflatex => 'pdflatex', # point this to the script you use to import pages as 2-sided tif # images. Either name them ".tif" (NOT tif_f_) if you want them to # be recognized or send patches :) :scan => File.join(RAILS_ROOT, '..', 'tools', "scan.sh"), # point this to the script that can be used to print forms. It # should accept file paths to PDF files to print and be non- # interactive if --non-interactive is given on the command line. # If no arguments are given, have it print files in tmp/forms/*pdf # that do not start with " multiple" (note the leading space). :print => File.join(RAILS_ROOT, '..', 'tools', 'print_forms_locally.rb'), # Point this to your preferred PDF Viewer. It is recommended to # choose one which can detect if it is already showing the same # image instead of opening it again as well as detect changes to # the source file. :pdf_viewer => "evince", # this is the old zbar, which uses the default ImageMagick :zbar_shared => File.join(RAILS_ROOT, '..', 'tools', "zbarimg_#{`uname -m`.strip}"), # this is the custom zbar, which uses the custom ImageMagick :zbar_cust => File.join(@@custom_builds[:bld_zbar], "bin", "zbarimg") } @@application_paths.merge!({ # prefer own zbar over the default one :zbar => File.exists?(@@application_paths[:zbar_cust]) \ ? @@application_paths[:zbar_cust] \ : @@application_paths[:zbar_shared], }) # external database (i.e. not the Rails one) which stores the real eval data @@external_database = { :dbi_handler => 'Pg', :username => 'gnt-eval', :password => 'gnt-eval', :database => 'results' } @@settings = { # default recipient's FQDN :standard_mail_domain => 'some.domain.name.asdf', :standard_mail_from => 'evaluation@some.domain.name.asdf', :standard_mail_bcc => 'evaluation@some.domain.name.asdf', # who is responsible for the resulting PDF files? _headline will # be displayed at the title page, _pdf will be put into PDF meta # data. :author_page_headline => "Universität Heidelberg\\\\Fachschaft MathPhys", :author_pdf => "Fachschaft MathPhys, Universität Heidelberg", # defines how many sheets need to be handed in before a course or # tutor gets an evaluation. Otherwise a sheet might be matched to # the person who filled it in, destroying anonymity. :minimum_sheets_required => 5, # Set the default locale that will be used for the result PDFs. If # no locale is given on the command line, courses will be printed # in their selected language and all other pieces of text in the # language below. :default_locale => :en, # how many sheets should be printed when running emergency print :emergency_printing_amount => 50 } @@file_paths = { # Specify a directory where to cache things :cache_tmp_dir => '/tmp/seee/', # directory to store the extracted comment images in. Each term # has its own subfolder, which will be created automatically. :comment_images_public_dir => File.join(RAILS_ROOT, "public", "comments"), # Same directory as above, but available via http :comment_images_public_link => "http://localhost:3000/comments", # public URL to the seee web gui. It’s required in order to # generate the correct links on the cover sheets. :web_gui_public_link => "http://localhost:3000/", # the directory where the final form pdf files will be stored. # this location will be printed below each howto, in case additional # sheets need to be printed. :forms_howto_dir => File.join(RAILS_ROOT, "..", "tmp", "forms"), :texmfdir => File.join(RAILS_ROOT, '..', 'tex', 'bogen'), :hunspell_personal_dic => File.join(RAILS_ROOT, "app", "lib", "persdic.dic"), :scanned_pages_dir => File.join(RAILS_ROOT, "..", "tmp", "scanned"), :sorted_pages_dir => File.join(RAILS_ROOT, "..", "tmp", "images"), # prefer the custom RMagick version over the default one. Its meant # to be used for "require" and should automatically fall back to # default if custom build is not available. :rmagick => @@custom_builds[:rmagick_rb] || "RMagick" } # Ask /usr/bin/env for unconfigured/unspecified paths def @@application_paths.default(key=nil) if not key.nil? "/usr/bin/env #{key.to_s}" else nil end end # special commands which might be access right depended, i.e. # anything that is more than an “application_path” @@commands = { :cp_comment_image_directory => 'cp', :mkdir_comment_image_directory => 'mkdir', :hunspell => "#{@@application_paths[:hunspell]} -t -l -d en_US,de_DE -p #{@@file_paths[:hunspell_personal_dic]}", :aspell => "#{@@application_paths[:aspell]} -t -d de_DE-neu list | #{@@application_paths[:aspell]} -t -d en list", :pdflatex => "TEXMFHOME=#{@@file_paths[:texmfdir]} #{@@application_paths[:pdflatex]}", :xelatex => "#{@@application_paths[:xelatex]} -halt-on-error -file-line-error -interaction=nonstopmode", # disable unused barcodes and disable scanning in x-direction to speed up processing. :zbar => "#{@@application_paths[:zbar]} --set ean13.disable=1 --set upce.disable=1 --set isbn10.disable=1 --set upca.disable=1 --set isbn13.disable=1 --set i25.disable=1 --set code39.disable=1 --set code128.disable=1 --set y-density=4 --set x-density=0 " } @@commands.merge!({ # scan every line to hopefully find more barcodes :zbar_desperate => "#{@@commands[:zbar]} --set y-density=1 ", # -halt-on-error: stops TeX after the first error # -file-line-error: displays file and line where the error occured # -draftmode: doesn't create PDF, which speeds up TeX. Still does # syntax-checking and toc-creation # -interaction=nonstopmode prevents from asking for stuff on the # console which regularily occurs for missing packages :pdflatex_fast => "#{@@commands[:pdflatex]} -halt-on-error -file-line-error -draftmode -interaction=nonstopmode", :pdflatex_real => "#{@@commands[:pdflatex]} -halt-on-error -file-line-error" }) # fall back to application_paths if a command # hasn't been configured/is unspecified def @@commands.default(key=nil) @@application_paths[key] end end end # Load configuration files from other directories. system_config = File.expand_path(system_config) load system_config if File.exist? system_config begin user_config = File.expand_path(user_config) load user_config if File.exist? user_config rescue # If you get this error, it probably means that expand path failed # because either the path invalid (e.g. unescaped tildes that cannot # be expanded) or no home directory is set. The latter is usually true # if gnt-eval is run from Apache. end # some commonly used shorthands Scc = Seee::Config.commands SCed = Seee::Config.external_database
41.2625
260
0.644653
4cfe7f4be6448765aa10e9998f0006734390b17d
2,222
swift
Swift
BlockEQ/Extensions/UIAlertController+Prompts.swift
aircredit/stellar-ios-wallet
70fc0a956b93113709660aab5b8cdeb95c2a5aaf
[ "MIT" ]
37
2018-03-19T00:04:15.000Z
2021-02-15T17:09:04.000Z
BlockEQ/Extensions/UIAlertController+Prompts.swift
aircredit/stellar-ios-wallet
70fc0a956b93113709660aab5b8cdeb95c2a5aaf
[ "MIT" ]
31
2018-03-28T16:35:48.000Z
2019-11-11T18:04:09.000Z
BlockEQ/Extensions/UIAlertController+Prompts.swift
aircredit/stellar-ios-wallet
70fc0a956b93113709660aab5b8cdeb95c2a5aaf
[ "MIT" ]
16
2018-04-26T02:08:43.000Z
2021-09-18T03:34:22.000Z
// // UIAlertController+Prompts.swift // BlockEQ // // Created by Nick DiZazzo on 2018-09-28. // Copyright © 2018 BlockEQ. All rights reserved. // extension UIAlertController { static func simpleAlert(title: String, message: String?, presentingViewController: UIViewController) { callbackAlert(title: title, message: message, presentingViewController: presentingViewController, handler: nil) } static func callbackAlert(title: String, message: String?, presentingViewController: UIViewController, handler: ((UIAlertAction) -> Void)?) { let controller = UIAlertController.init(title: title, message: message, preferredStyle: .alert) let action = UIAlertAction(title: "GENERIC_OK_TEXT".localized(), style: .default, handler: handler) controller.addAction(action) presentingViewController.present(controller, animated: true, completion: nil) } static func prompt(title: String, message: String?, handler: @escaping (UIAlertController) -> Void, presentingViewController: UIViewController, placeholder: String? = nil, okText: String? = "GENERIC_OK_TEXT".localized(), cancelText: String? = "CANCEL_ACTION".localized(), secureText: Bool = false ) { let controller = UIAlertController.init(title: title, message: message, preferredStyle: .alert) let cancelAction = UIAlertAction(title: cancelText, style: .cancel, handler: nil) let okAction = UIAlertAction(title: okText, style: .default, handler: { _ in handler(controller) }) controller.addAction(okAction) controller.addAction(cancelAction) controller.addTextField { field in field.placeholder = placeholder field.autocorrectionType = .no field.autocapitalizationType = .none field.isSecureTextEntry = secureText } presentingViewController.present(controller, animated: true, completion: nil) } }
42.730769
119
0.619712
437cec53485a3208bc94a457aee6475f7fb04be3
1,525
ts
TypeScript
frontend/src/utils/userUtils.ts
VidroX/Safegistics
b177885d859f7b3524476ba6dd50bab41e6f0be6
[ "Apache-2.0" ]
null
null
null
frontend/src/utils/userUtils.ts
VidroX/Safegistics
b177885d859f7b3524476ba6dd50bab41e6f0be6
[ "Apache-2.0" ]
null
null
null
frontend/src/utils/userUtils.ts
VidroX/Safegistics
b177885d859f7b3524476ba6dd50bab41e6f0be6
[ "Apache-2.0" ]
null
null
null
import {UserPayload} from "../interfaces/user"; import {User} from "../interfaces/appState"; export const UserTypes = { UNKNOWN: -1, DEFAULT: 0, DRIVER: 1, DEVICE: 2, }; export const isUserPayloadValid = (localUser: UserPayload): boolean => { return localUser.id != null && localUser.email != null && localUser.is_staff != null; }; export const canOpenLink = (user: User, id: string | null = null) => { if (id != null) { return user != null && user.isActive && user.id != null && user.id === id; } return user != null && user.isActive && user.id != null; }; export const canAdminOpenLink = (user: User, id: string | null = null) => { if (id != null) { return user != null && user.isActive && user.id != null && (user.id === id || user.isStaff); } return user != null && user.isActive && user.isStaff && user.id != null; }; export const canServerAdminOpenLink = (user: UserPayload, id: string | null = null) => { if (id != null) { return user != null && user.id != null && (user.id === id || user.is_staff); } return user != null && user.is_staff && user.id != null; }; export const getParsedUserType = (userType?: string): number | null => { if (!userType) { return UserTypes.UNKNOWN; } switch (userType) { case "BaseUserModel.UserModel": { return UserTypes.DEFAULT; } case "BaseUserModel.DriverModel": { return UserTypes.DRIVER; } } return null; };
27.727273
100
0.580328
6643ed4fc5811a98b0c47b31591c3609583e53fa
2,834
py
Python
tests/test_questions/test_likert_question.py
vahndi/quant-survey
1a0fcf0c22e2c7306cba0218f82d24c97d28ee1f
[ "MIT" ]
2
2021-04-10T21:50:36.000Z
2022-03-26T16:46:52.000Z
tests/test_questions/test_likert_question.py
vahndi/quant-survey
1a0fcf0c22e2c7306cba0218f82d24c97d28ee1f
[ "MIT" ]
11
2020-08-30T18:47:14.000Z
2021-09-09T15:57:19.000Z
tests/test_questions/test_likert_question.py
vahndi/quant-survey
1a0fcf0c22e2c7306cba0218f82d24c97d28ee1f
[ "MIT" ]
null
null
null
from numpy import array from pandas import DataFrame, Series from unittest.case import TestCase from probability.distributions import Beta from tests.test_questions.question_factories import make_likert_question class TestLikertQuestion(TestCase): def setUp(self) -> None: self.question = make_likert_question() def test_count(self): self.assertEqual(15, self.question.count()) self.assertEqual(2, self.question.count('1 - strongly disagree')) self.assertEqual(6, self.question.count(['1 - strongly disagree', '2 - disagree'])) def test_value_counts(self): self.assertTrue(Series({ '1 - strongly disagree': 2, '2 - disagree': 4, '3 - neither agree nor disagree': 6, '4 - agree': 0, '5 - strongly agree': 3 }).equals(self.question.value_counts())) self.assertTrue(Series({ '1 - strongly disagree': 2, }).equals(self.question.value_counts('1 - strongly disagree'))) self.assertTrue(Series({ '1 - strongly disagree': 2, '2 - disagree': 4, }).equals(self.question.value_counts(['1 - strongly disagree', '2 - disagree']))) def test_distribution_table__no_significance(self): expected = DataFrame(data=[ ('1 - strongly disagree', 2), ('2 - disagree', 4), ('3 - neither agree nor disagree', 6), ('4 - agree', 0), ('5 - strongly agree', 3) ], columns=['Value', 'Count']) actual = self.question.distribution_table() self.assertTrue(expected.equals(actual)) def test_distribution_table__significance(self): a = array([2, 4, 6, 0, 3]) n = a.sum() b = n - a a_others = array([ (a.sum() - a[i]) / (len(a) - 1) for i in range(len(a)) ]) b_others = n - a_others expected = DataFrame(data=[ ('1 - strongly disagree', a[0], Beta(1 + a[0], 1 + b[0]) > Beta(1 + a_others[0], 1 + b_others[0])), ('2 - disagree', a[1], Beta(1 + a[1], 1 + b[1]) > Beta(1 + a_others[1], 1 + b_others[1])), ('3 - neither agree nor disagree', a[2], Beta(1 + a[2], 1 + b[2]) > Beta(1 + a_others[2], 1 + b_others[2])), ('4 - agree', a[3], Beta(1 + a[3], 1 + b[3]) > Beta(1 + a_others[3], 1 + b_others[3])), ('5 - strongly agree', a[4], Beta(1 + a[4], 1 + b[4]) > Beta(1 + a_others[4], 1 + b_others[4])) ], columns=['Value', 'Count', 'Significance']) actual = self.question.distribution_table(significance=True) self.assertTrue(expected.equals(actual))
36.805195
80
0.528582
c84518cfc28d1af8d330a091002a598fe85e5617
93
sh
Shell
k8s-deploy/app/bin/deploy-environment.sh
fuadajip/ship
bc8106d7880476f4cf56417cac1487347bbe5425
[ "MIT" ]
1
2021-04-21T17:58:52.000Z
2021-04-21T17:58:52.000Z
k8s-deploy/app/bin/deploy-environment.sh
fuadajip/ship
bc8106d7880476f4cf56417cac1487347bbe5425
[ "MIT" ]
null
null
null
k8s-deploy/app/bin/deploy-environment.sh
fuadajip/ship
bc8106d7880476f4cf56417cac1487347bbe5425
[ "MIT" ]
null
null
null
#!/usr/bin/env bash helm upgrade --install environment-release ./environment --namespace app
31
72
0.774194
8352ec734b76edf713f816b827b5b8e29597b13c
18,900
tsx
TypeScript
src/components/integrations/__tests__/WithMoveValidation.test.tsx
ildar-icoosoft/react-chessboard
2374e6090129c57252dd25d4a447c65ddca3f733
[ "MIT" ]
2
2020-09-15T01:52:32.000Z
2021-05-09T00:36:10.000Z
src/components/integrations/__tests__/WithMoveValidation.test.tsx
ildar-icoosoft/react-chessboard
2374e6090129c57252dd25d4a447c65ddca3f733
[ "MIT" ]
22
2020-06-03T21:53:40.000Z
2022-03-26T20:02:58.000Z
src/components/integrations/__tests__/WithMoveValidation.test.tsx
ildar-icoosoft/react-chessboard
2374e6090129c57252dd25d4a447c65ddca3f733
[ "MIT" ]
null
null
null
import TestRenderer from "react-test-renderer"; import React from "react"; import { WithMoveValidation, WithMoveValidationCallbackProps, } from "../WithMoveValidation"; import { Position } from "../../../interfaces/Position"; import { PieceCode } from "../../../enums/PieceCode"; import { render } from "@testing-library/react"; import "@testing-library/jest-dom/extend-expect"; import { INITIAL_BOARD_FEN, INITIAL_BOARD_POSITION, } from "../../../constants/constants"; import { ValidMoves } from "../../../types/ValidMoves"; import { PromotionChoice } from "../PromotionChoice"; // we need this for Audio.play() // @see https://github.com/jsdom/jsdom/issues/2155 // @ts-ignore window.HTMLMediaElement.prototype.play = () => { /* do nothing */ }; const initialFen: string = "8/4p3/8/5k2/8/3p4/4PP2/4K3 w KQkq - 0 1"; const checkmateFen: string = "4k3/4Q3/4K3/8/8/8/8/8 b - - 0 1"; const prePromotionFen: string = "k7/4P3/4K3/8/8/8/8/8 w - - 0 1"; const prePromotionPosition: Position = { a8: PieceCode.BLACK_KING, e7: PieceCode.WHITE_PAWN, e6: PieceCode.WHITE_KING, }; const promotionPosition: Position = { a8: PieceCode.BLACK_KING, e8: PieceCode.WHITE_BISHOP, e6: PieceCode.WHITE_KING, }; const initialPosition: Position = { e2: PieceCode.WHITE_PAWN, f2: PieceCode.WHITE_PAWN, e1: PieceCode.WHITE_KING, f5: PieceCode.BLACK_KING, e7: PieceCode.BLACK_PAWN, d3: PieceCode.BLACK_PAWN, }; const initialPositionValidMoves: ValidMoves = { e1: ["d2", "f1", "d1", "g1", "c1"], e2: ["e3", "e4", "d3"], f2: ["f3", "f4"], }; // 1. e2-e4 const positionAfterFirstMove: Position = { e4: PieceCode.WHITE_PAWN, f2: PieceCode.WHITE_PAWN, e1: PieceCode.WHITE_KING, f5: PieceCode.BLACK_KING, e7: PieceCode.BLACK_PAWN, d3: PieceCode.BLACK_PAWN, }; const positionAfterFirstMoveValidMoves: ValidMoves = { f5: ["e6", "f6", "g6", "g5", "g4", "f4", "e4", "e5"], }; const renderWithMoveValidation = ( fen?: string, playerVsCompMode: boolean = false ) => { let callbackProps: WithMoveValidationCallbackProps; const testRenderer = TestRenderer.create( <WithMoveValidation initialFen={fen} playerVsCompMode={playerVsCompMode}> {(props) => { callbackProps = props; return null; }} </WithMoveValidation> ); const testInstance = testRenderer.root; return { getProps() { return callbackProps; }, testRenderer, testInstance, }; }; jest.useFakeTimers(); describe("WithMoveValidation", () => { describe("children components", () => { it("contains 1 PromotionChoice", () => { const { testInstance } = renderWithMoveValidation(); expect(testInstance.findAllByType(PromotionChoice).length).toBe(1); }); }); describe("children components props", () => { it("PromotionChoice", () => { const { testInstance, getProps } = renderWithMoveValidation( prePromotionFen, true ); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); const promotionChoice: TestRenderer.ReactTestInstance = testInstance.findByType( PromotionChoice ); expect(props.position).toEqual(prePromotionPosition); expect(promotionChoice.props.showPromotionChoice).toBe(false); expect(promotionChoice.props.turnColor).toBe("white"); TestRenderer.act(() => { props.onMove({ from: "e7", to: "e8", }); }); props = getProps(); expect(props.position).toEqual(prePromotionPosition); expect(promotionChoice.props.showPromotionChoice).toBe(true); expect(promotionChoice.props.turnColor).toBe("white"); TestRenderer.act(() => { promotionChoice.props.onPromotion("b"); }); props = getProps(); expect(props.position).toEqual(promotionPosition); expect(promotionChoice.props.showPromotionChoice).toBe(false); expect(promotionChoice.props.turnColor).toBe("black"); // invalid move. do nothing TestRenderer.act(() => { promotionChoice.props.onPromotion("b"); }); props = getProps(); expect(props.position).toEqual(promotionPosition); expect(promotionChoice.props.showPromotionChoice).toBe(false); expect(promotionChoice.props.turnColor).toBe("black"); //do computer move after 3 seconds TestRenderer.act(() => { jest.advanceTimersByTime(3000); }); props = getProps(); expect(props.position).not.toEqual(promotionPosition); expect(props.lastMoveSquares).not.toEqual(["e7", "e8"]); expect(props.turnColor).toBe("white"); }); }); describe("callback props", () => { describe("props.children()", () => { it("must be called immediately", () => { const childrenCallback = jest.fn(); TestRenderer.create( <WithMoveValidation> {(props) => { childrenCallback(props); return null; }} </WithMoveValidation> ); expect(childrenCallback).toBeCalled(); }); it("props.children({position}) if has not initialPosition prop", () => { const { getProps } = renderWithMoveValidation(); const props = getProps(); expect(props).toEqual( expect.objectContaining({ position: INITIAL_BOARD_POSITION, }) ); }); it("props.children({position}) if has initialPosition prop", () => { const { getProps } = renderWithMoveValidation(initialFen); const props = getProps(); expect(props).toEqual( expect.objectContaining({ position: initialPosition, }) ); }); it("props.children({check: false})", () => { const { getProps } = renderWithMoveValidation(); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); expect(props).toEqual( expect.objectContaining({ check: false, }) ); }); it("props.children({check: true})", () => { const { getProps } = renderWithMoveValidation(checkmateFen); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); expect(props).toEqual( expect.objectContaining({ check: true, }) ); }); it("props.children({turnColor: white})", () => { const { getProps } = renderWithMoveValidation(); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); expect(props).toEqual( expect.objectContaining({ turnColor: "white", }) ); }); it("props.children({turnColor: black})", () => { const { getProps } = renderWithMoveValidation(checkmateFen); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); expect(props).toEqual( expect.objectContaining({ turnColor: "black", }) ); }); it("props.children({viewOnly}) default value", () => { const { getProps } = renderWithMoveValidation(initialFen); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); expect(props).toEqual( expect.objectContaining({ viewOnly: false, }) ); }); it("props.children({viewOnly}) if game is over", () => { const { getProps } = renderWithMoveValidation(checkmateFen); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); expect(props).toEqual( expect.objectContaining({ viewOnly: true, }) ); }); it("props.children({allowMarkers})", () => { const { getProps } = renderWithMoveValidation(); const props = getProps(); expect(props).toEqual( expect.objectContaining({ allowMarkers: true, }) ); }); it("props.children({clickable})", () => { const { getProps } = renderWithMoveValidation(); const props = getProps(); expect(props).toEqual( expect.objectContaining({ clickable: true, }) ); }); it("props.children({draggable})", () => { const { getProps } = renderWithMoveValidation(); const props = getProps(); expect(props).toEqual( expect.objectContaining({ draggable: true, }) ); }); it("props.children({movableColor} playerVsPlayer)", () => { const { getProps } = renderWithMoveValidation(); const props = getProps(); expect(props).toEqual( expect.objectContaining({ movableColor: "both", }) ); }); it("props.children({movableColor} playerVsComp)", () => { const { getProps } = renderWithMoveValidation(undefined, true); const props = getProps(); expect(props).toEqual( expect.objectContaining({ movableColor: "white", }) ); }); it("props.children({validMoves})", () => { const { getProps } = renderWithMoveValidation(initialFen); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); expect(props).toEqual( expect.objectContaining({ validMoves: initialPositionValidMoves, }) ); }); it("props.children({lastMoveSquares}) default values", () => { const { getProps } = renderWithMoveValidation(initialFen); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); expect(props).toEqual( expect.objectContaining({ position: initialPosition, lastMoveSquares: [], }) ); }); describe("props.children({onMove})", () => { it("props.children({onMove}) is a function", () => { const { getProps } = renderWithMoveValidation(); const props = getProps(); expect(props).toEqual( expect.objectContaining({ onMove: expect.any(Function), }) ); }); it("props.children({onMove}) do valid move", () => { const { getProps } = renderWithMoveValidation(initialFen); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); TestRenderer.act(() => { props.onMove({ from: "e2", to: "e4", }); }); props = getProps(); expect(props).toEqual( expect.objectContaining({ position: positionAfterFirstMove, validMoves: positionAfterFirstMoveValidMoves, lastMoveSquares: ["e2", "e4"], }) ); }); it("computer move after props.children({onMove}) in playerVsComp mode", () => { const { getProps } = renderWithMoveValidation(initialFen, true); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); TestRenderer.act(() => { props.onMove({ from: "e2", to: "e4", }); }); props = getProps(); expect(props).toEqual( expect.objectContaining({ position: positionAfterFirstMove, validMoves: positionAfterFirstMoveValidMoves, lastMoveSquares: ["e2", "e4"], turnColor: "black", }) ); TestRenderer.act(() => { jest.advanceTimersByTime(3000); }); props = getProps(); expect(props).toEqual( expect.not.objectContaining({ position: positionAfterFirstMove, validMoves: positionAfterFirstMoveValidMoves, lastMoveSquares: ["e2", "e4"], }) ); expect(props).toEqual( expect.objectContaining({ turnColor: "white", }) ); }); it("props.children({onMove}) do invalid move", () => { const { getProps } = renderWithMoveValidation(initialFen); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); TestRenderer.act(() => { props.onMove({ from: "e2", to: "e5", }); }); props = getProps(); expect(props).toEqual( expect.objectContaining({ position: initialPosition, lastMoveSquares: [], }) ); }); }); describe("props.children({onSetPremove})", () => { it("must call playPremove() if onSetPremove was called", () => { const playPremove = jest.fn(); const cancelPremove = jest.fn(); const { getProps } = renderWithMoveValidation(initialFen, true); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); TestRenderer.act(() => { props.onMove({ from: "e2", to: "e4", }); }); TestRenderer.act(() => { props.onSetPremove( { from: "g1", to: "f3", }, playPremove, cancelPremove ); }); props = getProps(); expect(props).toEqual( expect.objectContaining({ position: positionAfterFirstMove, validMoves: positionAfterFirstMoveValidMoves, lastMoveSquares: ["e2", "e4"], turnColor: "black", }) ); TestRenderer.act(() => { jest.advanceTimersByTime(3000); }); props = getProps(); expect(props).toEqual( expect.not.objectContaining({ position: positionAfterFirstMove, validMoves: positionAfterFirstMoveValidMoves, lastMoveSquares: ["e2", "e4"], }) ); expect(props).toEqual( expect.objectContaining({ turnColor: "white", }) ); TestRenderer.act(() => { jest.advanceTimersByTime(100); }); expect(playPremove).toBeCalledTimes(1); expect(playPremove).toBeCalledWith(); }); it("must not call playPremove() if onUnsetPremove was called", () => { const playPremove = jest.fn(); const cancelPremove = jest.fn(); const { getProps } = renderWithMoveValidation(initialFen, true); let props = getProps(); TestRenderer.act(() => { jest.runAllTimers(); props = getProps(); }); TestRenderer.act(() => { props.onMove({ from: "e2", to: "e4", }); }); TestRenderer.act(() => { props.onSetPremove( { from: "g1", to: "f3", }, playPremove, cancelPremove ); }); props = getProps(); expect(props).toEqual( expect.objectContaining({ position: positionAfterFirstMove, validMoves: positionAfterFirstMoveValidMoves, lastMoveSquares: ["e2", "e4"], turnColor: "black", }) ); TestRenderer.act(() => { props.onUnsetPremove(); }); TestRenderer.act(() => { jest.advanceTimersByTime(3000); }); props = getProps(); expect(props).toEqual( expect.not.objectContaining({ position: positionAfterFirstMove, validMoves: positionAfterFirstMoveValidMoves, lastMoveSquares: ["e2", "e4"], }) ); expect(props).toEqual( expect.objectContaining({ turnColor: "white", }) ); TestRenderer.act(() => { jest.advanceTimersByTime(100); }); expect(playPremove).toBeCalledTimes(0); }); }); it("props.children({width})", () => { const { getProps } = renderWithMoveValidation(); const props = getProps(); expect(props).toEqual( expect.objectContaining({ width: 480, }) ); }); it("props.children({onResize}) is a function", () => { const { getProps } = renderWithMoveValidation(); const props = getProps(); expect(props).toEqual( expect.objectContaining({ onResize: expect.any(Function), }) ); }); it("call props.children({onResize}) must change width prop", () => { const { getProps } = renderWithMoveValidation(); let props = getProps(); expect(props).toEqual( expect.objectContaining({ width: 480, }) ); TestRenderer.act(() => { props.onResize(200); }); props = getProps(); expect(props).toEqual( expect.objectContaining({ width: 200, }) ); TestRenderer.act(() => { props.onResize(100); }); props = getProps(); expect(props).toEqual( expect.objectContaining({ width: 100, }) ); }); }); }); describe("With react-dom", () => { describe("DOM structure", () => { it("must contain children", () => { const { container } = render( <WithMoveValidation initialFen={INITIAL_BOARD_FEN}> {() => <div data-testid="some-children" />} </WithMoveValidation> ); expect(container).toContainHTML( '<div data-testid="some-children"></div>' ); }); }); }); });
26.104972
87
0.516455
e04eb1a66e759b7032300ace5e1e54de5e65c8f3
2,276
go
Go
middlewares.go
samuelmasuy/animalgame
085bd88776b1e66014629bb98b57b772ced36b7d
[ "MIT" ]
null
null
null
middlewares.go
samuelmasuy/animalgame
085bd88776b1e66014629bb98b57b772ced36b7d
[ "MIT" ]
null
null
null
middlewares.go
samuelmasuy/animalgame
085bd88776b1e66014629bb98b57b772ced36b7d
[ "MIT" ]
null
null
null
package main import ( "encoding/json" "io/ioutil" "log" "net/http" "time" "github.com/golang/protobuf/proto" "github.com/gorilla/context" "github.com/samuelmasuy/animalgame/repo" ) // Middlewares func contentTypeHandler(next http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { if r.Header.Get("Content-Type") == "application/json" { context.Set(r, "content-type", "json") defer func() { if err := recover(); err != nil { log.Printf("panic: %+v", err) WriteJsonError(w, ErrInternalServer) } }() } else if r.Header.Get("Content-Type") == "application/octet-stream" { context.Set(r, "content-type", "proto") defer func() { if err := recover(); err != nil { log.Printf("panic: %+v", err) WriteProtoError(w, ErrInternalServer) } }() } else { w.WriteHeader(415) w.Write([]byte("Content-Type header must be set to: 'application/json' or 'application/octet-stream'")) } next.ServeHTTP(w, r) } return http.HandlerFunc(fn) } func bodyHandler(next http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { contentType := context.Get(r, "content-type") if contentType == "proto" { request := repo.ProtoAnimalAnswer{} data, err := ioutil.ReadAll(r.Body) defer r.Body.Close() if err != nil { log.Println(err) WriteProtoError(w, ErrBadRequest) return } if err := proto.Unmarshal(data, &request); err != nil { log.Println("unmarshalling error", err) WriteProtoError(w, ErrBadRequest) return } if next != nil { context.Set(r, "body", request) next.ServeHTTP(w, r) } } else if contentType == "json" { request := &repo.JsonAnimalAnswer{} err := json.NewDecoder(r.Body).Decode(request) defer r.Body.Close() if err != nil { WriteJsonError(w, ErrBadRequest) return } if next != nil { context.Set(r, "body", request) next.ServeHTTP(w, r) } } } return http.HandlerFunc(fn) } func loggingHandler(next http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { t1 := time.Now() next.ServeHTTP(w, r) t2 := time.Now() log.Printf("[%s] %q %v\n", r.Method, r.URL.String(), t2.Sub(t1)) } return http.HandlerFunc(fn) }
23.22449
106
0.634886
851a0f276751ed73933cacd18102746cfe660467
311
cs
C#
src/TeachMeSkills.DotNet.Task18/SortArray.cs
AndrewBynkov/TeachMeSkills-DotNet-Essential
8b670d96ba0f9e8533c3db0fe8a682a900123ae1
[ "MIT" ]
null
null
null
src/TeachMeSkills.DotNet.Task18/SortArray.cs
AndrewBynkov/TeachMeSkills-DotNet-Essential
8b670d96ba0f9e8533c3db0fe8a682a900123ae1
[ "MIT" ]
null
null
null
src/TeachMeSkills.DotNet.Task18/SortArray.cs
AndrewBynkov/TeachMeSkills-DotNet-Essential
8b670d96ba0f9e8533c3db0fe8a682a900123ae1
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TeachMeSkills.DotNet.Task18 { public static class SortArray { public static int[] SortArrays(this int[] arrayNum) { return arrayNum.OrderBy(x => x).ToArray(); } } }
19.4375
59
0.643087
b30e0dce1b514c4be7ff29f80a840eed3eacbf52
2,357
py
Python
tests/rapid_clay_formations_fab/robots/test_pick_station.py
gramaziokohler/rapid_clay_formations_fab
a8f9b32486d83a3e066eaadaa41bd4dab822c1cd
[ "MIT" ]
null
null
null
tests/rapid_clay_formations_fab/robots/test_pick_station.py
gramaziokohler/rapid_clay_formations_fab
a8f9b32486d83a3e066eaadaa41bd4dab822c1cd
[ "MIT" ]
35
2020-10-24T20:22:31.000Z
2022-02-28T13:05:10.000Z
tests/rapid_clay_formations_fab/robots/test_pick_station.py
gramaziokohler/rapid_clay_formations_fab
a8f9b32486d83a3e066eaadaa41bd4dab822c1cd
[ "MIT" ]
2
2020-10-15T09:13:27.000Z
2020-10-27T09:22:03.000Z
from __future__ import absolute_import from __future__ import division from __future__ import print_function import pytest from compas.geometry import Frame from rapid_clay_formations_fab.fab_data import FabricationElement from rapid_clay_formations_fab.robots import PickStation @pytest.fixture def frame_list(): return [ Frame([0, 0, 0], [1, 0, 0], [0, 1, 0]), Frame([1, 0, 0], [1, 0, 0], [0, 1, 0]), Frame([2, 0, 0], [1, 0, 0], [0, 1, 0]), Frame([3, 0, 0], [1, 0, 0], [0, 1, 0]), Frame([4, 0, 0], [1, 0, 0], [0, 1, 0]), ] @pytest.fixture def station1(frame_list): return PickStation( frame_list, elem_height=200, elem_egress_distance=250, ) @pytest.fixture def station2_data(): return { "pick_frames": [ {"point": [0, 1, 0], "xaxis": [1, 0, 0], "yaxis": [0, 1, 0]}, {"point": [0, 2, 0], "xaxis": [1, 0, 0], "yaxis": [0, 1, 0]}, ], "elem_height": 150, "elem_egress_distance": 200, } @pytest.fixture def station2(station2_data): return PickStation.from_data(station2_data) @pytest.fixture def pick_elements(station1, frame_list): kwargs = { "height": station1.elem_height, "egress_frame_distance": station1.elem_egress_distance, } elements = [] for frame in frame_list: elem = FabricationElement(frame, "pick_elem", **kwargs) elements.append(elem) return elements def test_frame_iter(station2_data): station = PickStation.from_data(station2_data) frame_list = station.pick_frames for n in range(12): frame = station._get_next_pick_frame() assert frame == frame_list[n % len(frame_list)] def test_pick_element_generator(station1, pick_elements): assert station1.get_next_pick_elem().location == pick_elements[0].location for _ in range(len(pick_elements) - 1): station1.get_next_pick_elem() assert station1.get_next_pick_elem().location == pick_elements[0].location assert station1.get_next_pick_elem().location == pick_elements[1].location def test_from_data(station2, station2_data): assert station2.elem_height == station2_data["elem_height"] def test_to_from_data(station2_data): station = PickStation.from_data(station2_data) assert station2_data == station.to_data()
27.729412
78
0.657616
f5ebf8fe4ee90cce7462c30acae946b0e45b7562
5,262
css
CSS
public/css/custom.css
franjojosip/Library
ab2297e0818b7248a626abacab74bd3e5c7d2472
[ "MIT" ]
null
null
null
public/css/custom.css
franjojosip/Library
ab2297e0818b7248a626abacab74bd3e5c7d2472
[ "MIT" ]
null
null
null
public/css/custom.css
franjojosip/Library
ab2297e0818b7248a626abacab74bd3e5c7d2472
[ "MIT" ]
null
null
null
html { overflow: scroll; overflow-x: hidden; } .inactiveLink { pointer-events: none; cursor: pointer !important; } ::-webkit-scrollbar { width: 0; background: transparent; } .carousel-item { height: 100vh; background: no-repeat center center scroll; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .carousel-caption h5 { font-size: 2vw; font-family: 'Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif'; text-transform: uppercase; letter-spacing: 2px; } .carousel-caption p { width: 75%; margin: auto; font-family: 'sans-serif'; font-size: 24px; line-height: 1.9; } .navbar-dark .navbar-brand { color: #fff; font-size: 29px; text-transform: uppercase; font-weight: bold; letter-spacing: 3px; } .navbar { background: rgba(0, 0, 0, 0.7); } .navbar-nav { text-align: center; } .nav-link { padding: .2rem 1rem; } .nav-link.active { background: none; color: #f8a379 !important; } .navbar-toggler { padding: 1px 5px; font-size: 18px; line-height: 0.3; background: rgba(0, 0, 0, 0.9); } .navbar>.container { display: block; } .navbar-brand { font-family: 'Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif'; padding-top: 20px; padding-bottom: 20px; width: 100%; text-align: center; } .navbar-brand:hover { color: white !important; } .nav-link { font-size: 18px !important; color: white !important; text-align-last: center; } .active { color: #f8a379 !important; } .nav-link:hover { background: none; color: #f8a379 !important; } .dropdown-menu { margin-top: 10px; background: rgba(0, 0, 0, 0.7); top: 100%; right: 0; margin-left: -20px; } .carousel-fade .carousel-inner .item { opacity: 0; transition-property: opacity; } .carousel-fade .carousel-inner .active { opacity: 1; } .carousel-item.active, .carousel-item .view { height: 50% !important; } .carousel-item.book.active, .carousel-item .book .view { overflow: hidden !important; height: 700px !important; } .carousel { height: 50% !important; } .carousel-inner { height: 50% !important; } @media all and (max-width: 800px) { .carousel-caption { height: 50px !important; } .carousel-caption p { display: none !important; } #about-us { font-size: 35px !important; } #raise-title { padding: 20px !important; font-size: 35px !important; } #raise-description { font-size: 3vw !important; } } @media all and (max-width: 992px) { .carousel-item.book.active, .carousel-item.book .view { overflow: hidden !important; height: 400px !important; } .navbar-brand { padding-top: 0px !important; padding-bottom: 0px !important; } .navbar-toggler { float: right; } .navbar-nav { margin-top: 30px; } .dropdown-menu { width: 200px; margin: 0 auto; background: rgba(0, 0, 0, 0) !important; } } @media all and (max-width: 1450px) { .container-raising { height: 70vh !important; } } .carousel-caption { top: 50%; height: auto; text-align: center; transform: translateY(-50%); bottom: initial; background: rgba(0, 0, 0, 0.8); } #about-us { color: #4d4d4d; margin-top: 20px; margin-bottom: 20px; font-size: 50px; text-align: center; font-family: 'Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif'; } #row-title { font-size: 20px; } .row { padding-bottom: 20px; } .col-10 { padding: 10px; } .col-2 { display: flex; align-items: center; justify-content: center; } .container-raising { height: 60vh; color: white !important; margin-top: 30px; background-image: url('images/raising_future.jpg'); background-position: center; background-repeat: no-repeat; background-size: cover; } #raise-title { color: white; padding: 80px 80px 20px 80px; font-size: 40px; text-align: center; font-family: 'Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif'; } #raise-description { color: white; padding-top: 10px; padding-left: 40px; padding-right: 40px; font-size: min(2vw, 28px); text-align: center; font-family: 'Avantgarde, TeX Gyre Adventor, URW Gothic L, sans-serif'; } .col-12 { padding: 0px; } .footer-basic { padding: 15px 0; background: rgba(0, 0, 0, 0.9); color: #4b4c4d; } .footer-basic ul { padding: 0; list-style: none; text-align: center; font-size: 18px; line-height: 1.6; margin-bottom: 0; } .footer-basic li { padding: 0 10px; } .footer-basic ul a { color: inherit; text-decoration: none; opacity: 0.8; } .footer-basic ul a:hover { opacity: 1; } .footer-basic .social { text-align: center; padding-bottom: 5px; } .footer-basic .social>a { font-size: 24px; width: 40px; height: 40px; line-height: 40px; display: inline-block; text-align: center; border-radius: 50%; border: 1px solid #ccc; margin: 0 8px; color: inherit; opacity: 0.75; } .footer-basic .social>a:hover { opacity: 0.9; } .footer-basic .copyright { margin-top: 15px; text-align: center; font-size: 17px; color: #aaa; margin-bottom: 0; } .w-100-popular { width: 70% !important; height: 75vh; margin: 0 auto; }
15.660714
73
0.641771
e75d1b6e1aa2a5ee55c9993ab0933cce3e390449
433
php
PHP
application/controllers/Rating.php
mirzaRakha28/HealtyPaws
d95dd95fca0fa69d0e599f02805d6405b87c4d3f
[ "Apache-2.0", "MIT" ]
null
null
null
application/controllers/Rating.php
mirzaRakha28/HealtyPaws
d95dd95fca0fa69d0e599f02805d6405b87c4d3f
[ "Apache-2.0", "MIT" ]
null
null
null
application/controllers/Rating.php
mirzaRakha28/HealtyPaws
d95dd95fca0fa69d0e599f02805d6405b87c4d3f
[ "Apache-2.0", "MIT" ]
null
null
null
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Rating extends CI_Controller { public function add_data(){ $data = array( "id_user"=> $_GET["id_user"], "id_dokter"=>$_GET["id_dokter"], "id_participant"=>$_GET["id_participant"], "rating"=>$this->input->post('rating'), ); $this->db->insert("rating", $data); redirect("home/chat"); } }
27.0625
63
0.572748
20ff981b36ab08a6e07dbac0be501c6c56dacb09
1,142
kt
Kotlin
clef-workflow-api/clef-workflow-api-adapter/clef-workflow-api-adapter-shared/src/main/kotlin/io/quee/clef/workflow/api/adapter/shared/query/StoreQueryImpl.kt
Quee-io/clef-workflow
217da218289fbbc1c1460309883d806dc52dc401
[ "Apache-2.0" ]
null
null
null
clef-workflow-api/clef-workflow-api-adapter/clef-workflow-api-adapter-shared/src/main/kotlin/io/quee/clef/workflow/api/adapter/shared/query/StoreQueryImpl.kt
Quee-io/clef-workflow
217da218289fbbc1c1460309883d806dc52dc401
[ "Apache-2.0" ]
6
2020-03-13T12:18:44.000Z
2020-03-27T14:13:31.000Z
clef-workflow-api/clef-workflow-api-adapter/clef-workflow-api-adapter-shared/src/main/kotlin/io/quee/clef/workflow/api/adapter/shared/query/StoreQueryImpl.kt
Quee-io/clef-workflow
217da218289fbbc1c1460309883d806dc52dc401
[ "Apache-2.0" ]
null
null
null
package io.quee.clef.workflow.api.adapter.shared.query import io.quee.api.develop.shared.model.Identity import io.quee.api.develop.shared.model.PageData import io.quee.api.develop.store.StoreQuery import io.quee.clef.workflow.api.adapter.shared.repository.MainRepository import io.quee.clef.workflow.api.adapter.shared.toPageData import org.springframework.data.domain.PageRequest /** * Created By [**Ibrahim Al-Tamimi **](https://www.linkedin.com/in/iloom/)<br></br> * Created At **18**, **Wed Mar, 2020** * Project **clef-workflow** [Quee.IO](https://quee.io/)<br></br> */ open class StoreQueryImpl<I : Identity, E : I>( private val mainRepository: MainRepository<E> ) : StoreQuery<I> { override fun find(uuid: String): I? = mainRepository.findByUuid(uuid) override fun exist(uuid: String): Boolean = mainRepository.existsById(uuid) override fun all(): List<I> = mainRepository.findAll() override fun all(page: Int, size: Int): PageData<I> = mainRepository.findAll(PageRequest.of(page, size)).toPageData() override fun allByUuids(uuids: List<String>): Iterable<I> = mainRepository.findAllById(uuids) }
42.296296
121
0.737303
3b93f28cd547b5a631f792c4fb51482e612cdca6
1,835
dart
Dart
lib/pages/home_page.dart
swaraj961/swaraj.github.io
6c52b9b7f3f264b8f7a9c1ec62eecdba5b074a7d
[ "Apache-2.0" ]
1
2020-05-05T13:46:36.000Z
2020-05-05T13:46:36.000Z
lib/pages/home_page.dart
swaraj961/swaraj.github.io
6c52b9b7f3f264b8f7a9c1ec62eecdba5b074a7d
[ "Apache-2.0" ]
1
2020-05-05T16:15:04.000Z
2020-05-05T16:55:00.000Z
lib/pages/home_page.dart
swaraj961/swaraj961.github.io
6c52b9b7f3f264b8f7a9c1ec62eecdba5b074a7d
[ "Apache-2.0" ]
null
null
null
import 'package:swaraj/config/assets.dart'; import 'package:swaraj/tabs/about_tab.dart'; import 'package:swaraj/tabs/contactme.dart'; import 'package:swaraj/tabs/projects_tab.dart'; import 'package:swaraj/widgets/theme_inherited_widget.dart'; import 'package:flutter/material.dart'; class HomePage extends StatefulWidget { @override _HomePageState createState() => _HomePageState(); } class _HomePageState extends State<HomePage> { int _selectedIndex = 0; static List<Widget> tabWidgets = <Widget>[ AboutTab(), ProjectsTab(), ContactmeTab(), ]; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( actions: <Widget>[ IconButton( icon: ThemeSwitcher.of(context).isDarkModeOn?Icon(Icons.wb_sunny):Image.asset(Assets.moon,height: 20,width: 20,), onPressed: ()=> ThemeSwitcher.of(context).switchDarkMode(), ) ], ), body: Center( child: tabWidgets.elementAt(_selectedIndex), ), bottomNavigationBar: BottomNavigationBar( items: const <BottomNavigationBarItem>[ BottomNavigationBarItem( icon: Icon(Icons.account_circle), title: Text('About'), ), BottomNavigationBarItem( icon: Icon(Icons.mobile_screen_share), title: Text('Projects'), ), BottomNavigationBarItem( icon: Icon(Icons.contact_phone), title: Text('Contact me'), ) ], currentIndex: _selectedIndex, onTap: (index)=> setState(() => _selectedIndex = index), selectedItemColor: Theme.of(context).accentColor, ), ); } }
28.671875
127
0.607629
a312340a4e7f451b75d62a446fe46fe39ef058c7
1,048
tsx
TypeScript
src/components/atoms/Typekit.tsx
kremalicious/blog
601d0277908066b70c2a8029fc6e556600928967
[ "MIT" ]
43
2018-10-07T03:27:31.000Z
2022-01-31T17:54:33.000Z
src/components/atoms/Typekit.tsx
kremalicious/blog
601d0277908066b70c2a8029fc6e556600928967
[ "MIT" ]
590
2018-09-12T22:31:12.000Z
2022-03-31T13:24:13.000Z
src/components/atoms/Typekit.tsx
kremalicious/blog
601d0277908066b70c2a8029fc6e556600928967
[ "MIT" ]
12
2018-10-07T14:50:42.000Z
2021-09-16T22:30:00.000Z
import React from 'react' import { Helmet } from 'react-helmet' const getTypekitScript = () => ( <script> {` (function(d) { var config = { kitId: '${process.env.GATSBY_TYPEKIT_ID}', scriptTimeout: 3000, async: true }, h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s) })(document); `} </script> ) export default function Typekit(): JSX.Element { return ( <Helmet> <link rel="preconnect" href="https://use.typekit.net" /> {getTypekitScript()} </Helmet> ) }
38.814815
515
0.620229
b362e255f88bd3cd37e7ad66e21656c727b380d6
1,459
py
Python
src/audio/voiceCMD.py
GloryChou/Robotics-N
438ecf06140a9df896b66ad58a624eab15535ffb
[ "MIT" ]
null
null
null
src/audio/voiceCMD.py
GloryChou/Robotics-N
438ecf06140a9df896b66ad58a624eab15535ffb
[ "MIT" ]
null
null
null
src/audio/voiceCMD.py
GloryChou/Robotics-N
438ecf06140a9df896b66ad58a624eab15535ffb
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import sys sys.path.append("./voc") from rnaudio import * from bdasr import * from rntuling import * CMD_LST = ["前进","后退","左转","右转","停止"] # 检测语音内容是否为命令 def checkCmd(text): if(CMD_LST.index(text) < 0): return False return True # 执行命令 def exeCmd(cmd): if(CMD_LST.index(text) == 0): # 前进 elif(CMD_LST.index(text) == 1): # 后退 elif(CMD_LST.index(text) == 2): # 左转 elif(CMD_LST.index(text) == 3): # 右转 else: # 停止 # 语音控制流程 if __name__ == '__main__': rna = Rnaudio() # 音频控制模块 asr = BDasr() # 语音识别模块 rnt = Rntuling() # 对话模块 print "******开启语音控制******" while True: # 录音,并获取录音文件 rcd_filename = rna.Record() if(rcd_filename != ""): # 识别录音内容 text = asr.Recognise(rcd_filename) # 删除录音文件 rna.Delete(rcd_filename) # 如果不是命令,则进行对话 if(!checkCmd(text)): # 与图灵机器人对话,获取回复内容 response = rnt.Get_response(text) print response # 语音合成,并获取合成的语音文件 cps_filename = asr.Compose(response) # 播放语音 rna.Play_MP3(cps_filename) # 删除合成的语音文件 rna.Delete(cps_filename) else: # 若是命令,执行机械操作 exeCmd(text) print "******结束语音控制******"
23.918033
53
0.472241
eb3e363a2334b4e41c7ace12f6328c59eadbfeff
354
css
CSS
src/styles/global.css
lodybo/athena
86e977e671303e1ec12a053aea5383c43a7b2635
[ "MIT" ]
null
null
null
src/styles/global.css
lodybo/athena
86e977e671303e1ec12a053aea5383c43a7b2635
[ "MIT" ]
null
null
null
src/styles/global.css
lodybo/athena
86e977e671303e1ec12a053aea5383c43a7b2635
[ "MIT" ]
null
null
null
@tailwind base; @tailwind components; @tailwind utilities; @layer base { h1 { @apply text-2xl; } h2 { @apply text-xl; } h3 { @apply text-lg; } h4 { @apply text-base; } h5 { @apply text-sm; } h6 { @apply text-xs; } } html { box-sizing: border-box; } *, *:before, *:after { box-sizing: inherit; }
9.567568
25
0.525424
1acae67da648ba72ee1a790241863a006aad2065
3,353
py
Python
wqxlib/wqx_v3_0/Telephonic.py
FlippingBinary/wqxlib-python
5aa1d41384928f1faca47d5984485e2efa93174c
[ "MIT" ]
null
null
null
wqxlib/wqx_v3_0/Telephonic.py
FlippingBinary/wqxlib-python
5aa1d41384928f1faca47d5984485e2efa93174c
[ "MIT" ]
null
null
null
wqxlib/wqx_v3_0/Telephonic.py
FlippingBinary/wqxlib-python
5aa1d41384928f1faca47d5984485e2efa93174c
[ "MIT" ]
null
null
null
from yattag import Doc from .SimpleContent import ( TelephoneExtensionNumberText, TelephoneNumberText, TelephoneNumberTypeName, ) class Telephonic: """ An identification of a telephone connection. """ __telephoneNumberText: TelephoneNumberText __telephoneNumberTypeName: TelephoneNumberTypeName __telephoneExtensionNumberText: TelephoneExtensionNumberText def __init__( self, o: dict = None, *, telephoneNumberText: TelephoneNumberText = None, telephoneNumberTypeName: TelephoneNumberTypeName = None, telephoneExtensionNumberText: TelephoneExtensionNumberText = None ): if isinstance(o, Telephonic): # Assign attributes from object without typechecking self.__telephoneNumberText = o.telephoneNumberText self.__telephoneNumberTypeName = o.telephoneNumberTypeName self.__telephoneExtensionNumberText = o.telephoneExtensionNumberText elif isinstance(o, dict): # Assign attributes from dictionary with typechecking self.telephoneNumberText = o.get("telephoneNumberText") self.telephoneNumberTypeName = o.get("telephoneNumberTypeName") self.telephoneExtensionNumberText = o.get("telephoneExtensionNumberText") else: # Assign attributes from named keywords with typechecking self.telephoneNumberText = telephoneNumberText self.telephoneNumberTypeName = telephoneNumberTypeName self.telephoneExtensionNumberText = telephoneExtensionNumberText @property def telephoneNumberText(self) -> TelephoneNumberText: return self.__telephoneNumberText @telephoneNumberText.setter def telephoneNumberText(self, val: TelephoneNumberText) -> None: self.__telephoneNumberText = None if val is None else TelephoneNumberText(val) @property def telephoneNumberTypeName(self) -> TelephoneNumberTypeName: return self.__telephoneNumberTypeName @telephoneNumberTypeName.setter def telephoneNumberTypeName(self, val: TelephoneNumberTypeName) -> None: self.__telephoneNumberTypeName = ( None if val is None else TelephoneNumberTypeName(val) ) @property def telephoneExtensionNumberText(self) -> TelephoneExtensionNumberText: return self.__telephoneExtensionNumberText @telephoneExtensionNumberText.setter def telephoneExtensionNumberText(self, val: TelephoneExtensionNumberText) -> None: self.__telephoneExtensionNumberText = ( None if val is None else TelephoneExtensionNumberText(val) ) def generateXML(self, name: str = "Telephonic") -> str: doc = Doc() line = doc.line tag = doc.tag with tag(name): if self.__telephoneNumberText is not None: line("TelephoneNumberText", self.__telephoneNumberText) if self.__telephoneNumberTypeName is not None: line("TelephoneNumberTypeName", self.__telephoneNumberTypeName) if self.__telephoneExtensionNumberText is not None: line("TelephoneExtensionNumberText", self.__telephoneExtensionNumberText) return doc.getvalue()
39.447059
90
0.691321
9a798b8259d79773d9a64f366a4dee449ac009f0
521
py
Python
src/preprocess/analysis.py
wxy1224/cs224n_project
6dbd7869622565d0eaa3ac7b1dacc569f33d5a18
[ "MIT" ]
1
2018-05-30T16:16:12.000Z
2018-05-30T16:16:12.000Z
src/preprocess/analysis.py
wxy1224/cs224n_project
6dbd7869622565d0eaa3ac7b1dacc569f33d5a18
[ "MIT" ]
7
2020-01-28T22:19:16.000Z
2021-05-21T14:43:03.000Z
src/preprocess/analysis.py
wxy1224/cs224n_project
6dbd7869622565d0eaa3ac7b1dacc569f33d5a18
[ "MIT" ]
null
null
null
import pandas as pd train = pd.read_csv('./input/train.csv') positive_train = train[train['identity_hate']>0] labels = ['toxic', 'severe_toxic', 'obscene', 'threat', 'insult', 'identity_hate'] for label in labels: positive_train = train[train[label] > 0] print( label) print(positive_train.shape) max = 0 max_line = None for i,line in train.iterrows(): length = len(line['comment_text']) if length>max: max =length max_line = line print( 'longest: ', max) print( 'line: ', max_line)
26.05
82
0.662188
2591cb46fb74c136051307f0ce3bb4cfe0fcee2e
1,267
cs
C#
Hospital_ERP_VS13-WCF_WF/AH.INVMS/MODEL/SalesReportRO.cs
atiq-shumon/DotNetProjects
954951ff5c1774e288502bb734a6af86bd2a5f12
[ "Apache-2.0" ]
null
null
null
Hospital_ERP_VS13-WCF_WF/AH.INVMS/MODEL/SalesReportRO.cs
atiq-shumon/DotNetProjects
954951ff5c1774e288502bb734a6af86bd2a5f12
[ "Apache-2.0" ]
null
null
null
Hospital_ERP_VS13-WCF_WF/AH.INVMS/MODEL/SalesReportRO.cs
atiq-shumon/DotNetProjects
954951ff5c1774e288502bb734a6af86bd2a5f12
[ "Apache-2.0" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AH.INVMS.MODEL { public class SalesReportRO { public string Issue_id { set; get; } public string Str_id { set; get; } public string StoreTitle { set; get; } public string DRID { set; get; } public string DeptID { set; get; } public string DeptName { set; get; } public string UnitID { set; get; } public string UnitName { set; get; } public string ItemGroup { set; get; } public string ItemType { set; get; } public string ItemUnit { set; get; } public string ItemName { set; get; } public string ItemCompany { set; get; } public string ItemBrand { set; get; } public string ItemModel { set; get; } public float ReqQty { set; get; } public float IssueQty { set; get; } public float Qty_Over_Pres { set; get; } public float Urate { set; get; } public float Vat { set; get; } public float Disc { set; get; } public string EntryBy { set; get; } public string ENTRY_BY_NAME { set; get; } public DateTime EntryDate { set; get; } } }
34.243243
49
0.595107
6f95c4d7b48de175b3457f039469edf630c81dd4
20,303
sql
SQL
oracle-scripts/Mongolia.sql
oseferi/sql-insert-generator
90ccb958fb66dd0ead88d1e4123922070a199d8b
[ "MIT" ]
1
2020-02-28T11:10:15.000Z
2020-02-28T11:10:15.000Z
oracle-scripts/Mongolia.sql
oseferi/sql-insert-generator
90ccb958fb66dd0ead88d1e4123922070a199d8b
[ "MIT" ]
null
null
null
oracle-scripts/Mongolia.sql
oseferi/sql-insert-generator
90ccb958fb66dd0ead88d1e4123922070a199d8b
[ "MIT" ]
null
null
null
INSERT INTO WWS_COUNTRIES (ID, NAME, ISO3, ISO2, PHONECODE, CAPITAL, CURRENCY, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (146, 'Mongolia', 'MNG', 'MN', '976', 'Ulan Bator', 'MNT', TO_TIMESTAMP('2018-07-20 16:41:03','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-08-02 21:38:23','YYYY-MM-DD HH24:MI:SS'), 1, 'Q711'); INSERT ALL INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1961, 'Bulgan Province', 146, 'MN', '21', '067', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q209774') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1962, 'Darkhan-Uul Province', 146, 'MN', '23', '037', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q18827') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1963, 'Dornod Province', 146, 'MN', '06', '061', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q207795') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1964, 'Khovd Province', 146, 'MN', '12', '043', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q194098') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1965, 'Övörkhangai Province', 146, 'MN', '15', '055', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:43:46','YYYY-MM-DD HH24:MI:SS'),1, 'Q234713') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1966, 'Orkhon Province', 146, 'MN', '25', '035', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q234710') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1967, 'Ömnögovi Province', 146, 'MN', '14', '053', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:43:46','YYYY-MM-DD HH24:MI:SS'),1, 'Q235579') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1968, 'Töv Province', 146, 'MN', '18', '047', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:43:46','YYYY-MM-DD HH24:MI:SS'),1, 'Q276195') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1969, 'Bayan-Ölgii Province', 146, 'MN', '03', '071', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:43:46','YYYY-MM-DD HH24:MI:SS'),1, 'Q191792') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1970, 'Dundgovi Province', 146, 'MN', '08', '059', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q211835') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1971, 'Uvs Province', 146, 'MN', '19', '046', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q192942') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1972, 'Govi-Altai Province', 146, 'MN', '10', '065', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q192945') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1973, 'Arkhangai Province', 146, 'MN', '01', '073', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q207809') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1974, 'Khentii Province', 146, 'MN', '11', '039', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q239040') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1975, 'Khövsgöl Province', 146, 'MN', '13', '041', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:43:46','YYYY-MM-DD HH24:MI:SS'),1, 'Q244788') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1976, 'Bayankhongor Province', 146, 'MN', '02', '069', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q276200') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1977, 'Sükhbaatar Province', 146, 'MN', '17', '051', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:43:46','YYYY-MM-DD HH24:MI:SS'),1, 'Q244804') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1978, 'Govisümber Province', 146, 'MN', '24', '064', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:43:46','YYYY-MM-DD HH24:MI:SS'),1, 'Q236333') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1979, 'Zavkhan Province', 146, 'MN', '09', '057', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q167764') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1980, 'Selenge Province', 146, 'MN', '16', '049', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q234680') INTO WWS_STATES (ID, NAME, COUNTRY_ID, COUNTRY_CODE, FIPS_CODE, ISO2, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (1981, 'Dornogovi Province', 146, 'MN', '07', '063', TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 14:18:45','YYYY-MM-DD HH24:MI:SS'),1, 'Q213272') SELECT * FROM dual; INSERT ALL INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67705, 'Altai', 1972, '065', 146, 'MN', 46.37222000, 96.25833000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q433861') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67706, 'Altay', 1969, '071', 146, 'MN', 48.29359000, 89.51488000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q2593952') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67707, 'Arvayheer', 1965, '055', 146, 'MN', 46.26389000, 102.77500000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q717684') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67708, 'Baruun-Urt', 1977, '051', 146, 'MN', 46.68056000, 113.27917000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q809657') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67709, 'Bayanhongor', 1976, '069', 146, 'MN', 46.19444000, 100.71806000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q804117') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67710, 'Bulgan', 1961, '067', 146, 'MN', 48.81250000, 103.53472000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q945055') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67711, 'Choibalsan', 1963, '061', 146, 'MN', 48.07257000, 114.53264000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q318245') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67712, 'Choyr', 1978, '064', 146, 'MN', 46.36111000, 108.36111000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q642346') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67713, 'Dalandzadgad', 1967, '053', 146, 'MN', 43.57083000, 104.42500000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q822808') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67714, 'Darhan', 1962, '037', 146, 'MN', 49.48667000, 105.92278000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q235571') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67715, 'Dzuunmod', 1968, '047', 146, 'MN', 47.70694000, 106.95278000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q917690') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67716, 'Dzüünharaa', 1980, '049', 146, 'MN', 48.85229000, 106.45786000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:42:10','YYYY-MM-DD HH24:MI:SS'), 1, 'Q917690') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67717, 'Erdenet', 1966, '035', 146, 'MN', 49.03333000, 104.08333000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q230628') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67718, 'Ereencav', 1963, '061', 146, 'MN', 49.88070000, 115.72526000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q230628') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67719, 'Hanh', 1975, '041', 146, 'MN', 51.50265000, 100.66395000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q2607700') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67720, 'Hanhongor', 1967, '053', 146, 'MN', 43.77345000, 104.47998000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q3402358') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67721, 'Harhorin', 1965, '055', 146, 'MN', 47.19753000, 102.82379000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q3402358') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67722, 'Hovd', 1965, '055', 146, 'MN', 44.67024000, 102.17491000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q3402358') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67723, 'Kharkhorin', 1965, '055', 146, 'MN', 47.19245000, 102.81349000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q3402358') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67724, 'Khovd', 1964, '043', 146, 'MN', 48.00556000, 91.64194000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q731256') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67725, 'Mandalgovi', 1970, '059', 146, 'MN', 45.76250000, 106.27083000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q1000373') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67726, 'Murun-kuren', 1975, '041', 146, 'MN', 49.63417000, 100.16250000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q1000373') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67727, 'Möngönmorĭt', 1968, '047', 146, 'MN', 48.19504000, 108.48295000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:42:10','YYYY-MM-DD HH24:MI:SS'), 1, 'Q3403761') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67728, 'Möst', 1964, '043', 146, 'MN', 46.67712000, 92.78521000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:42:10','YYYY-MM-DD HH24:MI:SS'), 1, 'Q10950043') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67729, 'Nariynteel', 1965, '055', 146, 'MN', 45.95950000, 101.45977000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q3402273') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67730, 'Nomgon Sum', 1967, '053', 146, 'MN', 42.41462000, 105.05640000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q3402154') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67731, 'Sühbaatar', 1980, '049', 146, 'MN', 50.23139000, 106.20778000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:42:10','YYYY-MM-DD HH24:MI:SS'), 1, 'Q46319') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67732, 'Tsengel', 1975, '041', 146, 'MN', 49.47833000, 100.88944000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q46319') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67733, 'Tsengel', 1969, '071', 146, 'MN', 48.94314000, 89.14358000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q46319') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67734, 'Tsetserleg', 1973, '073', 146, 'MN', 47.47500000, 101.45417000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q529834') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67735, 'Turt', 1975, '041', 146, 'MN', 51.50725000, 100.66257000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q529834') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67736, 'Ulaangom', 1971, '046', 146, 'MN', 49.98111000, 92.06667000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q822815') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67737, 'Ulaanhudag', 1968, '047', 146, 'MN', 47.33333000, 104.50000000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q822815') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67738, 'Uliastay', 1979, '057', 146, 'MN', 47.74167000, 96.84444000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q943374') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67739, 'Undurkhaan', 1974, '039', 146, 'MN', 47.31944000, 110.65556000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), 1, 'Q297632') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67740, 'Ölgii', 1969, '071', 146, 'MN', 48.96833000, 89.96250000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:42:10','YYYY-MM-DD HH24:MI:SS'), 1, 'Q297060') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67741, 'Üyönch', 1964, '043', 146, 'MN', 46.04786000, 92.02612000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:42:10','YYYY-MM-DD HH24:MI:SS'), 1, 'Q3404181') INTO WWS_CITIES (ID, NAME, STATE_ID, STATE_CODE, COUNTRY_ID, COUNTRY_CODE, LATITUDE, LONGITUDE, CREATED_AT, UPDATED_AT, FLAG, WIKIDATAID) VALUES (67742, 'Зуунмод', 1968, '047', 146, 'MN', 47.70693000, 106.95276000, TO_TIMESTAMP('2019-10-05 15:38:05','YYYY-MM-DD HH24:MI:SS'), TO_TIMESTAMP('2020-03-02 15:42:10','YYYY-MM-DD HH24:MI:SS'), 1, 'Q3404181') SELECT * FROM dual;
294.246377
357
0.714377
ff76295d37f8efe8636f492c20b96a040e32aed4
41
py
Python
postmarker/__init__.py
Canalyst/postmarker
2e43733c0ea1d579fa1f72fddbe6bae93ed99220
[ "MIT" ]
null
null
null
postmarker/__init__.py
Canalyst/postmarker
2e43733c0ea1d579fa1f72fddbe6bae93ed99220
[ "MIT" ]
null
null
null
postmarker/__init__.py
Canalyst/postmarker
2e43733c0ea1d579fa1f72fddbe6bae93ed99220
[ "MIT" ]
null
null
null
# coding: utf-8 __version__ = '0.12.0'
8.2
22
0.609756
6b286bcf69232b88679da30c067eee8c5cab64cc
2,862
js
JavaScript
script.js
guimaraesalves/TopFiveCodewars-mai21-victor
e0be3f905aaf6ab26f55f2e93cbe0f36c24f71c2
[ "MIT" ]
null
null
null
script.js
guimaraesalves/TopFiveCodewars-mai21-victor
e0be3f905aaf6ab26f55f2e93cbe0f36c24f71c2
[ "MIT" ]
null
null
null
script.js
guimaraesalves/TopFiveCodewars-mai21-victor
e0be3f905aaf6ab26f55f2e93cbe0f36c24f71c2
[ "MIT" ]
null
null
null
let ranking = [ { nome: 'Julia Gama', pontos: 126 }, { nome: 'Laudemir', pontos: 0 }, { nome: 'Emanuel Martins', pontos: 112 }, { nome: 'Lucas Elias', pontos: 135 }, { nome: 'Ian kuntz', pontos: 82 }, { nome: 'João Pedro Nonato', pontos: 50 }, { nome: 'Sthéfany Gomes', pontos: 120 }, { nome: 'Rafael Sousa', pontos: 133 }, { nome: 'Wallace Silva', pontos: 281 }, { nome: 'Madu Rubini', pontos: 111 }, { nome: 'Felipe Silveira', pontos: 311 }, { nome: 'Natan dos Santos', pontos: 59 }, { nome: 'Matheus Bueno', pontos: 220, }, { nome: 'Miguel Teruel', pontos: 138 }, { nome: 'Ique Moraes', pontos: 69 }, { nome: 'Nicholas dos Santos', pontos: 57 }, { nome: 'Gabriel Gutierrez', pontos: 192 }, { nome: 'Renato Tateiwa', pontos: 322 }, { nome: 'Glen Escobar', pontos: 218 }, { nome: 'Willian Santos', pontos: 70 }, { nome: 'Mateus Alves', pontos: 215 }, { nome: 'Kaueh Prats', pontos: 76 }, { nome: 'Ricardo Oliveira', pontos: 82 }, { nome: 'Victor Scherer', pontos: 91 }, { nome: 'Natalia Veríssimo', pontos: 0 }, { nome: 'Luciana Nunes', pontos: 60 }, { nome: 'Thiago Trad', pontos: 100 }]; ranking.sort(function (a, b) { if (a.pontos < b.pontos) { return 1; } if (a.pontos > b.pontos) { return -1; } // a must be equal to b return 0; }); //console.log(ranking) let arrTop = [] for (let i = 0; i < 5; i++){ arrTop.push(ranking[i]) } const listas = []; listas[0] = { nome: 'Renato Tateiwa', pontos: 322 }; listas[1] = { nome: 'Felipe Silveira', pontos: 311 }; listas[2] = { nome: 'Wallace Silva', pontos: 281 }; listas[3] = { nome: 'Matheus Bueno', pontos: 220 }; listas[4] = { nome: 'Glen Escobar', pontos: 218 }; const novalista = listas.map(lista => ({ nome: lista.nome, pontos: lista.pontos })) document.getElementById("first").innerHTML = Object.values(arrTop[0]); document.getElementById("second").innerHTML = Object.values(arrTop[1]); document.getElementById("third").innerHTML = Object.values(arrTop[2]); document.getElementById("fourth").innerHTML = Object.values(arrTop[3]); document.getElementById("fifth").innerHTML = Object.values(arrTop[4]); //console.log(Object.values(arrTop[0]));
15.223404
71
0.474144
7da62ba4359ad93e77f0c3351e550e494dda999d
3,161
css
CSS
Source-Code-设客网设计师与设计院作品分享与威客门户网站/User/css/User_Login.css
zoomlacms/web022
cee80b3d479a8249f393896be0cf11e94c482fce
[ "Apache-2.0" ]
2
2020-06-17T01:53:15.000Z
2021-01-20T07:19:52.000Z
Source-Code-设客网设计师与设计院作品分享与威客门户网站/User/css/User_Login.css
zoomlacms/web022
cee80b3d479a8249f393896be0cf11e94c482fce
[ "Apache-2.0" ]
null
null
null
Source-Code-设客网设计师与设计院作品分享与威客门户网站/User/css/User_Login.css
zoomlacms/web022
cee80b3d479a8249f393896be0cf11e94c482fce
[ "Apache-2.0" ]
null
null
null
#userlogin_body { font: normal normal normal 12px/150% Arial, "宋体" ,Helvetica,sans-serif; margin: 0px; margin-top: 110px; padding: 0px; background: url(../Images/user_all_bg.gif) #226cc5 repeat-x top; text-decoration: none; } #user_login, #user_top, #user_main, #user_bottom, #user_login dl, #user_login dd, #user_top, #user_main, #user_bottom, #user_top ul, #user_main ul, #user_bottom ul, #user_top li, #user_main li, #user_bottom li, form { margin: 0px; padding: 0px; } #user_login { margin: 0px auto; width: 590px; } #user_top, #user_main, #user_bottom { clear: both; } #user_top li, #user_main li, #user_bottom li { float: left; list-style-type: none; } /* user_top背景定义 */ .user_top_r { background: url(../Images/user_top_r.gif) no-repeat top; } .user_top_c { background: url(../Images/user_top_c.gif) no-repeat top; } .user_top_l { background: url(../Images/user_top_l.gif) no-repeat top; } /* user_main背景定义 */ .user_main_r { background: url(../Images/user_main_r.gif) #bec5cc no-repeat top; } .user_main_c { background: url(../Images/user_main_c.gif) #bec5cc no-repeat top; width: 280px; } .user_main_l { background: url(../Images/user_main_l.gif) #bec5cc no-repeat top; } /* user_main背景定义 */ .user_bottom_r { background: url(../Images/user_bottom_r.gif) no-repeat top; } .user_bottom_c { background: url(../Images/user_bottom_c.gif) no-repeat top; color: #fff; text-align: right; padding-top: 20px; line-height: 117px; } .user_bottom_c a { color: yellow; text-decoration: underline; } .user_bottom_c a:hover { color: #c00; } .user_bottom_l { background: url(../Images/user_bottom_l.gif) no-repeat top; } /* 三行宽度定义 */ .user_top_r, .user_main_r, .user_bottom_r { width: 180px; float: left; } user_main_c, .user_top_c, .user_bottom_c { width: 280px; float: left; } .user_top_l, .user_main_l, .user_bottom_l { width: 129px; float: left; } /* 三列高度定义 */ .user_top_r, .user_top_c, .user_top_l { height: 116px; } .user_main_r, .user_main_c, .user_main_l { height: 139px; } .user_main_r { line-height: 139px; } .user_bottom_r, .user_bottom_c, .user_bottom_l { height: 117px; } /* 登录框样式 */ .user_main_box, .user_main_box ul, .user_main_box li { margin: 0px; padding: 0px; } .user_main_box ul { clear: both; } .user_main_box li { float: left; list-style-type: none; } .user_main_box .user_main_text, .user_main_box .user_main_input { height: 34px; line-height: 34px; } .user_main_box .user_main_text { width: 60px; color: #000; } .user_main_box .user_main_input img { margin-left: -25px; margin-bottom: -2px; } .TxtUserNameCssClass { background: url(../Images/user_login_name.gif) no-repeat; border: 0px; width: 165px; height: 21px; line-height: 20px; padding-left: 25px; } .TxtPasswordCssClass { background: url(../Images/user_login_password.gif) no-repeat; border: 0px; width: 165px; height: 21px; line-height: 20px; padding-left: 25px; } .TxtValidateCodeCssClass { background: url(../Images/user_login_validatecode.gif) no-repeat; border: 0px; width: 91px; height: 21px; line-height: 20px; padding-left: 25px; ime-mode: disabled; } .IbtnEnterCssClass { width: 111px; height: 122px; }
17.368132
215
0.712749
ef61729da3741ae2d9397e5379583f22f6f8dcd3
273
js
JavaScript
controllers/home.js
prasangbc/hackathon-7-2018
6c20db04f0927942937b08c7b3bbf1305ad0d2cd
[ "MIT" ]
null
null
null
controllers/home.js
prasangbc/hackathon-7-2018
6c20db04f0927942937b08c7b3bbf1305ad0d2cd
[ "MIT" ]
null
null
null
controllers/home.js
prasangbc/hackathon-7-2018
6c20db04f0927942937b08c7b3bbf1305ad0d2cd
[ "MIT" ]
null
null
null
/** * GET / * Home page. */ exports.index = (req, res) => { res.render('home', { title: 'Home' }); }; exports.results = (request, response) => { const { restaurants } = request.body; response.render('results', { restaurants }) }
14.368421
42
0.509158
7b35ecf095b23ae5cd220a92b1312fb92a874572
2,551
rb
Ruby
app/services/zenoss_service.rb
safetymonkey/asq
f1d21b3cd83a177f4976f4e7520eb8d6c7686ab4
[ "MIT" ]
1
2017-03-17T07:26:47.000Z
2017-03-17T07:26:47.000Z
app/services/zenoss_service.rb
safetymonkey/asq
f1d21b3cd83a177f4976f4e7520eb8d6c7686ab4
[ "MIT" ]
166
2017-03-14T16:05:17.000Z
2021-12-31T22:49:13.000Z
app/services/zenoss_service.rb
safetymonkey/asq
f1d21b3cd83a177f4976f4e7520eb8d6c7686ab4
[ "MIT" ]
1
2017-03-14T03:48:31.000Z
2017-03-14T03:48:31.000Z
# Used to build and post Zenoss messages, based on a passed-in Asq object. class ZenossService class << self # The sole way that the outside world interacts with this class. # Returns true if the POST action was successful. Raises an exception # If it doesn't. This is so it can include some error text, which it # can't do if it just returns "false". def post(asq) @asq = asq max_retries = 2 # Why 2? Why not? We can make it a Setting if we want. retries = max_retries while retries > 0 # Broken out into its own method to keep the linter happy. return true if post_successful? retries -= 1 end # If we end up here, then we've run out of retries. raise StandardError,\ "Failed to post #{@asq.name} to Zenoss after "\ "#{max_retries} tries." end protected # Sets the new URL to POST to before returning false. If we want to do it # differently, then the method needs to return something instead of a simple # "false" and the URL modification needs to happen upstream. def post_successful? true if RestClient::Request.execute(request).code == 200 rescue RestClient::Exception => e case e.response.code when 300..308 @current_zenoss_url = e.response.headers[:location] return false end raise StandardError, "HTTP Error #{e.response.code}" end # A request is a property bag, with some values based on some Settings. # Its "payload" property is also a property bag. def request { method: :post, headers: { content_type: :json, accept: :json }, url: @current_zenoss_url ? @current_zenoss_url : Settings.zenoss_url, user: Settings.zenoss_username, password: Settings.zenoss_password, payload: zenoss_payload.to_json } end # A payload is a property bag. Its "data" property is # also a property bag. def zenoss_payload { action: 'EventsRouter', method: 'add_event', type: 'rpc', tid: 1, data: [zenoss_data] } end # This is a property bag, with values based on some @asq properties. def zenoss_data summary = @asq.in_alert? ? 'is in alert.' : 'is clear.' { component: @asq.name, device: Settings.vip_name, summary: "#{@asq.name} #{summary}", severity: @asq.in_alert? ? 'Critical' : 'Clear', evclasskey: 'ASQ', evclass: '/ASQ' } end end end
32.705128
80
0.621325
ff651f22bfd2a2fd73774e38cfb2fad6847e9eaa
15,329
py
Python
spoonacular/com.spoonacular.client.model/__init__.py
Lowe-Man/spoonacular-python-api
c5522abdc2ef48258434e22b4f2038d64bcebd86
[ "MIT" ]
21
2019-08-09T18:53:26.000Z
2022-03-14T22:10:10.000Z
spoonacular/com.spoonacular.client.model/__init__.py
Lowe-Man/spoonacular-python-api
c5522abdc2ef48258434e22b4f2038d64bcebd86
[ "MIT" ]
null
null
null
spoonacular/com.spoonacular.client.model/__init__.py
Lowe-Man/spoonacular-python-api
c5522abdc2ef48258434e22b4f2038d64bcebd86
[ "MIT" ]
55
2019-08-13T17:52:47.000Z
2022-03-27T04:29:34.000Z
# coding: utf-8 # flake8: noqa """ spoonacular API The spoonacular Nutrition, Recipe, and Food API allows you to access over 380,000 recipes, thousands of ingredients, 800,000 food products, and 100,000 menu items. Our food ontology and semantic recipe search engine makes it possible to search for recipes using natural language queries, such as \"gluten free brownies without sugar\" or \"low fat vegan cupcakes.\" You can automatically calculate the nutritional information for any recipe, analyze recipe costs, visualize ingredient lists, find recipes for what's in your fridge, find recipes based on special diets, nutritional requirements, or favorite ingredients, classify recipes into types and cuisines, convert ingredient amounts, or even compute an entire meal plan. With our powerful API, you can create many kinds of food and especially nutrition apps. Special diets/dietary requirements currently available include: vegan, vegetarian, pescetarian, gluten free, grain free, dairy free, high protein, whole 30, low sodium, low carb, Paleo, ketogenic, FODMAP, and Primal. # noqa: E501 The version of the OpenAPI document: 1.0 Contact: mail@spoonacular.com Generated by: https://openapi-generator.tech """ from __future__ import absolute_import # import models into model package from spoonacular.com.spoonacular.client.model.food_ingredients_map_products import FoodIngredientsMapProducts from spoonacular.com.spoonacular.client.model.inline_object import InlineObject from spoonacular.com.spoonacular.client.model.inline_object1 import InlineObject1 from spoonacular.com.spoonacular.client.model.inline_object10 import InlineObject10 from spoonacular.com.spoonacular.client.model.inline_object2 import InlineObject2 from spoonacular.com.spoonacular.client.model.inline_object3 import InlineObject3 from spoonacular.com.spoonacular.client.model.inline_object4 import InlineObject4 from spoonacular.com.spoonacular.client.model.inline_object5 import InlineObject5 from spoonacular.com.spoonacular.client.model.inline_object6 import InlineObject6 from spoonacular.com.spoonacular.client.model.inline_object7 import InlineObject7 from spoonacular.com.spoonacular.client.model.inline_object8 import InlineObject8 from spoonacular.com.spoonacular.client.model.inline_object9 import InlineObject9 from spoonacular.com.spoonacular.client.model.inline_response200 import InlineResponse200 from spoonacular.com.spoonacular.client.model.inline_response2001 import InlineResponse2001 from spoonacular.com.spoonacular.client.model.inline_response20010 import InlineResponse20010 from spoonacular.com.spoonacular.client.model.inline_response20010_amount import InlineResponse20010Amount from spoonacular.com.spoonacular.client.model.inline_response20010_amount_metric import InlineResponse20010AmountMetric from spoonacular.com.spoonacular.client.model.inline_response20010_ingredients import InlineResponse20010Ingredients from spoonacular.com.spoonacular.client.model.inline_response20011 import InlineResponse20011 from spoonacular.com.spoonacular.client.model.inline_response20011_ingredients import InlineResponse20011Ingredients from spoonacular.com.spoonacular.client.model.inline_response20012 import InlineResponse20012 from spoonacular.com.spoonacular.client.model.inline_response20013 import InlineResponse20013 from spoonacular.com.spoonacular.client.model.inline_response20013_ingredients import InlineResponse20013Ingredients from spoonacular.com.spoonacular.client.model.inline_response20013_ingredients1 import InlineResponse20013Ingredients1 from spoonacular.com.spoonacular.client.model.inline_response20013_parsed_instructions import InlineResponse20013ParsedInstructions from spoonacular.com.spoonacular.client.model.inline_response20013_steps import InlineResponse20013Steps from spoonacular.com.spoonacular.client.model.inline_response20014 import InlineResponse20014 from spoonacular.com.spoonacular.client.model.inline_response20015 import InlineResponse20015 from spoonacular.com.spoonacular.client.model.inline_response20016 import InlineResponse20016 from spoonacular.com.spoonacular.client.model.inline_response20017 import InlineResponse20017 from spoonacular.com.spoonacular.client.model.inline_response20018 import InlineResponse20018 from spoonacular.com.spoonacular.client.model.inline_response20018_dishes import InlineResponse20018Dishes from spoonacular.com.spoonacular.client.model.inline_response20018_ingredients import InlineResponse20018Ingredients from spoonacular.com.spoonacular.client.model.inline_response20019 import InlineResponse20019 from spoonacular.com.spoonacular.client.model.inline_response2002 import InlineResponse2002 from spoonacular.com.spoonacular.client.model.inline_response20020 import InlineResponse20020 from spoonacular.com.spoonacular.client.model.inline_response20021 import InlineResponse20021 from spoonacular.com.spoonacular.client.model.inline_response20021_calories import InlineResponse20021Calories from spoonacular.com.spoonacular.client.model.inline_response20021_calories_confidence_range95_percent import InlineResponse20021CaloriesConfidenceRange95Percent from spoonacular.com.spoonacular.client.model.inline_response20022 import InlineResponse20022 from spoonacular.com.spoonacular.client.model.inline_response20022_nutrition import InlineResponse20022Nutrition from spoonacular.com.spoonacular.client.model.inline_response20023 import InlineResponse20023 from spoonacular.com.spoonacular.client.model.inline_response20023_ingredients import InlineResponse20023Ingredients from spoonacular.com.spoonacular.client.model.inline_response20024 import InlineResponse20024 from spoonacular.com.spoonacular.client.model.inline_response20025 import InlineResponse20025 from spoonacular.com.spoonacular.client.model.inline_response20025_results import InlineResponse20025Results from spoonacular.com.spoonacular.client.model.inline_response20026 import InlineResponse20026 from spoonacular.com.spoonacular.client.model.inline_response20027 import InlineResponse20027 from spoonacular.com.spoonacular.client.model.inline_response20028 import InlineResponse20028 from spoonacular.com.spoonacular.client.model.inline_response20028_ingredients import InlineResponse20028Ingredients from spoonacular.com.spoonacular.client.model.inline_response20028_nutrition import InlineResponse20028Nutrition from spoonacular.com.spoonacular.client.model.inline_response20028_servings import InlineResponse20028Servings from spoonacular.com.spoonacular.client.model.inline_response20029 import InlineResponse20029 from spoonacular.com.spoonacular.client.model.inline_response20029_custom_foods import InlineResponse20029CustomFoods from spoonacular.com.spoonacular.client.model.inline_response2003 import InlineResponse2003 from spoonacular.com.spoonacular.client.model.inline_response20030 import InlineResponse20030 from spoonacular.com.spoonacular.client.model.inline_response20030_ingredients import InlineResponse20030Ingredients from spoonacular.com.spoonacular.client.model.inline_response20031 import InlineResponse20031 from spoonacular.com.spoonacular.client.model.inline_response20031_comparable_products import InlineResponse20031ComparableProducts from spoonacular.com.spoonacular.client.model.inline_response20031_comparable_products_protein import InlineResponse20031ComparableProductsProtein from spoonacular.com.spoonacular.client.model.inline_response20032 import InlineResponse20032 from spoonacular.com.spoonacular.client.model.inline_response20032_results import InlineResponse20032Results from spoonacular.com.spoonacular.client.model.inline_response20033 import InlineResponse20033 from spoonacular.com.spoonacular.client.model.inline_response20034 import InlineResponse20034 from spoonacular.com.spoonacular.client.model.inline_response20035 import InlineResponse20035 from spoonacular.com.spoonacular.client.model.inline_response20035_menu_items import InlineResponse20035MenuItems from spoonacular.com.spoonacular.client.model.inline_response20036 import InlineResponse20036 from spoonacular.com.spoonacular.client.model.inline_response20037 import InlineResponse20037 from spoonacular.com.spoonacular.client.model.inline_response20037_nutrients import InlineResponse20037Nutrients from spoonacular.com.spoonacular.client.model.inline_response20038 import InlineResponse20038 from spoonacular.com.spoonacular.client.model.inline_response20038_days import InlineResponse20038Days from spoonacular.com.spoonacular.client.model.inline_response20038_items import InlineResponse20038Items from spoonacular.com.spoonacular.client.model.inline_response20038_nutrition_summary import InlineResponse20038NutritionSummary from spoonacular.com.spoonacular.client.model.inline_response20038_nutrition_summary_nutrients import InlineResponse20038NutritionSummaryNutrients from spoonacular.com.spoonacular.client.model.inline_response20038_value import InlineResponse20038Value from spoonacular.com.spoonacular.client.model.inline_response20039 import InlineResponse20039 from spoonacular.com.spoonacular.client.model.inline_response2003_extended_ingredients import InlineResponse2003ExtendedIngredients from spoonacular.com.spoonacular.client.model.inline_response2003_measures import InlineResponse2003Measures from spoonacular.com.spoonacular.client.model.inline_response2003_measures_metric import InlineResponse2003MeasuresMetric from spoonacular.com.spoonacular.client.model.inline_response2003_wine_pairing import InlineResponse2003WinePairing from spoonacular.com.spoonacular.client.model.inline_response2003_wine_pairing_product_matches import InlineResponse2003WinePairingProductMatches from spoonacular.com.spoonacular.client.model.inline_response2004 import InlineResponse2004 from spoonacular.com.spoonacular.client.model.inline_response20040 import InlineResponse20040 from spoonacular.com.spoonacular.client.model.inline_response20040_items import InlineResponse20040Items from spoonacular.com.spoonacular.client.model.inline_response20040_value import InlineResponse20040Value from spoonacular.com.spoonacular.client.model.inline_response20041 import InlineResponse20041 from spoonacular.com.spoonacular.client.model.inline_response20041_days import InlineResponse20041Days from spoonacular.com.spoonacular.client.model.inline_response20041_items import InlineResponse20041Items from spoonacular.com.spoonacular.client.model.inline_response20041_value import InlineResponse20041Value from spoonacular.com.spoonacular.client.model.inline_response20042 import InlineResponse20042 from spoonacular.com.spoonacular.client.model.inline_response20042_aisles import InlineResponse20042Aisles from spoonacular.com.spoonacular.client.model.inline_response20042_items import InlineResponse20042Items from spoonacular.com.spoonacular.client.model.inline_response20042_measures import InlineResponse20042Measures from spoonacular.com.spoonacular.client.model.inline_response20043 import InlineResponse20043 from spoonacular.com.spoonacular.client.model.inline_response20044 import InlineResponse20044 from spoonacular.com.spoonacular.client.model.inline_response20045 import InlineResponse20045 from spoonacular.com.spoonacular.client.model.inline_response20045_product_matches import InlineResponse20045ProductMatches from spoonacular.com.spoonacular.client.model.inline_response20046 import InlineResponse20046 from spoonacular.com.spoonacular.client.model.inline_response20047 import InlineResponse20047 from spoonacular.com.spoonacular.client.model.inline_response20047_recommended_wines import InlineResponse20047RecommendedWines from spoonacular.com.spoonacular.client.model.inline_response20048 import InlineResponse20048 from spoonacular.com.spoonacular.client.model.inline_response20049 import InlineResponse20049 from spoonacular.com.spoonacular.client.model.inline_response20049_category import InlineResponse20049Category from spoonacular.com.spoonacular.client.model.inline_response20049_nutrition import InlineResponse20049Nutrition from spoonacular.com.spoonacular.client.model.inline_response20049_nutrition_calories import InlineResponse20049NutritionCalories from spoonacular.com.spoonacular.client.model.inline_response20049_nutrition_calories_confidence_range95_percent import InlineResponse20049NutritionCaloriesConfidenceRange95Percent from spoonacular.com.spoonacular.client.model.inline_response20049_recipes import InlineResponse20049Recipes from spoonacular.com.spoonacular.client.model.inline_response2005 import InlineResponse2005 from spoonacular.com.spoonacular.client.model.inline_response20050 import InlineResponse20050 from spoonacular.com.spoonacular.client.model.inline_response20051 import InlineResponse20051 from spoonacular.com.spoonacular.client.model.inline_response20052 import InlineResponse20052 from spoonacular.com.spoonacular.client.model.inline_response20053 import InlineResponse20053 from spoonacular.com.spoonacular.client.model.inline_response20053_results import InlineResponse20053Results from spoonacular.com.spoonacular.client.model.inline_response20053_search_results import InlineResponse20053SearchResults from spoonacular.com.spoonacular.client.model.inline_response20054 import InlineResponse20054 from spoonacular.com.spoonacular.client.model.inline_response20054_videos import InlineResponse20054Videos from spoonacular.com.spoonacular.client.model.inline_response20055 import InlineResponse20055 from spoonacular.com.spoonacular.client.model.inline_response20056 import InlineResponse20056 from spoonacular.com.spoonacular.client.model.inline_response20057 import InlineResponse20057 from spoonacular.com.spoonacular.client.model.inline_response20057_suggests import InlineResponse20057Suggests from spoonacular.com.spoonacular.client.model.inline_response2006 import InlineResponse2006 from spoonacular.com.spoonacular.client.model.inline_response2006_recipes import InlineResponse2006Recipes from spoonacular.com.spoonacular.client.model.inline_response2007 import InlineResponse2007 from spoonacular.com.spoonacular.client.model.inline_response2008 import InlineResponse2008 from spoonacular.com.spoonacular.client.model.inline_response2009 import InlineResponse2009 from spoonacular.com.spoonacular.client.model.inline_response200_results import InlineResponse200Results from spoonacular.com.spoonacular.client.model.recipes_find_by_ingredients_missed_ingredients import RecipesFindByIngredientsMissedIngredients from spoonacular.com.spoonacular.client.model.recipes_parse_ingredients_estimated_cost import RecipesParseIngredientsEstimatedCost from spoonacular.com.spoonacular.client.model.recipes_parse_ingredients_nutrition import RecipesParseIngredientsNutrition from spoonacular.com.spoonacular.client.model.recipes_parse_ingredients_nutrition_caloric_breakdown import RecipesParseIngredientsNutritionCaloricBreakdown from spoonacular.com.spoonacular.client.model.recipes_parse_ingredients_nutrition_nutrients import RecipesParseIngredientsNutritionNutrients from spoonacular.com.spoonacular.client.model.recipes_parse_ingredients_nutrition_properties import RecipesParseIngredientsNutritionProperties from spoonacular.com.spoonacular.client.model.recipes_parse_ingredients_nutrition_weight_per_serving import RecipesParseIngredientsNutritionWeightPerServing
101.516556
1,050
0.903386
6d39b0bf7467004eae0543181e8ced373b8767a5
2,472
tsx
TypeScript
src/components/ToggleSwitch.tsx
jeongtae/jt-gatsby-blog
48df73a720af9e07f1ad119c9baf72a298d9ef0f
[ "MIT" ]
null
null
null
src/components/ToggleSwitch.tsx
jeongtae/jt-gatsby-blog
48df73a720af9e07f1ad119c9baf72a298d9ef0f
[ "MIT" ]
null
null
null
src/components/ToggleSwitch.tsx
jeongtae/jt-gatsby-blog
48df73a720af9e07f1ad119c9baf72a298d9ef0f
[ "MIT" ]
null
null
null
import React, { useState } from "react"; import styled from "styled-components"; import oc from "open-color"; import { uniqueId } from "lodash"; const Container = styled.div` label { padding: 0.02rem 0.06rem; display: inline-flex; align-items: center; font-size: 0.12rem; font-weight: 500; user-select: none; transition: background-color 150ms ease-in-out; border-radius: 0.08rem; cursor: pointer; @media (hover) { &:hover { background-color: ${oc.gray[1]}; } } .icon { position: relative; display: inline-block; margin-left: 0.03rem; width: 0.21rem; height: 0.14rem; border-radius: 1rem; background-color: ${oc.gray[5]}; transition: background-color 100ms ease-in-out; &::before { content: ""; position: absolute; top: 0.01rem; left: 0.01rem; width: 0.12rem; height: 0.12rem; border-radius: 1rem; background-color: ${oc.white}; transition: transform 100ms ease-in-out; } } &:active .icon::before { transform: translateX(0.02rem); transition-timing-function: ease-in; transition-duration: 60ms; transition-delay: 100ms; } } input:focus + label { outline: auto; outline-color: inherit; } input:checked + label { .icon { background-color: ${oc.orange[5]}; &::before { transform: translateX(0.07rem); } } &:active .icon::before { transform: translateX(0.05rem); } } `; const HiddenInput = styled.input` opacity: 0; position: absolute; pointer-events: none; `; const labelClickHandler: React.MouseEventHandler<HTMLLabelElement> = e => { e.preventDefault(); e.currentTarget.control?.click(); }; const ToggleSwitch: React.FC<{ id?: string; text?: string; checked?: boolean; onChange?: (checked: boolean) => void; }> = ({ id = "", text = "", checked: checked = false, onChange = () => {} }) => { const [generatedId] = useState(uniqueId()); id = id || generatedId; return ( <Container> <HiddenInput type="checkbox" id={id} checked={checked} onChange={e => onChange(e.currentTarget.checked)} /> <label htmlFor={id} onClick={labelClickHandler}> <span>{text}</span> <div aria-hidden={true} className="icon" /> </label> </Container> ); }; export default ToggleSwitch;
23.769231
81
0.586165
e75869a38787c5bde31c16a12ed32477d5f0ea60
324
php
PHP
learn/php/secret/sha1.php
pengfen/WWW
8879f8f408ac731f636bf82a1eff14007f353da1
[ "BSD-3-Clause" ]
1
2017-10-12T08:23:23.000Z
2017-10-12T08:23:23.000Z
learn/php/secret/sha1.php
pengfen/WWW
8879f8f408ac731f636bf82a1eff14007f353da1
[ "BSD-3-Clause" ]
null
null
null
learn/php/secret/sha1.php
pengfen/WWW
8879f8f408ac731f636bf82a1eff14007f353da1
[ "BSD-3-Clause" ]
null
null
null
<?php /** shal 加密算法 string shal(string $str[, bool $raw_output=false]) 计算字符串的shal 散列值 $str 加密的字符串 $raw_output 如果可选的 raw_output 参数被设置为 TRUE 那么 shal 摘要将以 20 字符长度的原始格式返回 否则返回值是一个 40 字符长度的十六进制数字 返回 shal 散列值字符串 */ echo shal('apeng'); echo "<h1/>"; echo shal('cao', true); echo "<h1/>";
19.058824
96
0.623457
cf172f8648a90a69e66de5a8581f39177327e7d0
895
php
PHP
app/Http/Routes/OperativoRoute.php
lleonelrocha/cic-moviles
776ad68c9083f1289f1e960ed2eb6d2c98b6c58b
[ "MIT" ]
null
null
null
app/Http/Routes/OperativoRoute.php
lleonelrocha/cic-moviles
776ad68c9083f1289f1e960ed2eb6d2c98b6c58b
[ "MIT" ]
null
null
null
app/Http/Routes/OperativoRoute.php
lleonelrocha/cic-moviles
776ad68c9083f1289f1e960ed2eb6d2c98b6c58b
[ "MIT" ]
null
null
null
<?php /** * Created by PhpStorm. * User: llrocha * Date: 03/09/2015 * Time: 02:00 PM */ $module = 'operativos'; $controller = 'OperativosController'; Route::get($module ,['middleware' => ['roles:'.$module.'-listar'] , 'as'=>$module ,'uses'=>$controller. '@getIndex']); Route::get($module.'Nuevo',['middleware' => ['roles:'.$module.'-agregar'] , 'as'=>$module.'Nuevo','uses'=>$controller. '@getNew']); Route::get($module.'Editar/{id}', ['middleware' => ['roles:'.$module.'-editar'] , 'as'=>$module.'Edit','uses'=>$controller. '@getEdit']); Route::get($module.'Borrar/{id}', ['middleware' => ['roles:'.$module.'-eliminar'] , 'as'=>$module.'Delete','uses'=>$controller. '@getDelete']); Route::post($module.'NuevoPost', ['as' => $module.'PostNuevo','uses'=>$controller. '@postNew']); Route::post($module.'EditarPost/{id}', ['as' => $module.'PostEdit','uses'=>$controller. '@postEdit']);
49.722222
145
0.611173
78bf84ff7d8d7910406947d9629bb205936f6012
1,612
kt
Kotlin
library/src/main/java/kwasm/format/binary/type/FunctionType.kt
jasonwyatt/KWasm
3c17988daaa8f37d654ee29428a37b330b3532ad
[ "Apache-2.0" ]
16
2019-12-10T04:06:44.000Z
2022-01-21T15:52:32.000Z
library/src/main/java/kwasm/format/binary/type/FunctionType.kt
jasonwyatt/KWasm
3c17988daaa8f37d654ee29428a37b330b3532ad
[ "Apache-2.0" ]
126
2019-12-10T20:13:36.000Z
2021-01-28T09:08:02.000Z
library/src/main/java/kwasm/format/binary/type/FunctionType.kt
jasonwyatt/KWasm
3c17988daaa8f37d654ee29428a37b330b3532ad
[ "Apache-2.0" ]
2
2021-01-13T00:46:00.000Z
2021-10-14T21:03:40.000Z
/* * Copyright 2020 Google LLC * * 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 kwasm.format.binary.type import kwasm.ast.Identifier import kwasm.ast.type.FunctionType import kwasm.ast.type.Param import kwasm.ast.type.Result import kwasm.format.binary.BinaryParser import kwasm.format.binary.value.readVector const val FUNCTION_TYPE_MAGIC: Byte = 0x60 /** * From [the docs](https://webassembly.github.io/spec/core/binary/types.html#function-types): * * Function types are encoded by the byte `0x60` followed by the respective vectors of parameter * and result types. * * ``` * functype ::= 0x60 rt1:resulttype rt2:resulttype => rt1 → rt2 * ``` */ fun BinaryParser.readFunctionType(): FunctionType { val byte = readByte() if (byte != FUNCTION_TYPE_MAGIC) { throwException("Expected 0x60 for Function Type (integer representation too long)", -1) } val params = readVector { readValueType() }.map { Param(Identifier.Local(null, null), it) } val results = readVector { readValueType() }.map { Result(it) } return FunctionType(params, results) }
35.822222
100
0.728288
b22f89bc83a98a5c82fff6c6d8c418f7deb76c03
279
rb
Ruby
lib/potassium/cli.rb
mihailpozarski/potassium
0012fb7dc78df111585681f668fbfecdb08cf4a6
[ "MIT" ]
150
2015-05-11T11:49:17.000Z
2022-03-31T16:21:19.000Z
lib/potassium/cli.rb
mihailpozarski/potassium
0012fb7dc78df111585681f668fbfecdb08cf4a6
[ "MIT" ]
234
2015-05-11T16:46:28.000Z
2022-03-03T19:56:10.000Z
lib/potassium/cli.rb
mihailpozarski/potassium
0012fb7dc78df111585681f668fbfecdb08cf4a6
[ "MIT" ]
19
2016-10-14T16:51:13.000Z
2022-03-04T19:35:52.000Z
require "potassium/version" require "gli" module Potassium::CLI extend GLI::App program_desc "Platanus Rails application generator" version Potassium::VERSION hide_commands_without_desc true commands_from "potassium/cli/commands" exit Potassium::CLI.run(ARGV) end
19.928571
53
0.78853
c959726ebadcb89a1bdcfccbba5d5508387110d1
1,531
ts
TypeScript
src/screens/Login/styles.ts
wallison-bruno/CREAApp
24ed1e88f2dd3d19e3521905a367ac0128e6d11e
[ "MIT" ]
null
null
null
src/screens/Login/styles.ts
wallison-bruno/CREAApp
24ed1e88f2dd3d19e3521905a367ac0128e6d11e
[ "MIT" ]
null
null
null
src/screens/Login/styles.ts
wallison-bruno/CREAApp
24ed1e88f2dd3d19e3521905a367ac0128e6d11e
[ "MIT" ]
null
null
null
import { StyleSheet } from 'react-native'; import { RFValue } from 'react-native-responsive-fontsize'; import { theme } from '../../global/theme'; export const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: theme.colors.primary, paddingTop: RFValue(80), paddingHorizontal: RFValue(37), }, logo:{ alignItems: 'center', paddingBottom: 70, }, content:{ alignItems: 'center', justifyContent: 'center', }, recoverPassword:{ // backgroundColor: theme.colors.secondary20, justifyContent: 'center', alignItems: 'center', flexDirection: 'row', marginTop: RFValue(80), }, titleRecover: { fontSize: 14, color: theme.colors.milk, paddingHorizontal: 4, fontFamily: theme.fonts.Regular400 }, linkRecover:{ fontSize:14, fontWeight: 'bold', color: theme.colors.milk, fontFamily: theme.fonts.Regular400 }, enter:{ width: '100%', }, buttonEnter:{ backgroundColor: theme.colors.secondary20, borderRadius: 4, marginTop: 25, paddingVertical: RFValue(19), alignItems: 'center', elevation: 3, }, public:{ alignItems: 'center', justifyContent: 'center', flexDirection: 'row', marginTop: RFValue(30) }, imagePublic:{ width: 25.48, height: 18, marginRight: 9.5 }, titlePublic: { fontSize: 14, // fontWeight: 'medium', color: theme.colors.milk, fontWeight: 'bold', fontFamily: theme.fonts.Regular400 } });
18.445783
59
0.624428
6986e50b5f4d69fd89a4b20f45e451997259c67d
340
rb
Ruby
db/migrate/20160303001700_create_inspector_profiles.rb
codeforamerica/inspector-gadget
693e970eb1a5758a905c67b478ffa2289aebdbc7
[ "MIT" ]
2
2021-02-01T03:51:19.000Z
2021-03-25T19:03:58.000Z
db/migrate/20160303001700_create_inspector_profiles.rb
rossettistone/inspector-gadget
693e970eb1a5758a905c67b478ffa2289aebdbc7
[ "MIT" ]
94
2016-03-03T23:50:23.000Z
2016-10-25T21:58:29.000Z
db/migrate/20160303001700_create_inspector_profiles.rb
codeforamerica/inspector-gadget
693e970eb1a5758a905c67b478ffa2289aebdbc7
[ "MIT" ]
4
2017-01-20T00:24:09.000Z
2021-03-15T18:40:08.000Z
class CreateInspectorProfiles < ActiveRecord::Migration def change create_table :inspector_profiles do |t| t.integer :inspector_id t.string :inspector_type t.text :inspection_categories, array: true, default: [] t.geometry :inspection_region, geographic: true t.timestamps null: false end end end
26.153846
61
0.714706
a3188dd216d083abec98eb149e34fc6439d81b92
373
sh
Shell
4idl_dihedral/06_grest_production/new1/run.sh
matsunagalab/paper_higashida2021
7a7786edb970db292340566f3a0420df3265d1f6
[ "BSD-3-Clause" ]
null
null
null
4idl_dihedral/06_grest_production/new1/run.sh
matsunagalab/paper_higashida2021
7a7786edb970db292340566f3a0420df3265d1f6
[ "BSD-3-Clause" ]
null
null
null
4idl_dihedral/06_grest_production/new1/run.sh
matsunagalab/paper_higashida2021
7a7786edb970db292340566f3a0420df3265d1f6
[ "BSD-3-Clause" ]
null
null
null
#!/bin/bash #SBATCH -p all #SBATCH -J grest #SBATCH -n 32 #num of total mpi processes #SBATCH -c 1 #num of threads per mpi processes #SBATCH -o run.log # set the number of OpenMP threads export OMP_NUM_THREADS=1 export CUDA_VISIBLE_DEVICES="2,3,4,5,6,7,8,9" # perform equilibration with SPDYN by using 8 MPI processes mpirun -np 32 /opt/genesis/bin/spdyn.cuda run.inp
24.866667
59
0.745308
0d58ca5ade4e214ea13fbcdc729a4fc5fbaf1fbf
2,034
cs
C#
src/BurnSystems/Xml/Html/HtmlElement.cs
mbrenn/burnsystems
c69c49bf0fff2ec72b5479c1e7ae4123f8ec4f86
[ "MIT" ]
null
null
null
src/BurnSystems/Xml/Html/HtmlElement.cs
mbrenn/burnsystems
c69c49bf0fff2ec72b5479c1e7ae4123f8ec4f86
[ "MIT" ]
null
null
null
src/BurnSystems/Xml/Html/HtmlElement.cs
mbrenn/burnsystems
c69c49bf0fff2ec72b5479c1e7ae4123f8ec4f86
[ "MIT" ]
null
null
null
using System.Collections.Generic; using System.Linq; using System.Xml.Linq; namespace BurnSystems.Xml.Html { /// <summary> /// Helper class that is used to create a simple html element /// </summary> public class HtmlElement : XElement { /// <summary> /// Initializes a new instance of the HtmlElement class. /// </summary> /// <param name="htmlTag">Tag to be added</param> /// <param name="contents">Contents of the html node</param> public HtmlElement( string htmlTag, params object[] contents) : base(HtmlDocument.XHtml5Namespace + htmlTag, contents) { } /// <summary> /// Creates a new instance of the HtmlElement and sets the html tag and includes the content /// </summary> /// <param name="htmlTag">Html Tag to be created</param> /// <param name="contents">Contents of the new html tag</param> /// <returns>Created html tag</returns> public static HtmlElement Create( string htmlTag, params object[] contents) { return new HtmlElement(htmlTag, contents); } /// <summary> /// Gets the text and converts each newline character (\r\n) to a <br />-tag. /// The result can directly be added to a node /// </summary> /// <param name="text">Text to be converted</param> /// <returns>Array of elements containing text and newline breaks. </returns> public static object[] ConvertNewLineToBreaks(string text) { var result = new List<object>(); var notFirst = false; foreach (var element in text.Split('\r').Select(x => x.Trim())) { if (notFirst) { result.Add(new XElement("br")); } result.Add(element); notFirst = true; } return result.ToArray(); } } }
32.806452
100
0.544739
aa29137a0e17fe3b426fbbf166c15ba50c6c1552
166
swift
Swift
Tests/LinuxMain.swift
tgu/SRP
3271936c767217825aff12e40caddbc26e12aac2
[ "MIT" ]
null
null
null
Tests/LinuxMain.swift
tgu/SRP
3271936c767217825aff12e40caddbc26e12aac2
[ "MIT" ]
null
null
null
Tests/LinuxMain.swift
tgu/SRP
3271936c767217825aff12e40caddbc26e12aac2
[ "MIT" ]
null
null
null
import XCTest @testable import SRPTests XCTMain([ testCase(SRPTests.allTests), testCase(PySrptoolsTests.allTests), testCase(ReadmeTests.allTests), ])
18.444444
40
0.740964
1432e4b42a96c7faa74611d8d044041c1b5da36d
2,818
cpp
C++
src/LogicManager.cpp
KrzeszewskiAdrian/JamEngine
b8f38d5e4e64e6d8b4b68a51fada47ab04f667a4
[ "MIT" ]
1
2019-04-19T23:36:56.000Z
2019-04-19T23:36:56.000Z
src/LogicManager.cpp
KrzeszewskiAdrian/JamEngine
b8f38d5e4e64e6d8b4b68a51fada47ab04f667a4
[ "MIT" ]
null
null
null
src/LogicManager.cpp
KrzeszewskiAdrian/JamEngine
b8f38d5e4e64e6d8b4b68a51fada47ab04f667a4
[ "MIT" ]
null
null
null
#include <iostream> #include "LogicManager.h" #include "LogicRaport.h" #include "Settings.h" #include "Timer.h" #include "ViewportCode.h" #include "Renderable.h" #include "RenderableLists.h" #include "ClickableLists.h" #include "TestObject.h" #include <stdlib.h> #include <time.h> using namespace std; LogicManager::LogicManager() { srand(time(NULL)); } bool LogicManager::initManager(InitSettings settings) { //LOADING_MAIN PanelManager.add(LOADING_MAIN, { settings.viewportSettingsList[LOADING_MAIN] }); //GAME_MAIN PanelManager.add(GAME_MAIN, { settings.viewportSettingsList[GAME_MAIN] }); //GAME_RESOURCES PanelManager.add(GAME_RESOURCES, { settings.viewportSettingsList[GAME_RESOURCES] }); //GAME_ACTIONS PanelManager.add(GAME_ACTIONS, { settings.viewportSettingsList[GAME_ACTIONS] }); return true; } bool LogicManager::initGame(Settings settings) { return true; } int LogicManager::loading(Settings settings) { testOffset = 3.0; return 100; } LogicRaport LogicManager::calculateLogic() { mLogicRaport = new LogicRaport(); mInputRaport = new InputRaport(); ///Time insensitive calculations InputManager.calculateInput(mInputRaport); clickedObject = NULL; hoveredObject = NULL; translateInput(); calculateTimeInsensitive(); ///Take current time mTimer.startLoop(); oneHundredFramesTime = oneHundredFramesTime + mTimer.getLastLoopDuration(); ///Time sensitive calculations currentLoopTime = mTimer.getLastLoopDuration(); mLogicRaport->setTime(currentLoopTime); calculateTimeSensitive(); ///Generating orders from lists mRenderableLists.renderAllLists(mLogicRaport, currentLoopTime); mClickableLists.renderAllLists(mLogicRaport, currentLoopTime); frame++; return *mLogicRaport; } bool LogicManager::calculateTimeInsensitive() { //Main code starts from here //see https://github.com/KrzeszewskiAdrian/JamEngine for help return true; } bool LogicManager::calculateTimeSensitive() { //Main code starts from here //see https://github.com/KrzeszewskiAdrian/JamEngine for help return true; } bool LogicManager::adjustPanels() { PanelManager.mList[LOADING_MAIN].move(currentLoopTime); CameraOrder testOrder7(LOADING_MAIN); testOrder7.jump(PanelManager.mList[LOADING_MAIN].getCameraX(), PanelManager.mList[LOADING_MAIN].getCameraY()); //mLogicRaport->add(testOrder7); return true; } void LogicManager::translateInput() { PanelClicksList panelClicksList = PanelManager.calculatePanelClicks(mInputRaport->mouseX, mInputRaport->mouseY); if (mInputRaport->mouseClick == true) { clickedObject = mClickableLists.identifyObjectClicked(panelClicksList, mInputRaport->mouseX, mInputRaport->mouseY); } else { hoveredObject = mClickableLists.identifyObjectClicked(panelClicksList, mInputRaport->mouseX, mInputRaport->mouseY); } }
19.985816
117
0.775018
94762d9675b28d2838ca49b6a175f5cf45d0bf88
4,086
swift
Swift
Homework8_Patterns/Homework8_Patterns/CleanSwiftViewController.swift
aku536/Homework8_Patterns
7bb7c2301fab5a9681da3638cb9610887465f860
[ "MIT" ]
null
null
null
Homework8_Patterns/Homework8_Patterns/CleanSwiftViewController.swift
aku536/Homework8_Patterns
7bb7c2301fab5a9681da3638cb9610887465f860
[ "MIT" ]
null
null
null
Homework8_Patterns/Homework8_Patterns/CleanSwiftViewController.swift
aku536/Homework8_Patterns
7bb7c2301fab5a9681da3638cb9610887465f860
[ "MIT" ]
null
null
null
// // CleanSwiftViewController.swift // Homework8_VIPER // // Created by Кирилл Афонин on 29/10/2019. // Copyright (c) 2019 Кирилл Афонин. All rights reserved. // // This file was generated by the Clean Swift Xcode Templates so // you can apply clean architecture to your iOS and Mac projects, // see http://clean-swift.com // import UIKit protocol CleanSwiftDisplayLogic: class { func displayImage(viewModel: CleanSwift.ImageData.ViewModel) func showAlert() } class CleanSwiftViewController: UIViewController, CleanSwiftDisplayLogic { var interactor: CleanSwiftBusinessLogic? var router: (NSObjectProtocol & CleanSwiftRoutingLogic & CleanSwiftDataPassing)? let imageView = UIImageView() let downloadButton = UIButton(type: .custom) let showButton = UIButton(type: .custom) let clearButton = UIButton(type: .custom) // MARK: Object lifecycle override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) setup() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setup() } // MARK: Setup private func setup() { let viewController = self let interactor = CleanSwiftInteractor() let presenter = CleanSwiftPresenter() let router = CleanSwiftRouter() viewController.interactor = interactor viewController.router = router interactor.presenter = presenter presenter.viewController = viewController router.viewController = viewController router.dataStore = interactor } // настройка представления private func setupView() { let midX = view.frame.midX - 100 imageView.frame = CGRect(x: midX, y: 100, width: 200, height: 200) imageView.backgroundColor = .blue view.addSubview(imageView) showButton.frame = CGRect(x: midX, y: 350, width: 200, height: 25) showButton.setTitleColor(.black, for: .normal) showButton.setTitle("Отобразить", for: .normal) showButton.addTarget(self, action: #selector(setImage), for: .touchUpInside) view.addSubview(showButton) downloadButton.frame = CGRect(x: midX, y: 400, width: 200, height: 25) downloadButton.setTitleColor(.black, for: .normal) downloadButton.setTitle("Скачать", for: .normal) downloadButton.addTarget(self, action: #selector(getImage), for: .touchUpInside) view.addSubview(downloadButton) clearButton.frame = CGRect(x: midX, y: 450, width: 200, height: 25) clearButton.setTitleColor(.black, for: .normal) clearButton.setTitle("Очистить кэш", for: .normal) clearButton.addTarget(self, action: #selector(clearCache), for: .touchUpInside) view.addSubview(clearButton) } // MARK: Routing func showAlert() { if let alert = router?.setupAlert() { self.present(alert, animated: true, completion: nil) } else { print("There are no image! Please, download it first") } } // MARK: View lifecycle override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .white } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) setupView() } // MARK: работа с изображением @objc func getImage() { let request = CleanSwift.ImageData.Request() interactor?.getImage(request: request) } @objc func setImage() { let request = CleanSwift.ImageData.Request() interactor?.setImage(request: request) } func displayImage(viewModel: CleanSwift.ImageData.ViewModel) { imageView.image = viewModel.image } @objc func clearCache() { let request = CleanSwift.ImageData.Request() interactor?.clearCache(request: request) } }
30.266667
88
0.638767
1152c2d95bd9c4b0bf6bdad0262c6fba621761d1
1,051
ps1
PowerShell
Tests/Custom.test.ps1
bforsythe/Invoke-Build
5898437ad652f250a22e95a73f11abc0ea958ee7
[ "Apache-2.0" ]
527
2015-01-18T06:37:54.000Z
2022-03-30T13:47:16.000Z
Tests/Custom.test.ps1
bforsythe/Invoke-Build
5898437ad652f250a22e95a73f11abc0ea958ee7
[ "Apache-2.0" ]
190
2015-04-12T20:49:16.000Z
2022-03-18T19:43:47.000Z
Tests/Custom.test.ps1
bforsythe/Invoke-Build
5898437ad652f250a22e95a73f11abc0ea958ee7
[ "Apache-2.0" ]
83
2015-05-20T15:10:36.000Z
2022-03-22T05:12:51.000Z
<# .Synopsis Custom task tests. .Example Invoke-Build * Custom.test.ps1 #> # Synopsis: Test "check", pass all, then run again. task Check1 { $file = '..\Tasks\Check\Check.build.ps1.Check.clixml' remove $file # fake to pass all function Read-Host {} Invoke-Build * ..\Tasks\Check\Check.build.ps1 -Result r equals $r.Tasks.Count 6 assert (Test-Path $file) Invoke-Build * ..\Tasks\Check\Check.build.ps1 -Result r equals $r.Tasks.Count 1 Remove-Item $file } # Synopsis: Test "check", fail at task.2.2, then run again. task Check2 { $file = '..\Tasks\Check\Check.build.ps1.Check.clixml' remove $file # fake to fail at task.2.2 function Read-Host { if ($args[0] -eq 'Do task.2.2 and press enter') {throw 'Demo error'} } Invoke-Build * ..\Tasks\Check\Check.build.ps1 -Result r -Safe assert ($r.Error) equals $r.Tasks.Count 6 equals $r.Errors.Count 1 assert (Test-Path $file) # fake to pass all function Read-Host {} Invoke-Build * ..\Tasks\Check\Check.build.ps1 -Result r equals $r.Tasks.Count 2 Remove-Item $file }
20.211538
70
0.683159
b60c1dfa508fed1ae3a0d9da663798ba7dbe8fd9
39
rb
Ruby
chapter13/type_test.rb
ChrisZou/programmingruby
2e89f8a1b941b47e4b0a869d44c387325f486ac9
[ "Apache-2.0" ]
null
null
null
chapter13/type_test.rb
ChrisZou/programmingruby
2e89f8a1b941b47e4b0a869d44c387325f486ac9
[ "Apache-2.0" ]
null
null
null
chapter13/type_test.rb
ChrisZou/programmingruby
2e89f8a1b941b47e4b0a869d44c387325f486ac9
[ "Apache-2.0" ]
null
null
null
value = 'hello' puts value.divmod(100)
13
22
0.717949
79cf3e307e737c852c57ba2b816f741a88cb7ed3
5,471
php
PHP
application/custom/components/FieldsInventorySpec_Component.php
jerry-yen/honeymoon
b53795d5d7e487ed3e5f0aa228d8164a3039566c
[ "MIT" ]
null
null
null
application/custom/components/FieldsInventorySpec_Component.php
jerry-yen/honeymoon
b53795d5d7e487ed3e5f0aa228d8164a3039566c
[ "MIT" ]
null
null
null
application/custom/components/FieldsInventorySpec_Component.php
jerry-yen/honeymoon
b53795d5d7e487ed3e5f0aa228d8164a3039566c
[ "MIT" ]
null
null
null
<?php class FieldsInventorySpec_Component extends Component { private static $include_scripts = false; public function render($attributes = array()) { // 驗證失敗呈現 $invalid_string = ""; if ($this -> valid_error_message != "") { $attributes["class"] = (isset($attributes["class"])) ? ($attributes["class"] . " invalid") : "invalid"; $invalid_string = "<span class='invalid_message'>{$this -> valid_error_message}</span>"; } // 屬性 $str_attribute = ""; foreach ($attributes as $name => $attr_value) { $str_attribute .= $name . '="' . $attr_value . '" '; } // 提示 $tip = ($this -> tip != "") ? ("<span class=\"tip\">" . $this -> tip . "</span>") : ""; $value = $this -> get_value(); if($value == ""){ $value = array(); } $fieldMetadatas = ( is_array($value) || is_object($value)) ? $value : json_decode($value); //$fieldMetadatas = ($value == "" || $value == array()) ? array() : json_decode($value); include($this -> config["full_application_path"] . "/custom/config/components.php"); $render = "{$tip} <div id='{$this -> variable}_field_add' style='float:right;margin-bottom:5px;'><button class=\"btn btn-success glyphicon glyphicon-plus\" type='button' title=\"新增欄位\"></button></div><br />"; $render .= '<div class="box-body table-responsive no-padding"> <table class="table table-hover"> <tr> <th>&nbsp;</th> <th>規格型號 (如:S,紅色)</th> <th>庫存</th> <th>指令</th> </tr> '; $render .='<tbody class="' . $this -> variable . '_items">'; foreach($fieldMetadatas as $fieldMetadata){ $render .= $this -> get_row_object($fieldMetadata); } $render .= $this -> get_empty_row_object(); $render .='</tbody>'; $render .='</table> </div>'; return $render; } private function get_row_object($fieldMetadata){ $render =' <tr class="' . $this -> variable . '_item"> <td style="width:30px;" valign="middle"><div style="padding-top:8px;" class="dropable glyphicon glyphicon-align-justify"></div></td>'; $render .= '<td><input type="text" class="form-control" name="' . $this -> variable . '_field_name[]" value="' . $fieldMetadata -> {$this -> variable . "_field_name"} . '"></td>'; $render .= '<td><input type="number" class="form-control" name="' . $this -> variable . '_field_count[]" value="' . $fieldMetadata -> {$this -> variable . "_field_count"} . '"></td> <td><button class="delete btn btn-danger glyphicon glyphicon-trash" title="刪除欄位" type="button"></button></td> </tr>'; return $render; } private function get_empty_row_object(){ $render =' <tr class="' . $this -> variable . '_empty" style="display:none;"> <td style="width:30px;" valign="middle"><div style="padding-top:8px;" class="dropable glyphicon glyphicon-align-justify"></div></td> <td><input type="text" class="form-control" name="' . $this -> variable . '_field_name[]" value=""></td> <td><input type="number" class="form-control" name="' . $this -> variable . '_field_count[]" value=""></td> <td><button class="delete btn btn-danger glyphicon glyphicon-trash" title="刪除欄位" type="button"></button></td> </tr>'; return $render; } public function get_title(){ return strip_tags($this -> get_value()); } public function set_value( $value ){ $field_count = $this -> variable . "_field_count"; $field_name = $this -> variable . "_field_name"; $name_count = count($this -> controller -> module_io -> {$field_name}); $fields = array(); for($i=0;$i<$name_count;$i++){ if($this -> controller -> module_io -> {$field_name}[$i] == ""){ continue; } $fields[] = array( $field_name => $this -> controller -> module_io -> {$field_name}[$i], $field_count => $this -> controller -> module_io -> {$field_count}[$i], ); } $this -> value = json_encode($fields); } public function script(){ if( !self::$include_scripts ){ self::$include_scripts = true; ?> <link href="<?php echo $this -> config["machine_relative_jquery_lib_path"]; ?>/jquery-ui-1.11.4/jquery-ui.min.css" rel="stylesheet" type="text/css" /> <script src="<?php echo $this -> config["machine_relative_jquery_lib_path"]; ?>/jquery-ui-1.11.4/jquery-ui.min.js" type="text/javascript"></script> <?php } ?> <script type="text/javascript"> $(document).ready(function() { $(".<?php echo $this -> variable?>_items").sortable({ handle : ".dropable" }); $("#<?php echo $this -> variable; ?>_field_add").click(function(){ var new_object = $(".<?php echo $this -> variable?>_empty").clone(); $(".<?php echo $this -> variable?>_empty").before(new_object); new_object.addClass("<?php echo $this -> variable?>_item").removeClass("<?php echo $this -> variable?>_empty"); new_object.show(); $(".<?php echo $this -> variable?>_items").sortable('disable'); $(".delete").unbind("click"); $(".delete").click(function(){ $(this).parents(".<?php echo $this -> variable?>_item").remove(); }); }); $(".delete").click(function(){ $(this).parents(".<?php echo $this -> variable?>_item").remove(); }); }); </script> <?php } } ?>
35.993421
210
0.566258
7142c2a87739e1e4412cc452f7f8731b72c960ca
389
dart
Dart
lib/types/scale_codec/union_value.dart
Pocket4D/p4d-rust-binding
2e0994c72454e4ad65efac278d1c60241b460424
[ "Apache-2.0" ]
17
2020-12-21T05:17:15.000Z
2022-02-17T14:27:12.000Z
lib/types/scale_codec/union_value.dart
Pocket4D/p4d-rust-binding
2e0994c72454e4ad65efac278d1c60241b460424
[ "Apache-2.0" ]
3
2021-02-08T22:18:41.000Z
2022-02-17T23:44:06.000Z
lib/types/scale_codec/union_value.dart
Pocket4D/p4d-rust-binding
2e0994c72454e4ad65efac278d1c60241b460424
[ "Apache-2.0" ]
4
2021-05-14T20:07:56.000Z
2021-12-16T04:11:06.000Z
class UnionValue<T> { int index; T value; UnionValue(int index, T value) { if (index < 0) { throw "Index cannot be negative number: $index"; } if (index > 255) { throw "Union can have max 255 values. Index: $index"; } this.index = index; this.value = value; } int getIndex() { return index; } T getValue() { return value; } }
16.208333
59
0.560411
8e5edf42c586a07943891c69b32f7d0fc3619fd6
181
js
JavaScript
.build_scripts/build-components/header.js
developmentseed/ml-grid-docs
29863c1f17e0e185ae4ac586a9c40e99e5416044
[ "MIT" ]
1
2022-02-08T16:20:11.000Z
2022-02-08T16:20:11.000Z
.build_scripts/build-components/header.js
developmentseed/ml-grid-docs
29863c1f17e0e185ae4ac586a9c40e99e5416044
[ "MIT" ]
null
null
null
.build_scripts/build-components/header.js
developmentseed/ml-grid-docs
29863c1f17e0e185ae4ac586a9c40e99e5416044
[ "MIT" ]
null
null
null
//inserts title code module.exports = function(yfm) { var title = yfm['title']; return '<script>document.getElementById("header-title").innerHTML="' + title + '";</script>'; };
30.166667
95
0.668508
d62ae49675d5c1bc9f4d5c1e50c047f7f1e2baeb
1,042
cs
C#
AmbientSounds/Services/SoundDataProvider.cs
mediaexplorer74/ambie
acb519ffad41f6a3cb97488ad37578bc1b229472
[ "MIT" ]
null
null
null
AmbientSounds/Services/SoundDataProvider.cs
mediaexplorer74/ambie
acb519ffad41f6a3cb97488ad37578bc1b229472
[ "MIT" ]
null
null
null
AmbientSounds/Services/SoundDataProvider.cs
mediaexplorer74/ambie
acb519ffad41f6a3cb97488ad37578bc1b229472
[ "MIT" ]
null
null
null
using AmbientSounds.Models; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Threading.Tasks; using Windows.Storage; namespace AmbientSounds.Services { /// <summary> /// Retrieves list of sound data /// available to the app. /// </summary> public class SoundDataProvider { private const string DataFileName = "Data.json"; /// <summary> /// Retrieves list of sound data available to the app. /// </summary> /// <returns>List of <see cref="Sound"/>.</returns> public static async Task<IList<Sound>> GetSoundsAsync() { StorageFolder appInstalledFolder = Windows.ApplicationModel.Package.Current.InstalledLocation; StorageFolder assets = await appInstalledFolder.GetFolderAsync("Assets"); var dataFile = await assets.GetFileAsync(DataFileName); string text = await FileIO.ReadTextAsync(dataFile); return JsonConvert.DeserializeObject<Sound[]>(text); } } }
32.5625
106
0.660269
2944a59ae2474e506a4510a13d11d2019fa8992f
1,863
rs
Rust
tcp/src/lib.rs
95ulisse/amq-protocol
b9f16f793112700223a4d676f1693e0ac403c2b8
[ "BSD-2-Clause" ]
null
null
null
tcp/src/lib.rs
95ulisse/amq-protocol
b9f16f793112700223a4d676f1693e0ac403c2b8
[ "BSD-2-Clause" ]
null
null
null
tcp/src/lib.rs
95ulisse/amq-protocol
b9f16f793112700223a4d676f1693e0ac403c2b8
[ "BSD-2-Clause" ]
null
null
null
#![deny(missing_docs)] #![warn(rust_2018_idioms)] #![doc(html_root_url = "https://docs.rs/amq-protocol-tcp/7.0.0/")] //! # AMQP URI TCP connection handling //! //! amq-protocol-tcp is a library aiming at providing tools to help //! connecting to an AMQP URI use amq_protocol_uri::{AMQPScheme, AMQPUri}; use std::time::Duration; use tracing::trace; /// Re-export TcpStream pub use tcp_stream::{ HandshakeError, HandshakeResult, Identity, MidHandshakeTlsStream, OwnedIdentity, OwnedTLSConfig, TLSConfig, TcpStream, }; #[cfg(feature = "native-tls")] pub use tcp_stream::NativeTlsConnector; #[cfg(feature = "openssl")] pub use tcp_stream::OpenSslConnector; #[cfg(feature = "rustls-connector")] pub use tcp_stream::{RustlsConnector, RustlsConnectorConfig}; /// Trait providing a method to connect to a TcpStream pub trait AMQPUriTcpExt { /// connect to a TcpStream fn connect(&self) -> HandshakeResult where Self: Sized, { self.connect_with_config(TLSConfig::default()) } /// connect to a TcpStream with the given configuration fn connect_with_config(&self, config: TLSConfig<'_, '_, '_>) -> HandshakeResult; } impl AMQPUriTcpExt for AMQPUri { fn connect_with_config(&self, config: TLSConfig<'_, '_, '_>) -> HandshakeResult { let uri = format!("{}:{}", self.authority.host, self.authority.port); trace!(uri = %uri, "Connecting."); let stream = if let Some(timeout) = self.query.connection_timeout { TcpStream::connect_timeout(uri, Duration::from_millis(timeout)) } else { TcpStream::connect(uri) }?; let stream = match self.scheme { AMQPScheme::AMQP => stream, AMQPScheme::AMQPS => stream.into_tls(&self.authority.host, config)?, }; stream.set_nonblocking(true)?; Ok(stream) } }
31.05
85
0.665056
38bdd8ef6fb837e9a529aee336b5268d75f16ea2
248
php
PHP
protected/module/members/controller/old/BackupController.php
sfsfco/lifting
b2e4f7eefbaf3dfb9ff0b7a3eb206c46bcf9dbdf
[ "MIT" ]
null
null
null
protected/module/members/controller/old/BackupController.php
sfsfco/lifting
b2e4f7eefbaf3dfb9ff0b7a3eb206c46bcf9dbdf
[ "MIT" ]
null
null
null
protected/module/members/controller/old/BackupController.php
sfsfco/lifting
b2e4f7eefbaf3dfb9ff0b7a3eb206c46bcf9dbdf
[ "MIT" ]
null
null
null
<?php /** * MainController * Feel free to delete the methods and replace them with your own code. * * @author darkredz */ class BackupController extends MembersController{ public function index(){ echo 'im backup'; } } ?>
16.533333
71
0.653226
12591a1b5d01a40c375c4ac802be70ef9937b480
1,160
cs
C#
src/DummyForm/DummyForm.cs
ventsislav-georgiev/ProcessTools
ee3d5a02f78de202e5101ff01795bbcd3ba9489d
[ "MIT" ]
1
2017-09-22T01:26:44.000Z
2017-09-22T01:26:44.000Z
src/DummyForm/DummyForm.cs
ventsislav-georgiev/ProcessTools
ee3d5a02f78de202e5101ff01795bbcd3ba9489d
[ "MIT" ]
null
null
null
src/DummyForm/DummyForm.cs
ventsislav-georgiev/ProcessTools
ee3d5a02f78de202e5101ff01795bbcd3ba9489d
[ "MIT" ]
1
2020-04-20T01:24:33.000Z
2020-04-20T01:24:33.000Z
using System; using System.Windows.Forms; namespace DummyForm { public partial class DummyForm : Form { public DummyForm() { InitializeComponent(); } private void DummyForm_Load(object sender, EventArgs e) { Cycle(); } private void btnNextCycle_Click(object sender, EventArgs e) { Cycle(); } private const string _message_uni = "Здравей Свят"; private const string _message = "Hello World"; private int cycleIndex = 0; private const int cycleLength = 10; private int _integer = 0; private void Cycle() { lbConsole.Items.Add("Values in cycle " + cycleIndex++ + " from " + cycleLength + ":"); lbConsole.Items.Add("Unicode message: " + _message_uni); lbConsole.Items.Add("ASCII message: " + _message); lbConsole.Items.Add("Current incrementing integer value: " + _integer++); lbConsole.Items.Add(""); lbConsole.SelectedIndex = lbConsole.Items.Count - 1; lbConsole.SelectedIndex = -1; } } }
29
98
0.568103
755a3c63581a592c5fac822b378c7b5de89f0b06
2,722
lua
Lua
test/simple/test-net-pingpong.lua
mkottman/LuaNode
b059225855939477147c5d4a6e8df3350c0a25fb
[ "MIT" ]
1
2015-06-13T18:00:06.000Z
2015-06-13T18:00:06.000Z
test/simple/test-net-pingpong.lua
mkottman/LuaNode
b059225855939477147c5d4a6e8df3350c0a25fb
[ "MIT" ]
null
null
null
test/simple/test-net-pingpong.lua
mkottman/LuaNode
b059225855939477147c5d4a6e8df3350c0a25fb
[ "MIT" ]
null
null
null
module(..., lunit.testcase, package.seeall) local common = dofile("common.lua") local net = require "luanode.net" function test() local tests_run = 0 function pingPong (port, host) local N = 1000 local count = 0 local sent_final_ping = false local server = net.createServer(function (self, socket) console.log("connection: %s:%d", socket:remoteAddress()) assert_equal(self, socket.server) assert_equal(1, self.connections) socket:setNoDelay() socket.timeout = 0 socket:setEncoding("utf8") socket:addListener("data", function (self, data) console.log("server got: %s", data) assert_equal(true, socket.writable) assert_equal(true, socket.readable) assert_equal(true, count <= N) if data:match("PING") then socket:write("PONG") end end) socket:addListener("end", function (self) assert_equal(true, socket.writable) assert_equal(false, socket.readable) socket:finish() end) socket:addListener("error", function (self, e) error(e) end) socket:addListener("close", function (self) console.log("server socket.end") assert_equal(false, socket.writable) assert_equal(false, socket.readable) socket.server:close() end) end) server:listen(port, host, function (self) console.log("server listening on " .. port .. " " .. (host and host or "")) local client = net.createConnection(port, host) collectgarbage() client:setEncoding("ascii") client:addListener("connect", function () assert_equal(true, client.readable) assert_equal(true, client.writable) client:write("PING") end) client:addListener("data", function (self, data) console.log("client got: %s", data) assert_equal("PONG", data) count = count + 1 if sent_final_ping then assert_equal(false, client.writable) assert_equal(true, client.readable) return else assert_equal(true, client.writable) assert_equal(true, client.readable) end if count < N then client:write("PING") else sent_final_ping = true client:write("PING") client:finish() end end) client:addListener("close", function () console.log("client.end") assert_equal(N + 1, count) assert_equal(true, sent_final_ping) tests_run = tests_run + 1 end) client:addListener("error", function (self, e) error(e) end) end) end -- All are run at once, so run on different ports pingPong(20989, "localhost") pingPong(20988) --pingPong(20997, "::1") -- deshabilitado porque mi notebook no soporta ipv6 --pingPong("/tmp/pingpong.sock") -- aun no soporto unix domain sockets process:addListener("exit", function () --assert_equal(3, tests_run) assert_equal(2, tests_run) console.log("done") end) process:loop() end
23.877193
77
0.696547
5440a2faff181116b080c5b2abc571c811e301da
2,123
css
CSS
data/usercss/19423.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
118
2020-08-28T19:59:28.000Z
2022-03-26T16:28:40.000Z
data/usercss/19423.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
38
2020-09-02T01:08:45.000Z
2022-01-23T02:47:24.000Z
data/usercss/19423.user.css
33kk/uso-archive
2c4962d1d507ff0eaec6dcca555efc531b37a9b4
[ "MIT" ]
21
2020-08-19T01:12:43.000Z
2022-03-15T21:55:17.000Z
/* ==UserStyle== @name Fixes for dark system themes @namespace USO Archive @author ikari @description `I have been using dark gray and black system themes under windows and linux and have found many sites ugly or unreadable, especially when it comes to forms. This theme would fix them, providing ‘better’ default colors for most elements.It even “fixes” the Fire.fm bar :-) (thanks to direct help from Jorge Villalobos)` @version 20090711.12.15 @license NO-REDISTRIBUTION @preprocessor uso ==/UserStyle== */ * { color: inherit; background: transparent; } body { color: black; background: white; } #urlbar { color: white !important; } input, button, textarea, select { background-color: background; color: #ddd; } @-moz-document domain(www.mbank.com.pl) { input, button, textarea, select { color: silver !important; background-color: #303030; } } /* Fire.fm tricks ;-) Big thanks for help to the Fire.fm team! (Especially Jorge Villalobos) */ fmtrackinfo label { color: black !important; font-size: x-small !important; } .firefm-info-progress-elapsed { background-color: #FFA053 !important; } .firefm-info-panel-artist, .firefm-info-panel-album, .firefm-info-panel-info-box { color: silver !important; } .firefm-info-panel-track { color: white !important; } .firefm-info-progress-box { background-color: grey; } /* (c) pihentagy */ @-moz-document domain(mail.google.com) { /* sent and received messages */ div.gMivnd { background-color: #ddd !important; font-family: monospace; font-size: 8.5pt !important; } /* lower panel */ .v0fLnc { background-color: #ccc !important; } /* text input */ .Gr0sfc { background-color: #eee !important; -moz-border-radius: 5px; border-color: #77f !important; color: black !important; font: 9pt Monospace !important; } /* focused */ .Gr0sfc:focus { border-color: #000 !important; } /* make titlebar transparent a bit*/ .AWqJIf { -moz-opacity:.9; } }
23.853933
335
0.646726
7f1c995588cbc56ef476992057ccfdd69ee8fd5b
152
cs
C#
Designer.Interfaces/IVSMDCodeDomProvider.cs
isabella232/JetBrains.EnvDTE
752b7206aa3ef59302cc89a8643217f1b51580cc
[ "Apache-2.0" ]
6
2020-10-09T08:00:29.000Z
2021-11-19T20:23:30.000Z
Designer.Interfaces/IVSMDCodeDomProvider.cs
JetBrains/JetBrains.EnvDTE
d87e42f0bf56c94c7db8e8ed7e7856a293c5be90
[ "Apache-2.0" ]
4
2020-12-07T08:31:16.000Z
2021-08-31T15:54:51.000Z
Designer.Interfaces/IVSMDCodeDomProvider.cs
isabella232/JetBrains.EnvDTE
752b7206aa3ef59302cc89a8643217f1b51580cc
[ "Apache-2.0" ]
1
2022-03-18T20:05:22.000Z
2022-03-18T20:05:22.000Z
namespace Microsoft.VisualStudio.Designer.Interfaces { public interface IVSMDCodeDomProvider { object CodeDomProvider { get; } } }
19
53
0.703947
aff3e971b98291b97f56dc43b01fb01d1e72cd08
5,596
py
Python
components/puppet/modules/gitolite/files/post-receive.py
pahoughton/scrumy-bdd
ea0776e66c6ea43e946d7b61e0050506fdf19470
[ "Apache-2.0" ]
null
null
null
components/puppet/modules/gitolite/files/post-receive.py
pahoughton/scrumy-bdd
ea0776e66c6ea43e946d7b61e0050506fdf19470
[ "Apache-2.0" ]
null
null
null
components/puppet/modules/gitolite/files/post-receive.py
pahoughton/scrumy-bdd
ea0776e66c6ea43e946d7b61e0050506fdf19470
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3.3 '''gitolite post-receive hook Executed after successful push to the repo to notify, jenkins, trac and/or mirror the repo. Usse: Add config keys to ~GIT/.gitolite.rc GIT_CONFIG_KEYS => 'gitolite\.url jenkins\.url jenkins\.build\.job jenkins\.build\.token trac\.dir trac\.repo git\.mirror\.repo', Add values as needed to your gitolite.conf repo @all repo myproduct.git config gitolite.url = git@gitolite.host.com config jenkins.url = http://host.com/jenkins config jenkins.build.job = JENKINS_JOB_NAME%20NOSPACE config jenkins.build.token = JENK_JOB_TOKEN config git.mirror.repo = git@github:USER/pubprod.git Install this script as ~GIT/REPO_DIR/MYPRODUCT.git/hooks/post-receive Both jenkins.build.job and jenkins.build.token are provided by the build configuration that will be signaled by the push. NOTE: the trac-admin app used is either 'trac-admin' or the value of the TRAC_ADMIN_APP environment variable. This is set to 'echo' for unit testing. Trac Tickets: #17, #19, #57, #58 ''' import sys import os import urllib.request import subprocess import shutil def show_post_receive_env(): '''For testing / debugging only Show the user that did the push all the values available to the post-receive hook Values may be args (none expected), environment variables and read from stdin in the formation of: OLDREV NEWREV REFNAME ''' print('ARGLIST:') for a in sys.argv: print('ARG: '+a) print('ENVLIST:') for k,v in os.environ.items(): print('ENV: '+k+'='+v) def git_config(repoVar): '''return the value from a git config variable This is able to retrieve gitolite repo variables when the script is a gitolite hook. ''' cfgVal = None try: cfgVal = subprocess.check_output(['git', 'config', '--get', repoVar] ).decode('utf-8').strip() except: pass return cfgVal def notify_jenkins(jenkinsUrl, branches): '''Send notification to jenkinsUrl of the push ''' gitoliteUrl = git_config('gitolite.url') jenkinsBuildJob = git_config('jenkins.build.job') jenkinsBuildToken = git_config('jenkins.build.token') reqUrl = jenkinsUrl if jenkinsBuildJob and jenkinsBuildToken: # this url is directly from the jenkins job definition reqUrl += '/job/'+jenkinsBuildJob reqUrl += '/build?token='+jenkinsBuildToken reqUrl += '&cause=Cause+git+push' elif gitoliteUrl: # this url is from the git jenkins plugin # note: GitPython does not work with python3 reqUrl += '/git/notifyCommit?url=' + gitoliteUrl reqUrl += ':' + os.environ.get('GL_REPO') if len(branches): reqUrl += '&branches='+','.join(branches) else: reqUrl = None #print('ReqUrl:',reqUrl) if reqUrl: try: resp = urllib.request.urlopen(reqUrl) if resp and resp.status == 200: print('Jenkins notified via:', reqUrl, 'response was:', resp.read() ) else: print('jenkins request failed: '+reqUrl + str(resp.status)) except: print('Jenkins request failed: '+reqUrl) else: print( 'Repo not configured for continuous integration.' ) def main(): '''app entry ''' # Notify Trac trac_dir = git_config('trac.dir') trac_repo = git_config('trac.repo') trac_admin = 'trac-admin' if os.environ.get('TRAC_ADMIN_APP'): trac_admin = os.environ.get('TRAC_ADMIN_APP') branches = [] for l in sys.stdin: oldref, newref, refname = l.split() branch = refname.split('/')[-1] branches.append(branch) # tell trac about the change if trac_dir and trac_repo and shutil.which(trac_admin): trac_out = subprocess.check_output([trac_admin, trac_dir, 'changeset', 'added', trac_repo, newref]) trac_out = trac_out.decode('utf-8').strip() print('Trac notified of change to', trac_repo, 'for', trac_dir, '.\n', trac_out) # Notify Jenkins jenkins_url = git_config('jenkins.url') if not jenkins_url or 'http' not in jenkins_url : print( 'Repo not configured for continuous integration.' ) else: print('JURL:',jenkins_url) notify_jenkins(jenkins_url,branches) # Push changes to mirror mirrors = git_config('git.mirror.repo') if mirrors: for mir in mirrors.split(): git_out = subprocess.check_output(['git', 'push', '--mirror', mir ]).decode('utf-8').strip() print('Pushed to mirror:',mir) else: print('Not mirrored') if __name__ == '__main__': main()
32.346821
133
0.544853
653d19b8b9b8a17b13ec53e56009d728269d3cf5
3,009
dart
Dart
lib/pages/chat/chat_list.dart
azamatig/travelman_places
2e39168268db30c0594525397bb4bd6f82b48d66
[ "MIT", "Unlicense" ]
null
null
null
lib/pages/chat/chat_list.dart
azamatig/travelman_places
2e39168268db30c0594525397bb4bd6f82b48d66
[ "MIT", "Unlicense" ]
null
null
null
lib/pages/chat/chat_list.dart
azamatig/travelman_places
2e39168268db30c0594525397bb4bd6f82b48d66
[ "MIT", "Unlicense" ]
null
null
null
import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:travelman/pages/chat/widgets/convo_item.dart'; import 'package:travelman/pages/chat/widgets/messenger_app_bar.dart'; import 'package:travelman/pages/chat/widgets/stories_list.dart'; import 'models/mocky.dart'; class ListFriend extends StatefulWidget { ListFriend({Key key}) : super(key: key); _ListFriendState createState() => _ListFriendState(); } class _ListFriendState extends State<ListFriend> { ScrollController _controller; bool _isScroll = false; _scrollListener() { if (_controller.offset > 0) { this.setState(() { _isScroll = true; }); } else { this.setState(() { _isScroll = false; }); } } void initState() { _controller = ScrollController(); _controller.addListener(_scrollListener); super.initState(); } @override Widget build(BuildContext context) { return NotificationListener<OverscrollIndicatorNotification>( onNotification: (overscroll) { overscroll.disallowGlow(); }, child: Container( decoration: BoxDecoration(color: Colors.white), child: Column( children: <Widget>[ _buildMessengerAppBar(_isScroll), _buildRootListView(), ], ), ), ); } _buildMessengerAppBar(_isScroll) { return (MessengerAppBar( isScroll: _isScroll, title: 'Chats', actions: <Widget>[ Container( width: 40.0, height: 40.0, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: Colors.grey.shade200, ), child: Icon( FontAwesomeIcons.camera, size: 18.0, ), ), Container( width: 40.0, height: 40.0, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), color: Colors.grey.shade200, ), child: Icon( FontAwesomeIcons.pen, size: 18.0, ), ), ], )); } _buildRootListView() { return Expanded( child: ListView.builder( padding: EdgeInsets.only(top: 10.0), controller: _controller, itemBuilder: (context, index) { if (index == 0) { return _buildSearchBar(); } else if (index == 1) { return _buildStoriesList(); } else { return ConversationItem( friendItem: friendList[index - 2], ); } }, itemCount: friendList.length + 2, ), ); } _buildSearchBar() { return Padding( padding: const EdgeInsets.only(left: 16.0, right: 16.0), child: SearchBar(), ); } _buildStoriesList() { return Container( height: 100, padding: EdgeInsets.only(top: 16.0), child: StoriesList(), ); } }
24.266129
69
0.57328