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
[
{
"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"
}
],
@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.`);
module.exports.noSql = {
dbo: null,
connectionDB: function () {
if(!this.dbo){
this.dbo = db.db("mydb");
}
},
setDB: function (param) {
this.connectionDB();
// 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')
//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')
// (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)
@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
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 / 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;
@koras
koras / test.js
Created June 30, 2018 13:55
test Safe
const expectRevert = require('./assertRevert');
const ABI_tkn = require('./ABI_token');// remote token
var Web3 = require('web3');
const Safe = artifacts.require("./Safe.sol");
// use the given Provider, e.g in Mist, or instantiate a new websocket provider
var web3 = new Web3(Web3.givenProvider || 'http://127.0.0.1:8545');
var GasCost = 470000;
var gasPrice_value = 200000000000;
let meta;