Skip to content

Instantly share code, notes, and snippets.

View koras's full-sized avatar
🏠
Working from home

Константин koras

🏠
Working from home
View GitHub Profile
@koras
koras / test.sol
Created July 5, 2018 17:02
getSireList
function getSireList(uint page, uint indexBunny)
public view returns(
uint32[12] rabbitID,
uint[12]currentPriceBids,
uint elementEnd,
uint elementTotal
) {
uint32 bunnyID = 0;
uint pagecount = 12;
pragma solidity ^0.4.23;
/// @title Interface new rabbits address
contract FromInterface {
function getBunny(uint32 _bunny) public view returns(
uint32 mother,
uint32 sire,
uint birthblock,
uint birthCount,
uint birthLastTime,
@koras
koras / sire
Created October 23, 2018 22:50
sire bunny
2=20000000000000000
4=6000000000000000
6=5001000000000000
7=5100000000000000
8=5001000000000000
9=5100000000000000
17=6000000000000000
18=5100000000000000
19=5100000000000000
20=8000000000000000
// (SQL: select (select `user`.`id` from `user` where `user`.`id` in (2013, 2015) limit 1)
// as ff from `user` as `tmp_user`
// where `tmp_user`.`year` in (?, ?))
public function arrayUser(){
$arrayUser = [5,6];
$arrayYear = [2013,2015];
$subSelect = DB::table('user')
->select('user.id')
->wherein('user.id',$arrayUser)
//SQLSTATE[HY093]: Invalid parameter number
// (SQL: select (select `user`.`id` from `user`
// where `user`.`id` in (2013, 2015, ?, ?, ?, ?) limit 1) as ff
// from `user` as `tmp_user` where `tmp_user`.`year` in (?, ?))
$arrayUser = [5,6,7,8,9,10];
$arrayYear = [2013,2015];
$subSelect = DB::table('user')
->select('user.id')
// SQLSTATE[HY093]: Invalid parameter number
// (SQL: select (select `user`.`id` from `user`
// where `user`.`id` in (2013, 2015) limit 1) as ff
// from `user` as `tmp_user`
// where `tmp_user`.`year` in (2016, 2017, 2018, ?, ?))
$arrayUser = [5,6];
$arrayYear = [2013,2015,2016,2017,2018];
$subSelect = DB::table('user')
module.exports.noSql = {
dbo: null,
connectionDB: function () {
if(!this.dbo){
this.dbo = db.db("mydb");
}
},
setDB: function (param) {
this.connectionDB();
@koras
koras / Component
Last active February 12, 2022 21:15
class Component {
constructor() {
if (new.target === Component) {
throw new Error(`Can't instantiate Component, only concrete one.`);
}
}
get template() {
throw new Error(`You have to define template.`);
[
{
"likes": [
{
"name": "Tim Berners-Lee",
"about": "Inventor, scientist",
"avatar": "https://media.wired.com/photos/5c86f3dd67bf5c2d3c382474/4:3/w_2400,h_1800,c_limit/TBL-RTX6HE9J-(1).jpg",
"_id": "d285e3dceed844f902650f40"
}
],
/**
* Студент делает длинную проверку и незнает как сократить
* if (popupName.value.length > 1 && popupName.value.length < 31 && ((popupLink.value.slice(0, 7) == "http://" && popupLink.value.length > 7) ||
* (popupLink.value.slice(0, 8) == "https://" && popupLink.value.length > 8))) {
* Ну во первых мы в качестве параметров передаём объекты
* и разбиваем на две функции
*/
function _checkLength(item, min, max) {