Skip to content

Instantly share code, notes, and snippets.

View dastagirkhan's full-sized avatar
🎯
Focusing

dastagirkhan dastagirkhan

🎯
Focusing
  • Symamobile
  • Paris, France
View GitHub Profile
var body = document.querySelector('body');
// Create a manager to manager the element
var manager = new Hammer.Manager(body);
// Create a recognizer
var Swipe = new Hammer.Swipe();
// Add the recognizer to the manager
manager.add(Swipe);
@dastagirkhan
dastagirkhan / Ballot.sol
Created July 22, 2022 15:47
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.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/// @title Voting with delegation.
contract Ballot {
// This declares a new complex type which will
// be used for variables later.
// It will represent a single voter.
struct Voter {
uint weight; // weight is accumulated by delegation
bool voted; // if true, that person already voted
@dastagirkhan
dastagirkhan / CounterInterface.sol
Created July 22, 2022 14:14
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.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Counter {
uint public count;
function increment() external {
count += 1;
}
}
@dastagirkhan
dastagirkhan / CattleAbstract.sol
Created July 22, 2022 14:14
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.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract Animal {
string name;
constructor (string memory n){
name = n;
}
@dastagirkhan
dastagirkhan / Bank.sol
Created July 20, 2022 15:01
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.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Bank {
uint depositAmount = 0;
address payable receiver;
address owner;
event logDepositAmount(uint);
constructor(){
@dastagirkhan
dastagirkhan / School.sol
Created July 20, 2022 10:44
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.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Strings.sol";
contract School {
address owner;
constructor() public{
owner = msg.sender;
}
@dastagirkhan
dastagirkhan / RandomPractise.sol
Created July 18, 2022 15:09
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.8.0+commit.c7dfd78e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract RandomPractise{
}
var $vat = 20;
var $vat_divisor = 1 + ($vat/100);
var $price_gross = 5;
var $price_net = ($price_gross/$vat_divisor).toFixed(2);
@dastagirkhan
dastagirkhan / vat.php
Last active September 17, 2021 10:20
<?php
// get net price
$vat = 20;
$vat_divisor = 1 + ($vat/100);
$price_gross = 5;
$price_net = number_format($price_gross/$vat_divisor,2);
//Adding VAT to the price of a product
//The VAT rate / percentage.
$vat = 20;
@dastagirkhan
dastagirkhan / snippets.js
Last active October 1, 2018 09:27
JS: snippets
// Test for existence of nested JavaScript object key
function checkNested(obj) {
var args = Array.prototype.slice.call(arguments, 1);
for (var i = 0; i < args.length; i++) {
if (!obj || !obj.hasOwnProperty(args[i])) {
return false;
}
obj = obj[args[i]];
}