Skip to content

Instantly share code, notes, and snippets.

View tabman83's full-sized avatar
🎯
Focusing

Antonino Parisi tabman83

🎯
Focusing
  • ESW
  • Dublin, Ireland
View GitHub Profile
@tabman83
tabman83 / CoffeeMachine.cs
Last active January 24, 2025 23:08
Microsoft Interview OOP question
/*
Problem;
Object Oriented Design -
Design a coffee maker machine class There is a coffee maker with a screen. We need to add three ingredients into the machine: coffee beans, water and milk.
There are three types of drinks we can make, below are the default recipes:
Espresso: cost 3 coffee beans and 1 water
Americano: cost 2 coffee beans and 3 water
Latte: cost 2 coffee beans, 2 milk and 2 water
When a user comes, on the screen we show available drinks. After the user chooses a drink, the user will be able to customize the amount of ingredients. (For example, after choosing Espresso, the user can change from default to 4 coffee beans and 1 water)
The admin is able to refill the ingredients. The admin and the users interact with the machine via the screen. In the future, we might can support more drink types.
<?xml version="1.0" encoding="utf-8"?>
<Page
x:Class="ConfluentBrowser.Pages.TopicsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="using:ConfluentBrowser.Models"
xmlns:viewmodels="using:ConfluentBrowser.ViewModels" d:DataContext="{d:DesignInstance Type=viewmodels:TopicsViewModel}"
mc:Ignorable="d">
@tabman83
tabman83 / mikrotik-ddns
Created March 28, 2022 22:39
DDNS script for Mikrotik RouterOS
:global ddnsuser "<ddns username>"
:global ddnspass "<ddns password>"
:global theinterface "<public interface name, i.e.: ether1>"
:global ddnshost "<host name to update>"
:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:log info "ddns: running for google-domains"
:if ([ :typeof $ipfresh ] = nil ) do={
:log info ("ddns: no IP address on $theinterface .")
} else={
;ES6 => Data una stringa contare il numero di i caratteri
;(versione complicata con immissione da tastiera e stampa
; a video non richieste nel testo dell'esercizio)
.data
;parametri per la syscall 5
fmt: .asciiz "La stringa '%s' contiene %d caratteri"
fmt_addr: .space 8
str: .space 8
string compress(string input) 
{
	string result = "";
	
	char lastChar = input[0];
	int count = 1;
	for(int i=1; i<input.Length; i++)
	{
 if( input[i] == lastChar )
string rot13(string input) 
{
	string result = "";
	
	char[] skip = new char[] {' ',',','.' };
	
	
	foreach( char c in input )	
	{
@tabman83
tabman83 / getContrast50
Created November 21, 2014 13:40
Gets a contrasting black or white given a color
function getContrast50(hexcolor){
return (parseInt(hexcolor, 16) > 0xffffff/2) ? 'black':'white';
}
html,
body
{
height: 100%;
}
body
{
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-shadow: -0.5px -0.5px #444;
margin: 0px;
<!doctype html>
<html lang=en-us>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Intercom | Your inbox</title>
<meta name="description" content="Intercom - your inbox">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" src="http://normalize-css.googlecode.com/svn/trunk/normalize.min.css">
// let 'students' be the JSON you provided
var sortedStudents = students.sort( function(s1, s2) {
var s1 = s1.name.split(' ')[1];
var s2 = s2.name.split(' ')[1];
return s1.localeCompare(s2);
});