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 )
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
| /* | |
| 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. |
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
| <?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"> |
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
| :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={ |
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
| ;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 rot13(string input)
{
string result = "";
char[] skip = new char[] {' ',',','.' };
foreach( char c in input )
{
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 getContrast50(hexcolor){ | |
| return (parseInt(hexcolor, 16) > 0xffffff/2) ? 'black':'white'; | |
| } |
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
| html, | |
| body | |
| { | |
| height: 100%; | |
| } | |
| body | |
| { | |
| font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; | |
| text-shadow: -0.5px -0.5px #444; | |
| margin: 0px; |
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
| <!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"> |
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
| // 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); | |
| }); |
NewerOlder