Skip to content

Instantly share code, notes, and snippets.

@pistol88
pistol88 / ERC20.sol
Created July 17, 2019 09:39
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.2+commit.1df8f40c.js&optimize=false&gist=
pragma solidity ^0.5.0;
import "./IERC20.sol";
import "./SafeMath.sol";
/**
* @dev Implementation of the `IERC20` interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using `_mint`.
@pistol88
pistol88 / ERC20.sol
Created July 17, 2019 09:23
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.2+commit.1df8f40c.js&optimize=false&gist=
pragma solidity ^0.5.0;
import "./IERC20.sol";
import "./SafeMath.sol";
/**
* @dev Implementation of the `IERC20` interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using `_mint`.
@pistol88
pistol88 / ERC20Standard.sol
Created July 16, 2019 14:02
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.7+commit.6da8b019.js&optimize=false&gist=
pragma solidity ^0.5.7;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
@pistol88
pistol88 / Address.sol
Created July 14, 2019 10:24
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.10+commit.5a6ea5b1.js&optimize=false&gist=
pragma solidity ^0.5.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* This test is non-exhaustive, and there may be false-negatives: during the
/** \file */
#ifndef IFPTR_H
#define IFPTR_H
#include "idtobase.h"
#include "abstract__event.h"
namespace TED
{
private static function assertTrueRecaptcha()
{
$recaptcha = $_REQUEST['g-recaptcha-response'];
$secret = '123123123123123123123';
$url = "https://www.google.com/recaptcha/api/siteverify?secret=".$secret ."&response=".$recaptcha."&remoteip=".$_SERVER['REMOTE_ADDR'];
$status = 1;
if(!empty($recaptcha)) {
$curl = curl_init();
if(!$curl) {
@pistol88
pistol88 / php
Created March 27, 2017 13:54
SendMailSmtpClass
class SendMailSmtpClass {
/**
*
* @var string $smtp_username - логин
* @var string $smtp_password - пароль
* @var string $smtp_host - хост
* @var string $smtp_from - от кого
* @var integer $smtp_port - порт
{"order":{"name":"Тест","mobilePhone":"+389999999999","personNumber":1,"standardStick":0,"traineeStick":0,"paymentMethod":"Наличными при получении","price":171,"amount":2,"items":[{"title":"Обакэ","price":"98.00","amount":1,"urlImage":"http://smilefood.od.ua/upload/images/2014/11/c13f8bd623d5e5df43ab935f799fb3cd.jpg","breadType":"","addedIngridients":[]},{"title":"Чириз","price":"73.00","amount":1,"urlImage":"http://smilefood.od.ua/upload/images/2015/07/0dd5320cfbb9b0836bc55ede6d8eac3e.jpg","breadType":"","addedIngridients":[]}],"change":"222","timeDelivery":"","pickUpYourSelfRegion":"Ак. Глушко 29/2","deliveryAddress":{"street":"","houseNumber":"","appartmentNumber":"","privateHouse":"","floor":"","doorPhone":""},"comments":""}}
<div class="heading">Состав заказа</div>
<?php foreach($elements as $elementId => $element) { ?>
<div class=" cart_row">
<div class="cart-cell cart-cell-image" data-role="product-container" data-url="<?=Url::toRoute("/product/quick-view/{$element->getModel()->getCartId()}");?>" style="cursor: pointer;">
<?php if($image = $element->getModel()->getImage()) { ?>
<div>
<img src="<?=$image->getUrl('60x60')?>" width="auto" height="84" alt="<?=Html::encode($element->getModel()->getCartName());?>" style="border:none"/>
</div>
<?php } ?>
</div>
<?php
namespace frontend\controllers;
use yii;
use common\models\Product;
use pistol88\order\models\Order;
use vova07\users\models\backend\User;
use yii\filters\VerbFilter;
class ApiController extends \yii\web\Controller