Skip to content

Instantly share code, notes, and snippets.

View ExtensionMethods.cs
using System;
namespace Project.Extensions
{
public static class LocalDateExtension
{
private static int DayCount(in int month) => (month % 2 != 0) ? 31 : 30;
private static object ValidateNumberOfDays(in int day, in int month)
=> (day > DayCount(month)) ? throw new Exception() : default;
View SimplePerceptron.py
from sklearn.base import BaseEstimator, ClassifierMixin
import numpy as np
class SimplePerceptron(BaseEstimator, ClassifierMixin):
def __init__(self, eta=1.0):
self.class_labels_ = None
self.w_ = None # wagi
self.k_ = None # liczba kroków algorytmu
self.eta_ = eta # współczynnik uczenia
View Password.cs
using System.Linq;
namespace Day2
{
public class Password
{
private PasswordPolicy _policy { get; set; }
private string _password { get; set; }
public Password(PasswordPolicy policy, string password)
@MichaelStett
MichaelStett / activation.sh
Last active Sep 14, 2021
Windows 10 Activation script
View activation.sh
@echo off
title Activate Windows 10 ALL versions for FREE! WireDroid.com&cls&echo ============================================================================&echo #Project: Activating Microsoft software products for FREE without software(WireDroid.com)&echo ============================================================================&echo.&echo #Supported products:&echo - Windows 10 Home&echo - Windows 10 Home N&echo - Windows 10 Home Single Language&echo - Windows 10 Home Country Specific&echo - Windows 10 Professional&echo - Windows 10 Professional N&echo - Windows 10 Education N&echo - Windows 10 Education N&echo - Windows 10 Enterprise&echo - Windows 10 Enterprise N&echo - Windows 10 Enterprise LTSB&echo - Windows 10 Enterprise LTSB N&echo.&echo.&echo ============================================================================&echo Activating your Windows...&cscript //nologo slmgr.vbs /upk >nul&cscript //nologo slmgr.vbs /cpky >nul&wmic os | findstr /I "enterprise" >nul
if %errorlevel% EQU 0 (cscript //no
View script.js
let isEditingAlready = false;
let editedElementId = null;
window.addEventListener('click', (event) => {
if (event.target.type == "text" && (event.target.id !== 'addTodoInput' && event.target.id !== 'searchInput')) {
if (!isEditingAlready)
{
console.log("Start editing...");
event.target.disabled = false;
View script.js
const filterTodoList = (word) =>{
return todos.filter((item) => {
return item.desc.toLowerCase().includes(word.toLowerCase());
});
};
searchInput.addEventListener('input', (event) => {
event.preventDefault();
if (event.target.value.length >= 3){
View script.js
const addTodo = (desc, date) => {
let todo = new Todo(desc, date);
console.log(`Add Task... ${todo.id}`);
todos.push(todo);
localStorage.setItem('todos', JSON.stringify(todos));
// resetowanie wartości pól
addTodoInput.value = addTodoInput.defaultValue;
View script.js
const Todo = class {
constructor(desc, date) {
this.id = Date.now();
this.desc = desc;
this.date = date;
this.completed = 0;
}
}
let todos = [];
View index.html
<div class="container">
<div class="input-group mb-3 mr-auto ml-auto" id="addTaskForm">
<input type="text" class="form-control" placeholder="Search for todo" id="searchInput">
<div class="input-group-append">
<button class="btn btn-primary" type="button">Search</button>
</div>
</div>
<br>
<h3 class="text-center">Todos</h3>
View index.html
<!doctype html>
<html lang="en">
<head>
<title>Todo List</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA==" crossorigin="anonymous" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="an