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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ad3841faa7a76da3624f33e00961957f09121992 | 2,466 | rs | Rust | src/message_dialog.rs | talklittle/gtk | b3af34228bef07e0c22829437d73144857fa44d7 | [
"MIT"
] | null | null | null | src/message_dialog.rs | talklittle/gtk | b3af34228bef07e0c22829437d73144857fa44d7 | [
"MIT"
] | null | null | null | src/message_dialog.rs | talklittle/gtk | b3af34228bef07e0c22829437d73144857fa44d7 | [
"MIT"
] | null | null | null | // Copyright 2013-2016, The Gtk-rs Project Developers.
// See the COPYRIGHT file at the top-level directory of this distribution.
// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
use libc::c_char;
use ffi;
use glib::translate::*;
use glib::object::{Downcast, IsA};
use std::ptr;
use ButtonsType;
use DialogFlags;
use MessageDialog;
use MessageType;
use Widget;
use Window;
impl MessageDialog {
pub fn new<T: IsA<Window>>(parent: Option<&T>, flags: DialogFlags, type_: MessageType,
buttons: ButtonsType, message: &str) -> MessageDialog {
assert_initialized_main_thread!();
unsafe {
let message: Stash<*const c_char, _> = message.to_glib_none();
Widget::from_glib_none(
ffi::gtk_message_dialog_new(parent.to_glib_none().0, flags.to_glib(), type_.to_glib(), buttons.to_glib(),
b"%s\0".as_ptr() as *const c_char, message.0, ptr::null::<c_char>()))
.downcast_unchecked()
}
}
}
pub trait MessageDialogExt {
fn set_secondary_markup(&self, message: Option<&str>);
fn set_secondary_text(&self, message: Option<&str>);
}
impl<O: IsA<MessageDialog>> MessageDialogExt for O {
fn set_secondary_markup(&self, message: Option<&str>) {
match message {
Some(m) => unsafe {
let message: Stash<*const c_char, _> = m.to_glib_none();
ffi::gtk_message_dialog_format_secondary_markup(
self.to_glib_none().0, b"%s\0".as_ptr() as *const c_char, message.0,
ptr::null::<c_char>())
},
None => unsafe {
ffi::gtk_message_dialog_format_secondary_markup(
self.to_glib_none().0,
ptr::null::<c_char>())
},
}
}
fn set_secondary_text(&self, message: Option<&str>) {
match message {
Some(m) => unsafe {
let message: Stash<*const c_char, _> = m.to_glib_none();
ffi::gtk_message_dialog_format_secondary_text(
self.to_glib_none().0,
b"%s\0".as_ptr() as *const c_char, message.0, ptr::null::<c_char>())
},
None => unsafe {
ffi::gtk_message_dialog_format_secondary_text(
self.to_glib_none().0,
ptr::null::<c_char>())
},
}
}
}
| 34.732394 | 121 | 0.573804 |
13015e01ffeb662b5d380419682e3cde5d235705 | 4,040 | kt | Kotlin | komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/MediaDao.kt | TSedlar/komga | 78b215ee1e8380305415a441f02e563e39ec60ba | [
"MIT"
] | null | null | null | komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/MediaDao.kt | TSedlar/komga | 78b215ee1e8380305415a441f02e563e39ec60ba | [
"MIT"
] | null | null | null | komga/src/main/kotlin/org/gotson/komga/infrastructure/jooq/MediaDao.kt | TSedlar/komga | 78b215ee1e8380305415a441f02e563e39ec60ba | [
"MIT"
] | null | null | null | package org.gotson.komga.infrastructure.jooq
import org.gotson.komga.domain.model.BookPage
import org.gotson.komga.domain.model.Media
import org.gotson.komga.domain.persistence.MediaRepository
import org.gotson.komga.jooq.Tables
import org.gotson.komga.jooq.tables.records.MediaPageRecord
import org.gotson.komga.jooq.tables.records.MediaRecord
import org.jooq.DSLContext
import org.springframework.stereotype.Component
import java.time.LocalDateTime
@Component
class MediaDao(
private val dsl: DSLContext
) : MediaRepository {
private val m = Tables.MEDIA
private val p = Tables.MEDIA_PAGE
private val f = Tables.MEDIA_FILE
private val groupFields = arrayOf(*m.fields(), *p.fields())
override fun findById(bookId: Long): Media =
dsl.select(*groupFields)
.from(m)
.leftJoin(p).on(m.BOOK_ID.eq(p.BOOK_ID))
.where(m.BOOK_ID.eq(bookId))
.groupBy(*groupFields)
.orderBy(p.NUMBER.asc())
.fetchGroups(
{ it.into(m) }, { it.into(p) }
).map { (mr, pr) ->
val files = dsl.selectFrom(f)
.where(f.BOOK_ID.eq(bookId))
.fetchInto(f)
.map { it.fileName }
mr.toDomain(pr.filterNot { it.bookId == null }.map { it.toDomain() }, files)
}.first()
override fun getThumbnail(bookId: Long): ByteArray? =
dsl.select(m.THUMBNAIL)
.from(m)
.where(m.BOOK_ID.eq(bookId))
.fetchOne(0, ByteArray::class.java)
override fun insert(media: Media): Media {
dsl.transaction { config ->
with(config.dsl())
{
insertInto(m)
.set(m.BOOK_ID, media.bookId)
.set(m.STATUS, media.status.toString())
.set(m.MEDIA_TYPE, media.mediaType)
.set(m.THUMBNAIL, media.thumbnail)
.set(m.COMMENT, media.comment)
.set(m.PAGE_COUNT, media.pages.size.toLong())
.execute()
insertPages(this, media)
insertFiles(this, media)
}
}
return findById(media.bookId)
}
private fun insertPages(dsl: DSLContext, media: Media) {
media.pages.forEachIndexed { index, page ->
dsl.insertInto(p)
.set(p.BOOK_ID, media.bookId)
.set(p.FILE_NAME, page.fileName)
.set(p.MEDIA_TYPE, page.mediaType)
.set(p.NUMBER, index)
.execute()
}
}
private fun insertFiles(dsl: DSLContext, media: Media) {
media.files.forEach {
dsl.insertInto(f)
.set(f.BOOK_ID, media.bookId)
.set(f.FILE_NAME, it)
.execute()
}
}
override fun update(media: Media) {
dsl.transaction { config ->
with(config.dsl())
{
update(m)
.set(m.STATUS, media.status.toString())
.set(m.MEDIA_TYPE, media.mediaType)
.set(m.THUMBNAIL, media.thumbnail)
.set(m.COMMENT, media.comment)
.set(m.PAGE_COUNT, media.pages.size.toLong())
.set(m.LAST_MODIFIED_DATE, LocalDateTime.now())
.where(m.BOOK_ID.eq(media.bookId))
.execute()
deleteFrom(p)
.where(p.BOOK_ID.eq(media.bookId))
.execute()
deleteFrom(f)
.where(f.BOOK_ID.eq(media.bookId))
.execute()
insertPages(this, media)
insertFiles(this, media)
}
}
}
override fun delete(bookId: Long) {
dsl.transaction { config ->
with(config.dsl())
{
deleteFrom(p).where(p.BOOK_ID.eq(bookId)).execute()
deleteFrom(f).where(f.BOOK_ID.eq(bookId)).execute()
deleteFrom(m).where(m.BOOK_ID.eq(bookId)).execute()
}
}
}
private fun MediaRecord.toDomain(pages: List<BookPage>, files: List<String>) =
Media(
status = Media.Status.valueOf(status),
mediaType = mediaType,
thumbnail = thumbnail,
pages = pages,
files = files,
comment = comment,
bookId = bookId,
createdDate = createdDate,
lastModifiedDate = lastModifiedDate
)
private fun MediaPageRecord.toDomain() =
BookPage(
fileName = fileName,
mediaType = mediaType
)
}
| 27.114094 | 84 | 0.615594 |
75fa9353f2449a4f3ace86fd1e30b38d633fd6c1 | 117 | sql | SQL | data/open-source/extracted_sql/synapsestudios_synapse-base.sql | tushartushar/dbSmellsData | 07d53621825746fe38c27f47bead960b9cda0556 | [
"MIT"
] | 2 | 2017-11-26T22:35:16.000Z | 2019-07-23T10:40:12.000Z | data/open-source/extracted_sql/synapsestudios_synapse-base.sql | tushartushar/dbSmellsData | 07d53621825746fe38c27f47bead960b9cda0556 | [
"MIT"
] | 1 | 2019-07-23T10:40:06.000Z | 2019-07-24T03:11:21.000Z | data/open-source/extracted_sql/synapsestudios_synapse-base.sql | tushartushar/dbSmellsData | 07d53621825746fe38c27f47bead960b9cda0556 | [
"MIT"
] | 1 | 2022-01-14T14:46:23.000Z | 2022-01-14T14:46:23.000Z | CREATE TABLE IF NOT EXISTS `app_migrations` ( `timestamp` VARCHAR(14) NOT NULL, `description` VARCHAR(100) NOT NULL)
| 58.5 | 116 | 0.760684 |
9c740f6912e80710c3652fcb6e4eb666f80ca50c | 648 | js | JavaScript | docs/html/search/functions_c.js | Jannled/J3ngine | b0a0484aa42baedc057082718e54b61b52ea1fb8 | [
"MIT"
] | null | null | null | docs/html/search/functions_c.js | Jannled/J3ngine | b0a0484aa42baedc057082718e54b61b52ea1fb8 | [
"MIT"
] | null | null | null | docs/html/search/functions_c.js | Jannled/J3ngine | b0a0484aa42baedc057082718e54b61b52ea1fb8 | [
"MIT"
] | null | null | null | var searchData=
[
['render_245',['render',['../class_model.html#a23d73ad85c992469cfc1baef2bc715d5',1,'Model::render()'],['../class_scene.html#acca6946123f92816e17746bcd8b88e58',1,'Scene::render()']]],
['rendercube_246',['renderCube',['../class_cube_map.html#a86364029cd8831d35b1ff11dc16b5d81',1,'CubeMap']]],
['renderquad_247',['renderQuad',['../class_cube_map.html#af229a9950268730c7e9ccc8703e525e5',1,'CubeMap']]],
['renderskybox_248',['renderSkybox',['../class_cube_map.html#ad78bc228bee185ab338dce67dcbe783f',1,'CubeMap']]],
['resize_249',['resize',['../namespace_g_l_window.html#a4efbb10bee2861c7703c0372442c37f3',1,'GLWindow']]]
];
| 72 | 184 | 0.746914 |
bb46acc2f62b7a9572495e198e9181a0c24a6b9a | 828 | html | HTML | manuscript/page-45/body.html | marvindanig/the-prince-and-the-pauper | d439084e603a656110b37fb28127811c9eb34dd4 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | manuscript/page-45/body.html | marvindanig/the-prince-and-the-pauper | d439084e603a656110b37fb28127811c9eb34dd4 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | manuscript/page-45/body.html | marvindanig/the-prince-and-the-pauper | d439084e603a656110b37fb28127811c9eb34dd4 | [
"BlueOak-1.0.0",
"CC-BY-4.0",
"Unlicense"
] | null | null | null | <div class="leaf flex"><div class="inner justify"><p class="no-indent ">Pudding Lane.”</p><p>“Offal Court! Truly ’tis another odd one. Hast parents?”</p><p>“Parents have I, sir, and a grand-dam likewise that is but indifferently precious to me, God forgive me if it be offence to say it—also twin sisters, Nan and Bet.”</p><p>“Then is thy grand-dam not over kind to thee, I take it?”</p><p>“Neither to any other is she, so please your worship. She hath a wicked heart, and worketh evil all her days.”</p><p>“Doth she mistreat thee?”</p><p>“There be times that she stayeth her hand, being asleep or overcome with drink; but when she hath her judgment clear again, she maketh it up to me with goodly beatings.”</p><p>A fierce look came into the little prince’s eyes, and he cried out—</p><p>“What! Beatings?”</p></div> </div> | 828 | 828 | 0.714976 |
1c630cfe3adcd893f84ffdf1259d81099e3eb544 | 9,887 | css | CSS | css/casing.css | singcl/angular-new | 5e07c9ab4cef04d60246e243321dd8816b495773 | [
"MIT"
] | null | null | null | css/casing.css | singcl/angular-new | 5e07c9ab4cef04d60246e243321dd8816b495773 | [
"MIT"
] | null | null | null | css/casing.css | singcl/angular-new | 5e07c9ab4cef04d60246e243321dd8816b495773 | [
"MIT"
] | null | null | null | @charset "UTF-8";
.header {
position: relative;
width: 100%;
line-height: 40px;
/*对块级元素设置行高就可以使下面的浮动元素对齐,具体原因呢?*/
}
.font-x {
font-size: 1.5rem;
}
.bg-blue {
color: #fff;
background-color: #1d7ad9;
}
.bg-blue.lter,
.bg-blue .lter {
background-color: #1d7ad9;
}
.header.casing ul li {
width: 30%;
padding-left: 3%;
text-align: center;
transition: width 0.5s, background-color 0.5s;
/* W3C:IE9以及更早的IE版本不支持transition */
-moz-transition: width 0.5s, background-color 0.5s;
/* Firefox 4 */
-webkit-transition: width 0.5s, background-color 0.5s;
/* Safari and Chrome */
-o-transition: width 0.5s, background-color 0.5s;
/* Opera */
/* vertical-align: middle; 这段代码会使浮动的ul不能垂直对齐,具体原因不知道???*/
}
.header.casing ul li:hover {
width: 35%;
text-align: center;
color: black;
background-color: #fff;
cursor: pointer;
}
.header.casing li:first-child {
border-left: 1px solid #fff;
}
@media screen and (max-width: 768px) {
.header.casing ul {
text-align: left;
}
.header.casing ul li {
width: 30%;
border-left-style: none!important;
}
.header.casing ul li:hover {
width: 40%;
}
}
@media screen and (max-width: 500px) {
.header.casing ul {
text-align: left;
}
.header.casing ul li {
width: 40%;
border-left-style: none!important;
}
.header.casing ul li:hover {
width: 50%;
}
}
/*Header End*/
.nav-casing {
background-color: #f9f9f9;
}
.nav-casing ul {
margin: 2% 0 2% -5px;
}
.nav-casing ul li {
padding: 1% 2%;
margin-left: 2%;
font-size: 1.6rem;
background-color: #fff;
border-right: 1px solid #e6e6e6;
border-bottom: 1px solid #e6e6e6;
border-radius: 6px;
-moz-border-radius: 6px;
/* 老的 Firefox */
transition: background-color 0.3s, color 0.3s;
/* W3C:IE9以及更早的IE版本不支持transition */
-moz-transition: background-color 0.3s, color 0.3s;
/* Firefox 4 */
-webkit--moz-transition: background-color 0.3s, color 0.3s;
/* Safari and Chrome */
-o-transition: background-color 0.3s, color 0.3s;
/* Opera */
}
.nav-casing ul li:hover {
color: #fff;
background-color: #3985db;
cursor: pointer;
}
.nav-casing li:first-child {
color: #fff;
background-color: #1d7ad9;
}
.nav-casing li.active a {
color: #fff;
}
.bg-white.dim {
color: #999;
background-color: #f9f9f9;
}
.footer-top {
padding: 3% 0;
}
.footer-top .col-two li {
padding-right: 4%;
}
.footer-top .col-two li a {
color: #999;
text-decoration: none;
}
.footer-top .col-two li a:hover {
color: orange;
border-bottom: 1px solid #3985db;
}
.footer-top li.about-us a {
color: #3985db;
}
.footer-top .col-three li {
padding-left: 0;
vertical-align: middle;
}
.footer-top .col-three li P {
margin-bottom: 7px;
}
.footer-bottom.casing ul {
list-style-type: none;
margin: 0.8% 0;
text-align: center;
}
.footer-bottom.casing ul li {
display: inline-block;
padding-left: 5px;
}
@media screen and (max-width: 768px) {
.footer-top .col-three ul {
text-align: left;
}
.footer-top .col-three ul li {
padding-left: 5px!important;
}
}
@media screen and (max-width: 768px) {
html {
font-size: 60%!important;
}
}
.main.casing {
margin-bottom: 2%;
}
ul.mask {
float: right;
width: 50%;
padding: 3% 0;
text-align: right;
letter-spacing: -4px;
}
ul.mask > li {
width: 24.5%;
margin-left: -3px;
text-align: center;
}
ul.mask > li ul {
position: relative;
width: 100%;
padding: 3% 0;
letter-spacing: -5px;
/*font-size:0;
-webkit-text-size-adjust:none; 该方法+兼容代码可以去除chrome浏览器inline-block间的空格*/
}
ul.mask > li ul li.line {
position: absolute;
top: 50%;
left: 0;
width: 100%;
padding: 1.5% 0;
margin-top: -2%;
background-color: #ccc;
}
ul.mask > li p {
padding-top: 7%;
font-size: 1.5rem;
color: #ccc;
letter-spacing: 1px;
}
ul.mask li {
display: inline-block;
list-style-type: none;
vertical-align: middle;
}
ul.process-one > li {
background-color: #ff7f02!important;
}
p.step-one {
color: #ff7f02!important;
}
.line-one {
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
li.circle {
position: relative;
z-index: 1;
width: 2rem;
height: 2rem;
padding: 1.5% 0;
color: #fff;
letter-spacing: -1px;
background-color: #ccc;
border-radius: 50%;
-moz-border-radius: 50%;
/* 老的 Firefox */
}
.line-three {
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
}
@media screen and (max-width: 768px) {
ul.mask {
float: left;
width: 100%;
}
ul.mask p {
letter-spacing: -1px !important;
}
}
p.start-box {
padding-left: 1%;
font-size: 1.8rem;
border-left: 4px solid #1d7ad9;
}
input[type="radio"].radios {
display: inline-block;
margin-top: 0;
opacity: 0;
filter: alpha(opacity=0);
/* IE8 以及更早的浏览器 */
}
label.radios {
padding-left: 27px;
margin-left: -20px;
background-position: left 59%;
}
input[type="radio"].radios:checked + label.radios {
background-position: left 77%;
}
.sprite1 {
background: url(../img/casing1.png) no-repeat;
}
.row-typle {
margin: 0;
font-size: 1.6rem;
border: 1px solid #e8e8e8;
border: none;
}
.row-typle .box-style {
padding-top: 1%;
padding-bottom: 1%;
background-color: #f4f4f4;
}
.row-typle .box-style span {
display: inline-block;
vertical-align: middle;
font-size: 1.7rem;
color: #1d7ad9;
}
.row-typle .box-style .sprite-img {
background-position: 0% -1.5%;
width: 23px;
height: 21px;
}
.row-dimensions {
margin: 0;
font-size: 1.6rem;
border: 1px solid #e8e8e8;
border-top-style: none;
border-bottom-style: none;
}
.row-dimensions .box-style {
padding-top: 1%;
padding-bottom: 1%;
background-color: #f4f4f4;
}
.row-dimensions .box-style span {
display: inline-block;
vertical-align: middle;
font-size: 1.7rem;
color: #1d7ad9;
}
.row-dimensions .box-style .sprite-img {
background-position: 0% 17.5%;
width: 23px;
height: 21px;
}
.row-material {
margin: 0;
font-size: 1.6rem;
border: 1px solid #e8e8e8;
border-top-style: none;
border-bottom-style: none;
}
.row-material .box-style {
padding-top: 1%;
padding-bottom: 1%;
background-color: #f4f4f4;
}
.row-material .box-style span {
display: inline-block;
vertical-align: middle;
font-size: 1.7rem;
color: #1d7ad9;
}
.row-material .box-style .sprite-img {
background-position: 0% 39%;
width: 23px;
height: 21px;
}
.style-fx {
padding: 2% 0;
}
.style-fx label {
font-weight: normal;
}
.commom-style {
margin: 0;
font-size: 1.6rem;
border: 1px solid #e8e8e8;
}
.row-two {
margin: 0;
font-size: 1.6rem;
border: 1px solid #e8e8e8;
}
.row-two .style {
padding: 2% 0;
}
.row-two .style label {
font-weight: normal;
}
.row-two .details {
float: right;
padding-top: 1.5%;
padding-bottom: 1%;
padding-left: 8px;
text-align: center;
}
.row-two .details select {
padding: 6.5px 30px 6.5px 3%;
color: #999;
border: 1px solid #e8e8e8;
background-position: 99% 101%;
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
}
@media screen and (max-width: 768px) {
.row-two .details {
float: left!important;
padding-left: 0;
text-align: right!important;
}
}
.row-three {
margin: 0;
font-size: 1.6rem;
border: 1px solid #e8e8e8;
}
.row-three .style {
padding: 2% 0;
}
.row-three .style label {
font-weight: normal;
}
.row-three .style .row {
padding-bottom: 1%;
padding-top: 1%;
}
.row-three .style .row > div {
padding-right: 0;
}
.row-three input.text-box {
width: 50%;
border: 1px solid #e8e8e8;
}
.row-three .details {
float: right;
padding-top: 4.6%;
padding-bottom: 4.5%;
padding-left: 8px;
text-align: center;
}
.row-three .details select {
padding: 6.5px 30px 6.5px 3%;
color: #999;
border: 1px solid #e8e8e8;
background-position: 99% 101%;
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
}
@media screen and (max-width: 768px) {
.row-three .details {
float: right!important;
padding-top: 2%!important;
padding-bottom: 2%!important;
padding-left: 0!important;
text-align: right!important;
}
}
.row-four {
margin: 0;
font-size: 1.6rem;
border: 1px solid #e8e8e8;
}
.row-four .style {
padding: 2% 0;
}
.row-four .style label {
font-weight: normal;
}
.row-four input.text-box {
width: 50%;
border: 1px solid #e8e8e8;
}
.row-four .details {
float: right;
padding-top: 1.35%;
padding-bottom: 1.35%;
padding-left: 8px;
text-align: center;
}
.row-four .details select {
padding: 6.5px 30px 6.5px 3%;
color: #999;
border: 1px solid #e8e8e8;
background-position: 99% 101%;
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
}
@media screen and (max-width: 992px) {
.row-four .details {
float: right!important;
padding-left: 0!important;
text-align: right!important;
}
}
.row-five {
padding: 6% 0;
text-align: center;
margin: 0;
font-size: 1.6rem;
border: 1px solid #e8e8e8;
border-top-style: none;
}
.row-five input {
padding: 1% 4%;
font-size: 1.6rem;
font-weight: bold;
color: #fff;
background-color: #e15053;
border-style: none;
border-radius: 3px;
outline: none;
}
| 17.718638 | 78 | 0.593709 |
a1c1f27fe36dd7283fd67584fc302dcf3ed160c3 | 580 | sql | SQL | order_entry_human_resources/tables/oehr_regions.sql | ogobrecht/sample-data-sets-for-oracle | 3f6a429a1200ff8320b7d90857ed9ed652d9456c | [
"MIT",
"BSD-3-Clause"
] | 3 | 2020-04-11T00:22:34.000Z | 2022-01-20T17:59:45.000Z | order_entry_human_resources/tables/oehr_regions.sql | ogobrecht/sample-data-sets-for-oracle | 3f6a429a1200ff8320b7d90857ed9ed652d9456c | [
"MIT",
"BSD-3-Clause"
] | null | null | null | order_entry_human_resources/tables/oehr_regions.sql | ogobrecht/sample-data-sets-for-oracle | 3f6a429a1200ff8320b7d90857ed9ed652d9456c | [
"MIT",
"BSD-3-Clause"
] | 1 | 2022-03-09T15:43:36.000Z | 2022-03-09T15:43:36.000Z | prompt - table oehr_regions
create table oehr_regions (
region_id integer generated by default on null as identity (increment by 100 nocache nocycle),
region_name varchar2(25 char) ,
--
primary key (region_id)
);
comment on table oehr_regions is
'Regions table that contains region numbers and names. Contains 4 rows; references with the Countries table.';
comment on column oehr_regions.region_id is
'Primary key of regions table.';
comment on column oehr_regions.region_name is
'Names of regions. Locations are in the countries of these regions.';
| 32.222222 | 112 | 0.760345 |
9c40f0b37b1aacf649415b96aa48cc314fa144d9 | 1,483 | js | JavaScript | src/components/Message/index.js | pandeyom331/Empowerment-Foundation-SparksFoundation-PGI- | ac1500a65a40a6223d1d8d48a3d7976e98909b1b | [
"MIT"
] | 2 | 2021-10-02T17:56:05.000Z | 2022-03-01T07:25:55.000Z | src/components/Message/index.js | pandeyom331/Empowerment-Foundation-SparksFoundation-PGI- | ac1500a65a40a6223d1d8d48a3d7976e98909b1b | [
"MIT"
] | null | null | null | src/components/Message/index.js | pandeyom331/Empowerment-Foundation-SparksFoundation-PGI- | ac1500a65a40a6223d1d8d48a3d7976e98909b1b | [
"MIT"
] | null | null | null | import React from 'react';
import Icon1 from '../../images/bg-cover.jpg';
import Icon2 from '../../images/youth.jpg';
import Icon3 from '../../images/download.jfif';
import { MessageContainer, MessageCard, MessageH1, MessageH2,
MessageIcon, MessageP, MessageWrapper } from './MessageElements';
const Message = () => {
return (
<MessageContainer id="Message">
<MessageH1>Our Message To You</MessageH1>
<MessageWrapper>
<MessageCard>
<MessageIcon src={Icon1} />
<MessageH2>Make someone smile</MessageH2>
<MessageP>many children in foster care system are often in midst of a family challenge, help them by donating now.</MessageP>
</MessageCard>
<MessageCard>
<MessageIcon src={Icon2} />
<MessageH2>Give from your heart</MessageH2>
<MessageP>our inititative is to to make a dispensary available in every corner of the city so that everyone gets proper care.</MessageP>
</MessageCard>
<MessageCard>
<MessageIcon src={Icon3} />
<MessageH2>Have a Big Heart</MessageH2>
<MessageP>you were born with the ability to change someone's life and it's your responsibility that you use it wisely.</MessageP>
</MessageCard>
</MessageWrapper>
</MessageContainer>
)
}
export default Message
| 42.371429 | 154 | 0.601483 |
53c86393f221faae7cab701633f0f6c1953e9497 | 436 | java | Java | engage/src/main/java/com/silverpop/engage/recipient/SetupRecipientResult.java | makeandbuild/mobile-connector-sdk-android | 480214765a08f6a83b1beaa4cb39c6c6d14ebb98 | [
"Apache-2.0"
] | null | null | null | engage/src/main/java/com/silverpop/engage/recipient/SetupRecipientResult.java | makeandbuild/mobile-connector-sdk-android | 480214765a08f6a83b1beaa4cb39c6c6d14ebb98 | [
"Apache-2.0"
] | null | null | null | engage/src/main/java/com/silverpop/engage/recipient/SetupRecipientResult.java | makeandbuild/mobile-connector-sdk-android | 480214765a08f6a83b1beaa4cb39c6c6d14ebb98 | [
"Apache-2.0"
] | null | null | null | package com.silverpop.engage.recipient;
/**
* Created by Lindsay Thurmond on 1/13/15.
*/
public class SetupRecipientResult {
private String recipientId;
public SetupRecipientResult(String recipientId) {
this.recipientId = recipientId;
}
public String getRecipientId() {
return recipientId;
}
public void setRecipientId(String recipientId) {
this.recipientId = recipientId;
}
}
| 19.818182 | 53 | 0.68578 |
97483d9a31b41331fa6d66095899aa2924c3a154 | 3,348 | swift | Swift | PeertalkSimple/PTSimpleiOS/SimpleViewController.swift | kokluch/peertalk-simple | fa9ba809ae218a95d9378b3d54a2bb43f21d3161 | [
"MIT"
] | null | null | null | PeertalkSimple/PTSimpleiOS/SimpleViewController.swift | kokluch/peertalk-simple | fa9ba809ae218a95d9378b3d54a2bb43f21d3161 | [
"MIT"
] | null | null | null | PeertalkSimple/PTSimpleiOS/SimpleViewController.swift | kokluch/peertalk-simple | fa9ba809ae218a95d9378b3d54a2bb43f21d3161 | [
"MIT"
] | null | null | null | import PeertalkManager
import UIKit
class SimpleViewController: UIViewController {
// Outlets
@IBOutlet var label: UILabel!
@IBOutlet var addButton: UIButton!
@IBOutlet var imageButton: UIButton!
@IBOutlet var imageView: UIImageView!
@IBOutlet var statusLabel: UILabel!
// Properties
let ptManager = PTManager.shared
let imagePicker = UIImagePickerController()
// UI Setup
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
addButton.layer.cornerRadius = addButton.frame.height / 2
imageButton.layer.cornerRadius = imageButton.frame.height / 2
}
override func viewDidLoad() {
super.viewDidLoad()
// Setup the PTManager
ptManager.delegate = self
ptManager.connect(portNumber: PORT_NUMBER)
// Setup imagge picker
imagePicker.delegate = self
imagePicker.allowsEditing = false
imagePicker.sourceType = .photoLibrary
}
@IBAction func addButtonTapped(_: UIButton) {
if ptManager.isConnected {
var num = Int(label.text!)! + 1
label.text = "\(num)"
let data = Data(bytes: &num, count: MemoryLayout<Int>.size)
ptManager.send(data: data, type: PTType.number.rawValue)
} else {
showAlert()
}
}
@IBAction func imageButtonTapped(_: UIButton) {
if ptManager.isConnected {
present(imagePicker, animated: true, completion: nil)
} else {
showAlert()
}
}
func showAlert() {
let alert = UIAlertController(title: "Disconnected", message: "Please connect to a device first", preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
present(alert, animated: true, completion: nil)
}
}
extension SimpleViewController: PTManagerDelegate {
func peertalk(shouldAcceptDataOfType _: UInt32) -> Bool {
return true
}
func peertalk(didReceiveData data: Data?, ofType type: UInt32) {
guard let data = data else { return }
if type == PTType.number.rawValue {
let count = data.withUnsafeBytes { $0.load(as: Int.self) }
label.text = "\(count)"
} else if type == PTType.image.rawValue {
let image = UIImage(data: data)
imageView.image = image
}
}
func peertalk(didChangeConnection connected: Bool) {
print("Connection: \(connected)")
statusLabel.text = connected ? "Connected" : "Disconnected"
}
}
extension SimpleViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerController(_: UIImagePickerController, didFinishPickingMediaWithInfo info: [String: Any]) {
let image = info[UIImagePickerControllerOriginalImage] as! UIImage
imageView.image = image
DispatchQueue.global(qos: .background).async {
let data = UIImageJPEGRepresentation(image, 1.0)!
self.ptManager.send(data: data, type: PTType.image.rawValue, completion: nil)
}
dismiss(animated: true, completion: nil)
}
func imagePickerControllerDidCancel(_: UIImagePickerController) {
dismiss(animated: true, completion: nil)
}
}
| 32.823529 | 151 | 0.651135 |
fb4a249cef92a4d5a7281621f1fcf507a6c415e7 | 2,030 | h | C | GUI/xephem/db.h | lemmy04/XEphem | 89c6a70620436a877ae910374abd88d052448437 | [
"MIT"
] | 57 | 2021-02-08T20:55:49.000Z | 2022-03-29T21:10:24.000Z | GUI/xephem/db.h | lemmy04/XEphem | 89c6a70620436a877ae910374abd88d052448437 | [
"MIT"
] | 28 | 2021-02-08T23:32:44.000Z | 2022-03-14T00:07:46.000Z | GUI/xephem/db.h | lemmy04/XEphem | 89c6a70620436a877ae910374abd88d052448437 | [
"MIT"
] | 24 | 2021-02-08T21:26:02.000Z | 2022-03-06T15:46:37.000Z | #ifndef _DB_H
#define _DB_H
/* used to maintain progress state with db_scanint() and db_scan */
typedef struct {
int m; /* mask of *N types desired */
int t; /* current Object type, as per ObjType */
int n; /* number of objects of type t "scanned" so far */
int c; /* index of catalog being scanned */
ObjF *op; /* local list to also scan */
int nop; /* number in op[] */
} DBScan;
/* keep track of the indeces effected for each ObjType loaded by each catalog.
* N.B. this works because all objects from a given catalog are contiguous
* within each their respective ObjType.
*/
#define MAXCATNM 32 /* max catalog file name (just the base) */
/* collect objects in each catalog, and handy macro to address entry n type t.
* objects are collected into small arrays called chunks. this eliminates
* them moving around since putting them into one large array would require
* using realloc and open the possibility they could move, and the smaller
* pieces reduces memory bloat due to fragmentation.
*/
#define NDBCHNKO 4096 /* objects for which mem is allocated at once */
typedef struct {
int siz; /* bytes in each object, sizeof(ObjE) etc */
char **mem; /* array of pointers to memory chunks */
int nmem; /* n objects available in all chunks */
int nuse; /* n objects actually in use */
} DBTMem; /* all objects for a given o_type */
typedef struct {
char name[MAXCATNM]; /* name of catalog */
DBTMem tmem[NOBJTYPES]; /* memory for each type */
} DBCat; /* all objects in a given catalog */
/* duplicate names are detected by keeping a list of each name and the Obj to
* which it refers.
*/
typedef struct {
char nm[MAXNM];
Obj *op;
} DupName;
extern char dbcategory[];
extern DBCat *db_opfindcat (Obj *op);
extern void db_newcatmenu (DBCat a[], int na);
extern void db_catdel (DBCat *dbcp);
extern void db_del_all (void);
extern void db_rel_all (void);
extern int db_dups (DupName **dnpp);
extern int db_chkAltNames(void);
#endif /* _DB_H */
| 34.40678 | 78 | 0.693103 |
85b3ca612ebe7efe7e66c0c299c2a8f41580f2d8 | 283 | h | C | QtFramelessWindowSample.h | IWXQ/Qt-FramelessWindow | 8925f4d0b69993b69a4bc63a46d4d65762666b88 | [
"Apache-2.0"
] | 1 | 2019-11-21T08:43:00.000Z | 2019-11-21T08:43:00.000Z | QtFramelessWindowSample.h | IWXQ/Qt-FramelessWindow | 8925f4d0b69993b69a4bc63a46d4d65762666b88 | [
"Apache-2.0"
] | null | null | null | QtFramelessWindowSample.h | IWXQ/Qt-FramelessWindow | 8925f4d0b69993b69a4bc63a46d4d65762666b88 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include "FramelessMainWindow.h"
#include "ui_QtFramelessWindowSample.h"
class QtFramelessWindowSample : public FramelessMainWindow
{
Q_OBJECT
public:
QtFramelessWindowSample(QWidget *parent = Q_NULLPTR);
private:
Ui::QtFramelessWindowSampleClass ui;
};
| 17.6875 | 58 | 0.784452 |
e0f941d471b47491f3e6478b70c0112643e5a958 | 1,948 | sql | SQL | Projects/NELondonDiabetes/Queries/7_populateEligSnomeds.sql | endeavourhealth-discovery/DiscoveryQueryLibrary | 7f8573df1bf44e073b793aab69e32600161ba02d | [
"Apache-2.0"
] | null | null | null | Projects/NELondonDiabetes/Queries/7_populateEligSnomeds.sql | endeavourhealth-discovery/DiscoveryQueryLibrary | 7f8573df1bf44e073b793aab69e32600161ba02d | [
"Apache-2.0"
] | null | null | null | Projects/NELondonDiabetes/Queries/7_populateEligSnomeds.sql | endeavourhealth-discovery/DiscoveryQueryLibrary | 7f8573df1bf44e073b793aab69e32600161ba02d | [
"Apache-2.0"
] | null | null | null | USE data_extracts;
DROP PROCEDURE IF EXISTS populateEligSnomeds;
DELIMITER //
CREATE PROCEDURE populateEligSnomeds()
BEGIN
INSERT INTO snomed_codes (GROUP_ID, SNOMED_ID, DESCRIPTION)
VALUES
(4,237602007,'Metabolic syndrome X (disorder)'),
(4,417681008,'Diabetic patient unsuitable for digital retinal photography (finding)'),
(4,839811000000106,'Diabetic retinopathy screening declined (situation)'),
(4,408396006,'Diabetic retinopathy screening not indicated (situation)'),
(4,413122001,'Diabetic retinopathy screening refused (situation)'),
(4,371871000000101,'Eligibility permanently inactive for diabetic retinopathy screening (finding)'),
(4,371841000000107,'Eligibility temporarily inactive for diabetic retinopathy screening (finding)'),
(4,371781000000108,'Eligible for diabetic retinopathy screening (finding)'),
(4,374901000000103,'Excluded from diabetic retinopathy screening (finding)'),
(4,374691000000100,'Excluded from diabetic retinopathy screening as blind (finding)'),
(4,374631000000101,'Excluded from diabetic retinopathy screening as deceased (finding)'),
(4,374841000000109,'Excluded from diabetic retinopathy screening as learning disability (finding)'),
(4,374601000000107,'Excluded from diabetic retinopathy screening as moved away (finding)'),
(4,374781000000105,'Excluded from diabetic retinopathy screening as no current contact details (finding)'),
(4,374721000000109,'Excluded from diabetic retinopathy screening as no longer diabetic (finding)'),
(4,374871000000103,'Excluded from diabetic retinopathy screening as physical disorder (finding)'),
(4,374811000000108,'Excluded from diabetic retinopathy screening as terminal illness (finding)'),
(4,374661000000106,'Excluded from diabetic retinopathy screening as under care of ophthalmologist (finding)'),
(4,371811000000106,'Ineligible for diabetic retinopathy screening (finding)'),
(4,416075005,'On learning disability register (finding)');
END//
DELIMITER ;
| 54.111111 | 110 | 0.808522 |
ca3b120e66b212d333adc7368f37aea65c8b20ff | 731 | kt | Kotlin | library/src/test/java/com/magicjack/interceptor/internal/support/InterceptorCrashHandlerTest.kt | skendora/Interceptor | a622777e44a38665d359c303fd35c209565a7a9a | [
"Apache-2.0"
] | null | null | null | library/src/test/java/com/magicjack/interceptor/internal/support/InterceptorCrashHandlerTest.kt | skendora/Interceptor | a622777e44a38665d359c303fd35c209565a7a9a | [
"Apache-2.0"
] | null | null | null | library/src/test/java/com/magicjack/interceptor/internal/support/InterceptorCrashHandlerTest.kt | skendora/Interceptor | a622777e44a38665d359c303fd35c209565a7a9a | [
"Apache-2.0"
] | null | null | null | package com.magicjack.interceptor.internal.support
import com.magicjack.interceptor.api.InterceptorCollector
import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import org.junit.jupiter.api.Test
class InterceptorCrashHandlerTest {
@Test
fun uncaughtException_isReportedCorrectly() {
val mockCollector = mockk<InterceptorCollector>()
val mockThrowable = Throwable()
val handler = InterceptorCrashHandler(mockCollector)
every { mockCollector.onError(any(), any()) } returns Unit
handler.uncaughtException(Thread.currentThread(), mockThrowable)
verify { mockCollector.onError("Error caught on ${Thread.currentThread().name} thread", mockThrowable) }
}
}
| 31.782609 | 112 | 0.74829 |
969512a4b7bac3cab18a13f6099f9e5fe9aa0f32 | 7,215 | html | HTML | documentation/referral_referral_count.html | Solspace/Friends | 85b866a74231a37579c374960e52ef35e291cce5 | [
"MIT"
] | null | null | null | documentation/referral_referral_count.html | Solspace/Friends | 85b866a74231a37579c374960e52ef35e291cce5 | [
"MIT"
] | null | null | null | documentation/referral_referral_count.html | Solspace/Friends | 85b866a74231a37579c374960e52ef35e291cce5 | [
"MIT"
] | 2 | 2018-07-23T09:14:07.000Z | 2019-08-02T14:53:08.000Z | <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie9"> <![endif]-->
<!--[if gt IE 9]><!--> <html class="no-js"> <!--<![endif]-->
<head lang="en">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Referral Count | Friends | Solspace Addon Documentation</title>
<meta name="description" content="" />
<meta name="copyright" content="(c) 2010 Copyright content: Copyright design: Solspace, Inc."/>
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="assets/css/normalize.css" />
<link rel="stylesheet" href="assets/css/main.css" />
<link rel="stylesheet" type="text/css" href="assets/fancybox/jquery.fancybox-1.3.4.css" />
<link href="assets/syntaxhighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />
<link href="assets/syntaxhighlighter/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />
<script src="assets/js/modernizr.min.js"></script>
</head>
<body>
<!--[if lt IE 8]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<header>
<div class="header-inner">
<div class="logo">
<img src="assets/images/logo.png" />
</div>
<div class="bread_crumbs">
<ul class="crumbs">
<li class="first"><a href="index.html">Friends</a></li>
<li>Referral Count</li>
</ul>
</div>
</div>
</header>
<div class="content-wrapper">
<nav class="toc">
<ul>
<li><a href="https://solspace.com/expressionengine/friends">More Info | Purchase</a></li>
<li><a href="change_log.html">Change Log</a></li>
<li><a href="install_update.html">Install / Update</a></li>
<li><a href="control_panel.html">Control Panel</a></li>
<li><a href="extension_hooks.html">Extension Hooks</a></li>
<li class="template_tags"><h3>Template Tags</h3></li>
<li><p>Basic:</p>
<ul>
<li><a href="add.html">Add</a></li>
<li><a href="form.html">Form</a></li>
<li><a href="hug.html">Hug</a></li>
<li><a href="hugs.html">Hugs</a></li>
<li><a href="invites.html">Invites</a></li>
<li><a href="members.html">Members</a></li>
<li><a href="mine.html">Mine</a></li>
<li><a href="mutual_friends.html">Mutual Friends</a></li>
</ul></li>
<li><p>Profile Wall:</p>
<ul>
<li><a href="profile_wall.html">Profile Wall</a></li>
<li><a href="profile_wall_comment_delete.html">Profile Wall Comment Delete</a></li>
<li><a href="profile_wall_form.html">Profile Wall Form</a></li>
</ul></li>
<li><p>Status Updates:</p>
<ul>
<li><a href="status.html">Status</a></li>
<li><a href="status_delete.html">Status Delete</a></li>
<li><a href="status_form.html">Status Form</a></li>
</ul></li>
<li><p>Groups:</p>
<ul>
<li><a href="groups.html">Groups</a></li>
<li><a href="group_add.html">Group Add</a></li>
<li><a href="group_delete.html">Group Delete</a></li>
<li><a href="group_entries.html">Group Entries</a></li>
<li><a href="group_entry_add.html">Group Entry Add</a></li>
<li><a href="group_form.html">Group Form</a></li>
<li><a href="group_members.html">Group Members</a></li>
<li><a href="member_of_group.html">Member Of Group</a></li>
<li><a href="group_wall.html">Group Wall</a></li>
<li><a href="group_wall_comment_delete.html">Group Wall Comment Delete</a></li>
<li><a href="group_wall_form.html">Group Wall Form</a></li>
</ul></li>
<li><p>Messages:</p>
<ul>
<li><a href="messages.html">Messages</a></li>
<li><a href="message_delete.html">Message Delete</a></li>
<li><a href="message_folders.html">Message Folders</a></li>
<li><a href="message_folder_form.html">Message Folder Form</a></li>
<li><a href="message_folder_name.html">Message Folder Name</a></li>
<li><a href="message_form.html">Message Form</a></li>
<li><a href="message_move.html">Message Move</a></li>
</ul></li>
<li><p>Referrals:</p>
<ul>
<li><a href="referral_invite_form.html">Referral Invite Form</a></li>
<li class="current"><a href="referral_referral_count.html">Referral Count</a></li>
</ul></li>
<li><h3>Requirements</h3><div class="requirements">
<ul>
<li>EE 2.10.x</li>
<li>PHP 5.2+</li>
<li>MySQL 5+</li>
<li>All modern browsers or IE 10+</li>
</ul></div></li>
</ul>
</nav>
<article class="docs">
<p>The <em>Friends:Referral_Count</em> loop is available to output website
registration referral stats for any given member. See <a href="referral_invite_form.html">Referral Invite
Form</a> documentation for more information.</p>
<pre class="brush: html;">{exp:friends:referral_count} content {/exp:friends:referral_count}</pre>
<ul>
<li><a href="#parameters">Parameters</a></li>
<li><a href="#variables">Variables</a></li>
<li><a href="#examples">Examples</a></li>
</ul>
<p><a name="parameters"></a></p>
<h2>Parameters</h2>
<p>The following parameters are available for use:</p>
<ul>
<li><a href="#member_id">member_id</a></li>
<li><a href="#username">username</a></li>
</ul>
<p><a name="member_id"></a></p>
<h3>member_id=</h3>
<pre class="brush: html;">member_id="CURRENT_USER"</pre>
<p>This parameter is necessary to view referral stats for a
specific member. You can hardcode a member ID, pass it through an embed,
grab it from the URI, or specify <strong>CURRENT_USER</strong> to display stats of the
currently logged in user. Alternatively, you can use the
<a href="#username">username</a> parameter.</p>
<p><a name="username"></a></p>
<h3>username=</h3>
<pre class="brush: html;">username="{segment_3}"</pre>
<p>This parameter is necessary to view referral stats for a
specific member. You can hardcode a username, pass it through an embed,
grab it from the URI, or specify <strong>CURRENT_USER</strong> to display stats of the
currently logged in user. Alternatively, you can use the
<a href="#member_id">member_id</a> parameter.</p>
<p><a name="variables"></a></p>
<h2>Variables</h2>
<p>The following variables are available for use:</p>
<ul>
<li><a href="#friends_referral_count">friends_referral_count</a></li>
</ul>
<p><a name="friends_referral_count"></a></p>
<h3>friends_referral_count</h3>
<pre class="brush: html;">{friends_referral_count}</pre>
<p>This variables outputs the total number of
successful website registration referrals the given user has.</p>
<p><a name="examples"></a></p>
<h2>Examples</h2>
<p>The following code should be a complete example for displaying the total
number of referrals the currently logged in user has:</p>
<pre class="brush: html;">Total Referrals:
{exp:friends:referral_count
member_id="CURRENT_USER"
}
{friends_referral_count}
{/exp:friends:referral_count}
</pre>
</article>
</div>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script src="assets/syntaxhighlighter/scripts/shCore.js"></script>
<script src="assets/syntaxhighlighter/scripts/shAutoloader.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html> | 34.521531 | 270 | 0.675121 |
6235b2e65d787ad3d0706a5b82c83d8c9f0fce46 | 154 | swift | Swift | SwiftBar/Utility/String+Escaped.swift | incanus/SwiftBar | a80d5655b1076d2eefa02162427a2c3aa8e3c3a5 | [
"MIT"
] | null | null | null | SwiftBar/Utility/String+Escaped.swift | incanus/SwiftBar | a80d5655b1076d2eefa02162427a2c3aa8e3c3a5 | [
"MIT"
] | null | null | null | SwiftBar/Utility/String+Escaped.swift | incanus/SwiftBar | a80d5655b1076d2eefa02162427a2c3aa8e3c3a5 | [
"MIT"
] | null | null | null | import Foundation
extension String {
func escaped() -> Self {
guard self.contains(" ") else {return self}
return "'\(self)'"
}
}
| 17.111111 | 51 | 0.564935 |
5bc8caa6be1e9654168b60df1345fcd264c9c7e9 | 42,183 | h | C | Src/Plugins/GLShaderEdit/wxstedit/include/wx/stedit/stedit.h | vinjn/glintercept | f82166d3a774bfb02459f6b3ae2a03d4c9eaf64f | [
"MIT"
] | 468 | 2015-04-13T19:03:57.000Z | 2022-03-23T00:11:24.000Z | Src/Plugins/GLShaderEdit/wxstedit/include/wx/stedit/stedit.h | vinjn/glintercept | f82166d3a774bfb02459f6b3ae2a03d4c9eaf64f | [
"MIT"
] | 12 | 2015-05-25T11:15:21.000Z | 2020-10-26T02:46:50.000Z | Src/Plugins/GLShaderEdit/wxstedit/include/wx/stedit/stedit.h | vinjn/glintercept | f82166d3a774bfb02459f6b3ae2a03d4c9eaf64f | [
"MIT"
] | 67 | 2015-04-22T13:22:48.000Z | 2022-03-05T01:11:02.000Z | ///////////////////////////////////////////////////////////////////////////////
// Name: stedit.h
// Purpose: wxSTEditor
// Author: John Labenski, parts taken from wxGuide by Otto Wyss
// Modified by:
// Created: 11/05/2002
// Copyright: (c) John Labenski, Otto Wyss
// Licence: wxWidgets licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _STEDIT_H_
#define _STEDIT_H_
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "stedit.h"
#endif
class WXDLLEXPORT wxMenu;
class WXDLLEXPORT wxKeyEvent;
class WXDLLEXPORT wxFindDialogEvent;
class WXDLLEXPORT wxToolBar;
class WXDLLEXPORT wxConfigBase;
class WXDLLEXPORT wxFileHistory;
#include "wx/datetime.h"
#include "wx/fdrepdlg.h"
#include "wx/stedit/stedefs.h"
#include "wx/stedit/steprefs.h"
#include "wx/stedit/stestyls.h"
#include "wx/stedit/stelangs.h"
#include "wx/stedit/steopts.h"
//-----------------------------------------------------------------------------
// wxSTERecursionGuard - a simple recursion guard to block reentrant functions
// We have our own version since it's used as a class member and wxWidgets may
// change their implementation.
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_STEDIT wxSTERecursionGuardFlag
{
public:
wxSTERecursionGuardFlag() : m_flag(0) {}
int m_flag;
};
class WXDLLIMPEXP_STEDIT wxSTERecursionGuard
{
public:
wxSTERecursionGuard(wxSTERecursionGuardFlag& flag) : m_flag(flag)
{
m_isInside = (flag.m_flag++ != 0);
}
~wxSTERecursionGuard()
{
wxASSERT_MSG(m_flag.m_flag > 0, _T("unbalanced wxSTERecursionGuards!?"));
m_flag.m_flag--;
}
bool IsInside() const { return m_isInside; }
private:
wxSTERecursionGuardFlag& m_flag;
bool m_isInside; // true if m_flag had been already set when created
};
//-----------------------------------------------------------------------------
// STE_LoadFileType - options when loading a file
// see wxSTEditor::LoadInputStream
//-----------------------------------------------------------------------------
enum STE_LoadFileType
{
// If a file(stream) starts with 0xfffe as first two chars it's probably unicode.
STE_LOAD_DEFAULT = 0, // load as unicode if it has the header,
// else load as ascii
STE_LOAD_QUERY_UNICODE = 0x0001, // popup dialog to ask if to load in unicode
// if the file starts w/ unicode signature
STE_LOAD_ASCII = 0x0002, // load as ascii in all cases
STE_LOAD_UNICODE = 0x0004, // load as unicode in all cases
STE_LOAD_NOERRDLG = 0x0010, // never show an error message dialog
// silent failure, return false
// this flag can be used with one of the others
};
//-----------------------------------------------------------------------------
// wxSTEditorRefData - ref counted data to share with refed editors
//
// You normally do not need to access any of this, use the member functions
// in the wxSTEditor.
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_STEDIT wxSTEditorRefData : public wxObjectRefData
{
public:
wxSTEditorRefData();
virtual ~wxSTEditorRefData() { m_editors.Clear(); }
// Find/Add/Remove editors that share this data
size_t GetEditorCount() const { return m_editors.GetCount(); }
bool HasEditor(wxSTEditor* editor) const { return FindEditor(editor) != wxNOT_FOUND; }
int FindEditor(wxSTEditor* editor) const { return m_editors.Index(editor); }
wxSTEditor *GetEditor(size_t n) const { return (wxSTEditor*)m_editors.Item(n); }
void AddEditor(wxSTEditor* editor) { if (!HasEditor(editor)) m_editors.Add(editor); }
void RemoveEditor(wxSTEditor* editor) { int n = FindEditor(editor);
if (n != wxNOT_FOUND)
m_editors.RemoveAt(n); }
// -----------------------------------------------------------------------
// implementation
wxArrayPtrVoid m_editors; // editors that share this data
wxString m_fileName; // current filename for the editor
wxDateTime m_modifiedTime; // file modification time, else invalid
int m_last_autoindent_line; // last line that was auto indented
int m_last_autoindent_len; // the length of the line before auto indenting
int m_steLangId; // index into the wxSTEditorLangs used
wxSTEditorOptions m_options; // options, always created
// we have our own copy of prefs/styles/langs in addition to those in
// the options so we can detach an editor, but use the rest of the options
// they're ref counted so they're small
wxSTEditorPrefs m_stePrefs;
wxSTEditorStyles m_steStyles;
wxSTEditorLangs m_steLangs;
};
//-----------------------------------------------------------------------------
// wxSTEditor
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_STEDIT wxSTEditor : public wxStyledTextCtrl
{
public :
// wxStyledTextCtrl doesn't have Create method in 2.4.x
#if wxCHECK_VERSION(2,5,0)
wxSTEditor() : wxStyledTextCtrl() { Init(); }
#endif // wxCHECK_VERSION(2,5,0)
wxSTEditor(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0, // wxStyledTextCtrl ors this with defaults
const wxString& name = wxT("wxSTEditor"));
virtual ~wxSTEditor();
virtual bool Destroy();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0, // wxStyledTextCtrl ors this with defaults
const wxString& name = wxT("wxSTEditor"));
// Clone this editor, uses wxClassInfo so derived classes should work.
// Override if you want to create your own type for the splitter to use in
// wxSTEditorSplitter::CreateEditor.
virtual wxSTEditor* Clone(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0, // wxStyledTextCtrl ors this with defaults
const wxString& name = wxT("wxSTEditor")) const;
// Create any elements desired in the wxSTEditorOptions.
// This function is always called after creation by the parent splitter
// with it's options and would be a good function to override to setup
// the editor your own way.
// This registers the prefs, styles, langs in the options,
// and creates any items set by the options.
virtual void CreateOptions(const wxSTEditorOptions& options);
// GetEditorOptions, use this to change editor option values
const wxSTEditorOptions& GetOptions() const;
wxSTEditorOptions& GetOptions();
// Set the options, the options will now be refed copies of the ones you send
// in. This can be used to detach the options for a particular editor from
// the rest of them. (See also CreateOptions)
void SetOptions(const wxSTEditorOptions& options);
// ************************************************************************
// NOTE: This might not be necessary anymore since overriding Destroy()
//
// IMPORTANT! In your wxApp::OnExit or wxFrame's EVT_CLOSE handler
// make sure you call this to ensure that any extraneous focus events
// are blocked. GTK 2.0 for example sends them, MSW has been known to do it
// as well (but that was for a different control)
//
// The problem occurs because focus events may be sent to the window if the
// user closes it and immediately clicks on it before it's destroyed. This
// is not typical, but can happen suprisingly easily.
// The sequence of events is as follows, the focus event is created
// from wxWidgets and the ste editor tries to update the menus and toolbars.
// In GTK2, for example, the event loop is run when updating a
// toolbar tool and so the ste editor can be destroyed before the toolbar
// finishes updating. When the function returns the program crashes.
void SetSendSTEEvents(bool send);
// ************************************************************************
// ------------------------------------------------------------------------
// wxTextCtrl methods - this can be used as a replacement textctrl with
// very few, if any, code changes.
bool CanCopy() { return GetSelectionEnd() != GetSelectionStart(); }
bool CanCut() { return CanCopy() && !GetReadOnly(); }
// FIXME gtk runs evt loop during CanPaste check causing a crash in
// scintilla's drawing code, for now let's just assume you can always paste
#ifdef __WXGTK__
bool CanPaste() { return !GetReadOnly(); }
#endif // __WXGTK__
// void Clear() { ClearAll(); } // wxSTC uses Clear to clear selection
void DiscardEdits() { SetSavePoint(); }
int GetInsertionPoint() { return GetCurrentPos(); }
int GetLineLength(int iLine); // excluding any cr/lf at end
wxString GetLineText(int line); // excluding any cr/lf at end
long GetNumberOfLines() { return GetLineCount(); }
void GetSelection(long *iStart, long *iEnd) { int s=0,e=0; wxStyledTextCtrl::GetSelection(&s, &e); if (iStart) *iStart=s; if (iEnd) *iEnd=e; }
wxString GetValue() { return GetText(); }
bool IsModified() { return GetModify(); }
void SetInsertionPoint(int pos) { GotoPos(pos); }
void SetInsertionPointEnd() { GotoPos(GetLength()); }
void ShowPosition(int pos) { GotoPos(pos); }
void WriteText(const wxString &text) { InsertText(GetCurrentPos(), text); SetCurrentPos(GetCurrentPos() + text.Len()); }
long XYToPosition(long x, long y) { return x + PositionFromLine(y); }
// Remove this section of text between markers
void Remove(int iStart, int iEnd) { SetTargetStart(iStart); SetTargetEnd(iEnd); ReplaceTarget(wxEmptyString); }
// Get the row/col representation of the position
bool PositionToXY(long pos, long *x, long *y);
// ------------------------------------------------------------------------
// Convenience functions - other useful functions
// Translate the start and end positions in the document, returns if !empty
// if start_pos == end_pos == -1 use current selection or if none use cursor line
// to get the whole document use (0, GetLength()-1) or (0, -1)
bool TranslatePos(int start_pos, int end_pos,
int* trans_start_pos, int* trans_end_pos);
// Translate the top and bottom lines in the document, returns true if they differ
// if top_line == bottom_line == -1 then use top/bottom line of selection
// or if no selection use the cursor line
// if top_line = 0 and bottom_line = -1 use (0, GetLineCount()-1)
bool TranslateLines(int top_line, int bottom_line,
int* trans_top_line, int* trans_bottom_line);
// Get the text between the GetTargetStart and GetTargetEnd
wxString GetTargetText();
// Paste the text from the clipboard into the text at the current cursor
// position preserving the linefeeds in the text using PasteRectangular
bool PasteRectangular();
// Paste the text into the document using the column of pos, -1 means
// current cursor position, as the leftmost side for linefeeds.
void PasteRectangular(const wxString& str, int pos = -1);
// Get the EOL string "\r", "\n", "\r\n" as appropriate for Mac, Unix, DOS
// default (-1) gets EOL string for current document settings
wxString GetEOLString(int stc_eol_mode = -1);
// AppendText to the document and if the cursor was already at the end of
// the document keep the cursor at the end. This is useful for scrolling
// logs so the user can click above the end and read the message without
// it scrolling off the screen as new text is added below.
// If goto_end then always put the cursor at the end.
void AppendTextGotoEnd(const wxString &text, bool goto_end = false);
// Write the text to the line, adding lines if necessary
// if inc_newline then also overwrite the newline char at end of line
// See also GetLineText in wxTextCtrl compatibility functions
// which excludes any crlf at the end of the line
void SetLineText(int line, const wxString& text, bool inc_newline = false);
void GotoStartOfCurrentLine() { GotoLine(LineFromPosition(GetInsertionPoint())); }
// Get the number of words in the string, counts words as contiguous isalnum
size_t GetWordCount(const wxString& text) const;
// Get the number of words, counts words as contiguous isalnum
// See TranslatePos(start_pos, end_pos) for start/end interpretation
size_t GetWordCount(int start_pos = 0, int end_pos = -1);
// Get the count of these "words", they may be single characters and
// they may also be parts of other words. Returns total count.
// The output int array contains the count in the same order as the words array.
size_t GetWordArrayCount(const wxString& text,
const wxArrayString& words, wxArrayInt& count,
bool ignoreCase = false);
// Get the EOL count for each EOL type (also tabs), each and all types can be NULL
void GetEOLCount(int *crlf, int *cr, int *lf, int *tabs = NULL);
// calls ToggleFold on the parent fold of the line (if any)
// if line = -1 then use the current line
void ToggleFoldAtLine(int line = -1);
// Expand or collapse all folds at and above or below the level
void ExpandFoldsToLevel(int level, bool expand = true);
void CollapseFoldsToLevel(int level) { ExpandFoldsToLevel(level, false); }
// Expand or collapse all the folds in the document
void ExpandAllFolds() { ExpandFoldsToLevel(wxSTC_FOLDLEVELNUMBERMASK, true); }
void CollapseAllFolds() { CollapseFoldsToLevel(0); }
// Set the indentation of a line or set of lines, width is usually GetIndent()
// See TranslateLines(top_line, bottom_line) for top/bottom interpretation
void SetIndentation(int width, int top_line = -1, int bottom_line = -1);
// Convert tab characters to spaces uses GetTabWidth for # spaces to use
// returns the number of replacements.
// See TranslatePos(start_pos, end_pos) for start/end interpretation
size_t ConvertTabsToSpaces(bool to_spaces, int start_pos = -1, int end_pos = -1);
// Remove all trailing spaces and tabs from the document
// See TranslateLines(top_line, bottom_line) for top/bottom interpretation
bool RemoveTrailingWhitespace(int top_line = -1, int bottom_line = -1);
// Remove chars before and after the position until char not in remove found
// only works on a single line, if pos == -1 then use GetCurrentPos()
bool RemoveCharsAroundPos(int pos = -1, const wxString& remove = wxT(" \t"));
// Inserts specified text at the column (adding spaces as necessary)
// if col == 0, prepend text, < 0 then append text, else insert at column
// See TranslateLines(top_line, bottom_line) for top/bottom interpretation
bool InsertTextAtCol(int col, const wxString& text,
int top_line = -1, int bottom_line = -1);
// Put all the text in the lines in equally spaced columns using the chars
// to split in cols before, after and what chars will bound regions that
// you want to preserve (like strings).
bool Columnize(int top_line = -1, int bottom_line = -1,
const wxString& splitBefore = wxT(")]{}"),
const wxString& splitAfter = wxT(",;"),
const wxString& preserveChars = wxT("\""));
// Show a dialog that allows the user to append, prepend, or insert text
// in the selected lines or the current line
bool ShowInsertTextDialog();
// Show a dialog to allow the user to turn the selected text into columns
bool ShowColumnizeDialog();
// Show a convert EOL dialog to allow the user to select one
bool ShowConvertEOLModeDialog();
// Show a dialog to allow the user to select a text size zoom to use
bool ShowSetZoomDialog();
// Simple dialog to goto a particular line in the text
bool ShowGotoLineDialog();
// ------------------------------------------------------------------------
// Load/Save methods
// Can/Should this document be saved (has valid filename and is modified)
bool CanSave() { return GetModify() && !GetFileName().IsEmpty(); }
// Load a file from the wxInputStream (probably a wxFileInputStream)
// The fileName is used only for the message on error
// flags is STE_LoadFileType
bool LoadInputStream(wxInputStream& stream, const wxString &fileName,
int flags = STE_LOAD_QUERY_UNICODE);
// Load a file, if filename is wxEmptyString then use wxFileSelector
// if using wxFileSelector then if extensions is wxEmptyString use
// GetOptions().GetDefaultFileExtensions() else the ones supplied
virtual bool LoadFile( const wxString &filename = wxEmptyString,
const wxString &extensions = wxEmptyString );
// Save current file, if use_dialog or GetFileName() is empty use wxFileSelector
virtual bool SaveFile( bool use_dialog = true,
const wxString &extensions = wxEmptyString );
// clear everything to a blank page
// if title is empty then pop up a dialog to ask the user what name to use
virtual bool NewFile(const wxString &title = wxEmptyString);
// Show a dialog to allow users to export the document
// See wxSTEditorExporter
bool ShowExportDialog();
// If IsModified show a message box asking if the user wants to save the file
// returns wxYES, wxNO, wxCANCEL, if the user does wxYES then file is
// automatically saved if save_file, wxCANCEL implies that the user wants
// to continue editing.
// note: use EVT_CLOSE in frame before hiding frame so this dialog
// check for wxCloseEvent::CanVeto and if it can't be vetoed use the
// style wxYES_NO only since it can't be canceled.
virtual int QuerySaveIfModified(bool save_file, int style = wxYES_NO|wxCANCEL);
// Get/Set the current filename, including path
wxString GetFileName() const;
void SetFileName(const wxString &fileName, bool send_event = false);
// If there's a valid filename, return false if it's modification time is
// before the current doc's times if the time is valid.
// if show_reload_dialog then ask user if they want to reload
// if yes then the file is reloaded else modified time is set to an
// invalid time so that the user won't be asked again.
bool IsAlteredOnDisk(bool show_reload_dialog);
// Get/Set the last modification time of the file on the disk (internal use)
// doesn't read/write to/from disk and the time is invalid if it wasn't
// loaded from a file in the first place.
void SetFileModificationTime(const wxDateTime &dt);
wxDateTime GetFileModificationTime() const;
// Show a modal dialog that displays the properties of this editor
// see wxSTEditorPropertiesDialog
void ShowPropertiesDialog();
// ------------------------------------------------------------------------
// Find/Replace methods
// A note about the find dialog system.
//
// When you create a find/replace dialog this checks if the grandparent is
// a wxSTEditorNotebook and uses that as a parent. Else, if the parent is
// a wxSTEditorSplitter then use that as a parent to avoid this being 2nd
// window and user unsplits. Finally this is used as a parent.
//
// Find/Replace events from the dialog are sent to the parent (see above).
// If in a notebook and STE_FR_ALLDOCS is set the notebook handles the event
// and switches pages automatically to find the next occurance, else the
// current editor handles the event. If the splitter is the parent, it does
// nothing and passes the event to the current editor.
//
// ShowFindReplaceDialog(true...) will Destroy a previously made dialog by
// checking if a window exists with the name
// wxSTEditorFindReplaceDialogNameStr and create a new one.
// Find the string using the flags (see STEFindReplaceFlags)
// start_pos is the starting position, -1 uses GetCursorPos()
// end_pos is the ending position, -1 uses GetTextLength or
// if flags doesn't have STE_FR_DOWN then 0.
// if flags = -1 uses GetFindFlags()
// hilight selects the text
// found_start_pos/end_pos if !NULL are set to the start/end pos of string
// note found_end_pos - found_start_pos might not be string.length for regexp
// returns starting position of the found string
int FindString(const wxString &findString,
int start_pos = -1, int end_pos = -1,
int flags = -1, bool hilight = true,
int *found_start_pos = NULL, int *found_end_pos = NULL);
// Does the current selection match the findString using the flags
// if flags = -1 uses GetFindFlags()
bool SelectionIsFindString(const wxString &findString, int flags = -1);
// Replace all occurances of the find string with the replace string
// if flags = -1 uses GetFindFlags()
// returns the number of replacements
int ReplaceAllStrings(const wxString &findString,
const wxString &replaceString, int flags = -1);
// Finds all occurances of the string and returns their starting positions
// if flags = -1 uses GetFindFlags()
// returns the number of strings found
// if startPositions is !NULL then fill with the starting positions
// if endPositions if !NULL then fill that with the ending positions
// note: for regexp end - start might not equal findString.length.
size_t FindAllStrings(const wxString &findString, int flags = -1,
wxArrayInt* startPositions = NULL,
wxArrayInt* endPositions = NULL);
// if show then show it, else hide it, if find then find dialog, else replace dialog
void ShowFindReplaceDialog(bool show, bool find = true);
// Get the find replace data from the options
wxSTEditorFindReplaceData *GetFindReplaceData() const;
// Get the current string to find
wxString GetFindString() const;
// Get the current replace string
wxString GetReplaceString() const;
// set the current string to find, only sends wxEVT_STE_CANFIND_CHANGED if value changes
void SetFindString(const wxString &str, bool send_evt = false);
// Get the flags used to find a string
int GetFindFlags() const;
// set the current find flags, only sends wxEVT_STE_CANFIND_CHANGED if flags change
void SetFindFlags(long flags, bool send_evt = false);
// get the direction of search
bool GetFindDown() const { return (GetFindFlags() & wxFR_DOWN) != 0; }
// false if the last search failed and the flags or findstr hasn't changed
bool CanFind() const { return HasState(STE_CANFIND); }
// reset the canfind variable in case you change something else
void SetCanFind(bool can_find) { SetStateSingle(STE_CANFIND, can_find); }
// ------------------------------------------------------------------------
// Set/ClearIndicator methods
// Indicate a section of text starting at pos to len, of indic type wxSTC_INDIC(0,1,2)_MASK
void SetIndicator(int pos, int len, int indic);
// Indicates all strings using indic type wxSTC_INDIC(0,1,2)_MASK
// if str = wxEmptyString use GetFindString(), if flags = -1 use GetFindFlags()|STE_FR_WHOLEDOC
bool IndicateAllStrings(const wxString &str=wxEmptyString, int flags = -1, int indic=wxSTC_INDIC0_MASK);
// clear a single character of indicated text of indic type wxSTC_INDIC(0,1,2)_MASK or -1 for all
bool ClearIndicator(int pos, int indic = wxSTC_INDIC0_MASK);
// clear an indicator starting at any position within the indicated text of
// indic type wxSTC_INDIC(0,1,2)_MASK or -1 for all
// returns position after last indicated text or -1 if nothing done
int ClearIndication(int pos, int indic = wxSTC_INDIC0_MASK);
// clears all the indicators of type wxSTC_INDIC(0,1,2)_MASK or -1 for all
void ClearAllIndicators(int indic = -1);
// ------------------------------------------------------------------------
// Printing/Rendering methods
// Show the wxWidgets print dialog
bool ShowPrintDialog();
// Show the wxWidgets print preview dialog
bool ShowPrintPreviewDialog();
// Show the wxWidgets printer setup dialog (papersize, orientation...)
bool ShowPrintSetupDialog();
// Show the wxWidgets print page setup dialog (papersize, margins...)
bool ShowPrintPageSetupDialog();
// Show a STC specific options dialog (Wrapmode, magnification, colourmode)
bool ShowPrintOptionsDialog();
// ------------------------------------------------------------------------
// Menu/MenuBar/Toolbar management
// Update all the menu/tool items in the wxSTEditorOptions for this editor
virtual void UpdateAllItems();
// Update all the known items for a menu, menubar, toolbar, if they're NULL
// then they're not updated
virtual void UpdateItems(wxMenu *menu=NULL, wxMenuBar *menuBar=NULL, wxToolBar *toolBar=NULL);
// ------------------------------------------------------------------------
// Set Lexer Language - you must have set wxSTEditorLangs
// Setup colouring and lexing based on wxSTEditorLangs type
bool SetLanguage(int lang);
// Setup colouring and lexing based on wxSTEditorLangs::GetFilePattern()
bool SetLanguage(const wxString &filename);
// What language are we using, the index into wxSTEditorLangs
// This may or may not match wxSTC::GetLexer since
// different languages may use the same lexer. (Java uses CPP lexer)
int GetLanguageId() const;
// ------------------------------------------------------------------------
// Editor preferences, styles, languages
//
// There are global versions that many editors can share and they're ref
// counted so you don't need to keep any local versions around.
// You should use the globals in at least one editor to not let them go
// to waste. There's nothing special about them, it's just that if you're
// bothering to use this class you'll probably want at least one of each.
//
// The prefs/styles/langs are initially not set for an editor, but can be
// set by the function CreateOptions if you have set them in the options.
// If however you wish to use different ones you may call RegisterXXX to
// "detach" this editor from the others.
//
// example usage :
// editor->RegisterPreferences(wxSTEditorPrefs()); // no prefs
//
// wxSTEditorPrefs myPrefs(true); // create
// myPrefs.SetPrefBool(STE_PREF_VIEWEOL, true); // adjust as necessary
// editor->RegisterPreferences(myPrefs); // assign to editor
// register this editor to use these preferences
// the default is to use the prefs in the options (if set) which by
// default will be the static global wxSTEditorPrefs::GetGlobalEditorPrefs()
// RegisterPrefs(wxSTEditorPrefs(false)) to not use any preferences
void RegisterPrefs(const wxSTEditorPrefs& prefs);
const wxSTEditorPrefs& GetEditorPrefs() const;
wxSTEditorPrefs& GetEditorPrefs();
// register this editor to use these styles
// the default is to use the styles in the options (if set) which by
// default will be the static global wxSTEditorStyles::GetGlobalEditorStyles()
// RegisterStyles(wxSTEditorStyles(false)) to not use any styles
void RegisterStyles(const wxSTEditorStyles& styles);
const wxSTEditorStyles& GetEditorStyles() const;
wxSTEditorStyles& GetEditorStyles();
// register this editor to use these languages
// the default is to use the langs in the options (if set) which by
// default will be the static global wxSTEditorLangs::GetGlobalEditorLangs()
// RegisterLangs(wxSTEditorLangs(false)) to not use any languages
void RegisterLangs(const wxSTEditorLangs& langs);
const wxSTEditorLangs& GetEditorLangs() const;
wxSTEditorLangs& GetEditorLangs();
// -----------------------------------------------------------------------
// implementation
void OnKeyDown(wxKeyEvent& event);
void OnRightUp(wxMouseEvent &event); // popup menu if one is set in options
void OnMenu(wxCommandEvent &event);
// handle menu events of known types, returns sucess, false for unknown id
virtual bool HandleMenuEvent(wxCommandEvent &event);
void OnFindDialog(wxFindDialogEvent& event);
// handle the find dialog event
virtual void HandleFindDialogEvent(wxFindDialogEvent& event);
void OnSTCUpdateUI(wxStyledTextEvent &event);
void OnSTCCharAdded(wxStyledTextEvent &event);
void OnSTCMarginClick(wxStyledTextEvent &event);
void OnSTCMarginDClick(wxStyledTextEvent &event); // we generate this event
void OnSetFocus(wxFocusEvent &event);
void OnSTEState(wxSTEditorEvent &event);
void OnSTEFocus(wxSTEditorEvent &event);
void OnEraseBackground(wxEraseEvent &event) { event.Skip(false); }
void OnMouseWheel(wxMouseEvent& event); // FIXME - only for wxGTK 2.0
void OnScroll(wxScrollEvent& event);
void OnScrollWin(wxScrollWinEvent& event);
// Access to the scrollbars in wxStyledTextCtrl
wxScrollBar* GetHScrollBar() { return m_hScrollBar; }
wxScrollBar* GetVScrollBar() { return m_vScrollBar; }
// Get the width in pixels of the longest line between top_line and
// bottom_line takeing care of ctrl chars and tabs.
// if top_line = bottom_line = -1 then use the visible lines.
int GetLongestLinePixelWidth(int top_line = -1, int bottom_line = -1);
// Update all the CanSave, CanXXX functions to see if they've changed and
// and send appropriate events as to what has changed for updating UI
// this is called in OnSTCUpdateUI, but Saving doesn't generate an event
// but CanSave becomes false. Make sure to call this in odd cases like this.
// if send_event is false don't send events just update internal values
void UpdateCanDo(bool send_event);
// Get/Set combinations enum STE_StateType
long GetState() const { return m_state; }
void SetState(long state) { m_state = state; }
bool HasState(long ste_statetype) const { return (GetState() & ste_statetype) != 0; }
void SetStateSingle(long state, bool set) { if (set) SetState(GetState() | state); else SetState(GetState() & ~state); }
// Check if we autoindented but the user didn't type anything and
// remove the space we added. (resets m_last_autoindent_line/len)
bool ResetLastAutoIndentLine();
// These are not currently used
int IsLinePreprocessorCondition(const wxString &line);
bool FindMatchingPreprocessorCondition(int &curLine, int direction,
int condEnd1, int condEnd2);
bool FindMatchingPreprocCondPosition(bool isForward, int &mppcAtCaret,int &mppcMatch);
// for brace matching and highlighting other brace
bool DoFindMatchingBracePosition(int &braceAtCaret, int &braceOpposite, bool sloppy);
void DoBraceMatch();
// Get the position (col) of the caret in the line it's currently in
int GetCaretInLine();
// ------------------------------------------------------------------------
// Autocomplete functions
// Get keywords as a space separated list from the langs that begin with root
virtual wxString GetAutoCompleteKeyWords(const wxString& root);
// Add the matching keywords from the langs to the array string
// returns the number added
size_t DoGetAutoCompleteKeyWords(const wxString& root, wxArrayString& words);
// Show the autocompletion box if any keywords from the langs match the start
// of the current word
bool StartAutoComplete();
// Show the autocompletion box if any other words in the document match the start
// of the current word
// if onlyOneWord then if more than one word then don't show box
// if add_keywords then also add the keywords from the langs
bool StartAutoCompleteWord(bool onlyOneWord, bool add_keywords);
// ------------------------------------------------------------------------
// Note for a wxEVT_STE_STATE_CHANGED event evt_int is the changed state and
// extra_long is the state values.
// Otherwise the int/long values are those in the wxCommandEvent
bool SendEvent(wxEventType eventType, int evt_int = 0, long extra_long = 0,
const wxString &evtStr = wxEmptyString );
// ------------------------------------------------------------------------
// Get the ref counted data for the editor (ref counted for splitting)
// The ref data is ALWAYS expected to exist, do NOT call wxObject::UnRef
wxSTEditorRefData* GetSTERefData() const { return (wxSTEditorRefData*)GetRefData(); }
// If this editor is going to use a Refed document, run this after construction
// to have this mirror the original wxSTEditor, origEditor isn't modified
// See usage in wxSTEditorSplitter
virtual void RefEditor(wxSTEditor *origEditor);
protected:
bool m_sendEvents; // block sending events if false
bool m_activating; // are we in EVT_ACTIVATE already
long m_state; // what state does this editor have, enum STE_StateType
wxLongLong m_marginDClickTime; // last time margin was clicked
int m_marginDClickLine; // last line margin was clicked on
int m_marginDClickMargin; // last margin # clicked on
wxSTERecursionGuardFlag m_rGuard_OnMenu;
wxSTERecursionGuardFlag m_rGuard_HandleMenuEvent;
wxSTERecursionGuardFlag m_rGuard_OnFindDialog;
#ifdef GLI_CHANGES
void ToggleBreakpoint(unsigned int breakLine);
#endif //GLI_CHANGES
private:
void Init();
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxSTEditor)
};
//-----------------------------------------------------------------------------
// wxSTEditorEvent
//
// helper events to update the gui only when items change (avoids UpdateUI overkill)
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_STEDIT wxSTEditorEvent : public wxCommandEvent
{
public:
wxSTEditorEvent() : wxCommandEvent() {}
wxSTEditorEvent(const wxSTEditorEvent& event) : wxCommandEvent(event) {}
wxSTEditorEvent( int id, wxEventType type, wxObject* obj,
int stateChange, int stateValues,
const wxString& fileName );
// Has the state of the editor changed see STE_StateType for different states.
// can OR states together to see if any of them have changed
bool HasStateChange(int stateChange) const { return (GetStateChange() & stateChange) != 0; }
bool GetStateValue(STE_StateType stateValue) const { return (GetStateValues() & stateValue) != 0; }
int GetStateChange() const { return GetInt(); }
int GetStateValues() const { return int(GetExtraLong()); }
void SetStateChange(int stateChange) { SetInt(stateChange); }
void SetStateValues(int stateValues) { SetExtraLong(stateValues); }
wxString GetFileName() const { return GetString(); }
void SetFileName( const wxString& fileName ) { SetString( fileName ); }
wxSTEditor* GetEditor() const { return wxDynamicCast(GetEventObject(), wxSTEditor); }
// implementation
virtual wxEvent *Clone() const { return new wxSTEditorEvent(*this); }
private:
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSTEditorEvent)
};
BEGIN_DECLARE_EVENT_TYPES()
// editor created, event.GetEventObject is the editor, use to setup after constructor
// (this is a wxCommandEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STE_CREATED, 0)
// splitter created, event.GetEventObject is the splitter, use to setup after constructor
// (this is a wxCommandEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STS_CREATED, 0)
// notebook created, event.GetEventObject is the notebook, use to setup after constructor
// (this is a wxCommandEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STN_CREATED, 0)
// The state of the editor has changed see STE_StateType for the types of changes
// (this is a wxSTEditorEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STE_STATE_CHANGED, 0)
// This editor has the focus now, (serves to pass EVT_SET_FOCUS to parents)
// (this is a wxSTEditorEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STE_SET_FOCUS, 0)
// The popup menu for the wxSTEditor is about to be shown, maybe you want to update it?
// (this is a wxSTEditorEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STE_POPUPMENU, 0)
// The margin has been double clicked in the same line
// (this is a wxStyledTextEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STE_MARGINDCLICK, 0)
// A wxSTEditor is about to be created for the wxSTEditorSplitter.
// event.GetEventObject is the parent wxSTEditorSplitter.
// You can set the event.SetEventObject to a "new wxSTEditor" or a
// subclassed one of your own and this editor will be used instead.
// Make sure that the parent of your editor is the splitter
// (ie. the original event.GetEventObject)
// event.GetInt is the preferred id (probably wxID_ANY)
// (this is a wxCommandEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STS_CREATE_EDITOR, 0)
// A wxSTEditorSplitter is about to be created for the wxSTEditorNotebook.
// event.GetEventObject is the parent wxSTEditorNotebook.
// You can set the event.SetEventObject to a "new wxSTEditorSplitter" or a
// subclassed one of your own and this splitter will be used instead.
// Make sure that the parent of your splitter is the notebook
// (ie. the original event.GetEventObject)
// event.GetInt is the preferred id (probably wxID_ANY)
// (this is a wxCommandEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STN_CREATE_SPLITTER, 0)
// The user has clicked on one of the splitter buttons in the
// wxSTEditor. This event is received by the splitter and then
// the splitting occurs. The event.GetInt() is enum wxSPLIT_VERTICAL
// or wxSPLIT_HORIZONTAL.
// (this is a wxCommandEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STS_SPLIT_BEGIN, 0)
// The wxNotebook doesn't always send enough events to follow it's state.
// This event is sent whenever the selection or page count changes
// eg. When all the pages are deleted, gtk doesn't notify you that the
// selection is now -1
// (this is a wxNotebookEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STN_PAGE_CHANGED, 0)
// Enter has been pressed on the last line of the wxSTEditorShell
// GetString for the event contains the contents of the line.
// (this is a wxSTEditorEvent)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STEDIT, wxEVT_STESHELL_ENTER, 0)
END_DECLARE_EVENT_TYPES()
typedef void (wxEvtHandler::*wxSTEditorEventFunction)(wxSTEditorEvent&);
#define wxSTEditorEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSTEditorEventFunction, &func)
#define wx__DECLARE_STEEVT(evt, id, fn) wx__DECLARE_EVT1( evt, id, wxSTEditorEventHandler(fn))
#define StyledTextEventHandler(func) \
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxStyledTextEventFunction, &func)
#define wx__DECLARE_STEVT(evt, id, fn) wx__DECLARE_EVT1( evt, id, StyledTextEventHandler(fn))
#define EVT_STE_CREATED(id, fn) EVT_COMMAND(id, wxEVT_STE_CREATED, fn)
#define EVT_STS_CREATED(id, fn) EVT_COMMAND(id, wxEVT_STS_CREATED, fn)
#define EVT_STN_CREATED(id, fn) EVT_COMMAND(id, wxEVT_STN_CREATED, fn)
#define EVT_STE_STATE_CHANGED(id, fn) wx__DECLARE_STEEVT(wxEVT_STE_STATE_CHANGED, id, fn)
#define EVT_STE_SET_FOCUS(id, fn) wx__DECLARE_STEEVT(wxEVT_STE_SET_FOCUS, id, fn)
#define EVT_STE_POPUPMENU(id, fn) wx__DECLARE_STEEVT(wxEVT_STE_POPUPMENU, id, fn)
#define EVT_STE_MARGINDCLICK(id, fn) wx__DECLARE_STEVT(wxEVT_STE_MARGINDCLICK, id, fn)
#define EVT_STS_CREATE_EDITOR(id, fn) EVT_COMMAND(id, wxEVT_STS_CREATE_EDITOR, fn)
#define EVT_STN_CREATE_SPLITTER(id, fn) EVT_COMMAND(id, wxEVT_STN_CREATE_SPLITTER, fn)
#define EVT_STN_PAGE_CHANGED(id, fn) wx__DECLARE_EVT1(wxEVT_STN_PAGE_CHANGED, id, wxNotebookEventHandler(fn))
#define EVT_STS_SPLIT_BEGIN(id, fn) wx__DECLARE_EVT1(wxEVT_STS_SPLIT_BEGIN, id, wxCommandEventHandler(fn))
#define EVT_STESHELL_ENTER(id, fn) wx__DECLARE_STEEVT(wxEVT_STESHELL_ENTER, id, fn)
// include the others so that only this file needs to be included for everything
#include "wx/stedit/stenoteb.h"
#include "wx/stedit/steframe.h"
#include "wx/stedit/stesplit.h"
#include "wx/stedit/steprint.h"
#include "wx/stedit/stemenum.h"
#include "wx/stedit/stedlgs.h"
#include "wx/stedit/stefindr.h"
#endif // _STEDIT_H_
| 50.337709 | 146 | 0.662945 |
21e323366f7ee093ea3e159b48b555c60fcc58d4 | 4,640 | html | HTML | index.html | ernesto13/fit-tracker | d12e073b0183a14c8e3735d35c5aacbb2792cd08 | [
"MIT"
] | null | null | null | index.html | ernesto13/fit-tracker | d12e073b0183a14c8e3735d35c5aacbb2792cd08 | [
"MIT"
] | null | null | null | index.html | ernesto13/fit-tracker | d12e073b0183a14c8e3735d35c5aacbb2792cd08 | [
"MIT"
] | null | null | null | <!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
<!-- Google Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap">
<!-- Bootstrap core CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.19.1/css/mdb.min.css" rel="stylesheet">
<title>fit track</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">fiTrack</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
</ul>
<!-- <form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form> -->
</div>
</nav>
<div class="container">
<div class="card text-center mt-3">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
</li>
</ul>
</div>
<div class="card-body">
<h5 class="card-title">Back and Biceps</h5>
<p class="card-text">Last done on</p>
<!--<input class="form-control col-4 text-center" type="date" />-->
<a href="back.html" class="btn btn-primary">Start</a>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<!-- JQuery -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.4/umd/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.19.1/js/mdb.min.js"></script>
<script src="assets/javascript/main.js"></script>
</body>
</html> | 46.4 | 215 | 0.663578 |
9f15937fde9d8eb4eff927f9de402f56d1d5bfcd | 4,181 | sql | SQL | hotel.sql | AkilAkil/hotel | b9f379122f9c25949afee77b681a49c1fdde75f2 | [
"MIT"
] | null | null | null | hotel.sql | AkilAkil/hotel | b9f379122f9c25949afee77b681a49c1fdde75f2 | [
"MIT"
] | null | null | null | hotel.sql | AkilAkil/hotel | b9f379122f9c25949afee77b681a49c1fdde75f2 | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 4.0.10deb1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 08, 2017 at 06:13 PM
-- Server version: 5.5.54-0ubuntu0.14.04.1
-- PHP Version: 5.5.9-1ubuntu4.21
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 utf8 */;
--
-- Database: `hotel`
--
-- --------------------------------------------------------
--
-- Table structure for table `cab`
--
CREATE TABLE IF NOT EXISTS `cab` (
`cabnum` varchar(50) NOT NULL,
`driverno` varchar(50) NOT NULL,
`bookedperson` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `cab`
--
INSERT INTO `cab` (`cabnum`, `driverno`, `bookedperson`) VALUES
('TN 29 BD1000', '9587412569', 'Akilan'),
('TN 19 AA 0001', '4578466851', 'Akil');
-- --------------------------------------------------------
--
-- Table structure for table `occupied`
--
CREATE TABLE IF NOT EXISTS `occupied` (
`name` varchar(50) NOT NULL,
`id` varchar(50) NOT NULL,
`checkin` varchar(20) NOT NULL,
`checkout` varchar(20) NOT NULL,
`intime` varchar(10) NOT NULL,
`outtime` varchar(10) NOT NULL,
`number` varchar(20) NOT NULL,
`advance` varchar(25) NOT NULL,
`roomno` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `occupied`
--
INSERT INTO `occupied` (`name`, `id`, `checkin`, `checkout`, `intime`, `outtime`, `number`, `advance`, `roomno`) VALUES
('Akilan', 'PAN Card', '10/10/2017', '12/10/2016', '10 AM', '11 AM', '1234567890', '5000', '101'),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '10 AM', '1234567890', '10000', ''),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '11 AM', '1234567890', '', ''),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '11 AM', '1234567890', '', ''),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '11 AM', '1234567890', '', ''),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '11 AM', '1234567890', '', ''),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '11 AM', '1234567890', '', ''),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '11 AM', '1234567890', '', ''),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '11 AM', '1234567890', '', ''),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '11 AM', '1234567890', '', ''),
('ak', 'Aadhar', '10/12/2016', '20/12/2016', '10 AM', '11 AM', '1234567890', '', '');
-- --------------------------------------------------------
--
-- Table structure for table `room`
--
CREATE TABLE IF NOT EXISTS `room` (
`rno` varchar(10) NOT NULL,
`fno` varchar(10) NOT NULL,
`rtype` varchar(50) NOT NULL,
`services` varchar(50) NOT NULL,
`price` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `room`
--
INSERT INTO `room` (`rno`, `fno`, `rtype`, `services`, `price`) VALUES
('100', '1', 'double', 'Luxury Service', '10,000'),
('101', '1', 'Single', 'Selected Services', '5000'),
('110', '1', 'Quad', 'Luxury', '15000'),
('201', '2', 'Triple', 'Economy', '3000'),
('210', '2', 'Single', 'Selected Services', '2000'),
('308', '3', 'double', 'Selected Services', '3999');
-- --------------------------------------------------------
--
-- Table structure for table `user`
--
CREATE TABLE IF NOT EXISTS `user` (
`name` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`pass` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user`
--
INSERT INTO `user` (`name`, `email`, `pass`) VALUES
('admin', '', 'asdf1234'),
('Akil', 'agilan.madhiyan@gmail.com', 'qwerty'),
('Akilan', 'akilan@gmail.com', 'asdf123'),
('Akilan', 'akilan@gmail.com', 'asdf123'),
('Akilan', 'akilan@gmail.com', 'asdf123'),
('ajith', 'ajith@gmail.com', 'qwerty');
/*!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 */;
| 31.916031 | 119 | 0.586463 |
497c0e6b6490d83056393f6cb8bd0ce71780eacc | 3,922 | html | HTML | SaPlat/src/main/resources/template/app/project/inviteExpertGroup.html | gzmuSoft/SaPlat | a3a398c4aae506197c8f22db79e19db21569dabd | [
"Apache-2.0"
] | 7 | 2019-03-07T00:59:19.000Z | 2021-12-29T10:16:18.000Z | SaPlat/src/main/resources/template/app/project/inviteExpertGroup.html | gzmuSoft/SaPlat | a3a398c4aae506197c8f22db79e19db21569dabd | [
"Apache-2.0"
] | null | null | null | SaPlat/src/main/resources/template/app/project/inviteExpertGroup.html | gzmuSoft/SaPlat | a3a398c4aae506197c8f22db79e19db21569dabd | [
"Apache-2.0"
] | 7 | 2018-07-24T04:59:23.000Z | 2019-07-31T06:39:53.000Z | #include("/template/common/layout/_page_layout.html")
#@layout()
#define css()
<style>
button {
background: #758ef0;
color: #FFF;
border: none;
border-radius: 15px;
}
</style>
#end
#define content()
<div class="x-body">
<label class="layui-form-label">专家姓名</label>
<div class="layui-input-inline">
<input type="text" id="name" name="name" placeholder="姓名" class="layui-input"/>
</div>
<div class="layui-input-inline" style="width : 80px">
<button class="layui-btn" lay-submit="" id="search"><i class="layui-icon"></i>
</button>
</div>
<!--隐藏id-->
<input type="text" id="id" name="id"
class="layui-input layui-disabled layui-hide" value="#(id)" required/>
<div class="layui-row">
<table id="dateTable" lay-filter="dateTable"></table>
</div>
<script type="text/html" id="barOption">
#shiroHasPermission('/app/project/inviteReview')
#[[
{{# if(!d.isInvite){ }}
]]#
<a class="layui-btn layui-btn-xs" lay-event="invite">邀请</a>
#[[
{{# } else if(d.isInvite){ }}
]]#
<a class="layui-btn layui-btn-disabled layui-btn-xs" disabled="disabled">√已邀请</a>
#[[
{{# } }}
]]#
#end
</script>
</div>
#end
#define js()
<script type="text/javascript">
layui.use(['table', 'layer'], function () {
var table = layui.table, layer = layui.layer;
// 审核通过的表格渲染
var tableIns = table.render({
elem: '#dateTable' //指定原始表格元素选择器(推荐id选择器)
, id: 'dateTable'
, even: true //开启隔行背景
, size: 'sm' //小尺寸的表格
, height: 'full-150' //容器高度
, cols: [[ //标题栏
{type: 'numbers', fixed: true, unresize: 'true'}
, {field: 'name', title: '姓名', width: 100, sort: true}
, {field: 'workstate', title: '在职状态', width: 90}
, {field: 'phone', title: '联系电话', width: 110, templet: function(d){return d.user? (d.user.phone||'') : '';}}
, {field: 'Email', title: 'Email', width: 200, templet: function(d){return d.user? (d.user.email||'') : '';}}
, {field: 'department', title: '所在部门', width: 200}
, {field: 'profess', title: '专业资格', minWidth: 200}
, {field: 'project', title: '参与项目经历', minWidth: 200}
, {fixed: 'right', title: '操作', minWidth:100, align: 'center', toolbar: '#barOption'} //这里的toolbar值是模板元素的选择器
]]
, url: '#(ctxPath)/app/project/expertGroupTable?id=' + $('#id').val()
, method: 'get'
, request: {
pageName: 'pageNumber' //页码的参数名称,默认:page
, limitName: 'pageSize' //每页数据量的参数名,默认:limit
}
, initSort: {
field: 'createTime'//按照时间进行默认排序
,type: 'desc'
}
, page: true
, limits: [30, 60, 90, 150, 300]
, limit: 30 //默认采用30
, loading: true
, done: function (res, curr, count) {
}
});
table.on('tool(dateTable)', function (obj) {
var data = obj.data;
if (obj.event === 'invite') {
$.ajax({
type: 'POST',
url: '#(ctxPath)/app/project/inviteReview?id=' + data.id + '&projectId=' + $('#id').val(),
success: function () {
window.location.reload();
}
});
}
});
$('#search').click(function () {
table.reload('dateTable', {
url: '#(ctxPath)/app/expert_group/tableData?name=' + $('#name').val()
});
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
});
});
</script>
#end | 32.413223 | 125 | 0.472718 |
9bd3b9d1bdabb41476d5f7b397f1751d3c47c2a9 | 1,738 | js | JavaScript | tailwind.config.js | markusantonwolf/best-practice-vue-js-tailwind-post-css | 9d2d5580615b04002d6db9829d0a581125e4e69b | [
"MIT"
] | 9 | 2020-11-13T14:52:53.000Z | 2022-03-03T19:02:18.000Z | tailwind.config.js | markusantonwolf/best-practice-vue-js-tailwind-post-css | 9d2d5580615b04002d6db9829d0a581125e4e69b | [
"MIT"
] | null | null | null | tailwind.config.js | markusantonwolf/best-practice-vue-js-tailwind-post-css | 9d2d5580615b04002d6db9829d0a581125e4e69b | [
"MIT"
] | null | null | null | const { colors } = require('tailwindcss/defaultTheme')
const plugin = require('tailwindcss/plugin')
module.exports = {
purge: ['./src/**/*.html', './src/**/*.vue', './public/**/*.html'],
theme: {
fontFamily: {
sans: ['Fira Sans', '"Helvetica Neue"', 'Arial', '"Noto Sans"', 'sans-serif'],
mono: ['Fira Code', 'Monaco', 'Consolas', '"Liberation Mono"', '"Courier New"', 'monospace'],
},
listStyleType: {
circle: 'circle',
},
container: {
center: true,
},
height: theme => ({
auto: 'auto',
...theme('spacing'),
full: '100%',
screen: 'calc(var(--vh) * 100)',
}),
minHeight: theme => ({
'0': '0',
...theme('spacing'),
full: '100%',
screen: 'calc(var(--vh) * 100)',
}),
extend: {
colors: {
primary: colors.pink[800],
secondary: colors.blue[800],
copy: colors.gray[800],
},
opacity: {
'10': '0.1',
'20': '0.2',
'30': '0.3',
'40': '0.4',
'50': '0.5',
'60': '0.6',
'70': '0.7',
'80': '0.8',
'90': '0.9',
},
},
},
variants: {},
plugins: [
plugin(function({ addUtilities }) {
const newUtilities = {
'.text-shadow': {
textShadow: '1px 1px 0px rgba(0,0,0, 0.6), -1px -1px 0px rgba(0,0,0, 0.2)',
},
'.text-glow': {
textShadow: '1px 1px 1px rgba(255, 255, 255, 0.6), -1px -1px 1px rgba(255, 255, 255, 0.2)',
},
'.filter-blur': {
filter: 'blur(10px)',
},
'.backdrop-blur': {
backdropFilter: 'blur(4px)',
},
}
addUtilities(newUtilities, ['responsive', 'hover'])
}),
],
}
| 25.188406 | 101 | 0.449367 |
9b8a923c04f1c45ef6d6b8b1a337963f4a076eda | 1,328 | js | JavaScript | packages/react-examples/src/pages/scrollbar/components/mousewheel.js | cym2050/better-scroll | c97e67ecf15e616d998e67aa4ce15a7c429691c3 | [
"MIT"
] | 17,030 | 2015-12-18T03:29:34.000Z | 2022-03-31T12:48:31.000Z | packages/react-examples/src/pages/scrollbar/components/mousewheel.js | cym2050/better-scroll | c97e67ecf15e616d998e67aa4ce15a7c429691c3 | [
"MIT"
] | 1,172 | 2016-12-08T13:59:03.000Z | 2022-03-29T10:59:09.000Z | packages/react-examples/src/pages/scrollbar/components/mousewheel.js | cym2050/better-scroll | c97e67ecf15e616d998e67aa4ce15a7c429691c3 | [
"MIT"
] | 3,231 | 2016-05-30T11:25:41.000Z | 2022-03-31T07:47:39.000Z | import React, { useRef } from 'react'
import BScroll from '@better-scroll/core'
import ScrollBar from '@better-scroll/scroll-bar'
import MouseWheel from '@better-scroll/mouse-wheel'
import girlImageLink from './sad-girl.jpg'
BScroll.use(ScrollBar)
BScroll.use(MouseWheel)
const Mousewheel = () => {
const wrapperRef = useRef(null)
const horizontalRef = useRef(null)
const scrollRef = useRef(null)
const onLoad = () => {
scrollRef.current = new BScroll(wrapperRef.current, {
scrollX: true,
scrollY: false,
click: true,
mouseWheel: true,
scrollbar: {
customElements: [horizontalRef.current],
fade: true,
interactive: true,
scrollbarTrackClickable: true,
},
})
}
return (
<div className="mousewheel-scrollbar-container view">
<div className="custom-scrollbar-wrapper" ref={wrapperRef}>
<div class="custom-scrollbar-content">
<img onLoad={onLoad} src={girlImageLink} alt="custom" />
</div>
{/* custom-horizontal-scrollbar */}
<div className="custom-horizontal-scrollbar" ref={horizontalRef}>
<div className="custom-horizontal-indicator"></div>
</div>
</div>
<div className="tip">please use your mouse-wheel</div>
</div>
)
}
export default Mousewheel
| 27.666667 | 73 | 0.646837 |
7274ca6ce4d9032159d7cc641f9a6b287b972405 | 5,053 | rs | Rust | enigma-core/app/src/wasm_u/mod.rs | enigmampc/enigma-core | 3c04c2625741daa693cdc1a867db03bc1dc3ead2 | [
"Apache-2.0"
] | 130 | 2018-07-02T22:03:06.000Z | 2021-07-04T04:23:00.000Z | enigma-core/app/src/wasm_u/mod.rs | rachitnoom/enigma-core | 4dad083a8424287099a0a16a1167ead3faf5b3c9 | [
"Apache-2.0"
] | 88 | 2018-07-05T05:13:32.000Z | 2020-03-10T15:54:42.000Z | enigma-core/app/src/wasm_u/mod.rs | rachitnoom/enigma-core | 4dad083a8424287099a0a16a1167ead3faf5b3c9 | [
"Apache-2.0"
] | 45 | 2018-07-03T14:45:01.000Z | 2021-02-25T02:38:57.000Z | pub mod wasm;
use crate::common_u::errors::EnclaveFailError;
use crate::db::{Delta, DeltaKey, Stype};
use std::{fmt, convert::TryFrom};
use enigma_types::{EnclaveReturn, ExecuteResult, ContractAddress};
use failure::Error;
use sgx_types::*;
#[derive(Clone)]
pub struct WasmTaskResult {
pub bytecode: Box<[u8]>,
pub output: Box<[u8]>, // On Deploy this will be the exeCode
pub delta: Delta,
pub eth_payload: Box<[u8]>,
pub eth_contract_addr: [u8; 20],
pub signature: [u8; 65],
pub used_gas: u64,
}
pub struct WasmTaskFailure {
pub output: Box<[u8]>,
pub signature: [u8; 65],
pub used_gas: u64,
}
#[derive(Debug)]
pub enum WasmResult{
WasmTaskResult(WasmTaskResult),
WasmTaskFailure(WasmTaskFailure),
}
impl Default for WasmTaskResult {
fn default() -> WasmTaskResult {
WasmTaskResult {
bytecode: Default::default(),
output: Default::default(),
delta: Default::default(),
eth_payload: Default::default(),
eth_contract_addr: Default::default(),
signature: [0u8; 65],
used_gas: Default::default()
}
}
}
impl Default for WasmTaskFailure {
fn default() -> WasmTaskFailure {
WasmTaskFailure {
output: Default::default(),
signature: [0u8; 65],
used_gas: Default::default()
}
}
}
impl fmt::Debug for WasmTaskResult {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut debug_builder = f.debug_struct("WasmTaskResult");
debug_builder.field("bytecode", &self.bytecode);
debug_builder.field("output", &self.output);
debug_builder.field("delta", &self.delta);
debug_builder.field("eth_payload", &self.eth_payload);
debug_builder.field("eth_contract_addr", &self.eth_contract_addr);
debug_builder.field("signature", &(&self.signature[..]));
debug_builder.field("used_gas", &self.used_gas);
debug_builder.finish()
}
}
impl fmt::Debug for WasmTaskFailure{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut debug_builder = f.debug_struct("WasmTaskFailure");
debug_builder.field("output", &self.output);
debug_builder.field("signature", &(&self.signature[..]));
debug_builder.field("used_gas", &self.used_gas);
debug_builder.finish()
}
}
impl TryFrom<(ExecuteResult, ContractAddress, EnclaveReturn, sgx_status_t)> for WasmResult {
type Error = Error;
fn try_from(exec: (ExecuteResult, ContractAddress, EnclaveReturn, sgx_status_t)) -> Result<Self, Self::Error> {
let get_output = |exec_result: ExecuteResult| -> Result<Box<[u8]>, Self::Error> {
if exec_result.output.is_null() {
bail!("The 'output' pointer in ExecuteResult is null: {:?}", exec_result);
}
let box_ptr = exec.0.output as *mut Box<[u8]>;
let output = unsafe { Box::from_raw(box_ptr) };
Ok(*output)
};
if exec.2 == EnclaveReturn::TaskFailure {
let mut result: WasmTaskFailure = Default::default();
result.output = get_output(exec.0)?;
result.signature = exec.0.signature;
result.used_gas = exec.0.used_gas;
Ok(WasmResult::WasmTaskFailure(result))
}
else if exec.2 != EnclaveReturn::Success || exec.3 != sgx_status_t::SGX_SUCCESS {
Err(EnclaveFailError { err: exec.2, status: exec.3 }.into())
}
else {
if exec.0.ethereum_payload_ptr.is_null() || exec.0.delta_ptr.is_null() {
bail!("One of the pointers in ExecuteResult is null: {:?}", exec.0);
}
let mut result: WasmTaskResult = Default::default();
// If execution does not return any result, then `output` points to empty array []
result.output = get_output(exec.0)?;
result.signature = exec.0.signature;
result.used_gas = exec.0.used_gas;
// If there is no call to any ethereum contract in the execution, then
// `eth_contract_addr` is all zeros
result.eth_contract_addr = exec.0.ethereum_address;
// If there is no call to any ethereum contract in the execution, then
// `ethereum_payload_ptr` points to empty array []
let box_payload_ptr = exec.0.ethereum_payload_ptr as *mut Box<[u8]>;
let payload = unsafe { Box::from_raw(box_payload_ptr) };
result.eth_payload = *payload;
// If state was not changed by the execution (which means that delta is empty),
// then `delta_ptr` points to empty array []
let box_ptr = exec.0.delta_ptr as *mut Box<[u8]>;
let delta_data = unsafe { Box::from_raw(box_ptr) };
result.delta.value = delta_data.to_vec();
result.delta.key = DeltaKey::new(exec.1, Stype::Delta(exec.0.delta_index));
Ok(WasmResult::WasmTaskResult(result))
}
}
}
| 37.42963 | 115 | 0.611122 |
7f6b8f7d71261c7bccc514f3a9486c174c5db723 | 1,897 | html | HTML | app/views/prototype-sya-demo/submit-your-appeal/002-dwp-esa-office.html | SparkyJustice/sscs-pcq-prototype | 32134b271d1b48b8e21eb198da37236c5e8d84d8 | [
"MIT"
] | null | null | null | app/views/prototype-sya-demo/submit-your-appeal/002-dwp-esa-office.html | SparkyJustice/sscs-pcq-prototype | 32134b271d1b48b8e21eb198da37236c5e8d84d8 | [
"MIT"
] | 1 | 2022-03-27T21:11:13.000Z | 2022-03-27T21:11:13.000Z | app/views/prototype-sya-demo/submit-your-appeal/002-dwp-esa-office.html | SparkyJustice/sscs-pcq-prototype | 32134b271d1b48b8e21eb198da37236c5e8d84d8 | [
"MIT"
] | null | null | null | {% extends "layout.html" %}
{% block page_title %}
Your MRN - Appeal a benefit decision - GOV.UK
{% endblock %}
{% block content %}
<main id="content" class="prototype-8" role="main">
{% include "includes/phase_banner_beta.html" %}
<a href="../prototype-sya-demo/submit-your-appeal/001-benefit-type" class="link-back">Back</a>
<div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-large">
Find DWP’s address on the top right of your Mandatory Reconsideration Notice (MRN)
</h1>
<!-- <details>
<summary><span class="summary">What’s a Mandatory Reconsideration Notice?</span></summary>
<p>Your MRN is the letter you received from DWP when you asked them to reconsider their decision about the PIP benefit. If you don’t have one, click ‘I don’t have a Mandatory Reconsideration Notice.’ </p>
</details> -->
<!--<p>This is the letter you received from DWP when you asked them to reconsider their decision about the PIP benefit. </p>-->
<div class="form-group">
<img src="/public/images/mrn/dwp-office-number.png" width="100%" alt="Example Mandatory Reconsideration Notice with the first line of the address highlighted.">
<form>
<br/>
<fieldset>
<p class="bold">Select the office which is shown in the first line of DWP’s address</p>
<div class="govuk-form-group">
<select class="govuk-select" id="sort" name="sort">
<option value="published">Recently published</option>
<option value="updated" selected>Recently updated</option>
<option value="views">Most views</option>
<option value="comments">Most comments</option>
</select>
</div>
</fieldset>
</div>
<a class="button" href="#">Continue</a>
</form>
</div>
</div>
</main>
{% endblock %} | 42.155556 | 213 | 0.629415 |
dd51bd8e315c4ffe29c56b434d84a19a48f4f74a | 1,865 | go | Go | app/contexts.go | k-kurikuri/goa-sandbox | 65952c63834951b8118f3718fb00921866fa2723 | [
"MIT"
] | null | null | null | app/contexts.go | k-kurikuri/goa-sandbox | 65952c63834951b8118f3718fb00921866fa2723 | [
"MIT"
] | null | null | null | app/contexts.go | k-kurikuri/goa-sandbox | 65952c63834951b8118f3718fb00921866fa2723 | [
"MIT"
] | null | null | null | // Code generated by goagen v1.4.0, DO NOT EDIT.
//
// API "adder": Application Contexts
//
// Command:
// $ goagen
// --design=github.com/k-kurikuri/goa-sandbox/design
// --out=$(GOPATH)/src/github.com/k-kurikuri/goa-sandbox
// --version=v1.3.1
package app
import (
"context"
"github.com/goadesign/goa"
"net/http"
"strconv"
)
// AddOperandsContext provides the operands add action context.
type AddOperandsContext struct {
context.Context
*goa.ResponseData
*goa.RequestData
Left int
Right int
}
// NewAddOperandsContext parses the incoming request URL and body, performs validations and creates the
// context used by the operands controller add action.
func NewAddOperandsContext(ctx context.Context, r *http.Request, service *goa.Service) (*AddOperandsContext, error) {
var err error
resp := goa.ContextResponse(ctx)
resp.Service = service
req := goa.ContextRequest(ctx)
req.Request = r
rctx := AddOperandsContext{Context: ctx, ResponseData: resp, RequestData: req}
paramLeft := req.Params["left"]
if len(paramLeft) > 0 {
rawLeft := paramLeft[0]
if left, err2 := strconv.Atoi(rawLeft); err2 == nil {
rctx.Left = left
} else {
err = goa.MergeErrors(err, goa.InvalidParamTypeError("left", rawLeft, "integer"))
}
}
paramRight := req.Params["right"]
if len(paramRight) > 0 {
rawRight := paramRight[0]
if right, err2 := strconv.Atoi(rawRight); err2 == nil {
rctx.Right = right
} else {
err = goa.MergeErrors(err, goa.InvalidParamTypeError("right", rawRight, "integer"))
}
}
return &rctx, err
}
// OK sends a HTTP response with status code 200.
func (ctx *AddOperandsContext) OK(resp []byte) error {
if ctx.ResponseData.Header().Get("Content-Type") == "" {
ctx.ResponseData.Header().Set("Content-Type", "text/plain")
}
ctx.ResponseData.WriteHeader(200)
_, err := ctx.ResponseData.Write(resp)
return err
}
| 27.426471 | 117 | 0.706702 |
2c7d67cdf4e8a3f2957aa3d4a9a4c622abcda85b | 2,008 | swift | Swift | 6 Feet Between.playgroundbook/Contents/UserModules/GameFoundationModule.playgroundmodule/Sources/StoryView.swift | TonyTang2001/SixFeetBetween_WWDC20SwiftChallenge | e8175728721f51a6a91e4ca300782efb5c9adc72 | [
"MIT"
] | 10 | 2020-06-17T03:31:30.000Z | 2021-04-04T11:25:53.000Z | SixFeetBetween_WWDC20SwiftChallenge/Views/StoryView.swift | TonyTang2001/SixFeetBetween_WWDC20SwiftChallenge | e8175728721f51a6a91e4ca300782efb5c9adc72 | [
"MIT"
] | null | null | null | SixFeetBetween_WWDC20SwiftChallenge/Views/StoryView.swift | TonyTang2001/SixFeetBetween_WWDC20SwiftChallenge | e8175728721f51a6a91e4ca300782efb5c9adc72 | [
"MIT"
] | null | null | null | //
// StoryView.swift
// WWDC20PlaygroundTest
//
// Created by Tony Tang on 5/16/20.
// Copyright © 2020 TonyTang. All rights reserved.
//
import SwiftUI
public struct StoryView: View {
var endingString = "Go to the next page for some training!"
@State var animate1Start = false
@State var animate1End = false
@State var animate2Start = false
@State var animate2End = false
@State var animate3Start = false
@State var animate3End = false
@State var animate4Start = false
@State var animate4End = false
@State var animate5Start = false
public init() {}
public var body: some View {
ZStack {
StoryTextIntroView(animate1Start: $animate1Start, animate1End: $animate1End, animate2Start: $animate2Start, animate2End: $animate2End, animate3Start: $animate3Start, animate3End: $animate3End)
.opacity(animate3Start ? 0 : 1)
.onAppear {
self.animate1Start = true
DispatchQueue.main.asyncAfter(deadline: .now() + 7) {
self.animate1End = true
}
}
BriefLogisticExplanationView(animate3Start: $animate3Start, animate3End: $animate3End, animate4Start: $animate4Start, animate4End: $animate4End, animate5Start: $animate5Start)
.opacity(animate5Start ? 0 : 1)
VStack {
Text(endingString)
.fontWeight(.semibold)
.font(.system(.title, design: .rounded))
.multilineTextAlignment(.center)
.opacity(self.animate5Start ? 1 : 0)
.offset(y: self.animate5Start ? 0 : 16)
.animation(Animation.easeInOut(duration: 1))
}
.opacity(animate5Start ? 1 : 0)
}
}
}
struct StoryView_Previews: PreviewProvider {
static var previews: some View {
StoryView()
}
}
| 31.873016 | 204 | 0.580179 |
c7e468d1e306cd4963641146f5e5eca1f752ebcf | 159 | java | Java | jmock/src/main/java/org/jmock/internal/Formatting.java | ittaiz/jmock-library | a05106e2e5c76d7e86f422239c8f161e272ed536 | [
"BSD-3-Clause"
] | 97 | 2015-01-18T19:56:00.000Z | 2022-02-07T11:53:29.000Z | jmock/src/main/java/org/jmock/internal/Formatting.java | ittaiz/jmock-library | a05106e2e5c76d7e86f422239c8f161e272ed536 | [
"BSD-3-Clause"
] | 131 | 2015-01-29T14:58:44.000Z | 2021-08-02T05:21:44.000Z | jmock/src/main/java/org/jmock/internal/Formatting.java | ittaiz/jmock-library | a05106e2e5c76d7e86f422239c8f161e272ed536 | [
"BSD-3-Clause"
] | 61 | 2015-04-16T23:32:34.000Z | 2022-01-14T15:00:47.000Z | package org.jmock.internal;
public class Formatting {
public static String times(int i) {
return i + " " + (i == 1 ? "time" : "times");
}
}
| 15.9 | 53 | 0.559748 |
2a8a0c8a0b667bac35f7ca36a742a5d827d021fe | 3,557 | java | Java | src/main/java/com/microsoft/graph/requests/extensions/IDepOnboardingSettingRequestBuilder.java | sbh04101989/msgraph-beta-sdk-java | c1de187b73396aa422fcfe3afc493acb92f6260c | [
"MIT"
] | null | null | null | src/main/java/com/microsoft/graph/requests/extensions/IDepOnboardingSettingRequestBuilder.java | sbh04101989/msgraph-beta-sdk-java | c1de187b73396aa422fcfe3afc493acb92f6260c | [
"MIT"
] | null | null | null | src/main/java/com/microsoft/graph/requests/extensions/IDepOnboardingSettingRequestBuilder.java | sbh04101989/msgraph-beta-sdk-java | c1de187b73396aa422fcfe3afc493acb92f6260c | [
"MIT"
] | null | null | null | // Template Source: IBaseEntityRequestBuilder.java.tt
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.requests.extensions;
import com.microsoft.graph.http.IRequestBuilder;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.concurrency.ICallback;
import com.microsoft.graph.models.extensions.DepOnboardingSetting;
import com.microsoft.graph.requests.extensions.IEnrollmentProfileCollectionRequestBuilder;
import com.microsoft.graph.requests.extensions.IEnrollmentProfileRequestBuilder;
import com.microsoft.graph.requests.extensions.IImportedAppleDeviceIdentityCollectionRequestBuilder;
import com.microsoft.graph.requests.extensions.IImportedAppleDeviceIdentityRequestBuilder;
import com.microsoft.graph.requests.extensions.IDepIOSEnrollmentProfileRequestBuilder;
import com.microsoft.graph.requests.extensions.IDepMacOSEnrollmentProfileRequestBuilder;
import java.util.Arrays;
import java.util.EnumSet;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The interface for the Dep Onboarding Setting Request Builder.
*/
public interface IDepOnboardingSettingRequestBuilder extends IRequestBuilder {
/**
* Creates the request
*
* @param requestOptions the options for this request
* @return the IDepOnboardingSettingRequest instance
*/
IDepOnboardingSettingRequest buildRequest(final com.microsoft.graph.options.Option... requestOptions);
/**
* Creates the request with specific options instead of the existing options
*
* @param requestOptions the options for this request
* @return the IDepOnboardingSettingRequest instance
*/
IDepOnboardingSettingRequest buildRequest(final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions);
/**
* Gets the request builder for DepIOSEnrollmentProfile
*
* @return the IDepIOSEnrollmentProfileWithReferenceRequestBuilder instance
*/
IDepIOSEnrollmentProfileWithReferenceRequestBuilder defaultIosEnrollmentProfile();
/**
* Gets the request builder for DepMacOSEnrollmentProfile
*
* @return the IDepMacOSEnrollmentProfileWithReferenceRequestBuilder instance
*/
IDepMacOSEnrollmentProfileWithReferenceRequestBuilder defaultMacOsEnrollmentProfile();
IEnrollmentProfileCollectionRequestBuilder enrollmentProfiles();
IEnrollmentProfileRequestBuilder enrollmentProfiles(final String id);
IImportedAppleDeviceIdentityCollectionRequestBuilder importedAppleDeviceIdentities();
IImportedAppleDeviceIdentityRequestBuilder importedAppleDeviceIdentities(final String id);
IDepOnboardingSettingGenerateEncryptionPublicKeyRequestBuilder generateEncryptionPublicKey();
IDepOnboardingSettingShareForSchoolDataSyncServiceRequestBuilder shareForSchoolDataSyncService();
IDepOnboardingSettingSyncWithAppleDeviceEnrollmentProgramRequestBuilder syncWithAppleDeviceEnrollmentProgram();
IDepOnboardingSettingUnshareForSchoolDataSyncServiceRequestBuilder unshareForSchoolDataSyncService();
IDepOnboardingSettingUploadDepTokenRequestBuilder uploadDepToken(final String appleId, final String depToken);
IDepOnboardingSettingGetEncryptionPublicKeyRequestBuilder getEncryptionPublicKey();
} | 49.402778 | 152 | 0.790273 |
39e3129c4e0458f80b9627d7ec50c023ce2b17ac | 1,092 | java | Java | src/main/java/sketch/compiler/ast/core/typs/NotYetComputedType.java | dolphingarlic/sketch-frontend | e646b7d51405e8a693f45472aa3cc6991a6f38af | [
"X11"
] | 1 | 2020-12-06T03:40:53.000Z | 2020-12-06T03:40:53.000Z | src/main/java/sketch/compiler/ast/core/typs/NotYetComputedType.java | dolphingarlic/sketch-frontend | e646b7d51405e8a693f45472aa3cc6991a6f38af | [
"X11"
] | null | null | null | src/main/java/sketch/compiler/ast/core/typs/NotYetComputedType.java | dolphingarlic/sketch-frontend | e646b7d51405e8a693f45472aa3cc6991a6f38af | [
"X11"
] | null | null | null | package sketch.compiler.ast.core.typs;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import sketch.compiler.ast.cuda.typs.CudaMemoryType;
public class NotYetComputedType extends Type {
public static final NotYetComputedType singleton = new NotYetComputedType();
public NotYetComputedType(CudaMemoryType memtyp) {
super(memtyp);
}
public NotYetComputedType() {
super(CudaMemoryType.UNDEFINED);
}
public String toString() {
return "???";
}
public Collection<Type> getBaseTypes() {
return Collections.singletonList((Type) this);
}
public Map<String, Type> unify(Type t, Set<String> names) {
return Collections.EMPTY_MAP;
}
public String cleanName() {
throw new RuntimeException("This type is not known");
}
@Override
public TypeComparisonResult compare(Type that) {
if (that instanceof NotYetComputedType) {
return TypeComparisonResult.EQ;
}
return TypeComparisonResult.NEQ;
}
}
| 23.73913 | 80 | 0.677656 |
0bd0ad185c47afd9239d3a8f97076a8434d5627e | 15,893 | js | JavaScript | public/js/controllers.js | joaobrunoah/SAMT | 41b74dde88299489a35aaf91c458476c2469fbef | [
"MIT"
] | null | null | null | public/js/controllers.js | joaobrunoah/SAMT | 41b74dde88299489a35aaf91c458476c2469fbef | [
"MIT"
] | null | null | null | public/js/controllers.js | joaobrunoah/SAMT | 41b74dde88299489a35aaf91c458476c2469fbef | [
"MIT"
] | null | null | null | 'use strict';
/* Controllers */
var samtControllers = angular.module('samtControllers', []);
samtControllers.controller('TopNavCtrl',
['$scope', '$location', 'AuthenticationService', '$window', '$http',
function ($scope, $location, AuthenticationService, $window, $http) {
$http.get('texts/texts.json').success(function (data) {
// you can do some processing here
$scope.texts = data;
});
$scope.getClass = function (path) {
if ($location.path().substr(0, path.length) == path) {
return "active"
} else {
return ""
}
}
$scope.logoutAppear = function () {
if (!AuthenticationService.isLogged && $window.localStorage.samtToken
&& $window.localStorage.expirationDate >= Date.now()) {
AuthenticationService.isLogged = true;
return "appear";
}
if (AuthenticationService.isLogged) {
return "appear";
}
return "";
}
$scope.userLogout = function () {
if (AuthenticationService.isLogged) {
AuthenticationService.isLogged = false;
delete $window.localStorage.samtToken;
delete $window.localStorage.expirationDate;
}
}
}]);
samtControllers.controller('InicioCtrl',
['$scope', '$http', '$interval', 'Noticia', 'Projeto', 'Evento',
function ($scope, $http, $interval, Noticia, Projeto, Evento) {
var numberOfElements = 0;
$scope.abaNoticia = true;
$scope.abaEvento = false;
$scope.elementosCounter = 0;
$http.get('texts/texts.json').success(function (data) {
$scope.texts = data;
});
$scope.noticias = {};
$scope.eventos = {};
// Elemento escolhido nas abas!
$scope.elementos = {};
$scope.noticiaQuery = Noticia.query({limit:10}, function () {
for (var i = 0; i < $scope.noticiaQuery.elementos.length; i++) {
var el = $scope.noticiaQuery.elementos[i];
if((el.resumo === undefined) ||
(el.resumo == null) || (el.resumo == "undefined")) {
el.resumo = el.texto.substring(0,150) + "...";
}
$scope.noticiaQuery.elementos[i] = el
}
$scope.noticias = $scope.noticiaQuery.elementos;
$scope.elementos = $scope.noticias;
numberOfElements = $scope.elementos.length;
$scope.activeElemento = $scope.elementos[0]._id;
});
$scope.eventoQuery = Evento.query(function () {
$scope.eventos = $scope.eventoQuery.elementos;
});
$scope.projetos = Projeto.query(function () {
var menorRand = 1;
var selectedProject = 0;
for (var i = 0; i < $scope.projetos.length; i++) {
$scope.projetos[i].random = Math.random();
if ($scope.projetos[i].random < menorRand) {
menorRand = $scope.projetos[i].random;
selectedProject = i;
}
}
$scope.activeProjeto = $scope.projetos[selectedProject]._id;
});
$scope.ordenarPor = '-data';
/* FUNCOES DE NOTICIA E EVENTO */
$scope.selectAba = function (aba) {
if (aba == 'noticia') {
$scope.abaNoticia = true;
$scope.abaEvento = false;
$scope.elementos = $scope.noticias;
} else if (aba == 'evento') {
$scope.abaNoticia = false;
$scope.abaEvento = true;
$scope.elementos = $scope.eventos;
} else {
$scope.abaNoticia = true;
$scope.abaEvento = false;
$scope.elementos = $scope.noticias;
}
numberOfElements = $scope.elementos.length;
$scope.activeElemento = $scope.elementos[0]._id;
};
$scope.isElementoActive = function (idElemento) {
if (idElemento == $scope.activeElemento) {
return "active";
} else {
return "";
}
};
$scope.setElementoActive = function (elNumber) {
$scope.activeElemento = $scope.elementos[elNumber]._id;
$scope.elementosCounter = elNumber;
$interval.cancel($scope.iterateOverElementos);
$scope.iterateOverElementos = $interval(function () {
$scope.elementosCounter += 1;
if ($scope.elementosCounter >= $scope.elementos.length) {
$scope.elementosCounter = 0;
}
$scope.activeElemento = $scope.elementos[$scope.elementosCounter]._id;
$interval.cancel($scope.iterateOverElementos);
$scope.iterateOverElementos = $interval(function () {
$scope.elementosCounter += 1;
if ($scope.elementosCounter >= $scope.elementos.length) {
$scope.elementosCounter = 0;
}
$scope.activeElemento = $scope.elementos[$scope.elementosCounter]._id;
}, 5000);
}, 20000);
}
$scope.getElemento = function () {
for (var i = 0; i < $scope.elementos.length; i++) {
if ($scope.elementos[i]._id == $scope.activeElemento) {
return $scope.elementos[i];
}
}
return null;
}
$scope.iterateOverElementos = $interval(function () {
$scope.elementosCounter += 1;
if ($scope.elementosCounter >= numberOfElements) {
$scope.elementosCounter = 0;
}
$scope.activeElemento = $scope.elementos[$scope.elementosCounter]._id;
}, 5000);
/* toLeft = 1 => left */
$scope.iterateElementos = function (toLeft) {
$interval.cancel($scope.iterateOverElementos);
if (toLeft == 1) {
$scope.elementosCounter -= 1;
if ($scope.elementosCounter < 0) {
$scope.elementosCounter = numberOfElements - 1;
}
$scope.activeElemento = $scope.elementos[$scope.elementosCounter]._id;
} else {
$scope.elementosCounter += 1;
if ($scope.elementosCounter >= numberOfElements) {
$scope.elementosCounter = 0;
}
$scope.activeElemento = $scope.elementos[$scope.elementosCounter]._id;
}
$scope.iterateOverElementos = $interval(function () {
$scope.elementosCounter -= 1;
if ($scope.elementosCounter < 0) {
$scope.elementosCounter = numberOfElements - 1;
}
$scope.activeElemento = $scope.elementos[$scope.elementosCounter]._id;
$interval.cancel($scope.iterateOverElementos);
$scope.iterateOverElementos = $interval(function () {
$scope.elementosCounter -= 1;
if ($scope.elementosCounter < 0) {
$scope.elementosCounter = numberOfElements - 1;
}
$scope.activeElemento = $scope.elementos[$scope.elementosCounter]._id;
}, 5000);
}, 20000);
};
/* FIM DE FUNCOES DE NOTICIA E EVENTO*/
/* FUNCOES DE PROJETO */
$scope.isProjectActive = function (idProjeto) {
if (idProjeto == $scope.activeProjeto) {
return "active";
} else {
return "";
}
}
$scope.setProjectActive = function (idProjeto) {
$scope.activeProjeto = idProjeto;
}
$scope.isLast = function ($last, $first) {
if ($last && !$first) {
return 'last';
}
return '';
}
$scope.isMiddle = function ($middle, $first) {
if ($middle && !$first) {
return 'middle';
}
return '';
}
/* FIM DE FUNCOES DE PROJETO */
}]);
samtControllers.controller('QuemSomosCtrl',
['$scope', '$http', '$sce', 'AuthenticationService',
function ($scope, $http, $sce, AuthenticationService) {
$http.get('texts/texts.json').success(function (data) {
$scope.titulo_secao = data.quem_somos;
$scope.texto_secao = $sce.trustAsHtml(data.quem_somos_text);
$scope.imagem_secao = data.quem_somos_imagem;
$scope.distance_top = data.quem_somos_distance_top;
});
$scope.mustAppear = function (subsecao) {
if (subsecao == 'texto') {
return "appear";
}
return "";
}
$scope.isLoggedIn = function () {
return AuthenticationService.isLogged;
}
}]);
samtControllers.controller('AdminCtrl',
['$scope', '$http', '$window', '$location', 'AuthenticationService', 'UserService', '$route',
function ($scope, $http, $window, $location, AuthenticationService, UserService, $route) {
$http.get('texts/texts.json').success(function (data) {
$scope.texts = data;
});
//Admin User Controller (login, logout)
$scope.Login = function (credentials) {
var username = credentials.username;
var password = credentials.password;
if (username !== undefined && password !== undefined) {
UserService.Login(username, password).success(function (data) {
AuthenticationService.isLogged = true;
$window.localStorage.samtToken = data.samtToken;
$http.defaults.headers.common['x-access-token'] = $window.localStorage.samtToken;
$window.localStorage.expirationDate = data.expires;
$window.localStorage.usuario = username;
$location.path("/");
$route.reload();
}).error(function (status, data) {
alert(status);
//console.log(data);
});
}
};
$scope.isLoggedIn = function () {
return AuthenticationService.isLogged;
};
$scope.isAdmin = function() {
return $window.localStorage.usuario == 'admin';
};
$scope.passInfo = {};
$scope.passInfo.confirmacao = '';
$scope.userInfo = {};
$scope.userInfo.confirmacao = '';
$scope.mudarSenha = function (passInfo) {
if (passInfo.senhaNova != passInfo.confirmacao) {
return;
}
UserService.MudarSenha(passInfo.senhaAntiga, passInfo.senhaNova, $window.localStorage.usuario).success(function (data, status) {
alert(data);
}).error(function (data, status) {
alert(data);
});
};
$scope.adicionarUsuario = function (userInfo) {
if (userInfo.senha != userInfo.confirmacao) {
return;
}
UserService.AdicionarUsuario(userInfo.usuario, userInfo.senha).success(function (data, status) {
alert(data);
}).error(function (data, status) {
alert(data);
});
};
}]);
samtControllers.controller('TrabalheCtrl',
['$scope', '$http', '$sce', 'AuthenticationService',
function ($scope, $http, $sce, AuthenticationService) {
$http.get('texts/texts.json').success(function (data) {
$scope.titulo_secao = data.trabalhe_conosco;
$scope.texto_secao = $sce.trustAsHtml(data.trabalhe_text);
$scope.imagem_secao = data.trabalhe_imagem;
$scope.distance_top = data.trabalhe_distance_top;
});
$scope.mustAppear = function (subsecao) {
if (subsecao == 'texto') {
return "appear";
}
return "";
}
$scope.isLoggedIn = function () {
return AuthenticationService.isLogged;
}
}]);
samtControllers.controller('ContatoCtrl',
['$scope', '$http', '$sce', 'AuthenticationService',
function ($scope, $http, $sce, AuthenticationService) {
$http.get('texts/texts.json').success(function (data) {
$scope.titulo_secao = data.contato;
$scope.texto_secao = $sce.trustAsHtml(data.contato_text);
$scope.imagem_secao = data.contato_imagem;
$scope.distance_top = data.contato_distance_top;
});
$scope.mustAppear = function (subsecao) {
if (subsecao == 'texto') {
return "appear";
}
return "";
}
$scope.isLoggedIn = function () {
return AuthenticationService.isLogged;
}
}]);
//samtControllers.controller('LojaCtrl',
// ['$scope','$http','$sce','AuthenticationService',
// function($scope,$http,$sce,AuthenticationService) {
//
// $http.get('texts/texts.json').success(function(data) {
// $scope.titulo_secao = data.loja;
// $scope.texto_secao = $sce.trustAsHtml(data.loja_text);
// $scope.imagem_secao = data.loja_imagem;
// $scope.distance_top = data.loja_distance_top;
// });
//
// $http.get('/api/loja').success(function(lojas){
// if (lojas) {
// var loja = lojas[0];
// $scope.galeria_fotos = loja.produtos;
// if ($scope.galeria_fotos == undefined) {
// $scope.galeria_fotos = [];
// }
// $scope.galeria_fotos = galeriaFotos.transformarMatriz($scope.galeria_fotos);
// }
// });
//
// $scope.mustAppear = function(subsecao) {
// if(subsecao == 'texto' || subsecao == 'fotos'){
// return "appear";
// }
// return "";
// }
//
// $scope.isLoggedIn = function() {
// return AuthenticationService.isLogged;
// }
//
// $scope.inserirProdutos = function(){
// if($scope.isLoggedin()){
// return "appear";
// }
// return "";
// }
// }]); | 37.930788 | 144 | 0.470585 |
4a6ae0bad43df88ad566ba5fec31287da522793d | 124 | js | JavaScript | truffle/migrations/2_deploy_hawalacoin.js | jsaur/hawalacoin | babf1c40e63694f413d62725857a0114afee60a1 | [
"Apache-2.0"
] | null | null | null | truffle/migrations/2_deploy_hawalacoin.js | jsaur/hawalacoin | babf1c40e63694f413d62725857a0114afee60a1 | [
"Apache-2.0"
] | 5 | 2021-11-16T12:09:09.000Z | 2021-11-17T16:31:55.000Z | truffle/migrations/2_deploy_hawalacoin.js | jsaur/hawalacoin | babf1c40e63694f413d62725857a0114afee60a1 | [
"Apache-2.0"
] | null | null | null | var HawalaCoin = artifacts.require("HawalaCoin");
module.exports = function (deployer) {
deployer.deploy(HawalaCoin);
};
| 20.666667 | 49 | 0.741935 |
59db74bdf64b16bcde36b2cc4b2bd3f1ce2c6e10 | 1,452 | asm | Assembly | programs/oeis/128/A128961.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/128/A128961.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/128/A128961.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A128961: a(n) = (n^3 - n)*3^n.
; 0,54,648,4860,29160,153090,734832,3306744,14171760,58458510,233834040,911952756,3482001432,13057505370,48212327520,175630621680,632270238048,2252462723046,7949868434280,27824539519980,96653663595720,333455139405234,1143274763675088,3897527603437800,13217702307310800,44609745287173950,149888744164904472,501550797782564964,1671835992608549880,5552883832592683530,18381960273410262720,60660468902253866976,199592510581609497792,654912925345906164630,2143351392041147447880,6997411897546099021020,22791570180578722525608,74072603086880848208226,240235469470964913107760,777604282761281166111960,2512259990459523767438640,8102038469231964149989614,26084611657039494336551928,83843394611912660367488340,269078801312649933272404440,862275249660991831622932410,2759280798915173861193383712,8817701683489794730335378384,28141601117520621479793760800,89701353562096980966842612550,285579819503818959812805052200,908143826022144292204720065996,2884692153246811281120875503752,9153350101648535795864316502290,29014392775036868183117078724240,91878910454283415913204082626760,290671462164460261252682006855568,918729442912669040030798485954206,2901250872355796968518311008276440,9153946717950186986876739905423940,28858204907436182704391078345912760,90903345458423975518831896789625194,286122005377334480321569248911607168,899899855622261671979129089318764480
add $0,2
mov $1,3
pow $1,$0
bin $0,3
mul $0,$1
div $0,27
mul $0,54
| 132 | 1,350 | 0.92011 |
56d391b898da0c1e8c0b6081d0041a3937ec7459 | 1,988 | ts | TypeScript | packages/eventbus/src/bus/AbstractPseudoObject.ts | allgemein-node/eventbus | a7365b3c9e150f659782e7146db72e11a9e6391b | [
"MIT"
] | null | null | null | packages/eventbus/src/bus/AbstractPseudoObject.ts | allgemein-node/eventbus | a7365b3c9e150f659782e7146db72e11a9e6391b | [
"MIT"
] | null | null | null | packages/eventbus/src/bus/AbstractPseudoObject.ts | allgemein-node/eventbus | a7365b3c9e150f659782e7146db72e11a9e6391b | [
"MIT"
] | null | null | null | import {IPseudoObject} from './IPseudoObject';
import {IEventBusAdapter} from '../adapter/IEventBusAdapter';
import {CryptUtils} from '@allgemein/base';
import {clearTimeout, setTimeout} from 'timers';
export abstract class AbstractPseudoObject<T extends IEventBusAdapter> implements IPseudoObject {
eventID: string;
uuid: string;
object: any;
adapter: T;
error: Error = null;
result: any = null;
timer: any = null;
resolve: Function;
reject: Function;
constructor(adapter: T, eventID: string, object: any) {
this.uuid = CryptUtils.shorthash(Date.now() + '');
this.eventID = eventID;
this.object = object;
this.adapter = adapter;
this.adapter.getEmitter().once(this.listenerEventName(), this.onDone.bind(this));
}
onDone(err: Error, res: any) {
if (this.resolve || this.reject) {
if (err) {
this.reject(err);
} else {
this.resolve(res);
}
} else {
this.result = res;
this.error = err;
}
this.reset();
}
waitForResult(ttl: number = 10000): Promise<any> {
return new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
if (ttl > 0) {
this.timer = setTimeout(() => {
this.reset();
reject(new Error('ttl ' + ttl + ' passed'));
}, ttl);
}
if (this.result) {
this.reset();
resolve(this.result);
} else if (this.error) {
this.reset();
reject(this.error);
} else if (ttl === 0) {
this.reset();
resolve(null);
}
});
}
listenerEventName(type: string = 'done') {
return [this.eventID, this.uuid, type].join('_');
}
reset() {
if (this.adapter) {
const emitter = this.adapter.getEmitter();
emitter.removeAllListeners(this.listenerEventName());
}
clearTimeout(this.timer);
this.object = null;
this.adapter = null;
this.reject = null;
this.resolve = null;
}
}
| 23.116279 | 97 | 0.588028 |
9c7d520b51d6cd4b4c4b7b2f1e8c9024f317e5ea | 875 | js | JavaScript | src/utils/contentUserFind.js | trywesley/desposito | 773988a4540115d35bcbfc5d68a114f95198e0d5 | [
"MIT"
] | 9 | 2020-10-27T04:19:22.000Z | 2021-03-13T18:51:08.000Z | src/utils/contentUserFind.js | Druzinhu/desposito | 4d2df70c0380cbfad5bf3bb02ea616211c3c1505 | [
"MIT"
] | null | null | null | src/utils/contentUserFind.js | Druzinhu/desposito | 4d2df70c0380cbfad5bf3bb02ea616211c3c1505 | [
"MIT"
] | 3 | 2021-01-28T16:24:20.000Z | 2021-03-13T18:59:35.000Z | module.exports = function userMentionResolve(message, desposito, options) {
options.self = options.self ? options.self : true
options.size = options.size ? options.size : 1
options.duplicated = options.duplicated ? options.duplicated : false
const usersArray = message.arguments.slice(0, options.size)
.map(id => id.replace(/[<!@>]/g, ""))
.map(id => desposito.users.cache.get(id))
.filter(value => value)
if(usersArray.length < options.size) {
usersArray.push(message.author)
}
const hasSelfMention = usersArray.some(u => u.id === message.author.id)
if(usersArray.length < options.size) {
return null
} else if(new Set(usersArray).size !== usersArray.length) {
if(!options.duplicated) return null
} else if(hasSelfMention) {
if(!options.self) return null
}
return usersArray
}
| 32.407407 | 75 | 0.656 |
2a34c7b46746c472baab2700eb2a9978d7cefe55 | 2,810 | java | Java | protobuf-nano/src/main/java/io/grpc/protobuf/nano/NanoUtils.java | dmvk/grpc-java | 8f51c2731929ac104706f3f33f689c1cc2e4cd8d | [
"Apache-2.0"
] | 4 | 2019-07-21T15:14:52.000Z | 2021-03-02T10:10:02.000Z | protobuf-nano/src/main/java/io/grpc/protobuf/nano/NanoUtils.java | dmvk/grpc-java | 8f51c2731929ac104706f3f33f689c1cc2e4cd8d | [
"Apache-2.0"
] | null | null | null | protobuf-nano/src/main/java/io/grpc/protobuf/nano/NanoUtils.java | dmvk/grpc-java | 8f51c2731929ac104706f3f33f689c1cc2e4cd8d | [
"Apache-2.0"
] | 5 | 2019-12-10T03:57:49.000Z | 2022-01-11T13:29:28.000Z | /*
* Copyright 2014 The gRPC Authors
*
* 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 io.grpc.protobuf.nano;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.protobuf.nano.CodedInputByteBufferNano;
import com.google.protobuf.nano.MessageNano;
import io.grpc.MethodDescriptor.Marshaller;
import io.grpc.Status;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* Utility methods for using nano proto with grpc.
*/
public class NanoUtils {
private static final int BUF_SIZE = 8192;
private NanoUtils() {}
/** Adapt {@code parser} to a {@code Marshaller}. */
public static <T extends MessageNano> Marshaller<T> marshaller(
final MessageNanoFactory<T> factory) {
return new Marshaller<T>() {
@Override
public InputStream stream(T value) {
return new NanoProtoInputStream(value);
}
@Override
public T parse(InputStream stream) {
try {
// TODO(simonma): Investigate whether we can do 0-copy here.
CodedInputByteBufferNano input =
CodedInputByteBufferNano.newInstance(toByteArray(stream));
input.setSizeLimit(Integer.MAX_VALUE);
T message = factory.newInstance();
message.mergeFrom(input);
return message;
} catch (IOException ipbe) {
throw Status.INTERNAL.withDescription("Failed parsing nano proto message").withCause(ipbe)
.asRuntimeException();
}
}
};
}
// Copied from guava com.google.common.io.ByteStreams because its API is unstable (beta)
private static byte[] toByteArray(InputStream in) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
copy(in, out);
return out.toByteArray();
}
// Copied from guava com.google.common.io.ByteStreams because its API is unstable (beta)
private static long copy(InputStream from, OutputStream to) throws IOException {
checkNotNull(from);
checkNotNull(to);
byte[] buf = new byte[BUF_SIZE];
long total = 0;
while (true) {
int r = from.read(buf);
if (r == -1) {
break;
}
to.write(buf, 0, r);
total += r;
}
return total;
}
}
| 31.222222 | 100 | 0.685053 |
74c5ced2eff484afa589260648e5eeb356312db7 | 2,765 | js | JavaScript | unpackage/dist/build/h5/static/js/pages-API-on-compass-change-on-compass-change.b87a1a33.js | 401610933/myGame | d907b0ba3a4c20790093e92269cbab4bc26853b4 | [
"MIT"
] | null | null | null | unpackage/dist/build/h5/static/js/pages-API-on-compass-change-on-compass-change.b87a1a33.js | 401610933/myGame | d907b0ba3a4c20790093e92269cbab4bc26853b4 | [
"MIT"
] | null | null | null | unpackage/dist/build/h5/static/js/pages-API-on-compass-change-on-compass-change.b87a1a33.js | 401610933/myGame | d907b0ba3a4c20790093e92269cbab4bc26853b4 | [
"MIT"
] | null | null | null | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-API-on-compass-change-on-compass-change"],{"078b":function(t,e,i){var n=i("d724");"string"===typeof n&&(n=[[t.i,n,""]]),n.locals&&(t.exports=n.locals);var a=i("4f06").default;a("62239123",n,!0,{sourceMap:!1,shadowMode:!1})},3569:function(t,e,i){"use strict";i.r(e);var n=i("3deb"),a=i.n(n);for(var o in n)"default"!==o&&function(t){i.d(e,t,(function(){return n[t]}))}(o);e["default"]=a.a},"3deb":function(t,e,i){"use strict";i("e25e"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n={data:function(){return{title:"onCompassChange",direction:0}},onReady:function(){var t=this;uni.onCompassChange((function(e){t.direction=parseInt(e.direction)}))},onUnload:function(){uni.stopCompass(),this.direction=0}};e.default=n},a308:function(t,e,i){"use strict";i.r(e);var n=i("c765"),a=i("3569");for(var o in a)"default"!==o&&function(t){i.d(e,t,(function(){return a[t]}))}(o);i("dc1c");var s,c=i("f0c5"),r=Object(c["a"])(a["default"],n["b"],n["c"],!1,null,"1ce940f3",null,!1,n["a"],s);e["default"]=r.exports},c765:function(t,e,i){"use strict";i.d(e,"b",(function(){return a})),i.d(e,"c",(function(){return o})),i.d(e,"a",(function(){return n}));var n={pageHead:i("60de").default},a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("v-uni-view",[n("page-head",{attrs:{title:t.title}}),n("v-uni-view",{staticClass:"uni-padding-wrap"},[n("v-uni-view",{staticClass:"uni-hello-text uni-center",staticStyle:{"padding-bottom":"50rpx"}},[t._v("旋转手机即可获取方位信息")]),n("v-uni-view",{staticClass:"direction"},[n("v-uni-view",{staticClass:"bg-compass-line"}),n("v-uni-image",{staticClass:"bg-compass",style:"transform: rotate("+t.direction+"deg)",attrs:{src:i("ccac")}}),n("v-uni-view",{staticClass:"direction-value"},[n("v-uni-text",[t._v(t._s(t.direction))]),n("v-uni-text",{staticClass:"direction-degree"},[t._v("o")])],1)],1)],1)],1)},o=[]},ccac:function(t,e,i){t.exports=i.p+"static/img/compass.acb5847f.png"},d724:function(t,e,i){var n=i("24fb");e=n(!1),e.push([t.i,".direction[data-v-1ce940f3]{position:relative;margin-top:%?70?%;display:flex;width:%?540?%;height:%?540?%;align-items:center;justify-content:center;margin:0 auto}.direction-value[data-v-1ce940f3]{position:relative;font-size:%?200?%;color:#353535;line-height:1;z-index:1}.direction-degree[data-v-1ce940f3]{position:absolute;top:0;right:%?-40?%;font-size:%?60?%}.bg-compass[data-v-1ce940f3]{position:absolute;top:0;left:0;width:%?540?%;height:%?540?%;transition:.1s}.bg-compass-line[data-v-1ce940f3]{position:absolute;left:%?267?%;top:%?-10?%;width:%?6?%;height:%?56?%;background-color:#1aad19;border-radius:%?999?%;z-index:1}",""]),t.exports=e},dc1c:function(t,e,i){"use strict";var n=i("078b"),a=i.n(n);a.a}}]); | 2,765 | 2,765 | 0.669801 |
5e0a0e30fb16605f85c4d9ecf5b2f70e04cbc638 | 494 | sql | SQL | CleanInformation.sql | Loptt/northwind-dw | e08db6caddb619169a2cc14ba09439fdf878a279 | [
"MIT"
] | null | null | null | CleanInformation.sql | Loptt/northwind-dw | e08db6caddb619169a2cc14ba09439fdf878a279 | [
"MIT"
] | null | null | null | CleanInformation.sql | Loptt/northwind-dw | e08db6caddb619169a2cc14ba09439fdf878a279 | [
"MIT"
] | null | null | null |
SELECT DISTINCT Country
from Lab0_NorthwindDB.dbo.Suppliers
UNION
SELECT Country
from Lab0_NorthwindDB.dbo.Employees
UNION
SELECT DISTINCT ShipCountry
from Lab0_NorthwindDB.dbo.Orders
SELECT c.CustomerID
FROM Lab0_NorthwindDB.dbo.Customers c
select p.productId, p.productName, p.categoryName
from DWNorthwind.dbo.DimProduct p
SELECT c.City, c.Country, c.CustomerID, c.CustomerName, c.Region
from DWNorthwind.dbo.DimCustomer c
SELECT *
FROM DWNorthwind.dbo.FactSales | 23.52381 | 64 | 0.799595 |
d287909064b3b501bc8e398b6aea1e59c5b72005 | 407 | php | PHP | editar_perfil.php | firminoandre/lab_laudos | c6254afd7a3335c4ba13693abfbe06414ec20b52 | [
"MIT"
] | 1 | 2021-09-03T18:05:58.000Z | 2021-09-03T18:05:58.000Z | editar_perfil.php | firminoandre/lab_laudos | c6254afd7a3335c4ba13693abfbe06414ec20b52 | [
"MIT"
] | null | null | null | editar_perfil.php | firminoandre/lab_laudos | c6254afd7a3335c4ba13693abfbe06414ec20b52 | [
"MIT"
] | null | null | null | <?php
include 'conexaoBD.php';
require 'verificacao.php';
$nome = addslashes($_POST['nome']);
$cpf = addslashes($_POST['cpf']);
$email = addslashes($_POST['email']);
$especialidade = (addslashes($_POST['especialidade']));
$pdo->query("UPDATE medicos SET nome='$nome', cpf='$cpf', email='$email', especialidade='$especialidade' WHERE idmedico = $idDoMedico");
header("Location: editarPerfil.php");
?> | 25.4375 | 136 | 0.685504 |
5115fda95825e25c4d3a53f8d6b0a0c227fd6d9f | 749 | h | C | PrivateFrameworks/Install/IFRequirementsEvaluatorResult.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 17 | 2018-11-13T04:02:58.000Z | 2022-01-20T09:27:13.000Z | PrivateFrameworks/Install/IFRequirementsEvaluatorResult.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 3 | 2018-04-06T02:02:27.000Z | 2018-10-02T01:12:10.000Z | PrivateFrameworks/Install/IFRequirementsEvaluatorResult.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 1 | 2018-09-28T13:54:23.000Z | 2018-09-28T13:54:23.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
@class NSArray, NSString;
@interface IFRequirementsEvaluatorResult : NSObject
{
BOOL _shouldContinue;
BOOL _shouldSkip;
NSArray *_errorDeps;
NSString *_title;
NSString *_message;
id _reference;
}
- (id)reference;
- (void)setMessage:(id)arg1;
- (void)setTitle:(id)arg1;
- (id)message;
- (id)title;
- (id)reason;
- (id)errorRequirements;
- (void)setShouldContinue:(BOOL)arg1;
- (BOOL)shouldSkip;
- (BOOL)shouldContinue;
- (id)description;
- (void)dealloc;
- (id)initWithShouldContinue:(BOOL)arg1 shouldSkip:(BOOL)arg2 errorDeps:(id)arg3 reference:(id)arg4;
@end
| 20.243243 | 100 | 0.692924 |
6472663eaca52d79b95db07949a5a5020e82f64c | 1,988 | swift | Swift | Sources/Exhibition/Utilities/View+Modify.swift | mjarvis/Exhibition | 742c7a48e12506a36a6c62ff267052aaa417ac56 | [
"MIT"
] | 17 | 2022-02-10T19:47:00.000Z | 2022-03-12T11:47:25.000Z | Sources/Exhibition/Utilities/View+Modify.swift | mjarvis/Exhibition | 742c7a48e12506a36a6c62ff267052aaa417ac56 | [
"MIT"
] | 45 | 2022-02-10T19:29:48.000Z | 2022-03-14T16:28:48.000Z | Sources/Exhibition/Utilities/View+Modify.swift | mjarvis/Exhibition | 742c7a48e12506a36a6c62ff267052aaa417ac56 | [
"MIT"
] | null | null | null | import SwiftUI
/// Helpers for conditionally applying modifiers
extension View {
/// Modify the current view with some given block. Useful for applying compiler conditional modifiers.
///
/// Example:
///
/// Rectangle().modify {
/// #if os(iOS)
/// $0.fill(Color.red)
/// #else
/// $0.fill(Color.blue)
/// #endif
/// }
///
/// - Returns: A modified view
func modify<Output: View>(
@ViewBuilder _ block: (Self) -> Output
) -> some View {
block(self)
}
/// Conditionally apply modifiers to a given view
///
/// See `ifLet` for version that takes an optional.
///
/// - Parameters:
/// - condition: Condition returning true/false for execution of the following blocks
/// - then: If condition is true, apply modifiers here.
/// - else: If condition is false, apply modifiers here.
/// - Returns: Self with modifiers applied accordingly.
@ViewBuilder public func `if`<Then: View, Else: View>(
_ condition: @autoclosure () -> Bool,
@ViewBuilder then: (Self) -> Then,
@ViewBuilder else: (Self) -> Else
) -> some View {
if condition() {
then(self)
} else {
`else`(self)
}
}
/// Conditionally apply modifiers to a given view
///
/// See `ifLet` for version that takes an optional.
///
/// - Parameters:
/// - condition: Condition returning true/false for execution of the following blocks
/// - then: If condition is true, apply modifiers here.
/// - Returns: Self with modifiers applied, or unchanged self if condition was false
@ViewBuilder public func `if`<Then: View>(
_ condition: @autoclosure () -> Bool,
@ViewBuilder then: (Self) -> Then
) -> some View {
if condition() {
then(self)
} else {
self
}
}
}
| 30.584615 | 106 | 0.550302 |
7424021f176fc9972476931088cdedf30872ec80 | 1,493 | kt | Kotlin | app/src/main/java/com/jaimegc/constraintlayouts/MainActivity.kt | jaimegc/ConstraintLayoutsAnimations | c32bb94a0080ba1e2be40bbd77e555e61db8aa1a | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/jaimegc/constraintlayouts/MainActivity.kt | jaimegc/ConstraintLayoutsAnimations | c32bb94a0080ba1e2be40bbd77e555e61db8aa1a | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/jaimegc/constraintlayouts/MainActivity.kt | jaimegc/ConstraintLayoutsAnimations | c32bb94a0080ba1e2be40bbd77e555e61db8aa1a | [
"Apache-2.0"
] | null | null | null | package com.jaimegc.constraintlayouts
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
fun onClickButton(view: View) {
var intent: Intent? = null
when(view.id) {
R.id.cats -> intent = Intent(this, CatsLandscapeActivity::class.java)
R.id.profile -> intent = Intent(this, ProfileActivity::class.java)
R.id.aspect_ratio -> intent = Intent(this, AspectRatioActivity::class.java)
R.id.profile_transition_same -> intent = Intent(this, OtherSameActivity::class.java)
R.id.profile_transition_different -> intent = Intent(this, OtherActivity::class.java)
R.id.exchange -> intent = Intent(this, AnimationCodingInFlowActivity::class.java)
R.id.collapse_expand -> intent = Intent(this, AnimationCodingInFlowCollapseExpandActivity::class.java)
R.id.lottie -> intent = Intent(this, LottieActivity::class.java)
R.id.physics_based -> intent = Intent(this, PhysicsBasedActivity::class.java)
R.id.collapse_expand_other -> intent = Intent(this, AnimationCodingInFlowCollapseExpandOtherActivity::class.java)
}
intent?.let {
startActivity(intent)
}
}
}
| 41.472222 | 125 | 0.685867 |
168e90b16bcf58698efcbbf6d8f9c510c98c0ca6 | 485 | ts | TypeScript | src/api/programs.ts | sophiemoustard/alenvi-mobile | 88fc1aa8c9cfa8a0e6d33ebe7f7c7157a5188a80 | [
"MIT"
] | null | null | null | src/api/programs.ts | sophiemoustard/alenvi-mobile | 88fc1aa8c9cfa8a0e6d33ebe7f7c7157a5188a80 | [
"MIT"
] | 41 | 2020-06-04T06:11:14.000Z | 2021-07-23T15:38:56.000Z | src/api/programs.ts | sophiemoustard/alenvi-mobile | 88fc1aa8c9cfa8a0e6d33ebe7f7c7157a5188a80 | [
"MIT"
] | null | null | null | import axiosLogged from './axios/logged';
import Environment from '../../environment';
import { ProgramType } from '../types/CourseTypes';
type ElearningProgramType = ProgramType & { categories: { name: string }[] };
export default {
getELearningPrograms: async (): Promise<ElearningProgramType[]> => {
const baseURL = await Environment.getBaseUrl();
const response = await axiosLogged.get(`${baseURL}/programs/e-learning`);
return response.data.data.programs;
},
};
| 34.642857 | 77 | 0.71134 |
996c43a1b00fef61ffbc8ccedba682d727f835ee | 324 | swift | Swift | SWGradient/SWGradient/ViewController.swift | cellgit/SWGradient | 76e160f276ed9fc1be3ee58630c6baf62575d5be | [
"MIT"
] | 1 | 2019-09-12T05:30:31.000Z | 2019-09-12T05:30:31.000Z | SWGradient/SWGradient/ViewController.swift | cellgit/SWGradient | 76e160f276ed9fc1be3ee58630c6baf62575d5be | [
"MIT"
] | null | null | null | SWGradient/SWGradient/ViewController.swift | cellgit/SWGradient | 76e160f276ed9fc1be3ee58630c6baf62575d5be | [
"MIT"
] | null | null | null | //
// ViewController.swift
// SWGradient
//
// Created by Alan on 2019/9/9.
// Copyright © 2019 liuhongli. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
| 15.428571 | 58 | 0.657407 |
61afdbf5708fa8281eb5fa14afc6bf4b1bce05dc | 270 | swift | Swift | HaveFunWithRealm/Other/Strings.swift | shndrs/Realmbustion | ab5cc16d1ed1466a91117ff2bbc2321a4db868eb | [
"BSL-1.0"
] | 2 | 2019-01-20T22:43:52.000Z | 2020-07-14T06:13:53.000Z | HaveFunWithRealm/Other/Strings.swift | shndrs/HaveFunWithRealm | ab5cc16d1ed1466a91117ff2bbc2321a4db868eb | [
"BSL-1.0"
] | null | null | null | HaveFunWithRealm/Other/Strings.swift | shndrs/HaveFunWithRealm | ab5cc16d1ed1466a91117ff2bbc2321a4db868eb | [
"BSL-1.0"
] | null | null | null | //
// Strings.swift
// HaveFunWithRealm
//
// Created by NP2 on 6/27/20.
// Copyright © 2020 Sahand Raeisi. All rights reserved.
//
import Foundation
enum Strings: String {
case updateError = "DBError: 'newItem' must has a value for update action"
}
| 16.875 | 78 | 0.662963 |
de1197048195c1836a9c1fef3880fe926efd02f2 | 1,599 | rs | Rust | parsemath/src/parsemath/tokenizer.rs | ValeryPiashchynski/rust_playground | 24b471710f1ccd191c91ba5d41450a426e3974c8 | [
"MIT"
] | null | null | null | parsemath/src/parsemath/tokenizer.rs | ValeryPiashchynski/rust_playground | 24b471710f1ccd191c91ba5d41450a426e3974c8 | [
"MIT"
] | 1 | 2020-12-06T20:53:50.000Z | 2020-12-13T16:31:07.000Z | parsemath/src/parsemath/tokenizer.rs | rustatian/rust_playground | 6168d9caf1bbfbf3cfebf907a633ddd8f2886056 | [
"MIT"
] | null | null | null | use crate::parsemath::token::Token;
use std::iter::Peekable;
use std::str::Chars;
pub struct Tokenizer<'a> {
// peekable iterator over the string
expr: Peekable<Chars<'a>>,
}
impl<'a> Tokenizer<'a> {
// creates a new tokenizer using the arithmetic expression provided by the user
pub fn new(new_expr: &'a str) -> Self {
Tokenizer {
expr: new_expr.chars().peekable(),
}
}
}
impl<'a> Iterator for Tokenizer<'a> {
type Item = Token;
fn next(&mut self) -> Option<Token> {
let next_char = self.expr.next();
match next_char {
Some('0'..='9') => {
let mut number = next_char?.to_string();
while let Some(next_char) = self.expr.peek() {
if next_char.is_numeric() || next_char == &'.' {
number.push(self.expr.next()?);
} else if next_char == &'(' {
return None;
} else {
break;
}
}
Some(Token::Num(number.parse::<f64>().unwrap()))
}
Some('+') => Some(Token::Add),
Some('-') => Some(Token::Subtract),
Some('*') => Some(Token::Multiply),
Some('/') => Some(Token::Divide),
Some('^') => Some(Token::Caret),
Some('(') => Some(Token::LeftParen),
Some(')') => Some(Token::RightParen),
None => Some(Token::EOF),
Some('_') => None,
_ => panic!("unknown token"),
}
}
}
| 30.75 | 83 | 0.459037 |
9aac197f8a6fe322ad71ff9a775223a771148b33 | 844 | css | CSS | style.css | kim4am/FlexBox | 93d0553717bead9e28935cf290f27e0aad5fb487 | [
"MIT"
] | null | null | null | style.css | kim4am/FlexBox | 93d0553717bead9e28935cf290f27e0aad5fb487 | [
"MIT"
] | null | null | null | style.css | kim4am/FlexBox | 93d0553717bead9e28935cf290f27e0aad5fb487 | [
"MIT"
] | null | null | null | body {
background-color: rgb(226, 209, 255);
}
.d-flex {
display: flex;
}
.child {
background-color: rgb(255, 39, 86);
color: rgb(255, 255, 255);
border: 3px solid rgb(29, 21, 21);
padding: 10px;
font-size: 35px;
}
h2 {
font-style: italic;
color: rgb(44, 0, 126);
font-size: 30px;
margin-left: 10px;
}
.f-direction-column {
flex-direction: column;
}
.f-direction-column-reverse {
flex-direction: column-reverse;
}
.f-direction-row-reverse {
flex-direction: row-reverse;
}
.j-content-center {
justify-content: center;
}
.j-content-flex-start {
justify-content: flex-start;
}
.j-content-flex-end {
justify-content: flex-end;
}
.j-content-space-around {
justify-content: space-around;
}
.j-content-space-between {
justify-content: space-between;
}
.j-content-space-evenly {
justify-content: space-evenly;
}
| 17.957447 | 39 | 0.672986 |
ad0d325c40ce3de59da2bed4b487fdfbb807a0d1 | 5,327 | rs | Rust | examples/vendored/complicated_cargo_library/cargo/vendor/syn-0.11.11/src/constant.rs | tommilligan/cargo-raze | b20c29f8f6a0902a7aadf5424dd830cd045ac92d | [
"Apache-2.0"
] | 5 | 2019-12-04T11:29:04.000Z | 2021-11-18T14:23:55.000Z | examples/vendored/complicated_cargo_library/cargo/vendor/syn-0.11.11/src/constant.rs | tommilligan/cargo-raze | b20c29f8f6a0902a7aadf5424dd830cd045ac92d | [
"Apache-2.0"
] | 6 | 2017-09-13T00:53:42.000Z | 2019-05-01T01:00:52.000Z | examples/vendored/complicated_cargo_library/cargo/vendor/syn-0.11.11/src/constant.rs | tommilligan/cargo-raze | b20c29f8f6a0902a7aadf5424dd830cd045ac92d | [
"Apache-2.0"
] | 18 | 2019-07-15T23:10:12.000Z | 2021-07-26T02:28:55.000Z | use super::*;
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub enum ConstExpr {
/// A function call
///
/// The first field resolves to the function itself,
/// and the second field is the list of arguments
Call(Box<ConstExpr>, Vec<ConstExpr>),
/// A binary operation (For example: `a + b`, `a * b`)
Binary(BinOp, Box<ConstExpr>, Box<ConstExpr>),
/// A unary operation (For example: `!x`, `*x`)
Unary(UnOp, Box<ConstExpr>),
/// A literal (For example: `1`, `"foo"`)
Lit(Lit),
/// A cast (`foo as f64`)
Cast(Box<ConstExpr>, Box<Ty>),
/// Variable reference, possibly containing `::` and/or type
/// parameters, e.g. foo::bar::<baz>.
Path(Path),
/// An indexing operation (`foo[2]`)
Index(Box<ConstExpr>, Box<ConstExpr>),
/// No-op: used solely so we can pretty-print faithfully
Paren(Box<ConstExpr>),
/// If compiling with full support for expression syntax, any expression is
/// allowed
Other(Other),
}
#[cfg(not(feature = "full"))]
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct Other {
_private: (),
}
#[cfg(feature = "full")]
pub type Other = Expr;
#[cfg(feature = "parsing")]
pub mod parsing {
use super::*;
use {BinOp, Ty};
use lit::parsing::lit;
use op::parsing::{binop, unop};
use ty::parsing::{path, ty};
named!(pub const_expr -> ConstExpr, do_parse!(
mut e: alt!(
expr_unary
|
expr_lit
|
expr_path
|
expr_paren
// Cannot handle ConstExpr::Other here because for example
// `[u32; n!()]` would end up successfully parsing `n` as
// ConstExpr::Path and then fail to parse `!()`. Instead, callers
// are required to handle Other. See ty::parsing::array_len and
// data::parsing::discriminant.
) >>
many0!(alt!(
tap!(args: and_call => {
e = ConstExpr::Call(Box::new(e), args);
})
|
tap!(more: and_binary => {
let (op, other) = more;
e = ConstExpr::Binary(op, Box::new(e), Box::new(other));
})
|
tap!(ty: and_cast => {
e = ConstExpr::Cast(Box::new(e), Box::new(ty));
})
|
tap!(i: and_index => {
e = ConstExpr::Index(Box::new(e), Box::new(i));
})
)) >>
(e)
));
named!(and_call -> Vec<ConstExpr>, do_parse!(
punct!("(") >>
args: terminated_list!(punct!(","), const_expr) >>
punct!(")") >>
(args)
));
named!(and_binary -> (BinOp, ConstExpr), tuple!(binop, const_expr));
named!(expr_unary -> ConstExpr, do_parse!(
operator: unop >>
operand: const_expr >>
(ConstExpr::Unary(operator, Box::new(operand)))
));
named!(expr_lit -> ConstExpr, map!(lit, ConstExpr::Lit));
named!(expr_path -> ConstExpr, map!(path, ConstExpr::Path));
named!(and_index -> ConstExpr, delimited!(punct!("["), const_expr, punct!("]")));
named!(expr_paren -> ConstExpr, do_parse!(
punct!("(") >>
e: const_expr >>
punct!(")") >>
(ConstExpr::Paren(Box::new(e)))
));
named!(and_cast -> Ty, do_parse!(
keyword!("as") >>
ty: ty >>
(ty)
));
}
#[cfg(feature = "printing")]
mod printing {
use super::*;
use quote::{Tokens, ToTokens};
impl ToTokens for ConstExpr {
fn to_tokens(&self, tokens: &mut Tokens) {
match *self {
ConstExpr::Call(ref func, ref args) => {
func.to_tokens(tokens);
tokens.append("(");
tokens.append_separated(args, ",");
tokens.append(")");
}
ConstExpr::Binary(op, ref left, ref right) => {
left.to_tokens(tokens);
op.to_tokens(tokens);
right.to_tokens(tokens);
}
ConstExpr::Unary(op, ref expr) => {
op.to_tokens(tokens);
expr.to_tokens(tokens);
}
ConstExpr::Lit(ref lit) => lit.to_tokens(tokens),
ConstExpr::Cast(ref expr, ref ty) => {
expr.to_tokens(tokens);
tokens.append("as");
ty.to_tokens(tokens);
}
ConstExpr::Path(ref path) => path.to_tokens(tokens),
ConstExpr::Index(ref expr, ref index) => {
expr.to_tokens(tokens);
tokens.append("[");
index.to_tokens(tokens);
tokens.append("]");
}
ConstExpr::Paren(ref expr) => {
tokens.append("(");
expr.to_tokens(tokens);
tokens.append(")");
}
ConstExpr::Other(ref other) => {
other.to_tokens(tokens);
}
}
}
}
#[cfg(not(feature = "full"))]
impl ToTokens for Other {
fn to_tokens(&self, _tokens: &mut Tokens) {
unreachable!()
}
}
}
| 29.430939 | 85 | 0.479632 |
72ec4fb5c87686d3b0f0246a521b88744597bc48 | 816 | html | HTML | test_vue/ej6.html | satoblacksato/capacitacionintg | f6498357477266b8bf2bd2e851ec98cc3eba0a69 | [
"MIT"
] | null | null | null | test_vue/ej6.html | satoblacksato/capacitacionintg | f6498357477266b8bf2bd2e851ec98cc3eba0a69 | [
"MIT"
] | 5 | 2021-03-09T19:10:23.000Z | 2022-02-26T18:20:16.000Z | test_vue/ej6.html | satoblacksato/capacitacionintg | f6498357477266b8bf2bd2e851ec98cc3eba0a69 | [
"MIT"
] | 1 | 2019-10-01T22:53:07.000Z | 2019-10-01T22:53:07.000Z | <!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.0/axios.min.js"></script>
</head>
<body>
<main>
<button @click="loadInfo" >CARGAR</button>
<ol v-if="posts">
<li v-for="(item,idx) in posts" >
{{ item.title }}
</li>
</ol>
<span v-else> ESPERANDO DATA </span>
{{ $data }}
</main>
</body>
<script type="text/javascript">
new Vue({
el:'main',
data:{
posts:null
},
methods:{
loadInfo(){
axios.get('https://jsonplaceholder.typicode.com/posts')
.then((response)=>{
this.posts=response.data;
});
}
},
mounted(){
this.loadInfo()
}
});
</script>
</html> | 18.133333 | 112 | 0.572304 |
0e4edead003f25067e5ba730e9ab82ab2489add4 | 543 | html | HTML | 404.html | lucilucency/footballx-cms | bc1730bb948df3925f58cfa10b315dd217b6ec0e | [
"MIT"
] | null | null | null | 404.html | lucilucency/footballx-cms | bc1730bb948df3925f58cfa10b315dd217b6ec0e | [
"MIT"
] | null | null | null | 404.html | lucilucency/footballx-cms | bc1730bb948df3925f58cfa10b315dd217b6ec0e | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>FootballX</title>
<meta name="explanation" content="Microsoft browsers require custom 404 pages to be at least 512 bytes in length, so this text is here as a placeholder in order to fill the necessary space to get to that number.">
<link rel="icon" type="image/png" href="/assets/images/logo.png">
<script>
window.sessionStorage.redirect = window.location.href;
window.location = '/';
</script>
</head>
<body>
</body>
</html>
| 28.578947 | 217 | 0.664825 |
0e44d7530050ae075dc81e0eb928320c729184d7 | 3,075 | kt | Kotlin | ks-mock/src/main/java/com/kingswim/mock/MockHelper.kt | KingSwim404/KingSwimMock | fba4b696d951413be7c2534b5d45d351c699fbc9 | [
"Apache-2.0"
] | 1 | 2021-09-10T03:39:18.000Z | 2021-09-10T03:39:18.000Z | ks-mock/src/main/java/com/kingswim/mock/MockHelper.kt | KingSwim404/KingSwimMock | fba4b696d951413be7c2534b5d45d351c699fbc9 | [
"Apache-2.0"
] | null | null | null | ks-mock/src/main/java/com/kingswim/mock/MockHelper.kt | KingSwim404/KingSwimMock | fba4b696d951413be7c2534b5d45d351c699fbc9 | [
"Apache-2.0"
] | 1 | 2021-09-10T03:39:20.000Z | 2021-09-10T03:39:20.000Z | package com.kingswim.mock
import android.content.Context
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import java.io.IOException
import kotlin.collections.HashMap
object MockHelper {
const val TAG = "MOCK_MODULE"
private val mockData: MutableMap<String, MutableMap<String, Any>> = HashMap()
private var openMock: Boolean = false
private var gson: Gson = Gson()
/**
* 初始化所有mock数据
* 备注:最好是在Application里面调用,提前准备好数据
* @param assetsPath 文件名或者文件夹名
* @param isFolder 是否是文件夹
*/
fun init(context: Context, assetsPath: String, isFolder: Boolean = false) {
mockData.clear()
if (isFolder) {
context.assets.list(assetsPath)?.forEach {
val parserMap = parserMockJson(context, ConvertUtils.join(assetsPath,it))
mockData.putAll(parserMap)
}
} else {
val parserMap = parserMockJson(context, assetsPath)
mockData.putAll(parserMap)
}
}
/**
* 是否打开模拟数据
*/
fun setMockMode(openMock: Boolean) {
this.openMock = openMock
}
/**
* 通过路径获取对应的模拟数据。
* @param url
* @return
*/
fun getMockData(url: String): String {
val keys: Set<String> = mockData.keys
for (key in keys) {
if (url.contains(key)) {
val result = mockData[key]
//除非手动指定为false,否则默认只要配置了模拟数据就会使用
return if ( result != null && result["mock"] != false) {
gson.toJson(result)
} else ""
}
}
return ""
}
private fun parserMockJson(
context: Context,
assetsPath: String
): MutableMap<String, MutableMap<String, Any>> {
val parserMap: MutableMap<String, MutableMap<String, Any>> = HashMap()
if (openMock && assetsPath.isNotEmpty()) {
try {
val inputStream = context.assets.open(assetsPath)
val mockData = ConvertUtils.inputStream2String(inputStream, "UTF-8")
if (mockData.isNotEmpty()) {
val type = object : TypeToken<MutableMap<String, MutableMap<String, Any>>>() {}.type
//解析文件获得的总体Json
val alLData = gson.fromJson<MutableMap<String, MutableMap<String, Any>>>(mockData, type)
for ((urlPath, value) in alLData) {
//判断 key里面是否含有多个 key.指向同一个 value
//key之间用";"分割
if (urlPath.contains(";")) {
//将key一个个取出来。赋值同样的 value
for (key in urlPath.split(";".toRegex()).toTypedArray()) {
parserMap[key] = value
}
} else {
parserMap[urlPath] = value
}
}
}
} catch (e: IOException) {
e.printStackTrace()
}
}
return parserMap
}
} | 33.423913 | 108 | 0.51935 |
1eb967383539523883a6d39f3668693253c50c5b | 418 | swift | Swift | Source/CovPassApp/Source/Scenes/Certificate Item Detail/Protocols/CertificateItemDetailViewModelProtocol.swift | southarsch/covpass-ios | ece6dbf95ab5f71920d561be4709118384127de3 | [
"Apache-2.0"
] | null | null | null | Source/CovPassApp/Source/Scenes/Certificate Item Detail/Protocols/CertificateItemDetailViewModelProtocol.swift | southarsch/covpass-ios | ece6dbf95ab5f71920d561be4709118384127de3 | [
"Apache-2.0"
] | null | null | null | Source/CovPassApp/Source/Scenes/Certificate Item Detail/Protocols/CertificateItemDetailViewModelProtocol.swift | southarsch/covpass-ios | ece6dbf95ab5f71920d561be4709118384127de3 | [
"Apache-2.0"
] | null | null | null | //
// CertificateItemDetailViewModelProtocol.swift
//
//
// © Copyright IBM Deutschland GmbH 2021
// SPDX-License-Identifier: Apache-2.0
//
import CovPassUI
import UIKit
protocol CertificateItemDetailViewModelProtocol {
var title: String { get }
var showSubtitle: Bool { get }
var headline: String { get }
var items: [(String, String)] { get }
func showQRCode()
func deleteCertificate()
}
| 20.9 | 49 | 0.698565 |
45271a2dcda8123130d2b8a8de38e3eba2fba68c | 3,173 | swift | Swift | Sources/servermodel/LoginTokenDAO.swift | rc2server/appserver | 1bc4b4e7868b056eef30adece3878e2b80e4511c | [
"0BSD"
] | null | null | null | Sources/servermodel/LoginTokenDAO.swift | rc2server/appserver | 1bc4b4e7868b056eef30adece3878e2b80e4511c | [
"0BSD"
] | 3 | 2016-12-06T19:24:48.000Z | 2018-01-28T15:28:26.000Z | Sources/servermodel/LoginTokenDAO.swift | rc2server/appserver | 1bc4b4e7868b056eef30adece3878e2b80e4511c | [
"0BSD"
] | null | null | null | //
// LoginTokenDAO.swift
//
// Copyright ©2017 Mark Lilback. This file is licensed under the ISC license.
//
import Foundation
import pgswift
import Rc2Model
import Logging
import SwiftJWT
/// Simple wrapper around contents stored in the authentication token
public struct LoginToken: Codable, Claims {
public let id: Int
public let userId: Int
public init?(_ dict: [String: Any]) {
guard let inId = dict["token"] as? Int, let inUser = dict["user"] as? Int else { return nil }
id = inId
userId = inUser
}
public init(_ inId: Int, _ inUser: Int) {
id = inId
userId = inUser
}
public var contents: [String: Any] { return ["token": id, "user": userId] }
}
/// Wrapper for database actions related to login tokens
public final class LoginTokenDAO {
private let pgdb: Connection
/// create a DAO
///
/// - Parameter connection: the database to query
public init(connection: Connection) {
pgdb = connection
}
/// create a new login token for a user
///
/// - Parameter user: the user to create a token for
/// - Returns: a new token
/// - Throws: a .dbError if the sql command fails
public func createToken(user: User) throws -> LoginToken {
do {
let result = try pgdb.execute(query: "insert into logintoken (userId) values ($1) returning id", parameters: [QueryParameter(type: .int8, value: user.id, connection: pgdb)])
guard result.wasSuccessful, result.rowCount == 1 else { throw ModelError.dbError }
guard let tokenId: Int = try result.getValue(row: 0, column: 0)
else { throw ModelError.dbError }
return LoginToken(tokenId, user.id)
} catch {
logger.error("failed to insert logintoken \(error)")
throw ModelError.dbError
}
}
/// checks the database to make sure a token is still valid
///
/// - Parameter token: the token to check
/// - Returns: true if the token is still valid
public func validate(token: LoginToken) -> Bool {
do {
let params: [QueryParameter] = [ try QueryParameter(type: .int8, value: token.id, connection: pgdb), try QueryParameter(type: .int8, value: token.userId, connection: pgdb) ]
let result = try? pgdb.execute(query: "select * from logintoken where id = $1 and userId = $2 and valid = true", parameters: params)
guard let res = result, res.wasSuccessful, res.rowCount == 1 else {
logger.info("failed to validate token for user \(token.userId)")
return false
}
return true
} catch {
logger.warning("validateLoginToken failed: \(error)")
return false
}
}
/// invalidate a token so it can't be used again
///
/// - Parameter token: the token to invalidate
/// - Throws: errors from executing sql
public func invalidate(token: LoginToken) throws {
let query = "update logintoken set valid = false where id = $1 and userId = $2"
let params: [QueryParameter] = [ try QueryParameter(type: .int8, value: token.id, connection: pgdb), try QueryParameter(type: .int8, value: token.userId, connection: pgdb) ]
let results = try pgdb.execute(query: query, parameters: params)
guard results.wasSuccessful else {
logger.warning("failed to invalidate token: \(results.errorMessage)")
throw ModelError.dbError
}
}
}
| 33.755319 | 176 | 0.695556 |
64bc3892ac7dc843aa6d07f3872a25834ef0667b | 905 | kt | Kotlin | src/main/kotlin/studio/attect/demo/test/UserController.kt | Attect/SpringBootMulitJsonAndFileExample | 17e78c2aefc483ad40c4f5079cb5e4d4c538076a | [
"MIT"
] | 1 | 2019-09-10T08:07:02.000Z | 2019-09-10T08:07:02.000Z | src/main/kotlin/studio/attect/demo/test/UserController.kt | Attect/SpringBootMulitJsonAndFileExample | 17e78c2aefc483ad40c4f5079cb5e4d4c538076a | [
"MIT"
] | null | null | null | src/main/kotlin/studio/attect/demo/test/UserController.kt | Attect/SpringBootMulitJsonAndFileExample | 17e78c2aefc483ad40c4f5079cb5e4d4c538076a | [
"MIT"
] | null | null | null | package studio.attect.demo.test
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController
import org.springframework.web.multipart.MultipartFile
import studio.attect.demo.annotation.MultiRequestJson
import studio.attect.demo.dataModel.UserLogin
import studio.attect.demo.resolver.MultiRequestParamJsonResolver
@RestController
class UserController {
private val logger: Logger = LoggerFactory.getLogger(this::class.java)
@RequestMapping("/login")
fun login(@MultiRequestJson userLogin:UserLogin,file:MultipartFile):Any?{
logger.info(userLogin.toString())
logger.info("receiveFile:${file.originalFilename}")
return null
}
} | 36.2 | 77 | 0.81105 |
b482a17d042b3be3998535f87d711bf0cb5c9bbb | 10,030 | kt | Kotlin | src/test/kotlin/ch/dissem/msgpack/ReaderTest.kt | Dissem/Simple-MsgPack | f1ecc8f767026feace976d2779287628d345cba1 | [
"Apache-2.0"
] | 1 | 2019-05-11T01:07:43.000Z | 2019-05-11T01:07:43.000Z | src/test/kotlin/ch/dissem/msgpack/ReaderTest.kt | Dissem/Simple-MsgPack | f1ecc8f767026feace976d2779287628d345cba1 | [
"Apache-2.0"
] | null | null | null | src/test/kotlin/ch/dissem/msgpack/ReaderTest.kt | Dissem/Simple-MsgPack | f1ecc8f767026feace976d2779287628d345cba1 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2017 Christian Basler
*
* 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 ch.dissem.msgpack
import ch.dissem.msgpack.types.*
import ch.dissem.msgpack.types.Utils.mp
import org.hamcrest.CoreMatchers.equalTo
import org.hamcrest.CoreMatchers.instanceOf
import org.junit.Assert.assertThat
import org.junit.Test
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.InputStream
import java.util.*
class ReaderTest {
@Test
fun `ensure demo json is parsed correctly`() {
val read = Reader.read(stream("demo.mp"))
assertThat(read, instanceOf(MPMap::class.java))
assertThat(read.toJson(), equalTo(string("demo.json")))
}
@Test
fun `ensure demo json is encoded correctly`() {
val obj = MPMap<MPString, MPType<*>>()
obj.put("compact".mp, true.mp)
obj.put("schema".mp, 0.mp)
val out = ByteArrayOutputStream()
obj.pack(out)
assertThat(out.toByteArray(), equalTo(bytes("demo.mp")))
}
@Test
fun `ensure mpArray is encoded and decoded correctly`() {
val array = MPArray(
byteArrayOf(1, 3, 3, 7).mp,
false.mp,
Math.PI.mp,
1.5f.mp,
42.mp,
MPMap<MPNil, MPNil>(),
MPNil,
"yay! \uD83E\uDD13".mp
)
val out = ByteArrayOutputStream()
array.pack(out)
val read = Reader.read(ByteArrayInputStream(out.toByteArray()))
assertThat(read, instanceOf(MPArray::class.java))
@Suppress("UNCHECKED_CAST")
assertThat(read as MPArray<MPType<*>>, equalTo(array))
assertThat(read.toJson(), equalTo("[\n AQMDBw==,\n false,\n 3.141592653589793,\n 1.5,\n 42,\n {},\n null,\n \"yay! 🤓\"\n]"))
}
@Test
fun `ensure float is encoded and decoded correctly`() {
val expected = MPFloat(1.5f)
val out = ByteArrayOutputStream()
expected.pack(out)
val read = Reader.read(ByteArrayInputStream(out.toByteArray()))
assertThat(read, instanceOf<Any>(MPFloat::class.java))
val actual = read as MPFloat
assertThat(actual, equalTo(expected))
assertThat(actual.precision, equalTo(MPFloat.Precision.FLOAT32))
}
@Test
fun `ensure double is encoded and decoded correctly`() {
val expected = MPFloat(Math.PI)
val out = ByteArrayOutputStream()
expected.pack(out)
val read = Reader.read(ByteArrayInputStream(out.toByteArray()))
assertThat(read, instanceOf<Any>(MPFloat::class.java))
val actual = read as MPFloat
assertThat(actual, equalTo(expected))
assertThat(actual.value, equalTo(Math.PI))
assertThat(actual.precision, equalTo(MPFloat.Precision.FLOAT64))
}
@Test
fun `ensure longs are encoded and decoded correctly`() {
// positive fixnum
ensureLongIsEncodedAndDecodedCorrectly(0, 1)
ensureLongIsEncodedAndDecodedCorrectly(127, 1)
// negative fixnum
ensureLongIsEncodedAndDecodedCorrectly(-1, 1)
ensureLongIsEncodedAndDecodedCorrectly(-32, 1)
// uint 8
ensureLongIsEncodedAndDecodedCorrectly(128, 2)
ensureLongIsEncodedAndDecodedCorrectly(255, 2)
// uint 16
ensureLongIsEncodedAndDecodedCorrectly(256, 3)
ensureLongIsEncodedAndDecodedCorrectly(65535, 3)
// uint 32
ensureLongIsEncodedAndDecodedCorrectly(65536, 5)
ensureLongIsEncodedAndDecodedCorrectly(4294967295L, 5)
// uint 64
ensureLongIsEncodedAndDecodedCorrectly(4294967296L, 9)
ensureLongIsEncodedAndDecodedCorrectly(java.lang.Long.MAX_VALUE, 9)
// int 8
ensureLongIsEncodedAndDecodedCorrectly(-33, 2)
ensureLongIsEncodedAndDecodedCorrectly(-128, 2)
// int 16
ensureLongIsEncodedAndDecodedCorrectly(-129, 3)
ensureLongIsEncodedAndDecodedCorrectly(-32768, 3)
// int 32
ensureLongIsEncodedAndDecodedCorrectly(-32769, 5)
ensureLongIsEncodedAndDecodedCorrectly(Integer.MIN_VALUE.toLong(), 5)
// int 64
ensureLongIsEncodedAndDecodedCorrectly(-2147483649L, 9)
ensureLongIsEncodedAndDecodedCorrectly(java.lang.Long.MIN_VALUE, 9)
}
private fun ensureLongIsEncodedAndDecodedCorrectly(`val`: Long, bytes: Int) {
val value = `val`.mp
val out = ByteArrayOutputStream()
value.pack(out)
val read = Reader.read(ByteArrayInputStream(out.toByteArray()))
assertThat(out.size(), equalTo(bytes))
assertThat(read, instanceOf<Any>(MPInteger::class.java))
assertThat(read as MPInteger, equalTo(value))
}
@Test
fun `ensure strings are encoded and decoded correctly`() {
ensureStringIsEncodedAndDecodedCorrectly(0)
ensureStringIsEncodedAndDecodedCorrectly(31)
ensureStringIsEncodedAndDecodedCorrectly(32)
ensureStringIsEncodedAndDecodedCorrectly(255)
ensureStringIsEncodedAndDecodedCorrectly(256)
ensureStringIsEncodedAndDecodedCorrectly(65535)
ensureStringIsEncodedAndDecodedCorrectly(65536)
}
@Test
fun `ensure json strings are escaped correctly`() {
val builder = StringBuilder()
var c = '\u0001'
while (c < ' ') {
builder.append(c)
c++
}
val string = MPString(builder.toString())
assertThat(string.toJson(), equalTo("\"\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\b\\t\\n\\u000b\\u000c\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f\""))
}
private fun ensureStringIsEncodedAndDecodedCorrectly(length: Int) {
val value = MPString(stringWithLength(length))
val out = ByteArrayOutputStream()
value.pack(out)
val read = Reader.read(ByteArrayInputStream(out.toByteArray()))
assertThat(read, instanceOf<Any>(MPString::class.java))
assertThat(read as MPString, equalTo(value))
}
@Test
fun `ensure binaries are encoded and decoded correctly`() {
ensureBinaryIsEncodedAndDecodedCorrectly(0)
ensureBinaryIsEncodedAndDecodedCorrectly(255)
ensureBinaryIsEncodedAndDecodedCorrectly(256)
ensureBinaryIsEncodedAndDecodedCorrectly(65535)
ensureBinaryIsEncodedAndDecodedCorrectly(65536)
}
private fun ensureBinaryIsEncodedAndDecodedCorrectly(length: Int) {
val value = MPBinary(ByteArray(length))
RANDOM.nextBytes(value.value)
val out = ByteArrayOutputStream()
value.pack(out)
val read = Reader.read(ByteArrayInputStream(out.toByteArray()))
assertThat(read, instanceOf<Any>(MPBinary::class.java))
assertThat(read as MPBinary, equalTo(value))
}
@Test
fun `ensure arrays are encoded and decoded correctly`() {
ensureArrayIsEncodedAndDecodedCorrectly(0)
ensureArrayIsEncodedAndDecodedCorrectly(15)
ensureArrayIsEncodedAndDecodedCorrectly(16)
ensureArrayIsEncodedAndDecodedCorrectly(65535)
ensureArrayIsEncodedAndDecodedCorrectly(65536)
}
private fun ensureArrayIsEncodedAndDecodedCorrectly(length: Int) {
val nil = MPNil
val list = ArrayList<MPNil>(length)
for (i in 0 until length) {
list.add(nil)
}
val value = MPArray(list)
val out = ByteArrayOutputStream()
value.pack(out)
val read = Reader.read(ByteArrayInputStream(out.toByteArray()))
assertThat(read, instanceOf(MPArray::class.java))
@Suppress("UNCHECKED_CAST")
assertThat(read as MPArray<MPNil>, equalTo(value))
}
@Test
fun `ensure maps are encoded and decoded correctly`() {
ensureMapIsEncodedAndDecodedCorrectly(0)
ensureMapIsEncodedAndDecodedCorrectly(15)
ensureMapIsEncodedAndDecodedCorrectly(16)
ensureMapIsEncodedAndDecodedCorrectly(65535)
ensureMapIsEncodedAndDecodedCorrectly(65536)
}
private fun ensureMapIsEncodedAndDecodedCorrectly(size: Int) {
val nil = MPNil
val map = HashMap<MPInteger, MPNil>(size)
for (i in 0 until size) {
map.put(i.mp, nil)
}
val value = MPMap(map)
val out = ByteArrayOutputStream()
value.pack(out)
val read = Reader.read(ByteArrayInputStream(out.toByteArray()))
assertThat(read, instanceOf<Any>(MPMap::class.java))
@Suppress("UNCHECKED_CAST")
assertThat(read as MPMap<MPInteger, MPNil>, equalTo(value))
}
private fun stringWithLength(length: Int): String {
val result = StringBuilder(length)
for (i in 0 until length) {
result.append('a')
}
return result.toString()
}
private fun stream(resource: String): InputStream {
return javaClass.classLoader.getResourceAsStream(resource)
}
private fun bytes(resource: String): ByteArray {
val `in` = stream(resource)
val out = ByteArrayOutputStream()
val buffer = ByteArray(100)
var size = `in`.read(buffer)
while (size >= 0) {
out.write(buffer, 0, size)
size = `in`.read(buffer)
}
return out.toByteArray()
}
private fun string(resource: String): String {
return String(bytes(resource))
}
companion object {
private val RANDOM = Random()
}
}
| 37.286245 | 253 | 0.659821 |
0e54423c5e0e56d983cb606b1875da2b16657911 | 1,994 | html | HTML | examples/index.html | bymerk/mediaPlayer | 4f4fb1a41a08bbe8a39faa04d190632016dabfc3 | [
"MIT"
] | null | null | null | examples/index.html | bymerk/mediaPlayer | 4f4fb1a41a08bbe8a39faa04d190632016dabfc3 | [
"MIT"
] | null | null | null | examples/index.html | bymerk/mediaPlayer | 4f4fb1a41a08bbe8a39faa04d190632016dabfc3 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript" src="../build/mediaPlayer.js"></script>
</head>
<body>
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function ()
{
mediaPlayer = new MediaPlayer('#video',
{
poster: '../media/b039c2afeeda74118f77942b2ea6332a.jpg',
// autoPlay: false,
playlist: [
{
url: '../media/image1.pngx',
type: 'image',
duration: 5
},
'http://tvbooking.ru/video/TVBooking.mp4',
{
url: '../media/b039c2afeeda74118f77942b2ea6332a.jpg',
type: 'image',
duration: 5,
},
// '../media/2fbdd09b1b72be.mp3',
'https://adbooking.ru/video/adbooking.mp4',
'http://www.w3schools.com/html/mov_bbb.mp4',
],
style: {
width: '500px',
// height: '500px',
},
controls: {
play: '.play',
pause: '.pause',
next: '.next',
prev: '.prev',
fullScreen: '.fullscreen',
mute: '.mute'
},
});
});
</script>
<div id="video"></div>
<div>
<span class="play">Играть</span>
<span class="pause">Остановить</span>
<span class="next">Следующий</span>
<span class="prev">Предыдущий</span>
<span class="fullscreen">На весь экран</span>
<span class="mute">Выключить звук</span>
</div>
</body>
</html> | 26.945946 | 84 | 0.399699 |
9d46f1d51638b76757a76e6da8871b4cda70821e | 791 | html | HTML | programacao-web/atividades/ta2-flex/lucas-concato/Exemplo de WRAP.html | guigon95/dctb-utfpr-2018-1 | 82939efafc52301b1723032a9649b933c30c5be3 | [
"Apache-2.0"
] | 24 | 2018-03-06T19:17:55.000Z | 2020-12-11T03:58:24.000Z | programacao-web/atividades/ta2-flex/lucas-concato/Exemplo de WRAP.html | guigon95/dctb-utfpr-2018-1 | 82939efafc52301b1723032a9649b933c30c5be3 | [
"Apache-2.0"
] | 56 | 2018-03-15T19:24:03.000Z | 2018-08-23T21:12:29.000Z | programacao-web/atividades/ta2-flex/lucas-concato/Exemplo de WRAP.html | guigon95/dctb-utfpr-2018-1 | 82939efafc52301b1723032a9649b933c30c5be3 | [
"Apache-2.0"
] | 375 | 2018-03-09T22:38:01.000Z | 2020-06-05T20:16:53.000Z | <!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="Style.css">
<title>Exemplo de WRAP</title>
</head>
<body>
<nav>
<section>
<div class="container menu ">
<ul>
<li>
<a href="Exemplo de algin-items.html">Exemplo de algin-items</a>
</li>
<li>
<a href="Galeria.html">Galeria</a>
</li>
<li>
<a href="Exemplo de WRAP.html">Exemplo de WRAP</a>
</li>
</ul>
</div>
</section>
</nav>
<h1>Exemplo de WRAP</h1>
<section class="container wrap">
<div class="item">ITEM 1</div>
<div class="item">ITEM 2</div>
<div class="item">ITEM 3</div>
</section>
</body>
</html>
| 20.282051 | 77 | 0.489254 |
e8a8a852e8c57cc3bc6ecac6da26574272b7e9fc | 634 | kt | Kotlin | app/src/main/java/com/habileducation/thesingers/util/jsonParser/JsonParserImpl.kt | annasta13/The_Singers | f082d4f6f8b9cebf8be81c3b7e74a5593329c8fe | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/habileducation/thesingers/util/jsonParser/JsonParserImpl.kt | annasta13/The_Singers | f082d4f6f8b9cebf8be81c3b7e74a5593329c8fe | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/habileducation/thesingers/util/jsonParser/JsonParserImpl.kt | annasta13/The_Singers | f082d4f6f8b9cebf8be81c3b7e74a5593329c8fe | [
"Apache-2.0"
] | null | null | null | package com.habileducation.thesingers.util.jsonParser
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import java.lang.reflect.Type
/**
* Created by Annas Surdyanto on 23/12/21.
*
*/
class JsonParserImpl: JsonParser {
private val moshi = Moshi.Builder().build()
override fun <T> fromJson(json: String, type: Type): T? {
val jsonAdapter: JsonAdapter<T> = moshi.adapter(type)
return jsonAdapter.fromJson(json)
}
override fun <T> toJson(obj: T, type: Type): String? {
val jsonAdapter: JsonAdapter<T> = moshi.adapter(type)
return jsonAdapter.toJson(obj)
}
} | 27.565217 | 61 | 0.692429 |
26490d592a5df7ff64367c46715a969394a8fa9b | 3,568 | java | Java | corpus/class/eclipse.jdt.ui/7065.java | masud-technope/ACER-Replication-Package-ASE2017 | cb7318a729eb1403004d451a164c851af2d81f7a | [
"MIT"
] | 15 | 2018-07-10T09:38:31.000Z | 2021-11-29T08:28:07.000Z | corpus/class/eclipse.jdt.ui/7065.java | masud-technope/ACER-Replication-Package-ASE2017 | cb7318a729eb1403004d451a164c851af2d81f7a | [
"MIT"
] | 3 | 2018-11-16T02:58:59.000Z | 2021-01-20T16:03:51.000Z | corpus/class/eclipse.jdt.ui/7065.java | masud-technope/ACER-Replication-Package-ASE2017 | cb7318a729eb1403004d451a164c851af2d81f7a | [
"MIT"
] | 6 | 2018-06-27T20:19:00.000Z | 2022-02-19T02:29:53.000Z | /*******************************************************************************
* Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.ui.tests.quickfix;
import java.util.Iterator;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.IMarkerResolutionGenerator;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
import org.eclipse.jdt.ui.JavaUI;
public class MarkerResolutionGenerator implements IMarkerResolutionGenerator {
/**
* Marker resolution that replaces the covered range with the uppercased content.
*/
public static class TestCorrectionMarkerResolution implements IMarkerResolution {
public TestCorrectionMarkerResolution() {
}
@Override
public String getLabel() {
return "Change to Uppercase";
}
@Override
public void run(IMarker marker) {
FileEditorInput input = new FileEditorInput((IFile) marker.getResource());
IAnnotationModel model = JavaUI.getDocumentProvider().getAnnotationModel(input);
if (model != null) {
// resource is open in editor
Position pos = findProblemPosition(model, marker);
if (pos != null) {
IDocument doc = JavaUI.getDocumentProvider().getDocument(input);
try {
String str = doc.get(pos.getOffset(), pos.getLength());
doc.replace(pos.getOffset(), pos.getLength(), str.toUpperCase());
} catch (BadLocationException e) {
e.printStackTrace();
}
}
} else {
// resource is not open in editor
// to do: work on the resource
}
try {
marker.delete();
} catch (CoreException e) {
e.printStackTrace();
}
}
private Position findProblemPosition(IAnnotationModel model, IMarker marker) {
Iterator<Annotation> iter = model.getAnnotationIterator();
while (iter.hasNext()) {
Object curr = iter.next();
if (curr instanceof SimpleMarkerAnnotation) {
SimpleMarkerAnnotation annot = (SimpleMarkerAnnotation) curr;
if (marker.equals(annot.getMarker())) {
return model.getPosition(annot);
}
}
}
return null;
}
}
public MarkerResolutionGenerator() {
}
@Override
public IMarkerResolution[] getResolutions(IMarker marker) {
return new IMarkerResolution[] { new TestCorrectionMarkerResolution() };
}
}
| 38.365591 | 92 | 0.597253 |
21cfcac64e3516941a980f1cbaa6adc9f5b0d3b1 | 2,391 | html | HTML | docs/_templates/sidebarintro.html | rnag/dataclass-wizard | 5bccf63daea217aff6e77fd00ed8f7bed87f0377 | [
"Apache-2.0"
] | 19 | 2021-11-05T20:29:56.000Z | 2022-03-31T02:51:25.000Z | docs/_templates/sidebarintro.html | rnag/dataclass-wizard | 5bccf63daea217aff6e77fd00ed8f7bed87f0377 | [
"Apache-2.0"
] | 6 | 2021-10-20T23:24:04.000Z | 2022-03-01T18:49:14.000Z | docs/_templates/sidebarintro.html | rnag/dataclass-wizard | 5bccf63daea217aff6e77fd00ed8f7bed87f0377 | [
"Apache-2.0"
] | null | null | null | <!--GitHub watchers/stars overview (disabled for now)
<p>
<iframe src="https://ghbtns.com/github-btn.html?user=rnag&repo=dataclass-wizard&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="200px" height="35px"></iframe>
</p>
-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" />
<style>
.algolia-autocomplete {
width: 100%;
height: 1.5em
}
.algolia-autocomplete a {
border-bottom: none !important;
}
#doc_search {
width: 100%;
height: 100%;
}
</style>
<!--Search functionality (disabled for now)
<input id="doc_search" placeholder="Search the doc" autofocus />
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js" onload="docsearch({
apiKey: 'abc123',
indexName: 'dataclass-wizard',
inputSelector: '#doc_search',
debug: false // Set debug to true if you want to inspect the dropdown
})" async></script>
-->
<h1 class="logo"><a href="{{ pathto(master_doc) }}">Dataclass Wizard</a></h1>
<p class="blurb">
A set of simple, yet elegant <i>wizarding</i> tools for interacting with the
Python <code>dataclasses</code> module.
</p>
<h3>Useful Links</h3>
<ul>
<!-- Quickstart is hidden because the docs are outdated; will need to update later. -->
<!--<li><a href="https://dataclass.readthedocs.io/en/latest/user/quickstart/">Quickstart</a></li>-->
<li><a href="{{ pathto('overview') }}">Overview</a></li>
<li><a href="{{ pathto('examples') }}">Examples</a></li>
<li><a href="{{ pathto('python_compatibility') }}">Py Compatibility</a></li>
<li><a href="{{ pathto('common_use_cases', 1) }}">Common Use Cases</a></li>
<li><a href="{{ pathto('advanced_usage', 1) }}">Advanced Usage</a></li>
<li><a href="{{ pathto('history') }}">Release History</a></li>
<li><a href="{{ pathto('contributing') }}">Contributors Guide</a></li>
<p></p>
<li><a href="{{ pathto('wiz_cli') }}">CLI Tool</a></li>
<li><a href="{{ pathto('using_field_properties') }}">Using Field Properties</a></li>
<p></p>
<li><a href="https://github.com/rnag/dataclass-wizard">Dataclass Wizard @ GitHub</a></li>
<li><a href="https://pypi.org/project/dataclass-wizard/">Dataclass Wizard @ PyPI</a></li>
<li><a href="https://github.com/rnag/dataclass-wizard/issues">Issue Tracker</a></li>
</ul>
| 37.359375 | 126 | 0.657465 |
d2c75f7f09d131d793bd8c7ef562f356edf8bb26 | 241 | phpt | PHP | ext/spl/tests/ArrayObject_unserialize_empty_string.phpt | thiagooak/php-src | 4006c0008e2b9646540a427b830dd46c11458786 | [
"PHP-3.01"
] | 32,467 | 2015-01-01T04:00:01.000Z | 2022-03-31T20:08:37.000Z | ext/spl/tests/ArrayObject_unserialize_empty_string.phpt | qmutz/php-src | d519e4500e5e42cf6e2858b78233f256895fd3da | [
"PHP-3.01"
] | 6,103 | 2015-01-01T03:03:43.000Z | 2022-03-31T22:38:16.000Z | ext/spl/tests/ArrayObject_unserialize_empty_string.phpt | qmutz/php-src | d519e4500e5e42cf6e2858b78233f256895fd3da | [
"PHP-3.01"
] | 8,715 | 2015-01-01T02:45:36.000Z | 2022-03-31T05:14:20.000Z | --TEST--
ArrayObject: test that you can unserialize a empty string
--CREDITS--
Havard Eide <nucleuz@gmail.com>
#PHPTestFest2009 Norway 2009-06-09 \o/
--FILE--
<?php
$a = new ArrayObject(array());
$a->unserialize("");
?>
Done
--EXPECT--
Done
| 17.214286 | 57 | 0.692946 |
7ee3e2799cb403b450b9026c9f41bb2b249628e8 | 994 | kt | Kotlin | test-utils/src/main/java/com/revenuecat/purchases/utils/StubGooglePurchase.kt | matteinn/purchases-android | 1e98dc73968149650c87e5361ec94369df6cb1bb | [
"MIT"
] | null | null | null | test-utils/src/main/java/com/revenuecat/purchases/utils/StubGooglePurchase.kt | matteinn/purchases-android | 1e98dc73968149650c87e5361ec94369df6cb1bb | [
"MIT"
] | null | null | null | test-utils/src/main/java/com/revenuecat/purchases/utils/StubGooglePurchase.kt | matteinn/purchases-android | 1e98dc73968149650c87e5361ec94369df6cb1bb | [
"MIT"
] | null | null | null | package com.revenuecat.purchases.utils
import com.android.billingclient.api.Purchase
fun stubGooglePurchase(
productId: String = "com.revenuecat.lifetime",
purchaseTime: Long = System.currentTimeMillis(),
purchaseToken: String = "abcdefghijipehfnbbnldmai.AO-J1OxqriTepvB7suzlIhxqPIveA0IHtX9amMedK0KK9CsO0S3Zk5H6gdwvV" +
"7HzZIJeTzqkY4okyVk8XKTmK1WZKAKSNTKop4dgwSmFnLWsCxYbahUmADg",
signature: String = "signature${System.currentTimeMillis()}",
purchaseState: Int = Purchase.PurchaseState.PURCHASED,
acknowledged: Boolean = true,
orderId: String = "GPA.3372-4150-8203-17209"
): Purchase = Purchase(
"""
{
"orderId": "$orderId",
"packageName":"com.revenuecat.purchases_sample",
"productId":"$productId",
"purchaseTime":$purchaseTime,
"purchaseState":${if (purchaseState == 2) 4 else 1},
"purchaseToken":"$purchaseToken",
"acknowledged":$acknowledged
}
""".trimIndent(), signature
)
| 36.814815 | 118 | 0.700201 |
71c0adbbc67509cafef34c659c25f94a1162142a | 55 | ts | TypeScript | src/components/index.ts | Horat1us/taskbook-frontend | 7a13fa1af71732449b3898c29237618177606625 | [
"MIT"
] | null | null | null | src/components/index.ts | Horat1us/taskbook-frontend | 7a13fa1af71732449b3898c29237618177606625 | [
"MIT"
] | null | null | null | src/components/index.ts | Horat1us/taskbook-frontend | 7a13fa1af71732449b3898c29237618177606625 | [
"MIT"
] | null | null | null | export * from "./Layout";
export * from "./Preloader";
| 18.333333 | 28 | 0.636364 |
4b3805cdb7e03957cf808d71a3a065c9767a46eb | 818 | kt | Kotlin | app/src/main/java/droiddevelopers254/droidconke/repository/SpeakersRepo.kt | droidconKE/droidconKE | 1c82965bf1fb0737ad1420ef4e4f0c96681f18a0 | [
"MIT"
] | 27 | 2018-06-15T19:49:08.000Z | 2021-11-01T14:22:56.000Z | app/src/main/java/droiddevelopers254/droidconke/repository/SpeakersRepo.kt | droidconKE/droidconKE | 1c82965bf1fb0737ad1420ef4e4f0c96681f18a0 | [
"MIT"
] | 15 | 2018-05-08T11:09:32.000Z | 2021-08-31T23:25:30.000Z | app/src/main/java/droiddevelopers254/droidconke/repository/SpeakersRepo.kt | droidconKE/droidconKE | 1c82965bf1fb0737ad1420ef4e4f0c96681f18a0 | [
"MIT"
] | 26 | 2018-05-11T17:00:37.000Z | 2019-10-15T07:27:04.000Z | package droiddevelopers254.droidconke.repository
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.FirebaseFirestoreException
import com.google.firebase.firestore.ktx.toObjects
import droiddevelopers254.droidconke.datastates.Result
import droiddevelopers254.droidconke.models.SpeakersModel
import droiddevelopers254.droidconke.utils.await
class SpeakersRepo(private val firestore: FirebaseFirestore) {
suspend fun getSpeakersInfo(speakerId: Int): Result<List<SpeakersModel>> {
return try {
val snapshot = firestore.collection("speakers")
.whereEqualTo("id", speakerId)
.get()
.await()
Result.Success(snapshot.toObjects<SpeakersModel>())
} catch (e: FirebaseFirestoreException) {
Result.Error(e.message)
}
}
}
| 34.083333 | 76 | 0.767726 |
e74272f87b58ad268c29ae94c11c6fe66fadc520 | 1,482 | js | JavaScript | src/fss-icons/help_24.js | Zix13/capital-components | ffd4b626ab7f1960fae459de4f53fc106faf4769 | [
"Apache-2.0"
] | 1 | 2020-02-26T11:34:10.000Z | 2020-02-26T11:34:10.000Z | src/fss-icons/help_24.js | Zix13/capital-components | ffd4b626ab7f1960fae459de4f53fc106faf4769 | [
"Apache-2.0"
] | 4 | 2019-07-10T16:51:20.000Z | 2019-10-09T17:53:50.000Z | src/fss-icons/help_24.js | Zix13/capital-components | ffd4b626ab7f1960fae459de4f53fc106faf4769 | [
"Apache-2.0"
] | 5 | 2019-07-10T16:46:50.000Z | 2020-06-29T14:44:09.000Z | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var SvgComponent = function SvgComponent(props) {
return _react.default.createElement("svg", _extends({
viewBox: "0 0 24 24"
}, props), _react.default.createElement("path", {
d: "M12 1C5.924 1 1 5.924 1 12s4.924 11 11 11c6.074 0 11-4.924 11-11S18.074 1 12 1zm9 11a8.925 8.925 0 0 1-1.271 4.587l-2.219-2.218a5.978 5.978 0 0 0 .001-4.738l2.219-2.218A8.934 8.934 0 0 1 21 12zM4.27 16.587C3.469 15.242 3 13.676 3 12s.469-3.242 1.27-4.587l2.219 2.219C6.175 10.359 6 11.159 6 12s.175 1.641.489 2.368L4.27 16.587zM8 12a4 4 0 1 1 8 0 4 4 0 0 1-8 0zm8.587-7.729L14.368 6.49A5.94 5.94 0 0 0 12 6c-.841 0-1.641.175-2.368.489L7.413 4.271A8.928 8.928 0 0 1 12 3c1.677 0 3.241.469 4.587 1.271zM7.413 19.729l2.219-2.219A5.94 5.94 0 0 0 12 18c.841 0 1.641-.175 2.368-.489l2.219 2.218A8.928 8.928 0 0 1 12 21a8.928 8.928 0 0 1-4.587-1.271z"
}));
};
var _default = SvgComponent;
exports.default = _default; | 64.434783 | 652 | 0.690283 |
2284379dcc83a21a732b517061de8b9867ace241 | 238 | sql | SQL | Placements_Advanced_joins.sql | ZeroHero77/MicrosoftSqlChallenges | 59e22749dcda954b3d92473fe6083a1ca2d106e6 | [
"MIT"
] | null | null | null | Placements_Advanced_joins.sql | ZeroHero77/MicrosoftSqlChallenges | 59e22749dcda954b3d92473fe6083a1ca2d106e6 | [
"MIT"
] | null | null | null | Placements_Advanced_joins.sql | ZeroHero77/MicrosoftSqlChallenges | 59e22749dcda954b3d92473fe6083a1ca2d106e6 | [
"MIT"
] | null | null | null | select students.name
from students
inner join packages
on students.id = packages.id
inner join friends
on students.id = friends.id
left join packages as p2
on friends.friend_id = p2.id
where p2.salary > packages.salary
order by p2.salary
| 21.636364 | 33 | 0.798319 |
f723cb29f3ae5416874218500340f237228bf79d | 1,634 | h | C | Sankore-3.1/src/pdf-merger/PageParser.h | eaglezzb/rsdc | cce881f6542ff206bf286cf798c8ec8da3b51d50 | [
"MIT"
] | null | null | null | Sankore-3.1/src/pdf-merger/PageParser.h | eaglezzb/rsdc | cce881f6542ff206bf286cf798c8ec8da3b51d50 | [
"MIT"
] | null | null | null | Sankore-3.1/src/pdf-merger/PageParser.h | eaglezzb/rsdc | cce881f6542ff206bf286cf798c8ec8da3b51d50 | [
"MIT"
] | null | null | null | /*
* Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA)
*
* This file is part of Open-Sankoré.
*
* Open-Sankoré is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License,
* with a specific linking exception for the OpenSSL project's
* "OpenSSL" library (or with modified versions of it that use the
* same license as the "OpenSSL" library).
*
* Open-Sankoré is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Open-Sankoré. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(EA_FF53E894_11D7_4c64_A409_DBC97C9EF3CF__INCLUDED_)
#define EA_FF53E894_11D7_4c64_A409_DBC97C9EF3CF__INCLUDED_
#include "Object.h"
#include <string>
class PageParser
{
friend class Parser;
public:
PageParser(const std::string & pageContent);
~PageParser();
unsigned int getPageNumber()
{
return _pageNumber;
}
void merge(const Page & sourcePage);
void recalculateObjectNumbers(unsigned int & newNumber);
std::string & getPageContent();
const std::map <unsigned int, Object *> & getPageRefs();
private:
//methods
//members
Object * _root;
unsigned int _pageNumber;
};
#endif // !defined(EA_FF53E894_11D7_4c64_A409_DBC97C9EF3CF__INCLUDED_)
| 27.694915 | 102 | 0.73929 |
569a44d9ae19317040517500f1e9f2a4b4580856 | 64 | tsx | TypeScript | StorytellersApp/config.tsx | Storytellers-App/team-project-19-storytellers-of-canada | 9a5f120838568aa13d1619a1fd7f038358bcece4 | [
"MIT"
] | null | null | null | StorytellersApp/config.tsx | Storytellers-App/team-project-19-storytellers-of-canada | 9a5f120838568aa13d1619a1fd7f038358bcece4 | [
"MIT"
] | 3 | 2021-02-15T01:25:39.000Z | 2021-03-02T02:55:39.000Z | StorytellersApp/config.tsx | csc301-fall-2020/team-project-19-storytellers-of-canada | 9a5f120838568aa13d1619a1fd7f038358bcece4 | [
"MIT"
] | 1 | 2021-06-10T03:05:38.000Z | 2021-06-10T03:05:38.000Z | export const HOST = "https://radioapp.storytellers-conteurs.ca/" | 64 | 64 | 0.78125 |
7f9e3c62f6a893f77535272203ead7070f83e98b | 61 | go | Go | programs/valid/typechecker/statements/for_continue.go | yiqiaowang/goLite | 99280564536ab8184059bf2c73e1c1de0b676612 | [
"BSD-3-Clause"
] | 2 | 2018-03-27T04:46:50.000Z | 2019-01-16T19:58:43.000Z | programs/valid/typechecker/statements/for_continue.go | yiqiaowang/goLite | 99280564536ab8184059bf2c73e1c1de0b676612 | [
"BSD-3-Clause"
] | null | null | null | programs/valid/typechecker/statements/for_continue.go | yiqiaowang/goLite | 99280564536ab8184059bf2c73e1c1de0b676612 | [
"BSD-3-Clause"
] | null | null | null | package statements
func main() {
for {
continue
}
}
| 7.625 | 18 | 0.590164 |
ce094bef0f2665e2a9d392b5c6e705ab7475eb38 | 5,480 | h | C | include/shaga/CRC.h | bwpow/libshaga | d457ee8dc267af9e20564961c9f6928290cb29cb | [
"CC0-1.0"
] | 1 | 2018-05-09T18:15:21.000Z | 2018-05-09T18:15:21.000Z | include/shaga/CRC.h | bwpow/libshaga | d457ee8dc267af9e20564961c9f6928290cb29cb | [
"CC0-1.0"
] | null | null | null | include/shaga/CRC.h | bwpow/libshaga | d457ee8dc267af9e20564961c9f6928290cb29cb | [
"CC0-1.0"
] | null | null | null | /******************************************************************************
Shaga library is released under the New BSD license (see LICENSE.md):
Copyright (c) 2012-2021, SAGE team s.r.o., Samuel Kupka
All rights reserved.
*******************************************************************************/
#ifndef HEAD_shaga_CRC
#define HEAD_shaga_CRC
#include "common.h"
namespace shaga::CRC {
/* All tables - look into src/CRC.cpp for more details */
extern const uint_fast32_t _bit_reverse_table[256];
extern const uint_fast64_t _crc64_table[256];
extern const uint_fast32_t _crc32_zlib_table[256];
extern const uint_fast32_t _crc32_atmel_table[256];
extern const uint_fast32_t _crc32c_table[256];
extern const uint_fast16_t _crc16_modbus_table[256];
extern const uint_fast8_t _crc8_dallas_table[256];
/*** CRC-64 Jones ***/
static const uint64_t crc64_magic {0};
static const uint64_t crc64_startval {0};
uint64_t crc64 (const void *const buf, const size_t len, const uint64_t startval = crc64_startval);
template<class T, typename std::enable_if<std::is_class<T>::value,T>::type* = nullptr>
uint64_t crc64 (const T &plain, const uint64_t startval = crc64_startval)
{
return crc64 (plain.data (), plain.size (), startval);
}
size_t crc64_check (const std::string_view plain, const uint64_t startval = crc64_startval);
void crc64_check_and_trim (std::string_view &plain, const uint64_t startval = crc64_startval);
void crc64_append (std::string &plain, const uint64_t startval = crc64_startval);
/*** CRC-32 zlib compatible ***/
static const uint32_t crc32_zlib_magic {0x2144df1c};
static const uint32_t crc32_zlib_startval {0};
uint32_t crc32_zlib (const void *const buf, const size_t len, const uint32_t startval = crc32_zlib_startval);
template<class T, typename std::enable_if<std::is_class<T>::value,T>::type* = nullptr>
uint32_t crc32_zlib (const T &plain, const uint32_t startval = crc32_zlib_startval)
{
return crc32_zlib (plain.data (), plain.size (), startval);
}
size_t crc32_zlib_check (const std::string_view plain, const uint32_t startval = crc32_zlib_startval);
void crc32_zlib_check_and_trim (std::string_view &plain, const uint32_t startval = crc32_zlib_startval);
void crc32_zlib_append (std::string &plain, const uint32_t startval = crc32_zlib_startval);
/*** CRC-32 Atmel CRCCU CCITT802.3 compatible ***/
static const uint32_t crc32_atmel_startval {UINT32_MAX};
uint32_t crc32_atmel (const void *const buf, const size_t len, const uint32_t startval = crc32_atmel_startval);
template<class T, typename std::enable_if<std::is_class<T>::value,T>::type* = nullptr>
uint32_t crc32_atmel (const T &plain, const uint32_t startval = crc32_atmel_startval)
{
return crc32_atmel (plain.data (), plain.size (), startval);
}
size_t crc32_atmel_check (const std::string_view plain, const uint32_t startval = crc32_atmel_startval);
void crc32_atmel_check_and_trim (std::string_view &plain, const uint32_t startval = crc32_atmel_startval);
void crc32_atmel_append (std::string &plain, const uint32_t startval = crc32_atmel_startval);
/*** CRC-32-Castagnoli ***/
static const uint32_t crc32c_magic {0x48674bc7};
static const uint32_t crc32c_startval {0};
uint32_t crc32c (const void *const buf, const size_t len, const uint32_t startval = crc32c_startval);
template<class T, typename std::enable_if<std::is_class<T>::value,T>::type* = nullptr>
uint32_t crc32c (const T &plain, const uint32_t startval = crc32c_startval)
{
return crc32c (plain.data (), plain.size (), startval);
}
size_t crc32c_check (const std::string_view plain, const uint32_t startval = crc32c_startval);
void crc32c_check_and_trim (std::string_view &plain, const uint32_t startval = crc32c_startval);
void crc32c_append (std::string &plain, const uint32_t startval = crc32c_startval);
/*** CRC-16 Modbus compatible ***/
static const uint16_t crc16_modbus_magic {0};
static const uint16_t crc16_modbus_startval {UINT16_MAX};
uint16_t crc16_modbus (const void *const buf, const size_t len, const uint16_t startval = crc16_modbus_startval);
template<class T, typename std::enable_if<std::is_class<T>::value,T>::type* = nullptr>
uint16_t crc16_modbus (const T &plain, const uint16_t startval = crc16_modbus_startval)
{
return crc16_modbus (plain.data (), plain.size (), startval);
}
size_t crc16_modbus_check (const std::string_view plain, const uint16_t startval = crc16_modbus_startval);
void crc16_modbus_check_and_trim (std::string_view &plain, const uint16_t startval = crc16_modbus_startval);
void crc16_modbus_append (std::string &plain, const uint16_t startval = crc16_modbus_startval);
/*** CRC-8 Dallas/Maxim ***/
static const uint8_t crc8_dallas_magic {0};
static const uint8_t crc8_dallas_startval {0};
uint8_t crc8_dallas (const void *const buf, const size_t len, const uint8_t startval = crc8_dallas_startval);
template<class T, typename std::enable_if<std::is_class<T>::value,T>::type* = nullptr>
uint8_t crc8_dallas (const T &plain, const uint8_t startval = crc8_dallas_startval)
{
return crc8_dallas (plain.data (), plain.size (), startval);
}
size_t crc8_dallas_check (const std::string_view plain, const uint8_t startval = crc8_dallas_startval);
void crc8_dallas_check_and_trim (std::string_view &plain, const uint8_t startval = crc8_dallas_startval);
void crc8_dallas_append (std::string &plain, const uint8_t startval = crc8_dallas_startval);
}
#endif // HEAD_shaga_CRC
| 45.666667 | 114 | 0.74927 |
39c47e1fe8a9c7a447041ad3ecfc38e167d19fa3 | 12,940 | js | JavaScript | src/Bd/controller/index.js | lsliangshan/talk_api | 11e30fa7156cb13880ff7ec52e2632889d16fe52 | [
"MIT"
] | 2 | 2018-01-22T11:06:07.000Z | 2018-01-22T11:11:53.000Z | src/Bd/controller/index.js | lsliangshan/talk_api | 11e30fa7156cb13880ff7ec52e2632889d16fe52 | [
"MIT"
] | 1 | 2022-02-13T20:26:49.000Z | 2022-02-13T20:26:49.000Z | src/Bd/controller/index.js | lsliangshan/talk_api | 11e30fa7156cb13880ff7ec52e2632889d16fe52 | [
"MIT"
] | 1 | 2018-04-19T13:56:46.000Z | 2018-04-19T13:56:46.000Z | /***
** _ooOoo_
** o8888888o
** 88" . "88
** (| -_- |)
** O\ = /O
** ____/`---'\____
** . ' \\| |// `.
** / \\||| : |||// \
** / _||||| -:- |||||- \
** | | \\\ - /// | |
** | \_| ''\---/'' | |
** \ .-\__ `-` ___/-. /
** ___`. .' /--.--\ `. . __
** ."" '< `.___\_<|>_/___.' >'"".
** | | : `- \`.;`\ _ /`;.`/ - ` : | |
** \ \ `-. \_ __\ /__ _/ .-` / /
** ======`-.____`-.___\_____/___.-`____.-'======
** `=---='
**
** .............................................
** 佛祖保佑 永无BUG
** 佛曰:
** 写字楼里写字间,写字间里程序员;
** 程序人员写程序,又拿程序换酒钱。
** 酒醒只在网上坐,酒醉还来网下眠;
** 酒醉酒醒日复日,网上网下年复年。
** 但愿老死电脑间,不愿鞠躬老板前;
** 奔驰宝马贵者趣,公交自行程序员。
** 别人笑我忒疯癫,我笑自己命太贱;
** 不见满街漂亮妹,哪个归得程序员?
*/
/**
* Created by liangshan on 2017/11/13.
*/
const FEMALES = [
{
name: '西施',
desc: '春秋战国时期出生于浙江诸暨苎萝村',
poetry: {
title: '饮湖上初晴后雨',
author: '苏轼',
content: ['水光潋滟晴方好', '山色空蒙雨亦奇', '欲把西湖比西子', '淡妆浓抹总相宜']
}
},
{
name: '貂蝉',
desc: '',
poetry: {
title: '忆江南 貂蝉',
author: '贵谷子',
content: ['媚娇娘', '枭雄逐彷徨', '红罗纤算干戈止', '豆蔻闭月乱世生', '貂蝉何处寻']
}
},
{
name: '王昭君',
desc: '',
poetry: {
title: '五美吟 明妃',
author: '曹雪芹',
content: ['绝艳惊人出汉宫', '红颜命薄古今同', '君王纵使轻颜色', '予夺权何畀画工']
}
},
{
name: '杨贵妃',
desc: '',
poetry: {
title: '清平调词',
author: '李白',
content: ['云想衣裳花想容', '春风拂槛露华浓', '若非群玉山头见', '会向瑶台月下逢']
}
},
{
name: '冯小怜',
desc: '',
poetry: {
title: '冯小怜',
author: '李贺',
content: ['湾头见小怜,请上琵琶弦', '破得春风恨,今朝值几钱', '裙垂竹叶带,鬓湿杏花烟', '玉冷红丝重,齐宫妾驾鞭']
}
},
{
name: '苏妲己',
desc: '',
poetry: {
title: '妲己图',
author: '杨维桢',
content: ['小白竿头血', '新图入汉廷', '宫中双燕子', '齐作牝鸡鸣']
}
},
{
name: '赵飞燕',
desc: '汉成帝刘骜的皇后,江都(今扬州)人',
poetry: {
title: '汉宫曲',
author: '徐凝',
content: ['水色帘前流玉霜', '赵家飞燕侍昭阳', '掌中舞罢箫声绝', '三十六宫秋夜长']
}
},
{
name: '郑旦',
desc: '',
poetry: {
title: '拾遗记',
author: '王嘉',
content: ['越又有美女二人', '一名夷光', '二名修明郑旦', '以贡于吴', '吴处以椒华之房']
}
},
{
name: '褒姒',
desc: '',
poetry: {
title: '十五夜观灯',
author: '卢照邻',
content: ['锦里开芳宴,兰缸艳早年', '缛彩遥分地,繁光远缀天', '接汉疑星落,依楼似月悬', '别有千金笑,来映九枝前']
}
},
{
name: '甄宓',
desc: '',
poetry: {
title: '和梨花',
author: '文同',
content: ['素质静相依,清香暖更飞', '笑从风外歇,啼向雨中归', '江令歌琼树,甄妃梦玉衣', '画堂明月地,常此惜芳菲']
}
}
];
const MALES = [
{
name: '潘安',
desc: '',
poetry: {
title: '花底',
author: '杜甫',
content: ['紫萼扶千蕊,黄须照万花', '忽疑行暮雨,何事入朝霞', '恐是潘安县,堪留卫玠车', '深知好颜色,莫作委泥沙']
}
},
{
name: '卫玠',
desc: '',
poetry: {
title: '晋 卫玠',
author: '孙元晏',
content: ['叔宝羊车海内稀', '山家女婿好风姿', '江东士女无端甚', '看杀玉人浑不知']
}
},
{
name: '子都',
desc: '',
poetry: {
title: '告子上',
author: '孟子',
content: ['至于子都', '天下莫不知其姣也', '不知子都之姣者', '无目者也']
}
},
{
name: '宋文公',
desc: '',
poetry: {
title: '左传',
author: '左丘明',
content: ['宋公子鲍礼于国人', '公子鲍美而艳']
}
},
{
name: '宋玉',
desc: '',
poetry: {
title: '赠邻女',
author: '鱼玄机',
content: ['羞日遮罗袖,愁春懒起妆', '易求无价宝,难得有心郎', '枕上潜垂泪,花间暗断肠', '自能窥宋玉,何必恨王昌']
}
},
{
name: '兰陵王',
desc: '',
poetry: {
title: '念裕堂',
author: '王国维',
content: ['江南天子皆词客', '河北诸王尽将材', '乍歌乐府兰陵曲', '又见湘东玉轴灰']
}
},
{
name: '嵇康',
desc: '',
poetry: {
title: '艺苑卮言',
author: '王世贞',
content: ['每叹嵇生琴夏侯色', '今千古他人览之', '犹为不堪', '况其身乎']
}
},
{
name: '韩子高',
desc: '',
poetry: {
title: '',
author: '陈蒨',
content: ['昔闻周小史', '今歌月下人', '玉尘手不别', '羊车市若空', '谁愁两雄并', '金貂应让侬']
}
},
{
name: '慕容冲',
desc: '',
poetry: {
title: '资治通鉴',
author: '司马光',
content: ['冲有自得之志', '赏罚任情']
}
},
{
name: '独孤信',
desc: '',
poetry: {
title: '',
author: '元修',
content: ['世乱识贞良', '岂虚言哉']
}
}
];
const RESULTS = {
'1': MALES,
'2': FEMALES
};
const CLIENT_ID = 'E0vrkHoQTODsnltW9GNSv8r9';
const CLIENT_SECRET = 'kMp3RsnSu385dIrGHoY06GbwGh7r5QPC';
const APP_ID = '11348934';
const CLIENT_ID2 = 'G3OXT72HTkCXrrkIj1LZuwqu';
const CLIENT_SECRET2 = 'ZXF5eSbatPXXkoiodteqHFBVArQ7GjVT';
const APP_ID2 = '11350031';
const axios = require('axios');
const qs = require('querystring');
const AipOcrClient = require('baidu-aip-sdk').ocr;
const client = new AipOcrClient(APP_ID, CLIENT_ID, CLIENT_SECRET);
const AipFaceClient = require('baidu-aip-sdk').face;
const faceClient = new AipFaceClient(APP_ID2, CLIENT_ID2, CLIENT_SECRET2);
const AipSpeechClient = require('baidu-aip-sdk').speech;
const speechClient = new AipSpeechClient(APP_ID2, CLIENT_ID2, CLIENT_SECRET2);
module.exports = class extends enkel.controller.base {
init (http) {
super.init(http);
this.BdConfigModel = this.models('Bd/config');
}
indexAction () {
return this.json({status: 200, message: 'bd成功', data: {}})
}
async tokenAction () {
// http://ai.baidu.com/docs#/OCR-API/6c337940
let params = {}
// if (!this.isPost()) {
// return this.json({status: 405, message: '请求方法不正确', data: {}});
// }
// let params = await this.post();
let bdConfigData = await this.BdConfigModel.findAll({
where: {
ci: params.ci || CLIENT_ID,
cs: params.cs || CLIENT_SECRET
}
});
let flag = 0
if (bdConfigData.length > 0) {
if (Number(bdConfigData[0].ei) > (+new Date() + 20 * 60 * 1000)) {
// access_token有效
return this.json({status: 200, message: '成功', data: {
access_token: bdConfigData[0].at
}})
} else {
// access_token即将失效
flag = 1
}
} else {
flag = 2
}
const _data = qs.stringify({
'grant_type': 'client_credentials',
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET
});
return axios({
url: 'https://aip.baidubce.com/oauth/2.0/token?' + _data,
method: 'get'
}).then(async ({data}) => {
if (data.error) {
return this.json({status: 401, message: data.error_description, data: {}});
} else {
if (flag === 1) {
let updateData = await this.BdConfigModel.update({
at: data.access_token,
sk: data.session_key,
ss: data.session_secret,
ei: (Number(data.expires_in) * 1000 + (+new Date()))
}, {
where: {
ci: CLIENT_ID,
cs: CLIENT_SECRET
}
})
if (updateData[0] > 0) {
return this.json({status: 200, message: '成功', data: {
access_token: data.access_token
}})
} else {
return this.json({status: 401, message: '失败', data: {
access_token: ''
}})
}
} else if (flag === 2) {
await this.BdConfigModel.create({
at: data.access_token,
sk: data.session_key,
ss: data.session_secret,
ci: CLIENT_ID,
cs: CLIENT_SECRET,
ei: (data.expires_in + (+new Date()) * 1000)
});
} else {}
return this.json({status: 200, message: '成功', data: {
access_token: data.access_token
}});
}
}).catch(err => {
return this.json({status: 401, message: err.message, data: {}});
})
}
async detectFaceAction () {
if (!this.isPost()) {
return this.json({status: 405, message: '请求方法不正确', data: {}});
}
let params = await this.post();
if (!params.at || (params.at.trim() === '')) {
return this.json({status: 1001, message: '缺少access_token', data: {}});
}
if (!params.image || (params.image.trim() === '')) {
return this.json({status: 1001, message: '缺少待识别的图片', data: {}});
}
let queryParams = {};
if (/^https?:\/\//.test(params.image + '')) {
// 图片url
queryParams.url = encodeURI(params.image)
} else if (/^data:image\//.test(params.image + '')) {
// 图片数据 base64
queryParams.image = params.image
} else {
queryParams.image = params.image
// return this.json({status: 1001, message: '图片数据不正确', data: {}});
}
var options = {};
options["face_field"] = "age,beauty,expression,faceshape,gender,glasses,race,quality,facetype";
options["max_face_num"] = "1";
options["face_type"] = "LIVE";
// return speechClient.text2audio('老师:如果追求一个中国女孩,你请她吃什么? 小李:麻辣烫。 老师:韩国女孩呢? 小王:韩国泡菜。 老师:日本女孩呢? 小明:马赛克。 老师:滚出去!', {
// per: 3
// }).then(res => {
// if (res.data) {
// const fs = require('fs');
// fs.writeFileSync('tts.mpVoice.mp3', res.data);
// }
// return this.json({status: 200, message: '成功', data: {}})
// })
return faceClient.detect(params.image, 'BASE64', options).then(res => {
return this.json({status: 200, message: '成功', data: res})
})
return axios({
url: 'https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic?access_token=' + params.at,
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: queryParams
}).then(({data}) => {
return this.json({status: 200, message: '成功', data: data});
}).catch(err => {
return this.json({status: 401, message: err.message, data: {}});
})
}
async imgAction () {
let params = this.get();
return axios({
url: params.image,
method: 'get'
}).then(res => {
return this.json({status: 200, message: '成功', data: (new Buffer(res.data)).toString('base64')});
}).catch(err => {
return this.json({status: 401, message: err.message, data: {}});
})
}
async img2Action () {
const http = require('https');
let params = this.get();
return new Promise((resolve, reject) => {
http.get(params.image, res => {
let chunks = [];
let size = 0;
res.on('data', chunk => {
chunks.push(chunk);
size += chunk.length;
});
res.on('end', err => {
if (err) {
reject(err.message);
}
let data = Buffer.concat(chunks, size);
resolve(data.toString('base64'));
return this.json({status: 200, message: '成功', data: data.toString('base64')})
})
})
})
}
async fileAction () {
if (!this.isPost()) {
return this.json({status: 405, message: '请求方法不正确', data: {}});
}
let params = await this.post();
return this.json({status: 200, message: '成功', data: {}})
}
async uploadAction () {
const that = this
const formidable = require('formidable');
const fs = require('fs');
let form = new formidable.IncomingForm();
let files = [];
form
.on('file', function (field, file) {
files.push(file);
});
form.parse(enkel.request, function (err) {
if (err) {
return that.json({status: 201, message: err.message, data: {}});
}
let imageData = fs.readFileSync(files[0].path);
return that.json({status: 200, message: '成功', data: new Buffer(imageData).toString('base64')});
})
}
async resultAction () {
if (!this.isPost()) {
return this.json({status: 405, message: '请求方法不正确', data: {}});
}
let params = await this.post();
return this.json({status: 200, message: '成功', data: RESULTS[String(params.gender)][9 - Math.floor(Number(params.score) / 10)]});
}
}
| 28.069414 | 132 | 0.450696 |
0ce5cb9e4bc10393a6546a397038a2d745082f63 | 3,752 | py | Python | read_iceye_h5.py | eciraci/iceye_gamma_proc | 68b04bfd55082862f419031c28e7b52f1800f3db | [
"MIT"
] | null | null | null | read_iceye_h5.py | eciraci/iceye_gamma_proc | 68b04bfd55082862f419031c28e7b52f1800f3db | [
"MIT"
] | null | null | null | read_iceye_h5.py | eciraci/iceye_gamma_proc | 68b04bfd55082862f419031c28e7b52f1800f3db | [
"MIT"
] | null | null | null | #!/usr/bin/env python
u"""
read_iceye_h5.py
Written by Enrico Ciraci' (03/2022)
Read ICEYE Single Look Complex and Parameter file using GAMMA's Python
integration with the py_gamma module.
usage: read_iceye_h5.py [-h] [--directory DIRECTORY]
TEST: Read ICEye Single Look Complex and Parameter.
optional arguments:
-h, --help show this help message and exit
--directory DIRECTORY, -D DIRECTORY
Project data directory.
--slc SLC, -C SLC Process and single SLC.
PYTHON DEPENDENCIES:
argparse: Parser for command-line options, arguments and sub-commands
https://docs.python.org/3/library/argparse.html
datetime: Basic date and time types
https://docs.python.org/3/library/datetime.html#module-datetime
tqdm: Progress Bar in Python.
https://tqdm.github.io/
py_gamma: GAMMA's Python integration with the py_gamma module
UPDATE HISTORY:
"""
# - Python Dependencies
from __future__ import print_function
import os
import argparse
import datetime
from tqdm import tqdm
# - GAMMA's Python integration with the py_gamma module
import py_gamma as pg
# - Utility Function
from utils.make_dir import make_dir
def main():
parser = argparse.ArgumentParser(
description="""TEST: Read ICEye Single Look Complex and Parameter."""
)
# - Absolute Path to directory containing input data.
default_dir = os.path.join(os.path.expanduser('~'), 'Desktop',
'iceye_gamma_test')
parser.add_argument('--directory', '-D',
type=lambda p: os.path.abspath(os.path.expanduser(p)),
default=default_dir,
help='Project data directory.')
parser.add_argument('--slc', '-C', type=str,
default=None, help='Process and single SLC.')
args = parser.parse_args()
# - Path to Test directory
data_dir = os.path.join(args.directory, 'input')
# - create output directory
out_dir = make_dir(args.directory, 'output')
out_dir = make_dir(out_dir, 'slc+par')
# - ICEye Suffix
ieye_suff = 'ICEYE_X7_SLC_SM_'
if args.slc is not None:
# - Process a single SLC
b_input = os.path.join(data_dir, args.slc)
# - Read input Binary File Name
b_input_name = b_input.split('/')[-1].replace(ieye_suff, '')
slc_name = os.path.join(out_dir,
str(b_input_name.replace('.h5', '.slc')))
par_name = os.path.join(out_dir,
str(b_input_name.replace('.h5', '.par')))
# - Extract SLC and Parameter File
# - Set dtype equal to zero to save the SLC in FCOMPLEX format.
pg.par_ICEYE_SLC(b_input, par_name, slc_name, 0)
else:
# - Process hte entire input directory content
# - List Directory Content
data_dir_list = [os.path.join(data_dir, x) for x in os.listdir(data_dir)
if x.endswith('.h5')]
for b_input in tqdm(data_dir_list, total=len(data_dir_list), ncols=60):
# - Read input Binary File Name
b_input_name = b_input.split('/')[-1].replace(ieye_suff, '')
slc_name = os.path.join(out_dir, b_input_name.replace('.h5', '.slc'))
par_name = os.path.join(out_dir, b_input_name.replace('.h5', '.par'))
# - Extract SLC and Parameter File
# - Set dtype equal to zero to save the SLC in FCOMPLEX format.
pg.par_ICEYE_SLC(b_input, par_name, slc_name, 0)
# - run main program
if __name__ == '__main__':
start_time = datetime.datetime.now()
main()
end_time = datetime.datetime.now()
print(f"# - Computation Time: {end_time - start_time}")
| 36.076923 | 81 | 0.63033 |
12b552ba2a4ef2bae819f74a41241445baaae1fd | 222 | h | C | DammitGLFW/MathConstants.h | SuniTheFish/DammitGLFW | bf80928ba1bbc439b06a54098110d8dff7388e38 | [
"MIT"
] | null | null | null | DammitGLFW/MathConstants.h | SuniTheFish/DammitGLFW | bf80928ba1bbc439b06a54098110d8dff7388e38 | [
"MIT"
] | null | null | null | DammitGLFW/MathConstants.h | SuniTheFish/DammitGLFW | bf80928ba1bbc439b06a54098110d8dff7388e38 | [
"MIT"
] | null | null | null | #pragma once
// I'm just surprised c++ has no implementaion of pi by default
namespace constants
{
constexpr double pi{ 3.14159265358979 };
constexpr double twoPi{ 6.283185307179586 };
constexpr double tau{ twoPi };
} | 22.2 | 63 | 0.747748 |
b2cf86d58c60bbfe505128563a6c3bba5ede1a72 | 212 | rs | Rust | cmd/build.rs | xiongjiwei/tikv | 6be3893f7f787b04bf34d99d1369092404ab5cfc | [
"Apache-2.0"
] | 7,968 | 2018-08-07T01:03:24.000Z | 2022-03-31T15:44:31.000Z | cmd/build.rs | xiongjiwei/tikv | 6be3893f7f787b04bf34d99d1369092404ab5cfc | [
"Apache-2.0"
] | 8,687 | 2018-08-07T02:37:23.000Z | 2022-03-31T12:53:37.000Z | cmd/build.rs | xiongjiwei/tikv | 6be3893f7f787b04bf34d99d1369092404ab5cfc | [
"Apache-2.0"
] | 1,576 | 2018-08-07T12:48:30.000Z | 2022-03-31T06:23:04.000Z | // Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0.
fn main() {
println!(
"cargo:rustc-env=TIKV_BUILD_TIME={}",
time::now_utc().strftime("%Y-%m-%d %H:%M:%S").unwrap()
);
}
| 23.555556 | 66 | 0.584906 |
92d9fcbf7f5164af2735ecbd7f0662e2a558e784 | 262 | h | C | circuit.h | enriquesomolinos/REDR | bb0712748a658d00b0bb9672d78a61f367e53fde | [
"CC0-1.0",
"CC-BY-4.0"
] | 69 | 2016-11-28T21:54:32.000Z | 2022-03-24T00:09:16.000Z | circuit.h | enriquesomolinos/REDR | bb0712748a658d00b0bb9672d78a61f367e53fde | [
"CC0-1.0",
"CC-BY-4.0"
] | 25 | 2016-11-17T15:48:24.000Z | 2021-12-11T12:17:19.000Z | circuit.h | enriquesomolinos/REDR | bb0712748a658d00b0bb9672d78a61f367e53fde | [
"CC0-1.0",
"CC-BY-4.0"
] | 9 | 2019-07-15T17:15:20.000Z | 2020-11-21T15:57:17.000Z | #ifndef CIRCUIT_H
#define CIRCUIT_H
#include "defs.h"
extern BYTE circuitOrder_45673C[];
extern char *circuits[];
/*paleta del cicuito
char byte_4A9BA0[256]; // weak //paleta del cicuito!
char byte_4A9BA1[256]; // weak
char byte_4A9BA2[256]; // weak*/
#endif | 18.714286 | 52 | 0.732824 |
ddd7b9fca8cb6a75a73e7a4859526f1618346bdf | 699 | php | PHP | resources/views/pages/auth/login.blade.php | deplink/repository | e7646fe3a3a1946cc83d61a56652f23ba4cd7aea | [
"MIT"
] | null | null | null | resources/views/pages/auth/login.blade.php | deplink/repository | e7646fe3a3a1946cc83d61a56652f23ba4cd7aea | [
"MIT"
] | 2 | 2018-09-23T19:19:25.000Z | 2018-09-24T18:11:40.000Z | resources/views/pages/auth/login.blade.php | deplink/repository | e7646fe3a3a1946cc83d61a56652f23ba4cd7aea | [
"MIT"
] | null | null | null | @extends('layouts.app')
@section('title', 'Login')
@section('content')
<h1>Login</h1>
@component('form', ['method' => 'post', 'action' => route('login')])
@component('form.string', ['name' => 'email', 'autofocus' => true])
E-mail:
@endcomponent
@component('form.password', ['name' => 'password'])
Password:
@endcomponent
@component('form.checkbox', ['name' => 'remember'])
Remember me
@endcomponent
@component('form.submit')
Login
@endcomponent
<a href="{{ route('password.request') }}">
Forgot Your Password?
</a>
@endcomponent
@endsection
| 24.103448 | 75 | 0.520744 |
b462aa6e19eea9996653d6322e512ce2fac3ba73 | 1,456 | swift | Swift | LoveFreshBeen/Class/SuperMarket/SupermarketHeadView.swift | wshenglong/LoveFreshBeen3 | 1ca90feddf5d8907761d91c359bf3f426c5ef84a | [
"MIT"
] | 1 | 2019-01-08T09:56:15.000Z | 2019-01-08T09:56:15.000Z | LoveFreshBeen/Class/SuperMarket/SupermarketHeadView.swift | wshenglong/LoveFreshBeen3 | 1ca90feddf5d8907761d91c359bf3f426c5ef84a | [
"MIT"
] | null | null | null | LoveFreshBeen/Class/SuperMarket/SupermarketHeadView.swift | wshenglong/LoveFreshBeen3 | 1ca90feddf5d8907761d91c359bf3f426c5ef84a | [
"MIT"
] | null | null | null | //
// SupermarketHeadView.swift
// LoveFreshBeen
//
// Created by 维尼的小熊 on 16/1/12.
// Copyright © 2016年 tianzhongtao. All rights reserved.
// GitHub地址:https://github.com/ZhongTaoTian/LoveFreshBeen
// Blog讲解地址:http://www.jianshu.com/p/879f58fe3542
// 小熊的新浪微博:http://weibo.com/5622363113/profile?topnav=1&wvr=6
import UIKit
class SupermarketHeadView: UITableViewHeaderFooterView {
var titleLabel: UILabel!
override init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)
backgroundView = UIView()
backgroundView?.backgroundColor = UIColor.clear
contentView.backgroundColor = UIColor(red: 240 / 255.0, green: 240 / 255.0, blue: 240 / 255.0, alpha: 0.8)
buildTitleLabel()
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
titleLabel.frame = CGRect(x: HotViewMargin, y: 0, width: width - HotViewMargin, height: height)
}
fileprivate func buildTitleLabel() {
titleLabel = UILabel()
titleLabel.backgroundColor = UIColor.clear
titleLabel.font = UIFont.systemFont(ofSize: 13)
titleLabel.textColor = UIColor.colorWithCustom(100, g: 100, b: 100)
titleLabel.textAlignment = NSTextAlignment.left
contentView.addSubview(titleLabel)
}
}
| 30.333333 | 114 | 0.667582 |
b5a50a387a6295332fe546e308095bd94e237fb5 | 58 | rs | Rust | javaDesktop/Iniciante/JavaApplication43/build/classes/javaapplication43/JavaApplication43.rs | AntonyFelisberto/projetos | 1af61f360c9099aa8e600789098ee7074768e35e | [
"MIT"
] | null | null | null | javaDesktop/Iniciante/JavaApplication43/build/classes/javaapplication43/JavaApplication43.rs | AntonyFelisberto/projetos | 1af61f360c9099aa8e600789098ee7074768e35e | [
"MIT"
] | null | null | null | javaDesktop/Iniciante/JavaApplication43/build/classes/javaapplication43/JavaApplication43.rs | AntonyFelisberto/projetos | 1af61f360c9099aa8e600789098ee7074768e35e | [
"MIT"
] | null | null | null | javaapplication43.ssd
javaapplication43.JavaApplication43
| 19.333333 | 35 | 0.931034 |
4c19c5af9a590fd25fd560ba053aea89e8f86143 | 5,176 | php | PHP | resources/views/international-staff-recruitment.blade.php | MdTalatMahmud/Mates-Group | d6abc32203ee729a9758bf5b24d588456ff82f53 | [
"MIT"
] | null | null | null | resources/views/international-staff-recruitment.blade.php | MdTalatMahmud/Mates-Group | d6abc32203ee729a9758bf5b24d588456ff82f53 | [
"MIT"
] | null | null | null | resources/views/international-staff-recruitment.blade.php | MdTalatMahmud/Mates-Group | d6abc32203ee729a9758bf5b24d588456ff82f53 | [
"MIT"
] | null | null | null | @extends('layouts.master', ['title' => 'Mates Global'])
{{--adding three lines for search engine meta link--}}
@section('title', 'International Staff Recruitment/Hire Service Australia')
@section('meta_keywords', 'Hire international workers australia, international staff recruitment service australia,
international staff recruitment worldwide, global international staff recruitment,
International staff recruitment in Sydney,
International staff recruitment in Melbourne,
International staff recruitment in Queensland,
International staff recruitment in Victoria,
International staff recruitment in NSW,
International staff recruitment in Brisbane,
International Labour hire services in Sydney,
International Labour hire services in Melbourne,
International Labour hire services in Queensland,
International Labour hire services in Victoria,
International Labour hire services in NSW,
International Labour hire services in Brisbane,
International staff recruitment services in Sydney,
International staff recruitment services in Queensland,
International staff recruitment services in Melbourne,
International staff recruitment services in NSW,
International staff recruitment services in Victoria,
International staff recruitment services in Brisbane,
')
@section('meta_des', 'Mates Group is a reputed Australian company with clients around the world. We provide International workers recruitment or hire services worldwide.')
@section('content')
<div class="header-banner" style="text-align: center;">
<h1 class="white line-12 text-45">Mates Group: Innovative International People Hire Company</h1>
</div>
<div class="single-content">
<div class="container">
<div class="col-md-12, text-justify">
<h2><strong>International People Hire Company</strong></h2>
<p>We trust that to be successfull, high-quality employees are the assets in a company. That's why we welcome the international staff. We provide international staff recruitment service Australia. </p>
<p><strong>Why joining Mates Group as a international staff?<br /> </strong>People in Australia are very friendly. They are very helpful. In our company we will provide you to the perfect & suitable workplace. As a result you can express yourself in your workplace.</p>
<table width="612">
<tbody>
<tr>
<td width="203">
<p style="text-align: center;"><strong>Highly Qualified</strong></p>
</td>
<td width="203">
<p style="text-align: center;"><strong>Extensive Selection</strong></p>
</td>
<td width="203">
<p style="text-align: center;"><strong>Professional Support</strong></p>
</td>
</tr>
<tr>
<td width="203">
<p>
With our smart recruitment process we shortlisted our applicants by their specifications. We have access to an international labour pool so that we guarantee high-quality staff. We select the most skilled people in the specific field.
</p>
</td>
<td width="203">
<p>
Every company want great employees but most often just settle for what’s available in their small local labour pool. We provide smart and customized recruitment service to find the exact skill you need.
</p>
</td>
<td width="203">
<p>Our experienced & elite team will provide you professional support as well as personalised advice & information based on the most current legislation and policy requirements.</p>
</td>
</tr>
</tbody>
</table>
<p> </p>
<h2><strong>Our international recruitment team can help you with: </strong></h2>
<p><strong>Trade Testing:<br></strong>Employers may have trade test shortlisted applicants as the specifications of a business or workshop company.</p>
<p></p>
<p><strong>Sponsorship of employees:<br></strong>We do international staff recruitment worldwide. Our agents will process the sponsorships, visa applications, and professional matters. </p>
<p></p>
<p><strong>Interviewing & Selection:<br></strong>Our specialist team interview the applicants and shortlist the perfect employees for perfect job. Our team hire international workers Australia.</p>
<p></p>
<p><strong>Continuous Support:<br></strong>Our team will provide continuous support including organise everything from Tax File Numbers to Trade Licensing.</p>
<p></p>
</div>
</div>
</div>
@endsection
| 54.484211 | 285 | 0.627512 |
74177d02f602a8b8e9ad7f76ab9d0d39c73a212f | 116 | kt | Kotlin | app/src/main/java/com/android/taitasciore/privaliatest/data/entity/mapper/Mapper.kt | phanghos/privalia-test-reloaded | fa768babb975100102ba84f5ade29ac90681a7b1 | [
"MIT"
] | null | null | null | app/src/main/java/com/android/taitasciore/privaliatest/data/entity/mapper/Mapper.kt | phanghos/privalia-test-reloaded | fa768babb975100102ba84f5ade29ac90681a7b1 | [
"MIT"
] | null | null | null | app/src/main/java/com/android/taitasciore/privaliatest/data/entity/mapper/Mapper.kt | phanghos/privalia-test-reloaded | fa768babb975100102ba84f5ade29ac90681a7b1 | [
"MIT"
] | null | null | null | package com.android.taitasciore.privaliatest.data.entity.mapper
interface Mapper<T, R> {
fun map(input: T): R
} | 23.2 | 63 | 0.741379 |
9c82fd0aa4a545ee0df6c5b25bd0e3a250b9b768 | 2,367 | asm | Assembly | Lab4/longop.asm | YuriySavchenko/Assembler | d8ab6e8451d97255e639f0039f623ec00d5e9e2b | [
"Apache-2.0"
] | null | null | null | Lab4/longop.asm | YuriySavchenko/Assembler | d8ab6e8451d97255e639f0039f623ec00d5e9e2b | [
"Apache-2.0"
] | null | null | null | Lab4/longop.asm | YuriySavchenko/Assembler | d8ab6e8451d97255e639f0039f623ec00d5e9e2b | [
"Apache-2.0"
] | null | null | null | section .code
; procedure for adding number increased bit rate
Add_608_LONGOP:
push ebp
mov ebp, esp
mov esi, [ebp+16] ; ESI - adress of A
mov ebx, [ebp+12] ; EBX - adress of B
mov edi, [ebp+8] ; EDI - adress of Result
mov ecx, 19 ; count of repeat
mov edx, 0 ; number of 32-bit group
clc ; set null bit CF for register EFLAGS
.cycle:
mov eax, dword [esi+4*edx] ; write A to register EAX
adc eax, dword [ebx+4*edx] ; adding group of 32-bits
mov dword [edi+4*edx], eax ; write result of adding of last 32-bit group to register EAX
inc edx ; set counter for number of 32-bit group more on 1 point
dec ecx ; set counter less on 1 point
jnz .cycle ; while value in ECX not equal 0 we are repeat cycle
pop ebp ; restoration stack
ret 12 ; exit of procedure
; procedure for subtraction numbers increased bit rate
Sub_512_LONGOP:
push ebp
mov ebp, esp
mov esi, [ebp+16] ; ESI - adress of A
mov ebx, [ebp+12] ; EBX - adress of B
mov edi, [ebp+8] ; EDI - adress of Result
mov ecx, 16 ; count of repeat
mov edx, 0 ; number of 32-bit group
clc ; set null bit CF for register EFLAGS
.cycle:
mov eax, dword [esi+4*edx] ; write A to register EAX
sbb eax, dword [ebx+4*edx] ; subtruction group of 32-bits
mov dword [edi+4*edx], eax ; write result of subtraction of last 32-bit group to register EAX
inc edx ; set counter for number of 32-bit group more on 1 point
dec ecx ; set counter less on 1 point
jnz .cycle ; while value in ECX not equal 0 we are repeat cycle
pop ebp ; restoration stack
ret 12 ; exit of procedure
| 38.803279 | 108 | 0.461766 |
7589d05bcf0e4b77dd02167132f2bc19ad6332ae | 267 | h | C | YanFarmwork/Third Tools/UIColorCategory/UIView+WFLine.h | shanghaiEast/HaoxtMpos_iOS | 8dde99789fc146d84f14e4a8ce7d8f2293685251 | [
"MIT"
] | null | null | null | YanFarmwork/Third Tools/UIColorCategory/UIView+WFLine.h | shanghaiEast/HaoxtMpos_iOS | 8dde99789fc146d84f14e4a8ce7d8f2293685251 | [
"MIT"
] | null | null | null | YanFarmwork/Third Tools/UIColorCategory/UIView+WFLine.h | shanghaiEast/HaoxtMpos_iOS | 8dde99789fc146d84f14e4a8ce7d8f2293685251 | [
"MIT"
] | null | null | null | //
// UIView+WFLine.h
// YiDingTongiOS
//
// Created by 周军 on 16/7/14.
// Copyright © 2016年 YiDingTongiOS.com. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIView (WFLine)
+ (UIView *)createLineViewWith:(CGRect)rect color:(UIColor *)color;
@end
| 16.6875 | 67 | 0.685393 |
fb731a56d20a17ba86a88fe3f811b87715eb2182 | 352 | kt | Kotlin | channels/alexa/src/main/kotlin/com/justai/jaicf/channel/alexa/model/AlexaEvent.kt | sjmittal/jaicf-kotlin | 7d0344a98fa0ac99fb7edc55e5a07bb3e429e126 | [
"Apache-2.0"
] | 210 | 2020-03-12T15:31:38.000Z | 2022-03-28T07:58:12.000Z | channels/alexa/src/main/kotlin/com/justai/jaicf/channel/alexa/model/AlexaEvent.kt | sjmittal/jaicf-kotlin | 7d0344a98fa0ac99fb7edc55e5a07bb3e429e126 | [
"Apache-2.0"
] | 67 | 2020-03-16T11:28:33.000Z | 2022-03-29T13:15:05.000Z | channels/alexa/src/main/kotlin/com/justai/jaicf/channel/alexa/model/AlexaEvent.kt | sjmittal/jaicf-kotlin | 7d0344a98fa0ac99fb7edc55e5a07bb3e429e126 | [
"Apache-2.0"
] | 42 | 2020-03-15T11:33:32.000Z | 2022-03-18T09:02:31.000Z | package com.justai.jaicf.channel.alexa.model
object AlexaEvent {
const val LAUNCH = "LaunchRequest"
const val PLAY = "PlaybackController.PlayCommandIssued"
const val PAUSE = "PlaybackController.PauseCommandIssued"
const val NEXT = "PlaybackController.NextCommandIssued"
const val PREV = "PlaybackController.PreviousCommandIssued"
} | 39.111111 | 63 | 0.78125 |
0bb9ef8fe971ab866f0df1a21e24ab5e58fecf4b | 713 | js | JavaScript | src/component/Filter.js | cstsncv/JS | 184f9674d7d7427713a686efe71b75522e5b828c | [
"MIT"
] | null | null | null | src/component/Filter.js | cstsncv/JS | 184f9674d7d7427713a686efe71b75522e5b828c | [
"MIT"
] | 4 | 2020-09-06T23:47:08.000Z | 2022-02-26T16:47:14.000Z | src/component/Filter.js | cstsncv/JS | 184f9674d7d7427713a686efe71b75522e5b828c | [
"MIT"
] | null | null | null | import { Select, Card, Col, Row } from 'antd';
import React from 'react';
import ReactDom from 'react-dom';
import 'antd/lib/row/style';
import 'antd/lib/card/style';
import 'antd/lib/col/style';
import 'antd/lib/select/style';
import TodoService from '../service/service'
const Option = Select.Option;
//过滤
export default props => <Card style={{ width: 300 }}>
<Row>
<Col span="20">
<Select defaultValue="uncompleted" style={{ width: 120 }} onChange={props.onChange}>
<Option value="completed">已完成</Option>
<Option value="uncompleted">未完成</Option>
<Option value="all" >全部</Option>
</Select>
</Col>
</Row>
</Card>; | 31 | 96 | 0.605891 |
b82b91a8c8452384a38b315df5c298b27dc87504 | 1,309 | rs | Rust | src/aabb/aabb.rs | ebenpack/rtiaw | 088482d47afb4753f5f13a788b54703cd61407f7 | [
"MIT"
] | null | null | null | src/aabb/aabb.rs | ebenpack/rtiaw | 088482d47afb4753f5f13a788b54703cd61407f7 | [
"MIT"
] | null | null | null | src/aabb/aabb.rs | ebenpack/rtiaw | 088482d47afb4753f5f13a788b54703cd61407f7 | [
"MIT"
] | null | null | null | use crate::ray::Ray;
use crate::vec3::Vec3;
#[derive(Clone, Copy)]
pub struct AABB {
pub minimum: Vec3,
pub maximum: Vec3,
}
impl AABB {
pub fn new(minimum: Vec3, maximum: Vec3) -> Self {
AABB { minimum, maximum }
}
pub fn hit(&self, ray: &Ray, mut t_min: f64, mut t_max: f64) -> bool {
for a in 0..=2 {
let inv_d = 1.0 / ray.direction[a];
let mut t0 = (self.minimum[a] - ray.origin[a]) * inv_d;
let mut t1 = (self.maximum[a] - ray.origin[a]) * inv_d;
if inv_d < 0.0 {
std::mem::swap(&mut t0, &mut t1);
}
t_min = if t0 > t_min { t0 } else { t_min };
t_max = if t1 < t_max { t1 } else { t_max };
if t_max <= t_min {
return false;
}
}
true
}
pub fn bounding_box(box0: &AABB, box1: &AABB) -> AABB {
let small = Vec3::new(
box0.minimum.x.min(box1.minimum.x),
box0.minimum.y.min(box1.minimum.y),
box0.minimum.z.min(box1.minimum.z),
);
let big = Vec3::new(
box0.maximum.x.max(box1.maximum.x),
box0.maximum.y.max(box1.maximum.y),
box0.maximum.z.max(box1.maximum.z),
);
AABB::new(small, big)
}
}
| 27.851064 | 74 | 0.488159 |
0ef4d43f4bde2068db680594bf4dcda4457e5756 | 1,500 | tsx | TypeScript | src/components/ContactSection/index.tsx | lunsmat/MyPersonalPortifolio | ac374db0cbc290ecb0e12b0b9427fef78c9f5ef5 | [
"MIT"
] | 1 | 2020-06-21T03:32:59.000Z | 2020-06-21T03:32:59.000Z | src/components/ContactSection/index.tsx | Luan-Farias/MyPersonalPortifolio | ac374db0cbc290ecb0e12b0b9427fef78c9f5ef5 | [
"MIT"
] | 2 | 2022-02-13T16:14:01.000Z | 2022-02-19T03:53:07.000Z | src/components/ContactSection/index.tsx | lunsmat/MyPersonalPortifolio | ac374db0cbc290ecb0e12b0b9427fef78c9f5ef5 | [
"MIT"
] | 1 | 2020-06-21T03:33:32.000Z | 2020-06-21T03:33:32.000Z | import React from 'react';
import { Container } from './styles';
import { SectionHeader } from '../SectionComponents';
import Background from '../../styles/assets/images/bg.jpg';
const ContactSection: React.FC = () => {
return (
<Container background={Background} id="contact">
<SectionHeader>
<h3>Contact</h3>
<p>Let's Keep In Touch</p>
<div className="separator">
<div /><span /><div />
</div>
</SectionHeader>
<div className="background">
<div id="backgroundColor">
<div className="body">
<form>
<h4>Get In Touch</h4>
<input type="text" name="name" placeholder="Your Name" />
<input type="email" name="email" placeholder="Your Email Adress" />
<input type="text" name="subject" placeholder="Subject" />
<input type="text" name="subject" placeholder="Subject" />
<input type="text" name="subject" placeholder="Subject" />
<textarea name="message" placeholder="Enter Your Message"></textarea>
<button>Submmit</button>
</form>
</div>
</div>
</div>
</Container>
);
}
export default ContactSection;
| 39.473684 | 97 | 0.466 |
127b17264a7f30840dd2acc442bff6dfbe4151e8 | 1,426 | h | C | dataAQ.h | isaiahgarcia/2014_US_Census | a087b1ca7d3ce58caff0a2986eab450a2775c411 | [
"MIT"
] | null | null | null | dataAQ.h | isaiahgarcia/2014_US_Census | a087b1ca7d3ce58caff0a2986eab450a2775c411 | [
"MIT"
] | null | null | null | dataAQ.h | isaiahgarcia/2014_US_Census | a087b1ca7d3ce58caff0a2986eab450a2775c411 | [
"MIT"
] | null | null | null | #ifndef DATAAQ_H
#define DATAAQ_H
#include <string>
#include <iostream>
#include <vector>
#include <map>
#include "demogCombo.h"
#include "psCombo.h"
#include "visitorReport.h"
/*
data aggregator and query for testing
*/
class dataAQ {
public:
dataAQ();
/* necessary function to aggregate the data - this CAN and SHOULD vary per
student - depends on how they map, etc. */
void createComboDemogData(std::vector<shared_ptr<demogData> >& theData);
void createComboPoliceData(std::vector<shared_ptr<psData> >& theData);
void createComboDemogDataKey(std::vector<shared_ptr<demogData> >& theData);
void createComboPoliceDataKey(std::vector<shared_ptr<psData> >& theData);
//sort and report the top ten states in terms of number of police shootings
void reportTopTenStatesPS();
//sort and report the top ten states with largest population below poverty
void reportTopTenStatesBP();
shared_ptr<demogCombo> getComboDemogData(string key) { return allComboDemogData[key]; }
shared_ptr<psCombo> getComboPoliceData(string key) { return allComboPoliceData[key]; }
friend std::ostream& operator<<(std::ostream &out, const dataAQ &comboData);
void comboReport(double thresh);
//this quarter restriction
private:
std::map<string, shared_ptr<demogCombo> > allComboDemogData;
std::map<string, shared_ptr<psCombo> > allComboPoliceData;
};
#endif
| 30.340426 | 91 | 0.728612 |
f06b5ca0b13a5293cc2597359395e328535fbb92 | 433 | py | Python | tags.py | Manugs51/TFM_Metaforas | 3fb459cf80c71e6fbb1c2a58d20bc03a05a760bd | [
"MIT"
] | null | null | null | tags.py | Manugs51/TFM_Metaforas | 3fb459cf80c71e6fbb1c2a58d20bc03a05a760bd | [
"MIT"
] | null | null | null | tags.py | Manugs51/TFM_Metaforas | 3fb459cf80c71e6fbb1c2a58d20bc03a05a760bd | [
"MIT"
] | null | null | null |
UNIVERSAL_POS_TAGS = {
'VERB': 'verbo',
'NOUN': 'nombre',
'PRON': 'pronombre',
'ADJ' : 'adjetivo',
'ADV' : 'adverbio',
'ADP' : 'aposición',
'CONJ': 'conjunción',
'DET' : 'determinante',
'NUM' : 'numeral',
'PRT' : 'partícula gramatical',
'X' : 'desconocido',
'.' : 'signo de puntuación',
}
BABEL = {
'v': 'verbo',
'n': 'nombre',
'a': 'adjetivo',
'r': 'adverbio',
} | 19.681818 | 35 | 0.484988 |
eefa32bdf7f2f38cc588fffe4a62149ba4f1584b | 428 | sql | SQL | presto-native-execution/src/test/resources/tpch/queries/q14.sql | shrinidhijoshi/presto | 34437ceaed40f32d50c90cfff320f5286ce8cfa2 | [
"Apache-2.0"
] | 1 | 2021-12-13T18:44:43.000Z | 2021-12-13T18:44:43.000Z | presto-native-execution/src/test/resources/tpch/queries/q14.sql | shrinidhijoshi/presto | 34437ceaed40f32d50c90cfff320f5286ce8cfa2 | [
"Apache-2.0"
] | null | null | null | presto-native-execution/src/test/resources/tpch/queries/q14.sql | shrinidhijoshi/presto | 34437ceaed40f32d50c90cfff320f5286ce8cfa2 | [
"Apache-2.0"
] | null | null | null | -- TPC-H/TPC-R Promotion Effect Query (Q14)
-- Functional Query Definition
-- Approved February 1998
select
100.00 * sum(case
when p.type like 'PROMO%'
then l.extendedprice * (1 - l.discount)
else 0
end) / sum(l.extendedprice * (1 - l.discount)) as promo_revenue
from
lineitem as l,
part as p
where
l.partkey = p.partkey
and l.shipdate >= date '1995-09-01'
and l.shipdate < date '1995-09-01' + interval '1' month;
| 25.176471 | 64 | 0.689252 |
bc1b4f33f6ff9d5dc6df3d4c83d8b7e54cf5dacd | 2,362 | rs | Rust | garnet/bin/setui/src/night_mode/night_mode_controller.rs | wwjiang007/fuchsia-1 | 0db66b52b5bcd3e27c8b8c2163925309e8522f94 | [
"BSD-2-Clause"
] | 210 | 2019-02-05T12:45:09.000Z | 2022-03-28T07:59:06.000Z | garnet/bin/setui/src/night_mode/night_mode_controller.rs | wwjiang007/fuchsia-1 | 0db66b52b5bcd3e27c8b8c2163925309e8522f94 | [
"BSD-2-Clause"
] | 5 | 2019-12-04T15:13:37.000Z | 2020-02-19T08:11:38.000Z | garnet/bin/setui/src/night_mode/night_mode_controller.rs | wwjiang007/fuchsia-1 | 0db66b52b5bcd3e27c8b8c2163925309e8522f94 | [
"BSD-2-Clause"
] | 73 | 2019-03-06T18:55:23.000Z | 2022-03-26T12:04:51.000Z | // Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::base::SettingInfo;
use crate::handler::base::Request;
use crate::handler::device_storage::{DeviceStorageAccess, DeviceStorageCompatible};
use crate::handler::setting_handler::persist::{controller as data_controller, ClientProxy};
use crate::handler::setting_handler::{
controller, ControllerError, IntoHandlerResult, SettingHandlerResult,
};
use crate::night_mode::types::NightModeInfo;
use async_trait::async_trait;
impl DeviceStorageCompatible for NightModeInfo {
const KEY: &'static str = "night_mode_info";
fn default_value() -> Self {
NightModeInfo { night_mode_enabled: None }
}
}
impl From<NightModeInfo> for SettingInfo {
fn from(info: NightModeInfo) -> SettingInfo {
SettingInfo::NightMode(info)
}
}
pub struct NightModeController {
client: ClientProxy,
}
impl DeviceStorageAccess for NightModeController {
const STORAGE_KEYS: &'static [&'static str] = &[NightModeInfo::KEY];
}
#[async_trait]
impl data_controller::Create for NightModeController {
/// Creates the controller
async fn create(client: ClientProxy) -> Result<Self, ControllerError> {
Ok(NightModeController { client })
}
}
#[async_trait]
impl controller::Handle for NightModeController {
async fn handle(&self, request: Request) -> Option<SettingHandlerResult> {
match request {
Request::SetNightModeInfo(night_mode_info) => {
let nonce = fuchsia_trace::generate_nonce();
let mut current = self.client.read_setting::<NightModeInfo>(nonce).await;
// Save the value locally.
current.night_mode_enabled = night_mode_info.night_mode_enabled;
Some(
self.client
.write_setting(current.into(), false, nonce)
.await
.into_handler_result(),
)
}
Request::Get => Some(
self.client
.read_setting_info::<NightModeInfo>(fuchsia_trace::generate_nonce())
.await
.into_handler_result(),
),
_ => None,
}
}
}
| 32.805556 | 91 | 0.636749 |
92dc0e863cd1072350d91ac119f61f43ba8785d4 | 410 | h | C | main/src/sds011.h | michey/air-q | d6c3c5f0a33240804a5020602fa64faf4f2b6f5a | [
"WTFPL"
] | null | null | null | main/src/sds011.h | michey/air-q | d6c3c5f0a33240804a5020602fa64faf4f2b6f5a | [
"WTFPL"
] | null | null | null | main/src/sds011.h | michey/air-q | d6c3c5f0a33240804a5020602fa64faf4f2b6f5a | [
"WTFPL"
] | null | null | null |
#ifndef _SDS011
#define _SDS011
#include "driver/gpio.h"
#include "driver/uart.h"
#include "esp_log.h"
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "serial.h"
#include "string.h"
#include "cJSON.h"
#include "logging.h"
#define UART_NUM_SDS UART_NUM_2
#define SDS_TXD_PIN (GPIO_NUM_17)
#define SDS_RXD_PIN (GPIO_NUM_16)
void sds_rx_task(void *qPointer);
#endif | 18.636364 | 33 | 0.758537 |
40d48d0a98cb2b027d55ec1b142a06fd0ba857dd | 1,830 | html | HTML | src/app/feature/cita/components/listar-cita/listar-cita.component.html | JuanHurtado95/angular-base | 9700a0f5cb1c6b8db863935d28efb36f3fa3b371 | [
"Apache-2.0"
] | null | null | null | src/app/feature/cita/components/listar-cita/listar-cita.component.html | JuanHurtado95/angular-base | 9700a0f5cb1c6b8db863935d28efb36f3fa3b371 | [
"Apache-2.0"
] | null | null | null | src/app/feature/cita/components/listar-cita/listar-cita.component.html | JuanHurtado95/angular-base | 9700a0f5cb1c6b8db863935d28efb36f3fa3b371 | [
"Apache-2.0"
] | null | null | null | <div class="container">
<br>
<div class="card row">
<div class="col-md-12">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h5>Citas</h5>
<button (click)="nuevaCita()" class="btn btn-primary btn-sm bi bi-person-plus-fill" id="botonCrearCita"> Crear Cita</button>
</div>
</div>
</div>
<div class="card-body">
<table class="table table-hover">
<thead>
<tr class="text-center">
<th>ID</th>
<th>CEDULA</th>
<th>NOMBRE</th>
<th>TELEFONO</th>
<th>VEHICULO</th>
<th>PLACA</th>
<th>VALOR</th>
<th>FECHA</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let cita of citas | async ; let i = index" class="text-center tablaCitas">
<td>{{cita.id}}</td>
<td>{{cita.vehiculo.usuario.cedula}}</td>
<td>{{cita.vehiculo.usuario.nombre}}</td>
<td>{{cita.vehiculo.usuario.telefono}}</td>
<td>{{cita.vehiculo.tipoVehiculo.nombre}}</td>
<td>{{cita.vehiculo.placa}}</td>
<td>{{cita.vehiculo.tipoVehiculo.precioLavada}}</td>
<td>{{cita.fecha | date:'dd-MM-yyyy'}}</td>
<td>
<button (click)="editarCita(cita)" class="btn btn-outline-secondary btn-sm bi bi-pencil-square" [id]="'botonEditarCita'+ i"> Editar</button>
<button (click)="deleteCita(cita)" class="btn btn-outline-danger btn-sm bi bi-trash-fill" [id]="'botonEliminarCita' + i"> Borrar</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
| 38.93617 | 156 | 0.487978 |
741f79709d59446725815ba525641ae594230ce4 | 6,559 | h | C | atca_basic.h | GabrielNotman/ExpLoRer_Crypto | 3016cb1f5f44d8ad79a0488f179ed33a3bf9d867 | [
"MIT",
"Unlicense"
] | 6 | 2018-07-21T21:14:12.000Z | 2020-10-22T21:50:01.000Z | atca_basic.h | GabrielNotman/ExpLoRer_Crypto | 3016cb1f5f44d8ad79a0488f179ed33a3bf9d867 | [
"MIT",
"Unlicense"
] | null | null | null | atca_basic.h | GabrielNotman/ExpLoRer_Crypto | 3016cb1f5f44d8ad79a0488f179ed33a3bf9d867 | [
"MIT",
"Unlicense"
] | 2 | 2018-12-04T15:13:12.000Z | 2019-06-24T01:10:25.000Z | /**
* \file
* \brief CryptoAuthLib Basic API methods - a simple crypto authentication api.
* These methods manage a global ATCADevice object behind the scenes. They also
* manage the wake/idle state transitions so callers don't need to.
*
* \copyright Copyright (c) 2015 Atmel Corporation. All rights reserved.
*
* \atmel_crypto_device_library_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel integrated circuit.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* \atmel_crypto_device_library_license_stop
*/
#include "cryptoauthlib.h"
#ifndef ATCA_BASIC_H_
#define ATCA_BASIC_H_
#define TBD void
/** \defgroup atcab_ Basic Crypto API methods (atcab_)
*
* \brief
* These methods provide the most convenient, simple API to CryptoAuth chips
*
@{ */
#ifdef __cplusplus
extern "C" {
#endif
// basic global device object methods
ATCA_STATUS atcab_version( char *verstr );
ATCA_STATUS atcab_init(ATCAIfaceCfg *cfg);
ATCA_STATUS atcab_init_device(ATCADevice cadevice);
ATCA_STATUS atcab_release(void);
ATCADevice atcab_getDevice(void);
ATCA_STATUS atcab_wakeup(void);
ATCA_STATUS atcab_idle(void);
ATCA_STATUS atcab_sleep(void);
// discovery
ATCA_STATUS atcab_cfg_discover( ATCAIfaceCfg cfgArray[], int max);
// basic crypto API
ATCA_STATUS atcab_info(uint8_t *revision);
ATCA_STATUS atcab_challenge(const uint8_t *challenge);
ATCA_STATUS atcab_challenge_seed_update(const uint8_t *seed, uint8_t* rand_out);
ATCA_STATUS atcab_nonce(const uint8_t *tempkey);
ATCA_STATUS atcab_nonce_rand(const uint8_t *seed, uint8_t* rand_out);
ATCA_STATUS atcab_random(uint8_t *rand_out);
ATCA_STATUS atcab_is_locked(uint8_t zone, bool *lock_state);
ATCA_STATUS atcab_is_slot_locked(uint8_t slot, bool *lock_state);
ATCA_STATUS atcab_get_addr(uint8_t zone, uint8_t slot, uint8_t block, uint8_t offset, uint16_t* addr);
ATCA_STATUS atcab_read_zone(uint8_t zone, uint8_t slot, uint8_t block, uint8_t offset, uint8_t *data, uint8_t len);
ATCA_STATUS atcab_write_zone(uint8_t zone, uint8_t slot, uint8_t block, uint8_t offset, const uint8_t *data, uint8_t len);
ATCA_STATUS atcab_write_bytes_slot(uint8_t slot, uint16_t offset, const uint8_t *data, uint8_t len);
ATCA_STATUS atcab_write_bytes_zone(ATCADeviceType dev_type, uint8_t zone, uint16_t address, const uint8_t *data, uint8_t len);
ATCA_STATUS atcab_read_bytes_zone(ATCADeviceType dev_type, uint8_t zone, uint16_t address, uint8_t len, uint8_t *data);
ATCA_STATUS atcab_read_serial_number(uint8_t* serial_number);
ATCA_STATUS atcab_read_pubkey(uint8_t slot8toF, uint8_t *pubkey);
ATCA_STATUS atcab_write_pubkey(uint8_t slot8toF, uint8_t *pubkey);
ATCA_STATUS atcab_read_sig(uint8_t slot8toF, uint8_t *sig);
ATCA_STATUS atcab_read_ecc_config_zone(uint8_t* config_data);
ATCA_STATUS atcab_write_ecc_config_zone(const uint8_t* config_data);
ATCA_STATUS atcab_read_sha_config_zone( uint8_t* config_data);
ATCA_STATUS atcab_write_sha_config_zone(const uint8_t* config_data);
ATCA_STATUS atcab_read_config_zone(ATCADeviceType dev_type, uint8_t* config_data);
ATCA_STATUS atcab_write_config_zone(ATCADeviceType dev_type, const uint8_t* config_data);
ATCA_STATUS atcab_cmp_config_zone(uint8_t* config_data, bool* same_config);
ATCA_STATUS atcab_read_enc(uint8_t slotid, uint8_t block, uint8_t *data, const uint8_t* enckey, const uint16_t enckeyid);
ATCA_STATUS atcab_write_enc(uint8_t slotid, uint8_t block, const uint8_t *data, const uint8_t* enckey, const uint16_t enckeyid);
ATCA_STATUS atcab_lock_config_zone(uint8_t* lock_response);
ATCA_STATUS atcab_lock_data_zone(uint8_t* lock_response);
ATCA_STATUS atcab_lock_data_slot(uint8_t slot, uint8_t* lock_response);
ATCA_STATUS atcab_priv_write(uint8_t slot, const uint8_t priv_key[36], uint8_t write_key_slot, const uint8_t write_key[32]);
ATCA_STATUS atcab_genkey( int slot, uint8_t *pubkey );
ATCA_STATUS atcab_get_pubkey(uint8_t privSlotId, uint8_t *pubkey);
ATCA_STATUS atcab_calc_pubkey(uint8_t privSlotId, uint8_t *pubkey);
ATCA_STATUS atcab_sign(uint16_t slot, const uint8_t *msg, uint8_t *signature);
ATCA_STATUS atcab_verify_extern(const uint8_t *message, const uint8_t *signature, const uint8_t *pubkey, bool *verified);
ATCA_STATUS atcab_ecdh(uint16_t key_id, const uint8_t* pub_key, uint8_t* ret_ecdh);
ATCA_STATUS atcab_ecdh_enc(uint16_t slotid, const uint8_t* pubkey, uint8_t* ret_ecdh, const uint8_t* enckey, const uint8_t enckeyid);
ATCA_STATUS atcab_gendig(uint8_t zone, uint16_t key_id);
ATCA_STATUS atcab_gendig_host(uint8_t zone, uint16_t key_id, uint8_t *other_data, uint8_t len);
ATCA_STATUS atcab_mac( uint8_t mode, uint16_t key_id, const uint8_t* challenge, uint8_t* digest );
ATCA_STATUS atcab_checkmac( uint8_t mode, uint16_t key_id, const uint8_t *challenge, const uint8_t *response, const uint8_t *other_data);
ATCA_STATUS atcab_sha_start(void);
ATCA_STATUS atcab_sha_update(uint16_t length, const uint8_t *message);
ATCA_STATUS atcab_sha_end(uint8_t *digest, uint16_t length, const uint8_t *message);
ATCA_STATUS atcab_sha(uint16_t length, const uint8_t *message, uint8_t *digest);
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* ATCA_BASIC_H_ */ | 47.875912 | 137 | 0.805458 |
263a385162e37cb0fe1d5d2baa635c5ee0fe6263 | 5,538 | java | Java | camel-k-loader-js/deployment/src/main/java/org/apache/camel/k/loader/js/quarkus/deployment/JavaScriptProcessor.java | dhirajsb/camel-k-runtime | a4d097dd3628e60b325f769532653f59e9228db4 | [
"Apache-2.0"
] | null | null | null | camel-k-loader-js/deployment/src/main/java/org/apache/camel/k/loader/js/quarkus/deployment/JavaScriptProcessor.java | dhirajsb/camel-k-runtime | a4d097dd3628e60b325f769532653f59e9228db4 | [
"Apache-2.0"
] | 3 | 2021-06-07T13:40:34.000Z | 2021-06-07T13:41:01.000Z | camel-k-loader-js/deployment/src/main/java/org/apache/camel/k/loader/js/quarkus/deployment/JavaScriptProcessor.java | dhirajsb/camel-k-runtime | a4d097dd3628e60b325f769532653f59e9228db4 | [
"Apache-2.0"
] | null | null | null | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF 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 org.apache.camel.k.loader.js.quarkus.deployment;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.Temporal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import org.apache.camel.Exchange;
import org.apache.camel.NamedNode;
import org.apache.camel.builder.DataFormatClause;
import org.apache.camel.builder.ExpressionClause;
import org.apache.camel.k.loader.js.dsl.Components;
import org.apache.camel.k.loader.js.dsl.IntegrationConfiguration;
import org.apache.camel.k.loader.js.dsl.ProcessorSupport;
import org.apache.camel.model.Block;
import org.apache.camel.model.FromDefinition;
import org.apache.camel.model.NoOutputDefinition;
import org.apache.camel.model.OptionalIdentifiedDefinition;
import org.apache.camel.model.ProcessDefinition;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.model.ToDefinition;
import org.apache.camel.model.dataformat.JsonLibrary;
import org.apache.camel.model.language.ExpressionDefinition;
import org.apache.camel.model.rest.RestSecurityDefinition;
import org.apache.camel.model.transformer.TransformerDefinition;
import org.apache.camel.model.validator.ValidatorDefinition;
import org.apache.camel.spi.ExchangeFormatter;
import org.apache.camel.spi.NamespaceAware;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
public class JavaScriptProcessor {
private static final List<Class<?>> JAVA_CLASSES = Arrays.asList(
Character.class,
Byte.class,
CharSequence.class, String.class,
Number.class,
Integer.class,
Long.class,
Float.class,
Double.class,
// Time
Date.class,
Temporal.class,
Instant.class,
Duration.class,
// Containers
Map.class, HashMap.class, TreeMap.class,
List.class, ArrayList.class, LinkedList.class,
Set.class, HashSet.class, TreeSet.class
);
private static final List<Class<?>> CAMEL_REFLECTIVE_CLASSES = Arrays.asList(
ExchangeFormatter.class,
RouteDefinition.class,
ProcessorDefinition.class,
DataFormatClause.class,
FromDefinition.class,
ToDefinition.class,
ExpressionDefinition.class,
ProcessDefinition.class,
ExpressionDefinition.class,
ExpressionClause.class,
Exchange.class,
JsonLibrary.class,
NamedNode.class,
OptionalIdentifiedDefinition.class,
NamespaceAware.class,
Block.class,
RestSecurityDefinition.class,
ValidatorDefinition.class,
TransformerDefinition.class,
NoOutputDefinition.class
);
@BuildStep
void registerReflectiveClasses(
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
CombinedIndexBuildItem combinedIndexBuildItem) {
IndexView view = combinedIndexBuildItem.getIndex();
for (Class<?> type: CAMEL_REFLECTIVE_CLASSES) {
DotName name = DotName.createSimple(type.getName());
if (type.isInterface()) {
for (ClassInfo info: view.getAllKnownImplementors(name)) {
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, info.name().toString()));
}
} else {
for (ClassInfo info: view.getAllKnownSubclasses(name)) {
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, info.name().toString()));
}
}
reflectiveClass.produce(new ReflectiveClassBuildItem(true, type.isEnum(), type));
}
for (Class<?> type: JAVA_CLASSES) {
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, type));
}
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, Components.class));
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, IntegrationConfiguration.class));
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, ProcessorSupport.class));
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, "org.apache.camel.converter.jaxp.XmlConverter"));
}
}
| 39 | 123 | 0.729866 |
7194c7db54827819dc579d584156d63bab6021b8 | 49 | ts | TypeScript | decorators/config/download/index.ts | josepmc/protractor | 1d9d53a77c8361842ca969b4d123a3e655d4d4e1 | [
"MIT"
] | 1 | 2018-07-28T11:31:23.000Z | 2018-07-28T11:31:23.000Z | decorators/config/download/index.ts | josepmc/protractor | 1d9d53a77c8361842ca969b4d123a3e655d4d4e1 | [
"MIT"
] | null | null | null | decorators/config/download/index.ts | josepmc/protractor | 1d9d53a77c8361842ca969b4d123a3e655d4d4e1 | [
"MIT"
] | 1 | 2018-11-20T14:48:43.000Z | 2018-11-20T14:48:43.000Z | export * from './cloud';
export * from './local'; | 24.5 | 24 | 0.612245 |
2d044731655908778318518d67b2063d74979c02 | 1,005 | rs | Rust | build.rs | genofire/tss-sapi | 6a1ae1009b67ea3f960f81515a81fbac8f23d618 | [
"Apache-2.0",
"MIT"
] | 4 | 2020-06-20T22:46:41.000Z | 2022-02-20T19:41:53.000Z | build.rs | genofire/tss-sapi | 6a1ae1009b67ea3f960f81515a81fbac8f23d618 | [
"Apache-2.0",
"MIT"
] | null | null | null | build.rs | genofire/tss-sapi | 6a1ae1009b67ea3f960f81515a81fbac8f23d618 | [
"Apache-2.0",
"MIT"
] | 2 | 2019-11-27T22:17:21.000Z | 2020-02-11T17:08:10.000Z | use std::env;
fn main() {
// link to the SAPI library
println!("cargo:rustc-link-lib=sapi");
// if the user wants to use tcti-socket then link it in
if env::var("CARGO_FEATURE_TCTI_SOCKET").is_ok() {
println!("cargo:rustc-link-lib=tcti-socket");
}
// if the user wants to use tcti-device then link it in
if env::var("CARGO_FEATURE_TCTI_DEVICE").is_ok() {
println!("cargo:rustc-link-lib=tcti-device");
}
// add to the search path anything set in the SAPI_LIBS_PATH
if let Ok(path) = env::var("SAPI_LIBS_PATH") {
println!("cargo:rustc-link-search={}", path);
}
// add to the search path anything set in the TCTI_DEV_LIBS_PATH
if let Ok(path) = env::var("TCTI_DEV_LIBS_PATH") {
println!("cargo:rustc-link-search={}", path);
}
// add to the search path anything set in the TCTI_SOCK_LIBS_PATH
if let Ok(path) = env::var("TCTI_SOCK_LIBS_PATH") {
println!("cargo:rustc-link-search={}", path);
}
}
| 31.40625 | 69 | 0.633831 |
cbf06e66308205274b809c6248af88c241021391 | 532 | kt | Kotlin | openapi-client/kotlin/src/main/kotlin/org/openapitools/client/models/MailLog.kt | interserver/mailbaby-api-samples | 0879348474e22463e77dc76ba5e5f7e6300a2b6c | [
"MIT"
] | null | null | null | openapi-client/kotlin/src/main/kotlin/org/openapitools/client/models/MailLog.kt | interserver/mailbaby-api-samples | 0879348474e22463e77dc76ba5e5f7e6300a2b6c | [
"MIT"
] | 185 | 2022-01-01T23:30:37.000Z | 2022-03-25T01:08:22.000Z | openapi-client/kotlin/src/main/kotlin/org/openapitools/client/models/MailLog.kt | interserver/mailbaby-api-samples | 0879348474e22463e77dc76ba5e5f7e6300a2b6c | [
"MIT"
] | null | null | null | /**
* Mail Baby API
* This is an API defintion for accesssing the Mail.Baby mail service.
*
* The version of the OpenAPI document: 1.0.0
* Contact: detain@interserver.net
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package org.openapitools.client.models
import com.squareup.moshi.Json
/**
* Mail Order Details
* @param id
*/
data class MailLog (
@Json(name = "id")
val id: kotlin.Long? = null
)
| 19.703704 | 91 | 0.704887 |
fb1e4c8316b81d9a41650fe2e4cf3544e416894d | 4,448 | go | Go | upnp/ssdp.go | ethulhu/helix | 0df88b97c21dced74248329ab4b1432fa94a66be | [
"BSD-2-Clause",
"MIT-0",
"MIT"
] | null | null | null | upnp/ssdp.go | ethulhu/helix | 0df88b97c21dced74248329ab4b1432fa94a66be | [
"BSD-2-Clause",
"MIT-0",
"MIT"
] | null | null | null | upnp/ssdp.go | ethulhu/helix | 0df88b97c21dced74248329ab4b1432fa94a66be | [
"BSD-2-Clause",
"MIT-0",
"MIT"
] | null | null | null | // SPDX-FileCopyrightText: 2020 Ethel Morgan
//
// SPDX-License-Identifier: MIT
package upnp
import (
"context"
"encoding/xml"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"github.com/ethulhu/helix/logger"
"github.com/ethulhu/helix/upnp/httpu"
"github.com/ethulhu/helix/upnp/ssdp"
)
const (
discoverMethod = "M-SEARCH"
notifyMethod = "NOTIFY"
ssdpCacheControl = "max-age=300"
)
var (
ssdpBroadcastAddr = &net.UDPAddr{
IP: net.IPv4(239, 255, 255, 250),
Port: 1900,
}
discoverURL = &url.URL{Opaque: "*"}
)
// DiscoverURLs discovers UPnP device manifest URLs using SSDP on the local network.
// It returns all valid URLs it finds, a slice of errors from invalid SSDP responses, and an error with the actual connection itself.
func DiscoverURLs(ctx context.Context, urn URN, iface *net.Interface) ([]*url.URL, []error, error) {
req := discoverRequest(ctx, urn)
rsps, errs, err := httpu.Do(req, 3, iface)
locations := map[string]*url.URL{}
for _, rsp := range rsps {
location, err := rsp.Location()
if err != nil {
errs = append(errs, fmt.Errorf("could not find SSDP response Location: %w", err))
continue
}
locations[location.String()] = location
}
var urls []*url.URL
for _, location := range locations {
urls = append(urls, location)
}
return urls, errs, err
}
// DiscoverDevices discovers UPnP devices using SSDP on the local network.
// It returns all valid URLs it finds, a slice of errors from invalid SSDP responses or UPnP device manifests, and an error with the actual connection itself.
func DiscoverDevices(ctx context.Context, urn URN, iface *net.Interface) ([]*Device, []error, error) {
urls, errs, err := DiscoverURLs(ctx, urn, iface)
var devices []*Device
for _, manifestURL := range urls {
rsp, err := http.Get(manifestURL.String())
if err != nil {
errs = append(errs, fmt.Errorf("could not GET manifest %v: %w", manifestURL, err))
continue
}
bytes, _ := ioutil.ReadAll(rsp.Body)
manifest := ssdp.Document{}
if err := xml.Unmarshal(bytes, &manifest); err != nil {
errs = append(errs, err)
continue
}
device, err := newDevice(manifestURL, manifest)
if err != nil {
errs = append(errs, err)
continue
}
devices = append(devices, device)
}
return devices, errs, err
}
// BroadcastDevice broadcasts the presence of a UPnP Device, with its SSDP/SCPD served via HTTP at addr.
func BroadcastDevice(d *Device, url string, iface *net.Interface) error {
conn, err := net.ListenMulticastUDP("udp", iface, ssdpBroadcastAddr)
if err != nil {
return fmt.Errorf("could not listen on %v: %v", ssdpBroadcastAddr, err)
}
defer conn.Close()
log, _ := logger.FromContext(context.TODO())
log.WithField("httpu.listener", ssdpBroadcastAddr).Info("serving HTTPU")
s := &httpu.Server{
Handler: func(r *http.Request) []httpu.Response {
switch r.Method {
case discoverMethod:
return handleDiscover(r, d, url)
case notifyMethod:
// TODO: handleNotify()
return nil
default:
log, _ := logger.FromContext(r.Context())
log.Warning("unknown method")
return nil
}
},
}
return s.Serve(conn)
}
func discoverRequest(ctx context.Context, urn URN) *http.Request {
req, _ := http.NewRequestWithContext(ctx, discoverMethod, discoverURL.String(), http.NoBody)
req.Host = ssdpBroadcastAddr.String()
req.Header = http.Header{
"MAN": {`"ssdp:discover"`},
"MX": {"2"},
"ST": {string(urn)},
}
return req
}
func handleDiscover(r *http.Request, d *Device, url string) []httpu.Response {
log, _ := logger.FromContext(r.Context())
if r.Header.Get("Man") != `"ssdp:discover"` {
log.Warning("request lacked correct MAN header")
return nil
}
st := URN(r.Header.Get("St"))
ok := false
for _, urn := range d.allURNs() {
ok = ok || urn == st
}
if st == All || ok {
responses := []httpu.Response{{
"CACHE-CONTROL": ssdpCacheControl,
"EXT": "",
"LOCATION": url,
"SERVER": fmt.Sprintf("%s %s", d.ModelName, d.ModelNumber),
"ST": d.UDN,
"USN": d.UDN,
}}
for _, urn := range d.allURNs() {
responses = append(responses, httpu.Response{
"CACHE-CONTROL": ssdpCacheControl,
"EXT": "",
"LOCATION": url,
"SERVER": fmt.Sprintf("%s %s", d.ModelName, d.ModelNumber),
"ST": string(urn),
"USN": fmt.Sprintf("%s::%s", d.UDN, urn),
})
}
return responses
}
return nil
}
| 26.634731 | 158 | 0.652653 |
2a12a840ff775ea8a4890db4bdf46dc71ba34659 | 4,893 | java | Java | rxjava-core/src/main/java/rx/subjects/AsyncSubject.java | MathildeLemee/RxJava | 526d091430572684e426983fa609fe1e843ff5bd | [
"Apache-2.0"
] | null | null | null | rxjava-core/src/main/java/rx/subjects/AsyncSubject.java | MathildeLemee/RxJava | 526d091430572684e426983fa609fe1e843ff5bd | [
"Apache-2.0"
] | null | null | null | rxjava-core/src/main/java/rx/subjects/AsyncSubject.java | MathildeLemee/RxJava | 526d091430572684e426983fa609fe1e843ff5bd | [
"Apache-2.0"
] | 1 | 2019-10-12T14:21:43.000Z | 2019-10-12T14:21:43.000Z | /**
* Copyright 2014 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package rx.subjects;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicReference;
import rx.Notification;
import rx.Observer;
import rx.functions.Action0;
import rx.functions.Action1;
import rx.subjects.SubjectSubscriptionManager.SubjectObserver;
/**
* Subject that publishes only the last event to each {@link Observer} that has subscribed when the
* sequence completes.
* <p>
* <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/S.AsyncSubject.png">
* <p>
* Example usage:
* <p>
* <pre> {@code
*
* // observer will receive no onNext events because the subject.onCompleted() isn't called.
AsyncSubject<Object> subject = AsyncSubject.create();
subject.subscribe(observer);
subject.onNext("one");
subject.onNext("two");
subject.onNext("three");
// observer will receive "three" as the only onNext event.
AsyncSubject<Object> subject = AsyncSubject.create();
subject.subscribe(observer);
subject.onNext("one");
subject.onNext("two");
subject.onNext("three");
subject.onCompleted();
} </pre>
*
* @param <T>
*/
public final class AsyncSubject<T> extends Subject<T, T> {
public static <T> AsyncSubject<T> create() {
final SubjectSubscriptionManager<T> subscriptionManager = new SubjectSubscriptionManager<T>();
final AtomicReference<Notification<T>> lastNotification = new AtomicReference<Notification<T>>(new Notification<T>());
OnSubscribe<T> onSubscribe = subscriptionManager.getOnSubscribeFunc(
/**
* This function executes at beginning of subscription.
*
* This will always run, even if Subject is in terminal state.
*/
new Action1<SubjectObserver<? super T>>() {
@Override
public void call(SubjectObserver<? super T> o) {
// nothing to do if not terminated
}
},
/**
* This function executes if the Subject is terminated.
*/
new Action1<SubjectObserver<? super T>>() {
@Override
public void call(SubjectObserver<? super T> o) {
// we want the last value + completed so add this extra logic
// to send onCompleted if the last value is an onNext
emitValueToObserver(lastNotification.get(), o);
}
}, null);
return new AsyncSubject<T>(onSubscribe, subscriptionManager, lastNotification);
}
protected static <T> void emitValueToObserver(Notification<T> n, Observer<? super T> o) {
n.accept(o);
if (n.isOnNext()) {
o.onCompleted();
}
}
private final SubjectSubscriptionManager<T> subscriptionManager;
final AtomicReference<Notification<T>> lastNotification;
protected AsyncSubject(OnSubscribe<T> onSubscribe, SubjectSubscriptionManager<T> subscriptionManager, AtomicReference<Notification<T>> lastNotification) {
super(onSubscribe);
this.subscriptionManager = subscriptionManager;
this.lastNotification = lastNotification;
}
@Override
public void onCompleted() {
Collection<SubjectObserver<? super T>> observers = subscriptionManager.terminate(new Action0() {
@Override
public void call() {
}
});
if (observers != null) {
for (Observer<? super T> o : observers) {
emitValueToObserver(lastNotification.get(), o);
}
}
}
@Override
public void onError(final Throwable e) {
Collection<SubjectObserver<? super T>> observers = subscriptionManager.terminate(new Action0() {
@Override
public void call() {
lastNotification.set(Notification.<T> createOnError(e));
}
});
if (observers != null) {
for (Observer<? super T> o : observers) {
emitValueToObserver(lastNotification.get(), o);
}
}
}
@Override
public void onNext(T v) {
lastNotification.set(Notification.createOnNext(v));
}
} | 34.216783 | 158 | 0.622318 |
febd46be0e521d2eab08a1cf246bc71b683d8d31 | 3,521 | kt | Kotlin | app/src/main/java/xyz/louischan/shogiboard/MainActivity.kt | louisch/ShogiBoard | f8ccc84392ccdab92b3cdae01142aa350a01a2a6 | [
"MIT"
] | null | null | null | app/src/main/java/xyz/louischan/shogiboard/MainActivity.kt | louisch/ShogiBoard | f8ccc84392ccdab92b3cdae01142aa350a01a2a6 | [
"MIT"
] | null | null | null | app/src/main/java/xyz/louischan/shogiboard/MainActivity.kt | louisch/ShogiBoard | f8ccc84392ccdab92b3cdae01142aa350a01a2a6 | [
"MIT"
] | null | null | null | package xyz.louischan.shogiboard
import android.animation.ObjectAnimator
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import android.os.Build
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.view.LayoutInflater
import android.widget.FrameLayout
import android.widget.RelativeLayout
import android.widget.TextView
import xyz.louischan.shogiboard.R.layout.piece
class MainActivity : AppCompatActivity() {
lateinit var model: BoardViewModel
val pieceMap = hashMapOf<String, PieceView>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val layout = findViewById<RelativeLayout>(R.id.main_layout)
model = ViewModelProviders.of(this).get(BoardViewModel::class.java)
renderPieces(model.board.allPieces(), layout)
model.observeMoves { piece: Piece ->
movePiece(piece)
}
}
private fun renderPieces(pieces: Iterable<Piece>, layout: RelativeLayout) {
for (piece in pieces) {
layout.addView(PieceView(piece).view)
}
}
private fun movePiece(piece: Piece) {
val pieceView = pieceMap[piece.identifier()]
if (pieceView != null) {
movePieceTo(pieceView.view, piece.coords)
}
}
fun movePieceTo(piece: RelativeLayout, coords: ShogiCoordinate) {
val dimens = CoordsAsDimens(coords)
if (dimens.file > 0) {
ObjectAnimator.ofFloat(piece, "x", dimens.leftMargin.toFloat()).apply {
duration = 2000
start()
}
}
if (dimens.rank > 0) {
ObjectAnimator.ofFloat(piece, "y", dimens.topMargin.toFloat()).apply {
duration = 2000
start()
}
}
}
inner class PieceView(piece: Piece) {
val view: RelativeLayout = layoutInflater.inflate(R.layout.piece, null) as RelativeLayout
val identifier: String = piece.identifier()
init {
view.findViewById<TextView>(R.id.piece_text).text = getString(piece.type)
val dimens = CoordsAsDimens(piece.coords)
val layoutParams =
FrameLayout.LayoutParams(
resources.getDimension(R.dimen.piece_width).toInt(),
resources.getDimension(R.dimen.piece_height).toInt()).also {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
it.marginStart = dimens.leftMargin
}
it.leftMargin = dimens.leftMargin
it.topMargin = dimens.topMargin
}
view.layoutParams = layoutParams
if (piece.owner == WHITEPLAYER()) {
view.rotation = 180.0f
}
pieceMap[identifier] = this
}
}
inner class CoordsAsDimens(coords: ShogiCoordinate) {
val file = coords.getIndFile()
val rank = coords.getIndRank()
val leftMargin = resources.getDimension(R.dimen.piece_topleft_leftMargin).toInt() +
file * resources.getDimension(R.dimen.piece_file_separation).toInt()
val topMargin = resources.getDimension(R.dimen.piece_topleft_topMargin).toInt() +
rank * resources.getDimension(R.dimen.piece_rank_separation).toInt()
}
}
| 34.184466 | 97 | 0.619142 |
9fc57a561faedfa510c1746a022ca6173f23f5c8 | 537 | asm | Assembly | oeis/263/A263790.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/263/A263790.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/263/A263790.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A263790: The number of length-n permutations avoiding the patterns 1234, 1324 and 2143.
; Submitted by Christian Krause
; 1,1,2,6,21,75,268,958,3425,12245,43778,156514,559565,2000543,7152292,25570698,91419729,326841561,1168515890,4177649198,14935828405,53398205443,190907947468,682529386598,2440162233937,8724007852045,31189857766034,111509210441322,398664979703373
lpb $0
sub $0,1
add $2,$4
add $2,$1
add $3,$1
mov $5,$1
add $1,$2
add $3,4
add $4,$3
mov $2,$4
sub $4,4
add $4,$5
lpe
mov $0,$1
div $0,4
add $0,1
| 25.571429 | 245 | 0.724395 |