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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dd21e821e26d7f247fb72df3517baf2847fdceec | 5,520 | dart | Dart | geography/lib/src/countries/iceland_states.dart | GioCirque/dart-pub | 44ae54c0cb6260d2ce3a1758f3fec080f1fa4556 | [
"BSD-3-Clause"
] | 2 | 2022-01-17T15:16:08.000Z | 2022-01-19T13:27:19.000Z | geography/lib/src/countries/iceland_states.dart | GioCirque/pub-dev | 44ae54c0cb6260d2ce3a1758f3fec080f1fa4556 | [
"BSD-3-Clause"
] | null | null | null | geography/lib/src/countries/iceland_states.dart | GioCirque/pub-dev | 44ae54c0cb6260d2ce3a1758f3fec080f1fa4556 | [
"BSD-3-Clause"
] | null | null | null | /// Access to known geographies in Iceland and their meta data.
///
/// NOTICE: This file is auto-generated and should not be changed manually.
import '../base.dart';
import 'iceland_cities.dart';
/// The 8 regions of `🇮🇸 Iceland`
const Region icelandCapitalRegion = Region(
id: 3431,
parentId: 100,
longitude: -92.1816949,
latitude: 38.5656957,
name: "Capital Region",
type: null,
stateCode: "1",
cities: [
icelandCapitalRegionAlftanes,
icelandCapitalRegionGarabaer,
icelandCapitalRegionHafnarfjorur,
icelandCapitalRegionKjosarhreppur,
icelandCapitalRegionKopavogur,
icelandCapitalRegionMosfellsbaer,
icelandCapitalRegionMosfellsbaer,
icelandCapitalRegionReykjavik,
icelandCapitalRegionSeltjarnarnes
]);
const Region icelandEasternRegion = Region(
id: 3433,
parentId: 100,
longitude: 1.7976931348623157e+308,
latitude: 1.7976931348623157e+308,
name: "Eastern Region",
type: null,
stateCode: "7",
cities: [
icelandEasternRegionBorgarfjararhreppur,
icelandEasternRegionBreidalshreppur,
icelandEasternRegionEgilsstair,
icelandEasternRegionEskifjorur,
icelandEasternRegionFjarabygg,
icelandEasternRegionFljotsdalshera,
icelandEasternRegionFljotsdalshreppur,
icelandEasternRegionHofn,
icelandEasternRegionNeskaupstaur,
icelandEasternRegionReyarfjorur
]);
const Region icelandNortheasternRegion = Region(
id: 3437,
parentId: 100,
longitude: -74.2179326,
latitude: 43.2994285,
name: "Northeastern Region",
type: null,
stateCode: "6",
cities: [
icelandNortheasternRegionAkureyri,
icelandNortheasternRegionDalvik,
icelandNortheasternRegionDalvikurbygg,
icelandNortheasternRegionEyjafjararsveit,
icelandNortheasternRegionFjallabygg,
icelandNortheasternRegionGrytubakkahreppur,
icelandNortheasternRegionHorgarsveit,
icelandNortheasternRegionHusavik,
icelandNortheasternRegionLanganesbygg,
icelandNortheasternRegionLaugar,
icelandNortheasternRegionSiglufjorur,
icelandNortheasternRegionSkutustaahreppur,
icelandNortheasternRegionSvalbarsstrandarhreppur,
icelandNortheasternRegionTjorneshreppur,
icelandNortheasternRegionThingeyjarsveit
]);
const Region icelandNorthwesternRegion = Region(
id: 3435,
parentId: 100,
longitude: -73.0471688,
latitude: 41.9133932,
name: "Northwestern Region",
type: null,
stateCode: "5",
cities: [
icelandNorthwesternRegionAkrahreppur,
icelandNorthwesternRegionHunathingVestra,
icelandNorthwesternRegionSauarkrokur,
icelandNorthwesternRegionSkagabygg,
icelandNorthwesternRegionSveitarfelagiSkagafjorur
]);
const Region icelandSouthernPeninsulaRegion = Region(
id: 3430,
parentId: 100,
longitude: -22.3649667,
latitude: 63.9154803,
name: "Southern Peninsula Region",
type: null,
stateCode: "2",
cities: [
icelandSouthernPeninsulaRegionGarur,
icelandSouthernPeninsulaRegionGrindavik,
icelandSouthernPeninsulaRegionKeflavik,
icelandSouthernPeninsulaRegionReykjanesbaer,
icelandSouthernPeninsulaRegionSandgeri,
icelandSouthernPeninsulaRegionVogar
]);
const Region icelandSouthernRegion = Region(
id: 3434,
parentId: 100,
longitude: 1.7976931348623157e+308,
latitude: 1.7976931348623157e+308,
name: "Southern Region",
type: null,
stateCode: "8",
cities: [
icelandSouthernRegionAsahreppur,
icelandSouthernRegionBlaskogabygg,
icelandSouthernRegionFloahreppur,
icelandSouthernRegionGrimsnesHypOogGrafningshreppur,
icelandSouthernRegionHrunamannahreppur,
icelandSouthernRegionHverageri,
icelandSouthernRegionMyrdalshreppur,
icelandSouthernRegionSelfoss,
icelandSouthernRegionSkaftarhreppur,
icelandSouthernRegionSkeiaHypOogGnupverjahreppur,
icelandSouthernRegionVestmannaeyjabaer,
icelandSouthernRegionVestmannaeyjar,
icelandSouthernRegionThorlakshofn
]);
const Region icelandWesternRegion = Region(
id: 3436,
parentId: 100,
longitude: 1.7976931348623157e+308,
latitude: 1.7976931348623157e+308,
name: "Western Region",
type: null,
stateCode: "3",
cities: [
icelandWesternRegionAkranes,
icelandWesternRegionBorgarbygg,
icelandWesternRegionBorgarnes,
icelandWesternRegionDalabygg,
icelandWesternRegionEyjaHypOogMiklaholtshreppur,
icelandWesternRegionHelgafellssveit,
icelandWesternRegionHvalfjararsveit,
icelandWesternRegionOlafsvik,
icelandWesternRegionSkorradalshreppur,
icelandWesternRegionSnaefellsbaer,
icelandWesternRegionStykkisholmur
]);
const Region icelandWestfjords = Region(
id: 3432,
parentId: 100,
longitude: -21.8811764,
latitude: 65.919615,
name: "Westfjords",
type: null,
stateCode: "4",
cities: [
icelandWestfjordsIsafjararbaer,
icelandWestfjordsIsafjorur,
icelandWestfjordsReykholahreppur,
icelandWestfjordsStrandabygg,
icelandWestfjordsTalknafjararhreppur
]);
const icelandStates = <int, Region>{
3431: icelandCapitalRegion,
3433: icelandEasternRegion,
3437: icelandNortheasternRegion,
3435: icelandNorthwesternRegion,
3430: icelandSouthernPeninsulaRegion,
3434: icelandSouthernRegion,
3436: icelandWesternRegion,
3432: icelandWestfjords
};
| 31.724138 | 75 | 0.744203 |
9d2fa8ca3b17c64bc4daef5b230425ad73ec1600 | 498 | html | HTML | respa_admin/templates/respa_admin/forms/widgets/_generic_checkbox.html | jussiarpalahti/respa | c308bcb96e56d9401e22df94d3073e248618e243 | [
"MIT"
] | 49 | 2015-10-21T06:25:31.000Z | 2022-03-20T07:24:20.000Z | respa_admin/templates/respa_admin/forms/widgets/_generic_checkbox.html | jussiarpalahti/respa | c308bcb96e56d9401e22df94d3073e248618e243 | [
"MIT"
] | 728 | 2015-06-24T13:26:54.000Z | 2022-03-24T12:18:41.000Z | respa_admin/templates/respa_admin/forms/widgets/_generic_checkbox.html | digipointtku/respa | a529e0df4d3f072df7801adb5bf97a5f4abd1243 | [
"MIT"
] | 46 | 2015-06-26T10:52:57.000Z | 2021-12-17T09:38:25.000Z | {% load i18n %}
<div class="custom-checkbox checkbox-inline generic-checkbox">
<input
class="custom-checkbox"
id="{{ widget.attrs.id }}"
type="checkbox"
name="{{ widget.name }}"
{% if widget.value != None %}value="{{ widget.value|stringformat:'s' }}"{% endif %}
{% include "django/forms/widgets/attrs.html" %}
>
<label for="{{ widget.attrs.id }}" class="">{{ widget.attrs.label }}</label>
<p>{{ widget.attrs.help_text }}</p>
</div>
| 31.125 | 91 | 0.564257 |
aae219a0dd18691513114a38aadc6c3738b6183d | 2,246 | sql | SQL | tests/sql/test.sql | burakuyar/simple-ddl-parser | f5714e0947a7cb48c202a91969b6e6d0d9a64d24 | [
"MIT"
] | 46 | 2021-03-07T02:21:29.000Z | 2022-03-24T12:45:03.000Z | tests/sql/test.sql | burakuyar/simple-ddl-parser | f5714e0947a7cb48c202a91969b6e6d0d9a64d24 | [
"MIT"
] | 53 | 2021-03-08T08:50:00.000Z | 2022-03-29T06:11:13.000Z | tests/sql/test.sql | burakuyar/simple-ddl-parser | f5714e0947a7cb48c202a91969b6e6d0d9a64d24 | [
"MIT"
] | 12 | 2021-06-21T16:14:17.000Z | 2022-03-25T13:52:35.000Z | CREATE TABLE "users" (
"id" SERIAL PRIMARY KEY,
"name" varchar,
"created_at" timestamp,
"updated_at" timestamp,
"country_code" int,
"default_language" int
);
CREATE TABLE "languages" (
"id" int PRIMARY KEY,
"code" varchar(2) NOT NULL,
"name" varchar NOT NULL
);
CREATE TABLE "countries" (
"id" int PRIMARY KEY,
"code" varchar(4) NOT NULL,
"name" varchar NOT NULL
);
CREATE TABLE "path_owners" (
"user_id" int,
"path_id" int,
"type" int DEFAULT 1
);
CREATE TABLE "paths" (
"id" int PRIMARY KEY,
"title" varchar NOT NULL,
"description" varchar(160),
"created_at" timestamp,
"updated_at" timestamp
);
CREATE TABLE "path_steps" (
"step_id" int,
"path_id" int
);
CREATE TABLE "steps" (
"id" int PRIMARY KEY,
"title" varchar NOT NULL,
"description" varchar(160),
"created_at" timestamp,
"updated_at" timestamp
);
CREATE TABLE "step_materials" (
"path_id" int,
"step_id" int
);
CREATE TABLE "materials" (
"id" int PRIMARY KEY,
"title" varchar NOT NULL default "New title",
"description" varchar,
"link" varchar,
"created_at" timestamp,
"updated_at" timestamp
);
CREATE TABLE "material_attachments" (
"material_id" int,
"attachment_id" int
);
CREATE TABLE "attachments" (
"id" int PRIMARY KEY,
"title" varchar,
"description" varchar,
"created_at" timestamp,
"updated_at" timestamp
);
ALTER TABLE "users" ADD FOREIGN KEY ("country_code") REFERENCES "countries" ("id");
ALTER TABLE "users" ADD FOREIGN KEY ("default_language") REFERENCES "languages" ("id");
ALTER TABLE "path_owners" ADD FOREIGN KEY ("user_id") REFERENCES "users" ("id");
ALTER TABLE "path_owners" ADD FOREIGN KEY ("path_id") REFERENCES "paths" ("id");
ALTER TABLE "path_steps" ADD FOREIGN KEY ("step_id") REFERENCES "steps" ("id");
ALTER TABLE "path_steps" ADD FOREIGN KEY ("path_id") REFERENCES "paths" ("id");
ALTER TABLE "step_materials" ADD FOREIGN KEY ("path_id") REFERENCES "materials" ("id");
ALTER TABLE "step_materials" ADD FOREIGN KEY ("step_id") REFERENCES "steps" ("id");
ALTER TABLE "material_attachments" ADD FOREIGN KEY ("material_id") REFERENCES "materials" ("id");
ALTER TABLE "material_attachments" ADD FOREIGN KEY ("attachment_id") REFERENCES "attachments" ("id");
| 23.642105 | 101 | 0.694568 |
64f340c3be61a26eae70055b92357c54879ebb50 | 6,221 | java | Java | core/src/nl/arjanfrans/mario/model/MovingActor.java | 4qu3l3c4r4/SuperMarioCloneInJAVA | aed8f9363b41786fbb4c4c6f9b075e1ebb3ea8e4 | [
"MIT"
] | null | null | null | core/src/nl/arjanfrans/mario/model/MovingActor.java | 4qu3l3c4r4/SuperMarioCloneInJAVA | aed8f9363b41786fbb4c4c6f9b075e1ebb3ea8e4 | [
"MIT"
] | null | null | null | core/src/nl/arjanfrans/mario/model/MovingActor.java | 4qu3l3c4r4/SuperMarioCloneInJAVA | aed8f9363b41786fbb4c4c6f9b075e1ebb3ea8e4 | [
"MIT"
] | null | null | null | package nl.arjanfrans.mario.model;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Touchable;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Pool;
public abstract class MovingActor extends Actor {
//TODO Some states are for Mario only, they don't belong in this class.
public static enum State {
Standing, Walking, Jumping, Dying, Dead, FlagSlide, NoControl, Pose
}
public static enum Direction {
LEFT, RIGHT;
}
protected Pool<Rectangle> rectPool = new Pool<Rectangle>()
{
@Override
protected Rectangle newObject()
{
return new Rectangle();
}
};
protected float max_velocity;
protected float jump_velocity = 40f;
protected float damping = 0.87f;
protected Vector2 position;
protected Vector2 velocity;
protected World world;
protected boolean dead;
protected boolean moving;
protected State state = State.Standing;
protected float stateTime = 0;
protected int level;
protected boolean facesRight = true;
protected Direction direction;
protected boolean grounded = false;
public MovingActor(World world, float x, float y, float max_velocity) {
this.world = world;
this.setPosition(x, y);
this.max_velocity = max_velocity;
velocity = new Vector2(0, 0);
dead = false;
moving = false;
this.setTouchable(Touchable.disabled);
}
public boolean isDead() {
return dead;
}
public void setDead(boolean dead) {
this.dead = dead;
world.removeActor(this);
}
protected Rectangle rectangle() {
return new Rectangle(this.getX(), this.getY(), this.getWidth(), this.getHeight());
}
protected void applyPhysics(Rectangle rect) {
float deltaTime = Gdx.graphics.getDeltaTime();
if (deltaTime == 0) return;
stateTime += deltaTime;
velocity.add(0, World.GRAVITY * deltaTime); // apply gravity if we are falling
if (Math.abs(velocity.x) < 1) { // clamp the velocity to 0 if it's < 1, and set the state to standing
velocity.x = 0;
if (grounded) {
state = State.Standing;
}
}
velocity.scl(deltaTime); // multiply by delta time so we know how far we go in this frame
if(collisionX(rect)) collisionXAction();
rect.x = this.getX();
collisionY(rect);
this.setPosition(this.getX() + velocity.x, this.getY() + velocity.y); // unscale the velocity by the inverse delta time and set the latest position
velocity.scl(1 / deltaTime);
velocity.x *= damping; // Apply damping to the velocity on the x-axis so we don't walk infinitely once a key was pressed
dieByFalling();
}
protected abstract void dieByFalling();
protected abstract void collisionXAction();
protected boolean collisionX(Rectangle rect) {
int[] bounds = checkTiles(true);
Array<Rectangle> tiles = world.getTiles(bounds[0], bounds[1], bounds[2], bounds[3]);
rect.x += velocity.x;
for (Rectangle tile : tiles) {
if (rect.overlaps(tile)) {
return true;
}
}
for(StaticActor a : world.getStaticActors()) {
if(rect.overlaps(a.rectangle()) && !a.isDestroyed()) {
return true;
}
}
return false;
}
/**
* Check from where to where to check. Method is used to help finding tiles
* if the koala is moving right, check the tiles to the right of it's
* right bounding box edge, otherwise check the ones to the left
* if the koala is moving upwards, check the tiles to the top of it's
* top bounding box edge, otherwise check the ones to the bottom
* @param checkx Check x if true or if false check y
* @return startX, startY, endX, enY
*/
protected int[] checkTiles(boolean checkX) {
int startX, startY, endX, endY;
if(checkX) {
if (velocity.x > 0) {
startX = endX = (int) (this.getX() + this.getWidth() + velocity.x);
}
else {
startX = endX = (int) (this.getX() + velocity.x);
}
startY = (int) (this.getY());
endY = (int) (this.getY() + this.getHeight());
}
else {
if (velocity.y > 0) {
startY = endY = (int) (this.getY() + this.getHeight() + velocity.y); //
}
else {
startY = endY = (int) (this.getY() + velocity.y);
}
startX = (int) (this.getX());
endX = (int) (this.getX() + this.getWidth());
}
return new int[]{startX, startY, endX, endY};
}
protected void collisionY(Rectangle rect) {
int[] bounds = checkTiles(false);
Array<Rectangle> tiles = world.getTiles(bounds[0], bounds[1], bounds[2], bounds[3]);
rect.y += velocity.y;
if(velocity.y < 0 ) { //dont allow jumping when falling/walking off an edge
grounded = false;
}
for (Rectangle tile : tiles) {
if (rect.overlaps(tile)) {
if (velocity.y > 0) {
this.setY(tile.y - this.getHeight()); //so it is just below/above the tile we collided with
}
else {
this.setY(tile.y + tile.height);
hitGround();
}
velocity.y = 0;
break;
}
}
for(StaticActor a : world.getStaticActors()) {
if(rect.overlaps(a.rectangle()) && !a.isDestroyed()) {
if (velocity.y > 0) {
a.hit(level);
this.setY(a.getOriginY() - this.getHeight());
}
else {
this.setY(a.getY() + a.getHeight());
hitGround();
}
velocity.y = 0;
break;
}
}
rectPool.free(rect);
}
public void move(Direction dir) {
if(state != State.Dying && moving) {
if(dir == Direction.LEFT) {
velocity.x = -max_velocity;
facesRight = false;
}
else {
velocity.x = max_velocity;
facesRight = true;
}
direction = dir;
if (grounded) {
state = MovingActor.State.Walking;
}
}
}
protected void hitGround() {
grounded = true;
}
public float getMax_velocity() {
return max_velocity;
}
public float getJump_velocity() {
return jump_velocity;
}
public float getDamping() {
return damping;
}
public float getStateTime() {
return stateTime;
}
public boolean isFacesRight() {
return facesRight;
}
public Vector2 getVelocity() {
return velocity;
}
public boolean isMoving() {
return moving;
}
public void setMoving(boolean moving) {
this.moving = moving;
}
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
}
| 24.206226 | 149 | 0.663559 |
b878589b7c46db8e5473b66410b2da832412ff57 | 360 | asm | Assembly | oeis/138/A138099.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/138/A138099.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/138/A138099.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A138099: Irregular triangle read by rows: T(n,k) = k + floor(n/2), 1 <= k <= ceiling(n/2).
; 1,2,2,3,3,4,3,4,5,4,5,6,4,5,6,7,5,6,7,8,5,6,7,8,9,6,7,8,9,10,6,7,8,9,10,11,7,8,9,10,11,12,7,8,9,10,11,12,13,8,9,10,11,12,13,14,8,9,10,11,12,13,14,15,9,10,11,12,13,14,15,16,9,10,11,12,13
lpb $0
add $1,$2
cmp $1,$2
add $2,$1
sub $0,$2
lpe
add $0,$2
add $0,1
| 30 | 187 | 0.561111 |
f45e6cf007fdcb46f89e84c7e05ff0e5ad8d468c | 1,242 | ps1 | PowerShell | Hyper-V/HyperV_Status.ps1 | cyberjacob/Zabbix-Addons | 05979a1c606e978ed26d523cd7079e3261df5596 | [
"MIT"
] | null | null | null | Hyper-V/HyperV_Status.ps1 | cyberjacob/Zabbix-Addons | 05979a1c606e978ed26d523cd7079e3261df5596 | [
"MIT"
] | null | null | null | Hyper-V/HyperV_Status.ps1 | cyberjacob/Zabbix-Addons | 05979a1c606e978ed26d523cd7079e3261df5596 | [
"MIT"
] | null | null | null | param(
[Parameter(Mandatory=$False)]
[string]$QueryName,
[string]$VMName
)
if ($QueryName -eq '') {
$colItems = Get-VM
write-host "{"
write-host " `"data`":["
write-host
foreach ($objItem in $colItems) {
$line = " { `"{#VMNAME}`":`"" + $objItem.Name + "`" , `"{#VMSTATE}`":`"" + $objItem.State + "`" },"
write-host $line
}
write-host
write-host " ]"
write-host "}"
write-host
}
else {
switch ($QueryName)
{
('State') {$Results = Get-VM -Name "$VMName" | select State | Format-Table -HideTableHeaders -AutoSize}
('CPUUsage') {$Results = Get-VM -Name "$VMName" | select CPUUsage | Format-Table -HideTableHeaders -AutoSize}
('MemoryAssigned') {$Results = Get-VM -Name "$VMName" | select MemoryAssigned | Format-Table -HideTableHeaders -AutoSize}
('Uptime') {$Results = Get-VM -Name "$VMName" | select Uptime | Format-Table -HideTableHeaders -AutoSize}
('Status') {$Results = Get-VM -Name "$VMName" | select Status | Format-Table -HideTableHeaders -AutoSize}
default {$Results = "Incorrect Command Given"}
}
$Results = $Results | Out-String
$Results = $Results.trim()
Write-Host $Results
} | 30.292683 | 129 | 0.586957 |
47f7d41fea06d187c2986a0914fa9152d1f86924 | 729 | kt | Kotlin | sdk/src/main/java/eu/genome/sdk/payment/datamodule/repository/PayRepositoryImpl.kt | genome-eu/payment-sdk-android | 26656429febf99273584773f305086d148a302fb | [
"MIT"
] | 1 | 2021-10-04T14:01:01.000Z | 2021-10-04T14:01:01.000Z | sdk/src/main/java/eu/genome/sdk/payment/datamodule/repository/PayRepositoryImpl.kt | genome-eu/payment-sdk-android | 26656429febf99273584773f305086d148a302fb | [
"MIT"
] | null | null | null | sdk/src/main/java/eu/genome/sdk/payment/datamodule/repository/PayRepositoryImpl.kt | genome-eu/payment-sdk-android | 26656429febf99273584773f305086d148a302fb | [
"MIT"
] | null | null | null | package eu.genome.sdk.payment.datamodule.repository
import eu.genome.sdk.payment.datamodule.api.Api
import eu.genome.sdk.payment.datamodule.api.PayApi
import eu.genome.sdk.payment.model.PayGatewayInfo
import eu.genome.sdk.payment.model.request.PaymentDto
import eu.genome.sdk.payment.model.response.BaseResponse
import io.reactivex.Single
import io.reactivex.schedulers.Schedulers
internal class PayRepositoryImpl(
private val api: Api
) : PayRepository {
override fun pay(authPaymentDto: PaymentDto, gatewayInfo: PayGatewayInfo?): Single<BaseResponse> {
return api.createApi(PayApi::class.java, gatewayInfo)
.pay(authPaymentDto)
.subscribeOn(Schedulers.io())
}
} | 36.45 | 103 | 0.754458 |
9273ef6d8a5e79ac307b91f2572bb127ec361deb | 8,957 | swift | Swift | Sources/Core/Theme/SingleSourceOfTruth/BrandsThemes/Aesop/AesopLightTheme.swift | fnazarios/natds-ios | be6b4d6fcd5f55708de371cb38e683eff59b4291 | [
"0BSD"
] | null | null | null | Sources/Core/Theme/SingleSourceOfTruth/BrandsThemes/Aesop/AesopLightTheme.swift | fnazarios/natds-ios | be6b4d6fcd5f55708de371cb38e683eff59b4291 | [
"0BSD"
] | null | null | null | Sources/Core/Theme/SingleSourceOfTruth/BrandsThemes/Aesop/AesopLightTheme.swift | fnazarios/natds-ios | be6b4d6fcd5f55708de371cb38e683eff59b4291 | [
"0BSD"
] | null | null | null | /***
*
* ███╗ ██╗ █████╗ ████████╗██████╗ ███████╗ ████████╗██╗ ██╗███████╗███╗ ███╗███████╗███████╗
* ████╗ ██║██╔══██╗╚══██╔══╝██╔══██╗██╔════╝ ╚══██╔══╝██║ ██║██╔════╝████╗ ████║██╔════╝██╔════╝
* ██╔██╗ ██║███████║ ██║ ██║ ██║███████╗█████╗██║ ███████║█████╗ ██╔████╔██║█████╗ ███████╗
* ██║╚██╗██║██╔══██║ ██║ ██║ ██║╚════██║╚════╝██║ ██╔══██║██╔══╝ ██║╚██╔╝██║██╔══╝ ╚════██║
* ██║ ╚████║██║ ██║ ██║ ██████╔╝███████║ ██║ ██║ ██║███████╗██║ ╚═╝ ██║███████╗███████║
* ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝
*
* https://github.com/natura-cosmeticos/natds-commons/tree/master/packages/natds-themes
*
* Generated by natds-themes in Mon May 24 2021
* Do not edit this file.
*
* If you have any trouble or a feature request, open an issue:
* https://github.com/natura-cosmeticos/natds-commons/issues
*
*/
struct AesopLightTheme: Theme {
let tokens: Tokens = AesopLightTokens()
let components: Components = AesopLightComponents()
}
struct AesopLightTokens: Tokens {
let assetBrandNeutralA = "aesop-a-official"
let assetBrandNeutralB = "aesop-a-official"
let assetBrandCustomA = "aesop-a-custom"
let assetBrandCustomB = "aesop-a-custom"
let borderRadiusNone: CGFloat = 0
let borderRadiusSmall: CGFloat = 2
let borderRadiusMedium: CGFloat = 4
let borderRadiusLarge: CGFloat = 8
let colorPrimary = "#262625"
let colorOnPrimary = "#FFFFFF"
let colorPrimaryLight = "#4E4E4D"
let colorOnPrimaryLight = "#FFFFFF"
let colorPrimaryDark = "#000000"
let colorOnPrimaryDark = "#FFFFFF"
let colorSecondary = "#A6662B"
let colorOnSecondary = "#FFFFFF"
let colorSecondaryLight = "#DB9457"
let colorOnSecondaryLight = "#000000"
let colorSecondaryDark = "#733B00"
let colorOnSecondaryDark = "#FFFFFF"
let colorBackground = "#FAFAFA"
let colorOnBackground = "#333333"
let colorSurface = "#FFFFFF"
let colorOnSurface = "#333333"
let colorHighlight = "#000000"
let colorHighEmphasis = "#333333"
let colorMediumEmphasis = "#777777"
let colorLowEmphasis = "#BBBBBB"
let colorLink = "#227BBD"
let colorOnLink = "#FFFFFF"
let colorSuccess = "#569A32"
let colorOnSuccess = "#FFFFFF"
let colorWarning = "#FCC433"
let colorOnWarning = "#333333"
let colorAlert = "#E74627"
let colorOnAlert = "#FFFFFF"
let elevationNoneShadowColor = "nil"
let elevationNoneShadowOffsetWidth: CGFloat = 0
let elevationNoneShadowOffsetHeight: CGFloat = -3
let elevationNoneShadowRadius: CGFloat = 3
let elevationNoneShadowOpacity: Float = 0
let elevationMicroShadowColor = "#000000"
let elevationMicroShadowOffsetWidth: CGFloat = 0
let elevationMicroShadowOffsetHeight: CGFloat = 1
let elevationMicroShadowRadius: CGFloat = 1
let elevationMicroShadowOpacity: Float = 0.14
let elevationTinyShadowColor = "#000000"
let elevationTinyShadowOffsetWidth: CGFloat = 0
let elevationTinyShadowOffsetHeight: CGFloat = 2
let elevationTinyShadowRadius: CGFloat = 2
let elevationTinyShadowOpacity: Float = 0.14
let elevationSmallShadowColor = "#000000"
let elevationSmallShadowOffsetWidth: CGFloat = 0
let elevationSmallShadowOffsetHeight: CGFloat = 3
let elevationSmallShadowRadius: CGFloat = 4
let elevationSmallShadowOpacity: Float = 0.14
let elevationMediumShadowColor = "#000000"
let elevationMediumShadowOffsetWidth: CGFloat = 0
let elevationMediumShadowOffsetHeight: CGFloat = 4
let elevationMediumShadowRadius: CGFloat = 5
let elevationMediumShadowOpacity: Float = 0.14
let elevationLargeShadowColor = "#000000"
let elevationLargeShadowOffsetWidth: CGFloat = 0
let elevationLargeShadowOffsetHeight: CGFloat = 6
let elevationLargeShadowRadius: CGFloat = 10
let elevationLargeShadowOpacity: Float = 0.14
let elevationLargeXShadowColor = "#000000"
let elevationLargeXShadowOffsetWidth: CGFloat = 0
let elevationLargeXShadowOffsetHeight: CGFloat = 8
let elevationLargeXShadowRadius: CGFloat = 10
let elevationLargeXShadowOpacity: Float = 0.14
let elevationLargeXXShadowColor = "#000000"
let elevationLargeXXShadowOffsetWidth: CGFloat = 0
let elevationLargeXXShadowOffsetHeight: CGFloat = 9
let elevationLargeXXShadowRadius: CGFloat = 12
let elevationLargeXXShadowOpacity: Float = 0.14
let elevationHugeShadowColor = "#000000"
let elevationHugeShadowOffsetWidth: CGFloat = 0
let elevationHugeShadowOffsetHeight: CGFloat = 12
let elevationHugeShadowRadius: CGFloat = 17
let elevationHugeShadowOpacity: Float = 0.14
let elevationHugeXShadowColor = "#000000"
let elevationHugeXShadowOffsetWidth: CGFloat = 0
let elevationHugeXShadowOffsetHeight: CGFloat = 16
let elevationHugeXShadowRadius: CGFloat = 24
let elevationHugeXShadowOpacity: Float = 0.14
let elevationHugeXXShadowColor = "#000000"
let elevationHugeXXShadowOffsetWidth: CGFloat = 0
let elevationHugeXXShadowOffsetHeight: CGFloat = 24
let elevationHugeXXShadowRadius: CGFloat = 38
let elevationHugeXXShadowOpacity: Float = 0.14
let opacityTransparent: CGFloat = 0
let opacityLower: CGFloat = 0.04
let opacityVeryLow: CGFloat = 0.08
let opacityLow: CGFloat = 0.12
let opacityMediumLow: CGFloat = 0.16
let opacityDisabledLow: CGFloat = 0.24
let opacityDisabled: CGFloat = 0.32
let opacityMedium: CGFloat = 0.48
let opacityMediumHigh: CGFloat = 0.56
let opacityHigh: CGFloat = 0.64
let opacityVeryHigh: CGFloat = 0.8
let opacityOpaque: CGFloat = 1
let sizeNone: CGFloat = 0
let sizeMicro: CGFloat = 4
let sizeTiny: CGFloat = 8
let sizeSmall: CGFloat = 16
let sizeStandard: CGFloat = 24
let sizeSemi: CGFloat = 32
let sizeSemiX: CGFloat = 40
let sizeMedium: CGFloat = 48
let sizeMediumX: CGFloat = 56
let sizeLarge: CGFloat = 64
let sizeLargeX: CGFloat = 72
let sizeLargeXX: CGFloat = 80
let sizeLargeXXX: CGFloat = 88
let sizeHuge: CGFloat = 96
let sizeHugeX: CGFloat = 128
let sizeHugeXX: CGFloat = 144
let sizeHugeXXX: CGFloat = 192
let sizeVeryHuge: CGFloat = 256
let spacingNone: CGFloat = 0
let spacingMicro: CGFloat = 4
let spacingTiny: CGFloat = 8
let spacingSmall: CGFloat = 16
let spacingStandard: CGFloat = 24
let spacingSemi: CGFloat = 32
let spacingLarge: CGFloat = 48
let spacingXLarge: CGFloat = 64
let typographyFontFamilyPrimary = "San Francisco"
let typographyFontFamilySecondary = "sans-serif"
let typographyFontFamilyBranding = "Helvetica Now"
let typographyFontFamilyCode = "SF Mono"
let typographyLineHeightReset: CGFloat = 1
let typographyLineHeightSmall: CGFloat = 1.25
let typographyLineHeightMedium: CGFloat = 1.5
let typographyLineHeightLarge: CGFloat = 2
let typographyFontWeightRegular: UIFont.Weight = .regular
let typographyFontWeightMedium: UIFont.Weight = .medium
}
struct AesopLightComponents: Components {
let buttonDefaultFontSize: CGFloat = 14
let buttonDefaultFontWeight: UIFont.Weight = .medium
let buttonDefaultLetterSpacing: CGFloat = 0.44
let buttonDefaultLineHeight: CGFloat = 1.5
let heading1FontSize: CGFloat = 96
let heading1FontWeight: UIFont.Weight = .regular
let heading1LetterSpacing: CGFloat = 0
let heading2FontSize: CGFloat = 60
let heading2FontWeight: UIFont.Weight = .regular
let heading2LetterSpacing: CGFloat = 0
let heading3FontSize: CGFloat = 48
let heading3FontWeight: UIFont.Weight = .regular
let heading3LetterSpacing: CGFloat = 0
let heading4FontSize: CGFloat = 34
let heading4FontWeight: UIFont.Weight = .regular
let heading4LetterSpacing: CGFloat = 0.08
let heading5FontSize: CGFloat = 24
let heading5FontWeight: UIFont.Weight = .regular
let heading5LetterSpacing: CGFloat = 0
let heading6FontSize: CGFloat = 20
let heading6FontWeight: UIFont.Weight = .medium
let heading6LetterSpacing: CGFloat = 0.12
let subtitle1FontSize: CGFloat = 16
let subtitle1FontWeight: UIFont.Weight = .medium
let subtitle1LetterSpacing: CGFloat = 0.08
let subtitle2FontSize: CGFloat = 14
let subtitle2FontWeight: UIFont.Weight = .medium
let subtitle2LetterSpacing: CGFloat = 0.08
let body1FontSize: CGFloat = 16
let body1FontWeight: UIFont.Weight = .regular
let body1LetterSpacing: CGFloat = 0.32
let body2FontSize: CGFloat = 14
let body2FontWeight: UIFont.Weight = .regular
let body2LetterSpacing: CGFloat = 0.16
let captionFontSize: CGFloat = 12
let captionFontWeight: UIFont.Weight = .regular
let captionLetterSpacing: CGFloat = 0.16
let overlineFontSize: CGFloat = 12
let overlineFontWeight: UIFont.Weight = .medium
let overlineLetterSpacing: CGFloat = 0.8
}
| 42.856459 | 102 | 0.681813 |
1371baa83a034ec4872ab68d0321d3403c8ae840 | 12,109 | h | C | programs/Xserver/hw/xfree86/drivers/tseng/tseng.h | sourcecode-reloaded/Xming | b9f2e99d00f9445a29803d622d24b5314ee35991 | [
"X11",
"MIT"
] | 4 | 2020-08-21T04:21:14.000Z | 2022-01-15T11:26:11.000Z | programs/Xserver/hw/xfree86/drivers/tseng/tseng.h | sourcecode-reloaded/Xming | b9f2e99d00f9445a29803d622d24b5314ee35991 | [
"X11",
"MIT"
] | 1 | 2020-02-23T19:22:52.000Z | 2020-02-23T19:22:52.000Z | programs/Xserver/hw/xfree86/drivers/tseng/tseng.h | talregev/Xming | e7a997e3c6441c572df6953468fd8e88ca9e07e7 | [
"X11",
"MIT"
] | 3 | 2020-12-18T06:33:36.000Z | 2022-02-22T16:25:50.000Z |
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h,v 1.37tsi Exp $ */
#ifndef _TSENG_H
#define _TSENG_H
/* All drivers should typically include these */
#include "xf86.h"
#include "xf86_OSproc.h"
/* All drivers need this */
#include "xf86_ansic.h"
/* Everything using inb/outb, etc needs "compiler.h" */
#include "compiler.h"
/* This is used for module versioning */
#include "xf86Version.h"
/* Drivers for PCI hardware need this */
#include "xf86PciInfo.h"
/* Drivers that need to access the PCI config space directly need this */
#include "xf86Pci.h"
/* All drivers using the vgahw module need this */
/* All Tseng chips _need_ VGA register access, so multihead operation is out of the question */
#include "vgaHW.h"
/* Drivers using the mi banking wrapper need this */
#include "mibank.h"
/* All drivers using the mi colormap manipulation need this */
#include "micmap.h"
/* Needed for the 1 and 4 bpp framebuffers */
#include "xf1bpp.h"
#include "xf4bpp.h"
#include "fb.h"
/* Drivers using the XAA interface ... */
#include "xaa.h"
#include "xaalocal.h"
#include "xf86Cursor.h"
#include "xf86fbman.h"
/* functions in tseng_driver.c needed outside it */
void TsengBlankScreen(ScrnInfoPtr pScrn, Bool unblank);
void TsengProtect(ScrnInfoPtr pScrn, Bool on);
#define MAX_TSENG_CLOCK 86000 /* default max clock for standard boards */
/*
* Contrary to the old driver, we use the "Chip Revision" here intead of
* multiple chipsets like "TYPE_ET4000W32Pa", "TYPE_ET4000W32Pb", etc.
*/
typedef enum {
TYPE_ET4000,
TYPE_ET4000W32,
TYPE_ET4000W32I,
TYPE_ET4000W32P,
TYPE_ET6000,
TYPE_ET6100,
TYPE_TSENG
} t_tseng_type;
/* revision ID for W32 chips: currently used for W32i and W32p */
typedef enum {
TSENGNOREV = 0,
W32REVID_A,
W32REVID_B,
W32REVID_C,
W32REVID_D
} t_w32_revid;
#define ET6100REVID (0x70)
typedef enum {
T_BUS_ISA,
T_BUS_MCA,
T_BUS_VLB,
T_BUS_PCI
} t_tseng_bus;
extern SymTabRec TsengDacTable[];
typedef enum {
UNKNOWN_DAC = -1,
NORMAL_DAC,
ATT20C47xA_DAC,
Sierra1502X_DAC,
ATT20C497_DAC,
ATT20C490_DAC,
ATT20C493_DAC,
ATT20C491_DAC,
ATT20C492_DAC,
ICS5341_DAC,
ICS5301_DAC,
STG1700_DAC,
STG1702_DAC,
STG1703_DAC,
ET6000_DAC,
CH8398_DAC,
MUSIC4910_DAC
} t_ramdactype;
typedef enum {
CLOCKCHIP_DEFAULT = -1,
CLOCKCHIP_ICD2061A,
CLOCKCHIP_ET6000,
CLOCKCHIP_ICS5341,
CLOCKCHIP_ICS5301,
CLOCKCHIP_CH8398,
CLOCKCHIP_STG1703
} t_clockchip_type;
typedef enum {
TSENG_MODE_NORMAL,
TSENG_MODE_PIXMUX,
TSENG_MODE_DACBUS16
} t_clockrange_type;
typedef struct {
unsigned char cmd_reg;
unsigned char f2_M;
unsigned char f2_N;
unsigned char ctrl;
unsigned char w_idx;
unsigned char r_idx;
unsigned char timingctrl; /* for STG170x */
unsigned char MClkM;
unsigned char dummy; /* FIXME!!! : someone overwrites saved MClkN without this */
unsigned char MClkN; /* PLL M/N values for MemClk programming */
} PllState;
typedef struct {
unsigned char ExtCRTC[16]; /* CRTC 0x30 .. 0x3F */
unsigned char ExtTS[2]; /* TS 0x06 .. 0x07 */
unsigned char ExtATC; /* ATC 0x16 */
unsigned char ExtSegSel[2]; /* 0x3CD , 0x3CB */
unsigned char ExtET6K[0x4F]; /* ET6000 PCI config space registers 0x40 .. 0x8F */
unsigned char ExtIMACtrl; /* IMA port control register (0x217B index 0xF7) */
PllState pll; /* registers in GenDAC-like RAMDAC/clockchips */
unsigned char ATTdac_cmd; /* command register for ATT 49x DACs */
} TsengRegRec, *TsengRegPtr;
typedef struct {
unsigned char save1, save2, save3, save4;
} clock_save;
typedef struct {
Bool Programmable; /* MemClk is programmable if set */
Bool Set; /* reprogram MClk if TRUE */
int MemClk; /* MemClk value in kHz */
int min, max; /* MemClk limits */
} TsengMClkInfoRec, *TsengMclkInfoPtr;
typedef struct {
int saved_cr;
int rmr;
} dac_save;
typedef struct {
t_ramdactype DacType;
Bool NotAttCompat; /* avoid treating the RAMDAC as AT&T compatible */
int RamdacShift; /* typically 10 or 8 for 6- or 8-bit dac */
int RamdacMask; /* typically 0x3f for 6 bit, 0xff for 8-bit ramdac */
Bool Dac8Bit; /* dac is 8 bit instead of the default 6 bit */
Bool DacPort16; /* Ramdac port is 16 bits wide instead of default 8 */
rgb rgb24packed;
} TsengDacInfoRec, *TsengDacInfoPtr;
typedef struct {
/* we'll put variables that we want to access _fast_ at the beginning (just a hunch) */
unsigned char cache_SegSelL, cache_SegSelH; /* for tseng_bank.c */
int Bytesperpixel; /* a shorthand for the XAA code */
Bool need_wait_acl; /* always need a full "WAIT" for ACL finish */
int line_width; /* framebuffer width in bytes per scanline */
int planemask_mask; /* mask for active bits in planemask */
int neg_x_pixel_offset;
int powerPerPixel; /* power-of-2 version of bytesperpixel */
unsigned char *BresenhamTable;
/* normal stuff starts here */
pciVideoPtr PciInfo;
PCITAG PciTag;
int Save_Divide;
Bool UsePCIRetry; /* Do we use PCI-retry or busy-waiting */
Bool UseAccel; /* Do we use the XAA acceleration architecture */
Bool HWCursor; /* Do we use the hardware cursor (if supported) */
Bool Linmem_1meg; /* Is this a card limited to 1Mb of linear memory */
Bool UseLinMem;
Bool SlowDram;
Bool FastDram;
Bool MedDram;
Bool SetPCIBurst;
Bool PCIBurst;
Bool SetW32Interleave;
Bool W32Interleave;
Bool ShowCache;
Bool Legend; /* Sigma Legend clock select method */
Bool NoClockchip; /* disable clockchip programming clockchip (=use set-of-clocks) */
TsengRegRec SavedReg; /* saved Tseng registers at server start */
TsengRegRec ModeReg;
unsigned long icd2061_dwv; /* To hold the clock data between Init and Restore */
t_tseng_bus Bustype; /* W32 bus type (currently used for lin mem on W32i) */
t_tseng_type ChipType; /* "Chipset" causes confusion with pScrn->chipset */
int ChipRev;
memType LinFbAddress;
unsigned char *FbBase;
memType LinFbAddressMask;
long FbMapSize;
miBankInfoRec BankInfo;
CARD32 IOAddress; /* PCI config space base address for ET6000 */
CARD32 MMIOBase;
int MinClock;
int MaxClock;
int MemClk;
ClockRangePtr clockRange[2];
TsengDacInfoRec DacInfo;
TsengMClkInfoRec MClkInfo;
t_clockchip_type ClockChip;
int max_vco_freq; /* max internal VCO frequency */
CloseScreenProcPtr CloseScreen;
int save_divide;
XAAInfoRecPtr AccelInfoRec;
xf86CursorInfoPtr CursorInfoRec;
CARD32 AccelColorBufferOffset; /* offset in video memory where FG and BG colors will be stored */
CARD32 AccelColorExpandBufferOffsets[3]; /* offset in video memory for ColorExpand buffers */
unsigned char * XAAColorExpandBuffers[3]; /* pointers to colorexpand buffers */
CARD32 AccelImageWriteBufferOffsets[2]; /* offset in video memory for ImageWrite Buffers */
unsigned char * XAAScanlineImageWriteBuffers[2]; /* pointers to ImageWrite Buffers */
CARD32 HWCursorBufferOffset;
unsigned char *HWCursorBuffer;
unsigned char * XAAScanlineColorExpandBuffers[1];
int acl_blitxdir;
int acl_blitydir;
CARD32 acl_iw_dest;
CARD32 acl_skipleft;
CARD32 acl_ColorExpandDst;
int acl_colexp_width_dwords;
int acl_colexp_width_bytes;
dac_save dac;
CARD32* ColExpLUT;
clock_save save_clock;
EntityInfoPtr pEnt;
char * MMioBase;
pointer scratchMemBase;
pointer tsengCPU2ACLBase;
/* These will hold the ping-pong registers. */
int tsengFg;
int tsengBg;
int tsengPat;
int tseng_old_dir;
int old_x;
int old_y;
int DGAnumModes;
Bool DGAactive;
DGAModePtr DGAModes;
int DGAViewportStatus;
OptionInfoPtr Options;
} TsengRec, *TsengPtr;
#define TsengPTR(p) ((TsengPtr)((p)->driverPrivate))
#define Is_stdET4K ( pTseng->ChipType == TYPE_ET4000 )
#define Is_W32 ( pTseng->ChipType == TYPE_ET4000W32 )
#define Is_W32i ( pTseng->ChipType == TYPE_ET4000W32I )
#define Is_W32p ( pTseng->ChipType == TYPE_ET4000W32P)
#define Is_ET6000 ( pTseng->ChipType == TYPE_ET6000 )
#define Is_ET6100 ( pTseng->ChipType == TYPE_ET6100 )
#define Is_W32_W32i ( Is_W32 || Is_W32i )
#define Is_W32_any ( Is_W32 || Is_W32i || Is_W32p )
#define Is_W32p_ab ( Is_W32p && ( (pTseng->ChipRev == W32REVID_A) || (pTseng->ChipRev == W32REVID_B) ) )
#define Is_W32p_cd ( Is_W32p && ( (pTseng->ChipRev == W32REVID_C) || (pTseng->ChipRev == W32REVID_D) ) )
#define Is_ET6K ( Is_ET6000 || Is_ET6100 )
#define CHIP_SUPPORTS_LINEAR ( Is_W32i || Is_W32p || Is_ET6K )
#define DAC_IS_ATT49x ( (pTseng->DacInfo.DacType == ATT20C490_DAC) \
|| (pTseng->DacInfo.DacType == ATT20C491_DAC) \
|| (pTseng->DacInfo.DacType == ATT20C492_DAC) \
|| (pTseng->DacInfo.DacType == ATT20C493_DAC) \
|| (pTseng->DacInfo.DacType == MUSIC4910_DAC) )
#define DAC_is_GenDAC ( (pTseng->DacInfo.DacType == ICS5341_DAC) \
|| (pTseng->DacInfo.DacType == ICS5301_DAC) )
#define DAC_is_STG170x ( (pTseng->DacInfo.DacType == STG1700_DAC) \
|| (pTseng->DacInfo.DacType == STG1702_DAC) \
|| (pTseng->DacInfo.DacType == STG1703_DAC) )
#define DAC_IS_CHRONTEL (pTseng->DacInfo.DacType == CH8398_DAC)
#define Gendac_programmable_clock \
( pScrn->progClock && \
( (pTseng->ClockChip == CLOCKCHIP_ICS5341) \
|| (pTseng->ClockChip == CLOCKCHIP_ICS5301) \
) \
)
#define STG170x_programmable_clock \
( pScrn->progClock && (pTseng->ClockChip == CLOCKCHIP_STG1703) )
#define ICD2061a_programmable_clock \
( pScrn->progClock && (pTseng->ClockChip == CLOCKCHIP_ICD2061A) )
#define CH8398_programmable_clock \
( pScrn->progClock && (pTseng->ClockChip == CLOCKCHIP_CH8398) )
#define ET6000_programmable_clock \
( pScrn->progClock && (pTseng->ClockChip == CLOCKCHIP_ET6000) )
/*
* tseng_driver.c for DGA
*/
Bool TsengModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
void TsengAdjustFrame(int scrnIndex, int x, int y, int flags);
/*
* tseng_dga.c
*/
Bool TsengDGAInit(ScreenPtr pScreen);
/*
* From tseng_bank.c
*/
int ET4000SetRead(ScreenPtr pScrn, unsigned int iBank);
int ET4000SetWrite(ScreenPtr pScrn, unsigned int iBank);
int ET4000SetReadWrite(ScreenPtr pScrn, unsigned int iBank);
int ET4000W32SetRead(ScreenPtr pScrn, unsigned int iBank);
int ET4000W32SetWrite(ScreenPtr pScrn, unsigned int iBank);
int ET4000W32SetReadWrite(ScreenPtr pScrn, unsigned int iBank);
/*
* From tseng_clocks.c
*/
Bool Tseng_check_clockchip(ScrnInfoPtr pScrn);
void tseng_clock_setup(ScrnInfoPtr pScrn);
void TsengcommonCalcClock(long freq,
int min_m, int min_n1, int max_n1, int min_n2, int max_n2,
long freq_min, long freq_max,
unsigned char *mdiv, unsigned char *ndiv);
/*
* From tseng_ramdac.c
*/
void tseng_dactopel(void);
unsigned char tseng_dactocomm(void);
unsigned char tseng_getdaccomm(void);
void tseng_setdaccomm(unsigned char comm);
Bool Check_Tseng_Ramdac(ScrnInfoPtr pScrn);
void tseng_set_ramdac_bpp(ScrnInfoPtr pScrn, DisplayModePtr mode);
/*
* From tseng_cursor.c
*/
Bool TsengHWCursorInit(ScreenPtr pScreen);
/*
* From tseng_dpms.c
*/
void TsengHVSyncDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
void TsengCrtcDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
/*
* For debugging
*/
#undef TSENG_DEBUG
#ifdef TSENG_DEBUG
#define PDEBUG(arg) do { ErrorF(arg); } while (0)
#else
#define PDEBUG(arg) do {} while (0)
#endif
#endif
| 30.811705 | 105 | 0.68032 |
417e728b18cbf2253fcccaebc100c372600118ff | 20,144 | c | C | salsa/src/util/parse-storage-args.c | nik-io/uDepot | 06b94b7f2438b38b46572ede28072e24997e40c6 | [
"BSD-3-Clause"
] | null | null | null | salsa/src/util/parse-storage-args.c | nik-io/uDepot | 06b94b7f2438b38b46572ede28072e24997e40c6 | [
"BSD-3-Clause"
] | null | null | null | salsa/src/util/parse-storage-args.c | nik-io/uDepot | 06b94b7f2438b38b46572ede28072e24997e40c6 | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2020 International Business Machines
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Authors: Nikolas Ioannou (nio@zurich.ibm.com),
* Kornilios Kourtis (kou@zurich.ibm.com, kornilios@gmail.com)
*
*/
#include "util/parse-storage-args.h"
#include <asm-generic/errno.h>
#include "gc/gc-io-work.h"
#include "generic/compiler.h"
#include "libos/os-debug.h"
#include "libos/os-string.h"
#include "sto-ctlr/private/sto-ctlr-common.h"
#include "sto-ctlr/scm-dev-properties.h"
#include "sto-ctlr/sto-capacity-mgr-parameters.h"
#include "sto-ctlr/sto-ctlr-parameters.h"
#include "sto-ctlr/sto-ctlr.h"
char errbuf[512];
#define str_starts_with(_s1, _s2) !strncmp(_s1, _s2, sizeof(_s2)-1)
int parse_scm_args(
struct scm_parameters *const scm_cfg,
const unsigned int argc,
char **const argv,
char **const err)
{
int pos;
int rc = -EINVAL;
char *token, *val, *valendp;
if (0 == scm_cfg->simulation && argc < 1) {
*err = "Device not specified.";
goto out0;
}
/* record valid dev arguments (starting with "/dev/") */
scm_cfg->dev_nr = 0;
pos = 0;
while (pos < argc && str_starts_with(argv[pos], "/dev/")) {
unsigned di = scm_cfg->dev_nr++;
char *dev_name = scm_cfg->cfg_dev_names[di];
snprintf(dev_name, SCM_MAX_DEV_NAME, "%s", argv[pos]);
pos++;
}
for (; pos < argc; pos++) {
token = argv[pos];
if (NULL == (val = strchr(token, '='))) {
snprintf(errbuf, sizeof(errbuf), "Argument '%s' invalid!" \
" (missing '=')\n", token);
*err = errbuf;
goto out0;
}
if (str_starts_with(token, "dev_size=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->dev_size_raw = argument_value;
} else if (str_starts_with(token, "grain_size=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->grain_size = argument_value;
} else if (str_starts_with(token, "rmap_grain_size=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->rmap_grain_size = argument_value;
} else if (str_starts_with(token, "segment_size=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->segment_size = argument_value;
} else if (str_starts_with(token, "raid=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->raid = argument_value;
} else if (str_starts_with(token, "dev_nr=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->dev_nr = argument_value;
} else if (str_starts_with(token, "gc_type=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->gc_params.gc = argument_value;
} else if (str_starts_with(token, "bin_nr=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->gc_params.bin_nr = argument_value;
} else if (str_starts_with(token, "gc_thread_nr=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->gc_params.thread_nr = argument_value;
} else if (str_starts_with(token, "simulation=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->simulation = !!(argument_value);
} else if (str_starts_with(token, "must_rebuild=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->must_rebuild = !!(argument_value);
} else if (str_starts_with(token, "use_rmap=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->use_rmap = !!(argument_value);
} else if (str_starts_with(token, "dont_rebuild=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->dont_rebuild = !!(argument_value);
} else if (str_starts_with(token, "gc_xnp_pct=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->gc_params.xnp_pct = argument_value;
} else if (str_starts_with(token, "gc_xnp_hot_pct=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->gc_params.xnp_hot_pct = argument_value;
} else if (str_starts_with(token, "gc_low_wm=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->gc_params.low_watermark = argument_value;
} else if (str_starts_with(token, "gc_high_wm=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->gc_params.high_watermark = argument_value;
} else if (str_starts_with(token, "seg_qs_conf=")) {
s64 argument_value = os_strtoul(val+1, &valendp, 0);
scm_cfg->seg_qs_conf = argument_value;
} else if (str_starts_with(token, "scm_dev=")) {
// in userspace we might want to use regulare files,
// instead of device files so add another parameter to
// add device files
unsigned di = scm_cfg->dev_nr++;
char *dev_name = scm_cfg->cfg_dev_names[di];
snprintf(dev_name, SCM_MAX_DEV_NAME, "%s", val+1);
// scm_props_devX=... X=0,1,...,6 (=SCM_MAX_DEVICES)
} else if (str_starts_with(token, "scm_props_dev")) {
int idx = strlen("scm_props_dev");
int dev = os_strtoul(token + idx, &valendp, 0);
if (dev >= SCM_MAX_DEVICES) {
snprintf(errbuf, sizeof(errbuf), "Invalid dev (%d) for scm_props_dev: %s\n", dev, token);
*err = errbuf;
goto out0;
}
scm_dev_props_parse(scm_cfg->cfg_dev_props + dev, val + 1);
MSG("user configuration for device %d:", dev);
scm_dev_props_print(&scm_cfg->cfg_dev_props[dev], "\t");
} else {
snprintf(errbuf, sizeof(errbuf), "Argument '%s' is invalid! "\
"(nonexisting key)\n", token);
*err = errbuf;
goto out0;
}
}
if (scm_cfg->dev_size_raw && !scm_cfg->simulation) {
MSG("----");
MSG("WARNING: dev_size argument is ignored");
MSG("For kernel, use the dm table to pass a user-specified device size");
MSG("----");
scm_cfg->dev_size_raw = 0;
}
switch (scm_cfg->dev_nr) {
case 0:
if (!scm_cfg->simulation) {
snprintf(errbuf, sizeof(errbuf), "parse_scm_args(): no devices found\n");
*err = errbuf;
goto out0;
} else {
char *dev_name = scm_cfg->cfg_dev_names[0];
scm_cfg->dev_nr = 1;
snprintf(dev_name, SCM_MAX_DEV_NAME, "SIM-DEVICE");
}
break;
case 1:
scm_cfg->raid = RAID0;
break;
}
rc = 0;
out0:
return rc;
}
int parse_storage_args(
struct sto_ctlr_parameters *const sto_cfg,
const unsigned int argc,
char **const argv,
char **const err)
{
int pos;
int rc = -EINVAL;
char *token, *val, *valendp;
s64 argument_value;
pos = 0;
/* skip valid dev arguments */
while (pos < argc && str_starts_with(argv[pos], "/dev/"))
pos++;
for (; pos < argc; pos++) {
token = argv[pos];
if (NULL == (val = strchr(token, '='))) {
snprintf(errbuf, sizeof(errbuf), "Argument '%s' invalid!" \
" (missing '=')\n", token);
*err = errbuf;
goto out0;
}
argument_value = os_strtoul(val+1, &valendp, 0);
if (str_starts_with(token, "dev_size=")) {
sto_cfg->dev_size = argument_value;
} else if (str_starts_with(token, "page_size=")) {
sto_cfg->page_size = argument_value;
} else if (str_starts_with(token, "small_page_size=")) {
sto_cfg->small_page_size = argument_value;
} else if (str_starts_with(token, "type=")) {
sto_cfg->type = argument_value;
} else if (str_starts_with(token, "stream_nr=")) {
sto_cfg->stream_nr = argument_value;
} else if (str_starts_with(token, "rel_stream_nr=")) {
sto_cfg->rel_stream_nr = argument_value;
} else if (str_starts_with(token, "generation_nr=")) {
sto_cfg->generation_nr = argument_value;
} else if (str_starts_with(token, "cache_size=")) {
sto_cfg->cache_size = argument_value;
} else if (str_starts_with(token, "pages_per_md_pg=")) {
sto_cfg->pages_per_md_pg = argument_value;
} else if (str_starts_with(token, "small_pages_per_md_pg=")) {
sto_cfg->small_pages_per_md_pg = argument_value;
} else if (str_starts_with(token, "precondition=")) {
sto_cfg->precondition = argument_value;
} else if (str_starts_with(token, "inject_read_delay=")) {
sto_cfg->inject_read_delay = argument_value;
} else if (str_starts_with(token, "inject_write_delay=")) {
sto_cfg->inject_write_delay = argument_value;
} else if (str_starts_with(token, "overprovision=")) {
sto_cfg->overprovision = argument_value;
} else if (str_starts_with(token, "uip_cache_size=")) {
sto_cfg->uip_cache_size = argument_value;
} else if (str_starts_with(token, "lba_heat_bits=")) {
sto_cfg->lba_heat_bits = argument_value;
} else if (str_starts_with(token, "precond_rnd_percent=")) {
sto_cfg->precond_rnd_percent = argument_value;
} else if (str_starts_with(token, "props_mask=")) {
sto_cfg->sc_prop_set = (struct scm_prop_set){.mask__ = argument_value};
} else if (str_starts_with(token, "small_props_mask=")) {
sto_cfg->sc_small_prop_set = (struct scm_prop_set){.mask__ = argument_value};
} else if (str_starts_with(token, "dont_rebuild=")) {
sto_cfg->dont_rebuild = !!argument_value;
} else if (str_starts_with(token, "magic_stream_oracle=")) {
sto_cfg->magic_stream_oracle = !!argument_value;
} else {
snprintf(errbuf, sizeof(errbuf), "Argument '%s' invalid! "\
"(nonexisting key)\n", token);
*err = errbuf;
goto out0;
}
}
// if sc_small_prop_set was not set, use the sc_prop_set value
if (scm_prop_set_is_empty(sto_cfg->sc_small_prop_set))
sto_cfg->sc_small_prop_set = sto_cfg->sc_prop_set;
rc = 0;
out0:
return rc;
}
int check_storage_params(
struct sto_ctlr_parameters *const sto_cfg,
char **const err)
{
int rc = -EINVAL;
if (sto_cfg->page_size == 0 || !is_power_of_two(sto_cfg->page_size)) {
*err = "Invalid cfg value: invalid page size";
goto out0;
}
if (sto_cfg->stream_nr == 0) {
*err = "Invalid cfg value: invalid stream_nr (==0)";
goto out0;
}
if (sto_cfg->cache_size < 1) {
*err = "Invalid cfg value: invalid cache_size (< 2)";
goto out0;
}
if (sto_cfg->precondition < 0 || sto_cfg->precondition > 1) {
*err = "Invalid cfg value: precondition " \
"should be in range [0, 1]";
goto out0;
}
if (sto_cfg->overprovision < 20 ||
1000 <= sto_cfg->overprovision) {
*err = "Invalid cfg value: overprovision " \
"should be in range (20, 1000)";
goto out0;
}
DBG("Storage config: page_size = %d", sto_cfg->page_size);
DBG("Storage config: stream_nr = %d", sto_cfg->stream_nr);
DBG("Storage config: precondition = %d", sto_cfg->precondition);
DBG("Storage config: overprovision = %d", sto_cfg->overprovision);
rc = 0;
out0:
return rc;
}
int check_sto_capacity_mgr_parameters(
const struct scm_parameters *const scm_cfg)
{
u64 dev_size;
int err = -EINVAL;
if (!scm_cfg->simulation && (scm_cfg->grain_size < PAGE_SIZE ||
SALSA_MAX_GRAIN_SIZE < scm_cfg->grain_size)) {
ERR("Invalid parameter grain_size=%u min=%lu max=%u",
scm_cfg->grain_size, PAGE_SIZE,
SALSA_MAX_GRAIN_SIZE);
goto fail0;
}
if (unlikely(!is_power_of_two(scm_cfg->grain_size))) {
ERR("Invalid parameter grain_size=%u not a power of two",
scm_cfg->grain_size);
goto fail0;
}
if (unlikely(scm_cfg->segment_size == 0 ||
SALSA_MAX_SEGMENT_SIZE < scm_cfg->segment_size)) {
ERR("Invalid parameter segment_size=%"PRIu64" max=%u",
scm_cfg->segment_size, SALSA_MAX_SEGMENT_SIZE);
goto fail0;
}
if (unlikely(scm_cfg->raid != RAID0 && scm_cfg->raid != RAID5 && scm_cfg->raid != SALSA_LINEAR)) {
ERR("Unsupported raid type=%u",
scm_cfg->raid);
goto fail0;
}
dev_size = scm_dev_props_size(&scm_cfg->cfg_scm_props);
if (unlikely(dev_size <
(scm_cfg->segment_size * (u64)scm_cfg->grain_size *
(SALSA_MIN_REL_SEGMENTS)))) {
ERR("Invalid parameter dev_size=%"PRIu64" too small"\
" (seg*page=%"PRIu64")", dev_size,
(u64) scm_cfg->segment_size * scm_cfg->grain_size);
goto fail0;
}
if (!scm_cfg->simulation && ((u64) PBA_INVAL_ENTRY * scm_cfg->grain_size < dev_size)) {
ERR("Invalid parameter dev_size=%"PRIu64" too big"\
" (max-size=%"PRIu64")", dev_size,
(u64) PBA_INVAL_ENTRY * scm_cfg->grain_size);
goto fail0;
}
err = 0;
fail0:
return err;
}
int check_ctlr_storage_parameters(
const struct sto_ctlr_parameters *const ctlr_cfg)
{
int err = EINVAL;
struct sto_capacity_mgr *const scm = ctlr_cfg->scm;
const u64 grain_size = scm_get_grain_size(scm);
const u64 queue_max_grains = scm_get_queue_max_hw_grains(scm);
if (unlikely(NULL == scm)) {
ERR("Invalid parameter null scm");
goto fail0;
}
if (unlikely(0 == ctlr_cfg->page_size ||
0 != (ctlr_cfg->page_size % scm_get_grain_size(scm)) ||
queue_max_grains * grain_size < ctlr_cfg->page_size)) {
ERR("Invalid parameter page_size=%u ", ctlr_cfg->page_size);
goto fail0;
}
err = 0;
fail0:
return err;
}
int check_lsa_storage_parameters(
const struct sto_ctlr_parameters *const lsa_cfg)
{
int err = EINVAL;
const struct sto_capacity_mgr *const scm = lsa_cfg->scm;
const u64 seg_size = scm_get_seg_size(scm);
const u64 grain_size = scm_get_grain_size(scm);
const u64 rmap_size = scm_get_rmap_size(scm);
const u32 page_in_grains = lsa_cfg->page_size / grain_size;
const u32 min_seg_nr = 1 + 2 * SALSA_MIN_REL_SEGMENTS +
(lsa_cfg->rel_stream_nr + lsa_cfg->stream_nr) * lsa_cfg->cache_size;
if (unlikely(0 == lsa_cfg->page_size ||
0 != (lsa_cfg->page_size % scm_get_grain_size(scm)))) {
ERR("Invalid parameter page_size=%u ",
lsa_cfg->page_size);
goto fail0;
}
if (unlikely(0 == lsa_cfg->page_size ||
0 != (lsa_cfg->page_size % scm_get_grain_size(scm)))) {
ERR("Invalid parameter page_size=%u ",
lsa_cfg->page_size);
goto fail0;
}
if(unlikely(0 != (seg_size % page_in_grains))) {
ERR("Invalid parameter page_size=%u grain_size=%"PRIu64" seg_size=%"PRIu64,
lsa_cfg->page_size, grain_size, seg_size);
goto fail0;
}
if (unlikely(!is_power_of_two(lsa_cfg->page_size))) {
ERR("Invalid parameter page_size=%u not a power of two",
lsa_cfg->page_size);
goto fail0;
}
if (SALSA_GC_MAX_IO_WORKERS < page_in_grains) {
ERR("Invalid parameter page_size in grains=%u bigger than GC max IO buffer=%u grains",
page_in_grains, SALSA_GC_MAX_IO_WORKERS);
goto fail0;
}
if ((page_in_grains < rmap_size || 0 != (page_in_grains % rmap_size)) &&
lsa_cfg->type != STO_CTLR_LSA_SMALL) {
ERR("Invalid parameter page_size=%u not a multiple of rmap size=%"PRIu64,
lsa_cfg->page_size, rmap_size * grain_size);
goto fail0;
}
if (lsa_cfg->large_page_size <= lsa_cfg->small_page_size &&
lsa_cfg->type == STO_CTLR_LSA_SMALL) {
ERR("Invalid parameter small_page_size=%u >= large_page_size=%u",
lsa_cfg->small_page_size, lsa_cfg->large_page_size);
goto fail0;
}
if (unlikely(lsa_cfg->dev_size < seg_size * grain_size)) {
ERR("Invalid parameter dev_size=%"PRIu64" too small"\
" (seg*page=%"PRIu64")", lsa_cfg->dev_size,
(u64) seg_size * grain_size);
goto fail0;
}
if (unlikely(lsa_cfg->dev_size <= lsa_cfg->logical_size)) {
ERR("Invalid parameter dev_size=%"PRIu64" smaller than "\
"logical_size=%"PRIu64,
lsa_cfg->dev_size, lsa_cfg->logical_size);
goto fail0;
}
if (unlikely(lsa_cfg->dev_size % lsa_cfg->page_size != 0)) {
ERR("Invalid parameter dev_size=%"PRIu64" not divisible by "\
"page_size=%u", lsa_cfg->dev_size, lsa_cfg->page_size);
goto fail0;
}
if (unlikely(lsa_cfg->logical_size % lsa_cfg->page_size != 0)) {
ERR("Invalid parameter logical_size=%"PRIu64" not divisible "\
"by page_size=%u", lsa_cfg->logical_size,
lsa_cfg->page_size);
goto fail0;
}
if (unlikely(SALSA_MAX_STREAMS < lsa_cfg->stream_nr)) {
ERR("Invalid parameter stream_nr=%u larger than %u "\
"(max for streams)", lsa_cfg->stream_nr,
SALSA_MAX_STREAMS);
goto fail0;
}
if (unlikely(SALSA_MAX_STREAMS < lsa_cfg->rel_stream_nr)) {
ERR("Invalid parameter rel_stream_nr=%u larger than %u "\
"(max for streams)", lsa_cfg->rel_stream_nr,
SALSA_MAX_STREAMS);
goto fail0;
}
if (lsa_cfg->cache_size < 1) {
ERR("Invalid cfg value: invalid cache_size (< 1)");
goto fail0;
}
if (unlikely(SALSA_MAX_GENERATIONS < lsa_cfg->generation_nr ||
lsa_cfg->stream_nr < lsa_cfg->generation_nr)) {
ERR("Invalid parameter generation_nr=%u larger than streams %u "\
"(max for generations)", lsa_cfg->generation_nr,
lsa_cfg->stream_nr);
goto fail0;
}
if ((lsa_cfg->dev_size - lsa_cfg->logical_size) / (seg_size * grain_size) < min_seg_nr &&
lsa_cfg->type != STO_CTLR_LSA_SMALL) {
ERR("Overprovisioning space less than MIN segs =%u"\
", aborting. logical=%"PRIu64" physical=%"PRIu64,
min_seg_nr, lsa_cfg->logical_size,
lsa_cfg->dev_size);
goto fail0;
}
if ((lsa_cfg->dev_size / (u64) lsa_cfg->page_size) > (1ULL << LBA_PBA_BITS)) {
ERR("Device larger than supported. Max 16TiB requested=%"PRIu64"GiB",
lsa_cfg->dev_size / (1UL << 30));
goto fail0;
}
if (300 < lsa_cfg->precond_rnd_percent) {
ERR("Wrong number of rnd precondition given %u.",
lsa_cfg->precond_rnd_percent);
goto fail0;
}
err = 0;
fail0:
return err;
}
int set_storage_params_dev_size(
struct sto_ctlr_parameters *const sto_cfg,
u64 dev_size, /* # sectors */
char **const err)
{
int rc = 0;
u64 logical_size;
u64 logical_utilization;
const u64 page_ssize = B2SEC(sto_cfg->page_size);
dev_size = align_down(dev_size, page_ssize);
if (unlikely(SEC2B(dev_size) < sto_cfg->page_size)) {
*err = "Device size too small";
rc = -EINVAL;
goto out0;
}
logical_utilization = 1000ULL - sto_cfg->overprovision;
logical_size = (dev_size * logical_utilization) / (1000ULL);
/* make logical_size upper aligned to page_size */
logical_size = uceil_up(logical_size, page_ssize);
sto_cfg->dev_size = SEC2B(dev_size);
sto_cfg->logical_size = SEC2B(logical_size);
out0:
return rc;
}
void reset_gc_config(struct gc_parameters *const gc_cfg)
{
gc_cfg->bin_nr = 4;
gc_cfg->gc = GC_NBIN_XNP_OVRW_HEAT_SEG;
gc_cfg->low_watermark = 3U;
gc_cfg->high_watermark = 5U;
gc_cfg->xnp_pct = 9;
gc_cfg->xnp_hot_pct = 0;
gc_cfg->thread_nr = 1;
}
void reset_scm_config(struct scm_parameters *const scm_cfg)
{
unsigned i;
memset(scm_cfg, 0, sizeof(*scm_cfg));
scm_cfg->dev_size_raw = 0UL; /* init to impossible value */
scm_cfg->grain_size = 4096; /* # of bytes per page */
scm_cfg->segment_size = 64; /* # of pages per segment */
scm_cfg->rmap_grain_size = 1; /* # of pages per segment */
scm_cfg->simulation = 0;
scm_cfg->must_rebuild = 0;
scm_cfg->use_rmap = 0;
scm_cfg->dont_rebuild = 0;
scm_cfg->raid = RAID0;
scm_cfg->dev_nr = 1;
scm_cfg->seg_qs_conf = SCM_SEG_QUEUES_ONE;
reset_gc_config(&scm_cfg->gc_params);
scm_dev_props_reset(&scm_cfg->cfg_scm_props);
for (i=0; i<SCM_MAX_DEVICES; i++)
scm_dev_props_reset(scm_cfg->cfg_dev_props + i);
}
void reset_storage_config(struct sto_ctlr_parameters *const sto_cfg)
{
struct timeval now;
if (0 != gettimeofday(&now, NULL)) {
perror("gettimeofday");
exit(1);
}
memset(sto_cfg, 0, sizeof(*sto_cfg));
sto_cfg->page_size = 4096; /* # of bytes per page */
sto_cfg->small_page_size = 4096; /* # of bytes per page */
sto_cfg->stream_nr = 1;
sto_cfg->rel_stream_nr = 1;
sto_cfg->generation_nr = 1;
sto_cfg->precondition = 0;
sto_cfg->overprovision = 200; /* thousandths of physical space */
sto_cfg->type = STO_CTLR_LSA;
sto_cfg->lba_heat_bits = 0;
sto_cfg->uip_cache_size = (1U<<25); /* bytes */
sto_cfg->precond_rnd_percent = 30;
sto_cfg->dev_size = 0UL; /* init to impossible value */
sto_cfg->logical_size = 0UL; /* init to impossible value */
sto_cfg->small_logical_size = 0UL; /* init to impossible value */
sto_cfg->cache_size = 4;
sto_cfg->inject_write_delay = 0;
sto_cfg->inject_read_delay = 0;
sto_cfg->was_rebuild = false;
sto_cfg->dont_rebuild = false;
sto_cfg->sc_prop_set = SCM_PROP_SET_ALL;
sto_cfg->sc_small_prop_set = SCM_PROP_SET_EMPTY;
sto_cfg->seed = now.tv_sec;
sto_cfg->small_pages_per_md_pg = 510;
}
void set_private_storage_config(
struct sto_ctlr_parameters *const sto_cfg,
void *const private)
{
sto_cfg->private = private;
}
| 33.912458 | 99 | 0.677274 |
b1a4f6947ee0e5671bf7dcb77591908228044beb | 2,385 | ps1 | PowerShell | PowerJira/public/api-v2/issue/Invoke-JiraGetIssuePickerSuggestions.ps1 | ender2021/PowerJira | 3d859e50ad9db78040741d2d84eb93e0e1ccf19c | [
"MIT"
] | 5 | 2019-12-07T03:51:01.000Z | 2021-09-14T13:27:26.000Z | PowerJira/public/api-v2/issue/Invoke-JiraGetIssuePickerSuggestions.ps1 | ender2021/PowerJira | 3d859e50ad9db78040741d2d84eb93e0e1ccf19c | [
"MIT"
] | 1 | 2020-09-07T08:49:59.000Z | 2020-09-07T10:18:39.000Z | PowerJira/public/api-v2/issue/Invoke-JiraGetIssuePickerSuggestions.ps1 | ender2021/PowerJira | 3d859e50ad9db78040741d2d84eb93e0e1ccf19c | [
"MIT"
] | 2 | 2020-05-16T04:12:26.000Z | 2020-08-11T20:40:36.000Z | #https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issue-picker-get
function Invoke-JiraGetIssuePickerSuggestions {
[CmdletBinding()]
param (
# A string to match against text fields in the issue such as title, description, or comments.
[Parameter(Position=0,ValueFromPipelineByPropertyName)]
[string]
$TextFilter,
# A JQL string defining the set of issues from which to make suggestions
[Parameter(Position=1,ValueFromPipelineByPropertyName)]
[string]
$JqlFilter,
# The ID of a project to which an issue must belong in order to be included in the suggestions
[Parameter(Position=2,ValueFromPipelineByPropertyName)]
[int32]
$ProjectId,
# Provide a single issue key to be excluded from results. Useful if using this in the context of an issue.
[Parameter(Position=3,ValueFromPipelineByPropertyName)]
[string]
$ExcludeIssueKey,
# Set this flag to exclude the parent issue from results if ExcludeIssueKey is a subtask
[Parameter(ValueFromPipelineByPropertyName)]
[switch]
$HideSubTaskParent,
# Set this flag to exclude subtasks from the suggestion list
[Parameter(ValueFromPipelineByPropertyName)]
[switch]
$HideSubTasks,
# The JiraContext object to use for the request
[Parameter()]
[object]
$JiraContext
)
begin {
$results = @()
}
process {
$functionPath = "/rest/api/2/issue/picker"
$verb = "GET"
$query = New-PACRestMethodQueryParams @{
showSubTasks = !$HideSubTasks
showSubTaskParent = !$HideSubTaskParent
}
if($PSBoundParameters.ContainsKey("TextFilter")){$query.Add("query",$TextFilter)}
if($PSBoundParameters.ContainsKey("JqlFilter")){$query.Add("currentJQL",$JqlFilter)}
if($PSBoundParameters.ContainsKey("ProjectFilter")){$query.Add("currentProjectId",$ProjectFilter)}
if($PSBoundParameters.ContainsKey("ExcludeIssueKey")){$query.Add("currentIssueKey",$ExcludeIssueKey)}
$method = New-PACRestMethod $functionPath $verb $query
$results += $method.Invoke($JiraContext)
}
end {
$results
}
} | 38.467742 | 116 | 0.634382 |
557db8f8e7ffdeee0908edb024ae6deacbcb9d52 | 344 | lua | Lua | lua/hpwrewrite/skins/neoskins/lioadvancedwand.lua | AdamCyffka/Hogwarts-Wands | 5dc7c5b9d438498b927dbe01838d744770fcea62 | [
"MIT"
] | null | null | null | lua/hpwrewrite/skins/neoskins/lioadvancedwand.lua | AdamCyffka/Hogwarts-Wands | 5dc7c5b9d438498b927dbe01838d744770fcea62 | [
"MIT"
] | null | null | null | lua/hpwrewrite/skins/neoskins/lioadvancedwand.lua | AdamCyffka/Hogwarts-Wands | 5dc7c5b9d438498b927dbe01838d744770fcea62 | [
"MIT"
] | null | null | null | local Skin = { }
Skin.Base = "Wand"
Skin.Description = [[
Generic Description
]]
Skin.ViewModel = Model("models/hpwrewrite/custom/c_lioadvancedwand.mdl")
Skin.WorldModel = Model("models/hpwrewrite/custom/w_lioadvancedwand.mdl")
Skin.NodeOffset = Vector(2080, -158, 0)
Skin.HoldType = "pistol"
HpwRewrite:AddSkin("Lio Advanced Wand", Skin) | 22.933333 | 73 | 0.747093 |
0ceb7ee6367f4094900b7a7ad37575ea6ba9548d | 5,680 | py | Python | minidump/streams/MiscInfoStream.py | lucasg/minidump | 18474e3221038abe866256e4e0eb255e33615110 | [
"MIT"
] | 1 | 2021-06-13T10:00:44.000Z | 2021-06-13T10:00:44.000Z | minidump/streams/MiscInfoStream.py | lucasg/minidump | 18474e3221038abe866256e4e0eb255e33615110 | [
"MIT"
] | null | null | null | minidump/streams/MiscInfoStream.py | lucasg/minidump | 18474e3221038abe866256e4e0eb255e33615110 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
#
# Author:
# Tamas Jos (@skelsec)
#
import io
import enum
#https://msdn.microsoft.com/en-us/library/windows/desktop/ms680388(v=vs.85).aspx
class MinidumpMiscInfo2Flags1(enum.IntFlag):
MINIDUMP_MISC1_PROCESS_ID = 0x00000001 #ProcessId is used.
MINIDUMP_MISC1_PROCESS_TIMES = 0x00000002 #ProcessCreateTime, ProcessKernelTime, and ProcessUserTime are used.
MINIDUMP_MISC1_PROCESSOR_POWER_INFO = 0x00000004 #ProcessorMaxMhz, ProcessorCurrentMhz, ProcessorMhzLimit, ProcessorMaxIdleState, and ProcessorCurrentIdleState are used.
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms680389(v=vs.85).aspx
class MinidumpMiscInfoFlags1(enum.IntFlag):
MINIDUMP_MISC1_PROCESS_ID = 0x00000001 #ProcessId is used.
MINIDUMP_MISC1_PROCESS_TIMES = 0x00000002 #ProcessCreateTime, ProcessKernelTime, and ProcessUserTime are used.
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms680389(v=vs.85).aspx
class MINIDUMP_MISC_INFO:
size = 24
def __init__(self):
self.SizeOfInfo = None
self.Flags1 = None
self.ProcessId = None
self.ProcessCreateTime = None
self.ProcessUserTime = None
self.ProcessKernelTime = None
def parse(buff):
mmi = MINIDUMP_MISC_INFO()
mmi.SizeOfInfo = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.Flags1 = MinidumpMiscInfoFlags1(int.from_bytes(buff.read(4), byteorder = 'little', signed = False))
if mmi.Flags1 & MinidumpMiscInfoFlags1.MINIDUMP_MISC1_PROCESS_ID:
mmi.ProcessId = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
else:
buff.read(4)
if mmi.Flags1 & MinidumpMiscInfoFlags1.MINIDUMP_MISC1_PROCESS_TIMES:
mmi.ProcessCreateTime = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.ProcessUserTime = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.ProcessKernelTime = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
else:
buff.read(12)
return mmi
#https://msdn.microsoft.com/en-us/library/windows/desktop/ms680388(v=vs.85).aspx
class MINIDUMP_MISC_INFO_2:
size = 44
def __init__(self):
self.SizeOfInfo = None
self.Flags1 = None
self.ProcessId = None
self.ProcessCreateTime = None
self.ProcessUserTime = None
self.ProcessKernelTime = None
self.ProcessorMaxMhz = None
self.ProcessorCurrentMhz = None
self.ProcessorMhzLimit = None
self.ProcessorMaxIdleState = None
self.ProcessorCurrentIdleState = None
def parse(buff):
mmi = MINIDUMP_MISC_INFO_2()
mmi.SizeOfInfo = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.Flags1 = MinidumpMiscInfo2Flags1(int.from_bytes(buff.read(4), byteorder = 'little', signed = False))
if mmi.Flags1 & MinidumpMiscInfo2Flags1.MINIDUMP_MISC1_PROCESS_ID:
mmi.ProcessId = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
else:
buff.read(4)
if mmi.Flags1 & MinidumpMiscInfo2Flags1.MINIDUMP_MISC1_PROCESS_TIMES:
mmi.ProcessCreateTime = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.ProcessUserTime = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.ProcessKernelTime = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
else:
buff.read(12)
if mmi.Flags1 & MinidumpMiscInfo2Flags1.MINIDUMP_MISC1_PROCESSOR_POWER_INFO:
mmi.ProcessorMaxMhz = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.ProcessorCurrentMhz = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.ProcessorMhzLimit = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.ProcessorMaxIdleState = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
mmi.ProcessorCurrentIdleState = int.from_bytes(buff.read(4), byteorder = 'little', signed = False)
else:
buff.read(20)
return mmi
class MinidumpMiscInfo:
def __init__(self):
self.ProcessId = None
self.ProcessCreateTime = None
self.ProcessUserTime = None
self.ProcessKernelTime = None
self.ProcessorMaxMhz = None
self.ProcessorCurrentMhz = None
self.ProcessorMhzLimit = None
self.ProcessorMaxIdleState = None
self.ProcessorCurrentIdleState = None
def parse(dir, buff):
t = MinidumpMiscInfo()
buff.seek(dir.Location.Rva)
chunk = io.BytesIO(buff.read(dir.Location.DataSize))
if dir.Location.DataSize == MINIDUMP_MISC_INFO.size:
misc = MINIDUMP_MISC_INFO.parse(chunk)
t.ProcessId = misc.ProcessId
t.ProcessCreateTime = misc.ProcessCreateTime
t.ProcessUserTime = misc.ProcessUserTime
t.ProcessKernelTime = misc.ProcessKernelTime
else:
misc = MINIDUMP_MISC_INFO_2.parse(chunk)
t.ProcessId = misc.ProcessId
t.ProcessCreateTime = misc.ProcessCreateTime
t.ProcessUserTime = misc.ProcessUserTime
t.ProcessKernelTime = misc.ProcessKernelTime
t.ProcessorMaxMhz = misc.ProcessorMaxMhz
t.ProcessorCurrentMhz = misc.ProcessorCurrentMhz
t.ProcessorMhzLimit = misc.ProcessorMhzLimit
t.ProcessorMaxIdleState = misc.ProcessorMaxIdleState
t.ProcessorCurrentIdleState = misc.ProcessorCurrentIdleState
return t
def __str__(self):
t = '== MinidumpMiscInfo ==\n'
t += 'ProcessId %s\n' % self.ProcessId
t += 'ProcessCreateTime %s\n' % self.ProcessCreateTime
t += 'ProcessUserTime %s\n' % self.ProcessUserTime
t += 'ProcessKernelTime %s\n' % self.ProcessKernelTime
t += 'ProcessorMaxMhz %s\n' % self.ProcessorMaxMhz
t += 'ProcessorCurrentMhz %s\n' % self.ProcessorCurrentMhz
t += 'ProcessorMhzLimit %s\n' % self.ProcessorMhzLimit
t += 'ProcessorMaxIdleState %s\n' % self.ProcessorMaxIdleState
t += 'ProcessorCurrentIdleState %s\n' % self.ProcessorCurrentIdleState
return t | 42.074074 | 170 | 0.757394 |
9cd55a3eefe460e41330a93a57e8adde316af2ba | 413 | css | CSS | Git y GitHub/Resumenes/Proyecto/css/style.css | David9652/Platzi | 7214e42b68ffe0cc878b6a76de06a14c8b62e6fe | [
"MIT"
] | null | null | null | Git y GitHub/Resumenes/Proyecto/css/style.css | David9652/Platzi | 7214e42b68ffe0cc878b6a76de06a14c8b62e6fe | [
"MIT"
] | null | null | null | Git y GitHub/Resumenes/Proyecto/css/style.css | David9652/Platzi | 7214e42b68ffe0cc878b6a76de06a14c8b62e6fe | [
"MIT"
] | 1 | 2021-08-11T02:21:20.000Z | 2021-08-11T02:21:20.000Z | body
{
color: blueviolet;
text-align: center;
font-family: Arial;
font-size: 18px;
margin: 0;
padding: 0;
}
#container
{
width: 50%;
padding: 1em;
border-bottom: 3px solid #fafa;
border-right: 10px solid #FFF233;
border-left: 10px solid #33BEFF;
border-top: 3px solid #FF8533;
text-align: center;
margin: 0 auto;
}
#header #greeting{
color: chocolate;
} | 17.956522 | 37 | 0.615012 |
4b53293d8bc1f4dd5af78f7ad63981d10233f1d1 | 4,822 | html | HTML | site/oquonie.html | XXIIVV/Oscean | 2ab6198a59e936ff7168502190296cd93ea0e79e | [
"MIT"
] | 210 | 2017-11-22T20:15:41.000Z | 2020-04-22T20:25:07.000Z | site/oquonie.html | XXIIVV/Oscean | 2ab6198a59e936ff7168502190296cd93ea0e79e | [
"MIT"
] | 41 | 2018-03-30T00:51:39.000Z | 2020-04-15T01:06:19.000Z | site/oquonie.html | XXIIVV/Oscean | 2ab6198a59e936ff7168502190296cd93ea0e79e | [
"MIT"
] | 59 | 2018-03-13T21:52:39.000Z | 2020-04-04T16:05:06.000Z | <!DOCTYPE html><html><head>
<meta charset="utf-8"/><meta name="viewport" content="width=device-width, inital-scale=1"/><link href="../links/main.css" type="text/css" rel="stylesheet"/><link href="../media/services/icon.png" type="image/png" rel="shortcut icon"/>
<title>XXIIVV — oquonie</title></head><body>
<header><a href="home.html"><img alt="XXIIVV" src="../media/icon/logo.svg"></a></header>
<nav><ul><li><a href="roms.html">roms</a></li><li><a href="tools.html">tools</a></li><li><a href="utilities.html">utilities</a></li><li><a href="formats.html">formats</a></li><li><a href="games.html" class="parent">games</a></li><li><a href="toys.html">toys</a></li><li><a href="mobile.html">mobile</a></li><li><a href="unreleased.html">unreleased</a></li></ul><ul><li><a href="markl.html">markl</a></li><li><a href="verreciel.html">verreciel</a></li><li><a href="donsol_famicom.html">donsol famicom</a></li><li><a href="oquonie.html" class="self">oquonie</a></li><li><a href="hiversaires.html">hiversaires</a></li><li><a href="purgateus.html">purgateus</a></li></ul><ul><li><a href="camilare.html">camilare</a></li></ul></nav><main><figure><img alt="Aboard Pino" src="../media/diary/623.jpg"/><figcaption>Aboard Pino</figcaption></figure><h2>Oquonie is a textless isometric puzzle game.</h2>
<p>You must make your way through a seemingly endless succession of rooms. You will not be alone. Your incarnations will have the help of <b>bizaroid</b> characters that speak an <a href='camilare.html'>an obscure language</a>.</p>
<p>We made Oquonie while living in <a href='japan.html'>japan</a>. The game was our first collaborative project as <a href='hundred_rabbits.html'>hundred rabbits</a>, and a reflection of our experience navigating a new country, with language as a recurent obstacle. Oquonie is about being lost in a foreign space.</p>
<p>A big inspiration for this project was the short story "A town without streets" by Junji Ito, about a city of endless interconnecting houses and rooms, where privacy is non-existent. To preserve the little privacy they do have, the townspeople wear masks.</p>
<iframe frameborder='0' src='https://itch.io/embed/23183?link_color=000000' width='624' height='167'></iframe>
<p>Back in 2013, we both had full-time jobs in different studios in Tokyo, we worked on Oquonie after work, and on weekends, for a total of 6 months. You can learn more about the development of the project <a href='https://100r.co/site/oquonie.html' target='_blank'>here</a>.</p>
<p>Oquonie features an original <a href='oquonie_soundtrack.html'>soundtrack</a>, and was best described as <a href='http://killscreendaily.com/articles/oquonie-maze-worth-entering/' target='_blank'>Animal Crossing in a K-Hole</a>. </p>
<ul>
<li><a href='https://hundredrabbits.itch.io/oquonie' target='_blank'>builds</a></li>
<li><a href='https://github.com/hundredrabbits/oquonie' target='_blank'>source</a></li>
</ul>
<figure><img alt="Nephtaline wandering" src="../media/diary/292.jpg"/><figcaption>Nephtaline wandering</figcaption></figure><figure><img alt="Bit Bazaar" src="../media/diary/285.jpg"/><figcaption>Bit Bazaar</figcaption></figure><figure><img alt="Walkthrough" src="../media/diary/283.jpg"/><figcaption>Walkthrough</figcaption></figure><figure><img alt="Nastazie" src="../media/diary/293.jpg"/><figcaption>Nastazie</figcaption></figure><figure><img alt="A Lost Neomine" src="../media/diary/296.jpg"/><figcaption>A Lost Neomine</figcaption></figure><figure><img alt="Goodies" src="../media/diary/381.jpg"/><figcaption>Goodies</figcaption></figure><figure><img alt="And so began testing" src="../media/diary/379.jpg"/><figcaption>And so began testing</figcaption></figure><figure><img alt="From Thailand" src="../media/diary/573.jpg"/><figcaption>From Thailand</figcaption></figure><ul><li><code>11E02</code> — Oquonie Desktop Release</li></ul><p><b>Incoming</b>: <a href="oquonie_soundtrack.html">oquonie soundtrack</a> <a href="verreciel.html">verreciel</a> <a href="hiversaires.html">hiversaires</a> <a href="hundred_rabbits.html">hundred rabbits</a> <a href="rekka.html">rekka</a> </p></main>
<footer><a href="https://creativecommons.org/licenses/by-nc-sa/4.0" target="_blank"><img src="../media/icon/cc.svg" alt="CreativeCommons"/></a> <a href="https://webring.xxiivv.com/" target="_blank"><img src="../media/icon/webring.svg" alt="Webring"/></a> <a href="https://merveilles.town/@neauoire" rel="me" target="_blank"><img src="../media/icon/merveilles.svg" alt="Merveilles"/></a> <a href="ethics.html"><img src="../media/icon/dreipfeile.svg" alt="NoNazis!"/></a> <a href="uxn.html"><img src="../media/icon/uxn.svg" alt="UxnPowered"/></a> <span><a href="devine_lu_linvega.html">Devine Lu Linvega</a> © 2022 — <a href="about.html">BY-NC-SA 4.0</a></span></footer>
</body></html> | 200.916667 | 1,198 | 0.713397 |
e6a1c5212857d0a9262e4b72add3982c0df50c4a | 69,320 | sql | SQL | gighub.sql | tianboyand/gighub.id | 0c1afd1ef29eb2e94d666d98e1c07f3da65dd9be | [
"MIT"
] | null | null | null | gighub.sql | tianboyand/gighub.id | 0c1afd1ef29eb2e94d666d98e1c07f3da65dd9be | [
"MIT"
] | null | null | null | gighub.sql | tianboyand/gighub.id | 0c1afd1ef29eb2e94d666d98e1c07f3da65dd9be | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Jan 27, 2017 at 07:04 PM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 5.6.24
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `gighub4`
--
-- --------------------------------------------------------
--
-- Table structure for table `admins`
--
CREATE TABLE `admins` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `admins`
--
INSERT INTO `admins` (`id`, `name`, `email`, `password`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'heri', 'heri@gmail.com', '$2y$10$stMd4anSPfmL/hNey3TX.utMBLyZJeHTzdFcgppO4ujqN0fXsEvQ6', '6S2CfivFMkjyboyGlOfLkxT4MWVrbMVamVAppCGhsp15Iu2vRf3Vv4gVfkwW', NULL, '2016-12-01 20:22:41'),
(2, 'admin1', 'admin1@gighub.com', '$2y$10$cS/iInvBorkPpscSDbsWkeBxLYvIdTpExpq43r2ZJJGX07Ar8VpoC', 'kP77bJzzCY7lez98rxRHEoUDPcge0mEybctPsYg1HKUc4o3AnAVpMuJXrRlt', '2016-12-22 13:58:40', '2016-12-22 15:38:53');
-- --------------------------------------------------------
--
-- Table structure for table `banks`
--
CREATE TABLE `banks` (
`id` int(10) UNSIGNED NOT NULL,
`nama_bank` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`no_rek` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`atas_nama` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`cabang` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `banks`
--
INSERT INTO `banks` (`id`, `nama_bank`, `no_rek`, `atas_nama`, `cabang`, `created_at`, `updated_at`) VALUES
(1, 'BCA', '0284579482543', 'Heri', '', '2016-10-21 06:10:26', '2016-10-21 06:10:26'),
(2, 'BNI', '00000009875', 'Dewi Sari', '', '2016-10-21 06:12:53', '2016-10-21 06:12:53'),
(3, 'Mandiri', '12345367', 'Dewo', '', '2016-10-23 19:46:42', '2016-10-23 19:46:42'),
(4, 'BRI', '31231413', 'heru', '', '2016-11-24 02:50:15', '2016-11-24 02:50:15'),
(6, 'BRI', '000098129789912', 'Satu Musisi', '', '2016-12-22 13:42:49', '2016-12-22 13:42:49'),
(7, 'BRI', '088525511535758', 'Edinofri', '', '2017-01-19 10:41:27', '2017-01-19 10:41:27'),
(8, 'BRI', '00067334864963', 'Muhammad Irfan', '', '2017-01-25 23:10:01', '2017-01-25 23:10:01');
-- --------------------------------------------------------
--
-- Table structure for table `bank_admin`
--
CREATE TABLE `bank_admin` (
`id` int(10) UNSIGNED NOT NULL,
`nama_bank` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`no_rek` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`atas_nama` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`cabang` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `bank_admin`
--
INSERT INTO `bank_admin` (`id`, `nama_bank`, `no_rek`, `atas_nama`, `cabang`, `created_at`, `updated_at`) VALUES
(1, 'BRI', '230109230827', 'PT. Gighub Indonesia', 'Medan', '2016-10-21 06:11:32', '2016-10-21 06:11:32'),
(2, 'BCA', '09087871824', 'PT. Gighub Indonesia', 'Medan', '2016-10-21 06:11:41', '2016-10-21 06:11:41'),
(3, 'Mandiri', '000092132323', 'PT. Gighub Indonesia', 'Medan', '2016-10-21 06:11:51', '2016-10-21 06:11:51');
-- --------------------------------------------------------
--
-- Table structure for table `bank_musisi`
--
CREATE TABLE `bank_musisi` (
`id` int(10) UNSIGNED NOT NULL,
`musician_id` int(10) UNSIGNED NOT NULL,
`bank_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `bank_musisi`
--
INSERT INTO `bank_musisi` (`id`, `musician_id`, `bank_id`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '2016-10-21 06:10:26', '2016-10-21 06:10:26'),
(2, 2, 2, '2016-10-21 06:12:53', '2016-10-21 06:12:53'),
(3, 3, 3, '2016-10-23 19:46:42', '2016-10-23 19:46:42'),
(4, 4, 4, '2016-11-24 02:50:15', '2016-11-24 02:50:15'),
(5, 6, 6, '2016-12-22 13:42:49', '2016-12-22 13:42:49'),
(6, 7, 7, '2017-01-19 10:41:27', '2017-01-19 10:41:27'),
(7, 8, 8, '2017-01-25 23:10:01', '2017-01-25 23:10:01');
-- --------------------------------------------------------
--
-- Table structure for table `genres`
--
CREATE TABLE `genres` (
`id` int(10) UNSIGNED NOT NULL,
`genre_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `genres`
--
INSERT INTO `genres` (`id`, `genre_name`, `created_at`, `updated_at`) VALUES
(1, 'Pop', '2016-10-21 06:08:46', '2016-10-21 06:08:46'),
(2, 'Rock', '2016-10-21 06:08:49', '2016-10-21 06:08:49'),
(3, 'Jazz', '2016-10-21 06:08:53', '2016-10-21 06:08:53'),
(4, 'Dangdut', '2016-10-21 06:08:56', '2016-10-21 06:08:56'),
(5, 'Regae', '2016-10-21 06:09:03', '2016-10-21 06:09:03');
-- --------------------------------------------------------
--
-- Table structure for table `genre_bands`
--
CREATE TABLE `genre_bands` (
`id` int(10) UNSIGNED NOT NULL,
`band_id` int(10) UNSIGNED NOT NULL,
`genre_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `genre_bands`
--
INSERT INTO `genre_bands` (`id`, `band_id`, `genre_id`, `created_at`, `updated_at`) VALUES
(2, 1, 2, '2016-10-21 06:30:37', '2016-10-21 06:30:37'),
(4, 2, 1, '2016-10-21 06:41:33', '2016-10-21 06:41:33'),
(5, 2, 3, '2016-10-21 06:41:33', '2016-10-21 06:41:33'),
(8, 3, 5, '2016-10-31 08:42:20', '2016-10-31 08:42:20'),
(9, 1, 3, '2016-10-31 23:40:28', '2016-10-31 23:40:28'),
(10, 1, 1, '2016-10-31 23:40:28', '2016-10-31 23:40:28'),
(11, 4, 1, '2016-12-22 14:29:28', '2016-12-22 14:29:28'),
(13, 6, 5, '2017-01-25 23:29:02', '2017-01-25 23:29:02');
-- --------------------------------------------------------
--
-- Table structure for table `genre_musisi`
--
CREATE TABLE `genre_musisi` (
`id` int(10) UNSIGNED NOT NULL,
`musician_id` int(10) UNSIGNED NOT NULL,
`genre_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `genre_musisi`
--
INSERT INTO `genre_musisi` (`id`, `musician_id`, `genre_id`, `created_at`, `updated_at`) VALUES
(1, 1, 1, '2016-10-21 06:10:26', '2016-10-21 06:10:26'),
(2, 1, 3, '2016-10-21 06:10:27', '2016-10-21 06:10:27'),
(3, 2, 3, '2016-10-21 06:12:53', '2016-10-21 06:12:53'),
(4, 3, 2, '2016-10-23 19:46:42', '2016-10-23 19:46:42'),
(5, 3, 3, '2016-10-23 19:46:42', '2016-10-23 19:46:42'),
(6, 3, 5, '2016-10-23 19:46:42', '2016-10-23 19:46:42'),
(7, 4, 1, '2016-11-24 02:50:15', '2016-11-24 02:50:15'),
(8, 4, 2, '2016-11-24 02:50:15', '2016-11-24 02:50:15'),
(9, 6, 1, '2016-12-21 22:04:33', '2016-12-21 22:04:33'),
(10, 7, 4, '2017-01-24 10:59:22', '2017-01-24 10:59:22'),
(11, 9, 1, '2017-01-25 22:28:05', '2017-01-25 22:28:05'),
(12, 8, 4, '2017-01-25 23:09:24', '2017-01-25 23:09:24'),
(13, 8, 5, '2017-01-25 23:09:24', '2017-01-25 23:09:24');
-- --------------------------------------------------------
--
-- Table structure for table `gigs`
--
CREATE TABLE `gigs` (
`id` int(10) UNSIGNED NOT NULL,
`nama_gig` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deskripsi` text COLLATE utf8_unicode_ci NOT NULL,
`photo_gig` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`lokasi` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`detail_lokasi` text COLLATE utf8_unicode_ci NOT NULL,
`lat` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`lng` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`genre` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`tipe` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`tanggal_mulai` datetime NOT NULL,
`tanggal_selesai` datetime NOT NULL,
`status` enum('0','1') COLLATE utf8_unicode_ci NOT NULL,
`type_gig` enum('sewa','post') COLLATE utf8_unicode_ci NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`aktif` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL,
`slug` text COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `gigs`
--
INSERT INTO `gigs` (`id`, `nama_gig`, `deskripsi`, `photo_gig`, `lokasi`, `detail_lokasi`, `lat`, `lng`, `genre`, `tipe`, `tanggal_mulai`, `tanggal_selesai`, `status`, `type_gig`, `user_id`, `aktif`, `slug`, `created_at`, `updated_at`) VALUES
(1, 'Malam Perpisahan SMAN 99 MEDAN', 'Malam perpisahan anak SMA', 'fsmdlymq641hi0aks8nw', 'Jl. STM, Suka Maju, Medan City, North Sumatra, Indonesia', 'STM, No.99', '3.534926399999999', '98.69144289999997', '', '', '2016-10-30 18:00:00', '2016-10-30 22:00:00', '1', 'post', 1, 'Y', 'malam-perpisahan-sman-99-medan', '2016-10-21 06:16:41', '2016-10-21 06:16:41'),
(3, 'My Wedding Hera', 'Acara resepsi pernikahan', 'sample', 'Medan, Medan City, North Sumatra, Indonesia', 'Adimulya Hotel Ballroom', '3.5951956', '98.67222270000002', '', '', '2016-11-05 10:00:00', '2016-11-05 21:00:00', '1', 'post', 1, 'Y', 'my-wedding-hera', '2016-10-23 19:53:44', '2016-10-23 19:53:44'),
(4, 'Acara Makan Makan', 'Acara makan makan dan syukuran', 'kvyefxpzyizrxvvctasb', 'Jl. Bilal, Pulo Brayan Darat I, Medan City, North Sumatra, Indonesia', 'Komplek Bilal Residence, No.8', '3.6228308', '98.68308290000004', '', '', '2016-11-10 11:00:00', '2016-11-10 17:00:00', '1', 'post', 1, 'Y', 'acara-makan-makan', '2016-10-25 23:00:03', '2016-10-25 23:01:09'),
(5, 'Ulang Tahun My Kids', 'Acara ulang tahun anak anak', 'j0etkdvlzhaarng6rjlt', 'Jalan Ring Road, Tanjung Sari, Medan City, North Sumatra, Indonesia', 'Komplek Grand Emerald, No.1 Blok B', '3.5530459', '98.62610659999996', '', '', '2016-10-31 14:00:00', '2016-10-31 17:00:00', '1', 'post', 1, 'Y', 'ulang-tahun-my-kids', '2016-10-25 23:41:15', '2016-10-25 23:51:47'),
(10, 'Acara kibod', 'Acara perayaan ulang tahun kelurahan', '', 'Jalan Jendral Gatot Subroto, Sei Sikambing D, Medan City, North Sumatra, Indonesia', 'Gg.Kenanga No.123', '3.590270699999999', '98.65402369999993', '', '', '2016-11-10 18:00:00', '2016-11-10 23:00:00', '1', 'sewa', 1, 'Y', 'acara-kibod', '2016-10-27 06:57:59', '2016-10-27 07:22:30'),
(11, 'Acara test', 'test aja', '', 'J. L. Gordon Street, Tel Aviv-Yafo, Israel', 'medan', '32.08166899999999', '34.774463999999966', '', '', '2016-11-10 18:00:00', '2016-11-10 23:00:00', '1', 'post', 1, 'Y', 'acara-test', '2016-10-27 07:34:23', '2016-10-30 23:20:25'),
(12, 'Acarat ntah apa', 'fgdfhdjdj', '', 'J. L. Long Middle School, Reiger Avenue, Dallas, TX, United States', 'Jauh', '32.80678350000001', '-96.74906470000002', '', '', '2016-11-10 18:00:00', '2016-11-10 22:00:00', '1', 'post', 1, 'Y', 'acarat-ntah-apa', '2016-10-27 07:36:15', '2016-10-27 23:38:15'),
(13, 'Acara Makan Bersama', 'sdgfsgfdgdfgh', '', 'J. L. Long Middle School, Reiger Avenue, Dallas, TX, United States', 'diman aja', '32.80678350000001', '-96.74906470000002', '', '', '2016-11-10 18:00:00', '2016-11-10 23:00:00', '1', 'sewa', 1, 'Y', 'acara-makan-bersama', '2016-10-28 07:13:45', '2016-11-01 19:20:35'),
(14, 'Acara test eror', 'att gdf', '', 'Medan, Medan City, North Sumatra, Indonesia', 'Jl.bilal', '3.5951956', '98.67222270000002', '', '', '2016-11-10 13:00:00', '2016-11-10 17:00:00', '1', 'sewa', 1, 'Y', 'acara-test-eror', '2016-10-30 23:31:50', '2016-10-30 23:32:20'),
(15, 'hao hao', 'hao hao', '', 'Marindal Satu, Deli Serdang Regency, North Sumatra, Indonesia', 'Jl. Bajak 5', '3.5250683', '98.7095789', '', '', '2016-11-08 18:00:00', '2016-11-08 20:00:00', '1', 'sewa', 1, 'Y', 'hao-hao', '2016-11-06 01:04:50', '2016-11-06 01:20:20'),
(19, 'Jo', 'asklf', '', 'Deli Tua', 'aksdjnl', '3.561332', '98.652952', '', '', '2017-00-14 19:00:00', '2017-00-14 21:00:00', '0', 'post', 2, 'Y', 'jo', '2017-01-10 09:49:35', '2017-01-10 09:49:35'),
(20, 'kulinerq', 'ksnoamkns', '', 'Jalan Halat, West Pasar Merah, Medan City, North Sumatra, Indonesia', 'nomor 45', '3.573079', '98.666878', '', '', '2017-00-14 19:00:00', '2017-00-14 21:00:00', '0', 'post', 2, 'Y', 'kulinerq', '2017-01-10 11:05:10', '2017-01-10 11:05:10'),
(21, 'opo', 'di pemandian', '', 'Penen, Deli Serdang Regency, North Sumatra, Indonesia', 'pemandian ', '3.3260592', '98.63256109999998', '', '', '2017-01-14 19:00:00', '2017-01-14 21:00:00', '0', 'post', 2, 'Y', 'opo', '2017-01-10 12:35:45', '2017-01-10 12:35:45'),
(22, 'Dua Band', 'sebentar aja', '', 'Jl. Perwira, Deli Tua, Kabupaten Deli Serdang, Sumatera Utara 20355, Indonesia', 'no. 46, sebelah pabrik opak', '3.5028321', '98.68077579999999', '', '', '2017-00-21 20:00:00', '2017-00-21 21:00:00', '0', 'post', 2, 'Y', 'dua-band', '2017-01-13 08:39:38', '2017-01-13 08:39:38'),
(23, 'SMA Istiqlal', 'iya sekolah', '', 'Jl. St., Suka Makmur, Deli Tua, Kabupaten Deli Serdang, Sumatera Utara, Indonesia', 'Sekolah ', '3.518514699999999', '98.684947', '', '', '2017-00-17 13:00:00', '2017-00-17 15:00:00', '0', 'post', 2, 'Y', 'sma-istiqlal', '2017-01-13 11:47:36', '2017-01-13 11:47:36'),
(25, 'Ulang Tahun Dina', 'kmasdk', '', 'Jalan Satria, Deli Tua, Deli Serdang Regency, North Sumatra, Indonesia', 'No. 56, sebelah pabrik tahu', '3.5054497', '98.68095990000006', '', '', '2017-01-31 19:00:00', '2017-02-01 21:00:00', '0', 'sewa', 2, 'Y', 'ulang-tahun-dina-2', '2017-01-19 07:50:10', '2017-01-19 07:50:10'),
(26, 'makan makan', '', '', 'Jl. Mawar, Suka Makmur, Deli Tua, Kabupaten Deli Serdang, Sumatera Utara 20147, Indonesia', 'nomor 3, rumah warna hijau', '', '', '', '', '2017-02-11 19:00:00', '2017-02-11 21:00:00', '0', 'sewa', 2, 'Y', 'makan-makan', '2017-01-24 14:05:12', '2017-01-24 14:05:12'),
(27, 'ajaib', '', '', 'Gg. Tj., Suka Makmur, Deli Tua, Kabupaten Deli Serdang, Sumatera Utara 20147, Indonesia', 'iyaaa', '', '', '', '', '2017-02-11 19:00:00', '2017-02-11 21:00:00', '0', 'sewa', 2, 'Y', 'ajaib', '2017-01-24 14:12:42', '2017-01-24 14:12:42'),
(28, 'halal bi halal', 'aman', '', 'Jl. Aman, Suka Makmur, Deli Tua, Kabupaten Deli Serdang, Sumatera Utara 20147, Indonesia', 'no. 67, cat warna merah muda', '3.5149291000000003', '98.68292149999999', '', '', '2017-02-25 19:00:00', '2017-02-25 21:00:00', '0', 'post', 2, 'Y', 'halal-bi-halal', '2017-01-24 14:27:53', '2017-01-24 14:27:53'),
(29, 'nikahan dina', 'iya kuning', 'fbbtcm1zecanlwebwad6', 'Gg. Mawar, Patumbak Satu, Patumbak, Kabupaten Deli Serdang, Sumatera Utara 20361, Indonesia', 'nomor 6, rumah warna kuning', '3.4640063999999997', '98.7140939', '', '', '2017-02-25 17:00:00', '2017-02-25 22:00:00', '0', 'post', 2, 'Y', 'nikahan-dina', '2017-01-25 11:30:07', '2017-01-25 11:30:07'),
(30, 'sunatan misbar', '', 'svplpxiqxq8xez5brfv5', 'Jl. Bilal Ujung, Pulo Brayan Darat I, Medan Tim., Kota Medan, Sumatera Utara, Indonesia', 'rumah warna hijau, no. 56', '3.6228308', '98.6830829', '', '', '2017-02-11 17:00:00', '2017-02-11 22:00:00', '0', 'sewa', 2, 'Y', 'sunatan-misbar', '2017-01-25 21:24:12', '2017-01-25 21:24:12'),
(31, 'yooo', 'iya', '', 'Gg. Pemuda, Sei Sikambing D, Medan Petisah, Kota Medan, Sumatera Utara 20118, Indonesia', 'yoi', '3.5891547999999998', '98.6474898', '', '', '2017-03-04 17:00:00', '2017-03-04 21:00:00', '0', 'post', 2, 'Y', 'yooo', '2017-01-26 00:12:09', '2017-01-26 00:12:09'),
(32, 'nama lokasinya apa', '', '', 'Jl. Ps. I No.78B, Tj. Sari, Medan Selayang, Kota Medan, Sumatera Utara 20132, Indonesia', 'iyalo', '3.5587583', '98.6276583', '', '', '2017-03-04 17:00:00', '2017-03-04 21:00:00', '0', 'sewa', 2, 'Y', 'nama-lokasinya-apa', '2017-01-26 00:18:39', '2017-01-26 00:18:39');
-- --------------------------------------------------------
--
-- Table structure for table `grupbands`
--
CREATE TABLE `grupbands` (
`id` int(10) UNSIGNED NOT NULL,
`nama_grupband` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`deskripsi` text COLLATE utf8_unicode_ci NOT NULL,
`tipe` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Group',
`basis` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '-',
`kota` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`photo` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`cover` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`harga` int(11) NOT NULL,
`youtube_video` text COLLATE utf8_unicode_ci NOT NULL,
`url_website` text COLLATE utf8_unicode_ci NOT NULL,
`username_soundcloud` text COLLATE utf8_unicode_ci NOT NULL,
`username_reverbnation` text COLLATE utf8_unicode_ci NOT NULL,
`aktif` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL,
`admin_id` int(10) UNSIGNED NOT NULL,
`slug` text COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `grupbands`
--
INSERT INTO `grupbands` (`id`, `nama_grupband`, `deskripsi`, `tipe`, `basis`, `kota`, `photo`, `cover`, `harga`, `youtube_video`, `url_website`, `username_soundcloud`, `username_reverbnation`, `aktif`, `admin_id`, `slug`, `created_at`, `updated_at`) VALUES
(1, 'Kelilingin Band', 'Keliling band', 'Group', 'Trio', 'Medan', 'sample', 'sample', 2000000, '', '', '', '', 'Y', 1, 'kelilingin-band', '2016-10-21 06:19:35', '2016-10-25 20:37:20'),
(2, 'Dewi Dewi', 'Dewi dewi band is good', 'Group', '-', 'Bandung', 'nbz7hvshyrlcep2aafil', 'sample', 2000000, '', '', '', '', 'Y', 2, 'dewi-dewi', '2016-10-21 06:41:33', '2016-10-21 06:41:33'),
(3, 'Maha Dewo', 'dewo dewo band', 'Group', '-', 'Medan', 'sample', 'sample', 150000, '', '', '', '', 'Y', 3, 'maha-dewo', '2016-10-31 08:42:20', '2016-10-31 08:42:20'),
(4, 'oopp', 'jikkooooopp', 'Group', '-', 'Medan', '', '', 2000000, '', '', '', '', 'Y', 6, 'oopp', '2016-12-22 14:29:28', '2016-12-22 14:29:28'),
(6, 'Ampas Kopi', 'band yang sedang berkembang ', 'Group', '-', 'Medan', 'gj1ttpphylaawmmwrkti', '', 4000000, '', '', '', '', 'Y', 8, 'ampas-kopi', '2017-01-25 23:29:01', '2017-01-25 23:29:01');
-- --------------------------------------------------------
--
-- Table structure for table `grupband_musisi`
--
CREATE TABLE `grupband_musisi` (
`id` int(10) UNSIGNED NOT NULL,
`position_id` int(10) UNSIGNED NOT NULL,
`musician_id` int(10) UNSIGNED NOT NULL,
`grupband_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `grupband_musisi`
--
INSERT INTO `grupband_musisi` (`id`, `position_id`, `musician_id`, `grupband_id`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 1, '2016-10-21 06:19:35', '2016-10-21 06:19:35'),
(2, 5, 2, 2, '2016-10-21 06:41:33', '2016-10-21 06:41:33'),
(3, 5, 2, 1, '2016-10-25 02:27:40', '2016-10-25 02:27:40'),
(4, 2, 1, 2, '2016-10-25 02:44:36', '2016-10-25 02:44:36'),
(5, 2, 3, 3, '2016-10-31 08:42:20', '2016-10-31 08:42:20'),
(6, 1, 6, 4, '2016-12-22 14:29:28', '2016-12-22 14:29:28'),
(8, 4, 8, 6, '2017-01-25 23:29:01', '2017-01-25 23:29:01');
-- --------------------------------------------------------
--
-- Table structure for table `konfirmasi_pembayarans`
--
CREATE TABLE `konfirmasi_pembayarans` (
`id` int(10) UNSIGNED NOT NULL,
`nama_rek` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`no_rek` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`nama_bank` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`photo` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`sewa_id` int(10) UNSIGNED NOT NULL,
`bank_admin_id` int(10) UNSIGNED NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `konfirmasi_pembayarans`
--
INSERT INTO `konfirmasi_pembayarans` (`id`, `nama_rek`, `no_rek`, `nama_bank`, `photo`, `sewa_id`, `bank_admin_id`, `created_at`, `updated_at`) VALUES
(2, 'Hera', '', 'BCA', '', 4, 2, '2016-10-23 19:57:29', '2016-10-23 19:57:29'),
(3, 'herawati', '', 'Mandiri', '', 6, 3, '2016-10-24 06:47:17', '2016-10-24 06:47:17'),
(4, 'herawati', '', 'BCA', '', 7, 2, '2016-10-25 23:01:29', '2016-10-25 23:01:29'),
(5, 'herawati', '', 'Mandiri', '', 8, 3, '2016-10-25 23:52:05', '2016-10-25 23:52:05'),
(6, 'herawati', '', 'BCA', '', 14, 2, '2016-10-30 00:38:09', '2016-10-30 00:38:09'),
(7, 'Anto', '', 'BCA', '', 22, 2, '2016-10-30 23:20:40', '2016-10-30 23:20:40'),
(8, 'Budi', '', 'BNI', '', 23, 3, '2016-10-30 23:32:45', '2016-10-30 23:32:45'),
(9, 'Hera', '', 'BRI', '', 21, 1, '2016-11-01 19:21:01', '2016-11-01 19:21:01');
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`migration`, `batch`) VALUES
('2014_10_12_000000_create_users_table', 1),
('2014_10_12_100000_create_password_resets_table', 1),
('2016_05_24_073233_create_admins_table', 1),
('2016_08_18_191655_create_musicians_table', 1),
('2016_09_18_082215_create_banks_table', 1),
('2016_09_18_082216_create_bank_admin_table', 1),
('2016_09_18_082217_create_bank_musisi_table', 1),
('2016_09_18_082251_create_genres_table', 1),
('2016_09_18_082252_create_genre_musisi_table', 1),
('2016_09_18_085545_create_gigs_table', 1),
('2016_09_18_085722_create_grupbands_table', 1),
('2016_09_18_090100_create_positions_table', 1),
('2016_09_18_090101_create_grupband_musisi_table', 1),
('2016_09_18_090136_create_sewas_table', 1),
('2016_09_18_090346_create_konfirmasi_pembayarans_table', 1),
('2016_10_21_065112_create_review_table', 1),
('2016_10_21_065139_create_saldo_table', 1),
('2016_10_21_065153_create_withdraw_table', 1),
('2016_10_21_080528_create_genre_bands_table', 1);
-- --------------------------------------------------------
--
-- Table structure for table `musicians`
--
CREATE TABLE `musicians` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`firebase` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`tipe` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Solo',
`basis` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '-',
`deskripsi` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`no_telp` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`kota` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`harga_sewa` int(11) NOT NULL,
`photo` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`youtube_video` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`url_website` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`username_soundcloud` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`username_reverbnation` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`aktif` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL,
`slug` text COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `musicians`
--
INSERT INTO `musicians` (`id`, `name`, `email`, `firebase`, `password`, `tipe`, `basis`, `deskripsi`, `no_telp`, `kota`, `harga_sewa`, `photo`, `youtube_video`, `url_website`, `username_soundcloud`, `username_reverbnation`, `aktif`, `slug`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'heri', 'hery.trie@gmail.com', '', '$2y$10$LbtqW.lMwtF37/AKc.iR8OsqnOAKYEg.U4yRYIOf3A/g2arOO/uGO', 'Solo', 'Duo', 'My Music is Murottal', '081398797257', 'Medan', 1000000, 'default_user', '', '', '', '', 'Y', 'heri', 'PgBkT8bvUN0bqhcJJmAMoAE7ER4SjByBWGSmz3WUJrVJ2N135rTYQKtPM5DO', '2016-10-21 06:07:26', '2016-12-01 01:24:48'),
(2, 'Dewi', 'dewi@gmail.com', '', '$2y$10$V7m3pApEQ6snvW2R8u5afuKcWccF9wefyftgLACtoRXhgGQo.Xqti', 'Solo', '-', 'My Music is Asyik', '085278639012', 'Bandung', 1500000, 'default_user', '', '', '', '', 'Y', 'dewi', '13PkXFerZB9io8bYjJTLPAtYjdUSlDzmDiNHq017ZCKy1LRomnGdIeDMv1c1', '2016-10-21 06:12:15', '2016-11-28 21:06:10'),
(3, 'dewo', 'dewo@gmail.com', '', '$2y$10$WSAw2wLtYgHXu72Rfuu6kOcbBbKSk4gsHCPCSRFauNTdY9pA8A68e', 'Solo', '-', 'Anak Rocker Men', '09083424', 'Jakarta', 500000, 'default_user', '', '', '', '', 'Y', 'dewo', '8l7UENh1Vr6w9s2UCDzvmPggubUI6l5V90EnZ8tS7Guz3nRNiB7BNZmmgyxj', '2016-10-23 19:45:56', '2016-10-31 20:33:54'),
(4, 'heru', 'heru@gmail.com', '', '$2y$10$dFl3feCbh46kVi7jXmQEMO5zzeww7emqoxeLYNW72EIZzc6Dv5cLO', 'Solo', 'Solo', 'fsdgfhdgh', '12342', 'Medan', 5000000, 'default_user', '', '', '', '', 'Y', 'heru', 'sSHh4boYBAwxDvM2Tq7X1llOmPf0IcUnpMyKcaILdW5Bc29QsvIXRkrmFTG6', '2016-11-24 02:49:48', '2016-11-24 02:50:23'),
(6, 'satumusisi', 'satumusisi@gmail.com', '', '$2y$10$i9qiPingw2SoqUU/LMOdBOm34zS6lrmLAdPbNY1MEh9Itliu4WQaG', 'Solo', '-', 'deskripsi', '089912345678', 'Medan', 1000000, 'kqygbmneba36okt1tj6r', '', '', '', '', 'Y', 'satumusisi', 'CMD0GyTq2BEbPEqQiq3lpNPo5AP4H2CZTj1kkSCqRaZxXtDLEOgfi7m6eUGY', '2016-12-21 21:56:23', '2017-01-19 05:33:23'),
(7, 'Edinofri', 'edi@gighub.dev', 'dd84YVPaz60:APA91bHpkckFVdMaPrx-iN-gFtQsuldzOqk45hOPpWAIvPgVav6U-az5fhDSwtGHpaDHRP_nOtqQTNEkojTQo9XWdkfR2h_6_oFU1t0ijmKRP8CjxE6K6wpDQnzEz6dDe5VIwsl42kCZ', '$2y$10$nfTh2jwYKsSZD6Kl9lavTOqtKlgoTgYQ6KeyxmLjHCGyfvNJvqNu6', 'Solo', '-', 'oi', '085214721472', 'Medan', 3000000, 'owuyfe5otruqlao2l5zp', 'https://www.youtube.com/watch?v=KIgmQmWczm8', '', '', '', 'Y', 'edinofri', NULL, '2017-01-17 09:09:28', '2017-01-27 00:38:24'),
(8, 'Irfan Kute', 'irfan@gmail.com', '', '$2y$10$5lSiqNOQAeqN9m4oFUyg6.LFObV9Je13L6g8fm18HugIizz24PZLy', 'Solo', '-', '', '085236903690', 'Medan', 2500000, '', '', '', '', '', 'Y', 'irfan-kute', NULL, '2017-01-25 22:12:22', '2017-01-25 23:54:25'),
(9, 'coba musisi', 'cobamusisi@gmail.com', '', '$2y$10$jxvCyxn/uGUYU1GgHegt6u65YgJ/WJUa72F16ySn3jz1abazKBA7S', 'Solo', '-', 'deskripsi', '19832102309', 'Medan', 2000000, '', '', '', '', '', 'Y', 'coba-musisi', NULL, '2017-01-25 22:21:46', '2017-01-25 22:21:46'),
(10, 'coba2 musisi', 'coba2musisi@gmail.com', 'dd84YVPaz60:APA91bHpkckFVdMaPrx-iN-gFtQsuldzOqk45hOPpWAIvPgVav6U-az5fhDSwtGHpaDHRP_nOtqQTNEkojTQo9XWdkfR2h_6_oFU1t0ijmKRP8CjxE6K6wpDQnzEz6dDe5VIwsl42kCZ', '$2y$10$kUz5TR6xD8hj.F44nTeKaOq6GG24ijspEVIFUsY0UvOp8x1rz0Vz.', 'Solo', '-', '', '', '', 0, '', '', '', '', '', 'Y', 'coba2-musisi', NULL, '2017-01-25 22:42:40', '2017-01-25 22:42:40'),
(39, 'coba3 musisi', 'coba3musisi@gmail.com', '', '$2y$10$xGP.7MRxyaO9i6yslj76ku1Y1oUyh5xYMuqMj6/qGtySdpFzSVi6K', 'Solo', '-', '', '', '', 0, '', '', '', '', '', 'Y', 'coba3-musisi', NULL, '2017-01-25 22:50:56', '2017-01-25 22:50:56'),
(40, 'coba4musisi', 'coba4musisi@gmail.com', '', '$2y$10$G7K75BW6eLxTCOiUfQSC.OHHmPn0jWjiKhA1e1zz87KkG4PriR0D.', 'Solo', '-', '', '', '', 0, '', '', '', '', '', 'Y', 'coba4musisi', NULL, '2017-01-25 22:51:51', '2017-01-25 22:54:16');
-- --------------------------------------------------------
--
-- Table structure for table `notif`
--
CREATE TABLE `notif` (
`id` int(10) NOT NULL,
`object_id` int(11) DEFAULT NULL,
`subject_id` int(11) DEFAULT NULL,
`type_subject` enum('musisi','band','organizer','admin') DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
`type_user` enum('musisi','band','organizer','admin') DEFAULT NULL,
`type_notif` enum('reqoffer','reqsewa','lunas','batal','selesai','terimasewa','tolaksewa','tolakoffer','terimaoffer','tambahsaldo','withdrawselesai','withdraw','konfirmasipembayaran','review') DEFAULT NULL,
`baca` enum('N','Y') DEFAULT 'N',
`created_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `notif`
--
INSERT INTO `notif` (`id`, `object_id`, `subject_id`, `type_subject`, `user_id`, `type_user`, `type_notif`, `baca`, `created_at`, `updated_at`) VALUES
(1, 2, 1, 'organizer', 1, 'musisi', 'reqsewa', 'Y', '2016-10-28 13:38:57', '2016-10-28 06:38:57'),
(2, 10, 1, 'organizer', 1, 'musisi', 'reqsewa', 'Y', '2016-10-27 14:13:30', '2016-10-27 07:13:30'),
(3, 10, 1, 'musisi', 1, 'organizer', 'terimasewa', 'Y', '2016-10-28 04:04:36', '2016-10-27 21:04:36'),
(4, 11, 1, 'organizer', 2, 'band', 'reqsewa', 'Y', '2016-10-28 04:15:03', '2016-10-27 21:15:03'),
(5, 12, 1, 'organizer', 2, 'musisi', 'reqsewa', 'Y', '2016-10-28 04:14:46', '2016-10-27 21:14:46'),
(11, 12, 2, 'musisi', 1, 'organizer', 'tolaksewa', 'Y', '2016-10-28 06:28:21', '2016-10-27 23:28:21'),
(12, 11, 2, 'band', 1, 'organizer', 'tolaksewa', 'Y', '2016-10-28 06:28:25', '2016-10-27 23:28:25'),
(16, 12, 2, 'musisi', 1, 'organizer', 'reqoffer', 'Y', '2016-10-28 06:33:17', '2016-10-27 23:33:17'),
(17, 12, 2, 'band', 1, 'organizer', 'reqoffer', 'Y', '2016-10-28 06:33:27', '2016-10-27 23:33:27'),
(18, 12, 1, 'organizer', 2, 'band', 'tolakoffer', 'N', '2016-10-27 23:37:09', '2016-10-27 23:37:09'),
(19, 12, 1, 'organizer', 2, 'musisi', 'terimaoffer', 'N', '2016-10-27 23:38:15', '2016-10-27 23:38:15'),
(21, 12, 0, 'admin', 1, 'organizer', 'lunas', 'Y', '2016-10-28 13:26:34', '2016-10-28 06:26:34'),
(22, 12, 1, 'organizer', 2, 'musisi', 'lunas', 'Y', '2016-10-28 13:34:01', '2016-10-28 06:34:01'),
(23, 10, 0, 'admin', 1, 'organizer', 'lunas', 'Y', '2016-10-28 13:39:28', '2016-10-28 06:39:28'),
(24, 10, 1, 'organizer', 1, 'musisi', 'lunas', 'Y', '2016-10-28 13:38:40', '2016-10-28 06:38:40'),
(25, 13, 1, 'organizer', 2, 'musisi', 'reqsewa', 'Y', '2016-10-28 14:47:58', '2016-10-28 07:47:58'),
(26, 12, 0, 'admin', 2, 'musisi', 'tambahsaldo', 'Y', '2016-10-28 14:24:28', '2016-10-28 07:24:28'),
(27, 12, 1, 'organizer', 2, 'musisi', 'review', 'N', '2016-10-28 14:48:43', '2016-10-28 14:48:43'),
(28, 0, 2, 'musisi', 0, 'admin', 'withdraw', 'Y', '2016-10-29 12:14:34', '2016-10-29 05:14:34'),
(29, 0, 0, 'admin', 2, 'musisi', 'withdrawselesai', 'Y', '2016-10-29 12:17:31', '2016-10-29 05:17:31'),
(30, 11, 1, 'organizer', 0, 'admin', 'konfirmasipembayaran', 'N', '2016-10-30 00:38:09', '2016-10-30 00:38:09'),
(31, 11, 1, 'musisi', 1, 'organizer', 'reqoffer', 'Y', '2016-10-31 06:20:22', '2016-10-30 23:20:22'),
(32, 11, 1, 'organizer', 1, 'musisi', 'terimaoffer', 'Y', '2016-10-31 08:21:41', '2016-10-31 01:21:41'),
(33, 11, 1, 'organizer', 0, 'admin', 'konfirmasipembayaran', 'N', '2016-10-30 23:20:41', '2016-10-30 23:20:41'),
(34, 11, 0, 'admin', 1, 'organizer', 'lunas', 'Y', '2016-10-31 06:31:54', '2016-10-30 23:31:54'),
(35, 11, 1, 'organizer', 1, 'musisi', 'lunas', 'Y', '2016-10-31 06:37:31', '2016-10-30 23:37:31'),
(36, 14, 1, 'organizer', 2, 'band', 'reqsewa', 'Y', '2016-10-31 06:32:14', '2016-10-30 23:32:14'),
(37, 14, 2, 'band', 1, 'organizer', 'terimasewa', 'Y', '2016-10-31 06:32:35', '2016-10-30 23:32:35'),
(38, 14, 1, 'organizer', 0, 'admin', 'konfirmasipembayaran', 'Y', '2016-10-31 06:33:36', '2016-10-30 23:33:36'),
(39, 14, 0, 'admin', 1, 'organizer', 'lunas', 'Y', '2016-11-06 03:24:37', '2016-11-05 20:24:37'),
(40, 14, 1, 'organizer', 2, 'band', 'lunas', 'N', '2016-10-30 23:33:42', '2016-10-30 23:33:42'),
(41, 10, 0, 'admin', 1, 'organizer', 'lunas', 'N', '2016-10-31 00:46:15', '2016-10-31 00:46:15'),
(42, 10, 1, 'organizer', 1, 'musisi', 'lunas', 'Y', '2016-10-31 07:47:46', '2016-10-31 00:47:46'),
(43, 10, 0, 'admin', 1, 'musisi', 'tambahsaldo', 'Y', '2016-11-01 01:20:39', '2016-10-31 18:20:39'),
(44, 13, 2, 'musisi', 1, 'organizer', 'terimasewa', 'Y', '2016-11-02 02:20:52', '2016-11-01 19:20:52'),
(45, 13, 1, 'organizer', 0, 'admin', 'konfirmasipembayaran', 'N', '2016-11-01 19:21:01', '2016-11-01 19:21:01'),
(46, 13, 0, 'admin', 1, 'organizer', 'lunas', 'N', '2016-11-01 19:21:32', '2016-11-01 19:21:32'),
(47, 13, 1, 'organizer', 2, 'musisi', 'lunas', 'Y', '2016-11-02 02:23:18', '2016-11-01 19:23:18'),
(48, 13, 0, 'admin', 1, 'organizer', 'lunas', 'N', '2016-11-01 19:32:29', '2016-11-01 19:32:29'),
(49, 13, 1, 'organizer', 2, 'musisi', 'lunas', 'N', '2016-11-01 19:32:29', '2016-11-01 19:32:29'),
(50, 15, 1, 'organizer', 2, 'band', 'reqsewa', 'Y', '2016-11-06 08:20:14', '2016-11-06 01:20:14'),
(51, 15, 2, 'band', 1, 'organizer', 'terimasewa', 'N', '2016-11-06 01:20:20', '2016-11-06 01:20:20'),
(52, 14, 1, 'organizer', 2, 'band', 'review', 'Y', '2016-11-27 08:18:53', '2016-11-27 01:18:53'),
(53, 13, 0, 'admin', 2, 'musisi', 'tambahsaldo', 'Y', '2016-11-27 09:20:22', '2016-11-27 02:20:22'),
(54, 13, 1, 'organizer', 2, 'musisi', 'review', 'N', '2016-11-27 02:18:49', '2016-11-27 02:18:49'),
(55, 14, 0, 'admin', 2, 'band', 'tambahsaldo', 'Y', '2016-11-27 09:56:30', '2016-11-27 02:56:30'),
(56, 10, 1, 'organizer', 1, 'musisi', 'review', 'N', '2016-11-27 06:30:31', '2016-11-27 06:30:31'),
(57, 17, 0, 'admin', 2, 'organizer', 'lunas', 'N', '2016-12-22 13:59:14', '2016-12-22 13:59:14'),
(58, 17, 2, 'organizer', 6, 'musisi', 'lunas', 'N', '2016-12-22 13:59:15', '2016-12-22 13:59:15'),
(59, 17, 0, 'admin', 6, 'musisi', 'tambahsaldo', 'N', '2016-12-22 14:02:02', '2016-12-22 14:02:02'),
(60, 18, 0, 'admin', 2, 'organizer', 'lunas', 'N', '2016-12-22 14:35:10', '2016-12-22 14:35:10'),
(61, 18, 2, 'organizer', 4, 'band', 'lunas', 'N', '2016-12-22 14:35:10', '2016-12-22 14:35:10'),
(62, 18, 0, 'admin', 4, 'band', 'tambahsaldo', 'N', '2016-12-22 14:35:34', '2016-12-22 14:35:34'),
(63, 0, 0, 'admin', 6, 'musisi', 'withdrawselesai', 'N', '2016-12-22 15:38:35', '2016-12-22 15:38:35'),
(64, 0, 0, '', 0, '', '', '', '2017-01-17 09:39:34', '2017-01-17 09:39:34'),
(65, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-17 10:05:00', '2017-01-17 10:05:00'),
(66, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-17 10:05:49', '2017-01-17 10:05:49'),
(67, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-17 10:17:20', '2017-01-17 10:17:20'),
(68, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-17 10:18:23', '2017-01-17 10:18:23'),
(69, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-17 10:40:17', '2017-01-17 10:40:17'),
(70, 6, 2, 'organizer', 2, 'organizer', 'terimaoffer', 'N', '2017-01-19 05:39:31', '2017-01-19 05:39:31'),
(71, 6, 2, 'organizer', 2, 'organizer', 'terimaoffer', 'N', '2017-01-19 05:40:39', '2017-01-19 05:40:39'),
(72, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 05:41:29', '2017-01-19 05:41:29'),
(73, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 05:43:57', '2017-01-19 05:43:57'),
(74, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 05:44:06', '2017-01-19 05:44:06'),
(75, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 05:45:05', '2017-01-19 05:45:05'),
(76, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 05:50:56', '2017-01-19 05:50:56'),
(77, 7, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 05:54:45', '2017-01-19 05:54:45'),
(78, 11, 7, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 05:54:54', '2017-01-19 05:54:54'),
(79, 25, 2, 'organizer', 4, 'band', 'reqsewa', 'N', '2017-01-19 07:50:10', '2017-01-19 07:50:10'),
(80, 7, 2, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 08:11:41', '2017-01-19 08:11:41'),
(81, 7, 2, 'organizer', 2, 'musisi', 'terimaoffer', 'N', '2017-01-19 08:12:37', '2017-01-19 08:12:37'),
(82, 7, 2, 'organizer', 2, 'musisi', 'terimaoffer', 'N', '2017-01-19 08:19:09', '2017-01-19 08:19:09'),
(83, 7, 2, 'organizer', 2, 'musisi', 'terimaoffer', 'N', '2017-01-19 09:42:57', '2017-01-19 09:42:57'),
(84, 7, 2, 'organizer', 2, 'musisi', 'terimaoffer', 'N', '2017-01-19 09:44:29', '2017-01-19 09:44:29'),
(85, 7, 2, 'organizer', 2, 'musisi', 'terimaoffer', 'N', '2017-01-19 10:06:27', '2017-01-19 10:06:27'),
(86, 7, 2, 'organizer', 2, 'musisi', 'terimaoffer', 'N', '2017-01-19 10:10:58', '2017-01-19 10:10:58'),
(87, 7, 2, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 10:11:52', '2017-01-19 10:11:52'),
(88, 7, 2, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 10:12:47', '2017-01-19 10:12:47'),
(89, 7, 2, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-19 10:16:36', '2017-01-19 10:16:36'),
(90, 7, 2, 'organizer', 7, 'musisi', 'reqsewa', 'N', '2017-01-19 11:47:36', '2017-01-19 11:47:36'),
(91, 7, 2, 'organizer', 7, 'musisi', 'reqsewa', 'N', '2017-01-24 14:05:14', '2017-01-24 14:05:14'),
(92, 7, 2, 'organizer', 7, 'musisi', 'terimaoffer', 'N', '2017-01-24 14:06:55', '2017-01-24 14:06:55'),
(93, 7, 2, 'organizer', 2, 'musisi', 'terimaoffer', 'N', '2017-01-24 14:07:09', '2017-01-24 14:07:09'),
(94, 7, 2, 'organizer', 7, 'musisi', '', 'N', '2017-01-24 14:08:22', '2017-01-24 14:08:22'),
(95, 7, 2, 'organizer', 2, 'musisi', '', 'N', '2017-01-24 14:08:45', '2017-01-24 14:08:45'),
(96, 7, 2, 'organizer', 7, 'musisi', '', 'N', '2017-01-24 14:10:20', '2017-01-24 14:10:20'),
(97, 7, 2, 'organizer', 7, 'musisi', '', 'N', '2017-01-24 14:11:13', '2017-01-24 14:11:13'),
(98, 7, 2, 'organizer', 7, 'musisi', 'reqsewa', 'N', '2017-01-24 14:12:44', '2017-01-24 14:12:44'),
(99, 2, 7, 'organizer', 2, 'musisi', 'reqsewa', 'N', '2017-01-24 14:29:32', '2017-01-24 14:29:32'),
(100, 2, 7, 'organizer', 2, 'musisi', 'reqoffer', 'N', '2017-01-24 14:30:55', '2017-01-24 14:30:55'),
(101, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:33:14', '2017-01-24 14:33:14'),
(102, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:34:19', '2017-01-24 14:34:19'),
(103, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:34:29', '2017-01-24 14:34:29'),
(104, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:35:16', '2017-01-24 14:35:16'),
(105, 2, 7, 'organizer', 2, 'musisi', 'reqoffer', 'N', '2017-01-24 14:35:47', '2017-01-24 14:35:47'),
(106, 2, 7, 'organizer', 2, 'musisi', 'reqoffer', 'N', '2017-01-24 14:36:07', '2017-01-24 14:36:07'),
(107, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:36:22', '2017-01-24 14:36:22'),
(108, 2, 7, 'organizer', 2, 'musisi', 'reqoffer', 'N', '2017-01-24 14:37:59', '2017-01-24 14:37:59'),
(109, 2, 2, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:38:14', '2017-01-24 14:38:14'),
(110, 2, 2, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:38:31', '2017-01-24 14:38:31'),
(111, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:40:08', '2017-01-24 14:40:08'),
(112, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:40:15', '2017-01-24 14:40:15'),
(113, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:42:14', '2017-01-24 14:42:14'),
(114, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:44:29', '2017-01-24 14:44:29'),
(115, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 14:45:07', '2017-01-24 14:45:07'),
(116, 2, 7, 'organizer', 7, 'musisi', 'reqoffer', 'N', '2017-01-24 14:51:57', '2017-01-24 14:51:57'),
(117, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 14:53:26', '2017-01-24 14:53:26'),
(118, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:06:12', '2017-01-24 15:06:12'),
(119, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:08:09', '2017-01-24 15:08:09'),
(120, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:08:29', '2017-01-24 15:08:29'),
(121, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:08:37', '2017-01-24 15:08:37'),
(122, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:08:48', '2017-01-24 15:08:48'),
(123, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:09:18', '2017-01-24 15:09:18'),
(124, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:09:45', '2017-01-24 15:09:45'),
(125, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:10:10', '2017-01-24 15:10:10'),
(126, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:29:05', '2017-01-24 15:29:05'),
(127, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:30:06', '2017-01-24 15:30:06'),
(128, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:30:22', '2017-01-24 15:30:22'),
(129, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:30:31', '2017-01-24 15:30:31'),
(130, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:31:52', '2017-01-24 15:31:52'),
(131, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:33:41', '2017-01-24 15:33:41'),
(132, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:34:05', '2017-01-24 15:34:05'),
(133, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:34:41', '2017-01-24 15:34:41'),
(134, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:35:05', '2017-01-24 15:35:05'),
(135, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:35:29', '2017-01-24 15:35:29'),
(136, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:35:48', '2017-01-24 15:35:48'),
(137, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:36:11', '2017-01-24 15:36:11'),
(138, 2, 7, 'musisi', 7, 'organizer', 'reqoffer', 'N', '2017-01-24 15:36:35', '2017-01-24 15:36:35'),
(139, 2, 7, 'musisi', 7, 'organizer', 'terimasewa', 'N', '2017-01-24 16:01:51', '2017-01-24 16:01:51'),
(140, 2, 7, 'musisi', 7, 'organizer', 'terimasewa', 'N', '2017-01-24 16:09:55', '2017-01-24 16:09:55'),
(141, 2, 7, 'musisi', 7, 'organizer', 'terimasewa', 'N', '2017-01-24 16:10:48', '2017-01-24 16:10:48'),
(142, 2, 7, 'musisi', 7, 'organizer', 'terimasewa', 'N', '2017-01-24 16:29:32', '2017-01-24 16:29:32'),
(143, 2, 7, 'musisi', 7, 'organizer', 'terimasewa', 'N', '2017-01-24 16:29:47', '2017-01-24 16:29:47'),
(144, 2, 7, 'musisi', 7, 'organizer', 'terimasewa', 'N', '2017-01-24 16:30:27', '2017-01-24 16:30:27'),
(145, 2, 7, 'musisi', 7, 'organizer', 'terimasewa', 'N', '2017-01-24 16:32:38', '2017-01-24 16:32:38'),
(146, 7, 2, 'organizer', 2, 'musisi', 'reqsewa', 'N', '2017-01-25 21:24:13', '2017-01-25 21:24:13'),
(147, 6, 2, 'organizer', 2, 'musisi', 'reqsewa', 'N', '2017-01-26 00:18:40', '2017-01-26 00:18:40'),
(148, 2, 7, 'musisi', 7, 'organizer', 'terimasewa', 'N', '2017-01-26 20:52:36', '2017-01-26 20:52:36'),
(149, 2, 7, 'musisi', 7, 'organizer', 'terimasewa', 'N', '2017-01-26 21:01:42', '2017-01-26 21:01:42'),
(150, 27, 7, 'musisi', 2, 'organizer', 'terimasewa', 'N', '2017-01-26 21:14:43', '2017-01-26 21:14:43'),
(151, 27, 7, 'musisi', 2, 'organizer', 'terimasewa', 'N', '2017-01-26 21:14:59', '2017-01-26 21:14:59'),
(152, 7, 2, 'musisi', 2, 'organizer', 'terimasewa', 'N', '2017-01-27 00:28:47', '2017-01-27 00:28:47'),
(153, 7, 2, 'musisi', 2, 'organizer', 'terimasewa', 'N', '2017-01-27 00:28:51', '2017-01-27 00:28:51');
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `password_resets`
--
INSERT INTO `password_resets` (`email`, `token`, `created_at`) VALUES
('hera@gmail.com', '3c1b9af30b8aa44e4b078338a15f552a10fece90f7ea240c33619a8f7a02d845', '2016-11-29 19:53:01'),
('terasdistro@gmail.com', '2f8335619b85b60231a2ed21a5c94dc2c0becbd7a09374c83cb9f93ec1d48dcb', '2016-11-30 00:33:04');
-- --------------------------------------------------------
--
-- Table structure for table `password_reset_musicians`
--
CREATE TABLE `password_reset_musicians` (
`id` int(10) NOT NULL,
`email` varchar(255) NOT NULL,
`token` varchar(255) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `password_reset_musicians`
--
INSERT INTO `password_reset_musicians` (`id`, `email`, `token`, `created_at`, `updated_at`) VALUES
(1, 'hery.trie@gmail.com', 'E6xYy2lexWxrFaVNz4udNhveeb0qcnhQgEVukZrR3UEQm5eZaCaEk61480571618', '2016-11-30 22:53:38', '2016-11-30 22:53:38'),
(2, 'hery.trie@gmail.com', 'MMt3gqBAEqkEAtg5pxcEUpsF3gR6Z7zkapVHdArwjKzGzEoEOLN9h61480571688', '2016-11-30 22:54:48', '2016-11-30 22:54:48'),
(3, 'hery.trie@gmail.com', 'YrxXS2D4GgJ8Rh8HIZLn1EzywqHkMafhcKhYzxdiDsrK7pZluueQau1480573790', '2016-11-30 23:29:50', '2016-11-30 23:29:50'),
(4, 'hery.trie@gmail.com', 'Hcv1zePKGDnw84ahxjXZ5ct2StHYPN8Xeemhz7kbCuPg2fRxp0A2rW1480574169', '2016-11-30 23:36:09', '2016-11-30 23:36:09'),
(5, 'hery.trie@gmail.com', 'WHcoWtLGt9uf3E2FOTwKslOe1C1kgp5XawwlQZVNsrNOlcenUAAAZC1480574215', '2016-11-30 23:36:55', '2016-11-30 23:36:55'),
(6, 'hery.trie@gmail.com', '0FkmybraGe7vDMSIwgF6Q1foXl9ZzPINwUde0xilGJER87znJbTVUd1480574238', '2016-11-30 23:37:18', '2016-11-30 23:37:18'),
(7, 'hery.trie@gmail.com', 'P1GkWEUNmHVq9nJAYlwzIMrvGkAxXO2xWbrQkYd6OpWUYxjd0IYzxo1480574272', '2016-11-30 23:37:52', '2016-11-30 23:37:52'),
(8, 'hery.trie@gmail.com', 'MCR1zX1XkpUcBi9tAown4yL3bWUJMhIBUO6irugXONsDW0kowYm7u01480574284', '2016-11-30 23:38:04', '2016-11-30 23:38:04'),
(9, 'hery.trie@gmail.com', 'cQ0uUoLbw9E9jMCHePimJQs6GRhYSXSgrZxS4SWUk2L9YAVUI7XmBS1480574416', '2016-11-30 23:40:16', '2016-11-30 23:40:16'),
(10, 'hery.trie@gmail.com', 'MCBLrKXlxVav5EWLEDyFCvPeDp6y5mUzz80FE5dt2RPOlqAn1ECJmv1480575021', '2016-11-30 23:50:21', '2016-11-30 23:50:21'),
(11, 'hery.trie@gmail.com', 'X6VnVOGq7TpfFr0Hu1C4MYbWpDiKxglfhF0mKqYYRJmXyoRTlAi6xt1480575312', '2016-11-30 23:55:12', '2016-11-30 23:55:12'),
(12, 'hery.trie@gmail.com', 'Gc6PWkP4VkoYNgjz0vRdBnv6Szvmc8hdUY2qxN4eXDmYcToN0uTBHG1480578458', '2016-12-01 00:47:38', '2016-12-01 00:47:38'),
(13, 'hery.trie@gmail.com', 'U7SNyfn1qEJurFhfxVoT8yjkS1EVmhypEYYYFQoYWFjPTxXORtWPLG1480580828', '2016-12-01 01:27:08', '2016-12-01 01:27:08'),
(14, 'hery.trie@gmail.com', 'uuPg8VMEb0myKRC5x2oBka1SkWiRN8KL0tEtDGb5fswJx2dbOXgFKz1480581337', '2016-12-01 01:35:37', '2016-12-01 01:35:37'),
(15, 'hery.trie@gmail.com', 'lLSOydLoWi6mcz3zL2ElvIFRJ9drCIkMTpmramqjIAcKLyepSlXqmA1480581405', '2016-12-01 01:36:45', '2016-12-01 01:36:45'),
(16, 'hery.trie@gmail.com', 'cz1z38XLFCiZqDJ1SfnXEjp5BZ4I9l12IH7WBRmZiZEj8ieIWQWf8J1480581437', '2016-12-01 01:37:17', '2016-12-01 01:37:17'),
(17, 'hery.trie@gmail.com', 'QApuwl2azsUSMCSSygKAFUfxPlOx16Kz3258cNDkhb5C1YRhfMIrCx1480581466', '2016-12-01 01:37:46', '2016-12-01 01:37:46'),
(18, 'hery.trie@gmail.com', 'dbUR1rFnYS4uaP5cJ5gPMGDKZJwlQuHuU1mS79UcoarHxVCGxPBfDe1480583667', '2016-12-01 02:14:27', '2016-12-01 02:14:27'),
(19, 'hery.trie@gmail.com', 'l4LMP1spKH7NvrCfYLkSD4vvFmMsxzCoupi4BjhIDeu7DYwLxehkIq1480583729', '2016-12-01 02:15:29', '2016-12-01 02:15:29'),
(20, 'hery.trie@gmail.com', 'wSswnZTz4tYi1V1TTxsZY1VHKnEoS5baCAB3F7CTz1UtYxA6UeHPE51480584433', '2016-12-01 02:27:13', '2016-12-01 02:27:13'),
(21, 'hery.trie@gmail.com', 'Zz5zLQh5AGRLqGN3UiPcHSrocFwpv6mvwqNvU2cpfUJUJNfho8KUNv1480584453', '2016-12-01 02:27:33', '2016-12-01 02:27:33'),
(22, 'hery.trie@gmail.com', 'HkbUs11un7zP4r8MQFnfztbNPpru91e6mhCEuIcdkUPlnM9ob0Yvwy1480584458', '2016-12-01 02:27:38', '2016-12-01 02:27:38'),
(23, 'hery.trie@gmail.com', 'mbOPQCDSQbG7B775Kzj3SFupEoYsIJfHoRROpXFy4KgxlueDahgVfu1480584793', '2016-12-01 02:33:13', '2016-12-01 02:33:13'),
(24, 'hery.trie@gmail.com', 'YziLxuqV7eiOt5kXlpJ5QzLC3RaXYhQAport37DgdVvp9OY9kLdJ5x1480585104', '2016-12-01 02:38:24', '2016-12-01 02:38:24'),
(25, 'hery.trie@gmail.com', 'NfC1e4t1jPoPReuw8UXmbSxoEL9ANTGA5O3xopekftRk8sQcTuDurd1480585199', '2016-12-01 02:39:59', '2016-12-01 02:39:59'),
(26, 'hery.trie@gmail.com', 'r5DOOBsFxKjBCgMpgnpGF0LsV0yK4hyIBcIOvWc1Q3Km87Fn5rSlIV1480647566', '2016-12-01 19:59:26', '2016-12-01 19:59:26'),
(27, 'hery.trie@gmail.com', '365F49htuV3sNbrvEvPsVNWsQWAtjP62oxpW2YrJtxzrsuArsup1cA1480647608', '2016-12-01 20:00:08', '2016-12-01 20:00:08'),
(28, 'hery.trie@gmail.com', 'Iy9kLn2Uxv04htyTWbtORNf3iMg3PClDR9pUYoAb9plxQSO0dqPf4p1480647633', '2016-12-01 20:00:33', '2016-12-01 20:00:33'),
(29, 'hery.trie@gmail.com', '5UkevrzJ3HPktuiSZM5KKgO0jbQlujYzh2caBm6LFEChRvn9U4uhNc1480647712', '2016-12-01 20:01:52', '2016-12-01 20:01:52');
-- --------------------------------------------------------
--
-- Table structure for table `positions`
--
CREATE TABLE `positions` (
`id` int(10) UNSIGNED NOT NULL,
`position_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `positions`
--
INSERT INTO `positions` (`id`, `position_name`, `created_at`, `updated_at`) VALUES
(1, 'Vocalist', '2016-10-21 06:09:15', '2016-10-21 06:09:15'),
(2, 'Guitarist', '2016-10-21 06:09:20', '2016-10-21 06:09:20'),
(3, 'Bassis', '2016-10-21 06:10:48', '2016-10-21 06:10:48'),
(4, 'Drummer', '2016-10-21 06:10:54', '2016-10-21 06:10:54'),
(5, 'Keyboardist', '2016-10-21 06:10:59', '2016-10-21 06:10:59'),
(6, 'Pianist', '2016-10-21 06:11:02', '2016-10-21 06:11:02'),
(7, 'backing', '2016-10-21 06:11:07', '2016-10-21 06:11:07');
-- --------------------------------------------------------
--
-- Table structure for table `review`
--
CREATE TABLE `review` (
`id` int(10) UNSIGNED NOT NULL,
`sewa_id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`pesan` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`nilai` enum('1','2','3','4','5') COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `review`
--
INSERT INTO `review` (`id`, `sewa_id`, `user_id`, `pesan`, `nilai`, `created_at`, `updated_at`) VALUES
(2, 4, 1, 'Mantaph performance nya!', '4', '2016-10-23 20:21:36', '2016-10-23 20:21:36'),
(3, 7, 1, 'Memuaskan...', '5', '2016-10-25 23:07:55', '2016-10-25 23:07:55'),
(4, 8, 1, 'Good Job! suka sekali', '5', '2016-10-25 23:54:20', '2016-10-25 23:54:20'),
(6, 6, 1, 'Good Job dewo!', '4', '2016-10-26 06:25:24', '2016-10-26 06:25:24'),
(7, 19, 1, 'ntaph lah', '5', '2016-10-28 07:32:30', '2016-10-28 07:32:30'),
(9, 23, 1, 'awesome', '5', '2016-11-27 01:16:56', '2016-11-27 01:16:56'),
(10, 21, 1, 'nice', '5', '2016-11-27 02:18:48', '2016-11-27 02:18:48'),
(11, 13, 1, 'not bad', '3', '2016-11-27 06:30:31', '2016-11-27 06:30:31');
-- --------------------------------------------------------
--
-- Table structure for table `saldo`
--
CREATE TABLE `saldo` (
`id` int(10) UNSIGNED NOT NULL,
`saldo` int(11) NOT NULL,
`subject_id` int(11) NOT NULL,
`type_pemilik` enum('musisi','band') COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `saldo`
--
INSERT INTO `saldo` (`id`, `saldo`, `subject_id`, `type_pemilik`, `created_at`, `updated_at`) VALUES
(1, 38500000, 2, 'band', '2016-10-23 23:36:38', '2016-11-27 02:54:24'),
(2, 15200000, 1, 'musisi', '2016-10-23 23:38:34', '2016-11-27 02:54:24'),
(5, 5000000, 3, 'musisi', '2016-10-24 06:58:36', '2016-10-25 00:14:48'),
(6, 13000000, 2, 'musisi', '2016-10-28 07:20:41', '2016-11-27 02:18:48'),
(7, 2000000, 6, 'musisi', '2016-12-22 14:02:01', '2016-12-22 15:37:12'),
(8, 6000000, 4, 'band', '2016-12-22 14:35:34', '2016-12-22 14:35:34');
-- --------------------------------------------------------
--
-- Table structure for table `saldo_detail`
--
CREATE TABLE `saldo_detail` (
`id` int(10) UNSIGNED NOT NULL,
`saldo_id` int(11) NOT NULL,
`sewa_id` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `saldo_detail`
--
INSERT INTO `saldo_detail` (`id`, `saldo_id`, `sewa_id`, `created_at`, `updated_at`) VALUES
(1, 2, 4, NULL, NULL),
(2, 1, 5, NULL, NULL),
(3, 1, 7, '2016-10-25 23:50:42', '2016-10-25 23:50:42'),
(4, 1, 8, '2016-10-25 23:52:41', '2016-10-25 23:52:41'),
(5, 6, 19, '2016-10-28 07:20:41', '2016-10-28 07:20:41'),
(6, 2, 13, '2016-10-31 00:53:43', '2016-10-31 00:53:43'),
(7, 6, 21, '2016-11-27 02:18:49', '2016-11-27 02:18:49'),
(8, 2, 22, '2016-11-27 02:52:50', '2016-11-27 02:52:50'),
(9, 2, 22, '2016-11-27 02:54:24', '2016-11-27 02:54:24'),
(10, 1, 23, '2016-11-27 02:54:24', '2016-11-27 02:54:24'),
(11, 7, 26, '2016-12-22 14:02:01', '2016-12-22 14:02:01'),
(12, 8, 27, '2016-12-22 14:35:34', '2016-12-22 14:35:34');
-- --------------------------------------------------------
--
-- Table structure for table `sewas`
--
CREATE TABLE `sewas` (
`id` int(10) UNSIGNED NOT NULL,
`total_biaya` int(11) NOT NULL,
`gig_id` int(10) UNSIGNED NOT NULL,
`object_id` int(11) NOT NULL,
`subject_id` int(11) NOT NULL,
`status` enum('0','1','2','3','4','5','6') COLLATE utf8_unicode_ci NOT NULL,
`status_request` enum('0','1','2') COLLATE utf8_unicode_ci NOT NULL,
`type_sewa` enum('hireband','hiremusisi','bandhire','musisihire') COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `sewas`
--
INSERT INTO `sewas` (`id`, `total_biaya`, `gig_id`, `object_id`, `subject_id`, `status`, `status_request`, `type_sewa`, `created_at`, `updated_at`) VALUES
(1, 10000000, 1, 1, 2, '0', '2', 'bandhire', '2016-10-21 06:47:06', '2016-10-21 06:56:08'),
(2, 6000000, 1, 1, 2, '0', '2', 'musisihire', '2016-10-21 06:47:13', '2016-10-21 06:56:08'),
(4, 4000000, 1, 1, 1, '4', '1', 'musisihire', '2016-10-21 06:48:55', '2016-10-24 23:47:30'),
(6, 5500000, 3, 1, 3, '4', '1', 'musisihire', '2016-10-23 19:56:37', '2016-10-24 06:58:36'),
(7, 15000000, 4, 1, 2, '4', '1', 'bandhire', '2016-10-25 23:00:36', '2016-10-25 23:50:43'),
(8, 7500000, 5, 1, 2, '4', '1', 'bandhire', '2016-10-25 23:43:16', '2016-10-25 23:52:41'),
(13, 5000000, 10, 1, 1, '4', '1', 'hiremusisi', '2016-10-27 06:57:59', '2016-10-31 00:53:43'),
(14, 10000000, 11, 2, 1, '1', '2', 'hireband', '2016-10-27 07:34:23', '2016-10-30 23:20:25'),
(15, 6000000, 12, 2, 1, '0', '2', 'hiremusisi', '2016-10-27 07:36:15', '2016-10-27 23:38:15'),
(19, 6000000, 12, 1, 2, '4', '1', 'musisihire', '2016-10-27 23:32:58', '2016-10-28 07:20:42'),
(20, 8000000, 12, 1, 2, '0', '2', 'bandhire', '2016-10-27 23:33:02', '2016-10-27 23:38:15'),
(21, 7500000, 13, 2, 1, '4', '1', 'hiremusisi', '2016-10-28 07:13:45', '2016-11-27 02:18:49'),
(22, 5000000, 11, 1, 1, '4', '1', 'musisihire', '2016-10-30 23:20:06', '2016-10-30 23:29:14'),
(23, 8000000, 14, 2, 1, '4', '1', 'hireband', '2016-10-30 23:31:50', '2016-10-30 23:33:46'),
(24, 4000000, 15, 2, 1, '5', '1', 'hireband', '2016-11-06 01:04:50', '2016-11-05 08:27:20'),
(29, 52000000, 25, 4, 2, '0', '0', 'hireband', '2017-01-19 07:50:10', '2017-01-19 07:50:10'),
(30, 6000000, 26, 7, 2, '0', '1', 'hiremusisi', '2017-01-24 14:05:12', '2017-01-24 16:10:47'),
(31, 6000000, 27, 7, 2, '0', '1', 'hiremusisi', '2017-01-24 14:12:42', '2017-01-24 15:59:36'),
(32, 6000000, 28, 2, 7, '0', '0', 'musisihire', '2017-01-24 14:29:33', '2017-01-24 14:29:33'),
(33, 6000000, 28, 2, 7, '0', '0', 'musisihire', '2017-01-24 14:30:55', '2017-01-24 14:30:55'),
(34, 6000000, 28, 2, 7, '0', '1', 'musisihire', '2017-01-24 14:51:55', '2017-01-27 00:28:34'),
(35, 6000000, 23, 2, 7, '0', '0', 'musisihire', '2017-01-24 14:53:25', '2017-01-24 14:53:25'),
(36, 6000000, 28, 2, 7, '0', '0', 'musisihire', '2017-01-24 15:06:10', '2017-01-24 15:06:10'),
(37, 15000000, 30, 7, 2, '0', '0', 'hiremusisi', '2017-01-25 21:24:12', '2017-01-25 21:24:12'),
(38, 4000000, 32, 6, 2, '0', '0', 'hiremusisi', '2017-01-26 00:18:39', '2017-01-26 00:18:39'),
(39, 15000000, 29, 2, 7, '0', '0', 'musisihire', '2017-01-27 00:41:28', '2017-01-27 00:41:28'),
(40, 15000000, 29, 2, 7, '0', '0', 'musisihire', '2017-01-27 00:41:31', '2017-01-27 00:41:31');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`first_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`last_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`firebase` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`photo` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`aktif` enum('Y','N') COLLATE utf8_unicode_ci NOT NULL,
`slug` text COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `first_name`, `last_name`, `email`, `firebase`, `password`, `photo`, `aktif`, `slug`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Hera', 'Dwiana', 'oxydesystemz@ymail.com', '', '$2y$10$yFPWV0KOsGiRgSyvKi3.M.dU9/LY7ku8eJK2Fz.aDS9wJ6YMOIuXy', 'f8wqgvnccvuzoax5t6mt', 'Y', 'hera', 'VdIuBtRP3m2oMIgfPd0qGbI2qsIIntUAEVdBXfNhx0gqQaIQP969dNI04J6Z', '2016-10-21 06:13:33', '2016-12-01 01:25:49'),
(2, 'Dina', 'Amanda', 'dina@gmail.com', '', '$2y$10$32sdnL8dVtkkH808a9OobuBe3CWJZvzryJ9wh0VENJNfmjXs89vhq', 'dswzjfpp8jtj4xnqclj2', 'Y', 'dina', '1vxd3CnTcEh1oDbRtixGTPm6OX7unMFK0ssH1iDz4EKWQxxaVL09XZwdejBn', '2016-12-22 10:19:38', '2017-01-27 00:37:22'),
(3, 'coba', 'organizer', 'cobaorganizer@gmail.com', '', '$2y$10$blhc5lQeHkcCpdBBdkXareluwE4dKFWkuARoVhgitrfVoKtUPzQZq', '', 'Y', 'coba', NULL, '2017-01-25 22:59:57', '2017-01-25 23:03:11');
-- --------------------------------------------------------
--
-- Table structure for table `withdraw`
--
CREATE TABLE `withdraw` (
`id` int(10) UNSIGNED NOT NULL,
`jumlah` int(11) NOT NULL,
`saldo_id` int(10) UNSIGNED NOT NULL,
`saldo_akhir` int(11) DEFAULT NULL,
`status` enum('0','1') COLLATE utf8_unicode_ci DEFAULT '0',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `withdraw`
--
INSERT INTO `withdraw` (`id`, `jumlah`, `saldo_id`, `saldo_akhir`, `status`, `created_at`, `updated_at`) VALUES
(7, 500000, 5, 5000000, '1', '2016-10-25 00:14:48', '2016-10-25 00:41:35'),
(8, 3000000, 2, 1000000, '1', '2016-10-25 00:15:46', '2016-10-25 08:25:29'),
(9, 800000, 2, 200000, '0', '2016-10-25 00:16:02', '2016-10-25 00:16:02'),
(10, 2000000, 1, 8000000, '1', '2016-10-25 02:33:59', '2016-10-25 02:36:07'),
(13, 500000, 6, 5500000, '1', '2016-10-29 04:59:23', '2016-10-29 05:14:21'),
(14, 1000000, 7, 2000000, '1', '2016-12-22 15:37:12', '2016-12-22 15:38:34');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `admins`
--
ALTER TABLE `admins`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `admins_email_unique` (`email`);
--
-- Indexes for table `banks`
--
ALTER TABLE `banks`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `bank_admin`
--
ALTER TABLE `bank_admin`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `bank_musisi`
--
ALTER TABLE `bank_musisi`
ADD PRIMARY KEY (`id`),
ADD KEY `bank_musisi_musician_id_foreign` (`musician_id`),
ADD KEY `bank_musisi_bank_id_foreign` (`bank_id`);
--
-- Indexes for table `genres`
--
ALTER TABLE `genres`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `genre_bands`
--
ALTER TABLE `genre_bands`
ADD PRIMARY KEY (`id`),
ADD KEY `genre_bands_band_id_foreign` (`band_id`),
ADD KEY `genre_bands_genre_id_foreign` (`genre_id`);
--
-- Indexes for table `genre_musisi`
--
ALTER TABLE `genre_musisi`
ADD PRIMARY KEY (`id`),
ADD KEY `genre_musisi_musician_id_foreign` (`musician_id`),
ADD KEY `genre_musisi_genre_id_foreign` (`genre_id`);
--
-- Indexes for table `gigs`
--
ALTER TABLE `gigs`
ADD PRIMARY KEY (`id`),
ADD KEY `gigs_user_id_foreign` (`user_id`);
--
-- Indexes for table `grupbands`
--
ALTER TABLE `grupbands`
ADD PRIMARY KEY (`id`),
ADD KEY `grupbands_admin_id_foreign` (`admin_id`);
--
-- Indexes for table `grupband_musisi`
--
ALTER TABLE `grupband_musisi`
ADD PRIMARY KEY (`id`),
ADD KEY `grupband_musisi_position_id_foreign` (`position_id`),
ADD KEY `grupband_musisi_musician_id_foreign` (`musician_id`),
ADD KEY `grupband_musisi_grupband_id_foreign` (`grupband_id`);
--
-- Indexes for table `konfirmasi_pembayarans`
--
ALTER TABLE `konfirmasi_pembayarans`
ADD PRIMARY KEY (`id`),
ADD KEY `konfirmasi_pembayarans_sewa_id_foreign` (`sewa_id`),
ADD KEY `bank_admin_id` (`bank_admin_id`);
--
-- Indexes for table `musicians`
--
ALTER TABLE `musicians`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `musicians_email_unique` (`email`);
--
-- Indexes for table `notif`
--
ALTER TABLE `notif`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`),
ADD KEY `password_resets_token_index` (`token`);
--
-- Indexes for table `password_reset_musicians`
--
ALTER TABLE `password_reset_musicians`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `positions`
--
ALTER TABLE `positions`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `review`
--
ALTER TABLE `review`
ADD PRIMARY KEY (`id`),
ADD KEY `review_sewa_id_foreign` (`sewa_id`),
ADD KEY `review_user_id_foreign` (`user_id`);
--
-- Indexes for table `saldo`
--
ALTER TABLE `saldo`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `saldo_detail`
--
ALTER TABLE `saldo_detail`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sewas`
--
ALTER TABLE `sewas`
ADD PRIMARY KEY (`id`),
ADD KEY `sewas_gig_id_foreign` (`gig_id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- Indexes for table `withdraw`
--
ALTER TABLE `withdraw`
ADD PRIMARY KEY (`id`),
ADD KEY `withdraw_saldo_id_foreign` (`saldo_id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `admins`
--
ALTER TABLE `admins`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `banks`
--
ALTER TABLE `banks`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `bank_admin`
--
ALTER TABLE `bank_admin`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `bank_musisi`
--
ALTER TABLE `bank_musisi`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `genres`
--
ALTER TABLE `genres`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT for table `genre_bands`
--
ALTER TABLE `genre_bands`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `genre_musisi`
--
ALTER TABLE `genre_musisi`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `gigs`
--
ALTER TABLE `gigs`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=33;
--
-- AUTO_INCREMENT for table `grupbands`
--
ALTER TABLE `grupbands`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `grupband_musisi`
--
ALTER TABLE `grupband_musisi`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `konfirmasi_pembayarans`
--
ALTER TABLE `konfirmasi_pembayarans`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
--
-- AUTO_INCREMENT for table `musicians`
--
ALTER TABLE `musicians`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;
--
-- AUTO_INCREMENT for table `notif`
--
ALTER TABLE `notif`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=154;
--
-- AUTO_INCREMENT for table `password_reset_musicians`
--
ALTER TABLE `password_reset_musicians`
MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30;
--
-- AUTO_INCREMENT for table `positions`
--
ALTER TABLE `positions`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `review`
--
ALTER TABLE `review`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `saldo`
--
ALTER TABLE `saldo`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `saldo_detail`
--
ALTER TABLE `saldo_detail`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;
--
-- AUTO_INCREMENT for table `sewas`
--
ALTER TABLE `sewas`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=41;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `withdraw`
--
ALTER TABLE `withdraw`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `bank_musisi`
--
ALTER TABLE `bank_musisi`
ADD CONSTRAINT `bank_musisi_bank_id_foreign` FOREIGN KEY (`bank_id`) REFERENCES `banks` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `bank_musisi_musician_id_foreign` FOREIGN KEY (`musician_id`) REFERENCES `musicians` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `genre_bands`
--
ALTER TABLE `genre_bands`
ADD CONSTRAINT `genre_bands_band_id_foreign` FOREIGN KEY (`band_id`) REFERENCES `grupbands` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `genre_bands_genre_id_foreign` FOREIGN KEY (`genre_id`) REFERENCES `genres` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `genre_musisi`
--
ALTER TABLE `genre_musisi`
ADD CONSTRAINT `genre_musisi_genre_id_foreign` FOREIGN KEY (`genre_id`) REFERENCES `genres` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `genre_musisi_musician_id_foreign` FOREIGN KEY (`musician_id`) REFERENCES `musicians` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `gigs`
--
ALTER TABLE `gigs`
ADD CONSTRAINT `gigs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `grupbands`
--
ALTER TABLE `grupbands`
ADD CONSTRAINT `grupbands_admin_id_foreign` FOREIGN KEY (`admin_id`) REFERENCES `musicians` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `grupband_musisi`
--
ALTER TABLE `grupband_musisi`
ADD CONSTRAINT `grupband_musisi_grupband_id_foreign` FOREIGN KEY (`grupband_id`) REFERENCES `grupbands` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `grupband_musisi_musician_id_foreign` FOREIGN KEY (`musician_id`) REFERENCES `musicians` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `grupband_musisi_position_id_foreign` FOREIGN KEY (`position_id`) REFERENCES `positions` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `konfirmasi_pembayarans`
--
ALTER TABLE `konfirmasi_pembayarans`
ADD CONSTRAINT `konfirmasi_pembayarans_ibfk_1` FOREIGN KEY (`bank_admin_id`) REFERENCES `bank_admin` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `konfirmasi_pembayarans_sewa_id_foreign` FOREIGN KEY (`sewa_id`) REFERENCES `sewas` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `review`
--
ALTER TABLE `review`
ADD CONSTRAINT `review_sewa_id_foreign` FOREIGN KEY (`sewa_id`) REFERENCES `sewas` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `review_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `sewas`
--
ALTER TABLE `sewas`
ADD CONSTRAINT `sewas_gig_id_foreign` FOREIGN KEY (`gig_id`) REFERENCES `gigs` (`id`) ON DELETE CASCADE;
--
-- Constraints for table `withdraw`
--
ALTER TABLE `withdraw`
ADD CONSTRAINT `withdraw_saldo_id_foreign` FOREIGN KEY (`saldo_id`) REFERENCES `saldo` (`id`) ON DELETE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 55.279107 | 459 | 0.646278 |
bccdf93af4e32d83391df91a290d5b3af297a105 | 785 | js | JavaScript | index.js | kailashyogeshwar85/async-await-foreach | edf9b09456676d5b4de453c81556953a6ac768e1 | [
"MIT"
] | null | null | null | index.js | kailashyogeshwar85/async-await-foreach | edf9b09456676d5b4de453c81556953a6ac768e1 | [
"MIT"
] | null | null | null | index.js | kailashyogeshwar85/async-await-foreach | edf9b09456676d5b4de453c81556953a6ac768e1 | [
"MIT"
] | null | null | null | /**
* Author: Kailash K Yogeshwar
* Module: async-await-foreach
* Description: Sequential looping of async calls like async.waterfall or bluebird.each
*/
/**
* Usage
* const asyncForEach = require('async-await-foreach);
* const storyIds = [1, 2, 3, 4];
*
* asyncForEach(storyIds, async (item, index, array) => {
* await someAsyncCall(item);
* });
*
*/
async function asyncForEach(array, callback){
try {
if(!Array.isArray(array)){
throw new Error('Invalid argument expected Array but got ', typeof array);
}
let totalElements = array.length;
for (let index = 0; index < totalElements; index++){
await callback(array[index], index, array);
}
}catch(e){
return e;
}
} | 21.805556 | 88 | 0.596178 |
c2587ae43d77c5fa8d48b1d178b6e05c98655fdf | 704 | go | Go | pkg/utils/filter_forward_rules.go | ististan/cni-plugins | b6800a01a99e9e5643effa6f65d56ae120859f97 | [
"Apache-2.0"
] | 2 | 2021-05-23T18:32:32.000Z | 2021-08-04T13:25:04.000Z | pkg/utils/filter_forward_rules.go | ZentriaMC/cni-nftables-plugins | 2a5b6b0515be52493abacb890a04d99f7e83445c | [
"Apache-2.0"
] | null | null | null | pkg/utils/filter_forward_rules.go | ZentriaMC/cni-nftables-plugins | 2a5b6b0515be52493abacb890a04d99f7e83445c | [
"Apache-2.0"
] | null | null | null | package utils
import (
"github.com/containernetworking/cni/pkg/types/current"
)
// AddFilterForwardRules adds a set of rules in forwarding chain of filter table.
func AddFilterForwardRules(v, tableName, chainName string, addr *current.IPConfig, intfName string) error {
if err := isSupportedIPVersion(v); err != nil {
return err
}
if err := addFilterForwardInboundTrafficRule(v, tableName, chainName, addr, intfName); err != nil {
return err
}
if err := addFilterForwardOutboundTrafficRule(v, tableName, chainName, addr, intfName); err != nil {
return err
}
if err := addFilterForwardIntraInterfaceRule(v, tableName, chainName, addr, intfName); err != nil {
return err
}
return nil
}
| 30.608696 | 107 | 0.744318 |
bb2f8067fe0f05fc4a0942ec89080548a6eaa267 | 5,817 | dart | Dart | lib/src/generated/safari_services/SFSafariTab.dart | rodydavis/cupertino_ffi_generated | 4d59f68921a5ae1ba58831c9de83ea0d7979148f | [
"MIT"
] | 2 | 2021-05-10T01:24:08.000Z | 2021-12-13T10:24:41.000Z | lib/src/generated/safari_services/SFSafariTab.dart | rodydavis/cupertino_ffi_generated | 4d59f68921a5ae1ba58831c9de83ea0d7979148f | [
"MIT"
] | null | null | null | lib/src/generated/safari_services/SFSafariTab.dart | rodydavis/cupertino_ffi_generated | 4d59f68921a5ae1ba58831c9de83ea0d7979148f | [
"MIT"
] | null | null | null | // AUTOMATICALLY GENERATED. DO NOT EDIT.
part of cupertino_ffi.safari_services;
/// Static methods for Objective-C class `SFSafariTab`.
/// See also instance methods in [SFSafariTabPointer].
///
/// Find detailed documentation at: [developer.apple.com/documentation/safariservices?language=objc](https://developer.apple.com/documentation/safariservices?language=objc)
class SFSafariTab extends Struct {
/// Allocates a new instance of SFSafariTab.
static Pointer<SFSafariTab> allocate() {
_ensureDynamicLibraryHasBeenOpened();
return _objc.allocateByClassName<SFSafariTab>('SFSafariTab');
}
}
/// Instance methods for [SFSafariTab] (Objective-C class `SFSafariTab`).
///
/// Find detailed documentation at: [developer.apple.com/documentation/safariservices?language=objc](https://developer.apple.com/documentation/safariservices?language=objc)
extension SFSafariTabPointer on Pointer<SFSafariTab> {
/// Objective-C method `activateWithCompletionHandler:`.
@ObjcMethodInfo(
selector: 'activateWithCompletionHandler:',
returnType: 'v',
parameterTypes: ['@', ':', '@?'],
)
Pointer activateWithCompletionHandler(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'activateWithCompletionHandler:',
),
arg,
);
}
/// Objective-C method `close`.
@ObjcMethodInfo(
selector: 'close',
returnType: 'v',
parameterTypes: ['@', ':'],
)
Pointer close() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'close',
),
);
}
/// Objective-C method `copyWithZone:`.
@ObjcMethodInfo(
selector: 'copyWithZone:',
returnType: '@',
parameterTypes: ['@', ':', '^{_NSZone=}'],
)
Pointer copyWithZone(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'copyWithZone:',
),
arg,
);
}
/// Objective-C method `encodeWithCoder:`.
@ObjcMethodInfo(
selector: 'encodeWithCoder:',
returnType: 'v',
parameterTypes: ['@', ':', '@'],
)
Pointer encodeWithCoder(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'encodeWithCoder:',
),
arg,
);
}
/// Objective-C method `getActivePageWithCompletionHandler:`.
@ObjcMethodInfo(
selector: 'getActivePageWithCompletionHandler:',
returnType: 'v',
parameterTypes: ['@', ':', '@?'],
)
Pointer getActivePageWithCompletionHandler(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'getActivePageWithCompletionHandler:',
),
arg,
);
}
/// Objective-C method `getContainingWindowWithCompletionHandler:`.
@ObjcMethodInfo(
selector: 'getContainingWindowWithCompletionHandler:',
returnType: 'v',
parameterTypes: ['@', ':', '@?'],
)
Pointer getContainingWindowWithCompletionHandler(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'getContainingWindowWithCompletionHandler:',
),
arg,
);
}
/// Objective-C method `getPagesWithCompletionHandler:`.
@ObjcMethodInfo(
selector: 'getPagesWithCompletionHandler:',
returnType: 'v',
parameterTypes: ['@', ':', '@?'],
)
Pointer getPagesWithCompletionHandler(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'getPagesWithCompletionHandler:',
),
arg,
);
}
/// Objective-C method `hash`.
@ObjcMethodInfo(
selector: 'hash',
returnType: 'Q',
parameterTypes: ['@', ':'],
)
int hash() {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_returns_uint64(
this,
_objc.getSelector(
'hash',
),
);
}
/// Objective-C method `initWithCoder:`.
@ObjcMethodInfo(
selector: 'initWithCoder:',
returnType: '@',
parameterTypes: ['@', ':', '@'],
)
Pointer initWithCoder(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'initWithCoder:',
),
arg,
);
}
/// Objective-C method `isEqual:`.
@ObjcMethodInfo(
selector: 'isEqual:',
returnType: 'c',
parameterTypes: ['@', ':', '@'],
)
int isEqual(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_int8(
this,
_objc.getSelector(
'isEqual:',
),
arg,
);
}
/// Objective-C method `navigateToURL:`.
@ObjcMethodInfo(
selector: 'navigateToURL:',
returnType: 'v',
parameterTypes: ['@', ':', '@'],
)
Pointer navigateToURL(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'navigateToURL:',
),
arg,
);
}
/// Objective-C method `set_extensionContext:`.
@ObjcMethodInfo(
selector: 'set_extensionContext:',
returnType: 'v',
parameterTypes: ['@', ':', '@'],
)
Pointer set_extensionContext(
Pointer arg,
) {
_ensureDynamicLibraryHasBeenOpened();
return _objc_call.call_ptr_ptr_ptr_returns_ptr(
this,
_objc.getSelector(
'set_extensionContext:',
),
arg,
);
}
}
| 23.938272 | 172 | 0.643459 |
b8f0fca67f30c6e4ae14212353f027210d6e02a8 | 46,062 | rs | Rust | src/expressions/mod.rs | Ali-Mirghasemi/aerospike-client-rust | 85c93a2098520d35a2390c273672286618497d41 | [
"Apache-2.0"
] | 72 | 2017-01-17T17:03:57.000Z | 2022-03-01T20:34:01.000Z | src/expressions/mod.rs | Ali-Mirghasemi/aerospike-client-rust | 85c93a2098520d35a2390c273672286618497d41 | [
"Apache-2.0"
] | 77 | 2017-01-18T09:27:14.000Z | 2022-03-30T20:42:00.000Z | src/expressions/mod.rs | Ali-Mirghasemi/aerospike-client-rust | 85c93a2098520d35a2390c273672286618497d41 | [
"Apache-2.0"
] | 20 | 2017-05-23T16:44:32.000Z | 2022-03-19T06:53:57.000Z | // Copyright 2015-2020 Aerospike, Inc.
//
// Portions may be licensed to Aerospike, Inc. under one or more contributor
// license agreements.
//
// 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.
//! Functions used for Filter Expressions. This module requires Aerospike Server version >= 5.2
pub mod bitwise;
pub mod hll;
pub mod lists;
pub mod maps;
pub mod regex_flag;
use crate::commands::buffer::Buffer;
use crate::errors::Result;
use crate::msgpack::encoder::{pack_array_begin, pack_integer, pack_raw_string, pack_value};
use crate::operations::cdt_context::CdtContext;
use crate::{ParticleType, Value};
use std::collections::HashMap;
use std::fmt::Debug;
/// Expression Data Types for usage in some `FilterExpressions` on for example Map and List
#[derive(Debug, Clone, Copy)]
pub enum ExpType {
/// NIL Expression Type
NIL = 0,
/// BOOLEAN Expression Type
BOOL = 1,
/// INTEGER Expression Type
INT = 2,
/// STRING Expression Type
STRING = 3,
/// LIST Expression Type
LIST = 4,
/// MAP Expression Type
MAP = 5,
/// BLOB Expression Type
BLOB = 6,
/// FLOAT Expression Type
FLOAT = 7,
/// GEO String Expression Type
GEO = 8,
/// HLL Expression Type
HLL = 9,
}
#[derive(Debug, Clone, Copy)]
#[doc(hidden)]
pub enum ExpOp {
Unknown = 0,
EQ = 1,
NE = 2,
GT = 3,
GE = 4,
LT = 5,
LE = 6,
Regex = 7,
Geo = 8,
And = 16,
Or = 17,
Not = 18,
Xor = 19,
Add = 20,
Sub = 21,
Mul = 22,
Div = 23,
Pow = 24,
Log = 25,
Mod = 26,
Abs = 27,
Floor = 28,
Ceil = 29,
ToInt = 30,
ToFloat = 31,
IntAnd = 32,
IntOr = 33,
IntXor = 34,
IntNot = 35,
IntLshift = 36,
IntRshift = 37,
IntARshift = 38,
IntCount = 39,
IntLscan = 40,
IntRscan = 41,
Min = 50,
Max = 51,
DigestModulo = 64,
DeviceSize = 65,
LastUpdate = 66,
SinceUpdate = 67,
VoidTime = 68,
TTL = 69,
SetName = 70,
KeyExists = 71,
IsTombstone = 72,
Key = 80,
Bin = 81,
BinType = 82,
Cond = 123,
Var = 124,
Let = 125,
Quoted = 126,
Call = 127,
}
#[doc(hidden)]
pub const MODIFY: i64 = 0x40;
#[derive(Debug, Clone)]
#[doc(hidden)]
pub enum ExpressionArgument {
Value(Value),
FilterExpression(FilterExpression),
Context(Vec<CdtContext>),
}
/// Filter expression, which can be applied to most commands, to control which records are
/// affected by the command. Filter expression are created using the functions in the
/// [expressions](crate::expressions) module and its submodules.
#[derive(Debug, Clone)]
pub struct FilterExpression {
/// The Operation code
cmd: Option<ExpOp>,
/// The Primary Value of the Operation
val: Option<Value>,
/// The Bin to use it on (REGEX for example)
bin: Option<Box<FilterExpression>>,
/// The additional flags for the Operation (REGEX or return_type of Module for example)
flags: Option<i64>,
/// The optional Module flag for Module operations or Bin Types
module: Option<ExpType>,
/// Sub commands for the CmdExp operation
exps: Option<Vec<FilterExpression>>,
/// Optional Arguments (CDT)
arguments: Option<Vec<ExpressionArgument>>,
}
#[doc(hidden)]
impl FilterExpression {
fn new(
cmd: Option<ExpOp>,
val: Option<Value>,
bin: Option<FilterExpression>,
flags: Option<i64>,
module: Option<ExpType>,
exps: Option<Vec<FilterExpression>>,
) -> FilterExpression {
let bin = bin.map(Box::new);
FilterExpression {
cmd,
val,
bin,
flags,
module,
exps,
arguments: None,
}
}
fn pack_expression(
&self,
exps: &[FilterExpression],
buf: &mut Option<&mut Buffer>,
) -> Result<usize> {
let mut size = 0;
if let Some(val) = &self.val {
// DEF expression
size += pack_raw_string(buf, &val.to_string())?;
size += exps[0].pack(buf)?;
} else {
// Normal Expressions
match self.cmd.unwrap() {
ExpOp::Let => {
// Let wire format: LET <defname1>, <defexp1>, <defname2>, <defexp2>, ..., <scope exp>
let count = (exps.len() - 1) * 2 + 2;
size += pack_array_begin(buf, count)?;
}
_ => {
size += pack_array_begin(buf, exps.len() + 1)?;
}
}
size += pack_integer(buf, self.cmd.unwrap() as i64)?;
for exp in exps {
size += exp.pack(buf)?;
}
}
Ok(size)
}
fn pack_command(&self, cmd: ExpOp, buf: &mut Option<&mut Buffer>) -> Result<usize> {
let mut size = 0;
match cmd {
ExpOp::Regex => {
size += pack_array_begin(buf, 4)?;
// The Operation
size += pack_integer(buf, cmd as i64)?;
// Regex Flags
size += pack_integer(buf, self.flags.unwrap())?;
// Raw String is needed instead of the msgpack String that the pack_value method would use.
size += pack_raw_string(buf, &self.val.clone().unwrap().to_string())?;
// The Bin
size += self.bin.clone().unwrap().pack(buf)?;
}
ExpOp::Call => {
// Packing logic for Module
size += pack_array_begin(buf, 5)?;
// The Operation
size += pack_integer(buf, cmd as i64)?;
// The Module Operation
size += pack_integer(buf, self.module.unwrap() as i64)?;
// The Module (List/Map or Bitwise)
size += pack_integer(buf, self.flags.unwrap())?;
// Encoding the Arguments
if let Some(args) = &self.arguments {
let mut len = 0;
for arg in args {
// First match to estimate the Size and write the Context
match arg {
ExpressionArgument::Value(_)
| ExpressionArgument::FilterExpression(_) => len += 1,
ExpressionArgument::Context(ctx) => {
if !ctx.is_empty() {
size += pack_array_begin(buf, 3)?;
size += pack_integer(buf, 0xff)?;
size += pack_array_begin(buf, ctx.len() * 2)?;
for c in ctx {
size += pack_integer(buf, i64::from(c.id))?;
size += pack_value(buf, &c.value)?;
}
}
}
}
}
size += pack_array_begin(buf, len)?;
// Second match to write the real values
for arg in args {
match arg {
ExpressionArgument::Value(val) => {
size += pack_value(buf, val)?;
}
ExpressionArgument::FilterExpression(cmd) => {
size += cmd.pack(buf)?;
}
_ => {}
}
}
} else {
// No Arguments
size += pack_value(buf, &self.val.clone().unwrap())?;
}
// Write the Bin
size += self.bin.clone().unwrap().pack(buf)?;
}
ExpOp::Bin => {
// Bin Encoder
size += pack_array_begin(buf, 3)?;
// The Bin Operation
size += pack_integer(buf, cmd as i64)?;
// The Bin Type (INT/String etc.)
size += pack_integer(buf, self.module.unwrap() as i64)?;
// The name - Raw String is needed instead of the msgpack String that the pack_value method would use.
size += pack_raw_string(buf, &self.val.clone().unwrap().to_string())?;
}
ExpOp::BinType | ExpOp::Var => {
// BinType/Var encoder
size += pack_array_begin(buf, 2)?;
// BinType/Var Operation
size += pack_integer(buf, cmd as i64)?;
// The name - Raw String is needed instead of the msgpack String that the pack_value method would use.
size += pack_raw_string(buf, &self.val.clone().unwrap().to_string())?;
}
_ => {
// Packing logic for all other Ops
if let Some(value) = &self.val {
// Operation has a Value
size += pack_array_begin(buf, 2)?;
// Write the Operation
size += pack_integer(buf, cmd as i64)?;
// Write the Value
size += pack_value(buf, value)?;
} else {
// Operation has no Value
size += pack_array_begin(buf, 1)?;
// Write the Operation
size += pack_integer(buf, cmd as i64)?;
}
}
}
Ok(size)
}
fn pack_value(&self, buf: &mut Option<&mut Buffer>) -> Result<usize> {
// Packing logic for Value based Ops
pack_value(buf, &self.val.clone().unwrap())
}
pub fn pack(&self, buf: &mut Option<&mut Buffer>) -> Result<usize> {
let mut size = 0;
if let Some(exps) = &self.exps {
size += self.pack_expression(exps, buf)?;
} else if let Some(cmd) = self.cmd {
size += self.pack_command(cmd, buf)?;
} else {
size += self.pack_value(buf)?;
}
Ok(size)
}
}
/// Create a record key expression of specified type.
/// ```
/// use aerospike::expressions::{ExpType, ge, int_val, key};
/// // Integer record key >= 100000
/// ge(key(ExpType::INT), int_val(10000));
/// ```
pub fn key(exp_type: ExpType) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Key),
Some(Value::from(exp_type as i64)),
None,
None,
None,
None,
)
}
/// Create function that returns if the primary key is stored in the record meta data
/// as a boolean expression. This would occur when `send_key` is true on record write.
/// ```
/// // Key exists in record meta data
/// use aerospike::expressions::key_exists;
/// key_exists();
/// ```
pub fn key_exists() -> FilterExpression {
FilterExpression::new(Some(ExpOp::KeyExists), None, None, None, None, None)
}
/// Create 64 bit int bin expression.
/// ```
/// // Integer bin "a" == 500
/// use aerospike::expressions::{int_bin, int_val, eq};
/// eq(int_bin("a".to_string()), int_val(500));
/// ```
pub fn int_bin(name: String) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Bin),
Some(Value::from(name)),
None,
None,
Some(ExpType::INT),
None,
)
}
/// Create string bin expression.
/// ```
/// // String bin "a" == "views"
/// use aerospike::expressions::{eq, string_bin, string_val};
/// eq(string_bin("a".to_string()), string_val("views".to_string()));
/// ```
pub fn string_bin(name: String) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Bin),
Some(Value::from(name)),
None,
None,
Some(ExpType::STRING),
None,
)
}
/// Create blob bin expression.
/// ```
/// // String bin "a" == [1,2,3]
/// use aerospike::expressions::{eq, blob_bin, blob_val};
/// let blob: Vec<u8> = vec![1,2,3];
/// eq(blob_bin("a".to_string()), blob_val(blob));
/// ```
pub fn blob_bin(name: String) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Bin),
Some(Value::from(name)),
None,
None,
Some(ExpType::BLOB),
None,
)
}
/// Create 64 bit float bin expression.
/// ```
/// use aerospike::expressions::{float_val, float_bin, eq};
/// // Integer bin "a" == 500.5
/// eq(float_bin("a".to_string()), float_val(500.5));
/// ```
pub fn float_bin(name: String) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Bin),
Some(Value::from(name)),
None,
None,
Some(ExpType::FLOAT),
None,
)
}
/// Create geo bin expression.
/// ```
/// // String bin "a" == region
/// use aerospike::expressions::{eq, geo_bin, string_val};
/// let region = "{ \"type\": \"AeroCircle\", \"coordinates\": [[-122.0, 37.5], 50000.0] }";
/// eq(geo_bin("a".to_string()), string_val(region.to_string()));
/// ```
pub fn geo_bin(name: String) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Bin),
Some(Value::from(name)),
None,
None,
Some(ExpType::GEO),
None,
)
}
/// Create list bin expression.
/// ```
/// use aerospike::expressions::{ExpType, eq, int_val, list_bin};
/// use aerospike::operations::lists::ListReturnType;
/// use aerospike::expressions::lists::get_by_index;
/// // String bin a[2] == 3
/// eq(get_by_index(ListReturnType::Values, ExpType::INT, int_val(2), list_bin("a".to_string()), &[]), int_val(3));
/// ```
pub fn list_bin(name: String) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Bin),
Some(Value::from(name)),
None,
None,
Some(ExpType::LIST),
None,
)
}
/// Create map bin expression.
///
/// ```
/// // Bin a["key"] == "value"
/// use aerospike::expressions::{ExpType, string_val, map_bin, eq};
/// use aerospike::MapReturnType;
/// use aerospike::expressions::maps::get_by_key;
///
/// eq(
/// get_by_key(MapReturnType::Value, ExpType::STRING, string_val("key".to_string()), map_bin("a".to_string()), &[]),
/// string_val("value".to_string()));
/// ```
pub fn map_bin(name: String) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Bin),
Some(Value::from(name)),
None,
None,
Some(ExpType::MAP),
None,
)
}
/// Create a HLL bin expression
///
/// ```
/// use aerospike::expressions::{gt, list_val, hll_bin, int_val};
/// use aerospike::operations::hll::HLLPolicy;
/// use aerospike::Value;
/// use aerospike::expressions::hll::add;
///
/// // Add values to HLL bin "a" and check count > 7
/// let list = vec![Value::from(1)];
/// gt(add(HLLPolicy::default(), list_val(list), hll_bin("a".to_string())), int_val(7));
/// ```
pub fn hll_bin(name: String) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Bin),
Some(Value::from(name)),
None,
None,
Some(ExpType::HLL),
None,
)
}
/// Create function that returns if bin of specified name exists.
/// ```
/// // Bin "a" exists in record
/// use aerospike::expressions::bin_exists;
/// bin_exists("a".to_string());
/// ```
pub fn bin_exists(name: String) -> FilterExpression {
ne(bin_type(name), int_val(ParticleType::NULL as i64))
}
/// Create function that returns bin's integer particle type.
/// ```
/// use aerospike::ParticleType;
/// use aerospike::expressions::{eq, bin_type, int_val};
/// // Bin "a" particle type is a list
/// eq(bin_type("a".to_string()), int_val(ParticleType::LIST as i64));
/// ```
pub fn bin_type(name: String) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::BinType),
Some(Value::from(name)),
None,
None,
None,
None,
)
}
/// Create function that returns record set name string.
/// ```
/// use aerospike::expressions::{eq, set_name, string_val};
/// // Record set name == "myset
/// eq(set_name(), string_val("myset".to_string()));
/// ```
pub fn set_name() -> FilterExpression {
FilterExpression::new(Some(ExpOp::SetName), None, None, None, None, None)
}
/// Create function that returns record size on disk.
/// If server storage-engine is memory, then zero is returned.
/// ```
/// use aerospike::expressions::{ge, device_size, int_val};
/// // Record device size >= 100 KB
/// ge(device_size(), int_val(100*1024));
/// ```
pub fn device_size() -> FilterExpression {
FilterExpression::new(Some(ExpOp::DeviceSize), None, None, None, None, None)
}
/// Create function that returns record last update time expressed as 64 bit integer
/// nanoseconds since 1970-01-01 epoch.
/// ```
/// // Record last update time >=2020-08-01
/// use aerospike::expressions::{ge, last_update, float_val};
/// ge(last_update(), float_val(1.5962E+18));
/// ```
pub fn last_update() -> FilterExpression {
FilterExpression::new(Some(ExpOp::LastUpdate), None, None, None, None, None)
}
/// Create expression that returns milliseconds since the record was last updated.
/// This expression usually evaluates quickly because record meta data is cached in memory.
///
/// ```
/// // Record last updated more than 2 hours ago
/// use aerospike::expressions::{gt, int_val, since_update};
/// gt(since_update(), int_val(2 * 60 * 60 * 1000));
/// ```
pub fn since_update() -> FilterExpression {
FilterExpression::new(Some(ExpOp::SinceUpdate), None, None, None, None, None)
}
/// Create function that returns record expiration time expressed as 64 bit integer
/// nanoseconds since 1970-01-01 epoch.
/// ```
/// // Expires on 2020-08-01
/// use aerospike::expressions::{and, ge, last_update, float_val, lt};
/// and(vec![ge(last_update(), float_val(1.5962E+18)), lt(last_update(), float_val(1.5963E+18))]);
/// ```
pub fn void_time() -> FilterExpression {
FilterExpression::new(Some(ExpOp::VoidTime), None, None, None, None, None)
}
/// Create function that returns record expiration time (time to live) in integer seconds.
/// ```
/// // Record expires in less than 1 hour
/// use aerospike::expressions::{lt, ttl, int_val};
/// lt(ttl(), int_val(60*60));
/// ```
pub fn ttl() -> FilterExpression {
FilterExpression::new(Some(ExpOp::TTL), None, None, None, None, None)
}
/// Create expression that returns if record has been deleted and is still in tombstone state.
/// This expression usually evaluates quickly because record meta data is cached in memory.
///
/// ```
/// // Deleted records that are in tombstone state.
/// use aerospike::expressions::{is_tombstone};
/// is_tombstone();
/// ```
pub fn is_tombstone() -> FilterExpression {
FilterExpression::new(Some(ExpOp::IsTombstone), None, None, None, None, None)
}
/// Create function that returns record digest modulo as integer.
/// ```
/// // Records that have digest(key) % 3 == 1
/// use aerospike::expressions::{int_val, eq, digest_modulo};
/// eq(digest_modulo(3), int_val(1));
/// ```
pub fn digest_modulo(modulo: i64) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::DigestModulo),
Some(Value::from(modulo)),
None,
None,
None,
None,
)
}
/// Create function like regular expression string operation.
/// ```
/// use aerospike::RegexFlag;
/// use aerospike::expressions::{regex_compare, string_bin};
/// // Select string bin "a" that starts with "prefix" and ends with "suffix".
/// // Ignore case and do not match newline.
/// regex_compare("prefix.*suffix".to_string(), RegexFlag::ICASE as i64 | RegexFlag::NEWLINE as i64, string_bin("a".to_string()));
/// ```
pub fn regex_compare(regex: String, flags: i64, bin: FilterExpression) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Regex),
Some(Value::from(regex)),
Some(bin),
Some(flags),
None,
None,
)
}
/// Create compare geospatial operation.
/// ```
/// use aerospike::expressions::{geo_compare, geo_bin, geo_val};
/// // Query region within coordinates.
/// let region = "{\"type\": \"Polygon\", \"coordinates\": [ [[-122.500000, 37.000000],[-121.000000, 37.000000], [-121.000000, 38.080000],[-122.500000, 38.080000], [-122.500000, 37.000000]] ] }";
/// geo_compare(geo_bin("a".to_string()), geo_val(region.to_string()));
/// ```
pub fn geo_compare(left: FilterExpression, right: FilterExpression) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Geo),
None,
None,
None,
None,
Some(vec![left, right]),
)
}
/// Creates 64 bit integer value
pub fn int_val(val: i64) -> FilterExpression {
FilterExpression::new(None, Some(Value::from(val)), None, None, None, None)
}
/// Creates a Boolean value
pub fn bool_val(val: bool) -> FilterExpression {
FilterExpression::new(None, Some(Value::from(val)), None, None, None, None)
}
/// Creates String bin value
pub fn string_val(val: String) -> FilterExpression {
FilterExpression::new(None, Some(Value::from(val)), None, None, None, None)
}
/// Creates 64 bit float bin value
pub fn float_val(val: f64) -> FilterExpression {
FilterExpression::new(None, Some(Value::from(val)), None, None, None, None)
}
/// Creates Blob bin value
pub fn blob_val(val: Vec<u8>) -> FilterExpression {
FilterExpression::new(None, Some(Value::from(val)), None, None, None, None)
}
/// Create List bin Value
pub fn list_val(val: Vec<Value>) -> FilterExpression {
FilterExpression::new(
Some(ExpOp::Quoted),
Some(Value::from(val)),
None,
None,
None,
None,
)
}
/// Create Map bin Value
#[allow(clippy::implicit_hasher)]
pub fn map_val(val: HashMap<Value, Value>) -> FilterExpression {
FilterExpression::new(None, Some(Value::from(val)), None, None, None, None)
}
/// Create geospatial json string value.
pub fn geo_val(val: String) -> FilterExpression {
FilterExpression::new(None, Some(Value::from(val)), None, None, None, None)
}
/// Create a Nil Value
pub fn nil() -> FilterExpression {
FilterExpression::new(None, Some(Value::Nil), None, None, None, None)
}
/// Create "not" operator expression.
/// ```
/// // ! (a == 0 || a == 10)
/// use aerospike::expressions::{not, or, eq, int_bin, int_val};
/// not(or(vec![eq(int_bin("a".to_string()), int_val(0)), eq(int_bin("a".to_string()), int_val(10))]));
/// ```
pub fn not(exp: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Not),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![exp]),
arguments: None,
}
}
/// Create "and" (&&) operator that applies to a variable number of expressions.
/// ```
/// // (a > 5 || a == 0) && b < 3
/// use aerospike::expressions::{and, or, gt, int_bin, int_val, eq, lt};
/// and(vec![or(vec![gt(int_bin("a".to_string()), int_val(5)), eq(int_bin("a".to_string()), int_val(0))]), lt(int_bin("b".to_string()), int_val(3))]);
/// ```
pub const fn and(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::And),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Create "or" (||) operator that applies to a variable number of expressions.
/// ```
/// // a == 0 || b == 0
/// use aerospike::expressions::{or, eq, int_bin, int_val};
/// or(vec![eq(int_bin("a".to_string()), int_val(0)), eq(int_bin("b".to_string()), int_val(0))]);
/// ```
pub const fn or(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Or),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Create equal (==) expression.
/// ```
/// // a == 11
/// use aerospike::expressions::{eq, int_bin, int_val};
/// eq(int_bin("a".to_string()), int_val(11));
/// ```
pub fn eq(left: FilterExpression, right: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::EQ),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![left, right]),
arguments: None,
}
}
/// Create not equal (!=) expression
/// ```
/// // a != 13
/// use aerospike::expressions::{ne, int_bin, int_val};
/// ne(int_bin("a".to_string()), int_val(13));
/// ```
pub fn ne(left: FilterExpression, right: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::NE),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![left, right]),
arguments: None,
}
}
/// Create greater than (>) operation.
/// ```
/// // a > 8
/// use aerospike::expressions::{gt, int_bin, int_val};
/// gt(int_bin("a".to_string()), int_val(8));
/// ```
pub fn gt(left: FilterExpression, right: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::GT),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![left, right]),
arguments: None,
}
}
/// Create greater than or equal (>=) operation.
/// ```
/// use aerospike::expressions::{ge, int_bin, int_val};
/// // a >= 88
/// ge(int_bin("a".to_string()), int_val(88));
/// ```
pub fn ge(left: FilterExpression, right: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::GE),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![left, right]),
arguments: None,
}
}
/// Create less than (<) operation.
/// ```
/// // a < 1000
/// use aerospike::expressions::{lt, int_bin, int_val};
/// lt(int_bin("a".to_string()), int_val(1000));
/// ```
pub fn lt(left: FilterExpression, right: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::LT),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![left, right]),
arguments: None,
}
}
/// Create less than or equals (<=) operation.
/// ```
/// use aerospike::expressions::{le, int_bin, int_val};
/// // a <= 1
/// le(int_bin("a".to_string()), int_val(1));
/// ```
pub fn le(left: FilterExpression, right: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::LE),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![left, right]),
arguments: None,
}
}
/// Create "add" (+) operator that applies to a variable number of expressions.
/// Return sum of all `FilterExpressions` given. All arguments must resolve to the same type (integer or float).
/// Requires server version 5.6.0+.
/// ```
/// use aerospike::expressions::{eq, num_add, int_bin, int_val};
/// // a + b + c == 10
/// eq(num_add(vec![int_bin("a".to_string()), int_bin("b".to_string()), int_bin("c".to_string())]), int_val(10));
/// ```
pub const fn num_add(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Add),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Create "subtract" (-) operator that applies to a variable number of expressions.
/// If only one `FilterExpressions` is provided, return the negation of that argument.
/// Otherwise, return the sum of the 2nd to Nth `FilterExpressions` subtracted from the 1st
/// `FilterExpressions`. All `FilterExpressions` must resolve to the same type (integer or float).
/// Requires server version 5.6.0+.
/// ```
/// use aerospike::expressions::{gt, num_sub, int_bin, int_val};
/// // a - b - c > 10
/// gt(num_sub(vec![int_bin("a".to_string()), int_bin("b".to_string()), int_bin("c".to_string())]), int_val(10));
/// ```
pub const fn num_sub(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Sub),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Create "multiply" (*) operator that applies to a variable number of expressions.
/// Return the product of all `FilterExpressions`. If only one `FilterExpressions` is supplied, return
/// that `FilterExpressions`. All `FilterExpressions` must resolve to the same type (integer or float).
/// Requires server version 5.6.0+.
/// ```
/// use aerospike::expressions::{lt, num_mul, int_val, int_bin};
/// // a * b * c < 100
/// lt(num_mul(vec![int_bin("a".to_string()), int_bin("b".to_string()), int_bin("c".to_string())]), int_val(100));
/// ```
pub const fn num_mul(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Mul),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Create "divide" (/) operator that applies to a variable number of expressions.
/// If there is only one `FilterExpressions`, returns the reciprocal for that `FilterExpressions`.
/// Otherwise, return the first `FilterExpressions` divided by the product of the rest.
/// All `FilterExpressions` must resolve to the same type (integer or float).
/// Requires server version 5.6.0+.
/// ```
/// use aerospike::expressions::{lt, int_val, int_bin, num_div};
/// // a / b / c > 1
/// lt(num_div(vec![int_bin("a".to_string()), int_bin("b".to_string()), int_bin("c".to_string())]), int_val(1));
/// ```
pub const fn num_div(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Div),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Create "power" operator that raises a "base" to the "exponent" power.
/// All arguments must resolve to floats.
/// Requires server version 5.6.0+.
/// ```
/// // pow(a, 2.0) == 4.0
/// use aerospike::expressions::{eq, num_pow, float_bin, float_val};
/// eq(num_pow(float_bin("a".to_string()), float_val(2.0)), float_val(4.0));
/// ```
pub fn num_pow(base: FilterExpression, exponent: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Pow),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![base, exponent]),
arguments: None,
}
}
/// Create "log" operator for logarithm of "num" with base "base".
/// All arguments must resolve to floats.
/// Requires server version 5.6.0+.
/// ```
/// // log(a, 2.0) == 4.0
/// use aerospike::expressions::{eq, float_bin, float_val, num_log};
/// eq(num_log(float_bin("a".to_string()), float_val(2.0)), float_val(4.0));
/// ```
pub fn num_log(num: FilterExpression, base: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Log),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![num, base]),
arguments: None,
}
}
/// Create "modulo" (%) operator that determines the remainder of "numerator"
/// divided by "denominator". All arguments must resolve to integers.
/// Requires server version 5.6.0+.
/// ```
/// // a % 10 == 0
/// use aerospike::expressions::{eq, num_mod, int_val, int_bin};
/// eq(num_mod(int_bin("a".to_string()), int_val(10)), int_val(0));
/// ```
pub fn num_mod(numerator: FilterExpression, denominator: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Mod),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![numerator, denominator]),
arguments: None,
}
}
/// Create operator that returns absolute value of a number.
/// All arguments must resolve to integer or float.
/// Requires server version 5.6.0+.
/// ```
/// // abs(a) == 1
/// use aerospike::expressions::{eq, int_val, int_bin, num_abs};
/// eq(num_abs(int_bin("a".to_string())), int_val(1));
/// ```
pub fn num_abs(value: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Abs),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![value]),
arguments: None,
}
}
/// Create expression that rounds a floating point number down to the closest integer value.
/// The return type is float.
// Requires server version 5.6.0+.
/// ```
/// // floor(2.95) == 2.0
/// use aerospike::expressions::{eq, num_floor, float_val};
/// eq(num_floor(float_val(2.95)), float_val(2.0));
/// ```
pub fn num_floor(num: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Floor),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![num]),
arguments: None,
}
}
/// Create expression that rounds a floating point number up to the closest integer value.
/// The return type is float.
/// Requires server version 5.6.0+.
/// ```
/// // ceil(2.15) == 3.0
/// use aerospike::expressions::{float_val, num_ceil, ge};
/// ge(num_ceil(float_val(2.15)), float_val(3.0));
/// ```
pub fn num_ceil(num: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Ceil),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![num]),
arguments: None,
}
}
/// Create expression that converts an integer to a float.
/// Requires server version 5.6.0+.
/// ```
/// // int(2.5) == 2
/// use aerospike::expressions::{float_val, eq, to_int, int_val};
/// eq(to_int(float_val(2.5)), int_val(2));
/// ```
pub fn to_int(num: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::ToInt),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![num]),
arguments: None,
}
}
/// Create expression that converts a float to an integer.
/// Requires server version 5.6.0+.
/// ```
/// // float(2) == 2.0
/// use aerospike::expressions::{float_val, eq, to_float, int_val};
/// eq(to_float(int_val(2)), float_val(2.0));
/// ```
pub fn to_float(num: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::ToFloat),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![num]),
arguments: None,
}
}
/// Create integer "and" (&) operator that is applied to two or more integers.
/// All arguments must resolve to integers.
/// Requires server version 5.6.0+.
/// ```
/// // a & 0xff == 0x11
/// use aerospike::expressions::{eq, int_val, int_and, int_bin};
/// eq(int_and(vec![int_bin("a".to_string()), int_val(0xff)]), int_val(0x11));
/// ```
pub const fn int_and(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::IntAnd),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Create integer "xor" (^) operator that is applied to two or more integers.
/// All arguments must resolve to integers.
/// Requires server version 5.6.0+.
/// ```
/// // a ^ b == 16
/// use aerospike::expressions::{eq, int_val, int_xor, int_bin};
/// eq(int_xor(vec![int_bin("a".to_string()), int_bin("b".to_string())]), int_val(16));
/// ```
pub const fn int_xor(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::IntXor),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Create integer "not" (~) operator.
/// Requires server version 5.6.0+.
/// ```
/// // ~a == 7
/// use aerospike::expressions::{eq, int_val, int_not, int_bin};
/// eq(int_not(int_bin("a".to_string())), int_val(7));
/// ```
pub fn int_not(exp: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::IntNot),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![exp]),
arguments: None,
}
}
/// Create integer "left shift" (<<) operator.
/// Requires server version 5.6.0+.
/// ```
/// // a << 8 > 0xff
/// use aerospike::expressions::{int_val, int_bin, gt, int_lshift};
/// gt(int_lshift(int_bin("a".to_string()), int_val(8)), int_val(0xff));
/// ```
pub fn int_lshift(value: FilterExpression, shift: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::IntLshift),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![value, shift]),
arguments: None,
}
}
/// Create integer "logical right shift" (>>>) operator.
/// Requires server version 5.6.0+.
/// ```
/// // a >> 8 > 0xff
/// use aerospike::expressions::{int_val, int_bin, gt, int_rshift};
/// gt(int_rshift(int_bin("a".to_string()), int_val(8)), int_val(0xff));
/// ```
pub fn int_rshift(value: FilterExpression, shift: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::IntRshift),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![value, shift]),
arguments: None,
}
}
/// Create integer "arithmetic right shift" (>>) operator.
/// The sign bit is preserved and not shifted.
/// Requires server version 5.6.0+.
/// ```
/// // a >>> 8 > 0xff
/// use aerospike::expressions::{int_val, int_bin, gt, int_arshift};
/// gt(int_arshift(int_bin("a".to_string()), int_val(8)), int_val(0xff));
/// ```
pub fn int_arshift(value: FilterExpression, shift: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::IntARshift),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![value, shift]),
arguments: None,
}
}
/// Create expression that returns count of integer bits that are set to 1.
/// Requires server version 5.6.0+.
/// ```
/// // count(a) == 4
/// use aerospike::expressions::{int_val, int_bin, int_count, eq};
/// eq(int_count(int_bin("a".to_string())), int_val(4));
/// ```
pub fn int_count(exp: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::IntCount),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![exp]),
arguments: None,
}
}
/// Create expression that scans integer bits from left (most significant bit) to
/// right (least significant bit), looking for a search bit value. When the
/// search value is found, the index of that bit (where the most significant bit is
/// index 0) is returned. If "search" is true, the scan will search for the bit
/// value 1. If "search" is false it will search for bit value 0.
/// Requires server version 5.6.0+.
/// ```
/// // lscan(a, true) == 4
/// use aerospike::expressions::{int_val, int_bin, eq, int_lscan, bool_val};
/// eq(int_lscan(int_bin("a".to_string()), bool_val(true)), int_val(4));
/// ```
pub fn int_lscan(value: FilterExpression, search: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::IntLscan),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![value, search]),
arguments: None,
}
}
/// Create expression that scans integer bits from right (least significant bit) to
/// left (most significant bit), looking for a search bit value. When the
/// search value is found, the index of that bit (where the most significant bit is
/// index 0) is returned. If "search" is true, the scan will search for the bit
/// value 1. If "search" is false it will search for bit value 0.
/// Requires server version 5.6.0+.
/// ```
/// // rscan(a, true) == 4
/// use aerospike::expressions::{int_val, int_bin, eq, int_rscan, bool_val};
/// eq(int_rscan(int_bin("a".to_string()), bool_val(true)), int_val(4));
/// ```
pub fn int_rscan(value: FilterExpression, search: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::IntRscan),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(vec![value, search]),
arguments: None,
}
}
/// Create expression that returns the minimum value in a variable number of expressions.
/// All arguments must be the same type (integer or float).
/// Requires server version 5.6.0+.
/// ```
/// // min(a, b, c) > 0
/// use aerospike::expressions::{int_val, int_bin, gt, min};
/// gt(min(vec![int_bin("a".to_string()),int_bin("b".to_string()),int_bin("c".to_string())]), int_val(0));
/// ```
pub const fn min(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Min),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Create expression that returns the maximum value in a variable number of expressions.
/// All arguments must be the same type (integer or float).
/// Requires server version 5.6.0+.
/// ```
/// // max(a, b, c) > 100
/// use aerospike::expressions::{int_val, int_bin, gt, max};
/// gt(max(vec![int_bin("a".to_string()),int_bin("b".to_string()),int_bin("c".to_string())]), int_val(100));
/// ```
pub const fn max(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Max),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
//--------------------------------------------------
// Variables
//--------------------------------------------------
/// Conditionally select an expression from a variable number of expression pairs
/// followed by default expression action.
/// Requires server version 5.6.0+.
/// ```
/// // Args Format: bool exp1, action exp1, bool exp2, action exp2, ..., action-default
/// // Apply operator based on type.
///
/// use aerospike::expressions::{cond, int_bin, eq, int_val, num_add, num_sub, num_mul};
/// cond(
/// vec![
/// eq(int_bin("type".to_string()), int_val(0)), num_add(vec![int_bin("val1".to_string()), int_bin("val2".to_string())]),
/// eq(int_bin("type".to_string()), int_val(1)), num_sub(vec![int_bin("val1".to_string()), int_bin("val2".to_string())]),
/// eq(int_bin("type".to_string()), int_val(2)), num_mul(vec![int_bin("val1".to_string()), int_bin("val2".to_string())]),
/// int_val(-1)
/// ]
/// );
/// ```
pub const fn cond(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Cond),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Define variables and expressions in scope.
/// Requires server version 5.6.0+.
/// ```
/// // 5 < a < 10
/// use aerospike::expressions::{exp_let, def, int_bin, and, lt, int_val, var};
/// exp_let(
/// vec![
/// def("x".to_string(), int_bin("a".to_string())),
/// and(vec![
/// lt(int_val(5), var("x".to_string()),),
/// lt(var("x".to_string()), int_val(10))
/// ])
/// ]
/// );
/// ```
pub const fn exp_let(exps: Vec<FilterExpression>) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Let),
val: None,
bin: None,
flags: None,
module: None,
exps: Some(exps),
arguments: None,
}
}
/// Assign variable to an expression that can be accessed later.
/// Requires server version 5.6.0+.
/// ```
/// // 5 < a < 10
/// use aerospike::expressions::{exp_let, def, int_bin, and, lt, int_val, var};
/// exp_let(
/// vec![
/// def("x".to_string(), int_bin("a".to_string())),
/// and(vec![
/// lt(int_val(5), var("x".to_string()),),
/// lt(var("x".to_string()), int_val(10))
/// ])
/// ]
/// );
/// ```
pub fn def(name: String, value: FilterExpression) -> FilterExpression {
FilterExpression {
cmd: None,
val: Some(Value::from(name)),
bin: None,
flags: None,
module: None,
exps: Some(vec![value]),
arguments: None,
}
}
/// Retrieve expression value from a variable.
/// Requires server version 5.6.0+.
pub fn var(name: String) -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Var),
val: Some(Value::from(name)),
bin: None,
flags: None,
module: None,
exps: None,
arguments: None,
}
}
/// Create unknown value. Used to intentionally fail an expression.
/// The failure can be ignored with `ExpWriteFlags` `EVAL_NO_FAIL`
/// or `ExpReadFlags` `EVAL_NO_FAIL`.
/// Requires server version 5.6.0+.
///
/// ```
/// // double v = balance - 100.0;
/// // return (v > 0.0)? v : unknown;
/// use aerospike::expressions::{exp_let, def, num_sub, float_bin, float_val, cond, ge, var, unknown};
/// exp_let(
/// vec![
/// def("v".to_string(), num_sub(vec![float_bin("balance".to_string()), float_val(100.0)])),
/// cond(vec![ge(var("v".to_string()), float_val(0.0)), var("v".to_string())]),
/// unknown()
/// ]
/// );
/// ```
pub const fn unknown() -> FilterExpression {
FilterExpression {
cmd: Some(ExpOp::Unknown),
val: None,
bin: None,
flags: None,
module: None,
exps: None,
arguments: None,
}
}
| 31.356025 | 195 | 0.578307 |
71710684afb80d3f60ccd854e20f4f2a3a0c55ac | 273 | ts | TypeScript | packages/app/src/req.ts | leoDreamer/mrapi | 3ef2216152d97902cf8b90a26783dfceeea5b58a | [
"MIT"
] | 20 | 2020-05-13T12:09:08.000Z | 2021-09-10T07:16:09.000Z | packages/app/src/req.ts | leoDreamer/mrapi | 3ef2216152d97902cf8b90a26783dfceeea5b58a | [
"MIT"
] | 14 | 2020-07-15T09:04:06.000Z | 2021-06-21T14:27:11.000Z | packages/app/src/req.ts | leoDreamer/mrapi | 3ef2216152d97902cf8b90a26783dfceeea5b58a | [
"MIT"
] | 5 | 2020-06-30T03:12:02.000Z | 2021-08-06T20:28:41.000Z | /**
* For express compatibility
*
* get() = header()
* accepts()
* acceptsEncodings()
* acceptsCharsets()
* acceptsLanguages()
* range()
* param()
* is()
*
* protocol
* secure
* ip
* ips
* subdomains
* path
* hostname
* host
* fresh
* stale
* xhr
*/
| 10.92 | 28 | 0.571429 |
d28b92e2ee89653d17adb025efecf63cc01ab992 | 1,572 | php | PHP | app/api/validate/Report.php | tcyfree/nx-qxd | 60131ae6b583428385b1910ea8579713bf8bb733 | [
"Apache-2.0"
] | 1 | 2018-08-02T15:04:18.000Z | 2018-08-02T15:04:18.000Z | app/api/validate/Report.php | tcyfree/nx-qxd | 60131ae6b583428385b1910ea8579713bf8bb733 | [
"Apache-2.0"
] | null | null | null | app/api/validate/Report.php | tcyfree/nx-qxd | 60131ae6b583428385b1910ea8579713bf8bb733 | [
"Apache-2.0"
] | 1 | 2017-10-24T10:58:35.000Z | 2017-10-24T10:58:35.000Z | <?php
// +----------------------------------------------------------------------
// | ThinkNuan-x [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017-2018 http://www.nuan-x.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: probe <1946644259@qq.com>
// +----------------------------------------------------------------------
// | DateTime: 2017/8/28/15:09
// +----------------------------------------------------------------------
namespace app\api\validate;
use app\lib\exception\ParameterException;
class Report extends BaseValidate
{
protected $rule = [
'community_id' => 'require|length:36',
'content' => 'max:255',
'images' => 'checkUris'
];
/**
* 验证不确定数组值是否符合规范,并确定到某个具体key
* 1 如果为空则返回true
* @param $value
* @return bool
* @throws ParameterException
*/
protected function checkUris($value)
{
if ($value){
foreach ($value as $v)
{
$res = preg_match('/^(https?:\/\/){1}([0-9a-zA-Z_-]+\.)+[a-zA-Z]+(\/([0-9a-zA-Z_-]+\.?)+[a-zA-Z]+)*$/',$v);
if ($res == 0){
throw new ParameterException([
'msg' => $v.'不是有效的URI地址'
]);
}
}
}
return true;
}
} | 31.44 | 123 | 0.354326 |
fb86172e1156b47a75c88db7c35aebb92dafb101 | 1,783 | sql | SQL | app/lib/jelix/core-modules/jelix/install/sql/install_jacl2.data.mysql.sql | yvestan/sendui | b643a89398024e1c7c04321fefc0efe0f773115b | [
"MIT"
] | 1 | 2015-05-06T14:03:39.000Z | 2015-05-06T14:03:39.000Z | app/lib/jelix/core-modules/jelix/install/sql/install_jacl2.data.mysql.sql | yvestan/sendui | b643a89398024e1c7c04321fefc0efe0f773115b | [
"MIT"
] | null | null | null | app/lib/jelix/core-modules/jelix/install/sql/install_jacl2.data.mysql.sql | yvestan/sendui | b643a89398024e1c7c04321fefc0efe0f773115b | [
"MIT"
] | null | null | null | --
INSERT INTO `jacl2_group` (`id_aclgrp`, `name`, `grouptype`, `ownerlogin`) VALUES
(1, 'admins', 0, NULL),
(2, 'users', 1, NULL),
(3, 'admin', 2, 'admin'),
(0, 'anonymous', 1, NULL);
INSERT INTO `jacl2_user_group` (`login`, `id_aclgrp`) VALUES
('admin', 1),
('admin', 3);
INSERT INTO `jacl2_subject` (`id_aclsbj`, `label_key`) VALUES
('acl.user.view', 'jelix~acl2db.acl.user.view'),
('acl.user.modify', 'jelix~acl2db.acl.user.modify'),
('acl.group.modify', 'jelix~acl2db.acl.group.modify'),
('acl.group.create', 'jelix~acl2db.acl.group.create'),
('acl.group.delete', 'jelix~acl2db.acl.group.delete'),
('acl.group.view', 'jelix~acl2db.acl.group.view'),
('auth.users.list', 'jelix~auth.acl.users.list'),
('auth.users.view', 'jelix~auth.acl.users.view'),
('auth.users.modify', 'jelix~auth.acl.users.modify'),
('auth.users.create', 'jelix~auth.acl.users.create'),
('auth.users.delete', 'jelix~auth.acl.users.delete'),
('auth.users.change.password', 'jelix~auth.acl.users.change.password'),
('auth.user.view', 'jelix~auth.acl.user.view'),
('auth.user.modify', 'jelix~auth.acl.user.modify'),
('auth.user.change.password', 'jelix~auth.acl.user.change.password');
INSERT INTO `jacl2_rights` (`id_aclsbj`, `id_aclgrp`, `id_aclres`) VALUES
('acl.group.modify', 1, ''),
('acl.group.create', 1, ''),
('acl.group.delete', 1, ''),
('acl.group.view', 1, ''),
('acl.user.modify', 1, ''),
('acl.user.view', 1, ''),
('auth.users.list', 1, ''),
('auth.users.view', 1, ''),
('auth.users.modify', 1, ''),
('auth.users.create', 1, ''),
('auth.users.delete', 1, ''),
('auth.users.change.password', 1, ''),
('auth.user.view', 1, ''),
('auth.user.modify', 1, ''),
('auth.user.change.password', 1, ''),
('auth.user.view', 2, ''),
('auth.user.modify', 2, ''),
('auth.user.change.password', 2, '');
| 36.387755 | 82 | 0.635446 |
545bd2fa50b7a0cf228764350e6b4e9e4de2a81e | 1,088 | sql | SQL | DataBaseScripts/Queries/SP_getReceiptWithAp.sql | Edufacr/University-DB1-Project | 9a6b4f9ada1cfd3aaee4d9aae9287c0dfc309d21 | [
"MIT"
] | null | null | null | DataBaseScripts/Queries/SP_getReceiptWithAp.sql | Edufacr/University-DB1-Project | 9a6b4f9ada1cfd3aaee4d9aae9287c0dfc309d21 | [
"MIT"
] | null | null | null | DataBaseScripts/Queries/SP_getReceiptWithAp.sql | Edufacr/University-DB1-Project | 9a6b4f9ada1cfd3aaee4d9aae9287c0dfc309d21 | [
"MIT"
] | null | null | null | SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Eduardo Madrigal Marín
-- Create date:
-- Description: Gets details of receipt with AP
-- =============================================
CREATE OR ALTER PROCEDURE SP_getReceiptWithAp
-- Add the parameters for the stored procedure here
@inMovNumber INT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
DECLARE @IdReceipt int;
DECLARE @ApCCName VARCHAR(50);
BEGIN TRY
SELECT @IdReceipt = ReceiptNumber
FROM completeAPReceipts AS r
WHERE r.MovId = @inMovNumber;
SELECT @ApCCName = Name
FROM completeCCs
WHERE Id = 12;
IF(@IdReceipt IS NOT NULL)
BEGIN
SELECT ReceiptNumber,@ApCCName as ChargeConceptName,Amount,DueDate,Date AS ReceiptDate
FROM completeAPReceipts AS r
WHERE r.ReceiptNumber = @IdReceipt
END
RETURN -50002
END TRY
BEGIN CATCH
return @@Error * -1
END CATCH
END
GO | 25.302326 | 94 | 0.65625 |
98c328386ed086975c9e74555fd0ccf38fab32cc | 10,971 | html | HTML | docs/html/crypto__engine_8cpp.html | GovTechSIOT/decada-embedded-example-zephyr | 8d21fb229dd8b2b9d893660b42fb3ccdd1851ef4 | [
"Apache-2.0"
] | 4 | 2021-06-30T06:18:31.000Z | 2021-07-21T07:00:03.000Z | docs/html/crypto__engine_8cpp.html | GovTechSIOT/decada-embedded-example-zephyr | 8d21fb229dd8b2b9d893660b42fb3ccdd1851ef4 | [
"Apache-2.0"
] | null | null | null | docs/html/crypto__engine_8cpp.html | GovTechSIOT/decada-embedded-example-zephyr | 8d21fb229dd8b2b9d893660b42fb3ccdd1851ef4 | [
"Apache-2.0"
] | null | null | null | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>decada-embedded-example-zephyr: src/crypto_engine/crypto_engine.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">decada-embedded-example-zephyr
 <span id="projectnumber">R1.0.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_e50a0b054ee5298339ea0fec2a8e1a4f.html">crypto_engine</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#define-members">Macros</a> |
<a href="#func-members">Functions</a> |
<a href="#var-members">Variables</a> </div>
<div class="headertitle">
<div class="title">crypto_engine.cpp File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include <logging/log.h></code><br />
<code>#include <mbedtls/pk_internal.h></code><br />
<code>#include <mbedtls/x509.h></code><br />
<code>#include <mbedtls/x509_csr.h></code><br />
<code>#include <net/tls_credentials.h></code><br />
<code>#include "<a class="el" href="crypto__engine_8h_source.html">crypto_engine.h</a>"</code><br />
<code>#include "<a class="el" href="device__uuid_8h_source.html">device_uuid/device_uuid.h</a>"</code><br />
<code>#include "<a class="el" href="persist__store_8h_source.html">persist_store/persist_store.h</a>"</code><br />
<code>#include "<a class="el" href="time__engine_8h_source.html">time_engine/time_engine.h</a>"</code><br />
<code>#include "<a class="el" href="tls__certs_8h_source.html">tls_certs.h</a>"</code><br />
<code>#include "<a class="el" href="user__config_8h_source.html">user_config.h</a>"</code><br />
<code>#include "<a class="el" href="watchdog__config_8h_source.html">watchdog_config/watchdog_config.h</a>"</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:acdd8c2cd693c9afa895b8422ef9da5fb"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="crypto__engine_8cpp.html#acdd8c2cd693c9afa895b8422ef9da5fb">MBEDTLS_KEY_SIZE</a>   (2048)</td></tr>
<tr class="separator:acdd8c2cd693c9afa895b8422ef9da5fb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a282551d0ff5614f8f46fb6fe3405fc2f"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="crypto__engine_8cpp.html#a282551d0ff5614f8f46fb6fe3405fc2f">MBEDTLS_EXPONENT</a>   (65537)</td></tr>
<tr class="separator:a282551d0ff5614f8f46fb6fe3405fc2f"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ac2bf33ff055ba1f95e02c0d898a487fe"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="crypto__engine_8cpp.html#ac2bf33ff055ba1f95e02c0d898a487fe">LOG_MODULE_REGISTER</a> (crypto_engine, LOG_LEVEL_DBG)</td></tr>
<tr class="separator:ac2bf33ff055ba1f95e02c0d898a487fe"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a11d3fba7520dbb3207f7d5f3b8536c93"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="crypto__engine_8cpp.html#a11d3fba7520dbb3207f7d5f3b8536c93">trng_entropy_func</a> (void *ctx, unsigned char *buf, size_t len)</td></tr>
<tr class="memdesc:a11d3fba7520dbb3207f7d5f3b8536c93"><td class="mdescLeft"> </td><td class="mdescRight">Entropy callback wrapper. <a href="crypto__engine_8cpp.html#a11d3fba7520dbb3207f7d5f3b8536c93">More...</a><br /></td></tr>
<tr class="separator:a11d3fba7520dbb3207f7d5f3b8536c93"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a552ccd9d8934001d1fcda2d1aeef9ca4"><td class="memItemLeft" align="right" valign="top">std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="crypto__engine_8cpp.html#a552ccd9d8934001d1fcda2d1aeef9ca4">session_client_key</a></td></tr>
<tr class="separator:a552ccd9d8934001d1fcda2d1aeef9ca4"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a282551d0ff5614f8f46fb6fe3405fc2f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a282551d0ff5614f8f46fb6fe3405fc2f">◆ </a></span>MBEDTLS_EXPONENT</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define MBEDTLS_EXPONENT   (65537)</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="acdd8c2cd693c9afa895b8422ef9da5fb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acdd8c2cd693c9afa895b8422ef9da5fb">◆ </a></span>MBEDTLS_KEY_SIZE</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">#define MBEDTLS_KEY_SIZE   (2048)</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ac2bf33ff055ba1f95e02c0d898a487fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac2bf33ff055ba1f95e02c0d898a487fe">◆ </a></span>LOG_MODULE_REGISTER()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">LOG_MODULE_REGISTER </td>
<td>(</td>
<td class="paramtype">crypto_engine </td>
<td class="paramname">, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">LOG_LEVEL_DBG </td>
<td class="paramname"> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="a11d3fba7520dbb3207f7d5f3b8536c93"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a11d3fba7520dbb3207f7d5f3b8536c93">◆ </a></span>trng_entropy_func()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int trng_entropy_func </td>
<td>(</td>
<td class="paramtype">void * </td>
<td class="paramname"><em>ctx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned char * </td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>len</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Entropy callback wrapper. </p>
<dl class="section author"><dt>Author</dt><dd>Lee Tze Han </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>TRNG device object </td></tr>
<tr><td class="paramname">buf</td><td>Buffer to fill </td></tr>
<tr><td class="paramname">len</td><td>Length of buffer </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error code </dd></dl>
</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a552ccd9d8934001d1fcda2d1aeef9ca4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a552ccd9d8934001d1fcda2d1aeef9ca4">◆ </a></span>session_client_key</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string session_client_key</td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
| 46.487288 | 315 | 0.668854 |
2fcc04d3ab97a72c788dfae6b26b91f43b67779a | 421 | ps1 | PowerShell | File Associations/Change file associations to notepad.ps1 | ITChristos/ActiveDirectory | 982e9cfbbd5401f2792691604e3df9aeaae44089 | [
"MIT"
] | 1 | 2021-11-17T16:57:34.000Z | 2021-11-17T16:57:34.000Z | File Associations/Change file associations to notepad.ps1 | ITChristos/ActiveDirectory | 982e9cfbbd5401f2792691604e3df9aeaae44089 | [
"MIT"
] | null | null | null | File Associations/Change file associations to notepad.ps1 | ITChristos/ActiveDirectory | 982e9cfbbd5401f2792691604e3df9aeaae44089 | [
"MIT"
] | 1 | 2021-12-03T03:07:27.000Z | 2021-12-03T03:07:27.000Z | #Import AssociateFileExtensions Module to PowerShell
Import-Module C:\Scripts\AssociateFileExtensions.psm1 #Input path where you have stored the module
Get-Help AssociateFileExtensions
AssociateFileExtensions -FileExtensions .bat,.cmd,.hta,.js,.jse,.msh,.msh1,.msh2,.mshxml,.msh1xml,.msh2xml,.ps1,.ps1xml,.ps2,.ps2xml,.psc1,.psc2,.reg,.vb,.vba,.vbe,.vbs,.ws,.wsc,.wsf,.wsh -OpenAppPath "C:\Windows\System32\notepad.exe" | 84.2 | 234 | 0.783848 |
2a0dffc64886a6fd077950de7750dfda16952ffc | 2,213 | java | Java | src/main/java/me/shedaniel/rei/api/REIHelper.java | shartte/RoughlyEnoughItems | b8c5531beb234d7eff1138fa0c5dcc4bf1c87ea3 | [
"MIT"
] | null | null | null | src/main/java/me/shedaniel/rei/api/REIHelper.java | shartte/RoughlyEnoughItems | b8c5531beb234d7eff1138fa0c5dcc4bf1c87ea3 | [
"MIT"
] | null | null | null | src/main/java/me/shedaniel/rei/api/REIHelper.java | shartte/RoughlyEnoughItems | b8c5531beb234d7eff1138fa0c5dcc4bf1c87ea3 | [
"MIT"
] | null | null | null | /*
* This file is licensed under the MIT License, part of Roughly Enough Items.
* Copyright (c) 2018, 2019, 2020 shedaniel
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package me.shedaniel.rei.api;
import me.shedaniel.rei.api.widgets.Tooltip;
import me.shedaniel.rei.gui.widget.TextFieldWidget;
import me.shedaniel.rei.impl.ScreenHelper;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screen.ingame.ContainerScreen;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@Environment(EnvType.CLIENT)
public interface REIHelper {
/**
* @return the instance of {@link REIHelper}
*/
static REIHelper getInstance() {
return ScreenHelper.getInstance();
}
ContainerScreen<?> getPreviousContainerScreen();
@Deprecated
default ContainerScreen<?> getPreviousHandledScreen() {
return getPreviousContainerScreen();
}
boolean isDarkThemeEnabled();
TextFieldWidget getSearchTextField();
List<ItemStack> getInventoryStacks();
void queueTooltip(@Nullable Tooltip tooltip);
}
| 35.126984 | 81 | 0.744239 |
497ade6a68b0723da91feff0bc5e0ebc31b62a82 | 322 | swift | Swift | Sources/Intermodular/Extensions/SwiftUI/Axis++.swift | fr-/SwiftUIX | d02d877a982a4bb290b34917398bfbad0009fe65 | [
"MIT"
] | 4,624 | 2019-08-02T07:14:42.000Z | 2022-03-31T16:09:40.000Z | Sources/Intermodular/Extensions/SwiftUI/Axis++.swift | fr-/SwiftUIX | d02d877a982a4bb290b34917398bfbad0009fe65 | [
"MIT"
] | 301 | 2019-08-05T05:51:19.000Z | 2022-03-29T08:52:07.000Z | Sources/Intermodular/Extensions/SwiftUI/Axis++.swift | fr-/SwiftUIX | d02d877a982a4bb290b34917398bfbad0009fe65 | [
"MIT"
] | 358 | 2019-08-05T07:01:40.000Z | 2022-03-26T03:04:27.000Z | //
// Copyright (c) Vatsal Manot
//
import Swift
import SwiftUI
extension Axis {
/// The axis orthogonal to `self`.
public var orthogonal: Axis {
switch self {
case .horizontal:
return .vertical
case .vertical:
return .horizontal
}
}
}
| 16.947368 | 38 | 0.52795 |
e62aa51a4f3b65009e10de2eb1f40bc435671e80 | 2,709 | go | Go | pkg/packer2llb/packer2llb_test.go | EricHripko/pack.yaml | eca8a8d0d103a7490032ec61438d619f169bcafd | [
"Apache-2.0"
] | 1 | 2021-02-19T10:29:20.000Z | 2021-02-19T10:29:20.000Z | pkg/packer2llb/packer2llb_test.go | EricHripko/pack.yaml | eca8a8d0d103a7490032ec61438d619f169bcafd | [
"Apache-2.0"
] | 5 | 2021-02-20T11:25:30.000Z | 2021-05-18T18:54:19.000Z | pkg/packer2llb/packer2llb_test.go | EricHripko/pack.yaml | eca8a8d0d103a7490032ec61438d619f169bcafd | [
"Apache-2.0"
] | null | null | null | package packer2llb
import (
"context"
"errors"
"testing"
"github.com/EricHripko/pack.yaml/pkg/packer2llb/config"
packer2llb_mock "github.com/EricHripko/pack.yaml/pkg/packer2llb/mock"
cib_mock "github.com/EricHripko/buildkit-fdk/pkg/cib/mock"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
type pluginTestSuite struct {
suite.Suite
ctrl *gomock.Controller
ctx context.Context
build *cib_mock.MockService
plugin *packer2llb_mock.MockPlugin
}
func (suite *pluginTestSuite) SetupTest() {
suite.ctrl = gomock.NewController(suite.T())
suite.ctx = context.Background()
suite.build = cib_mock.NewMockService(suite.ctrl)
suite.plugin = packer2llb_mock.NewMockPlugin(suite.ctrl)
}
func (suite *pluginTestSuite) TearDownTest() {
suite.ctrl.Finish()
Clear()
}
func (suite *pluginTestSuite) TestRegister() {
// Act
Register(suite.plugin)
// Assert
require.Len(suite.T(), plugins, 1)
require.Same(suite.T(), suite.plugin, plugins[0])
}
func (suite *pluginTestSuite) TestDetectSrcFails() {
// Arrange
cfg := &config.Config{}
expected := errors.New("something went wrong")
suite.build.EXPECT().
Src().
Return(nil, expected)
// Act
_, actual := Detect(suite.ctx, suite.build, cfg)
// Assert
require.Same(suite.T(), expected, actual)
}
func (suite *pluginTestSuite) TestDetectFails() {
// Arrange
cfg := &config.Config{}
src := cib_mock.NewMockReference(suite.ctrl)
suite.build.EXPECT().
Src().
Return(src, nil)
Register(suite.plugin)
expected := errors.New("something went wrong")
suite.plugin.EXPECT().
Detect(suite.ctx, src, cfg).
Return(expected)
// Act
_, actual := Detect(suite.ctx, suite.build, cfg)
// Assert
require.Same(suite.T(), expected, actual)
}
func (suite *pluginTestSuite) TestDetectNotFound() {
// Arrange
cfg := &config.Config{}
src := cib_mock.NewMockReference(suite.ctrl)
suite.build.EXPECT().
Src().
Return(src, nil)
Register(suite.plugin)
suite.plugin.EXPECT().
Detect(suite.ctx, src, cfg).
Return(nil)
// Act
plugin, err := Detect(suite.ctx, suite.build, cfg)
// Assert
require.Nil(suite.T(), err)
require.Nil(suite.T(), plugin)
}
func (suite *pluginTestSuite) TestDetectSucceeds() {
// Arrange
cfg := &config.Config{}
src := cib_mock.NewMockReference(suite.ctrl)
suite.build.EXPECT().
Src().
Return(src, nil)
Register(suite.plugin)
suite.plugin.EXPECT().
Detect(suite.ctx, src, cfg).
Return(ErrActivate)
// Act
plugin, err := Detect(suite.ctx, suite.build, cfg)
// Assert
require.Nil(suite.T(), err)
require.Same(suite.T(), suite.plugin, plugin)
}
func TestPlugin(t *testing.T) {
suite.Run(t, new(pluginTestSuite))
}
| 21.672 | 70 | 0.708379 |
39dd0ce7f83a60d39552393b16c85f0fbecc744e | 1,437 | java | Java | node_modules/appium/node_modules/appium-espresso-driver/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/FindElements.java | aspireias-ins/CodebaseAppIOS | 045fe55945fa7ba7e10a0b154464edbe8bafe643 | [
"Apache-2.0"
] | null | null | null | node_modules/appium/node_modules/appium-espresso-driver/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/FindElements.java | aspireias-ins/CodebaseAppIOS | 045fe55945fa7ba7e10a0b154464edbe8bafe643 | [
"Apache-2.0"
] | 1 | 2019-10-22T02:45:09.000Z | 2019-10-22T02:45:09.000Z | node_modules/appium/node_modules/appium-espresso-driver/espresso-server/app/src/androidTest/java/io/appium/espressoserver/lib/handlers/FindElements.java | aspireias-ins/CodebaseAppIOS | 045fe55945fa7ba7e10a0b154464edbe8bafe643 | [
"Apache-2.0"
] | null | null | null | package io.appium.espressoserver.lib.handlers;
import android.support.test.espresso.ViewInteraction;
import java.util.ArrayList;
import java.util.List;
import io.appium.espressoserver.lib.handlers.exceptions.AppiumException;
import io.appium.espressoserver.lib.handlers.exceptions.InvalidStrategyException;
import io.appium.espressoserver.lib.handlers.exceptions.MissingCommandsException;
import io.appium.espressoserver.lib.model.Element;
import io.appium.espressoserver.lib.model.Locator;
import static io.appium.espressoserver.lib.helpers.ViewFinder.findAllBy;
public class FindElements implements RequestHandler<Locator, List<Element>> {
@Override
public List<Element> handle(Locator locator) throws AppiumException {
if (locator.getUsing() == null) {
throw new InvalidStrategyException("Locator strategy cannot be empty");
} else if (locator.getValue() == null) {
throw new MissingCommandsException("No locator provided");
}
// Get the viewInteractions
List<ViewInteraction> viewInteractions = findAllBy(locator.getUsing(), locator.getValue());
// Turn it into a list of elements
List<Element> elements = new ArrayList<>();
for(ViewInteraction viewInteraction : viewInteractions) {
elements.add(new Element(viewInteraction));
}
// If we have a match, return success
return elements;
}
}
| 36.846154 | 99 | 0.731385 |
a426e1fa4cbd80d54f1ac9c30b343c0987175b13 | 568 | asm | Assembly | programs/oeis/015/A015613.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/015/A015613.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/015/A015613.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A015613: a(n) = Sum_{i=1..n} phi(i) * (ceiling(n/i) - floor(n/i)).
; 0,0,1,2,5,6,11,14,19,22,31,34,45,50,57,64,79,84,101,108,119,128,149,156,175,186,203,214,241,248,277,292,311,326,349,360,395,412,435,450,489,500,541,560,583,604,649,664,705,724,755,778,829,846,885,908,943,970,1027,1042,1101,1130,1165,1196,1243,1262,1327,1358,1401,1424,1493,1516,1587,1622,1661,1696,1755,1778,1855,1886,1939,1978,2059,2082,2145,2186,2241,2280,2367,2390,2461,2504,2563,2608,2679,2710,2805,2846,2905,2944
sub $1,$0
seq $0,15614 ; a(n) = -1 + Sum_{i=1..n} phi(i).
add $1,$0
mov $0,$1
| 71 | 419 | 0.690141 |
3399b2bf960ae58649c9c5788d750a4e0ff0b034 | 446 | sql | SQL | database/world/world_spells_effects_fix.sql | Daymortel/Stump | 52ef6d4d565467f117fbd92b2827041d97044180 | [
"Apache-2.0"
] | null | null | null | database/world/world_spells_effects_fix.sql | Daymortel/Stump | 52ef6d4d565467f117fbd92b2827041d97044180 | [
"Apache-2.0"
] | null | null | null | database/world/world_spells_effects_fix.sql | Daymortel/Stump | 52ef6d4d565467f117fbd92b2827041d97044180 | [
"Apache-2.0"
] | null | null | null | create table spells_effects_fix
(
Id int auto_increment
primary key,
SpellId int null,
SpellLevelId int null,
EffectId int null,
EffectIndex int null,
TriggerBuffDuration int null,
Dispellable int null,
ActionId int null,
ClientEffectId int null,
Priority int null
)
engine = MyISAM
charset = utf8;
| 24.777778 | 42 | 0.542601 |
506e63ab75244c2e3f96708e008b61e8de420df2 | 604 | html | HTML | HTML/R/262.html | cocoatomo/Python3.2_C_API_Tutorial | e33d4a285429935aca3178dc2a97aca3ab484232 | [
"PSF-2.0"
] | 2 | 2019-03-03T00:04:36.000Z | 2020-10-06T16:22:38.000Z | HTML/R/262.html | cocoatomo/Python3.2_C_API_Tutorial | e33d4a285429935aca3178dc2a97aca3ab484232 | [
"PSF-2.0"
] | null | null | null | HTML/R/262.html | cocoatomo/Python3.2_C_API_Tutorial | e33d4a285429935aca3178dc2a97aca3ab484232 | [
"PSF-2.0"
] | 1 | 2019-03-03T00:04:38.000Z | 2019-03-03T00:04:38.000Z | <html>
<head>
<title>BIT2BYTE</title>
<meta name='robots' content='noindex,nofollow'>
<meta name='generator' content='GLOBAL-5.8.1'>
</head>
<body text='#191970' bgcolor='#f5f5dc' vlink='gray'>
<pre>
<a href='../S/502.html#L16'>BIT2BYTE</a> 16 Include/bitset.h #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
<a href='../S/2834.html#L31'>BIT2BYTE</a> 31 Parser/bitset.c int ibyte = BIT2BYTE(ibit);
<a href='../S/2834.html#L44'>BIT2BYTE</a> 44 Parser/bitset.c return (ss[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0;
</pre>
</body>
</html>
| 40.266667 | 147 | 0.624172 |
c71fdab351600301a24c611715f745d487a2c4b9 | 3,258 | swift | Swift | SwiftyCryptoDisco/View Controllers/AddCoinTableViewController.swift | schmidyy/SwiftyCryptoDisco | 04330cea11f2b3e2194195c03be024d170d2e145 | [
"MIT"
] | 12 | 2018-01-03T21:41:01.000Z | 2021-06-20T16:13:29.000Z | SwiftyCryptoDisco/View Controllers/AddCoinTableViewController.swift | schmidyy/SwiftyCryptoDisco | 04330cea11f2b3e2194195c03be024d170d2e145 | [
"MIT"
] | null | null | null | SwiftyCryptoDisco/View Controllers/AddCoinTableViewController.swift | schmidyy/SwiftyCryptoDisco | 04330cea11f2b3e2194195c03be024d170d2e145 | [
"MIT"
] | 1 | 2018-07-31T19:48:00.000Z | 2018-07-31T19:48:00.000Z |
//
// AddCoinTableViewController.swift
// SwiftyCryptoDisco
//
// Created by Mat Schmid on 2017-12-24.
// Copyright © 2017 Mat Schmid. All rights reserved.
//
import UIKit
protocol AddCoinDelegate {
func didTapCoinWithID(id: String)
}
class AddCoinTableViewController: UITableViewController, UISearchBarDelegate {
let kCoinCellReuseIdentifier = "CoinCell"
var delegate : AddCoinDelegate?
var coins: [Currency]?
var filteredCoins : [Currency]?
let activityIndicator = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge)
@IBOutlet weak var currencySearchBar: UISearchBar!
var isSearching = false
override func viewDidLoad() {
super.viewDidLoad()
activityIndicator.hidesWhenStopped = true
activityIndicator.center = CGPoint(x: tableView.frame.width / 2, y: tableView.frame.height / 2 - 56)
self.view.addSubview(activityIndicator)
self.activityIndicator.startAnimating()
currencySearchBar.delegate = self
let dataFetcher = CurrencyDataFetcher()
dataFetcher.getDataForAllCurencies { (coinArray) in
guard let coinArray = coinArray else {
return
}
let sortedCoins = coinArray.sorted { $0.name < $1.name }
self.coins = sortedCoins
self.activityIndicator.stopAnimating()
self.tableView.reloadData()
}
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if coins != nil {
return (isSearching) ? (filteredCoins?.count)! : (coins?.count)!
} else {
return 0
}
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 66
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCell(withIdentifier: kCoinCellReuseIdentifier, for: indexPath) as! CoinTableViewCell
cell.formatCellFor(coin: (isSearching) ? filteredCoins![indexPath.row] : coins![indexPath.row])
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let coin = isSearching ? filteredCoins![indexPath.row] : coins![indexPath.row]
delegate?.didTapCoinWithID(id: coin.id)
navigationController?.popToRootViewController(animated: true)
}
// MARK: - Search Bar Delegate
func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
if (currencySearchBar.text?.isEmpty)! {
isSearching = false
view.endEditing(true)
tableView.reloadData()
} else {
isSearching = true
filteredCoins = coins?.filter({ $0.name.lowercased().range(of: currencySearchBar.text!.lowercased()) != nil })
tableView.reloadData()
}
}
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
view.endEditing(true)
}
}
| 34.294737 | 133 | 0.65531 |
a297515e2af1119bbcfba4d87fe0ba707a2e582b | 1,098 | dart | Dart | midterm/lib/favorite.dart | SilverJun/MobileAppDevelopment | 72fbe85d2fc1501d3048f912fcf7528c6ac72eee | [
"MIT"
] | null | null | null | midterm/lib/favorite.dart | SilverJun/MobileAppDevelopment | 72fbe85d2fc1501d3048f912fcf7528c6ac72eee | [
"MIT"
] | null | null | null | midterm/lib/favorite.dart | SilverJun/MobileAppDevelopment | 72fbe85d2fc1501d3048f912fcf7528c6ac72eee | [
"MIT"
] | null | null | null |
import 'package:flutter/material.dart';
import 'package:midterm/HotelInfo.dart';
class FavoritePage extends StatefulWidget {
@override
State<StatefulWidget> createState() => FavoritePageState();
}
class FavoritePageState extends State<FavoritePage> {
final items = favoriteList.toList();
@override
Widget build(BuildContext context) {
final Iterable<Dismissible> tiles = favoriteList.map((Hotel hotel) {
return Dismissible(
key: Key(hotel.name),
onDismissed: (direction) {
setState(() {
items.remove(hotel);
});
favoriteList.remove(hotel);
},
background: Container(color: Colors.red),
child: ListTile(
title: Text(
hotel.name,
style: TextStyle(fontWeight: FontWeight.bold),
),
),
);
});
final List<Widget> divided = ListTile.divideTiles(
context: context,
tiles: tiles,
).toList();
return Scaffold(
appBar: AppBar(title: Text('Favorite'),),
body: ListView(children: divided)
);
}
} | 24.4 | 72 | 0.606557 |
6b472ee28bff1a4a99859b15d88e36d3483a76de | 1,064 | html | HTML | manuscript/page-125/body.html | marvindanig/under-the-big-dipper | 71f1a3f0ddbf2fa3a3775223eb3bfaaf8f0bc271 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | manuscript/page-125/body.html | marvindanig/under-the-big-dipper | 71f1a3f0ddbf2fa3a3775223eb3bfaaf8f0bc271 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | manuscript/page-125/body.html | marvindanig/under-the-big-dipper | 71f1a3f0ddbf2fa3a3775223eb3bfaaf8f0bc271 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | <div class="leaf flex"><div class="inner justify"><p class="no-indent stretch-last-line ">highly gifted population descended from peoples who have lived under liberal laws for many generations, inhabiting a virtually virgin land of great resources, without a history of oppression to live down—you are capable of existing and prospering under a democracy. Believe me, my dear sir, Roumelia never could and never will survive under a similar form of government. The novelty may appeal to them, the delusion of a new kind of freedom may delude them, but the people are not educated for it, they are not ready for it. They need the pomp of a court, the strong personality of an acknowledged ruler to temper demagogue ambitions and to curb the desire of the common mind to become enriched at the expense of the country. There must be some one who is above bribery, who will not be swayed by selfish motives but who has the public welfare at heart—such a man can only be the king. His position is God’s gift; and he is responsible to his Maker alone! A</p></div> </div> | 1,064 | 1,064 | 0.789474 |
0bd8edb0725fe9ebf8b412cc5ec1d253b77a6658 | 13,345 | sql | SQL | siperpusDB.sql | JustYourDream/siperpus | 60cbbdd4366fb584252ae54435d0da8a788c350f | [
"MIT"
] | null | null | null | siperpusDB.sql | JustYourDream/siperpus | 60cbbdd4366fb584252ae54435d0da8a788c350f | [
"MIT"
] | null | null | null | siperpusDB.sql | JustYourDream/siperpus | 60cbbdd4366fb584252ae54435d0da8a788c350f | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 17, 2021 at 05:19 PM
-- Server version: 10.4.18-MariaDB
-- PHP Version: 7.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `siperpus`
--
CREATE DATABASE IF NOT EXISTS `siperpus` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `siperpus`;
-- --------------------------------------------------------
--
-- Table structure for table `data_anggota`
--
CREATE TABLE `data_anggota` (
`no_anggota` varchar(25) NOT NULL,
`nama_anggota` varchar(35) NOT NULL,
`tempat_lahir` varchar(25) NOT NULL,
`tanggal_lahir` date NOT NULL,
`jurusan_anggota` varchar(50) NOT NULL,
`alamat_anggota` varchar(50) NOT NULL,
`agama_anggota` varchar(20) NOT NULL,
`jkel_anggota` varchar(15) NOT NULL,
`foto_anggota` varchar(255) NOT NULL,
`qr_anggota` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `data_anggota`
--
INSERT INTO `data_anggota` (`no_anggota`, `nama_anggota`, `tempat_lahir`, `tanggal_lahir`, `jurusan_anggota`, `alamat_anggota`, `agama_anggota`, `jkel_anggota`, `foto_anggota`, `qr_anggota`) VALUES
('20202001', 'Alfian Maol', 'Pemalang', '2000-08-28', 'Teknik Komputer dan Jaringan', 'Jl. KH Makmur No. 27', 'Islam', 'Laki-laki', '20202001-PIC-59', '20202001-QR.png'),
('20202002', 'Sasha Brauss', 'Paradise', '2000-02-12', 'Tata Busana', 'Shigashina District', 'Katolik', 'Perempuan', '20202002-PIC-01', '20202002-QR.png'),
('20202003', 'Mikasa Ackerman', 'Paradise', '2000-01-20', 'Desain Pemodelan dan Informasi Bangunan', 'Shigashina District', 'Kristen Protestan', 'Perempuan', '20202003-PIC-27', '20202003-QR.png'),
('20202004', 'Alan Walker', 'California', '1998-12-22', 'Teknik Kendaraan Ringan Otomotif', 'Sillicon Valley', 'Kristen Protestan', 'Laki-laki', '20202004-PIC-51', '20202004-QR.png'),
('20202005', 'Breel Embolo', 'Swisse', '2000-02-28', 'Teknik Elektronika Industri', 'Switzerland', 'Katolik', 'Laki-laki', 'MALE-PIC', '20202005-QR.png');
-- --------------------------------------------------------
--
-- Table structure for table `data_buku`
--
CREATE TABLE `data_buku` (
`no_induk` int(11) NOT NULL,
`isbn` varchar(20) NOT NULL,
`judul_buku` varchar(100) NOT NULL,
`pengarang_buku` varchar(30) NOT NULL,
`kota_dibuat` varchar(20) NOT NULL,
`penerbit_buku` varchar(30) NOT NULL,
`tahun_buku` year(4) NOT NULL,
`eksemplar_buku` int(11) NOT NULL,
`no_rak` varchar(10) NOT NULL,
`kategori_buku` varchar(40) NOT NULL,
`qr_code` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `data_buku`
--
INSERT INTO `data_buku` (`no_induk`, `isbn`, `judul_buku`, `pengarang_buku`, `kota_dibuat`, `penerbit_buku`, `tahun_buku`, `eksemplar_buku`, `no_rak`, `kategori_buku`, `qr_code`) VALUES
(5491, '21212121200', 'Codeigniter 4', 'Effendy', 'Yogyakarta', 'Alex Komputindo', 2021, 15, '6', 'Teknologi & Ilmu Terapan', '5491-QR.png'),
(5492, '282828939019', 'Sistem Informasi', 'Effendy', 'Bandung', 'Sinar Plus', 2020, 10, '6', 'Teknologi & Ilmu Terapan', '5492-QR.png'),
(5493, '282828939012', 'Belajar Javascript', 'Linus Torvalds', 'Sillicon Valley', 'New York Times', 2019, 5, '2', 'Teknologi & Ilmu Terapan', '5493-QR.png'),
(5494, '280820026922', 'Belajar Aritmatika', 'Seto Mulyadi', 'Banyuwangi', 'Gramedia', 2019, 4, '1', 'Ilmu-ilmu & Matematika', '5494-QR.png'),
(5495, '202020098482', 'Java Programming', 'Linus', 'Nevada', 'EA Sports', 2020, 4, '3', 'Teknologi & Ilmu Terapan', '5495-QR.png');
--
-- Triggers `data_buku`
--
DELIMITER $$
CREATE TRIGGER `delete_buku` AFTER DELETE ON `data_buku` FOR EACH ROW DELETE FROM insert_buku WHERE no_induk = old.no_induk
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `insert_buku` AFTER INSERT ON `data_buku` FOR EACH ROW INSERT INTO insert_buku SET no_induk = new.no_induk, judul_buku = new.judul_buku, eksemplar_buku = new.eksemplar_buku, kategori_buku = new.kategori_buku, tanggal_insert = now()
$$
DELIMITER ;
DELIMITER $$
CREATE TRIGGER `update_buku` AFTER UPDATE ON `data_buku` FOR EACH ROW UPDATE insert_buku SET judul_buku = new.judul_buku, kategori_buku = new.kategori_buku, eksemplar_buku = new.eksemplar_buku WHERE no_induk = old.no_induk
$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `data_ebook`
--
CREATE TABLE `data_ebook` (
`id_ebook` varchar(10) NOT NULL,
`judul_ebook` varchar(50) NOT NULL,
`pengarang` varchar(40) NOT NULL,
`penerbit` varchar(35) NOT NULL,
`kategori_ebook` varchar(30) NOT NULL,
`cover_ebook` varchar(25) NOT NULL,
`file_ebook` varchar(25) NOT NULL,
`qr_ebook` varchar(25) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `data_ebook`
--
INSERT INTO `data_ebook` (`id_ebook`, `judul_ebook`, `pengarang`, `penerbit`, `kategori_ebook`, `cover_ebook`, `file_ebook`, `qr_ebook`) VALUES
('EB00001', 'PHP : The Right Way', 'Josh Lockchart & Phil Sturgeon', 'Leanpub', 'Teknologi & Ilmu Terapan', 'EB00001-Cover', 'EB00001-Ebook.pdf', 'EB00001-QR.png'),
('EB00002', 'Apalagi Islam Itu Kalau Bukan Cinta', 'Husein Ja\'far Al-Hadar', 'Gerakan Islam Cinta', 'Agama', 'EB00002-Cover', 'EB00002-Ebook.pdf', 'EB00002-QR.png'),
('EB00003', 'Sebuah Seni Untuk Bersikap Bodo Amat', 'Mark Manson', 'Gramedia', 'Ilmu Sosial', 'EB00003-Cover', 'EB00003-Ebook.pdf', 'EB00003-QR.png');
-- --------------------------------------------------------
--
-- Table structure for table `data_peminjaman`
--
CREATE TABLE `data_peminjaman` (
`id_peminjaman` varchar(10) NOT NULL,
`tanggal_pinjam` date NOT NULL,
`tanggal_kembali` date NOT NULL,
`id_buku` int(11) NOT NULL,
`jml_pinjam` int(11) NOT NULL,
`no_anggota` varchar(25) NOT NULL,
`status` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `data_peminjaman`
--
INSERT INTO `data_peminjaman` (`id_peminjaman`, `tanggal_pinjam`, `tanggal_kembali`, `id_buku`, `jml_pinjam`, `no_anggota`, `status`) VALUES
('PJ00001', '2021-04-03', '2021-04-07', 5491, 1, '20202001', 'Dikembalikan'),
('PJ00002', '2021-04-14', '2021-04-17', 5492, 1, '20202002', 'Dikembalikan'),
('PJ00003', '2021-04-14', '2021-04-21', 5493, 1, '20202001', 'Dikembalikan'),
('PJ00004', '2021-04-18', '2021-04-21', 5493, 1, '20202003', 'Dikembalikan'),
('PJ00005', '2021-05-01', '2021-05-07', 5492, 1, '20202002', 'Dikembalikan'),
('PJ00006', '2021-06-15', '2021-06-18', 5495, 1, '20202003', 'Dipinjam'),
('PJ00007', '2021-06-15', '2021-06-18', 5494, 1, '20202001', 'Dipinjam');
-- --------------------------------------------------------
--
-- Table structure for table `data_pengembalian`
--
CREATE TABLE `data_pengembalian` (
`id_peminjaman` varchar(10) NOT NULL,
`tanggal_pinjam` date NOT NULL,
`tanggal_kembali` date NOT NULL,
`no_anggota` varchar(25) NOT NULL,
`tgl_dikembalikan` date NOT NULL,
`denda` int(11) NOT NULL,
`status_pembayaran` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `data_pengembalian`
--
INSERT INTO `data_pengembalian` (`id_peminjaman`, `tanggal_pinjam`, `tanggal_kembali`, `no_anggota`, `tgl_dikembalikan`, `denda`, `status_pembayaran`) VALUES
('PJ00001', '2021-04-03', '2021-04-07', '20202001', '2021-04-10', 1500, 'Dibayar'),
('PJ00002', '2021-04-14', '2021-04-17', '20202002', '2021-04-14', 0, 'Tidak Ada'),
('PJ00003', '2021-04-14', '2021-04-21', '20202001', '2021-04-18', 0, 'Tidak Ada'),
('PJ00004', '2021-04-18', '2021-04-21', '20202003', '2021-04-26', 2500, 'Dibayar'),
('PJ00005', '2021-05-01', '2021-05-07', '20202002', '2021-05-30', 11500, 'Dibayar');
-- --------------------------------------------------------
--
-- Table structure for table `data_pengunjung`
--
CREATE TABLE `data_pengunjung` (
`no` int(11) NOT NULL,
`no_anggota` varchar(25) NOT NULL,
`nama` varchar(35) NOT NULL,
`jurusan_anggota` varchar(50) NOT NULL,
`tanggal_kunjungan` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `data_pengunjung`
--
INSERT INTO `data_pengunjung` (`no`, `no_anggota`, `nama`, `jurusan_anggota`, `tanggal_kunjungan`) VALUES
(1, '20202001', 'Alfian Maol', 'Teknik Komputer dan Jaringan', '2021-04-18'),
(2, '20202002', 'Sasha Brauss', 'Tata Busana', '2021-04-18'),
(3, '20202003', 'Mikasa Ackerman', 'Desain Pemodelan dan Informasi Bangunan', '2021-04-18'),
(4, '20202004', 'Alan Walker', 'Teknik Kendaraan Ringan Otomotif', '2021-04-18'),
(5, '20202003', 'Mikasa Ackerman', 'Desain Pemodelan dan Informasi Bangunan', '2021-04-18'),
(6, '20202003', 'Mikasa Ackerman', 'Desain Pemodelan dan Informasi Bangunan', '2021-04-30'),
(7, '20202002', 'Sasha Brauss', 'Tata Busana', '2021-04-30'),
(8, '20202001', 'Alfian Maol', 'Teknik Komputer dan Jaringan', '2021-05-03');
-- --------------------------------------------------------
--
-- Table structure for table `insert_buku`
--
CREATE TABLE `insert_buku` (
`no_induk` int(11) NOT NULL,
`judul_buku` varchar(100) NOT NULL,
`kategori_buku` varchar(40) NOT NULL,
`eksemplar_buku` int(11) NOT NULL,
`tanggal_insert` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `insert_buku`
--
INSERT INTO `insert_buku` (`no_induk`, `judul_buku`, `kategori_buku`, `eksemplar_buku`, `tanggal_insert`) VALUES
(5491, 'Codeigniter 4', 'Teknologi & Ilmu Terapan', 15, '2021-03-31 16:37:57'),
(5492, 'Sistem Informasi', 'Teknologi & Ilmu Terapan', 10, '2021-04-03 23:23:57'),
(5493, 'Belajar Javascript', 'Teknologi & Ilmu Terapan', 5, '2021-04-13 23:27:28'),
(5494, 'Belajar Aritmatika', 'Ilmu-ilmu & Matematika', 4, '2021-04-17 23:01:07'),
(5495, 'Java Programming', 'Teknologi & Ilmu Terapan', 4, '2021-05-01 16:32:28');
-- --------------------------------------------------------
--
-- Table structure for table `pengguna`
--
CREATE TABLE `pengguna` (
`no` int(11) NOT NULL,
`nama` varchar(35) NOT NULL,
`role` varchar(10) NOT NULL,
`id` varchar(25) NOT NULL,
`password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `pengguna`
--
INSERT INTO `pengguna` (`no`, `nama`, `role`, `id`, `password`) VALUES
(1, 'Eren Yeager', 'Petugas', '26092000', '25d55ad283aa400af464c76d713c07ad'),
(2, 'Berthold Hoover', 'Petugas', '28082000', '25d55ad283aa400af464c76d713c07ad'),
(11, 'Alfian Maol', 'Anggota', '20202001', '25d55ad283aa400af464c76d713c07ad'),
(12, 'Sasha Brauss', 'Anggota', '20202002', '25d55ad283aa400af464c76d713c07ad'),
(18, 'Mikasa Ackerman', 'Anggota', '20202003', '25d55ad283aa400af464c76d713c07ad'),
(19, 'Alan Walker', 'Anggota', '20202004', '25d55ad283aa400af464c76d713c07ad'),
(20, 'Breel Embolo', 'Anggota', '20202005', '25d55ad283aa400af464c76d713c07ad');
-- --------------------------------------------------------
--
-- Table structure for table `petugas`
--
CREATE TABLE `petugas` (
`id_petugas` varchar(25) NOT NULL,
`nama_petugas` varchar(40) NOT NULL,
`jabatan_petugas` varchar(25) NOT NULL,
`no_telp_petugas` char(14) NOT NULL,
`alamat_petugas` varchar(50) NOT NULL,
`foto_petugas` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `petugas`
--
INSERT INTO `petugas` (`id_petugas`, `nama_petugas`, `jabatan_petugas`, `no_telp_petugas`, `alamat_petugas`, `foto_petugas`) VALUES
('26092000', 'Eren Yeager', 'Petugas', '085156506725', 'Jl. Shigashina No. 20 Paradise', '26092000-PIC-05'),
('28082000', 'Berthold Hoover', 'Petugas', '0811281794', 'Jl. Liberio No.3 Marley', '28082000-PIC-20');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `data_anggota`
--
ALTER TABLE `data_anggota`
ADD PRIMARY KEY (`no_anggota`);
--
-- Indexes for table `data_buku`
--
ALTER TABLE `data_buku`
ADD PRIMARY KEY (`no_induk`);
--
-- Indexes for table `data_ebook`
--
ALTER TABLE `data_ebook`
ADD PRIMARY KEY (`id_ebook`);
--
-- Indexes for table `data_peminjaman`
--
ALTER TABLE `data_peminjaman`
ADD PRIMARY KEY (`id_peminjaman`);
--
-- Indexes for table `data_pengembalian`
--
ALTER TABLE `data_pengembalian`
ADD PRIMARY KEY (`id_peminjaman`);
--
-- Indexes for table `data_pengunjung`
--
ALTER TABLE `data_pengunjung`
ADD PRIMARY KEY (`no`);
--
-- Indexes for table `insert_buku`
--
ALTER TABLE `insert_buku`
ADD PRIMARY KEY (`no_induk`);
--
-- Indexes for table `pengguna`
--
ALTER TABLE `pengguna`
ADD PRIMARY KEY (`no`);
--
-- Indexes for table `petugas`
--
ALTER TABLE `petugas`
ADD PRIMARY KEY (`id_petugas`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `data_pengunjung`
--
ALTER TABLE `data_pengunjung`
MODIFY `no` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=34;
--
-- AUTO_INCREMENT for table `pengguna`
--
ALTER TABLE `pengguna`
MODIFY `no` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 36.461749 | 246 | 0.671862 |
a095f7a602c361ee41f42432cd7c34c3f4989a82 | 589 | asm | Assembly | oeis/027/A027794.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/027/A027794.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/027/A027794.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A027794: a(n) = 12*(n+1)*C(n+3,9).
; 84,960,5940,26400,94380,288288,780780,1921920,4375800,9335040,18845112,36279360,67016040,119380800,205931880,345181056,563861100,899870400,1406047500,2154952800,3244861620,4807202400,7015706100,10097568000,14346961200,20141282304,27960554160,38410458240,52249520400,70421028480,94090318608,124688129280,163960788420,214028068800,277449621540,357300976032,457260177660,581706222240,735830538300,925762865280,1158712977576,1443129811200,1788879661800,2207445240000,2712147492600,3318392226240
mov $1,$0
add $0,9
bin $0,$1
add $1,7
mul $0,$1
mul $0,12
| 58.9 | 492 | 0.837012 |
9066a6fa5b6c16a19b4190b88ec90f81e3ece57d | 36,366 | py | Python | gigpower/src/gigpower/solution_nr3.py | elaguerta/gigpower | 22e0a6152fa8d7a04f6067f3d500bfee042a98f9 | [
"Unlicense"
] | null | null | null | gigpower/src/gigpower/solution_nr3.py | elaguerta/gigpower | 22e0a6152fa8d7a04f6067f3d500bfee042a98f9 | [
"Unlicense"
] | 4 | 2021-06-15T16:50:13.000Z | 2021-06-15T16:53:23.000Z | gigpower/src/gigpower/solution_nr3.py | msankur/gigpower | 22e0a6152fa8d7a04f6067f3d500bfee042a98f9 | [
"Unlicense"
] | null | null | null | # Elaine Laguerta (github: @elaguerta)
# LBNL GIG
# File created: 19 February 2021
# Create NR3 Solution class, a namespace for calculations used by nr3
from . solution import Solution
from . circuit import Circuit
import numpy as np
from . nr3_lib.compute_NR3FT import compute_NR3FT
from . nr3_lib.compute_NR3JT import compute_NR3JT
from . nr3_lib.map_output import map_output
class SolutionNR3(Solution):
CONVERGENCE_TOLERANCE = 10**-6
@classmethod
def set_zip_values(cls, zip_v):
"""
sets zip values for the Solution class
param zip_V: List or nd.array with 7 values
[a_z_p, a_i_p, a_pq_p, a_z_q, a_i_q, a_pq_q, min voltage pu]
Note that zip values are set both on the Solution class and Circuit
class
"""
Solution.set_zip_values(zip_v)
def __init__(self, dss_fp: str, **kwargs):
super().__init__(dss_fp, **kwargs) # sets self.circuit
self._set_orient('cols')
self._init_XNR()
self._init_slack_bus_matrices()
self._init_KVL_matrices()
self._init_KCL_matrices()
self._init_KVL_matrices_vregs()
def _init_XNR(self):
"""
adapted from
https://github.com/msankur/LinDist3Flow/blob/vectorized/20180601/PYTHON/lib/basematrices.py
written by @kathleenchang
"""
V0, I0 = None, None
Vslack = self.__class__.VSLACK
nline = self.circuit.lines.num_elements
nnode = self.circuit.buses.num_elements
tf_lines = self.circuit.transformers.get_num_lines_x_ph()
vr_lines = self.circuit.voltage_regulators.get_num_lines_x_ph()
# XNR order is bus voltages, line currents, transformer line currents,
# voltage regulator line currents * 2
XNR = np.zeros((2*3*(nnode + nline) + 2*tf_lines + 2*2*vr_lines, 1),
dtype=float)
# intialize node voltage portion of XNR
if V0 is None or len(V0) == 0:
for ph in range(3):
for k1 in range(nnode):
XNR[2*ph*nnode + 2*k1] = Vslack[ph].real
XNR[2*ph*nnode + 2*k1+1] = Vslack[ph].imag
# If initial V is given (usually from CVX)
elif len(V0) != 0:
for ph in range(3):
for k1 in range(nnode):
XNR[2*ph*nnode + 2*k1] = V0[ph, k1].real
XNR[2*ph*nnode + 2*k1+1] = V0[ph, k1].imag
# intialize line current portion of XNR
if I0 is None or len(I0) == 0:
XNR[(2*3*nnode):] = 0.0*np.ones((6*nline + 2*tf_lines + 2*2* vr_lines, 1), dtype = float)
# If initial I is given
elif len(I0) != 0:
for ph in range(3):
for k1 in range(nline):
XNR[(2*3*nnode) + 2*ph*nline + 2*k1] = I0[ph, k1].real
XNR[(2*3*nnode) + 2*ph*nline + 2*k1+1] = I0[ph, k1].imag
XNR[(2*3*nnode + 2*3*nline):] = np.zeros((len(XNR) - 2*3*nnode - 2*3*nline), 1)
self.XNR = XNR
def _init_slack_bus_matrices(self):
"""
Initializes g_SB and b_SB
adapted from
https://github.com/msankur/LinDist3Flow/blob/vectorized/20180601/PYTHON/lib/basematrices.py
written by @kathleenchang
"""
tf_lines = self.circuit.transformers.get_num_lines_x_ph()
vr_lines = self.circuit.voltage_regulators.get_num_lines_x_ph()
nline = self.circuit.lines.num_elements
nnode = self.circuit.buses.num_elements
Vslack = self.__class__.VSLACK
# ------------ Slack Bus ------------------
self.g_SB = np.zeros((6, 2*3*(nnode+nline) + 2*tf_lines + 2*2*vr_lines),
dtype=float)
sb_idx = [0, 1, 2*nnode, (2*nnode)+1, 4*nnode, (4*nnode)+1]
for i in range(len(sb_idx)):
self.g_SB[i, sb_idx[i]] = 1
self.b_SB = np.zeros((6, 1), dtype=float)
for i in range(3):
self.b_SB[2*i, 0] = Vslack[i].real
self.b_SB[(2*i) + 1] = Vslack[i].imag
def _init_KVL_matrices(self):
"""
set self.b_KVL and self.G_KVL
copied from
https://github.com/msankur/LinDist3Flow/blob/vectorized/20180601/PYTHON/lib/compute_SBKVL_matrices.py
written by @kathleenchang
"""
tf_bus = self.circuit.transformers.get_bus_ph_matrix()
tf_lines = self.circuit.transformers.get_num_lines_x_ph()
vr_lines = self.circuit.voltage_regulators.get_num_lines_x_ph()
nline = self.circuit.lines.num_elements
nnode = self.circuit.buses.num_elements
X_matrix = self.circuit.lines.get_X_matrix()
R_matrix = self.circuit.lines.get_R_matrix()
# ------- Residuals for KVL across line (m,n) ----------
self.b_KVL = np.zeros((2*3*(nline) + 2*tf_lines + 2*2*vr_lines, 1),
dtype=float)
G_KVL = np.zeros((2*3*(nline) + 2*tf_lines + 2*2*vr_lines,
2*3*(nnode+nline) + 2*tf_lines + 2*2*vr_lines),
dtype=float)
for ph in range(3):
for line in range(nline): # line = line index
line_ele = self.circuit.lines.get_element(line)
bus1_idx = self.circuit.buses.get_idx(line_ele.tx)
bus2_idx = self.circuit.buses.get_idx(line_ele.rx)
bus1_phases = line_ele.phase_matrix
if bus1_phases[ph] == 1:
G_KVL[2*ph*nline + 2*line][2*(nnode)*ph + 2*(bus1_idx)] = 1 #A_m
G_KVL[2*ph*nline + 2*line][2*(nnode)*ph + 2*(bus2_idx)] = -1 #A_n
G_KVL[2*ph*nline + 2*line+1][2*(nnode)*ph + 2*(bus1_idx) + 1] = 1 #B_m
G_KVL[2*ph*nline + 2*line+1][2*(nnode)*ph + 2*(bus2_idx) + 1] = -1 #B_n
G_KVL[2*ph*nline + 2*line][2*3*(nnode) + 2*line] = -R_matrix[line][ph*3] * bus1_phases[0] #C_mn for a
G_KVL[2*ph*nline + 2*line][2*3*(nnode) + 2*line + 1] = X_matrix[line][ph*3] * bus1_phases[0] #D_mn for a
G_KVL[2*ph*nline + 2*line][2*3*(nnode) + 2*nline + 2*line] = -R_matrix[line][ph*3 + 1] * bus1_phases[1] #C_mn for b
G_KVL[2*ph*nline + 2*line][2*3*(nnode) + 2*nline + 2*line + 1] = X_matrix[line][ph*3 + 1] * bus1_phases[1] #D_mn for b
G_KVL[2*ph*nline + 2*line][2*3*(nnode) + 4*nline + 2*line] = -R_matrix[line][ph*3 + 2] * bus1_phases[2] #C_mn for c
G_KVL[2*ph*nline + 2*line][2*3*(nnode) + 4*nline + 2*line + 1] = X_matrix[line][ph*3 + 2] * bus1_phases[2] #D_mn for c
G_KVL[2*ph*nline + 2*line+1][2*3*(nnode) + 2*line] = -X_matrix[line][ph*3] * bus1_phases[0] #C_mn for a
G_KVL[2*ph*nline + 2*line+1][2*3*(nnode) + 2*line + 1] = -R_matrix[line][ph*3] * bus1_phases[0] #D_mn for a
G_KVL[2*ph*nline + 2*line+1][2*3*(nnode) + 2*nline + 2*line] = -X_matrix[line][ph*3 + 1] * bus1_phases[1] #C_mn for b
G_KVL[2*ph*nline + 2*line+1][2*3*(nnode) + 2*nline + 2*line + 1] = -R_matrix[line][ph*3 + 1] * bus1_phases[1] #D_mn for b
G_KVL[2*ph*nline + 2*line+1][2*3*(nnode) + 4*nline + 2*line] = -X_matrix[line][ph*3 + 2] * bus1_phases[2] #C_mn for c
G_KVL[2*ph*nline + 2*line+1][2*3*(nnode) + 4*nline + 2*line + 1] = -R_matrix[line][ph*3 + 2] * bus1_phases[2] #D_mn for c
else:
G_KVL[2*ph*nline + 2*line][2*(nnode)*3 + 2*ph*nline + 2*line] = 1 #C_mn
G_KVL[2*ph*nline + 2*line+1][2*(nnode)*3 + 2*ph*nline + 2*line+1] = 1 #D_mn
#------- Residuals for Transformer KVL ----------
line_idx_tf = range(0, tf_lines)
kvl_count = 0
for tfbs in range(len(tf_bus[0])):
for ph in range(0, 3):
if tf_bus[ph + 2, tfbs] != 0:
line = line_idx_tf[kvl_count]
G_KVL[2*3*nline + 2*line][2*nnode*ph + 2*int(tf_bus[0, tfbs])] = 1 #A_m
G_KVL[2*3*nline + 2*line][2*nnode*ph + 2*int(tf_bus[1, tfbs])] = -1 #A_n
G_KVL[2*3*nline + 2*line+1][2*nnode*ph + 2*int(tf_bus[0, tfbs]) + 1] = 1 #B_m
G_KVL[2*3*nline + 2*line+1][2*nnode*ph + 2*int(tf_bus[1, tfbs]) + 1] = -1 #B_n
kvl_count += 1
self.G_KVL = G_KVL
def _init_KCL_matrices(self, der=0, capacitance=0):
"""
set H, g, b
copied from 20180601/PYTHON/lib/compute_KCL_matrices.py
written by @kathleenchang
"""
tf_bus = self.circuit.transformers.get_bus_ph_matrix()
vr_bus = self.circuit.voltage_regulators.get_bus_ph_matrix()
tf_lines = self.circuit.transformers.get_num_lines_x_ph()
tf_no = self.circuit.transformers.num_elements
vr_lines = self.circuit.voltage_regulators.get_num_lines_x_ph()
vr_count = self.circuit.voltage_regulators.num_elements
nnode = self.circuit.buses.num_elements
nline = self.circuit.lines.num_elements
# Line Indices Associated with Voltage Regulators and Transformers
line_in_idx_vr = range(0, 2*vr_lines, 2)
line_out_idx_vr = range(1, 2*vr_lines, 2)
line_idx_tf = range(0, tf_lines)
load_kw = self.circuit.loads.get_ppu_matrix()
load_kvar = self.circuit.loads.get_qpu_matrix()
caparr = self.circuit.get_cappu_matrix()
# ----------Residuals for KCL at a bus (m) ----------
bp = self.circuit.buses.get_phase_matrix_dict()
dss = self.dss
# Zip Parameters
# Load
beta_S = Circuit.aPQ_p
beta_I = Circuit.aI_p
beta_Z = Circuit.aZ_p
# Capacitors
gamma_S = Circuit.aPQ_p
gamma_I = Circuit.aI_p
gamma_Z = Circuit.aZ_p
H = np.zeros((2*3*(nnode-1), 2*3*(nnode+nline) + 2*tf_lines +
2*2*vr_lines, 2*3*(nnode+nline) + 2*tf_lines +
2*2*vr_lines), dtype=float)
g = np.zeros((2*3*(nnode-1), 1, 2*3*(nnode+nline) + 2*tf_lines +
2*2*vr_lines), dtype=float)
b = np.zeros((2*3*(nnode-1), 1, 1), dtype=float)
# --------------- Quadratic Terms -----------------
for ph in range(0,3):
if ph == 0: #set nominal voltage based on phase
A0 = 1
B0 = 0
elif ph == 1:
A0 = -1/2
B0 = -1 * np.sqrt(3)/2
elif ph == 2:
A0 = -1/2
B0 = np.sqrt(3)/2
for k2 in range(1, len(dss.Circuit.AllBusNames())): #skip slack bus
dss.Circuit.SetActiveBus(dss.Circuit.AllBusNames()[k2]) #set the bus
bus_name = dss.Circuit.AllBusNames()[k2]
in_lines = self.circuit.lines.get_line_list(bus_name, 'in') # upstream buses
out_lines = self.circuit.lines.get_line_list(bus_name, 'out') # downstream buses
for cplx in range(0,2):
idxbs = dss.Circuit.AllBusNames().index(dss.Circuit.AllBusNames()[k2])
if cplx == 0:
load_val = load_kw[ph,idxbs]
cap_val = 0
else:
load_val = load_kvar[ph,idxbs]
cap_val = caparr[ph][idxbs]
#gradient_mag = np.array([A0 * ((A0**2+B0**2) ** (-1/2)), B0 * ((A0**2+B0**2) ** (-1/2))]) #some derivatives
hessian_mag = np.array([[-((A0**2)*(A0**2+B0**2)**(-3/2))+(A0**2+B0**2)**(-1/2), -A0*B0*(A0**2+B0**2)**(-3/2)],
[-A0*B0*(A0**2+B0**2)**(-3/2), -((B0**2)*(A0**2+B0**2)**(-3/2))+((A0**2+B0**2)**(-1/2))]], dtype=float)
available_phases = bp[dss.Circuit.AllBusNames()[k2]] #phase array at specific bus
if available_phases[ph] == 1: #quadratic terms
H[2*ph*(nnode-1) + (k2-1)*2 + cplx][2*(nnode)*ph + 2*k2][2*(nnode)*ph + 2*k2] = \
-load_val * (beta_Z + (0.5 * beta_I* hessian_mag[0][0])) + \
cap_val * (gamma_Z + (0.5 * gamma_I * hessian_mag[0][0]))# TE replace assignment w/ -load_val * beta_Z; #a**2
H[2*ph*(nnode-1) + (k2-1)*2 + cplx][2*(nnode)*ph + 2*k2 + 1][2*(nnode)*ph + 2*k2 + 1] = \
-load_val * (beta_Z + (0.5 * beta_I * hessian_mag[1][1])) + \
cap_val * (gamma_Z + (0.5 * gamma_I * hessian_mag[1][1]))# TE replace assignment w/ -load_val * beta_Z; #b**2
#H[2*ph*(nnode-1) + (k2-1)*2 + cplx][2*(nnode)*ph + 2*k2][2*(nnode)*ph + 2*k2 + 1] = -load_val * beta_I * hessian_mag[0][1] / 2 #remove for TE
#H[2*ph*(nnode-1) + (k2-1)*2 + cplx][2*(nnode)*ph + 2*k2 + 1][2*(nnode)*ph + 2*k2] = -load_val * beta_I * hessian_mag[1][0] / 2 #remove for TE
for i in range(len(in_lines)): # in lines
line_idx = self.circuit.lines.get_idx(in_lines[i])
if available_phases[ph] == 1:
if cplx == 0: #real residual
#A_m and C_lm
H[2*ph*(nnode-1) + (k2-1)*2 + cplx][2*(nnode)*ph + 2*k2][2*3*(nnode) + 2*ph*nline + 2*line_idx] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2 + cplx][2*3*(nnode) + 2*ph*nline + 2*line_idx][2*(nnode)*ph + 2*k2] = 1/2
#B_m and D_lm
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode) + 2*ph*nline + 2*line_idx + 1] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*3*(nnode) + 2*ph*nline + 2*line_idx + 1][2*(nnode)*ph + 2*k2 + 1] = 1/2
if cplx == 1: #imaginary residual
# #A_m, D_lm
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*(nnode)*ph + 2*k2][2*3*(nnode) + 2*ph*nline + 2*line_idx + 1] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*3*(nnode) + 2*ph*nline + 2*line_idx + 1][2*(nnode)*ph + 2*k2] = -1/2
#B_m and C_lm
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode) + 2*ph*nline + 2*line_idx] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*3*(nnode) + 2*ph*nline + 2*line_idx][2*(nnode)*ph + 2*k2 + 1] = 1/2
for j in range(len(out_lines)): # out lines
line_idx = self.circuit.lines.get_idx(out_lines[j])
if available_phases[ph] == 1:
if cplx == 0: #real residual
#A_m and C_mn
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*(nnode)*ph + 2*k2][2*3*(nnode) + 2*ph*nline + 2*line_idx] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*3*(nnode) + 2*ph*nline + 2*line_idx][2*(nnode)*ph + 2*k2] = -1/2
#B_m and D_mn
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode) + 2*ph*nline + 2*line_idx + 1] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*3*(nnode) + 2*ph*nline + 2*line_idx + 1][2*(nnode)*ph + 2*k2 + 1] = -1/2
if cplx == 1: #imaginary residual
#A_m and D_mn
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*(nnode)*ph + 2*k2][2*3*(nnode) + 2*ph*nline + 2*line_idx + 1]= 1/2
H[2*ph*(nnode-1) + (k2-1)*2+ cplx][2*3*(nnode) + 2*ph*nline + 2*line_idx + 1][2*(nnode)*ph + 2*k2] = 1/2
#C_m and B_mn
H[2*ph*(nnode-1) + (k2-1)*2+cplx][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode) + 2*ph*nline + 2*line_idx] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2+cplx][2*3*(nnode) + 2*ph*nline + 2*line_idx][2*(nnode)*ph + 2*k2 + 1] = -1/2
# ----------------------- Transformer KCL -----------------------
tf_no = len(dss.Transformers.AllNames()) - len(dss.RegControls.AllNames())
count_tf = 0
count_tf2 = 0
for i in range(tf_no):
for ph in range(0,3):
k2 = int(tf_bus[1, i]) #in bus index of transformer [out bus: a0] --line-a0-a1-- [in bus: a1]
if k2 == 0: #if source bus, need to skip line
count_tf += 1
if k2 != 0 and tf_bus[ph + 2, i] != 0: #if not source bus, perform KCL
line_idx = line_idx_tf[count_tf]
#A_m and C_lm
H[2*ph*(nnode-1) + (k2-1)*2 ][2*(nnode)*ph + 2*k2][2*3*(nnode+nline) + 2*line_idx] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2 ][2*3*(nnode+nline) + 2*line_idx][2*(nnode)*ph + 2*k2] = 1/2
#B_m and D_lm
H[2*ph*(nnode-1) + (k2-1)*2][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode+nline) + 2*line_idx + 1] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2][2*3*(nnode+nline) + 2*line_idx + 1][2*(nnode)*ph + 2*k2 + 1] = 1/2
#A_m, D_lm
H[2*ph*(nnode-1) + (k2-1)*2+ 1][2*(nnode)*ph + 2*k2][2*3*(nnode+nline) + 2*line_idx + 1] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2+ 1][2*3*(nnode+nline) + 2*line_idx + 1][2*(nnode)*ph + 2*k2] = -1/2
#B_m and C_lm
H[2*ph*(nnode-1) + (k2-1)*2+ 1][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode+nline) + 2*line_idx] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2+ 1][2*3*(nnode+nline) + 2*line_idx][2*(nnode)*ph + 2*k2 + 1] = 1/2
count_tf += 1 #go to next line
for j in range(tf_no): #fill in H for the outlines
for ph in range(0,3):
k2 = int(tf_bus[0, j]) #out bus index of transformer
if k2 == 0:
count_tf2 += 1
if k2 != 0 and tf_bus[ph + 2, j] != 0:
line_idx = line_idx_tf[count_tf2]
#real residual
#A_m and C_mn
H[2*ph*(nnode-1) + (k2-1)*2][2*(nnode)*ph + 2*k2][2*3*(nnode+nline) + 2*line_idx] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2][2*3*(nnode+nline) + 2*line_idx][2*(nnode)*ph + 2*k2] = -1/2
#B_m and D_mn
H[2*ph*(nnode-1) + (k2-1)*2][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode+nline) + 2*line_idx + 1] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2][2*3*(nnode+nline) + 2*line_idx + 1][2*(nnode)*ph + 2*k2 + 1] = -1/2
#imaginary residual
#A_m and D_mn
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*(nnode)*ph + 2*k2][2*3*(nnode+nline) + 2*line_idx + 1]= 1/2
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*3*(nnode+nline) + 2*line_idx + 1][2*(nnode)*ph + 2*k2] = 1/2
#C_m and B_mn
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode+nline) + 2*line_idx] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*3*(nnode+nline) + 2*line_idx][2*(nnode)*ph + 2*k2 + 1] = -1/2
count_tf2+=1
# ----------------------- Voltage Regulator KCL -----------------------
vr_count = len(dss.RegControls.AllNames())
count_vr = 0
count_vr2 = 0
if vr_count > 0:
for i in range(vr_count): #in lines
for ph in range(0,3):
k2 = int(vr_bus[1, i])
if k2 == 0:
count_vr += 1
if k2 != 0 and vr_bus[ph + 2, i] != 0:
line_idx = line_in_idx_vr[count_vr]
#real residual
#A_m and C_lm
H[2*ph*(nnode-1) + (k2-1)*2 + 0][2*(nnode)*ph + 2*k2][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2 + 0][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx][2*(nnode)*ph + 2*k2] = 1/2
#B_m and D_lm
H[2*ph*(nnode-1) + (k2-1)*2 + 0][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx + 1] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2 + 0][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx + 1][2*(nnode)*ph + 2*k2 + 1] = 1/2
#imaginary residual
# #A_m, D_lm
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*(nnode)*ph + 2*k2][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx + 1] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx + 1][2*(nnode)*ph + 2*k2] = -1/2
#B_m and C_lm
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx][2*(nnode)*ph + 2*k2 + 1] = 1/2
count_vr += 1
for j in range(vr_count): #out lines
for ph in range(0,3):
k2 = int(vr_bus[0, j])
if k2 == 0:
count_vr2 += 1
if k2 != 0 and vr_bus[ph + 2, j] != 0:
line_idx = line_out_idx_vr[count_vr2]
#real residual
#A_m and C_mn
H[2*ph*(nnode-1) + (k2-1)*2][2*(nnode)*ph + 2*k2][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx][2*(nnode)*ph + 2*k2] = -1/2
#B_m and D_mn
H[2*ph*(nnode-1) + (k2-1)*2][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx + 1] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx + 1][2*(nnode)*ph + 2*k2 + 1] = -1/2
#imaginary residual
#A_m and D_mn
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*(nnode)*ph + 2*k2][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx + 1] = 1/2
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx + 1][2*(nnode)*ph + 2*k2] = 1/2
#C_m and B_mn
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*(nnode)*ph + 2*k2 + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx] = -1/2
H[2*ph*(nnode-1) + (k2-1)*2 + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_idx][2*(nnode)*ph + 2*k2 + 1] = -1/2
count_vr2 += 1
# ----------------------- Linear Term & Constant Term -----------------------
for ph in range(0,3):
for k2 in range(1, len(dss.Circuit.AllBusNames())):
for cplx in range(0,2):
available_phases = bp[dss.Circuit.AllBusNames()[k2]] #phase array at specific bus
idxbs = dss.Circuit.AllBusNames().index(dss.Circuit.AllBusNames()[k2])
if cplx == 0:
load_val = load_kw[ph][idxbs]
else:
load_val = load_kvar[ph][idxbs]
# Linear terms
g_temp = np.zeros(2*3*(nnode+nline) + 2*tf_lines +
2*2*vr_lines, dtype=float)
if available_phases[ph] == 0: #if phase does not exist
g_temp[2*(ph)*nnode + 2*k2 + cplx] = 1
g[2*(nnode-1)*ph + 2*(k2-1) + cplx, 0,:] = g_temp
# Constant terms
if cplx == 0:
if der.real != 0:
b_factor = der.real
b_factor = 0
else:
b_factor = 0
else:
if capacitance != 0 or der.imag != 0:
b_factor = capacitance - der.imag
b_factor = 0
else:
b_factor = caparr[ph][k2]
if available_phases[ph] == 0: #if phase does not exist
b_temp = 0
else:
b_temp = (-load_val * beta_S) + (b_factor * gamma_S)
b[2*(nnode-1)*ph + 2*(k2-1) + cplx][0][0] = b_temp
self.H, self.g, self.b = H, g, b
def _init_KVL_matrices_vregs(self):
"""
set H_reg, G_reg
copied from 20180601/PYTHON/lib/compute_SBKVL_matrices.py
written by @kathleenchang
"""
# ---------- Voltage Regulator -----------
tf_bus = self.circuit.transformers.get_bus_ph_matrix()
vr_bus = self.circuit.voltage_regulators.get_bus_ph_matrix()
tf_lines = self.circuit.transformers.get_num_lines_x_ph()
tf_no = self.circuit.transformers.num_elements
vr_lines = self.circuit.voltage_regulators.get_num_lines_x_ph()
vr_count = self.circuit.voltage_regulators.num_elements
nnode = self.circuit.buses.num_elements
nline = self.circuit.lines.num_elements
gain = self.circuit.voltage_regulators.get_gain_matrix()
H_reg = np.zeros((2*vr_lines, 2*3*(nnode+nline) + 2*tf_lines +
2*2*vr_lines, 2*3*(nnode+nline) +
2*tf_lines + 2*2*vr_lines), dtype=float)
G_reg = np.zeros((2*vr_lines, 2*3*(nnode+nline) + 2*tf_lines +
2*2*vr_lines), dtype=float)
# voltage ratio: V_bus2 - gamma V_bus1 = 0
line_in_idx = range(0, 2*vr_lines, 2)
line_out_idx = range(1, 2*vr_lines, 2)
vr_counter = 0
for m in range(vr_count):
bus1_idx = vr_bus[0, m]
bus2_idx = vr_bus[1, m]
for ph in range(0,3):
if vr_bus[ph + 2,m] != 0:
# voltage gain: gamma*A_in = A_out
# gamma * B_in = B_out
# Negative not shown below because inserted into gain term
G_reg[2*vr_counter][2*nnode*ph + 2*bus1_idx] = gain[m] #A_in
G_reg[2*vr_counter][2*nnode*ph + 2*bus2_idx] = 1 #A_out
G_reg[2*vr_counter + 1][2*nnode*ph + 2*bus1_idx + 1] = gain[m] #B_in
G_reg[2*vr_counter + 1][2*nnode*ph + 2*bus2_idx + 1] = 1 #B_out
#conservation of power: V_bus1 (I_bus1,out)* - V_bus2 (I_bus2,in)* = 0
# A_1 * C_out + B_1 * D_out - (A_2 * C_in + B_2 * D_in)
# j(B_1 * C_out - A_1 * D_out) - j(B_2 * C_in - A_2 * D_in)
#A_1 C_out
H_reg[2*vr_counter][2*nnode*ph + 2*bus1_idx][2*3*(nnode+nline) + 2*tf_lines + 2*line_out_idx[vr_counter]] = 1
H_reg[2*vr_counter][2*3*(nnode+nline) + 2*tf_lines + 2*line_out_idx[vr_counter]][2*nnode*ph + 2*bus1_idx] = 1
#B_1 D_out
H_reg[2*vr_counter][2*nnode*ph + 2*bus1_idx + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_out_idx[vr_counter] + 1] = 1
H_reg[2*vr_counter][2*3*(nnode+nline) + 2*tf_lines + 2*line_out_idx[vr_counter]+ 1][2*nnode*ph + 2*bus1_idx + 1] = 1
#A_2 C_in
H_reg[2*vr_counter][2*nnode*ph + 2*bus2_idx][2*3*(nnode+nline) + 2*tf_lines + 2*line_in_idx[vr_counter]] = -1
H_reg[2*vr_counter][2*3*(nnode+nline) + 2*tf_lines + 2*line_in_idx[vr_counter]][2*nnode*ph + 2*bus2_idx] = -1
#B_2 D_in
H_reg[2*vr_counter][2*nnode*ph + 2*bus2_idx + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_in_idx[vr_counter] + 1] = -1
H_reg[2*vr_counter][2*3*(nnode+nline) + 2*tf_lines + 2*line_in_idx[vr_counter] + 1][2*nnode*ph + 2*bus2_idx + 1] = -1
#B_1 * C_out
H_reg[2*vr_counter + 1][2*nnode*ph + 2*bus1_idx + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_out_idx[vr_counter]] = 1
H_reg[2*vr_counter + 1][2*3*(nnode+nline) + 2*tf_lines+ 2*line_out_idx[vr_counter]][2*nnode*ph + 2*bus1_idx + 1] = 1
# A_1 * D_out
H_reg[2*vr_counter + 1][2*nnode*ph + 2*bus1_idx][2*3*(nnode+nline) + 2*tf_lines + 2*line_out_idx[vr_counter] + 1] = -1
H_reg[2*vr_counter + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_out_idx[vr_counter] + 1][2*nnode*ph + 2*bus1_idx] = -1
#B_2 * C_in
H_reg[2*vr_counter + 1][2*nnode*ph + 2*bus2_idx + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_in_idx[vr_counter]] = -1
H_reg[2*vr_counter + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_in_idx[vr_counter]][2*nnode*ph + 2*bus2_idx + 1] = -1
# A_2 * D_in
H_reg[2*vr_counter + 1][2*nnode*ph + 2*bus2_idx][2*3*(nnode+nline) + 2*tf_lines + 2*line_in_idx[vr_counter] + 1] = 1
H_reg[2*vr_counter + 1][2*3*(nnode+nline) + 2*tf_lines + 2*line_in_idx[vr_counter] + 1][2*nnode*ph + 2*bus2_idx] = 1
vr_counter += 1
self.H_reg, self.G_reg = H_reg, G_reg
def change_KCL_matrices(self, der=0, capacitance=0, t=-1):
H, g, b = self.H, self.g, self.b
wpu = self.circuit.get_wpu_matrix()
nnode = self.circuit.buses.num_elements
# load_kw, load_kvar = nominal_load_values(t)
# caparr = nominal_cap_arr()
load_kw = self.circuit.loads.get_ppu_matrix()
load_kvar = self.circuit.loads.get_qpu_matrix()
caparr = self.circuit.get_cappu_matrix()
# ----------Residuals for KCL at a bus (m) ----------
#Zip Parameters
beta_S = Circuit.aPQ_p
beta_I = Circuit.aI_p
beta_Z = Circuit.aZ_p
# Capacitors
gamma_S = Circuit.aPQ_p
gamma_I = Circuit.aI_p
gamma_Z = Circuit.aZ_p
# Quadratic Terms
# Time varying load
if t != -1:
for ph in range(0, 3):
for k2 in range(1, nnode): # skip slack bus
bus = self.circuit.buses.get_element(k2)
#dss.Circuit.SetActiveBus(dss.Circuit.AllBusNames()[k2]) #set the bus
available_phases = bus.phase_matrix # phase array at specific bus
for cplx in range(0, 2):
if available_phases[ph] == 1: # quadratic terms
H[2*ph*(nnode-1) + (k2-1)*2 + cplx][2*(nnode)*ph + 2*k2][2 *
(nnode)*ph + 2*k2] *= (1 + 0.1*np.sin(2*np.pi*0.01*t))
#-load_val * (beta_Z + (0.5 * beta_I* hessian_mag[0][0])) # TE replace assignment w/ -load_val * beta_Z; #a**2
H[2*ph*(nnode-1) + (k2-1)*2 + cplx][2*(nnode)*ph + 2*k2 + 1][2 *
(nnode)*ph + 2*k2 + 1] *= (1 + 0.1*np.sin(2*np.pi*0.01*t))
#-load_val * (beta_Z + (0.5 * beta_I * hessian_mag[1][1])) # TE replace assignment w/ -load_val * beta_Z; #b**2
# Constant Term
if t != -1 or der != 0 or capacitance != 0:
for ph in range(0, 3):
for k2 in range(1, nnode):
bus = self.circuit.buses.get_element(k2)
available_phases = bus.phase_matrix
if available_phases[ph] == 1:
for cplx in range(0, 2):
if cplx == 0:
load_val = load_kw[ph][k2]
if der.real != 0:
b_factor = der.real
else:
b_factor = 0
else:
load_val = load_kvar[ph][k2]
if capacitance != 0 or der.imag != 0:
b_factor = capacitance - der.imag
else:
b_factor = caparr[ph][k2]
if t != -1:
print('Should not enter')
load_val *= (1 + 0.1*np.sin(2*np.pi*0.01*t))
b_temp = (-load_val * beta_S) + \
(b_factor * gamma_S)
# TODO: resolve numpy warning here
b[2*(nnode-1)*ph + 2*(k2-1) +
cplx][0][0] = b_temp - wpu[ph][k2]
return H, b
def solve(self):
"""
Solves powerflow once, updates self.XNR with solved XNR
From src/nr3_python/lib/NR3.py
Written by @kathleenchang
"""
# get pointers to basematrices
XNR, g_SB, b_SB = self.XNR, self.g_SB, self.b_SB
G_KVL, b_KVL, = self.G_KVL, self.b_KVL
H, g, b = self.H, self.g, self.b
H_reg, G_reg = self.H_reg, self.G_reg
# get index and Sbase info from self.circuit
nline = self.circuit.lines.num_elements
nnode = self.circuit.buses.num_elements
Sbase = self.circuit.Sbase
tf_lines = self.circuit.transformers.get_num_lines_x_ph()
vr_lines = self.circuit.voltage_regulators.get_num_lines_x_ph()
tol = self.__class__.CONVERGENCE_TOLERANCE
maxiter = self.__class__.maxiter
FT = 1e99
itercount = 0
# solve power-flow.
while np.amax(np.abs(FT)) >= 1e-9 and itercount < maxiter:
# print("Iteration number for Original NR3 %f" % (itercount))
FT = compute_NR3FT(XNR, g_SB, b_SB, G_KVL, b_KVL, H,
g, b, nnode, nline, H_reg, G_reg, vr_lines)
JT = compute_NR3JT(XNR, g_SB, G_KVL, H, g, nnode,
nline, H_reg, G_reg, tf_lines, vr_lines)
if JT.shape[0] >= JT.shape[1]:
XNR = XNR - np.linalg.inv(JT.T@JT)@JT.T@FT
itercount += 1
XNR_final = XNR
self.XNR = XNR
self.converged = True
self.map_XNR()
def map_XNR(self):
"""
Set self,V, self.I, self.Stx, self.Srx, self.i, self.s
based on the current value of self.XNR
Written by @kathleenchang
"""
TXnum = self.circuit.get_tx_idx_matrix()
RXnum = self.circuit.get_rx_idx_matrix()
nnode = self.circuit.buses.num_elements
nline = self.circuit.lines.num_elements
PH = self.circuit.buses.get_phase_matrix(self._orient)
spu = self.circuit.get_spu_matrix()
APQ = self.circuit.get_aPQ_matrix()
AZ = self.circuit.get_aZ_matrix()
AI = self.circuit.get_aI_matrix()
cappu = self.circuit.get_cappu_matrix()
wpu = self.circuit.get_wpu_matrix()
XNR = self.XNR
# TODO: can/should we include transformers and voltage regulators in
# in INR?
VNR, INR, STXNR, SRXNR, iNR, sNR = map_output(self.circuit, XNR)
self.V = VNR
self.Vmag = np.abs(VNR)
self.I = INR
self.Stx = STXNR
self.Srx = SRXNR
self.i_Node = iNR
self.sV = sNR
| 54.768072 | 228 | 0.474399 |
dd45648a7be07cf60184c712f163e51245348f71 | 895 | lua | Lua | tests/sorters_spec.lua | sindrets/bufferline.nvim | 94211eac27c931f4458ce713fbe430b7cc82dea8 | [
"Unlicense"
] | null | null | null | tests/sorters_spec.lua | sindrets/bufferline.nvim | 94211eac27c931f4458ce713fbe430b7cc82dea8 | [
"Unlicense"
] | null | null | null | tests/sorters_spec.lua | sindrets/bufferline.nvim | 94211eac27c931f4458ce713fbe430b7cc82dea8 | [
"Unlicense"
] | null | null | null | describe("Sorters - ", function()
local sorters = require("bufferline.sorters")
it("should sort by ID correctly", function()
local bufs = { { id = 12 }, { id = 2 }, { id = 3 }, { id = 8 } }
sorters.sort_buffers("id", bufs)
local ids = vim.tbl_map(function(buf)
return buf.id
end, bufs)
assert.same(ids, { 2, 3, 8, 12 })
end)
it("should sort by tabs correctly", function()
vim.cmd("e file1.txt")
vim.cmd("tabnew file2.txt")
vim.cmd("tabnew file3.txt")
vim.cmd("bunload file2.txt")
local bufs = vim.tbl_map(function(id)
return { id = id }
end, vim.api.nvim_list_bufs())
sorters.sort_buffers("tabs", bufs)
local buf_names = vim.tbl_map(function(buf)
return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(buf.id), ":p:t")
end, bufs)
assert.same({ "file1.txt", "file3.txt", "file2.txt" }, buf_names)
end)
end)
| 29.833333 | 74 | 0.614525 |
64e9290f72e1e4590e02d5eb1843dcdc59e2c9bc | 1,552 | java | Java | asdctool/src/main/java/org/openecomp/sdc/asdctool/utils/ReportWriter.java | infosiftr/sdc | a1f23ec5e7cd191b76271b5f33c237bad38c61c6 | [
"Apache-2.0"
] | null | null | null | asdctool/src/main/java/org/openecomp/sdc/asdctool/utils/ReportWriter.java | infosiftr/sdc | a1f23ec5e7cd191b76271b5f33c237bad38c61c6 | [
"Apache-2.0"
] | null | null | null | asdctool/src/main/java/org/openecomp/sdc/asdctool/utils/ReportWriter.java | infosiftr/sdc | a1f23ec5e7cd191b76271b5f33c237bad38c61c6 | [
"Apache-2.0"
] | null | null | null | package org.openecomp.sdc.asdctool.utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
public class ReportWriter {
FileWriter file;
public ReportWriter(String reportName) {
StringBuilder sb = new StringBuilder();
Path path = Paths.get("/var/tmp/");
if ( path.toFile().exists() ) {
sb.append("/var/tmp/");
}
sb.append("report_").append(reportName).append("_").append(System.currentTimeMillis()).append(".json");
String fileName = sb.toString();
try {
file = new FileWriter(fileName);
} catch (IOException e) {
System.out.println("Failed to create report file. " + e.getMessage());
}
}
public void report(Object objectToWrite) throws IOException {
if (file != null) {
JsonParser parser = new JsonParser();
JsonObject json = parser.parse(JsonParserUtils.toJson(objectToWrite)).getAsJsonObject();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = gson.toJson(json);
file.write(prettyJson);
file.flush();
}
}
public void close() throws IOException {
if (file != null) {
file.close();
}
}
}
| 30.431373 | 111 | 0.619201 |
efc399bf36495856dd58ad65cfc2326cf0844727 | 2,339 | lua | Lua | Games/Criminality/Player/Fly.lua | Stefanuk12/roblox | 4ab76ada0093218d95639763fd6cd2e7b4423cd5 | [
"Apache-2.0"
] | 1 | 2021-12-11T16:33:01.000Z | 2021-12-11T16:33:01.000Z | Games/Criminality/Player/Fly.lua | Stefanuk12/roblox | 4ab76ada0093218d95639763fd6cd2e7b4423cd5 | [
"Apache-2.0"
] | null | null | null | Games/Criminality/Player/Fly.lua | Stefanuk12/roblox | 4ab76ada0093218d95639763fd6cd2e7b4423cd5 | [
"Apache-2.0"
] | null | null | null | -- // BARELY FUNCTIONAL - shows POC of how protect_gui can be used to bypass checks for certain parts. In order to stop being TP'd back, must be paired with a TP Bypass
-- // Services
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
-- // Vars
local LocalPlayer = Players.LocalPlayer
local CurrentlyFlying = false
local MaxForce = Vector3.new(123123, 123123, 123123)
local UpFly = Vector3.new(0, 25, 0)
local Speed = UpFly.Y
local Keys = {
[Enum.KeyCode.W] = {"LookVector", false},
[Enum.KeyCode.S] = {"LookVector", true},
[Enum.KeyCode.A] = {"RightVector", true},
[Enum.KeyCode.D] = {"RightVector", false}
}
-- //
local BodyVelocity = Instance.new("BodyVelocity")
syn.protect_gui(BodyVelocity)
-- //
local function startFly(Velocity)
CurrentlyFlying = true
while (CurrentlyFlying) do
BodyVelocity.Parent = LocalPlayer.Character.HumanoidRootPart
BodyVelocity.MaxForce = MaxForce
BodyVelocity.Velocity = Velocity
wait(0.2)
end
end
-- //
local function stopFly()
CurrentlyFlying = false
BodyVelocity.Parent = nil
BodyVelocity.MaxForce = Vector3.new()
BodyVelocity.Velocity = Vector3.new()
end
-- //
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
-- // So you don't fly when typing in chat, etc
if (gameProcessedEvent) then
return
end
-- // Vars
local KeyCode = input.KeyCode
local MoveData = Keys[KeyCode]
-- // Check if it is a recognised key
if (MoveData) then
-- // Vars
local Multiplier = MoveData[2] and -1 or 1
local Velocity = LocalPlayer.Character.HumanoidRootPart.CFrame[MoveData[1]] * Speed
-- // Fly
startFly(Velocity * Multiplier)
return
end
-- // Check if it is a recognised key
if (KeyCode == Enum.KeyCode.Space) then
-- // Fly
startFly(UpFly)
return
end
end)
-- //
UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
-- // So you don't fly when typing in chat, etc
if (gameProcessedEvent) then
return
end
-- // Vars
local KeyCode = input.KeyCode
-- // Check if it is a recognised key
if (Keys[KeyCode] or KeyCode == Enum.KeyCode.Space) then
stopFly()
end
end) | 26.280899 | 168 | 0.659256 |
d7b90cec3abdfb606c54e52e8863eb293fbf1bc5 | 2,832 | kt | Kotlin | src/kotlin/org/intellij/plugins/hcl/findUsages/HCLFindUsagesProvider.kt | trucnguyenlam/intellij-hcl | 6a69e426b665806209a290b43ef1f84f7e0e33d2 | [
"Apache-2.0"
] | 253 | 2015-06-02T20:15:43.000Z | 2022-03-16T14:51:29.000Z | src/kotlin/org/intellij/plugins/hcl/findUsages/HCLFindUsagesProvider.kt | trucnguyenlam/intellij-hcl | 6a69e426b665806209a290b43ef1f84f7e0e33d2 | [
"Apache-2.0"
] | 377 | 2015-06-03T19:52:42.000Z | 2022-03-22T16:08:41.000Z | src/kotlin/org/intellij/plugins/hcl/findUsages/HCLFindUsagesProvider.kt | trucnguyenlam/intellij-hcl | 6a69e426b665806209a290b43ef1f84f7e0e33d2 | [
"Apache-2.0"
] | 61 | 2015-10-22T18:00:38.000Z | 2022-03-29T00:27:33.000Z | /*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.intellij.plugins.hcl.findUsages
import com.intellij.lang.cacheBuilder.WordsScanner
import com.intellij.lang.findUsages.FindUsagesProvider
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiNamedElement
import org.intellij.plugins.hcl.HCLLexer
import org.intellij.plugins.hcl.psi.*
open class HCLFindUsagesProvider : FindUsagesProvider {
override fun getWordsScanner(): WordsScanner? {
return HCLWordsScanner(HCLLexer())
}
override fun canFindUsagesFor(psiElement: PsiElement): Boolean {
if (psiElement !is PsiNamedElement || psiElement !is HCLElement) {
return false
}
if (psiElement is HCLStringLiteral || psiElement is HCLIdentifier) {
@Suppress("USELESS_CAST")
val parent = (psiElement as PsiElement).parent
if (parent is HCLBlock) {
return psiElement === parent.nameIdentifier
} else if(parent is HCLProperty) {
return psiElement === parent.nameIdentifier
}
}
return true
}
override fun getHelpId(psiElement: PsiElement): String? {
return null
}
override fun getType(element: PsiElement): String {
if (element is HCLBlock) {
return "Block('${element.nameElements.first()!!.text}')"
}
if (element is HCLProperty) {
return "Property"
}
if (element is HCLIdentifier || element is HCLStringLiteral) {
val parent = element.parent
if (parent is HCLBlock) {
return parent.nameElements.first()!!.text
}
if (HCLPsiUtil.isPropertyKey(element)) {
return "Property"
}
}
if (element is PsiNamedElement) {
// return element.name ?:
return "<Untyped PsiNamedElement${element.javaClass.name}>"
}
return "<Untyped non-PsiNamedElement ${element.node.elementType}>"
}
override fun getDescriptiveName(element: PsiElement): String {
val name = if (element is PsiNamedElement) element.name else null
return name ?: "<Not An PsiNamedElement ${element.node.elementType}>"
}
override fun getNodeText(element: PsiElement, useFullName: Boolean): String {
if (useFullName) {
if (element is HCLBlock) {
return element.fullName
}
}
return getDescriptiveName(element)
}
}
| 32.181818 | 79 | 0.699506 |
3a14d6650459c8abcdff904b928f86be3483343a | 4,352 | swift | Swift | TemplateProject/Utilities/Extensions/StringExtension.swift | nikhil-p-crest/TemplateProjectWOPods | a82393d598dcf43e9e5f6e9388976fc3ec89b081 | [
"MIT"
] | 1 | 2019-08-26T09:50:05.000Z | 2019-08-26T09:50:05.000Z | TemplateProject/Utilities/Extensions/StringExtension.swift | nikhil-p-crest/TemplateProjectWOPods | a82393d598dcf43e9e5f6e9388976fc3ec89b081 | [
"MIT"
] | null | null | null | TemplateProject/Utilities/Extensions/StringExtension.swift | nikhil-p-crest/TemplateProjectWOPods | a82393d598dcf43e9e5f6e9388976fc3ec89b081 | [
"MIT"
] | null | null | null | //
// StringExtension.swift
// TemplateProject
//
// Created by Nikhil Patel on 27/05/19.
// Copyright © 2019 Nikhil Patel. All rights reserved.
//
import Foundation
import UIKit
extension String {
mutating func encodeURL() {
self = self.encodedURL()
}
mutating func decodeURL() {
self = self.decodedURL()
}
mutating func encodeURLQuery() {
self = self.encodedURLQuery()
}
func encodedURL() -> String {
return self.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlHostAllowed) ?? self
}
func decodedURL() -> String {
return self.removingPercentEncoding ?? self
}
func encodedURLQuery() -> String {
return self.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) ?? self
}
static func base64Encode(_ data: Data?) -> String {
if data != nil {
return data!.base64EncodedString()
}
return ""
}
static func base64Encode(_ image: UIImage) -> String {
let data = image.pngData()
return String.base64Encode(data)
}
static func base64Encode(_ filepath: String) -> String {
do {
let data = try Data.init(contentsOf: URL.init(fileURLWithPath: filepath))
return String.base64Encode(data)
} catch let error {
print(error)
}
return ""
}
func utf8Encoded() -> Data {
return self.data(using: String.Encoding.utf8)!
}
mutating func encodeBase64() {
self = self.utf8Encoded().base64EncodedString()
}
func encodedBase64() -> String {
return self.utf8Encoded().base64EncodedString()
}
mutating func decodeBase64() {
self = self.decodedBase64()
}
func decodedBase64() -> String {
if let decodedData = Data.init(base64Encoded: self) {
return String.init(data: decodedData, encoding: String.Encoding.utf8) ?? self
}
return self
}
func trimmed() -> String {
let whitespace = CharacterSet.whitespacesAndNewlines
let stringTrimmed = self.trimmingCharacters(in: whitespace)
let stringWithoutSpace = stringTrimmed.replacingOccurrences(of: " ", with: "")
return stringWithoutSpace
}
mutating func trim() {
self = self.trimmed()
}
func toInt() -> Int {
let intValue = Int(self)
return intValue ?? 0
}
func toDouble() -> Double {
let doubleValue = Double(self)
return doubleValue ?? 0
}
func width(withConstrainedHeight height: CGFloat, font: UIFont) -> CGFloat {
let constraintRect = CGSize(width: .greatestFiniteMagnitude, height: height)
let boundingBox = self.boundingRect(with: constraintRect, options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font: font], context: nil)
return ceil(boundingBox.width)
}
func height(withConstrainedWidth width: CGFloat, font: UIFont) -> CGFloat {
let constraintRect = CGSize(width: width, height: .greatestFiniteMagnitude)
let boundingBox = self.boundingRect(with: constraintRect, options: .usesLineFragmentOrigin, attributes: [NSAttributedString.Key.font: font], context: nil)
return ceil(boundingBox.height)
}
static func currenyString(fromDouble value: Double?) -> String {
if value == nil {
return ""
}
let numberFormatter = NumberFormatter()
numberFormatter.locale = Locale.current
numberFormatter.numberStyle = .currency
if let string = numberFormatter.string(from: NSNumber.init(value: value!)) {
return string
}
return ""
}
static func fromDouble(_ value: Double?) -> String {
if value == nil {
return ""
}
return "\(value!)"
}
}
extension Double {
var string: String {
return self.truncatingRemainder(dividingBy: 1) == 0 ? String(format: "%.0f", self) : String(self)
}
}
extension Range where Bound == String.Index {
var nsRange:NSRange {
return NSRange(location: self.lowerBound.encodedOffset, length: self.upperBound.encodedOffset - self.lowerBound.encodedOffset)
}
}
| 29.208054 | 162 | 0.615809 |
508be4eba71eb127ff5cf192abf3234eb08fccd6 | 115 | html | HTML | app/views/notifications/_notification.scala.html | ajaygeorge91/postboard_server | 4defc856b85e70d28c0c9182170e211bdf639a4f | [
"Apache-2.0"
] | null | null | null | app/views/notifications/_notification.scala.html | ajaygeorge91/postboard_server | 4defc856b85e70d28c0c9182170e211bdf639a4f | [
"Apache-2.0"
] | null | null | null | app/views/notifications/_notification.scala.html | ajaygeorge91/postboard_server | 4defc856b85e70d28c0c9182170e211bdf639a4f | [
"Apache-2.0"
] | null | null | null | @(userDTO: Option[User], userNotification: UserNotification)(implicit request: RequestHeader, messages: Messages)
| 57.5 | 114 | 0.808696 |
712b594383639e3fe96379f276a0cf3a1e71d926 | 4,089 | ts | TypeScript | threejs-wrappers/BaseApplication.ts | mishankov/ubiquitous-octo-train | 209a158fd38689f23f22fce2020b9efa6688f7d0 | [
"MIT"
] | null | null | null | threejs-wrappers/BaseApplication.ts | mishankov/ubiquitous-octo-train | 209a158fd38689f23f22fce2020b9efa6688f7d0 | [
"MIT"
] | null | null | null | threejs-wrappers/BaseApplication.ts | mishankov/ubiquitous-octo-train | 209a158fd38689f23f22fce2020b9efa6688f7d0 | [
"MIT"
] | null | null | null | import * as THREE from 'three';
import Stats from 'three/examples/jsm/libs/stats.module';
import { CameraWrapper } from './cameras/CameraWrapper';
import { KeyboardInputController } from './input-controllers/KeyboardInputController';
import { MouseInputContoller } from './input-controllers/MouseInputController';
export interface AnimatedObject {
animation: (time: DOMHighResTimeStamp) => void;
}
export function animate(app: BaseApplication, time?: number) {
requestAnimationFrame(function(time) {
animate(app, time);
});
for (let index = 0; index < app.animatedObjects.length; index++) {
const element = app.animatedObjects[index];
element.animation(time);
}
app.keyboardInputHandler();
app.mouseInputHandler();
app.camera.move();
app.render();
}
export class BaseApplication {
scene: THREE.Scene;
camera: CameraWrapper;
renderer: THREE.WebGLRenderer;
stats: Stats;
keyboardInput: KeyboardInputController;
mouseInput: MouseInputContoller;
animatedObjects: Array<AnimatedObject>;
DEBUG: boolean;
constructor(debug=false) {
this._init(debug);
this.init();
}
_init(debug = false) {
this.DEBUG = debug;
this.animatedObjects = new Array();
this.initScene();
this.initCamera();
this.initRenderer();
this.initLight();
window.addEventListener('resize', () => {
this.onResize();
}, false);
window.addEventListener('keypress', (event) => {
this.onKeypress(event.key);
});
this.initDebug();
this.keyboardInput = new KeyboardInputController();
this.mouseInput = new MouseInputContoller();
}
init() {}
initScene() {
this.scene = new THREE.Scene();
this.scene.background = new THREE.Color(0xffffff);
}
initCamera() {
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.set(-30, 40, -30);
// camera.rotation.order = 'YXZ';
camera.lookAt(0, 0, 0);
this.camera = new CameraWrapper(camera);
}
initRenderer() {
this.renderer = new THREE.WebGLRenderer();
this.renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(this.renderer.domElement);
}
initLight() {
let dirLight = new THREE.DirectionalLight(0xFFFFFF, 1.0);
dirLight.position.set(-100, 100, 100);
dirLight.target.position.set(0, 0, 0);
dirLight.castShadow = true;
dirLight.shadow.bias = -0.001;
dirLight.shadow.mapSize.width = 4096;
dirLight.shadow.mapSize.height = 4096;
dirLight.shadow.camera.near = 0.1;
dirLight.shadow.camera.far = 500.0;
dirLight.shadow.camera.near = 0.5;
dirLight.shadow.camera.far = 500.0;
dirLight.shadow.camera.left = 50;
dirLight.shadow.camera.right = -50;
dirLight.shadow.camera.top = 50;
dirLight.shadow.camera.bottom = -50;
this.scene.add(dirLight);
let ambLight = new THREE.AmbientLight(0xFFFFFF, 0.25);
this.scene.add(ambLight);
}
initDebug() {
if (this.DEBUG) {
this.scene.add(new THREE.AxesHelper(100));
// FPS display
this.stats = Stats();
document.body.appendChild(this.stats.dom);
}
}
render() {
if (this.DEBUG) {
this.stats.begin();
}
this.renderer.render(this.scene, this.camera.actualCamera);
if (this.DEBUG) {
this.stats.end();
this.stats.update();
}
}
onResize() {
this.camera.actualCamera.aspect = window.innerWidth / window.innerHeight;
this.camera.actualCamera.updateProjectionMatrix();
this.renderer.setSize(window.innerWidth, window.innerHeight);
}
onKeypress(keyName: string) {}
keyboardInputHandler() {}
mouseInputHandler() {}
}; | 27.628378 | 106 | 0.609195 |
dab01ada6c22664be688f2a4c2cfcdc552de6535 | 170 | sql | SQL | web/dbWebSource/table_types/page_includes_tt.sql | zettasolutions/zsi-fmis | fc35ae309a55db663ed2cbf5c156b8937c544cd7 | [
"MIT"
] | null | null | null | web/dbWebSource/table_types/page_includes_tt.sql | zettasolutions/zsi-fmis | fc35ae309a55db663ed2cbf5c156b8937c544cd7 | [
"MIT"
] | 2 | 2021-05-08T23:02:28.000Z | 2021-05-11T14:17:29.000Z | web/dbWebSource/table_types/page_includes_tt.sql | zettasolutions/zsi-fmis | fc35ae309a55db663ed2cbf5c156b8937c544cd7 | [
"MIT"
] | 3 | 2019-11-20T14:33:06.000Z | 2021-01-09T00:46:07.000Z | CREATE TYPE page_includes_tt AS TABLE(
page_include_id INT NULL
,page_id INT NULL
,is_edited CHAR(1) NULL
,storage_location CHAR(1) NULL
,library_name NVARCHAR(200) NULL) | 28.333333 | 38 | 0.817647 |
9c0c247beba8680272c709ed90beb08c16ade203 | 11,241 | js | JavaScript | src/js/media-time-range.js | muxinc/player-chrome | f6b90e9765e7139a76980530c4b7c1fd0204bd01 | [
"MIT"
] | 17 | 2019-10-16T13:18:40.000Z | 2020-10-15T22:34:22.000Z | src/js/media-time-range.js | gkatsev/media-chrome | f6b90e9765e7139a76980530c4b7c1fd0204bd01 | [
"MIT"
] | 3 | 2020-03-12T00:23:48.000Z | 2020-04-06T14:25:07.000Z | src/js/media-time-range.js | muxinc/player-chrome | f6b90e9765e7139a76980530c4b7c1fd0204bd01 | [
"MIT"
] | null | null | null | import MediaChromeRange from './media-chrome-range.js';
import { defineCustomElement } from './utils/defineCustomElement.js';
import {
Window as window,
Document as document,
} from './utils/server-safe-globals.js';
import { MediaUIEvents, MediaUIAttributes } from './constants.js';
import { nouns } from './labels/labels.js';
import { formatAsTimePhrase } from './utils/time.js';
const DEFAULT_MISSING_TIME_PHRASE = 'video not loaded, unknown time.';
const updateAriaValueText = (el) => {
const range = el.range;
const currentTimePhrase = formatAsTimePhrase(+range.value);
const totalTimePhrase = formatAsTimePhrase(+range.max);
const fullPhrase = !(currentTimePhrase && totalTimePhrase)
? DEFAULT_MISSING_TIME_PHRASE
: `${currentTimePhrase} of ${totalTimePhrase}`;
range.setAttribute('aria-valuetext', fullPhrase);
};
const template = document.createElement('template');
template.innerHTML = `
<style>
#thumbnailContainer {
position: absolute;
left: 0;
top: 0;
transition: visibility .25s, opacity .25s;
visibility: hidden;
opacity: 0;
}
media-thumbnail-preview {
--thumb-preview-min-width: var(--media-thumbnail-preview-min-width, 120px);
--thumb-preview-max-width: var(--media-thumbnail-preview-max-width, 180px);
--thumb-preview-min-height: var(--media-thumbnail-preview-min-height, 80px);
--thumb-preview-max-height: var(--media-thumbnail-preview-max-height, 160px);
--thumb-preview-border: 2px solid #fff;
transform-origin: 50% 100%;
position: absolute;
bottom: calc(100% + 5px);
border: var(--media-thumbnail-preview-border, var(--thumb-preview-border, 2px solid #fff));
border-radius: var(--media-thumbnail-preview-border-radius, 2px);
background-color: #000;
}
/*
This is a downward triangle. Commented out for now because it would also
require scaling the px properties below in JS; bottom and border-width.
*/
/* media-thumbnail-preview::after {
content: "";
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: -10px;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-top: 10px solid #fff;
} */
:host([${MediaUIAttributes.MEDIA_PREVIEW_IMAGE}]:hover) #thumbnailContainer {
transition: visibility .5s, opacity .5s;
visibility: visible;
opacity: 1;
}
</style>
<div id="thumbnailContainer">
<media-thumbnail-preview></media-thumbnail-preview>
</div>
`;
class MediaTimeRange extends MediaChromeRange {
static get observedAttributes() {
return [
...super.observedAttributes,
'thumbnails',
MediaUIAttributes.MEDIA_DURATION,
MediaUIAttributes.MEDIA_SEEKABLE,
MediaUIAttributes.MEDIA_CURRENT_TIME,
MediaUIAttributes.MEDIA_PREVIEW_IMAGE,
MediaUIAttributes.MEDIA_BUFFERED,
];
}
constructor() {
super();
this.shadowRoot.appendChild(template.content.cloneNode(true));
this.range.addEventListener('input', () => {
const newTime = this.range.value;
const detail = newTime;
const evt = new window.CustomEvent(MediaUIEvents.MEDIA_SEEK_REQUEST, {
composed: true,
bubbles: true,
detail,
});
this.dispatchEvent(evt);
});
// Come back to this feature
// this.playIfNotReady = e => {
// this.range.removeEventListener('change', this.playIfNotReady);
// const media = this.media;
// media.play().then(this.setMediaTimeWithRange);
// };
this.enableThumbnails();
}
connectedCallback() {
this.range.setAttribute('aria-label', nouns.SEEK());
super.connectedCallback();
}
attributeChangedCallback(attrName, oldValue, newValue) {
if (attrName === MediaUIAttributes.MEDIA_CURRENT_TIME) {
this.range.value = this.mediaCurrentTime;
updateAriaValueText(this);
this.updateBar();
}
if (attrName === MediaUIAttributes.MEDIA_DURATION) {
// Since our range's step is 1, floor the max value to ensure reasonable rendering
this.range.max = Math.floor(this.mediaSeekableEnd ?? this.mediaDuration ?? 1000);
updateAriaValueText(this);
this.updateBar();
}
if (attrName === MediaUIAttributes.MEDIA_SEEKABLE) {
this.range.min = this.mediaSeekableStart ?? 0;
// Since our range's step is 1, floor the max value to ensure reasonable rendering
this.range.max = Math.floor(this.mediaSeekableEnd ?? this.mediaDuration ?? 1000);
updateAriaValueText(this);
this.updateBar();
}
if (attrName === MediaUIAttributes.MEDIA_BUFFERED) {
this.updateBar();
}
super.attributeChangedCallback(attrName, oldValue, newValue);
}
get mediaDuration() {
const attrVal = this.getAttribute(MediaUIAttributes.MEDIA_DURATION);
return attrVal != null ? +attrVal : undefined;
}
get mediaCurrentTime() {
const attrVal = this.getAttribute(MediaUIAttributes.MEDIA_CURRENT_TIME);
return attrVal != null ? +attrVal : undefined;
}
get mediaBuffered() {
const buffered = this.getAttribute(MediaUIAttributes.MEDIA_BUFFERED);
if (!buffered) return [];
return buffered.split(' ').map((timePair) => timePair.split(':').map(timeStr => +timeStr));
}
get mediaSeekable() {
const seekable = this.getAttribute(MediaUIAttributes.MEDIA_SEEKABLE);
if (!seekable) return undefined;
// Only currently supports a single, contiguous seekable range (CJP)
return seekable.split(':');
}
get mediaSeekableEnd() {
const [, end] = this.mediaSeekable ?? [];
return end;
}
get mediaSeekableStart() {
const [start] = this.mediaSeekable ?? [];
return start;
}
/* Add a buffered progress bar */
getBarColors() {
let colorsArray = super.getBarColors();
const { range } = this;
// Use mediaCurrentTime instead of range.value for precision (CJP)
const currentTime = this.mediaCurrentTime;
const relativeMax = range.max - range.min;
const buffered = this.mediaBuffered;
if (!buffered.length || !Number.isFinite(relativeMax) || relativeMax <= 0) {
return colorsArray;
}
// Find the buffered range that "contains" the current time and get its end. If none, just assume the
// start of the media timeline/range.min for visualization purposes.
const [, bufferedEnd = range.min] = buffered.find(([start, end]) => start <= currentTime && currentTime <= end) ?? [];
const relativeBufferedEnd = bufferedEnd - range.min;
const buffPercent = (relativeBufferedEnd / relativeMax) * 100;
colorsArray.splice(1, 0, [
'var(--media-time-buffered-color, #777)',
buffPercent,
]);
return colorsArray;
}
enableThumbnails() {
this.thumbnailPreview = this.shadowRoot.querySelector(
'media-thumbnail-preview'
);
const thumbnailContainer = this.shadowRoot.querySelector(
'#thumbnailContainer'
);
thumbnailContainer.classList.add('enabled');
let pointermoveHandler;
const trackMouse = () => {
pointermoveHandler = (evt) => {
const duration = +this.getAttribute(MediaUIAttributes.MEDIA_DURATION);
// If no duration we can't calculate which time to show
if (!duration) return;
// Get mouse position percent
const rangeRect = this.range.getBoundingClientRect();
let mousePercent = (evt.clientX - rangeRect.left) / rangeRect.width;
// Lock between 0 and 1
mousePercent = Math.max(0, Math.min(1, mousePercent));
// Get thumbnail center position
const leftPadding = rangeRect.left - this.getBoundingClientRect().left;
const thumbnailOffset = leftPadding + mousePercent * rangeRect.width;
const thumbStyle = getComputedStyle(this.thumbnailPreview);
const thumbMinWidth = parseInt(
thumbStyle.getPropertyValue('--thumb-preview-min-width')
);
const thumbMaxWidth = parseInt(
thumbStyle.getPropertyValue('--thumb-preview-max-width')
);
const thumbMinHeight = parseInt(
thumbStyle.getPropertyValue('--thumb-preview-min-height')
);
const thumbMaxHeight = parseInt(
thumbStyle.getPropertyValue('--thumb-preview-max-height')
);
// Use client dimensions instead of offset dimensions to exclude borders.
const { clientWidth, clientHeight } = this.thumbnailPreview;
const maxThumbRatio = Math.min(
thumbMaxWidth / clientWidth,
thumbMaxHeight / clientHeight
);
const minThumbRatio = Math.max(
thumbMinWidth / clientWidth,
thumbMinHeight / clientHeight
);
const thumbnailLeft = thumbnailOffset - clientWidth / 2;
// maxThumbRatio scales down and takes priority, minThumbRatio scales up.
const thumbScale =
maxThumbRatio < 1
? maxThumbRatio
: minThumbRatio > 1
? minThumbRatio
: 1;
this.thumbnailPreview.style.transform = `translateX(${thumbnailLeft}px) scale(${thumbScale})`;
let thumbBorderWidth = parseInt(
thumbStyle.getPropertyValue('--media-thumbnail-preview-border')
);
if (Number.isNaN(thumbBorderWidth)) {
thumbBorderWidth = parseInt(
thumbStyle.getPropertyValue('--thumb-preview-border')
);
}
this.thumbnailPreview.style.borderWidth = `${Math.round(
thumbBorderWidth / thumbScale
)}px`;
this.thumbnailPreview.style.borderRadius = `${Math.round(
thumbBorderWidth / thumbScale
)}px`;
const detail = mousePercent * duration;
const mediaPreviewEvt = new window.CustomEvent(
MediaUIEvents.MEDIA_PREVIEW_REQUEST,
{ composed: true, bubbles: true, detail }
);
this.dispatchEvent(mediaPreviewEvt);
};
window.addEventListener('pointermove', pointermoveHandler, false);
};
const stopTrackingMouse = () => {
window.removeEventListener('pointermove', pointermoveHandler);
const endEvt = new window.CustomEvent(
MediaUIEvents.MEDIA_PREVIEW_REQUEST,
{composed: true, bubbles: true, detail: null}
);
this.dispatchEvent(endEvt);
};
// Trigger when the mouse moves over the range
let rangeEntered = false;
let rangepointermoveHander = (evt) => {
const mediaDurationStr = this.getAttribute(
MediaUIAttributes.MEDIA_DURATION
);
if (!rangeEntered && mediaDurationStr) {
rangeEntered = true;
trackMouse();
let offRangeHandler = (evt) => {
if (!evt.composedPath().includes(this)) {
window.removeEventListener('pointermove', offRangeHandler);
rangeEntered = false;
stopTrackingMouse();
}
};
window.addEventListener('pointermove', offRangeHandler, false);
}
};
this.addEventListener('pointermove', rangepointermoveHander, false);
}
}
defineCustomElement('media-time-range', MediaTimeRange);
export default MediaTimeRange;
| 33.858434 | 122 | 0.656614 |
fbcddaf9a0f6e70d36d997f1743f2edd5bf5c01e | 581 | h | C | TerrainApps/vtocx/GLThread.h | nakijun/vtp | 7bd2b2abd3a3f778a32ba30be099cfba9b892922 | [
"MIT"
] | 4 | 2019-02-08T13:51:26.000Z | 2021-12-07T13:11:06.000Z | TerrainApps/vtocx/GLThread.h | nakijun/vtp | 7bd2b2abd3a3f778a32ba30be099cfba9b892922 | [
"MIT"
] | null | null | null | TerrainApps/vtocx/GLThread.h | nakijun/vtp | 7bd2b2abd3a3f778a32ba30be099cfba9b892922 | [
"MIT"
] | 7 | 2017-12-03T10:13:17.000Z | 2022-03-29T09:51:18.000Z | #pragma once
#include <OpenThreads/Thread>
#include <OpenThreads/Mutex>
template<class CViewer>
class CGLThread : public OpenThreads::Thread, public OpenThreads::Mutex
{
public:
CGLThread(CViewer* viewer) : Thread(), _viewer(viewer), _resize(false) {}
void resizeViewport(const long w, const long h)
{
_w = w;
_h = h;
_resize = true;
}
void run()
{
while(_viewer->rendering())
{
if(_resize)
{
_viewer->resize(_w, _h);
_resize = false;
}
_viewer->frame();
}
}
private:
CViewer* _viewer;
bool _rendering;
bool _resize;
int _w, _h;
};
| 14.897436 | 74 | 0.655766 |
7815b4074a85bdbda3e58127c5f50a2314fe465f | 283 | sql | SQL | src/AppEstimatorDb/Tables/TechnicalFactor.sql | anibalvelarde/AppEstimator | 1eeecfa1879eae15913bac4443b2f77a251f5a23 | [
"MIT"
] | null | null | null | src/AppEstimatorDb/Tables/TechnicalFactor.sql | anibalvelarde/AppEstimator | 1eeecfa1879eae15913bac4443b2f77a251f5a23 | [
"MIT"
] | null | null | null | src/AppEstimatorDb/Tables/TechnicalFactor.sql | anibalvelarde/AppEstimator | 1eeecfa1879eae15913bac4443b2f77a251f5a23 | [
"MIT"
] | null | null | null | CREATE TABLE [dbo].[TechnicalFactor]
(
[TechnicalFactorId] INT IDENTITY(1,1) NOT NULL,
Name NVARCHAR(50) NOT NULL,
[Description] NVARCHAR(500) NOT NULL,
Multiplier FLOAT NOT NULL,
ts rowversion NOT NULL,
PRIMARY KEY CLUSTERED ([TechnicalFactorId])
);
| 28.3 | 51 | 0.681979 |
8cfe9f44f4a951d8870779a92d06cae3daa45e9e | 1,926 | swift | Swift | mcts-checkers/CLI-Functions.swift | Z-Foster/ai-checkers | 0e9d7152a925a162fffbd963eca7ad73ef87c73d | [
"MIT"
] | null | null | null | mcts-checkers/CLI-Functions.swift | Z-Foster/ai-checkers | 0e9d7152a925a162fffbd963eca7ad73ef87c73d | [
"MIT"
] | null | null | null | mcts-checkers/CLI-Functions.swift | Z-Foster/ai-checkers | 0e9d7152a925a162fffbd963eca7ad73ef87c73d | [
"MIT"
] | null | null | null | //
// CLI-Functions.swift
// mcts-checkers
//
// Created by Zach Foster on 6/23/16.
// Copyright © 2016 Zach Foster. All rights reserved.
//
import Foundation
func prompt(playerNumber: Int) {
print("What AI would you like player \(playerNumber) to use?")
print("1. Pure Random")
print("2. Flat Monte-Carlo Tree Search")
print("3. UCT Monte-Carlo Tree Search")
}
func aiSelection(inout player: Player) {
if let answer = readLine(stripNewline: true) {
switch answer {
case "1":
player.type = AIType.RandomMove
case "2":
player.type = AIType.FlatMCTS
player.iterations = iterationSelection()
case "3":
player.type = AIType.UCT
player.iterations = iterationSelection()
default:
print("Please enter 1, 2, or 3.")
aiSelection(&player)
}
} else {
print("Please enter 1, 2, or 3.")
aiSelection(&player)
}
}
func iterationSelection() -> Int? {
print("How many iterations of the MCTS would you like to perform? (> 0)")
if let answer = readLine(stripNewline: true) {
if let number = Int(answer) {
if number > 0 {
return number
} else {
print("Number must be greater than 0.")
iterationSelection()
}
} else {
print("Please enter a number.")
iterationSelection()
}
} else {
print("Please enter a number.")
iterationSelection()
}
return nil
}
func numberOfGamesSelection() -> Int? {
print("How many games would you like to simulate? ( > 0 )")
if let answer = readLine(stripNewline: true) {
if let number = Int(answer) {
if number > 0 {
return number
} else {
print("Number must be greater than 0.")
numberOfGamesSelection()
}
} else {
print("Please enter a number.")
numberOfGamesSelection()
}
} else {
print("Please enter a number.")
numberOfGamesSelection()
}
return nil
}
| 24.075 | 75 | 0.615784 |
91bc5698f2c78a8b0d53f94e3712a8ae4960c557 | 831 | sql | SQL | loja/src/main/resources/db/scripts/endereco.sql | juancanuto/lab4-finawork | 52b5e9053118bd60a48c9232c806a4f5530ff950 | [
"MIT"
] | null | null | null | loja/src/main/resources/db/scripts/endereco.sql | juancanuto/lab4-finawork | 52b5e9053118bd60a48c9232c806a4f5530ff950 | [
"MIT"
] | null | null | null | loja/src/main/resources/db/scripts/endereco.sql | juancanuto/lab4-finawork | 52b5e9053118bd60a48c9232c806a4f5530ff950 | [
"MIT"
] | null | null | null | --liquibase formatted sql
--changeset adriano:201810210022
--comment: Criando a estrutura da tabela ENDERECO
CREATE TABLE IF NOT EXISTS `lab04db`.`endereco` (
`id` INT(11) NOT NULL COMMENT 'Identificador da tabela endereco.',
`rua` VARCHAR(45) NULL DEFAULT NULL COMMENT 'Nome da rua.',
`numero` INT(10) NULL DEFAULT NULL COMMENT 'Numero da residência',
`bairro` VARCHAR(45) NULL DEFAULT NULL COMMENT 'Bairro da residência.',
`cidade` VARCHAR(45) NULL DEFAULT NULL COMMENT 'Cidade da residência',
`estado` INT(10) NULL DEFAULT NULL COMMENT 'Código referente ao estado federativo da residência',
`cep` INT(8) NOT NULL COMMENT 'Número do código de endereçamento postal.',
PRIMARY KEY (`id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci
--rollback DELETE FROM ENDERECO; | 48.882353 | 100 | 0.740072 |
2610cd92dbd23fc687d2189ef2bdfb48190050dd | 147 | asm | Assembly | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/fzero.lzh/fzero/calculate.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/fzero.lzh/fzero/calculate.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/NEWS.7z/NEWS/テープリストア/NEWS_05/NEWS_05.tar/home/kimura/fzero.lzh/fzero/calculate.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | Name: calculate.asm
Type: file
Size: 31108
Last-Modified: '1993-07-20T07:13:20Z'
SHA-1: FF4842C6FC8E8BD7BA5A5A7A61947DEE32B539BB
Description: null
| 21 | 47 | 0.816327 |
62096156e71ed29e999bf6739ca555c6b54b5a4b | 276 | asm | Assembly | engine/items/print_item_description.asm | AtmaBuster/pokeplat-gen2 | fa83b2e75575949b8f72cb2c48f7a1042e97f70f | [
"blessing"
] | 6 | 2021-06-19T06:41:19.000Z | 2022-02-15T17:12:33.000Z | engine/items/print_item_description.asm | AtmaBuster/pokeplat-gen2-old | 01e42c55db5408d72d89133dc84a46c699d849ad | [
"blessing"
] | 1 | 2020-12-16T01:11:20.000Z | 2020-12-16T22:53:56.000Z | engine/items/print_item_description.asm | AtmaBuster/pokeplat-gen2-old | 01e42c55db5408d72d89133dc84a46c699d849ad | [
"blessing"
] | 3 | 2021-01-15T18:45:40.000Z | 2021-10-16T03:35:27.000Z | PrintItemDescription:
; Print the description for item [wCurSpecies] at de.
push de
ld hl, ItemDescriptions
ld a, [wCurSpecies]
dec a
ld c, a
ld b, 0
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
pop hl
jp PlaceString
INCLUDE "data/items/descriptions.asm"
| 14.526316 | 53 | 0.692029 |
7716daf4e2138e78a30f1d4d1fb427ee7386a31b | 1,357 | lua | Lua | lua/autorun/server/autorestart.lua | s980845/misc | a32b5c97737b5a97896e5f9aa78254f8da70cf31 | [
"MIT"
] | 2 | 2018-10-14T14:15:05.000Z | 2019-01-07T03:10:40.000Z | lua/autorun/server/autorestart.lua | s980845/misc | a32b5c97737b5a97896e5f9aa78254f8da70cf31 | [
"MIT"
] | 27 | 2017-10-28T01:18:38.000Z | 2020-01-24T00:18:28.000Z | lua/autorun/server/autorestart.lua | s980845/misc | a32b5c97737b5a97896e5f9aa78254f8da70cf31 | [
"MIT"
] | 13 | 2017-10-30T11:41:49.000Z | 2019-08-20T02:17:37.000Z |
hook.Add("MingebanInitialized", "autorestart", function()
local autorestarting = false
local function abort()
mingeban.utils.print(mingeban.colors.Cyan, "Restart cancelled, players are on")
game.ConsoleCommand("mingeban abort\n")
autorestarting = false
end
timer.Create("autorestart", 60, 0, function()
if (CurTime() / 60 / 60) >= 8 then
if player.GetCount() < 1 and not mingeban.IsCountdownActive() and not autorestarting then
mingeban.utils.print(mingeban.colors.Cyan, "Automatic restart, CurTime is imprecise")
game.ConsoleCommand("mingeban restart 30\n")
autorestarting = true
elseif player.GetCount() > 0 and mingeban.IsCountdownActive() and autorestarting then
abort()
end
end
end)
hook.Add("ShutDown", "autorestart", function()
if not DiscordRelay or not autorestarting then return end
local msg = {
{
author = {
name = GetHostName(),
url = "https://re-dream.org/join",
icon_url = "https://re-dream.org/media/redream-logo.png"
},
description = "is autorestarting, was playing `" .. game.GetMap() .. "`.",
color = DiscordRelay.HexColors.Red
}
}
DiscordRelay.SendToDiscordRaw(nil, nil, msg)
autorestarting = false
end)
hook.Add("PlayerConnect", "autorestart", function()
if mingeban.IsCountdownActive() and autorestarting then
abort()
end
end)
end)
| 29.5 | 92 | 0.6986 |
c14995281badf0c208ba581c744bb84bac43013a | 2,199 | lua | Lua | luerl/4974fe23fed6df1bbf2deb5fba935b6f.lua | spacebeam/lovecraft | 9c608004475a84c3ea61d697740cb028f6810e8f | [
"Apache-2.0"
] | 2 | 2019-01-21T22:15:44.000Z | 2019-03-06T06:25:23.000Z | luerl/4974fe23fed6df1bbf2deb5fba935b6f.lua | spacebeam/lovecraft | 9c608004475a84c3ea61d697740cb028f6810e8f | [
"Apache-2.0"
] | 25 | 2019-04-23T13:36:17.000Z | 2020-08-19T19:25:11.000Z | luerl/4974fe23fed6df1bbf2deb5fba935b6f.lua | spacebeam/spaceboard | 9c608004475a84c3ea61d697740cb028f6810e8f | [
"Apache-2.0"
] | null | null | null | -- The Valkyrie is a Terran air-to-air unit that is available to be built
-- from a Starport once both an Armory and a Control Tower are on the field.
-- Our unit function table
local this_unit = {}
-- The standard local variables
-- Where we are and fast we move
local x, y, dx, dy
-- Our name
local name = "Terran_Valkyrie"
-- Our color
local color = "blue"
-- Our type
local type = "unit"
-- Size of a clock tick msec
local tick
-- This is me
local me = unit.self()
-- and now for something completely different
local label = "large_air"
local hitpoints,shield = 200,2
local ground_damage,air_damage = 0,8
local ground_cooldown, air_cooldown = 0,2.688
local ground_range, air_range = 0,6
local sight = 8
local supply = 3
local cooldown = 32
local mineral = 250
local gas = 125
-- The size of the region
local xsize,ysize = region.size()
-- The unit interface.
function this_unit.start() end
function this_unit.get_position() return x,y end
function this_unit.set_position(a1, a2) x,y = a1,a2 end
function this_unit.get_speed() return dx,dy end
function this_unit.set_speed(a1, a2) dx,dy = a1,a2 end
function this_unit.set_tick(a1) tick = a1 end
local function move_xy_bounce(x, y, dx, dy, valid_x, valid_y)
local nx = x + dx
local ny = y + dy
-- Bounce off the edge
if (not valid_x(nx)) then
nx = x - dx
dx = -dx
end
-- Bounce off the edge
if (not valid_y(ny)) then
ny = y - dy
dy = -dy
end
return nx, ny, dx, dy
end
local function move(x, y, dx, dy)
local nx,ny,ndx,ndy = move_xy_bounce(x, y, dx, dy,
region.valid_x, region.valid_y)
-- Where we were and where we are now.
local osx,osy = region.sector(x, y)
local nsx,nsy = region.sector(nx, ny)
if (osx ~= nsx or osy ~= nsy) then
-- In new sector, move us to the right sector
region.rem_sector(x, y)
region.add_sector(nx, ny)
end
return nx,ny,ndx,ndy
end
function this_unit.tick()
x,y,dx,dy = move(x, y, dx, dy)
end
function this_unit.attack()
-- The unit has been zapped and will die
region.rem_sector(x, y)
end
-- Return the unit table
return this_unit
| 23.645161 | 76 | 0.6603 |
fb4f3806be24648d240350783cae1627ff940e85 | 534 | java | Java | src/p344/Solution2.java | GloryC/leetcode | b0c88b0f9359600d5c4ad1910f77efd1ca9406e8 | [
"Apache-2.0"
] | 1 | 2021-02-20T05:49:30.000Z | 2021-02-20T05:49:30.000Z | src/p344/Solution2.java | GloryC/leetcode | b0c88b0f9359600d5c4ad1910f77efd1ca9406e8 | [
"Apache-2.0"
] | null | null | null | src/p344/Solution2.java | GloryC/leetcode | b0c88b0f9359600d5c4ad1910f77efd1ca9406e8 | [
"Apache-2.0"
] | null | null | null | package p344;
/**
* @author Glory
* @date 2019/12/11 9:56
*/
public class Solution2 {
public void reverseString(char[] s) {
int n = s.length;
for (int i = 0; i < n / 2; i++) {
s[i] ^= s[n - i - 1];
s[n - i - 1] ^= s[i];
s[i] ^= s[n - i - 1];
}
}
public static void main(String[] args) {
char[] s = {'h', 'e', 'l', 'l', 'o'};
Solution2 solution2 = new Solution2();
solution2.reverseString(s);
System.out.println(s);
}
}
| 20.538462 | 46 | 0.441948 |
6daa483982a8f2cc2a7c0dec8c1df657ac726d29 | 902 | kt | Kotlin | features/yebi-feature-user/src/main/kotlin/UserFeature.kt | elouyi/yebi | d4663fcbb662bfad8e79fd1a0d10debee755358e | [
"MIT"
] | null | null | null | features/yebi-feature-user/src/main/kotlin/UserFeature.kt | elouyi/yebi | d4663fcbb662bfad8e79fd1a0d10debee755358e | [
"MIT"
] | null | null | null | features/yebi-feature-user/src/main/kotlin/UserFeature.kt | elouyi/yebi | d4663fcbb662bfad8e79fd1a0d10debee755358e | [
"MIT"
] | null | null | null | package com.elouyi.yebi.feature.user
import com.elouyi.yebi.YebiBot
import com.elouyi.yebi.feature.AttributeKey
import com.elouyi.yebi.feature.YebiFeature
import com.elouyi.yebi.feature.user.internal.UserAPIImpl
public class UserFeature internal constructor(internal val config: Config){
private lateinit var scope: YebiBot
internal lateinit var userAPI: UserAPI
public class Config {
}
public companion object Feature : YebiFeature<Config, UserFeature> {
override val key: AttributeKey<UserFeature> = AttributeKey("UserFeature")
override fun prepare(block: Config.() -> Unit): UserFeature {
val config = Config().apply(block)
return UserFeature(config)
}
override fun install(feature: UserFeature, scope: YebiBot) {
feature.scope = scope
feature.userAPI = UserAPIImpl(scope)
}
}
} | 29.096774 | 81 | 0.696231 |
ab6fd9fb1131a7b4742a9836698cb9f1f4d8a8d6 | 3,183 | swift | Swift | HackerNews/Classes/PresentationLayer/Settings/Modules/Theme/View/ThemeViewController.swift | nik3212/HackerNews | 42c88898397506b51f2b43f9ad9dca32e2334078 | [
"MIT"
] | 15 | 2019-11-17T06:59:14.000Z | 2022-01-06T05:40:58.000Z | HackerNews/Classes/PresentationLayer/Settings/Modules/Theme/View/ThemeViewController.swift | nik3212/HackerNews | 42c88898397506b51f2b43f9ad9dca32e2334078 | [
"MIT"
] | null | null | null | HackerNews/Classes/PresentationLayer/Settings/Modules/Theme/View/ThemeViewController.swift | nik3212/HackerNews | 42c88898397506b51f2b43f9ad9dca32e2334078 | [
"MIT"
] | 2 | 2020-07-21T12:26:27.000Z | 2020-08-27T12:41:39.000Z | //
// ThemeViewController.swift
// HackerNews
//
// Created by Nikita Vasilev on 27/03/2020.
// Copyright © 2020 Nikita Vasilev. All rights reserved.
//
import UIKit
final class ThemeViewController: UIViewController {
// MARK: Outlets
@IBOutlet private var tableView: UITableView!
// MARK: Public Properties
var output: ThemeViewOutput!
// MARK: Private Properties
private var theme: Theme?
// MARK: Life Cycle
override func viewDidLoad() {
super.viewDidLoad()
if #available(iOS 11.0, *) {
navigationItem.largeTitleDisplayMode = .never
}
view.accessibilityIdentifier = "themeView"
tableView.isAccessibilityElement = true
tableView.accessibilityIdentifier = "themesTableView"
tableView.register(ThemeSelectableTableViewCell.self)
tableView.tableFooterView = UIView()
output.viewIsReady()
}
}
// MARK: ThemeViewInput
extension ThemeViewController: ThemeViewInput {
func setupInitialState(title: String, theme: Theme) {
self.title = title
self.theme = theme
update(theme: theme)
}
func reloadData() {
tableView.reloadData()
}
func update(theme: Theme) {
self.theme = theme
theme.tableView.apply(to: tableView)
theme.view.apply(to: view)
}
}
// MARK: UITableViewDelegate
extension ThemeViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
output.didSelectRow(at: indexPath)
tableView.deselectRow(at: indexPath, animated: true)
}
func tableView(_ tableView: UITableView, didDeselectRowAt indexPath: IndexPath) {
}
}
// MARK: UITableViewDataSource
extension ThemeViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return output.titleForHeader(in: section)
}
func numberOfSections(in tableView: UITableView) -> Int {
return output.numberOfSections()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return output.numberOfRows(in: section)
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: ThemeSelectableTableViewCell = tableView.dequeueReusableCell(forIndexPath: indexPath)
let model = output.getModel(for: indexPath)
cell.title = model.title
cell.accessoryType = model.isSelected ? .checkmark : .none
cell.isAccessibilityElement = true
cell.accessibilityIdentifier = String(format: "themeCell_%d_%d", indexPath.section, indexPath.row)
if let theme = theme {
cell.apply(theme: theme)
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return Metric.cellHeight
}
}
// MARK: Constants
extension ThemeViewController {
private enum Metric {
static let cellHeight: CGFloat = 48.0
}
}
| 28.675676 | 106 | 0.664153 |
5982077af085378bfea7630a4193758bbb6da220 | 9,031 | lua | Lua | resources/[FAROESTE]/[SYSTEM]/frp_posse/server.lua | gitmonox/frp_base_rd2 | b1458ee99ce968054cf3c5e87c8b22053d7b5dc4 | [
"MIT"
] | 15 | 2021-08-03T16:17:13.000Z | 2022-03-21T19:43:51.000Z | resources/[FAROESTE]/[SYSTEM]/frp_posse/server.lua | gitmonox/frp_base_rd2 | b1458ee99ce968054cf3c5e87c8b22053d7b5dc4 | [
"MIT"
] | 4 | 2021-07-30T19:38:47.000Z | 2022-02-28T14:48:33.000Z | resources/[FAROESTE]/[SYSTEM]/frp_posse/server.lua | gitmonox/frp_base_rd2 | b1458ee99ce968054cf3c5e87c8b22053d7b5dc4 | [
"MIT"
] | 16 | 2021-07-31T14:59:35.000Z | 2022-02-25T21:23:58.000Z | local Tunnel = module("_core", "lib/Tunnel")
local Proxy = module("_core", "lib/Proxy")
API = Proxy.getInterface("API")
API_DB = Proxy.getInterface("API_DB")
cAPI = Tunnel.getInterface("API")
RegisterCommand(
"bando",
function(source, args, rawCommand)
local User = API.getUserFromSource(source)
if User:isInAPosse() then
local data = {}
local Posse = API.getPosse(User:getPosseId())
for memberCharId, rank in pairs(Posse:getMembers()) do
local name = API.getNameById(memberCharId)
local isOnline = false
local UserMember = API.getUserFromCharId(memberCharId)
-- local CharLevel = UserMember:getCharacter():getLevel()
local CharLevel = 0
if UserMember ~= nil and UserMember:getCharacter():getId() == tonumber(memberCharId) then
isOnline = true
end
data[memberCharId] = {
UserID = UserMember:getId(),
rank = rank,
name = name,
level = CharLevel,
isOnline = isOnline
}
end
TriggerClientEvent("FRP:POSSE:OpenMenu", source, data, Posse:getName())
else
-- else
-- User:notify('Você não tem permissao para criar um Bando')
-- end
-- if User:getCharacter():hasGroup('donator01') then
TriggerClientEvent("FRP:POSSE:OpenCreationMenu", source)
end
end,
false
)
RegisterCommand(
"convidar",
function(source, args)
local arg = args[1]
TriggerEvent("FRP:POSSE:Invite", source, arg)
end
)
RegisterNetEvent("FRP:POSSE:checkBando")
AddEventHandler(
"FRP:POSSE:checkBando",
function()
local _source = source
local User = API.getUserFromSource(_source)
local Character = User:getCharacter()
local level = Character:getLevel()
if not User:isInAPosse() then
if level < 10 then
User:notify("Para criar um bando você precisa ter level maior que 10")
return
end
TriggerEvent("FRP:POSSE:createBando", _source)
else
TriggerClientEvent("FRP:NOTIFY:Simple", _source, "Você já está em um bando, para criar um novo deve sair do atual.", 5000)
end
end
)
RegisterNetEvent("FRP:POSSE:createBando")
AddEventHandler(
"FRP:POSSE:createBando",
function(source)
local _source = source
local PosseName = cAPI.prompt(source, "Nome do seu Bando", "")
local User = API.getUserFromSource(_source)
if PosseName == "" then
TriggerClientEvent("FRP:NOTIFY:Simple", _source, "Você não digitou um nome válido", 5000)
return
end
API.createPosse(User:getCharacter():getId(), PosseName)
TriggerClientEvent("FRP:NOTIFY:Simple", _source, "Registro do " .. PosseName .. " efetuado com Sucesso.", 5000)
end
)
RegisterNetEvent("FRP:POSSE:Invite")
AddEventHandler(
"FRP:POSSE:Invite",
function(source, targetUserId)
local _source = source
local User = API.getUserFromSource(_source)
local Character = User:getCharacter()
if not User:isInAPosse() then
User:notify("Você não está em um bando")
TriggerClientEvent("FRP:POSSE:CloseMenu", _source)
return
end
local Posse = API.getPosse(User:getPosseId())
local TargetSource = API.getUserFromUserId(parseInt(targetUserId)):getSource()
local UserTarget = API.getUserFromSource(TargetSource)
local userRank = Posse:getMemberRank(Character:getId())
if userRank == 3 then
User:notify("Somente um membro de cargo superior pode conviar para o bando")
return
end
if UserTarget == nil then
User:notify("Usuario de id " .. targetUserId .. " não está online")
return
end
if UserTarget:isInAPosse() then
User:notify("Usuario de id " .. targetUserId .. " já se encontra em um bando!")
return
end
User:notify("Você convidou o ID " .. targetUserId .. " para entrar no bando")
UserTarget:notify("Você foi convidado a entrar no bando.")
local yes = cAPI.request(TargetSource, "Convite para o Bando " .. Posse:getName() .. " ?", 30)
if yes then
UserTarget:notify("Você entrou no bando " .. Posse:getName())
Posse:addMember(UserTarget, 3)
else
User:notify("User " .. targetUserId .. " recusou o convite")
end
end
)
RegisterNetEvent("FRP:POSSE:Promote")
AddEventHandler(
"FRP:POSSE:Promote",
function(targetUserId)
local _source = source
local User = API.getUserFromSource(_source)
local TargetSource = API.getUserFromUserId(parseInt(targetUserId)):getSource()
local UserT = API.getUserFromSource(TargetSource)
if not User:isInAPosse() then
User:notify("Você não está em um bando")
TriggerClientEvent("FRP:POSSE:CloseMenu", _source)
return
end
local Character = User:getCharacter()
local TCharacter = UserT:getCharacter()
local Posse = API.getPosse(User:getPosseId())
if not Posse:isAMember(TCharacter:getId()) then
User:notify(TCharacter:getName() .. " não faz mais parte do bando")
return
end
local targetRank = Posse:getMemberRank(TCharacter:getId())
if targetRank <= 2 then
User:notify(TCharacter:getName() .. " já está no rank mais alto")
return
end
local userRank = Posse:getMemberRank(Character:getId())
if userRank <= 2 then
if userRank == targetRank then
User:notify("Somente um membro de cargo superior pode promover este membro")
return
end
Posse:promoteMember(TCharacter:getId())
Posse:notifyMembers(TCharacter:getName() .. " foi promovido no Bando!")
end
end
)
RegisterNetEvent("FRP:POSSE:Demote")
AddEventHandler(
"FRP:POSSE:Demote",
function(targetUserId)
local _source = source
local User = API.getUserFromSource(_source)
local TargetSource = API.getUserFromUserId(parseInt(targetUserId)):getSource()
local UserT = API.getUserFromSource(TargetSource)
if not User:isInAPosse() then
User:notify("Você não está em um bando")
TriggerClientEvent("FRP:POSSE:CloseMenu", _source)
return
end
local Character = User:getCharacter()
local TCharacter = UserT:getCharacter()
local Posse = API.getPosse(User:getPosseId())
if not Posse:isAMember(TCharacter:getId()) then
User:notify(TCharacter:getName() .. " não faz mais parte do bando")
return
end
local targetRank = Posse:getMemberRank(TCharacter:getId())
if targetRank == 3 then
User:notify(charName .. " já está no rank mais baixo!")
return
end
local userRank = Posse:getMemberRank(Character:getId())
if userRank <= 2 then
if userRank == targetRank then
User:notify("Somente um membro de cargo superior pode rebaixar este membro")
return
end
Posse:demoteMember(TCharacter:getId())
Posse:notifyMembers(TCharacter:getName() .. " foi rebaixado no Bando!")
end
end
)
RegisterNetEvent("FRP:POSSE:Leave")
AddEventHandler(
"FRP:POSSE:Leave",
function()
local _source = source
local User = API.getUserFromSource(_source)
if not User:isInAPosse() then
User:notify("Você não está em um bando")
TriggerClientEvent("FRP:POSSE:CloseMenu", _source)
return
end
local Character = User:getCharacter()
local Posse = API.getPosse(User:getPosseId())
Posse:removeMember(Character:getId())
Posse:notifyMembers(Character:getName() .. " saiu do bando!")
User:notify("Você saiu do bando!")
end
)
RegisterNetEvent("FRP:POSSE:Kick")
AddEventHandler(
"FRP:POSSE:Kick",
function(targetUserId)
local TargetSource = API.getUserFromUserId(parseInt(targetUserId)):getSource()
local User = API.getUserFromSource(TargetSource)
if not User:isInAPosse() then
User:notify("Você não está em um bando")
TriggerClientEvent("FRP:POSSE:CloseMenu", _source)
return
end
local Character = User:getCharacter()
local Posse = API.getPosse(User:getPosseId())
Posse:removeMember(Character:getId())
Posse:notifyMembers(Character:getName() .. " foi removido do bando!")
User:notify("Você foi removido do bando!")
end
)
| 32.485612 | 134 | 0.604806 |
b4b242891863194d209924ca24beab073bebd572 | 425 | kt | Kotlin | project-course/kotlin-smartherd/KotlinProgramming/src/loop/Main.kt | vel02/learn-kotlin-android | 7644d1911ff35fda44e45b1486bcce5d790fe7c0 | [
"MIT"
] | null | null | null | project-course/kotlin-smartherd/KotlinProgramming/src/loop/Main.kt | vel02/learn-kotlin-android | 7644d1911ff35fda44e45b1486bcce5d790fe7c0 | [
"MIT"
] | null | null | null | project-course/kotlin-smartherd/KotlinProgramming/src/loop/Main.kt | vel02/learn-kotlin-android | 7644d1911ff35fda44e45b1486bcce5d790fe7c0 | [
"MIT"
] | null | null | null | package loop
fun main(args: Array<String>) {
// LOOPS in Kotlin
// For
for (i in 1..10) {
if (i % 2 == 0)
println(i)
}
println()
// WHILE
var i = 1
while (i <= 10) {
if (i % 2 == 0)
println(i)
i++
}
println()
// DO WHILE
i = 1
do {
if (i % 2 == 0)
println(i)
i++
} while (i <= 10)
} | 12.142857 | 31 | 0.352941 |
b178c0c9595d795b0ebcb2279c1c15c677e3beed | 1,410 | h | C | Politician.h | Berdugo1994/Politicians-Election | 4ca8a475d2e16e4f77bb729bc5a137cdc54c19ef | [
"MIT"
] | null | null | null | Politician.h | Berdugo1994/Politicians-Election | 4ca8a475d2e16e4f77bb729bc5a137cdc54c19ef | [
"MIT"
] | null | null | null | Politician.h | Berdugo1994/Politicians-Election | 4ca8a475d2e16e4f77bb729bc5a137cdc54c19ef | [
"MIT"
] | null | null | null | #ifndef ASS5_POLITICIAN_H
#define ASS5_POLITICIAN_H
#include "Party.h"
#include <iostream>
#include <string>
using namespace std;
class Party;
class Politician
{
public:
Politician(const std::string& first, const std::string& last,const int& id ,const int& my_power):
first_name(first),last_name(last),ID(id),power(my_power){head_of_party="None";Party_name="Has_No_Party";};
Politician(Politician& new_p){ };
virtual void insert_to_republic_party(Party& p)=0;
virtual void insert_to_democratic_party(Party& p)=0;
virtual int primaries_power() const=0;
virtual int election_power() const=0;
friend std::ostream& operator <<(std::ostream &out, const Politician &pol){return pol.print_politician(out);}
virtual std::ostream& print_politician(std::ostream& out)const =0;
Politician(const Politician &pol){};
bool operator ==(const Politician& other)const;
void Update(const std::string& new_head,const std::string& party_name){head_of_party=new_head; Party_name=party_name;};
std::string& get_name(){return first_name;}
std::string& get_party_name(){return Party_name;}
int get_ID() const{return ID;};
virtual ~Politician(){};
protected:
std::string first_name;
std::string last_name;
int ID;
int power;
std::string Party_name;
std::string head_of_party;
};
#endif //ASS5_POLITICIAN_H
| 36.153846 | 124 | 0.704965 |
21bfed2bf97e9217dec4c319a63ea01c87bac2e5 | 4,757 | swift | Swift | workspaces/cogito-ios-app/CogitoTests/Key store/KeyStoreSpec.swift | philips-software/cogito | e84ddb4fb1e9ae95652595f3111c43eebb6e4982 | [
"MIT"
] | 17 | 2018-08-15T08:53:18.000Z | 2022-02-17T10:10:52.000Z | workspaces/cogito-ios-app/CogitoTests/Key store/KeyStoreSpec.swift | philips-software/cogito | e84ddb4fb1e9ae95652595f3111c43eebb6e4982 | [
"MIT"
] | 105 | 2018-09-21T13:42:22.000Z | 2022-02-26T21:31:51.000Z | workspaces/cogito-ios-app/CogitoTests/Key store/KeyStoreSpec.swift | philips-software/cogito | e84ddb4fb1e9ae95652595f3111c43eebb6e4982 | [
"MIT"
] | 7 | 2018-08-07T06:58:35.000Z | 2019-04-09T05:22:54.000Z | import Quick
import Nimble
import BigInt
@testable import Cogito
class KeyStoreSpec: QuickSpec {
override func spec() {
it("can be encoded and decoded") {
let keyStore = KeyStore(name: "some name", scryptN: 1, scryptP: 2)
let encoder = JSONEncoder()
var data: Data!
expect {
data = try encoder.encode(keyStore)
}.toNot(throwError())
let encoded = String(data: data, encoding: .utf8)
expect(encoded) == "{\"name\":\"some name\",\"scryptN\":1,\"scryptP\":2}"
let decoder = JSONDecoder()
var decodedKeyStore: KeyStore!
expect {
decodedKeyStore = try decoder.decode(KeyStore.self, from: data)
}.toNot(throwError())
expect(decodedKeyStore) == keyStore
}
context("using real file system") {
var keyStore: KeyStore!
beforeEach {
keyStore = KeyStore(name: "some name", scryptN: 1, scryptP: 2)
}
afterEach {
try? keyStore?.reset()
}
it("can be reset") {
expect {
try FileManager.default.createDirectory(at: keyStore.url,
withIntermediateDirectories: false,
attributes: [:])
}.toNot(throwError())
expect(FileManager.default.fileExists(atPath: keyStore.path)).to(beTrue())
expect { try keyStore.reset() }.toNot(throwError())
expect(FileManager.default.fileExists(atPath: keyStore.path)).to(beFalse())
}
}
context("given an initialized key store") {
var keyStore: KeyStore!
var keychainMock: KeychainMock!
var appPassword: AppPassword!
beforeEach {
keychainMock = KeychainMock()
appPassword = AppPassword(
keychain: keychainMock,
passwordLength: 16
)
keyStore = KeyStore(name: "testStore.keyStore")
keyStore.appPassword = appPassword
expect {
try FileManager.default.createDirectory(at: keyStore.url,
withIntermediateDirectories: false,
attributes: [:])
}.toNot(throwError())
}
afterEach {
try? keyStore.reset()
}
context("given an account") {
var identity: Identity!
beforeEach {
waitUntil(timeout: 5) { done in
keyStore.newAccount { address, error in
expect(error).to(beNil())
expect(address).toNot(beNil())
identity = Identity(
description: "test",
address: address!
)
done()
}
}
}
it("finds the account matching an identity") {
expect(keyStore.findAccount(identity: identity)).toNot(beNil())
}
it("calls key store to sign a transaction") {
let from = identity.address
let to = Address.testAddress2
let data = "some data".data(using: .utf8)!
let nonce = BigInt(1)
let gasPrice = BigInt(2)
let gasLimit = BigInt(3)
let value = BigInt(4)
let chainId = BigInt(42)
let transaction = UnsignedTransaction(
from: from,
to: to,
data: data,
nonce: nonce,
gasPrice: gasPrice,
gasLimit: gasLimit,
value: value,
chainId: chainId
)
waitUntil { done in
keyStore.sign(
transaction: transaction,
identity: identity
) { signed, error in
expect(error).to(beNil())
expect(signed).toNot(beNil())
done()
}
}
}
}
}
}
}
| 37.164063 | 95 | 0.418962 |
fdf0eea968b5eb61d04b8ff3e06dc695d516eb35 | 1,287 | lua | Lua | atom/args.lua | samuelwbaird/atom | 12d9468e11d19778d40e4411617a442dc6afba19 | [
"MIT"
] | null | null | null | atom/args.lua | samuelwbaird/atom | 12d9468e11d19778d40e4411617a442dc6afba19 | [
"MIT"
] | null | null | null | atom/args.lua | samuelwbaird/atom | 12d9468e11d19778d40e4411617a442dc6afba19 | [
"MIT"
] | null | null | null | -- some basic command line args handling
local error = error
local args = {}
local args_by_value = {}
-- begin by loading in the command line args
local function load(command_line_args, on_error)
error = on_error
for i = 1, #command_line_args do
args[i] = command_line_args[i]
end
end
local function get(name, required_or_default, validation)
if args_by_value[name] then
return args_by_value[name]
end
for i = 1, #args do
if args[i]:sub(1, #name + 2) == '--' .. name then
local key, value = args[i]:match('%-%-([^=]+)=(.+)')
if not key or not value then
error(args[i] .. 'argument should be formatted --' .. name .. '=value' )
end
table.remove(args, i)
if validation and not validation(value) then
error('invalid value ' .. value)
end
args_by_value[name] = value
return value
end
end
if required_or_default == true then
error('missing required parameter ' .. name)
elseif type(required_or_default) == 'function' then
args_by_value[name] = required_or_default()
else
args_by_value[name] = required_or_default
end
return args_by_value[name]
end
local function validate_unknown()
if #args > 0 then
error('unknown argument ' .. args[1])
end
end
return {
load = load,
get = get,
validate_unknown = validate_unknown,
} | 23.4 | 76 | 0.690754 |
331aeb6e2fbd46d9fdd79ecc88f4699a9b2df179 | 2,487 | lua | Lua | service/clustersender.lua | Ron2014/skynet-study | f13e57d11f326ec83451b4ed2fbd50d14a09bdca | [
"MIT"
] | null | null | null | service/clustersender.lua | Ron2014/skynet-study | f13e57d11f326ec83451b4ed2fbd50d14a09bdca | [
"MIT"
] | null | null | null | service/clustersender.lua | Ron2014/skynet-study | f13e57d11f326ec83451b4ed2fbd50d14a09bdca | [
"MIT"
] | null | null | null | local skynet = require "skynet"
local sc = require "skynet.socketchannel"
local socket = require "skynet.socket"
local cluster = require "skynet.cluster.core"
local channel
local session = 1
local node, nodename = ...
local command = {}
local waiting = {}
local function send_request(addr, msg, sz)
-- msg is a local pointer, cluster.packrequest will free it
local current_session = session
local request, new_session, padding = cluster.packrequest(addr, session, msg, sz)
session = new_session
local tracetag = skynet.tracetag()
if tracetag then
if tracetag:sub(1,1) ~= "(" then
-- add nodename
local newtag = string.format("(%s-%s-%d)%s", nodename, node, session, tracetag)
skynet.tracelog(tracetag, string.format("session %s", newtag))
tracetag = newtag
end
skynet.tracelog(tracetag, string.format("cluster %s", node))
channel:request(cluster.packtrace(tracetag))
end
return channel:request(request, current_session, padding)
end
local function wait()
local co = coroutine.running()
table.insert(waiting, co)
skynet.wait(co)
end
function command.req(...)
if channel == nil then
wait()
end
local ok, msg = pcall(send_request, ...)
if ok then
if type(msg) == "table" then
skynet.ret(cluster.concat(msg))
else
skynet.ret(msg)
end
else
skynet.error(msg)
skynet.response()(false)
end
end
function command.push(addr, msg, sz)
if channel == nil then
wait()
end
local request, new_session, padding = cluster.packpush(addr, session, msg, sz)
if padding then -- is multi push
session = new_session
end
channel:request(request, nil, padding)
end
local function read_response(sock)
local sz = socket.header(sock:read(2))
local msg = sock:read(sz)
return cluster.unpackresponse(msg) -- session, ok, data, padding
end
function command.changenode(host, port)
local c = sc.channel {
host = host,
port = tonumber(port),
response = read_response,
nodelay = true,
}
local succ, err = pcall(c.connect, c, true)
if channel then
channel:close()
end
if succ then
channel = c
for k, co in ipairs(waiting) do
waiting[k] = nil
skynet.wakeup(co)
end
skynet.ret(skynet.pack(nil))
else
channel = nil -- reset channel
skynet.response()(false)
end
end
skynet.start(function()
skynet.dispatch("lua", function(session , source, cmd, ...)
local f = assert(command[cmd])
f(...)
end)
end)
| 23.685714 | 83 | 0.673904 |
8195e4ce9c221843ec8805e5c3b4ba445bf5dfe9 | 4,124 | go | Go | render_test.go | arrowltd/go-render-quill | b3a51f53cbcb658a87f3b585cf66de2f276fa1bd | [
"MIT"
] | null | null | null | render_test.go | arrowltd/go-render-quill | b3a51f53cbcb658a87f3b585cf66de2f276fa1bd | [
"MIT"
] | null | null | null | render_test.go | arrowltd/go-render-quill | b3a51f53cbcb658a87f3b585cf66de2f276fa1bd | [
"MIT"
] | 1 | 2021-01-14T21:30:25.000Z | 2021-01-14T21:30:25.000Z | package quill
import (
"bytes"
"io/ioutil"
"strconv"
"testing"
)
func TestSimple(t *testing.T) {
cases := map[string]struct {
ops string
want string
}{
"empty": {
ops: `[{"insert": "\n"}]`,
want: "<p><br></p>",
},
"two paragraphs (single op)": {
ops: `[{"insert": "line1\nline2\n"}]`,
want: "<p>line1</p><p>line2</p>",
},
"blank line": {
ops: `[{"insert": "line1\n\nline3\n"}]`,
want: "<p>line1</p><p><br></p><p>line3</p>",
},
"blockquote": {
ops: `[{"insert": "bkqt"}, {"attributes": {"blockquote": true}, "insert": "\n"}]`,
want: "<blockquote>bkqt</blockquote>",
},
"color": {
ops: `[{"attributes": {"color": "#a10000"}, "insert": "colored"}, {"insert": "\n"}]`,
want: `<p><span style="color:#a10000;">colored</span></p>`,
},
"strikethrough": {
ops: `[{"attributes":{"strike":true},"insert":"striked"},{"insert":"\n"}]`,
want: "<p><s>striked</s></p>",
},
"list": {
ops: `[{"insert":"abc "},{"attributes":{"bold":true},"insert":"bld"},{"attributes":{"list":"bullet"},"insert":"\n"}]`,
want: "<ul><li>abc <strong>bld</strong></li></ul>",
},
"image": {
ops: `[{"insert":{"image":"source-url"}},{"insert":"\n"}]`,
want: `<p><img src="source-url"></p>`,
},
"image wrapped": {
ops: `[{"insert":"text "},{"insert":{"image":"source-url"}},{"insert":" more text\n"}]`,
want: `<p>text <img src="source-url"> more text</p>`,
},
"background": {
ops: `[{"insert":"abc "},{"attributes":{"background":"#66a3e0"},"insert":"bkg colored"},{"insert":" plain\n"}]`,
want: `<p>abc <span style="background-color:#66a3e0;">bkg colored</span> plain</p>`,
},
"underlined": {
ops: `[{"attributes":{"underline":true},"insert":"underlined"},{"insert":"\n"}]`,
want: "<p><u>underlined</u></p>",
},
"size": {
ops: `[{"insert":"stuff "},
{"insert":"large","attributes":{"size":"large"}},{"insert":" other "},
{"insert":"small","attributes":{"size":"small"}},{"insert":"\n"}]`,
want: `<p>stuff <span class="ql-size-large">large</span> other <span class="ql-size-small">small</span></p>`,
},
"superscript": {
ops: `[{"insert":"plain"},{"attributes":{"script":"super"},"insert":"super"},{"insert":"\n"}]`,
want: "<p>plain<sup>super</sup></p>",
},
"subscript": {
ops: `[{"insert":"plain"},{"attributes":{"script":"sub"},"insert":"sub"},{"insert":"\n"}]`,
want: "<p>plain<sub>sub</sub></p>",
},
}
for k, tc := range cases {
t.Run(k, func(t *testing.T) {
got, err := Render([]byte(tc.ops))
if err != nil {
t.Fatalf("%s", err)
}
if string(got) != tc.want {
t.Errorf("bad rendering; got: %s", got)
}
})
}
}
func TestRender(t *testing.T) {
pairNames := []string{"ops1", "nested", "ordering", "list1", "list2", "list3", "list4", "indent", "code1", "code2"}
for _, n := range pairNames {
t.Run(n, func(t *testing.T) {
ops, err := ioutil.ReadFile("./testdata/" + n + ".json")
if err != nil {
t.Fatalf("could not read %s.json; %s", n, err)
}
html, err := ioutil.ReadFile("./testdata/" + n + ".html")
if err != nil {
t.Fatalf("could not read %s.html; %s", n, err)
}
got, err := Render(ops)
if err != nil {
t.Errorf("error rendering; %v", err)
}
if !bytes.Equal(html, got) {
t.Errorf("bad rendering:\nwanted: \n%s\ngot: \n%s", html, got)
}
})
}
}
func TestClassesList(t *testing.T) {
cases := []struct {
classes []string
expect string
}{
{nil, ""},
{[]string{}, ""},
{[]string{"abc"}, ` class="abc"`},
{[]string{"abc", "ee-abcd"}, ` class="abc ee-abcd"`},
}
for i, tc := range cases {
t.Run("case_"+strconv.Itoa(i), func(t *testing.T) {
got := classesList(tc.classes)
if got != tc.expect {
t.Errorf("expected %q but got %q", tc.expect, got)
}
})
}
}
func BenchmarkRender_ops1(b *testing.B) {
bts, err := ioutil.ReadFile("./testdata/ops1.json")
if err != nil {
b.Fatalf("could not read ops file: %s", err)
}
b.ResetTimer()
for n := 0; n < b.N; n++ {
bts, err := Render(bts)
if err != nil {
b.Errorf("error rendering: %s", err)
}
_ = bts
}
}
| 26.606452 | 122 | 0.530795 |
bcafd88a83bae47a7871a61640fff568eacb2273 | 2,024 | js | JavaScript | static/js/share.js | angeal185/python-micro-twitter-clone | 254887f3935eb945ecfd253361bb3e80d600d7b8 | [
"MIT"
] | null | null | null | static/js/share.js | angeal185/python-micro-twitter-clone | 254887f3935eb945ecfd253361bb3e80d600d7b8 | [
"MIT"
] | null | null | null | static/js/share.js | angeal185/python-micro-twitter-clone | 254887f3935eb945ecfd253361bb3e80d600d7b8 | [
"MIT"
] | null | null | null | jQuery(function(){var e=jQuery('script[src*="share.js"]').attr("src"),t=function(t,o){var i=RegExp("[?&]"+t+"=([^&]*)").exec(e);return i&&decodeURIComponent(i[1].replace(/\+/g," "))||o},o=t("static","social"),i=encodeURIComponent(window.location.href),r=(window.location.hostname,escape(jQuery("title").text())),a="http://twitter.com/home?status="+r+"%20"+i,p="http://www.facebook.com/sharer.php?u="+i,d="https://plus.google.com/share?url="+i,s='<div id="socialdrawer"><span>Share<br/></span><div id="sicons"><a href="'+a+'" id="twit" title="Share on twitter"><img src="'+o+'/twitter.png" alt="Share on Twitter" width="32" height="32" /></a><a href="'+p+'" id="facebook" title="Share on Facebook"><img src="'+o+'/facebook.png" alt="Share on facebook" width="32" height="32" /></a><a href="'+d+'" id="gplus" title="Share on Google Plus"><img src="'+o+'/gplus-32.png" alt="Share on Google Plus" width="32" height="32" /></a></div></div>';jQuery("body").append(s);var h=jQuery("#socialdrawer");h.css({opacity:".7","z-index":"3000",background:"#FFF",border:"solid 1px #666","border-width":" 1px 0 0 1px",height:"20px",width:"40px",position:"fixed",bottom:"0",right:"0",padding:"2px 5px",overflow:"hidden","-webkit-border-top-left-radius":" 12px","-moz-border-radius-topleft":" 12px","border-top-left-radius":" 12px","-moz-box-shadow":" -3px -3px 3px rgba(0,0,0,0.5)","-webkit-box-shadow":" -3px -3px 3px rgba(0,0,0,0.5)","box-shadow":" -3px -3px 3px rgba(0,0,0,0.5)"}),jQuery("#socialdrawer a").css({"float":"left",width:"32px",margin:"3px 2px 2px 2px",padding:"0",cursor:"pointer"}),jQuery("#socialdrawer span").css({"float":"left",margin:"2px 3px","text-shadow":" 1px 1px 1px #FFF",color:"#444","font-size":"12px","line-height":"1em"}),jQuery("#socialdrawer img").hide(),h.click(function(){jQuery(this).animate({height:"40px",width:"160px",opacity:.95},300),jQuery("#socialdrawer img").show()}),h.mouseleave(function(){return h.animate({height:"20px",width:"40px",opacity:.7},300),jQuery("#socialdrawer img").hide(),!1})}); | 2,024 | 2,024 | 0.657609 |
9ab40088a7abff08958f2375daa140803ef1a587 | 271 | swift | Swift | Sources/Core/Mixins/ViewRecyclerMixin.swift | Appsaurus/UIKitBase | e369195961e181700930c3d3934490d906e644a7 | [
"MIT"
] | null | null | null | Sources/Core/Mixins/ViewRecyclerMixin.swift | Appsaurus/UIKitBase | e369195961e181700930c3d3934490d906e644a7 | [
"MIT"
] | null | null | null | Sources/Core/Mixins/ViewRecyclerMixin.swift | Appsaurus/UIKitBase | e369195961e181700930c3d3934490d906e644a7 | [
"MIT"
] | null | null | null | //
// ViewRecyclerMixin.swift
// UIKitBase
//
// Created by Brian Strobach on 12/3/18.
//
import UIKitMixinable
public class ViewRecyclerMixin: UIViewControllerMixin<ViewRecycler> {
override open func viewDidLoad() {
mixable?.registerReusables()
}
}
| 18.066667 | 69 | 0.708487 |
22e8fb5859872d629c50140e5f55a9a4caf6354a | 570 | h | C | ImportantExample/cuteReportView/cutereport/src/widgets/widgets/emptydialog.h | xiaohaijin/Qt | 54d961c6a8123d8e4daf405b7996aba4be9ab7ed | [
"MIT"
] | 3 | 2018-12-24T19:35:52.000Z | 2022-02-04T14:45:59.000Z | ImportantExample/CuteReport/src/widgets/widgets/emptydialog.h | xiaohaijin/Qt | 54d961c6a8123d8e4daf405b7996aba4be9ab7ed | [
"MIT"
] | null | null | null | ImportantExample/CuteReport/src/widgets/widgets/emptydialog.h | xiaohaijin/Qt | 54d961c6a8123d8e4daf405b7996aba4be9ab7ed | [
"MIT"
] | 1 | 2019-05-09T02:42:40.000Z | 2019-05-09T02:42:40.000Z | #ifndef EMPTYDIALOG_H
#define EMPTYDIALOG_H
#include "widgets_export.h"
#include <QDialog>
namespace Ui {
class EmptyDialog;
}
class WIDGET_EXPORTS EmptyDialog : public QDialog
{
Q_OBJECT
public:
explicit EmptyDialog(QWidget *parent = 0);
~EmptyDialog();
void setWidget(QWidget * widget);
void setHelperWidget(QWidget * widget);
public slots:
void slotAccept();
void slotReject();
private:
void keyPressEvent(QKeyEvent * event);
Ui::EmptyDialog *ui;
bool m_helperWidget;
QWidget *m_widget;
};
#endif // EMPTYDIALOG_H
| 16.285714 | 49 | 0.707018 |
61618c6d8b5e3b9a3f51a49ad224c1ee0aa09281 | 1,821 | css | CSS | static/css/base.css | tjdolan121/newspaper_proj | a46890f84cbf93fb4a74b277a78b3ca8b004e095 | [
"MIT"
] | null | null | null | static/css/base.css | tjdolan121/newspaper_proj | a46890f84cbf93fb4a74b277a78b3ca8b004e095 | [
"MIT"
] | 1 | 2019-01-10T11:19:06.000Z | 2019-01-10T11:19:57.000Z | static/css/base.css | tjdolan121/newspaper_proj | a46890f84cbf93fb4a74b277a78b3ca8b004e095 | [
"MIT"
] | null | null | null | h1, h2, h3, h4, h5 {
font-family: 'Bungee', cursive;
color: #f1f1ef
}
h6 {
font-family: 'Bungee', cursive;
color: #222222;
text-align: center;
}
p {
font-family: 'Lato', sans-serif;
}
body {
background-image: url(../img/wavy-dots.png);
}
li {
font-family: 'Lato', sans-serif;
}
.page-title {
color: #212529;
}
.custom-1 {
color: #212529;
text-decoration: none;
}
.custom-1:hover {
color: #212529;
}
.custom-2 {
text-align: center;
}
.custom-4 {
color: #f1f1ef;
font-family: 'Bungee', cursive;
}
.article-attributes {
font-family: 'Lato', sans-serif;
}
.art-display {
text-decoration: underline;
}
.btn {
background-color: #66b9bf;
outline: none !important;
}
.btn:hover {
background-color: #54dadf;
}
.entrance-link {
font-family: 'Bungee', cursive;
color: #f1f1ef;
}
.card {
text-align: center;
}
.card-header {
font-family: 'Lato', sans-serif;
background-color: #2a2a2a;
color: #f1f1ef;
}
.card-body {
text-align: center;
font-family: 'Lato', sans-serif;
background-color: #f1f1ef;
}
.card-footer {
text-align: left;
font-family: 'Lato', sans-serif;
background-color: #f1f1ef;
}
.list-group {
text-align: left;
}
.jumbotron {
background-image: url('/static/img/barbell.jpg');
background-size: cover;
background-position-y: bottom;
height: 400px;
width: auto;
margin-top: 0;
text-align: center;
}
.jumbotron h1 {
font-family: 'Bungee', cursive;
}
.jumbotron p {
font-family: 'Lato', sans-serif;
font-style: oblique;
}
.pagination {
text-align: center;
margin-bottom: 20px;
}
.custom-5 {
text-align: center !important;
}
.page-links {
text-align: center;
}
.footer {
background-color: #f1f1ef !important;
}
| 14.007692 | 53 | 0.60626 |
41110591a723977f043a65f676aaf5eaa5293c1f | 838 | h | C | EnginePractice/src/Main/Window.h | Ivaylo-Kirov/eng-practice | 1e0fbc321e873aa5a2c95b0cb3e846274b7140d6 | [
"Apache-2.0"
] | null | null | null | EnginePractice/src/Main/Window.h | Ivaylo-Kirov/eng-practice | 1e0fbc321e873aa5a2c95b0cb3e846274b7140d6 | [
"Apache-2.0"
] | null | null | null | EnginePractice/src/Main/Window.h | Ivaylo-Kirov/eng-practice | 1e0fbc321e873aa5a2c95b0cb3e846274b7140d6 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include "eppch.h"
#include "Main/Core.h"
#include "Main/Events/Event.h"
namespace EnginePractice {
struct WindowProps {
std::string Title;
unsigned int Width;
unsigned int Height;
WindowProps(const std::string& title = "EP Engine", unsigned int width = 1280, unsigned int height = 720)
: Title(title)
, Width(width)
, Height(height)
{ }
};
class EP_API Window {
public:
using EventCallbackFn = std::function<void(Event&)>;
virtual ~Window() {}
virtual void OnUpdate() = 0;
virtual unsigned int GetWidth() const = 0;
virtual unsigned int GetHeight() const = 0;
virtual void SetEventCallback(const EventCallbackFn& callback) = 0;
virtual void SetVSync(bool enabled) = 0;
virtual bool IsVSync() const = 0;
static Window* Create(const WindowProps& props = WindowProps());
};
} | 22.052632 | 107 | 0.693317 |
8f0b4f4f6fe7173ede44cfaca8dbc9c4c3a02c28 | 3,106 | java | Java | src/no/geosoft/common/geometry/spline/SplineFactory.java | rabbagast/common | e55e9ffadaefaf2c58cc424ab4bc0b1a3bb4e985 | [
"Apache-2.0"
] | null | null | null | src/no/geosoft/common/geometry/spline/SplineFactory.java | rabbagast/common | e55e9ffadaefaf2c58cc424ab4bc0b1a3bb4e985 | [
"Apache-2.0"
] | null | null | null | src/no/geosoft/common/geometry/spline/SplineFactory.java | rabbagast/common | e55e9ffadaefaf2c58cc424ab4bc0b1a3bb4e985 | [
"Apache-2.0"
] | null | null | null | package no.geosoft.common.geometry.spline;
/**
* A spline factory instance.
*
* @author <a href="mailto:jacob.dreyer@geosoft.no">Jacob Dreyer</a>
*/
public class SplineFactory
{
/**
* Create a Bezier spline based on the given control points.
* The generated curve starts in the first control point and ends
* in the last control point.
*
* @param controlPoints Control points of spline (x0,y0,z0,x1,y1,z1,...).
* @param nParts Number of parts to divide each leg into.
* @return Spline (x0,y0,z0,x1,y1,z1,...).
*/
public static double[] createBezier (double[] controlPoints, int nParts)
{
Spline spline = new BezierSpline (controlPoints, nParts);
return spline.generate();
}
/**
* Create a cubic spline based on the given control points.
* The generated curve starts in the first control point and ends
* in the last control point.
*
* @param controlPoints Control points of spline (x0,y0,z0,x1,y1,z1,...).
* @param nParts Number of parts to divide each leg into.
* @return Spline (x0,y0,z0,x1,y1,z1,...).
*/
public static double[] createCubic (double[] controlPoints, int nParts)
{
Spline spline = new CubicSpline (controlPoints, nParts);
return spline.generate();
}
/**
* Create a Catmull-Rom spline based on the given control points.
* The generated curve starts in the first control point and ends
* in the last control point.
* Im addition, the curve intersects all the control points.
*
* @param controlPoints Control points of spline (x0,y0,z0,x1,y1,z1,...).
* @param nParts Number of parts to divide each leg into.
* @return Spline (x0,y0,z0,x1,y1,z1,...).
*/
public static double[] createCatmullRom (double[] controlPoints, int nParts)
{
Spline spline = new CatmullRomSpline (controlPoints, nParts);
return spline.generate();
}
/**
* Testing the spline package.
*
* @param args Not used.
*/
public static void main (String[] args)
{
double[] c = new double[12];
c[0] = 0.0; // x0
c[1] = 0.0; // y0
c[2] = 0.0; // z0
c[3] = 1.0; // x1
c[4] = 1.0; // y1
c[5] = 0.0; // z1
c[6] = 2.0; // x2
c[7] = -1.0; // y2
c[8] = 0.0; // z2
c[9] = 10.0; // x3
c[10] = 0.0; // y3
c[11] = 0.0; // z3
double[] spline1 = SplineFactory.createBezier (c, 20);
double[] spline2 = SplineFactory.createCubic (c, 20);
double[] spline3 = SplineFactory.createCatmullRom (c, 20);
System.out.println ("-- Bezier");
for (int i = 0; i < spline1.length; i+=3)
System.out.println (spline1[i] + "," + spline1[i+1] + "," + spline1[i+2]);
System.out.println ("-- Cubic");
for (int i = 0; i < spline2.length; i+=3)
System.out.println (spline2[i] + "," + spline2[i+1] + "," + spline2[i+2]);
System.out.println ("-- Catmull-Rom");
for (int i = 0; i < spline3.length; i+=3)
System.out.println (spline3[i] + "," + spline3[i+1] + "," + spline3[i+2]);
}
}
| 32.020619 | 80 | 0.588538 |
cfc46c1a81a03a3424d93d0579596cbecff74913 | 709 | ps1 | PowerShell | src/app/resources/scripts/iis_scripts/Start-AdminAPI.ps1 | nathanm1011/IIS.WebManager | ea813ae8e4e1ee21467c5ab856e40ba8f5ef6787 | [
"MIT"
] | 101 | 2019-05-08T21:27:05.000Z | 2022-02-13T07:33:49.000Z | src/app/resources/scripts/iis_scripts/Start-AdminAPI.ps1 | nathanm1011/IIS.WebManager | ea813ae8e4e1ee21467c5ab856e40ba8f5ef6787 | [
"MIT"
] | 275 | 2017-07-21T16:31:44.000Z | 2019-05-04T05:30:54.000Z | src/app/resources/scripts/iis_scripts/Start-AdminAPI.ps1 | nathanm1011/IIS.WebManager | ea813ae8e4e1ee21467c5ab856e40ba8f5ef6787 | [
"MIT"
] | 48 | 2019-05-16T07:06:52.000Z | 2021-11-16T02:54:36.000Z | [CmdletBinding()]
param(
## Not doing anything with this parameter yet
[string]
$sessionId,
[string]
$serviceName = "Microsoft IIS Administration"
)
$ErrorActionPreference = "Stop"
function WaitForServerToStart($service) {
$waitPeriod = 1
$remainingTime = 600
while (!(Get-Service $service -ErrorAction SilentlyContinue | Where-Object {$_.Status -eq "Running"})) {
Start-Sleep -Seconds $waitPeriod
$remainingTime -= $waitPeriod
if ($remainingTime -lt 0) {
throw "Timeout waiting for service to start"
}
}
}
Start-Service -Name $serviceName
WaitForServerToStart $serviceName
'{ "success": true }'
| 24.448276 | 109 | 0.631876 |
0009f84edf5501e6fbd48ac98d7a1c75f2a85457 | 18,591 | sql | SQL | devel2016.sql | kiritoriq/sistempenjualan | 0c1f14041afe00c85372f1a9ec4a129797550ea6 | [
"MIT"
] | null | null | null | devel2016.sql | kiritoriq/sistempenjualan | 0c1f14041afe00c85372f1a9ec4a129797550ea6 | [
"MIT"
] | null | null | null | devel2016.sql | kiritoriq/sistempenjualan | 0c1f14041afe00c85372f1a9ec4a129797550ea6 | [
"MIT"
] | null | null | null | # ************************************************************
# Sequel Pro SQL dump
# Version 4541
#
# http://www.sequelpro.com/
# https://github.com/sequelpro/sequelpro
#
# Host: 192.168.0.5 (MySQL 5.5.47-MariaDB)
# Database: master_develop2
# Generation Time: 2016-07-22 14:10:11 +0000
# ************************************************************
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
# Dump of table application_log
# ------------------------------------------------------------
DROP TABLE IF EXISTS `application_log`;
CREATE TABLE `application_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`aksi` varchar(255) DEFAULT NULL,
`module` varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
`user` bigint(20) DEFAULT NULL,
`waktu` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
# Dump of table configurations
# ------------------------------------------------------------
DROP TABLE IF EXISTS `configurations`;
CREATE TABLE `configurations` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`value` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
LOCK TABLES `configurations` WRITE;
/*!40000 ALTER TABLE `configurations` DISABLE KEYS */;
INSERT INTO `configurations` (`id`, `name`, `value`, `created_at`, `updated_at`)
VALUES
(1,'site-name','Master Develop Dinustek','2014-02-19 00:00:00','2014-03-12 12:16:47'),
(2,'list-limit','25','2014-02-19 00:00:00','2014-02-26 02:28:22'),
(3,'Framework Version','5.1','2015-05-01 13:46:29','2016-06-09 03:19:42');
/*!40000 ALTER TABLE `configurations` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table contexts
# ------------------------------------------------------------
DROP TABLE IF EXISTS `contexts`;
CREATE TABLE `contexts` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`module_path` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`path` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`uses` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT ' ',
`flag` int(11) DEFAULT NULL,
`is_nav_bar` int(11) DEFAULT NULL,
`icons` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`order` int(11) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
LOCK TABLES `contexts` WRITE;
/*!40000 ALTER TABLE `contexts` DISABLE KEYS */;
INSERT INTO `contexts` (`id`, `module_path`, `name`, `path`, `uses`, `flag`, `is_nav_bar`, `icons`, `order`, `created_at`, `updated_at`)
VALUES
(1,0,'Dashboard','/dashboard','HomeController@dashboard',1,1,'fa-dashboard',1,'2014-02-06 00:00:00','2014-02-06 00:00:00'),
(2,0,'Developer','','',1,1,'fa-wrench',2,'2014-02-06 00:00:00','2014-02-06 00:00:00'),
(3,0,'Settings','','',1,1,'fa-gears',3,'2014-02-12 00:00:00','2014-02-12 00:00:00');
/*!40000 ALTER TABLE `contexts` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table migrations
# ------------------------------------------------------------
DROP TABLE IF EXISTS `migrations`;
CREATE TABLE `migrations` (
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
# Dump of table modules
# ------------------------------------------------------------
DROP TABLE IF EXISTS `modules`;
CREATE TABLE `modules` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`module_path` int(11) NOT NULL,
`id_context` int(11) NOT NULL,
`id_parent` int(11) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(350) COLLATE utf8_unicode_ci NOT NULL,
`path` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`uses` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`flag` int(11) NOT NULL,
`is_nav_bar` int(11) NOT NULL,
`icons` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
`order` int(11) NOT NULL,
`table_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
LOCK TABLES `modules` WRITE;
/*!40000 ALTER TABLE `modules` DISABLE KEYS */;
INSERT INTO `modules` (`id`, `module_path`, `id_context`, `id_parent`, `name`, `description`, `path`, `uses`, `flag`, `is_nav_bar`, `icons`, `order`, `table_name`, `created_at`, `updated_at`)
VALUES
(1,0,2,0,'Context','Contexts Moduls','/developer/context','ContextController',1,1,'fa-align-left',0,'contexts','2014-02-20 00:00:00','0000-00-00 00:00:00'),
(2,0,2,0,'Modules','Modules','/developer/modules','ModulesController',1,1,'fa-bolt',1,'modules','2014-02-20 00:00:00','0000-00-00 00:00:00'),
(3,0,3,0,'Permissions','','/settings/permissions','PermissionsController',1,1,'fa-check-square-o',1,'permissions','2014-02-22 00:00:00','2014-02-22 00:00:00'),
(4,0,3,0,'Permissions Matrix','','/settings/permissionsmatrix','PermissionsmatrixController',1,1,'fa-check-square-o',2,'role_permission','2014-02-22 00:00:00','2014-02-22 00:00:00'),
(5,0,3,0,'Roles','','/settings/roles','RolesController',1,1,'fa-child',3,'roles','2014-02-24 00:00:00','2014-02-24 00:00:00'),
(6,0,3,0,'Configurations','','/settings/configurations','ConfigurationsController',1,1,'fa-wrench',0,'configurations','2014-02-24 00:00:00','2014-02-24 00:00:00'),
(7,0,3,0,'Users','','/settings/users','UsersController',1,1,'fa-users',4,'users','2014-02-24 00:00:00','2014-02-24 00:00:00');
/*!40000 ALTER TABLE `modules` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table permissions
# ------------------------------------------------------------
DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`status` enum('Active','Inactive') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Active',
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
LOCK TABLES `permissions` WRITE;
/*!40000 ALTER TABLE `permissions` DISABLE KEYS */;
INSERT INTO `permissions` (`id`, `name`, `description`, `status`, `created_at`, `updated_at`)
VALUES
(1,'site-login','Allow User to login','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(2,'context-dashboard','Allow View Dashboard','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(3,'context-developer','Allow View Developer','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(4,'context-settings','Allow View Settings','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(5,'mod-context-index','Allow Access Context Index','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(6,'mod-context-create','Allow Access Context Create','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(7,'mod-context-edit','Allow Access Context Edit','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(8,'mod-context-delete','Allow Access Context Delete','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(9,'mod-modules-index','Allow Access Modules Index','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(10,'mod-modules-create','Allow Access Modules Create','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(11,'mod-modules-edit','Allow Access Modules Edit','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(12,'mod-modules-delete','Allow Access Modules Delete','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(13,'mod-permissions-index','Allow Access Permissions Index','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(14,'mod-permissions-create','Allow Access Permissions Create','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(15,'mod-permissions-edit','Allow Access Permissions Edit','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(16,'mod-permissions-delete','Allow Access Permissions Delete','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(17,'mod-roles-index','Allow Access Roles Index','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(18,'mod-roles-create','Allow Access Roles Create','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(19,'mod-roles-edit','Allow Access Roles Edit','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(20,'mod-roles-delete','Allow Access Roles Delete','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(21,'mod-permissionsmatrix-index','Allow Access Permissions Matrix Index','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(22,'mod-permissionsmatrix-create','Allow Access Permissions Matrix Create','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(23,'mod-permissionsmatrix-edit','Allow Access Permissions Matrix Edit','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(24,'mod-permissionsmatrix-delete','Allow Access Permissions Matrix Delete','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(25,'mod-users-index','Allow Access Users Index','Active','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(26,'mod-users-create','Allow Access Users Create','Active','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(27,'mod-users-edit','Allow Access Users Edit','Active','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(28,'mod-users-delete','Allow Access Users Delete','Active','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(30,'mod-configurations-index','Allow Access Configurations Index','Active','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(31,'mod-configurations-create','Allow Access Configurations Create','Active','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(32,'mod-configurations-edit','Allow Access Configurations Edit','Active','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(33,'mod-configurations-delete','Allow Access Configurations Delete','Active','2014-02-19 00:00:00','2014-02-19 00:00:00');
/*!40000 ALTER TABLE `permissions` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table role_permission
# ------------------------------------------------------------
DROP TABLE IF EXISTS `role_permission`;
CREATE TABLE `role_permission` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`role_id` bigint(20) NOT NULL,
`role_parent` bigint(20) NOT NULL,
`permission_id` bigint(20) NOT NULL,
`start_date` datetime DEFAULT '0000-00-00 00:00:00',
`end_date` datetime DEFAULT '0000-00-00 00:00:00',
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
LOCK TABLES `role_permission` WRITE;
/*!40000 ALTER TABLE `role_permission` DISABLE KEYS */;
INSERT INTO `role_permission` (`id`, `role_id`, `role_parent`, `permission_id`, `start_date`, `end_date`, `created_at`, `updated_at`)
VALUES
(1,1,0,1,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(2,1,0,3,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(3,1,0,4,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(4,1,0,9,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(5,1,0,10,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(6,1,0,11,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(7,1,0,12,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(8,1,0,13,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(9,1,0,14,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(10,1,0,15,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(11,1,0,16,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(12,1,0,17,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(13,1,0,18,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(14,1,0,19,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(15,1,0,20,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(16,1,0,21,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(17,1,0,22,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(18,1,0,23,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(19,1,0,24,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-18 00:00:00','2014-02-18 00:00:00'),
(20,1,0,25,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(21,1,0,26,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(22,1,0,27,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(23,1,0,28,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(24,1,0,2,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(26,1,0,7,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(27,1,0,6,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(29,1,0,30,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(30,1,0,31,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(31,1,0,32,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(34,1,0,5,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-19 00:00:00','2014-02-19 00:00:00'),
(81,1,0,8,'0000-00-00 00:00:00','0000-00-00 00:00:00','2014-02-24 00:00:00','2014-02-24 00:00:00'),
(84,1,0,36,'0000-00-00 00:00:00','0000-00-00 00:00:00','2015-04-29 23:53:43','2015-04-29 23:53:43'),
(85,1,0,37,'0000-00-00 00:00:00','0000-00-00 00:00:00','2015-04-29 23:53:43','2015-04-29 23:53:43'),
(86,1,0,38,'0000-00-00 00:00:00','0000-00-00 00:00:00','2015-04-29 23:53:43','2015-04-29 23:53:43'),
(87,1,0,39,'0000-00-00 00:00:00','0000-00-00 00:00:00','2015-04-29 23:53:43','2015-04-29 23:53:43'),
(89,2,0,1,'0000-00-00 00:00:00','0000-00-00 00:00:00','2016-06-09 04:14:51','2016-06-09 04:14:51'),
(90,1,0,33,'0000-00-00 00:00:00','0000-00-00 00:00:00','2016-06-09 04:20:14','2016-06-09 04:20:14'),
(91,1,0,33,'0000-00-00 00:00:00','0000-00-00 00:00:00','2016-06-09 04:20:14','2016-06-09 04:20:14'),
(166,2,0,2,'0000-00-00 00:00:00','0000-00-00 00:00:00','2016-06-09 14:18:47','2016-06-09 14:18:47');
/*!40000 ALTER TABLE `role_permission` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table roles
# ------------------------------------------------------------
DROP TABLE IF EXISTS `roles`;
CREATE TABLE `roles` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`parent` bigint(20) NOT NULL,
`name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`login_destination` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`status` enum('Active','In Active') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Active',
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
LOCK TABLES `roles` WRITE;
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` (`id`, `parent`, `name`, `description`, `login_destination`, `status`, `created_at`, `updated_at`)
VALUES
(1,0,'Administrator','Administrator Role','dashboard','Active','2014-02-12 00:00:00','2014-02-12 00:00:00'),
(2,0,'Super Admin','Untuk super admin','dashboard','Active','2016-06-09 04:13:52','2016-06-09 04:13:52');
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
UNLOCK TABLES;
# Dump of table users
# ------------------------------------------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`username` varchar(32) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(320) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`role_id` bigint(20) NOT NULL,
`foto` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`deleted_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` (`id`, `name`, `username`, `email`, `password`, `role_id`, `foto`, `remember_token`, `created_at`, `updated_at`, `deleted_at`)
VALUES
(1,'Developer','admin','admin@local','$2y$10$OGJ2VjPwXaJ02eYaw.ki8OZGm3j/vUz8nw3TOoKWwYHLrOPkLGToi',1,'bunny.jpg','y2sfCbM93a7pxxxTYXwEHglfAt1cIdF5h4vPgfuMi0Z30KVy2FUvBwBHJXrR','2014-02-25 00:00:00','2016-06-09 15:41:03',NULL);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 54.201166 | 228 | 0.663117 |
5e1e4fb0d7400519659ae1a7be4cc08621f59483 | 282 | ps1 | PowerShell | libexec/presets.ps1 | skyhoshi/concfg | 79b395fd7a63a398adfb14164c71eec13922f890 | [
"MIT"
] | 864 | 2015-01-04T17:00:03.000Z | 2022-03-28T02:23:23.000Z | powershell/concfg/libexec/presets.ps1 | codeimpossible/dotfiles | 73e45118bf9a83202c10c17c34cf8dee53366534 | [
"MIT"
] | 62 | 2015-06-24T17:30:13.000Z | 2021-08-02T11:06:05.000Z | powershell/concfg/libexec/presets.ps1 | codeimpossible/dotfiles | 73e45118bf9a83202c10c17c34cf8dee53366534 | [
"MIT"
] | 105 | 2015-02-09T14:31:32.000Z | 2021-11-11T18:49:54.000Z | # Usage: concfg presets
# Summary: List builtin available presets
# Help: Lists the presets that are available for the 'concfg import' command
. "$PSScriptRoot\..\lib\presets.ps1"
$result = Get-BuiltinPreset
Write-Output "Available presets:"
Format-PresetOutput($result)
| 28.2 | 77 | 0.744681 |
9da35ebcde57aed1b51f195c6786ded037c8c7b9 | 2,189 | asm | Assembly | artwork/barbaro_espada_golpealto.asm | fjpena/sword-of-ianna-zx | fdd6bdb5775933756e75402a7c6be80d5334702d | [
"Apache-2.0"
] | 67 | 2017-10-07T18:48:05.000Z | 2022-02-01T20:37:40.000Z | artwork/barbaro_espada_golpealto.asm | fjpena/sword-of-ianna-zx | fdd6bdb5775933756e75402a7c6be80d5334702d | [
"Apache-2.0"
] | null | null | null | artwork/barbaro_espada_golpealto.asm | fjpena/sword-of-ianna-zx | fdd6bdb5775933756e75402a7c6be80d5334702d | [
"Apache-2.0"
] | 9 | 2017-10-06T21:02:55.000Z | 2022-01-06T03:11:58.000Z | ; ASM source file created by SevenuP v1.20
; SevenuP (C) Copyright 2002-2006 by Jaime Tejedor Gomez, aka Metalbrain
;GRAPHIC DATA:
;Pixel Size: ( 24, 32)
;Char Size: ( 3, 4)
;Frames: 4
;Sort Priorities: X char, Char line, Y char, Frame number
;Data Outputted: Gfx
;Interleave: Sprite
;Mask: No
barbaro_espada_golpealto:
DEFB 127,255,118,127,255,118, 0, 1
DEFB 0, 0, 48, 0, 0, 76,104, 0
DEFB 35,100, 0, 16,112, 0,248,116
DEFB 1, 7,112, 0,159,180, 0, 63
DEFB 224, 0, 63, 16, 0,124, 96, 0
DEFB 121, 0, 0,115, 0, 0,108, 0
DEFB 0,124, 0, 0, 58, 0, 0, 4
DEFB 0, 0, 0,128, 0, 96, 80, 0
DEFB 240,168, 0,241, 84, 0,248, 40
DEFB 0,120, 0, 0, 56, 40, 0,192
DEFB 0, 0, 48, 34, 1,192, 84, 1
DEFB 128, 40, 3,192, 64, 7,240, 0
DEFB 0, 0, 0, 0, 0,248, 0, 3
DEFB 4, 0, 4, 0, 0, 24, 8, 0
DEFB 35, 20, 0, 28, 60, 0, 8, 60
DEFB 0, 11,200, 0, 7,240, 0, 15
DEFB 248, 0, 15,248, 0, 30,127, 0
DEFB 29,159, 0, 63,199, 0, 63, 0
DEFB 0, 56, 0, 0, 0, 0, 0, 3
DEFB 248, 0, 31,252, 0, 63,220, 0
DEFB 63,128, 0, 28, 56, 0, 0, 76
DEFB 0, 0,112, 0, 0,224, 0, 1
DEFB 224, 0, 0,112, 0, 10, 24, 0
DEFB 20, 0, 0, 40, 0, 0, 85, 0
DEFB 0,170, 0, 0, 85, 0, 0, 42
DEFB 128, 0, 85, 64, 0, 42,160, 0
DEFB 21, 80, 0, 42,168, 0, 85, 80
DEFB 0, 42,168, 0, 85, 84, 0,170
DEFB 168, 0, 85, 84, 0, 0, 0,206
DEFB 255,254,206,255,254, 4, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 0, 0, 0
DEFB 0, 0, 0, 0, 0, 63,240, 0
DEFB 64, 8, 0,128,112, 0,148,128
DEFB 0, 30, 96, 3,158, 16, 7,204
DEFB 128, 7,128, 64, 7,224,168, 3
DEFB 254, 4, 0, 0, 33,255,255,236
DEFB 255,255,236, 0, 0, 32, 0,250
DEFB 0, 0, 4, 0, 0, 0, 0, 0
DEFB 192, 0, 1,241, 64, 1,248,160
DEFB 0,252, 80, 0, 62, 32, 0, 14
DEFB 0, 0, 16, 80, 0, 46, 0, 0
DEFB 112,128, 1,225, 80, 3,250,168 | 35.885246 | 72 | 0.487437 |
0e1b2ad9078f6945bfe8599965f2aa2c0be150f5 | 4,245 | lua | Lua | spec/process_md_spec.lua | Dm1tr1y147/md_offliner | 354e9120b28923f2113156bbec0b3f08d4e64ef0 | [
"MIT"
] | null | null | null | spec/process_md_spec.lua | Dm1tr1y147/md_offliner | 354e9120b28923f2113156bbec0b3f08d4e64ef0 | [
"MIT"
] | null | null | null | spec/process_md_spec.lua | Dm1tr1y147/md_offliner | 354e9120b28923f2113156bbec0b3f08d4e64ef0 | [
"MIT"
] | null | null | null | local ProcessMD = require("src.process_md")
local Utils = require("spec.utils")
local assets_dir = './spec/assets/'
describe("process_md", function()
describe("get_file_content", function()
it("Gets content of file test.txt", function()
assert.equal(
" and even ",
ProcessMD.get_file_content("test.txt"))
end)
it("Throws error on wrong filename", function()
assert.has_error(function()
ProcessMD.get_file_content("foo.bar")
end, "foo.bar: No such file or directory")
end)
end)
describe("get_web_imgs_path", function()
it("Gets img path from markdown img string", function()
assert.are.same({'https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png'},
ProcessMD.get_web_imgs_path(
''))
end)
it("Doen't return local paths", function()
assert.are.same({}, ProcessMD.get_web_imgs_path(''))
end)
it("Gets img path from makrdown text", function()
assert.are.same({'https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png'},
ProcessMD.get_web_imgs_path(
'Tesing text, only simple  img passed'))
end)
it("Doesn't return links paths", function()
assert.are.same({}, ProcessMD.get_web_imgs_path(
'My favorite search engine is [Duck Duck Go](https://duckduckgo.com).'))
end)
it("Works for multiple images links", function()
assert.are.same({'http://test.ml/tux.png', 'http://w3.impa.br/~diego/software/luasocket/luasocket.png'},
ProcessMD.get_web_imgs_path(
' and even '))
end)
end)
describe("replace_paths", function()
it("Replaces original paths with passed", function()
assert.equal(' and even ', ProcessMD.replace_paths(
' and even ',
{
["http://test.ml/tux.png"] = "./tux.png",
["http://w3.impa.br/~diego/software/luasocket/luasocket.png"] = "./luasocket.png"
}))
end)
end)
describe("get_header", function()
it('Gets header of md file', function()
local f = io.open(assets_dir .. 'tmp_dir/some file.md', 'r')
local content = f:read('a')
local header, _
_, header = ProcessMD.get_header(content, assets_dir .. 'tmp_dir/some file.md', true)
f:close()
assert.equal('Header_:D', header)
end)
it("Returns empty line if no header", function()
local f = io.open(assets_dir .. 'tmp_dir/and one more.md', 'r')
local content = f:read('a')
local header, _
_, header = ProcessMD.get_header(content, assets_dir .. 'tmp_dir/and one more.md', true)
f:close()
assert.equal('and_one_more', header)
end)
end)
describe("save_document", function()
local function clean()
Utils.clean_assets({'Article_name.md'})
end
setup(clean)
teardown(clean)
it('Saves markdown document into file', function()
local temp_content = 'Test document'
ProcessMD.save_document(assets_dir, 'Article_name', temp_content)
local f = io.open(assets_dir .. 'Article_name.md', 'r')
assert.is_not_nil(f)
local f_content = f:read('a')
assert.equal(temp_content, f_content)
f:close()
end)
end)
end)
| 40.817308 | 147 | 0.581625 |
e63e86496ce4bc9f690c3d0cc631dd356d08f440 | 741 | go | Go | test/functional/wiring/wrappingService.go | Yomiji/gkBoot | 2e716d132d50a26348e45405a979f01e34098b1c | [
"MIT"
] | null | null | null | test/functional/wiring/wrappingService.go | Yomiji/gkBoot | 2e716d132d50a26348e45405a979f01e34098b1c | [
"MIT"
] | 9 | 2021-12-03T21:03:56.000Z | 2021-12-08T18:07:18.000Z | test/functional/wiring/wrappingService.go | Yomiji/gkBoot | 2e716d132d50a26348e45405a979f01e34098b1c | [
"MIT"
] | 1 | 2021-12-03T21:00:26.000Z | 2021-12-03T21:00:26.000Z | package wiring
import (
"context"
"testing"
"github.com/yomiji/gkBoot/service"
)
type TestPassService struct {
next service.Service
t *testing.T
}
func (t TestPassService) GetNext() service.Service {
return t.next
}
func (t *TestPassService) UpdateNext(nxt service.Service) {
t.next = nxt
}
func (t TestPassService) Execute(ctx context.Context, request interface{}) (response interface{}, err error) {
t.t.Log("Passed, Wrap Successful\n")
return t.next.Execute(ctx, request)
}
func WrapTestedService(t *testing.T) service.Wrapper {
return func(srv service.Service) service.Service {
if _,ok := srv.(LogWrappedTarget); ok {
tps := new(TestPassService)
tps.t = t
tps.next = srv
return tps
}
return srv
}
}
| 19 | 110 | 0.707152 |
4f9380b04c24a6babc4675eb7f01de6136e3cb46 | 699 | kt | Kotlin | app/src/main/java/com/karansyd4/pokedex/ui/compose/library/PreviewData.kt | karan4c6/Pokedex | e8052068698dd2a2a489a81fd3ada98079e515bc | [
"Apache-2.0"
] | 1 | 2022-01-28T00:29:46.000Z | 2022-01-28T00:29:46.000Z | app/src/main/java/com/karansyd4/pokedex/ui/compose/library/PreviewData.kt | karan4c6/Pokedex | e8052068698dd2a2a489a81fd3ada98079e515bc | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/karansyd4/pokedex/ui/compose/library/PreviewData.kt | karan4c6/Pokedex | e8052068698dd2a2a489a81fd3ada98079e515bc | [
"Apache-2.0"
] | 1 | 2022-01-28T00:34:25.000Z | 2022-01-28T00:34:25.000Z | package com.karansyd4.pokedex.ui.compose.library
import com.karansyd4.pokedex.data.model.PokemonCardData
fun getPreviewPokemonCardData() = listOf(
PokemonCardData(
imageUrl = "https://raw.githubusercontent.com/karan4c6/APIs/main/pokedex/images/001.jpg",
pokedexNumber = "001",
name = "Bulbasaur"
),
PokemonCardData(
imageUrl = "https://raw.githubusercontent.com/karan4c6/APIs/main/pokedex/images/002.jpg",
pokedexNumber = "002",
name = "Ivysaur"
),
PokemonCardData(
imageUrl = "https://raw.githubusercontent.com/karan4c6/APIs/main/pokedex/images/003.jpg",
pokedexNumber = "003",
name = "Venasaur"
)
) | 31.772727 | 97 | 0.668097 |
8e60eb9ce6de4537a0688db00813edf8f78289ea | 1,567 | lua | Lua | lib/types/hammerspoon/std/eventtap/event/event.lua | wwmoraes/Spoons | 7e1c5d4c2a1bef73dc53bf15612e0903f3540268 | [
"MIT"
] | null | null | null | lib/types/hammerspoon/std/eventtap/event/event.lua | wwmoraes/Spoons | 7e1c5d4c2a1bef73dc53bf15612e0903f3540268 | [
"MIT"
] | null | null | null | lib/types/hammerspoon/std/eventtap/event/event.lua | wwmoraes/Spoons | 7e1c5d4c2a1bef73dc53bf15612e0903f3540268 | [
"MIT"
] | null | null | null | --- @class EventTapEvent
--- @field properties EventTapEventProperties
--- @field rawFlagMasks EventTapEventRawFlagMasks
--- @field types EventTapEventTypes|table<integer,EventTapEventType>
local EventTapEvent
--- @param modifiers EventTapEventModifier[]
--- @param character string
--- @return EventTapEventInstance[]
function EventTapEvent.newKeyEventSequence(modifiers, character)end
--- @return EventTapEventInstance
function EventTapEvent.newEvent()end
--- @param data string
--- @return EventTapEventInstance
function EventTapEvent.newEventFromData(data)end
--- @param gestureType EventTapEventGestureType
--- @param gestureValue number|nil
--- @return EventTapEventInstance|nil
function EventTapEvent.newGesture(gestureType, gestureValue)end
--- @param mods EventTapEventKeyModifier[]|nil
--- @param key string|integer
--- @param isdown boolean
--- @return EventTapEventInstance
function EventTapEvent.newKeyEvent(mods, key, isdown)end
--- @param eventtype EventTapEventTypeNameMouse|integer
--- @param point EventTapPoint
--- @param modifiers EventTapEventKeyModifier|nil
--- @return EventTapEventInstance
function EventTapEvent.newMouseEvent(eventtype, point, modifiers)end
--- @param offsets EventTapOffsets
--- @param mods EventTapEventKeyModifier|nil
--- @param unit EventTapScrollWheelUnit
--- @return EventTapEventInstance
function EventTapEvent.newScrollEvent(offsets, mods, unit)end
--- @param key EventTapEventSpecialKeyName
--- @param isdown boolean
--- @return EventTapEventInstance
function EventTapEvent.newSystemKeyEvent(key, isdown)end
| 34.065217 | 68 | 0.808551 |
7edd217b3b867028404cf7344e6c744b5941f7c0 | 85 | swift | Swift | Package.swift | Oggerschummer/NSString-RemoveEmoji | b9fc0d5ea4068173a9b34b3fabee79e7730a5a4b | [
"MIT"
] | null | null | null | Package.swift | Oggerschummer/NSString-RemoveEmoji | b9fc0d5ea4068173a9b34b3fabee79e7730a5a4b | [
"MIT"
] | null | null | null | Package.swift | Oggerschummer/NSString-RemoveEmoji | b9fc0d5ea4068173a9b34b3fabee79e7730a5a4b | [
"MIT"
] | null | null | null | import PackageDescription
let package = Package(
name: "NSString_RemoveEmoji"
)
| 14.166667 | 32 | 0.764706 |
26653504f109c34295ebaa3747b232dc9467712a | 2,182 | java | Java | src/test/java/com/github/charlemaznable/core/net/common/HttpStatusTest.java | CharLemAznable/complex-kits | 91e3926a7801a87fb9a7707acb60e77118bb74a9 | [
"MIT"
] | 2 | 2019-05-20T14:46:15.000Z | 2020-12-01T05:59:30.000Z | src/test/java/com/github/charlemaznable/core/net/common/HttpStatusTest.java | CharLemAznable/complex-kits | 91e3926a7801a87fb9a7707acb60e77118bb74a9 | [
"MIT"
] | 1 | 2022-01-07T08:09:30.000Z | 2022-01-07T08:09:30.000Z | src/test/java/com/github/charlemaznable/core/net/common/HttpStatusTest.java | CharLemAznable/complex-kits | 91e3926a7801a87fb9a7707acb60e77118bb74a9 | [
"MIT"
] | null | null | null | package com.github.charlemaznable.core.net.common;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class HttpStatusTest {
@Test
public void testHttpStatus() {
assertThrows(IllegalArgumentException.class,
() -> HttpStatus.valueOf(600));
assertThrows(IllegalArgumentException.class,
() -> HttpStatus.Series.valueOf(600));
assertTrue(HttpStatus.CONTINUE.is1xxInformational());
assertFalse(HttpStatus.CONTINUE.is2xxSuccessful());
assertFalse(HttpStatus.CONTINUE.is3xxRedirection());
assertFalse(HttpStatus.CONTINUE.is4xxClientError());
assertFalse(HttpStatus.CONTINUE.is5xxServerError());
assertFalse(HttpStatus.OK.is1xxInformational());
assertTrue(HttpStatus.OK.is2xxSuccessful());
assertFalse(HttpStatus.OK.is3xxRedirection());
assertFalse(HttpStatus.OK.is4xxClientError());
assertFalse(HttpStatus.OK.is5xxServerError());
assertFalse(HttpStatus.MULTIPLE_CHOICES.is1xxInformational());
assertFalse(HttpStatus.MULTIPLE_CHOICES.is2xxSuccessful());
assertTrue(HttpStatus.MULTIPLE_CHOICES.is3xxRedirection());
assertFalse(HttpStatus.MULTIPLE_CHOICES.is4xxClientError());
assertFalse(HttpStatus.MULTIPLE_CHOICES.is5xxServerError());
assertFalse(HttpStatus.BAD_REQUEST.is1xxInformational());
assertFalse(HttpStatus.BAD_REQUEST.is2xxSuccessful());
assertFalse(HttpStatus.BAD_REQUEST.is3xxRedirection());
assertTrue(HttpStatus.BAD_REQUEST.is4xxClientError());
assertFalse(HttpStatus.BAD_REQUEST.is5xxServerError());
assertFalse(HttpStatus.INTERNAL_SERVER_ERROR.is1xxInformational());
assertFalse(HttpStatus.INTERNAL_SERVER_ERROR.is2xxSuccessful());
assertFalse(HttpStatus.INTERNAL_SERVER_ERROR.is3xxRedirection());
assertFalse(HttpStatus.INTERNAL_SERVER_ERROR.is4xxClientError());
assertTrue(HttpStatus.INTERNAL_SERVER_ERROR.is5xxServerError());
}
}
| 44.530612 | 75 | 0.742438 |
2a3387a014d12afbb3e93bc3615969a7fa432bd3 | 538 | java | Java | Moviemoving5/src/main/java/com/Moviemoving/service/CartServiceImpl.java | JungHwan-Park21/spring_workspace | 16259e885854bd8ffc82f6fbaba5dcd50713f6cf | [
"MIT"
] | null | null | null | Moviemoving5/src/main/java/com/Moviemoving/service/CartServiceImpl.java | JungHwan-Park21/spring_workspace | 16259e885854bd8ffc82f6fbaba5dcd50713f6cf | [
"MIT"
] | null | null | null | Moviemoving5/src/main/java/com/Moviemoving/service/CartServiceImpl.java | JungHwan-Park21/spring_workspace | 16259e885854bd8ffc82f6fbaba5dcd50713f6cf | [
"MIT"
] | null | null | null | package com.Moviemoving.service;
import java.util.List;
import com.Moviemoving.domain.MovieVO;
import com.Moviemoving.domain.CartVO;
public class CartServiceImpl implements CartService{
@Override
public int create(CartVO cartVO) {
// TODO Auto-generated method stub
return 0;
}
@Override
public List<MovieVO> getTitle(String MovieInfo_title) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<MovieVO> getImg(String MovieInfo_bkimg) {
// TODO Auto-generated method stub
return null;
}
}
| 18.551724 | 56 | 0.756506 |
cecf7e3bb398cdfca10c1f8595040d01142eb0a5 | 50 | sql | SQL | preset/postgis/testdata/queries.sql | KoduIsGreat/gnomock | 2f45fce94f7ac809abe5fca0fe9e636ccf7e6395 | [
"MIT"
] | 1 | 2021-11-20T10:30:49.000Z | 2021-11-20T10:30:49.000Z | preset/postgis/testdata/queries.sql | KoduIsGreat/gnomock | 2f45fce94f7ac809abe5fca0fe9e636ccf7e6395 | [
"MIT"
] | null | null | null | preset/postgis/testdata/queries.sql | KoduIsGreat/gnomock | 2f45fce94f7ac809abe5fca0fe9e636ccf7e6395 | [
"MIT"
] | null | null | null | create extension postgis;
create table t(a int);
| 12.5 | 25 | 0.76 |
58fa70878bec059c957cb7576498de4d66a03a20 | 186 | sql | SQL | src/main/java/sqlFiles/createTables/createEmployees.sql | karbowiak/2semsterProjekt | bedf40a89c95cf05712512669d2e0dac3bbb12e7 | [
"MIT"
] | null | null | null | src/main/java/sqlFiles/createTables/createEmployees.sql | karbowiak/2semsterProjekt | bedf40a89c95cf05712512669d2e0dac3bbb12e7 | [
"MIT"
] | null | null | null | src/main/java/sqlFiles/createTables/createEmployees.sql | karbowiak/2semsterProjekt | bedf40a89c95cf05712512669d2e0dac3bbb12e7 | [
"MIT"
] | null | null | null | CREATE TABLE employees (
employeeID INT NOT NULL IDENTITY(1,1),
function VARCHAR(255) NOT NULL,
PRIMARY KEY (employeeID),
FOREIGN KEY (employeeID) REFERENCES persons(personID)
); | 31 | 55 | 0.752688 |
7e2f33613b5722dfde34a2f230f6cac2866caf26 | 4,307 | css | CSS | mystyle.css | kerryokay07/weddingsite | 8286982572e5a11b27c6f764b42836607d3e98d0 | [
"Apache-2.0"
] | null | null | null | mystyle.css | kerryokay07/weddingsite | 8286982572e5a11b27c6f764b42836607d3e98d0 | [
"Apache-2.0"
] | null | null | null | mystyle.css | kerryokay07/weddingsite | 8286982572e5a11b27c6f764b42836607d3e98d0 | [
"Apache-2.0"
] | null | null | null | @import url(//db.onlinewebfonts.com/c/c485bd943deb738cde7beb2a970fefa8?family=Anter);
@font-face {
font-family: "Anter";
src: url("//db.onlinewebfonts.com/t/c485bd943deb738cde7beb2a970fefa8.eot");
src: url("//db.onlinewebfonts.com/t/c485bd943deb738cde7beb2a970fefa8.eot?#iefix") format("embedded-opentype"), url("//db.onlinewebfonts.com/t/c485bd943deb738cde7beb2a970fefa8.woff2") format("woff2"), url("//db.onlinewebfonts.com/t/c485bd943deb738cde7beb2a970fefa8.woff") format("woff"), url("//db.onlinewebfonts.com/t/c485bd943deb738cde7beb2a970fefa8.ttf") format("truetype"), url("//db.onlinewebfonts.com/t/c485bd943deb738cde7beb2a970fefa8.svg#Anter") format("svg");
}
body {
background-image: url(https://d3t14gfu9ehll4.cloudfront.net/themes/fbe04fa0-1408-4fd8-ac6e-384c7a8ebece/undefined_z1wqPbi.png);
background-repeat: repeat;
}
ul {
background-image: url(https://d3t14gfu9ehll4.cloudfront.net/themes/fbe04fa0-1408-4fd8-ac6e-384c7a8ebece/undefined_z1wqPbi.png);
background-repeat: repeat;
background-color: white;
display: flex;
justify-content: center;
list-style-type: none;
width: 105%;
position: fixed;
top: 0;
margin-left: -10px;
margin-top: 0px;
padding: 0;
overflow: hidden;
font-family: 'Open Sans Condensed', sans-serif;
font-size: 22px;
letter-spacing: 0.0725em;
text-transform: uppercase;
box-shadow: 0px 0px 5px #888888;
}
li {
float: left;
}
li a {
display: block;
color: #000540;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
h1, h2, h3 {
text-align: center;
color: #000540;
font-weight: 400;
}
h1 {
font-family: 'Anter', cursive;
font-size: 96px;
font-weight: 500;
}
h2 {
font-family: 'Open Sans Condensed', sans-serif;
font-size: 24px;
letter-spacing: 0.0725em;
}
h3 {
font-family: 'Open Sans Condensed', sans-serif;
font-size: 18px;
}
h3.upperText {
letter-spacing: 0.0925em;
text-transform: uppercase;
font-size: 28px;
}
h3.bodyText {
text-align: center;
}
div.bodyText {
margin-left: 20%;
margin-right: 20%;
}
div.map {
display: block;
margin: auto;
padding: 0;
width: 620px;
height: 470px;
background-color: white;
}
div.rsvp {
margin: auto;
padding: 0;
width: 920px;
height: 520px;
background-color: white;
}
div.pictureGallery {
margin: auto;
padding: 0;
width: 600px;
height: 610px;
background-color: white;
}
div.oneBox {
display: flex;
justify-content: center;
width: 100%;
padding-bottom: 20px;
}
div.threeBox {
display: flex;
flex-flow: row wrap;
justify-content: center;
align-items: center;
width: 100%;
padding-bottom: 20px;
}
iframe.map, iframe.rsvp {
padding-left: 10px;
padding-top: 10px;
}
img.flower {
width: 100px;
height: 100px;
display: flex;
}
img.flowerBox {
width: 100px;
height: 100px;
display: flex;
padding-left: 50px;
padding-right: 50px;
}
img.picture {
width: 20%;
height: 20%;
border: solid white 10px;
}
img.divider {
width: 20%;
height: 20%;
}
.rotate90 {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-o-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.rotate270 {
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
-ms-transform: rotate(270deg);
transform: rotate(270deg);
}
.myButton {
background-color: #599bb3;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
display: inline-block;
cursor: pointer;
color: #ffffff;
font-family: 'Open Sans Condensed';
font-size: 20px;
font-weight: bold;
padding: 13px 32px;
text-decoration: none;
}
.myButton:hover {
background-color: #408c99;
}
.myButton:active {
position: relative;
top: 1px;
}
#map {
display: block;
margin-left: 10px;
width: 750px;
height: 500px;
}
| 21.216749 | 472 | 0.619225 |
01e7cab36f423e88a5a5a13bc8b9e1e8be453eaa | 3,836 | dart | Dart | lib/ui/screens/account/accountDashboardScreen.dart | paetzold/apps-nigiri | 06a678fb6ab46d41d56c04e4f1aa85b605e66893 | [
"MIT"
] | null | null | null | lib/ui/screens/account/accountDashboardScreen.dart | paetzold/apps-nigiri | 06a678fb6ab46d41d56c04e4f1aa85b605e66893 | [
"MIT"
] | null | null | null | lib/ui/screens/account/accountDashboardScreen.dart | paetzold/apps-nigiri | 06a678fb6ab46d41d56c04e4f1aa85b605e66893 | [
"MIT"
] | null | null | null | import 'package:flutter/material.dart';
import 'package:mappy/ui/comps/ui-collection.dart';
import 'package:mappy/ui/comps/usercontext.dart';
import '../appScreen.dart';
import 'accountEditScreen.dart';
class AccountDashBoard extends StatefulWidget {
AccountDashBoard({Key key}) : super(key: key);
@override
_AccountDashBoardState createState() => _AccountDashBoardState();
}
class _AccountDashBoardState extends State<AccountDashBoard> {
final _formKey = GlobalKey<FormState>();
var _user = User();
@override
Widget build(BuildContext context) {
return AppScreen(
title: 'Hello ${UserContext.of(context).getIdentifier()}',
child: UseUserContext((context, userContext, child) => Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: ListView(children: <Widget>[
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: Container(
height: 200,
width: 60,
color: Colors.greenAccent)),
Expanded(
child: Container(
height: 200, width: 60, color: Colors.grey))
]),
ListTile(
leading: CircleAvatar(
backgroundImage:
NetworkImage('https://i.stack.imgur.com/YN0m7.png'),
),
title: Text('Your Personal Data'),
subtitle: Text('Bla bla blabla'),
trailing: Icon(Icons.keyboard_arrow_right),
onTap: () {
Navigator.of(context).pushNamed('/account/edit');
}),
ListTile(
leading: CircleAvatar(
backgroundImage:
NetworkImage('https://i.stack.imgur.com/YN0m7.png'),
),
title: Text('Your Payment Instruments'),
subtitle: Text('Bla bla blabla'),
trailing: Icon(Icons.keyboard_arrow_right),
onTap: () {
Navigator.of(context).pushNamed('/account/edit');
}),
ListTile(
leading: CircleAvatar(
backgroundImage:
NetworkImage('https://i.stack.imgur.com/YN0m7.png'),
),
title: Text('Change Your Password'),
subtitle: Text('Bla bla blabla'),
trailing: Icon(Icons.keyboard_arrow_right),
onTap: () {
Navigator.of(context).pushNamed('/account/changePasswd');
}),
ListTile(
leading: CircleAvatar(
backgroundImage:
NetworkImage('https://i.stack.imgur.com/YN0m7.png'),
),
title: Text('Notification Settings'),
subtitle: Text('Bla bla blabla'),
trailing: Icon(Icons.keyboard_arrow_right),
onTap: () {
Navigator.of(context).pushNamed('/account/notifications');
}),
SizedBox(height: 16.0),
StyledButton('Logout', color: Colors.black, onPressed: () {
showAppDialog(context, "Do you really want logout ?",
() => {userContext.logout()});
})
]),
)));
}
}
| 40.808511 | 80 | 0.474453 |
da53df1b69268f1b24b1242e928fe54928963165 | 1,923 | kt | Kotlin | app/src/main/java/com/jia/jetcontacts/ContactsViewModel.kt | Junjie-Jia/JetContacts | d1aa07905966e590c732ea3132efb64744393c02 | [
"MIT"
] | null | null | null | app/src/main/java/com/jia/jetcontacts/ContactsViewModel.kt | Junjie-Jia/JetContacts | d1aa07905966e590c732ea3132efb64744393c02 | [
"MIT"
] | null | null | null | app/src/main/java/com/jia/jetcontacts/ContactsViewModel.kt | Junjie-Jia/JetContacts | d1aa07905966e590c732ea3132efb64744393c02 | [
"MIT"
] | null | null | null | package com.jia.jetcontacts
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class ContactsViewModel : ViewModel() {
private val _contacts by lazy {
listOf(
Contact("Liam", "13888888801"),
Contact("Noah", "13888888802"),
Contact("William", "13888888803"),
Contact("James", "13888888804"),
Contact("Logan", "13888888805"),
Contact("Benjamin", "13888888806"),
Contact("Mason", "13888888807"),
Contact("Elijah", "13888888808"),
Contact("Oliver", "13888888809"),
Contact("Jacob", "13888888810"),
Contact("Emma", "13888888811"),
Contact("Olivia", "13888888812"),
Contact("Ava", "13888888813"),
Contact("Isabella", "13888888814"),
Contact("Sophia", "13888888815"),
Contact("Mia", "13888888816"),
Contact("Charlotte", "13888888817"),
Contact("Amelia", "13888888818"),
Contact("Evelyn", "13888888819"),
Contact("Abigail", "13888888820")
)
}
private val _name = MutableLiveData("")
val name: LiveData<String> = _name
val contacts = MutableLiveData(_contacts)
fun onNameChange(newName: String) {
_name.value = newName
viewModelScope.launch {
contacts.value = filterContacts(newName)
}
}
private suspend fun filterContacts(newName: String): List<Contact> {
return withContext(Dispatchers.Default) {
_contacts.filter {
it.name.contains(
newName,
ignoreCase = true
)
}
}
}
} | 31.52459 | 72 | 0.584503 |
0cab184754b8b6e990d3f1607a9b78c8dc5d5f41 | 7,421 | py | Python | model_functions.py | blowe615/flower_classifier | 7cdb6ebe292f90ae711f050ff24fb68e3a9570c1 | [
"MIT"
] | 1 | 2019-08-29T04:24:22.000Z | 2019-08-29T04:24:22.000Z | model_functions.py | blowe615/flower_classifier | 7cdb6ebe292f90ae711f050ff24fb68e3a9570c1 | [
"MIT"
] | null | null | null | model_functions.py | blowe615/flower_classifier | 7cdb6ebe292f90ae711f050ff24fb68e3a9570c1 | [
"MIT"
] | null | null | null | import torch
from torch import nn
import torch.nn.functional as F
#from helper_functions import process_image
class DeepNetworkClassifier(nn.Module):
def __init__(self, input_units, output_units, hidden_units,p_drop=0.2):
'''
Builds a classifier for a pretrained deep neural network for the flower dataset
Inputs
------
arch: string, model name from torchvision.models, determines the number of inputs in the classifier
hidden_units: int, the number of hidden units in the hidden layer
'''
super().__init__()
# Create input layer with input units based on model architecture
self.input = nn.Linear(input_units,hidden_units)
# Create output layer with 102 outputs (for 102 flower classes)
self.output = nn.Linear(hidden_units,output_units)
# Define level of dropout
self.dropout = nn.Dropout(p=p_drop)
def forward(self, x):
'''
Performs a forward pass through the network and returns the log probabilities
x: layer in model
'''
# Apply ReLU activation function and dropout to the input layer
x = F.relu(self.input(x))
x = self.dropout(x)
# Apply Log Softmax function to output layer
x = self.output(x)
x = F.log_softmax(x,dim=1)
return x
def train(model, trainloader, validloader, criterion, optimizer, epochs, device):
'''
Train the model
Inputs
-------
model: torchvision model
trainloader: PyTorch dataloader containing the training dataset
validloader: PyTorch dataloader containing the validation dataset
criterion: PyTorch criterion
optimizer: PyTorch optimizer with learning rate
epochs: int, number of passes of the training data through the network
device: 'cuda' if GPU is specified, otherwise 'cpu'
'''
# Initialize some counters
steps = 0
running_loss = 0
print_every = 10
for epoch in range(epochs):
for images, labels in trainloader:
steps += 1
# Send the images and labels to the device
images, labels = images.to(device), labels.to(device)
# Zero gradients for this step
optimizer.zero_grad()
# Perform a forward pass on the models
log_ps = model.forward(images)
# Calculate loss
loss = criterion(log_ps, labels)
# Backpropagate error
loss.backward()
# Take next step
optimizer.step()
# Aggregate loss
running_loss += loss.item()
# Display results
if steps % print_every == 0:
# Set model to evaluate mode
model.eval()
# Initialize the validation loss and accuracy
valid_loss = 0
valid_acc = 0
# Run validation dataset through the network
with torch.no_grad():
for images, labels in validloader:
# Send the images and labels to the device
images_v, labels_v = images.to(device), labels.to(device)
# Perform forward pass with validation images
log_ps_valid = model.forward(images_v)
# Calculate validation loss and aggregate
loss = criterion(log_ps_valid, labels_v)
valid_loss += loss
# Calculate validation accuracy
# Calculate the probabilities from the log_probabilities
ps = torch.exp(log_ps_valid)
# Determine the top probability
top_p, top_class = ps.topk(1, dim=1)
# Compare top_class to label
valid_equality = top_class == labels_v.view(*top_class.shape)
# Calculate accuracy by aggregating the equalities
valid_acc += torch.mean(valid_equality.type(torch.FloatTensor)).item()
# Print Results
print(f"Epoch {epoch+1}/{epochs}.. "
f"Training Loss: {running_loss/print_every:.3f}.. "
f"Validation Loss: {valid_loss/len(validloader):.3f}.. "
f"Validation Accuracy: {valid_acc/len(validloader):.3f}")
# Reset counter
running_loss = 0
# Return model to training mode to calculate grads
model.train()
def test(model, testloader, device):
'''
Test the model on the test dataset
Inputs
-------
model: torchvision model
testloader: PyTorch dataloader containing the testing dataset
device: 'cuda' if GPU is specified, otherwise 'cpu'
'''
# Set model to evaluate mode
model.eval()
# Initialize the testing accuracy
test_acc = 0
# Run test dataset through the network
with torch.no_grad():
for images, labels in testloader:
# Send the images and labels to the device
images_t, labels_t = images.to(device), labels.to(device)
# Perform forward pass with validation images
log_ps_test = model.forward(images_t)
# Calculate test accuracy
# Calculate the probabilities from the log_probabilities
ps_test = torch.exp(log_ps_test)
# Determine the top probability
top_p, top_class = ps_test.topk(1, dim=1)
# Compare top_class to label
test_equality = top_class == labels_t.view(*top_class.shape)
# Calculate accuracy by aggregating the equalities
test_acc += torch.mean(test_equality.type(torch.FloatTensor)).item()
# Print Results
print("Test Accuracy: {:.3f}".format(test_acc/len(testloader)))
# Return model to training mode to calculate grads
model.train();
def predict(image, model, topk, device):
'''
Predict the class (or classes) of an image using a trained deep learning model.
Inputs
------
image: numpy array, processed for PyTorch (224x224, normalized, color dimension in 3rd channel)
model: torchvision model
topk: int, number of classes to output
returns lists of the topk probabilities and the corresponding classes
'''
# Convert image from a numpy array to a tensor
image_tensor = torch.from_numpy(image)
image_tensor = image_tensor.unsqueeze(0)
# Run the test dataset through the model
# Send the model to the device
model.to(device)
# Set model to evaluate mode
model.to(torch.double)
model.eval()
# Run the image through the network
with torch.no_grad():
# Send the image to the device
image_tensor = image_tensor.to(device)
# Perform a forward pass with the image
log_ps = model.forward(image_tensor)
# Calculate the probabilities from the log_probabilities
ps = torch.exp(log_ps)
# Determine the top k probabilities
top_p, top_class = ps.topk(topk, dim=1)
labels = []
for i in top_class.tolist()[0]:
for cls, idx in model.class_to_idx.items():
if idx == i:
labels.append(cls)
# Return model to train mode
model.train()
return top_p.tolist()[0], labels
| 38.252577 | 107 | 0.603153 |
5cf36c08e48caccd6885ab262a6878b4e008418c | 2,839 | swift | Swift | Example/Moya-Argo/PlainMoyaTableViewController.swift | juvs/Moya-Argo | f985f0629a778b77e50ee703fe4b6fc9b05b769e | [
"MIT"
] | 42 | 2016-01-29T23:17:01.000Z | 2020-04-16T05:23:36.000Z | Example/Moya-Argo/PlainMoyaTableViewController.swift | juvs/Moya-Argo | f985f0629a778b77e50ee703fe4b6fc9b05b769e | [
"MIT"
] | 19 | 2016-02-02T11:21:42.000Z | 2020-03-27T19:18:42.000Z | Example/Moya-Argo/PlainMoyaTableViewController.swift | juvs/Moya-Argo | f985f0629a778b77e50ee703fe4b6fc9b05b769e | [
"MIT"
] | 18 | 2016-02-07T05:57:05.000Z | 2020-03-26T19:43:14.000Z | //
// PlainMoyaTableViewController.swift
// Moya-Argo
//
// Created by Sam Watts on 23/01/2016.
// Copyright © 2016 Sam Watts. All rights reserved.
//
import UIKit
import Moya
struct PlainMoyaUser {
let id: Int
let name: String
let birthdate: String?
}
extension PlainMoyaUser: UserType { }
class PlainMoyaTableViewController: DemoBaseTableViewController {
let provider:MoyaProvider<DemoTarget> = MoyaProvider(stubClosure: { _ in .immediate })
override func viewDidLoad() {
super.viewDidLoad()
self.title = "Plain Moya"
}
//MARK: Overrides
override func fetchUsers() {
self.provider.request(.allUsers) { result in
switch result {
case .success(let response):
self.processResponse(response)
case .failure(let error):
print("failed: \(error)")
}
}
}
fileprivate func processResponse(_ response: Response) {
let JSON = try! JSONSerialization.jsonObject(with: response.data, options: []) as! [String: Any]
if let users = JSON["users"] as? [[String:AnyObject]] {
self.users = users.map { (userDictionary:[String:AnyObject]) -> PlainMoyaUser? in
if let userID = userDictionary["id"] as? Int, let userName = userDictionary["name"] as? String {
return PlainMoyaUser(id: userID, name: userName, birthdate: nil)
} else {
return nil
}
}.compactMap { $0 }
DispatchQueue.main.async {
self.tableView.reloadData()
}
}
}
override func fetchUserDetail(_ user: UserType, showAlertClosure: @escaping (UserType) -> ()) {
self.provider.request(.user(userID: user.id.description)) { result in
switch result {
case .success(let response):
self.processUserDetailResponse(response, showAlertClosure: showAlertClosure)
case .failure(let error):
print("error: \(error)")
}
}
}
fileprivate func processUserDetailResponse(_ response: Response, showAlertClosure: @escaping (UserType) -> ()) {
let JSON = try! JSONSerialization.jsonObject(with: response.data, options: []) as! [String: Any]
if let userID = JSON["id"] as? Int,
let userName = JSON["name"] as? String,
let userBirthdate = JSON["birthdate"] as? String {
DispatchQueue.main.async {
showAlertClosure(PlainMoyaUser(id: userID, name: userName, birthdate: userBirthdate))
}
}
}
}
| 29.572917 | 116 | 0.553716 |
009402d9675e3984fc934206d6a66fad57a79900 | 341 | dart | Dart | road_monitoring_system/lib/login/model/user_account.dart | circleTreeF/2020_GRP_Team17 | e29bac4f5de54d34049da6549c82fefab3c016f5 | [
"MIT"
] | null | null | null | road_monitoring_system/lib/login/model/user_account.dart | circleTreeF/2020_GRP_Team17 | e29bac4f5de54d34049da6549c82fefab3c016f5 | [
"MIT"
] | null | null | null | road_monitoring_system/lib/login/model/user_account.dart | circleTreeF/2020_GRP_Team17 | e29bac4f5de54d34049da6549c82fefab3c016f5 | [
"MIT"
] | null | null | null |
///This class describe the information of the user who has logged in to this app.
class UserAccount {
static final UserAccount _singleton = UserAccount._internal();
///user_id of this user
int user_id;
///username of this user
String username;
factory UserAccount() {
return _singleton;
}
UserAccount._internal();
}
| 18.944444 | 81 | 0.715543 |
23b71045f2eb3c6b00312a3e23491a5721d19176 | 752 | lua | Lua | lua/snap/producer/vim/currentbuffer.lua | akinsho/snap | 79969a27fd581120288edae0fce282ce72b482b8 | [
"Unlicense"
] | 365 | 2021-06-09T02:41:45.000Z | 2022-03-22T03:43:14.000Z | lua/snap/producer/vim/currentbuffer.lua | akinsho/snap | 79969a27fd581120288edae0fce282ce72b482b8 | [
"Unlicense"
] | 82 | 2021-06-09T09:37:12.000Z | 2022-02-15T16:50:37.000Z | lua/snap/producer/vim/currentbuffer.lua | akinsho/snap | 79969a27fd581120288edae0fce282ce72b482b8 | [
"Unlicense"
] | 19 | 2021-06-09T16:15:55.000Z | 2022-03-11T13:16:32.000Z | local _2afile_2a = "fnl/snap/producer/vim/currentbuffer.fnl"
local snap = require("snap")
local function _2_(_1_)
local _arg_0_ = _1_
local winnr = _arg_0_["winnr"]
local bufnr
local function _3_(...)
return vim.api.nvim_win_get_buf(winnr, ...)
end
bufnr = snap.sync(_3_)
local filename
local function _4_(...)
return vim.api.nvim_buf_get_name(bufnr, ...)
end
filename = snap.sync(_4_)
local contents
local function _5_(...)
return vim.api.nvim_buf_get_lines(bufnr, 0, -1, false, ...)
end
contents = snap.sync(_5_)
local results = {}
for row, line in ipairs(contents) do
table.insert(results, snap.with_metas(line, {filename = filename, row = row}))
end
return coroutine.yield(results)
end
return _2_ | 27.851852 | 82 | 0.692819 |
39f35e571517a439b1de4c1f7176c15b09eb0728 | 706 | java | Java | src/main/java/org/arquillian/extension/VolkswagenExtension.java | aslakknutsen/arquillian-volkswagen | e4b073d734445261fb8ac2d070377504f4b2ea85 | [
"Apache-2.0"
] | 28 | 2015-10-08T15:56:53.000Z | 2018-02-22T12:13:55.000Z | src/main/java/org/arquillian/extension/VolkswagenExtension.java | aslakknutsen/arquillian-volkswagen | e4b073d734445261fb8ac2d070377504f4b2ea85 | [
"Apache-2.0"
] | null | null | null | src/main/java/org/arquillian/extension/VolkswagenExtension.java | aslakknutsen/arquillian-volkswagen | e4b073d734445261fb8ac2d070377504f4b2ea85 | [
"Apache-2.0"
] | null | null | null | package org.arquillian.extension;
import org.jboss.arquillian.core.api.annotation.Observes;
import org.jboss.arquillian.core.spi.LoadableExtension;
import org.jboss.arquillian.test.spi.TestResult;
import org.jboss.arquillian.test.spi.TestResult.Status;
public class VolkswagenExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
builder.observer(EnsureSuccess.class);
}
public static class EnsureSuccess {
@SuppressWarnings("deprecation")
public void enforce(@Observes(precedence = -10000) TestResult result) {
result.setStatus(Status.PASSED);
result.setThrowable(null);
}
}
}
| 28.24 | 79 | 0.729462 |
bc6016bd218eb64461415c1779c2a65bf0249cb3 | 968 | lua | Lua | gamemodes/perp/gamemode/properties/old_industrial.lua | RobCod/PERP | 0fd4fa653074722319c24c8370313f34bd96b66e | [
"MIT"
] | 7 | 2016-01-07T19:29:45.000Z | 2021-04-17T06:34:42.000Z | gamemodes/perp/gamemode/properties/old_industrial.lua | RobCod/PERP | 0fd4fa653074722319c24c8370313f34bd96b66e | [
"MIT"
] | 2 | 2019-12-07T16:40:35.000Z | 2019-12-07T17:15:40.000Z | gamemodes/perp/gamemode/properties/old_industrial.lua | RobCod/PERP | 0fd4fa653074722319c24c8370313f34bd96b66e | [
"MIT"
] | 14 | 2016-05-19T18:25:20.000Z | 2022-03-10T06:48:07.000Z |
/*
PROPERTY = {};
PROPERTY.ID = 115;
PROPERTY.Name = "Old Industrial";
PROPERTY.Category = "Business";
PROPERTY.Description = "A Small Industrial House With A Storage And A Big Courtyard. Placed In Industrial Area.";
PROPERTY.Image = "ev17x_oldindustrialfirm";
PROPERTY.Cost = 2500;
PROPERTY.Doors = {
{Vector(694, 4067, 136), '*161'},
{Vector(694, 3955, 136), '*162'},
{Vector(694, 3851, 136), '*164'},
{Vector(694, 3739, 136), '*163'},
{Vector(743, 4093, 126.25), 'models/props_c17/door01_left.mdl'},
{Vector(566, 4571, 126.25), 'models/props_c17/door01_left.mdl'},
{Vector(845, 4528, 126.25), 'models/props_c17/door01_left.mdl'},
{Vector(845, 4592, 126.25), 'models/props_c17/door01_left.mdl'},
{Vector(937, 4101, 136), '*166'},
{Vector(937, 4220, 136), '*165'},
{Vector(1312, 4603, 144), '*159'},
{Vector(1084, 4603, 144), '*160'},
};
GAMEMODE:RegisterProperty(PROPERTY);
*/ | 31.225806 | 113 | 0.618802 |
96dee49297b99eadc105b5ced64b974e59e36e35 | 1,207 | sql | SQL | sql/t_auth_record.sql | shenlanAZ/oauth2-client-demo | 2a06db56cc4fb2dd8068399915f599b8ff5b2a74 | [
"MIT"
] | null | null | null | sql/t_auth_record.sql | shenlanAZ/oauth2-client-demo | 2a06db56cc4fb2dd8068399915f599b8ff5b2a74 | [
"MIT"
] | null | null | null | sql/t_auth_record.sql | shenlanAZ/oauth2-client-demo | 2a06db56cc4fb2dd8068399915f599b8ff5b2a74 | [
"MIT"
] | null | null | null | /*
Navicat MySQL Data Transfer
Source Server : 10.68.165.163_mariadb_3306
Source Server Type : MariaDB
Source Server Version : 100406
Source Host : 10.68.165.163:3306
Source Schema : oauth_client_demo
Target Server Type : MariaDB
Target Server Version : 100406
File Encoding : 65001
Date: 28/06/2019 10:50:27
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for t_auth_record
-- ----------------------------
DROP TABLE IF EXISTS `t_auth_record`;
CREATE TABLE `t_auth_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`auth_server_name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'oauth2的来源服务名',
`auth_user_id` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'oauth2来源的用户唯一ID',
`user_id` int(11) NULL DEFAULT NULL COMMENT '系统内的用户id',
`access_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
`expired_time` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = Aria CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Page;
SET FOREIGN_KEY_CHECKS = 1;
| 33.527778 | 115 | 0.704225 |
9c5c9103e948c6907cfb91ee0f93a40a768153a3 | 4,700 | js | JavaScript | src/pages/Login.js | chachakawooka/credits-slots | d21abee5cb8ae8a74daabdbed4af1bcad3bed6ac | [
"MIT"
] | 1 | 2019-07-04T08:38:06.000Z | 2019-07-04T08:38:06.000Z | src/pages/Login.js | chachakawooka/credits-slots | d21abee5cb8ae8a74daabdbed4af1bcad3bed6ac | [
"MIT"
] | null | null | null | src/pages/Login.js | chachakawooka/credits-slots | d21abee5cb8ae8a74daabdbed4af1bcad3bed6ac | [
"MIT"
] | null | null | null | import React from 'react';
import PropTypes from 'prop-types';
import Avatar from '@material-ui/core/Avatar';
import Button from '@material-ui/core/Button';
import CssBaseline from '@material-ui/core/CssBaseline';
import TextField from '@material-ui/core/TextField';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Checkbox from '@material-ui/core/Checkbox';
import Link from '@material-ui/core/Link';
import Grid from '@material-ui/core/Grid';
import Box from '@material-ui/core/Box';
import LockOutlinedIcon from '@material-ui/icons/LockOutlined';
import Typography from '@material-ui/core/Typography';
import Container from '@material-ui/core/Container';
import {Navigation} from 'react-router';
import loginStyles from './Login.module.css';
import styles from '../Components/Game.module.css';
class Login extends React.Component {
constructor(props) {
super(props)
this.state = {
privateKey: '',
publicKey: '',
nodeUrl: 'https://proxy.cap.davidwalsh.dev'
}
}
privateKey(e) {
this.setState({ privateKey: e.target.value })
}
publicKey(e) {
this.setState({ publicKey: e.target.value })
}
nodeUrl(e) {
this.setState({ nodeUrl: e.target.value })
}
submitLogin(){
window.Url = this.state.nodeUrl
window.Cs_PrivateKey = this.state.privateKey
window.Cs_PublicKey = this.state.publicKey
if(window.Url && window.Cs_PrivateKey && window.Cs_PublicKey){
this.props.history.push('/');
}
}
render() {
return (
<div className={styles.gridcontainer}>
<div className={styles.notSlots}>
<div className={loginStyles.loginWrap}>
<Container component="main" maxWidth="xs">
<CssBaseline />
<div className={styles.paper}>
<div className={styles.form} noValidate>
<TextField
variant="outlined"
margin="normal"
required
fullWidth
id="privateKey"
label="Private Key"
name="privateKey"
autoFocus
onChange={this.privateKey.bind(this)}
/>
<TextField
variant="outlined"
margin="normal"
required
fullWidth
id="publicKey"
label="Public Key"
name="publicKey"
autoFocus
onChange={this.publicKey.bind(this)}
/>
<TextField
variant="outlined"
margin="normal"
required
fullWidth
id="Node"
label="Node"
name="Node"
autoFocus
value="https://proxy.cap.davidwalsh.dev"
onChange={this.nodeUrl.bind(this)}
/>
<Button
type="submit"
fullWidth
variant="contained"
color="primary"
className={styles.submit}
onClick={this.submitLogin.bind(this)}
>
Sign In
</Button>
</div>
</div>
</Container>
</div>
</div>
<div className={styles.Balance}>
<div className={styles.topWrap}>
<h2>Balance</h2>
<h3>0.00</h3>
</div>
</div>
<div className={styles.Win}>
<div className={styles.topWrap}>
<h2>Last Win</h2>
<h3>0.00</h3>
</div>
</div>
<div className={styles.LOGO}><h1>CS<em>SLOTS</em></h1></div>
<div className={styles.PayTable}></div>
<div className={styles.MakeYourOwn}></div>
<div className={styles.SPIN}>
</div>
<div className={styles.Bet}>
</div>
</div>
);
}
}
export default Login; | 32.638889 | 70 | 0.451277 |
a673767999d8600d22c1e651e19ed0af75ae88f9 | 353 | swift | Swift | Tests/LinuxMain.swift | HarishKataria/Triff | 3afe12d9139464d54ded1b5cf3a59fffff52f6d4 | [
"MIT"
] | null | null | null | Tests/LinuxMain.swift | HarishKataria/Triff | 3afe12d9139464d54ded1b5cf3a59fffff52f6d4 | [
"MIT"
] | null | null | null | Tests/LinuxMain.swift | HarishKataria/Triff | 3afe12d9139464d54ded1b5cf3a59fffff52f6d4 | [
"MIT"
] | null | null | null | //**************************************************************
//
// TriffTests
//
// Created by Harish Kataria
// Copyright © 2019 Harish Kataria. All rights reserved.
//
//**************************************************************
import XCTest
import TriffTests
var tests = [XCTestCaseEntry]()
tests += TriffTests.allTests()
XCTMain(tests)
| 23.533333 | 64 | 0.456091 |
26731ec551ad7609d8f4ec429fa837dbe5b5206e | 5,943 | java | Java | herddb-core/src/main/java/herddb/sql/SQLRecordKeyFunction.java | fossabot/herddb | 825b2259bbc4f6849b54a77e93a3ae3ce3f5268c | [
"Apache-2.0"
] | null | null | null | herddb-core/src/main/java/herddb/sql/SQLRecordKeyFunction.java | fossabot/herddb | 825b2259bbc4f6849b54a77e93a3ae3ce3f5268c | [
"Apache-2.0"
] | null | null | null | herddb-core/src/main/java/herddb/sql/SQLRecordKeyFunction.java | fossabot/herddb | 825b2259bbc4f6849b54a77e93a3ae3ce3f5268c | [
"Apache-2.0"
] | null | null | null | /*
Licensed to Diennea S.r.l. under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. Diennea S.r.l. licenses this file
to you 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 herddb.sql;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import herddb.codec.RecordSerializer;
import herddb.model.Column;
import herddb.model.Record;
import herddb.model.RecordFunction;
import herddb.model.StatementEvaluationContext;
import herddb.model.StatementExecutionException;
import herddb.model.TableContext;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.jsqlparser.expression.Expression;
import herddb.model.ColumnsList;
import herddb.sql.expressions.CompiledSQLExpression;
import herddb.sql.expressions.SQLExpressionCompiler;
import herddb.utils.DataAccessor;
/**
* Record mutator using SQL
*
* @author enrico.olivelli
*/
public class SQLRecordKeyFunction extends RecordFunction {
private final List<CompiledSQLExpression> expressions;
private final herddb.model.Column[] columns;
private final String[] pkColumnNames;
private final ColumnsList table;
private final boolean fullPrimaryKey;
private final boolean isConstant;
public SQLRecordKeyFunction(ColumnsList table, List<String> expressionToColumn, List<Expression> expressions) {
this.table = table;
this.columns = new Column[expressions.size()];
this.expressions = new ArrayList<>();
this.pkColumnNames = new String[expressions.size()];
int i = 0;
boolean constant = true;
for (String cexp : expressionToColumn) {
Column pkcolumn = table.getColumn(cexp);
this.columns[i] = pkcolumn;
Expression exp = expressions.get(i);
this.expressions.add(SQLExpressionCompiler.compileExpression(null, exp));
if (!SQLRecordPredicate.isConstant(exp)) {
constant = false;
}
i++;
}
this.isConstant = constant;
int k = 0;
String[] primaryKey = table.getPrimaryKey();
for (String pk : primaryKey) {
if (expressionToColumn.contains(pk)) {
this.pkColumnNames[k++] = pk;
}
}
this.fullPrimaryKey = (primaryKey.length == columns.length);
}
public SQLRecordKeyFunction(List<String> expressionToColumn,
List<CompiledSQLExpression> expressions, ColumnsList table) {
this.table = table;
final int size = expressions.size();
this.columns = new Column[size];
this.expressions = new ArrayList<>();
this.pkColumnNames = new String[size];
int i = 0;
boolean constant = true;
for (String cexp : expressionToColumn) {
Column pkcolumn = table.getColumn(cexp);
this.columns[i] = pkcolumn;
CompiledSQLExpression exp = expressions.get(i);
this.expressions.add(exp);
if (!SQLRecordPredicate.isConstant(exp)) {
constant = false;
}
i++;
}
this.isConstant = constant;
int k = 0;
String[] primaryKey = table.getPrimaryKey();
for (String pk : primaryKey) {
if (expressionToColumn.contains(pk)) {
this.pkColumnNames[k++] = pk;
}
}
this.fullPrimaryKey = (primaryKey.length == columns.length);
}
public boolean isFullPrimaryKey() {
return fullPrimaryKey;
}
@Override
@SuppressFBWarnings("BC_UNCONFIRMED_CAST")
public byte[] computeNewValue(Record previous, StatementEvaluationContext context, TableContext tableContext) throws StatementExecutionException {
SQLStatementEvaluationContext statementEvaluationContext = (SQLStatementEvaluationContext) context;
if (isConstant) {
byte[] cachedResult = (byte[]) statementEvaluationContext.getConstant(this);
if (cachedResult != null) {
return cachedResult;
}
}
Map<String, Object> pk = new HashMap<>();
for (int i = 0; i < columns.length; i++) {
herddb.model.Column c = columns[i];
CompiledSQLExpression expression = expressions.get(i);
Object value = expression.evaluate(DataAccessor.NULL, context);
value = RecordSerializer.convert(c.type, value);
pk.put(c.name, value);
}
try {
// maybe this is only a partial primary key
byte[] result = RecordSerializer.serializePrimaryKeyRaw(pk, table, pkColumnNames);
if (isConstant) {
statementEvaluationContext.cacheConstant(this, result);
}
return result;
} catch (Exception err) {
throw new StatementExecutionException("error while converting primary key " + pk + ": " + err, err);
}
}
@Override
public String toString() {
StringBuilder b = new StringBuilder("SQLRecordKeyFunction (fullPrimaryKey=" + fullPrimaryKey + "):");
for (int i = 0; i < pkColumnNames.length; i++) {
if (i > 0) {
b.append(" AND ");
}
b.append(pkColumnNames[i]).append("=").append(expressions.get(i));
}
return b.toString();
}
}
| 36.913043 | 150 | 0.64597 |
6e40d36e69a538efa07dcbea11bb9c4627b97438 | 220 | html | HTML | banner.html | cjvanlissa/Doing-Meta-Analysis-in-R | e84da0dfd2e052e59f3daef1cae59d229ab133f8 | [
"CC0-1.0"
] | 4 | 2021-03-21T22:41:37.000Z | 2022-01-27T17:36:32.000Z | banner.html | cjvanlissa/Doing-Meta-Analysis-in-R | e84da0dfd2e052e59f3daef1cae59d229ab133f8 | [
"CC0-1.0"
] | null | null | null | banner.html | cjvanlissa/Doing-Meta-Analysis-in-R | e84da0dfd2e052e59f3daef1cae59d229ab133f8 | [
"CC0-1.0"
] | 2 | 2020-04-08T07:50:05.000Z | 2021-11-22T03:47:33.000Z | <!DOCTYPE html>
<html>
<head>
</head>
<body>
<!--img src="https://raw.githubusercontent.com/MathiasHarrer/Doing-Meta-Analysis-in-R/master/banner.jpg" alt="banner" /-->
</body>
</html>
| 18.333333 | 125 | 0.572727 |
81199c18698d9d011a4f9816f652cd4affc195ab | 6,876 | swift | Swift | NextLevelSessionExporter/SessionExporter/ViewController.swift | dylanreich/NextLevelSessionExporter | 7368d5313202b55a2e1c05672b4e24ce749937e1 | [
"MIT"
] | null | null | null | NextLevelSessionExporter/SessionExporter/ViewController.swift | dylanreich/NextLevelSessionExporter | 7368d5313202b55a2e1c05672b4e24ce749937e1 | [
"MIT"
] | null | null | null | NextLevelSessionExporter/SessionExporter/ViewController.swift | dylanreich/NextLevelSessionExporter | 7368d5313202b55a2e1c05672b4e24ce749937e1 | [
"MIT"
] | null | null | null | //
// ViewController.swift
// NextLevelSessionExporter (http://nextlevel.engineering/)
//
// Copyright (c) 2016-present patrick piemonte (http://patrickpiemonte.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
import UIKit
import AVFoundation
import Photos
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Note: alternatively, one can use asset.nextlevel_export(...)
// .nextlevel_export(outputURL: tmpURL, videoOutputConfiguration: videoOutputConfig, audioOutputConfiguration: audioOutputConfig) {
// }
let asset = AVAsset(url: Bundle.main.url(forResource: "TestVideo", withExtension: "mov")!)
let exporter = NextLevelSessionExporter(withAsset: asset)
exporter.outputFileType = AVFileType.mp4
let tmpURL = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)
.appendingPathComponent(ProcessInfo().globallyUniqueString)
.appendingPathExtension("mp4")
exporter.outputURL = tmpURL
let compressionDict: [String: Any] = [
AVVideoAverageBitRateKey: NSNumber(integerLiteral: 6000000),
AVVideoProfileLevelKey: AVVideoProfileLevelH264HighAutoLevel as String,
]
exporter.videoOutputConfiguration = [
AVVideoCodecKey: AVVideoCodecH264,
AVVideoWidthKey: NSNumber(integerLiteral: 1920),
AVVideoHeightKey: NSNumber(integerLiteral: 1080),
AVVideoScalingModeKey: AVVideoScalingModeResizeAspectFill,
AVVideoCompressionPropertiesKey: compressionDict
]
exporter.audioOutputConfiguration = [
AVFormatIDKey: kAudioFormatMPEG4AAC,
AVEncoderBitRateKey: NSNumber(integerLiteral: 128000),
AVNumberOfChannelsKey: NSNumber(integerLiteral: 2),
AVSampleRateKey: NSNumber(value: Float(44100))
]
do {
try exporter.export(progressHandler: { (progress) in
print(progress)
}, devicePosition: .unspecified, completionHandler: { (status) in
switch status {
case .completed:
print("NextLevelSessionExporter, export completed, \(exporter.outputURL?.description ?? "")")
self.saveVideo(withURL: exporter.outputURL!)
break
case .cancelled:
print("NextLevelSessionExporter, export cancelled")
break
case .failed:
print("NextLevelSessionExporter, failed to export")
break
case .exporting:
fallthrough
case .waiting:
fallthrough
default:
print("NextLevelSessionExporter, did not complete")
break
}
})
} catch {
print("NextLevelSessionExporter, failed to export")
}
}
private func saveVideo(withURL url: URL) {
PHPhotoLibrary.shared().performChanges({
let albumAssetCollection = self.albumAssetCollection(withTitle: "Next Level")
if albumAssetCollection == nil {
let changeRequest = PHAssetCollectionChangeRequest.creationRequestForAssetCollection(withTitle: "Next Level")
let _ = changeRequest.placeholderForCreatedAssetCollection
}}, completionHandler: { (success1: Bool, error1: Error?) in
if let albumAssetCollection = self.albumAssetCollection(withTitle: "Next Level") {
PHPhotoLibrary.shared().performChanges({
if let assetChangeRequest = PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: url) {
let assetCollectionChangeRequest = PHAssetCollectionChangeRequest(for: albumAssetCollection)
let enumeration: NSArray = [assetChangeRequest.placeholderForCreatedAsset!]
assetCollectionChangeRequest?.addAssets(enumeration)
}
}, completionHandler: { (success2: Bool, error2: Error?) in
if success2 == true {
// prompt that the video has been saved
let alertController = UIAlertController(title: "Video Saved!", message: "Saved to the camera roll.", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alertController.addAction(okAction)
self.present(alertController, animated: true, completion: nil)
} else {
// prompt that the video has been saved
let alertController = UIAlertController(title: "Something failed!", message: "Something failed!", preferredStyle: .alert)
let okAction = UIAlertAction(title: "OK", style: .default, handler: nil)
alertController.addAction(okAction)
self.present(alertController, animated: true, completion: nil)
}
})
}
})
}
private func albumAssetCollection(withTitle title: String) -> PHAssetCollection? {
let predicate = NSPredicate(format: "localizedTitle = %@", title)
let options = PHFetchOptions()
options.predicate = predicate
let result = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .any, options: options)
if result.count > 0 {
return result.firstObject
}
return nil
}
}
| 49.114286 | 152 | 0.618237 |