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 requests | |
from bs4 import Beautifulsoup | |
url = 'https://www.yell.com/ucs/UcsSearchAction.do?' | |
params = { | |
'scrambleSeed': '383401705', | |
'keywords': 'hotel', | |
'location': 'New York' | |
} |
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
from django.dispatch import receiver | |
from allauth.socialaccount.models import SocialAccount | |
from django.db.models.signals import pre_save | |
from .models import Users | |
@receiver(pre_save, sender=SocialAccount) | |
def add_username(*args, kwargs): | |
print('Presave') | |
print(f'args: {args} \n kwargs: {kwargs}') |
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.7.0 <0.9.0; | |
contract HelloWorld { | |
// your contract begin here | |
} |
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
// SPDX-License-Identifier: MIT | |
// compiler version must be greater than or equal to 0.8.3 and less than 0.9.0 | |
pragma solidity ^0.8.3; | |
contract HelloWorld { | |
string public greet = "Hello World!"; | |
} |
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
# code exec | |
if __name__ == "__main__": | |
trans1: str = "Anna send 1 BTC to Feri" | |
trans2: str = "Feri Send 1.3 BTC to Budi" | |
trans3: str = "Bagus Send 3.5 BTC to Hadi" | |
trans4: str = 'Ivan send 5.5 BTC to Feryy' | |
# transaction List | |
transact: list = [trans1, trans2, trans3, trans4] |
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
# getting transaction | |
def get_transaction(self): | |
print(f"block data: {self.block_data}") | |
print(f"block hash: {self.block_hash}") |
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
from hashlib import sha256 | |
class Blockchain: | |
def __init__(self, prev_hash: str, transaction_list: list): | |
self.prev_hash = prev_hash | |
self.transaction_list = transaction_list | |
# block data and concate strings | |
self.block_data = " - ".join(transaction_list) + " - " + prev_hash | |
self.block_hash = sha256(self.block_data.encode()).hexdigest() |
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 'package:flutter/material.dart'; | |
import 'package:provider/provider.dart'; | |
import 'package:providers/providers/products.dart'; | |
import './screens/products_overview_screen.dart'; | |
import './screens/product_detail_screen.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} |
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 'package:flutter/material.dart'; | |
import 'package:provider/provider.dart'; | |
import 'package:providers/providers/products.dart'; | |
import './screens/products_overview_screen.dart'; | |
import './screens/product_detail_screen.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} |
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
// ignore_for_file: deprecated_member_use | |
import 'package:flutter/material.dart'; | |
import '../screens/product_detail_screen.dart'; | |
class ProductItem extends StatelessWidget { | |
final String id; | |
final String title; | |
final String imageUrl; |
NewerOlder