This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
class AdminController extends Controller | |
{ | |
public function imageFillToSquare(Request $request){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lsMessages = { | |
}; | |
function pleaseRegister(msg) { | |
return sendMessageAndClear('register', msg, bot.sendMessage(msg.chat.id, `Please register in bot`, {parse_mode: 'HTML'})); | |
} | |
function alreadyRegistered(msg) { | |
return sendMessageAndClear('register', msg, bot.sendMessage(msg.chat.id, `You already registered`, {parse_mode: 'HTML'})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract PolygonChecker { | |
struct PolygonData { | |
int256[2][] points; | |
} | |
mapping(uint256 => PolygonData) polygons; | |
function addPolygonPoint(uint256 polygonId, int256[2] memory point) public { | |
polygons[polygonId].points.push(point); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library PolygonUtils { | |
struct PolygonData { | |
int256[2][] points; | |
} | |
function isInsidePolygon(PolygonData storage _polygon, int256[2] memory _point) public view returns (bool) { | |
bool inside = false; | |
uint256 j = _polygon.points.length - 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "./PolygonUtils.sol"; | |
contract PolygonChecker { | |
mapping(uint256 => PolygonUtils.PolygonData) polygons; | |
function addPolygonPoint(uint256 polygonId, int256[2] memory point) public { | |
polygons[polygonId].points.push(point); | |
} | |
function isInsidePolygonById(int256[2] memory _point, uint256 _polygonId) public view returns (bool) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const Table = require('cli-table'); | |
const table = new Table({ | |
head: ['Contract', 'Size (bytes)'], | |
colWidths: [50, 15] | |
}); | |
const testFolder = './build/contracts/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: @openzeppelin/contracts/GSN/Context.sol | |
pragma solidity ^0.5.0; | |
/* | |
* @dev Provides information about the current execution context, including the | |
* sender of the transaction and its data. While these are generally available | |
* via msg.sender and msg.data, they should not be accessed in such a direct | |
* manner, since when dealing with GSN meta-transactions the account sending and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
createdb my_database | |
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';" | |
sudo apt install pgloader | |
mysql -uroot -proot -e "SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));" | |
pgloader --with "quote identifiers" mysql://root:root@localhost/my_database postgresql:///my_database | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.2; | |
/** | |
* @title Roles | |
* @dev Library for managing addresses assigned to a Role. | |
*/ | |
library Roles { | |
struct Role { | |
mapping (address => bool) bearer; | |
} |
NewerOlder