Skip to content

Instantly share code, notes, and snippets.

import './App.css';
import {useGeolocated} from "react-geolocated";
function App() {
const { coords, isGeolocationAvailable, isGeolocationEnabled } =
useGeolocated({
positionOptions: {
enableHighAccuracy: false,
},
userDecisionTimeout: 5000,

Git rules

Before starting ANY work

  1. git pull -a

And then start your work.

Saving your work

  1. git add .
  2. git commit -m "<message here>"
  3. git push
// Problem 17: [Number letter counts]
///
/// [Number letter counts]: https://projecteuler.net/problem=17
///
/// <p>If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.</p>
/// <p>If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? </p>
/// <br /><p class="note"><b>NOTE:</b> Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.</p>
///
/// Answer: todo!()
pub fn problem_17(max: u32) -> u32 {
---
- name: Enable internet services
hosts: serverb.lab.example.com
become: yes
tasks:
- name: Installs required packages
yum:
name:
- firewalld
- httpd
// test_case_name , function_name , input_to_function , expected_output
// test_kattis_wheresmyinternet_1, wheresmyinternet, "2 1\n2 1".to_string() , "Connected".to_string();
// test_kattis_wheresmyinternet_2, wheresmyinternet, "6 4\n1 2\n2 3\n3 4\n5 6".to_string(), "5\n6".to_string();
// test_kattis_wheresmyinternet_3, wheresmyinternet, "4 3\n2 3\n4 2\n3 4".to_string() , "2\n3\n4".to_string();
pub fn wheresmyinternet(input: String) -> String {
let mut lines = input.split('\n');
let (first, rest) = (lines.next().unwrap().to_owned(), lines);
let (no_houses, _) = first.split_once(' ').unwrap();
let no_houses = no_houses.parse::<usize>().unwrap();
# our algorithm first finds the next required number and then adds it to the score
# so we need to subtract from the number we initially want to add
# we need first even to be 2, so we subtract 2 from 2
current_even = 2 - 2
# we need first odd to be 1, so we subtract 2 from 1
current_odd = 1 - 2
# we need first prime to be 2, so we subtract 1 from 2
current_prime = 2 - 1
# according to the problem statement, the score starts at 0
use std::collections::HashMap;
#[derive(Debug, Clone)]
pub enum Token<'a> {
Word(&'a str, bool),
Colon,
Negation,
Whitespace,
Empty,
}
class Vec2 {
/*
* A 2D vector
* @param x The x coordinate
* @param y The y coordinate
*/
constructor(public x: number, public y: number) {}
}
class Line {
class Vec2 {
/*
* A 2D vector
* @param x The x coordinate
* @param y The y coordinate
*/
constructor(x, y) {
this.x = x
this.y = y
}
use makepad_widgets::KeyCode::ReturnKey;
use makepad_widgets::*;
#[derive(Live)]
pub struct App {
#[live]
ui: WidgetRef,
#[rust]
input: Option<String>,