Skip to content

Instantly share code, notes, and snippets.

Avatar
😉
On vacation

Viktor Knyazik01

😉
On vacation
View GitHub Profile
View index1.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
function addClass(obj, cls) {
var classes = obj.className ? obj.className.split(' ') : [];
View 2-1findPrimes.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>findPrimes(a, b)</title>
</head>
<script>
function findPrimes(min, max) {
var sieve = [], i, j, primes = [], ans = [];
View 00.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Завдання 0</title>
</head>
<script>
function pow(x, n) {
var result = 1;
for (var i = 0; i < n; i++) {
@Knyazik01
Knyazik01 / 155.py
Last active Feb 9, 2019
Идея: создание строки, путем перебора символов исходной строки и счетчика, затем сравнение длин полученой и исходной строк и выводом кратчайшей.
View 155.py
##155 Python https://tgraph.io/Anons-155-Algoritm-szhatiya-RLE-02-05
string = str(input('Введите строку: '))
string += ' '
string2 = ''
j = 1
for i in range(len(string)):
if i == len(string) - 1:
break
else:
if string[i] == string[i+1]:
@rproenca
rproenca / Clipboard.js
Last active Aug 25, 2021
Copy text to clipboard using Javascript. It works on Safari (iOS) and other browsers.
View Clipboard.js
window.Clipboard = (function(window, document, navigator) {
var textArea,
copy;
function isOS() {
return navigator.userAgent.match(/ipad|iphone/i);
}
function createTextArea(text) {
textArea = document.createElement('textArea');
@gregnavis
gregnavis / sudoku.rb
Created Apr 13, 2013
A simple Sudoku solver in Ruby.
View sudoku.rb
class Sudoku
SIZE = 9
NUMBERS = (1..9).to_a
def initialize
@board = Array.new(SIZE) { Array.new(SIZE, nil) }
end
def [](x, y)
@board[y][x]