- login to 'AWS Management Console' (https://aws.amazon.com/console/)
- from 'Services'(in navbar) choose 'EC2'
- from 'Create Instance' section, click on 'Launch Instance'
- then select 'AMI' (Amazon Machine Image), we will be using 'Ubuntu Server 16.04 LTS (HVM)' as example
- select 'Instance Type' as per your requirement
- then click 'Next:Configure Instance Details' to continue
change 'Configure Instance Details' or used as default settings
This file contains hidden or 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
// I extracted this logic from a suite of contracts I wrote in Huff meant to perform swaps as part of an AMM system. | |
// This is just provide an example of how your can write smart contracts at assembly level by simply manipulating the stack and calling opcodes. | |
// This is for learning purposes only | |
// Swap function | |
#define function swap() nonpayable returns () | |
// These constants will be replaced by the actual values during deploy time | |
#define constant OWNER = 0x6dc63ab72c3b163f71ce602ea2727307cf9a40402cd20689e35f0aa0eb82b586 |
This file contains hidden or 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
class Robot | |
MOVEMENTS = ['N', 'E', 'W', 'S'] | |
ACTIONS = ['G', 'D'] | |
CRATES_POSITIONS = [] | |
@length = 10 | |
@width = 10 | |
@is_lifting = false |
This file contains hidden or 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
# Clean backslash characters | |
def clean_str(str) | |
new_str = [] | |
str.chars.each do |char| | |
if char == "\\" | |
next | |
end | |
new_str << char | |
end |
This file contains hidden or 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
def filter | |
# receive params | |
allowed_constant_params = %w(property_type listing_type_id rooms bathrooms location) | |
allowed_varying_params = %w(price) | |
query = "" | |
allowed_constant_params.each do |param| | |
unless params[param] == "" | |
if query.empty? | |
query.concat("SELECT * FROM properties WHERE #{param} = '#{params[param]}'") |
This file contains hidden or 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
function validateEmail(email) { | |
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | |
if (email.match(re)) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
This file contains hidden or 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
var phoneno = /^(07)([0-9|7])(\d){7}$/; | |
if (phonenumber.match(phoneno)) { | |
return true; | |
} else { | |
return false; | |
} |