Skip to content

Instantly share code, notes, and snippets.

View fintara's full-sized avatar

Tsvetan fintara

View GitHub Profile
import hashlib
import time
text = "Hello World!"
nonce = 0
difficulty = "0"
start = time.time()
print("Nonce".ljust(16) + "Hash".ljust(70) + "Time")
while True:
import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Startup Name Generator',
@fintara
fintara / isPalindrome.php
Last active August 29, 2015 13:56
Three functions to check whether a number is a palindrome number.
<?php
function isPalindromA($num) {
$num = $num . '';
$len = strlen($num);
for($i = 0; $i < $len / 2; $i++)
if($num[$i] !== $num[$len - 1 - $i])
return false;
return true;
@fintara
fintara / Circle.php
Last active August 29, 2015 13:55
Very, very basic Circle object.
<?php
class Circle {
private $_center;
private $_radius;
public function __construct(Point $center, $radius) {
$this->_center = $center;
$this->_radius = $radius;
}
@fintara
fintara / DecimalToRoman.php
Last active August 29, 2015 13:55
Converts decimal numbers to Roman numerials. Limit [1; 3999]
<?php
/**
* Converts decimal numbers to Roman numerials.
* Limit [1; 3999]
*
* @param integer $n
* @param bool $recursive
* @return string
*/
function decroman($n, $recursive = false) {
@fintara
fintara / PredictTheNumber.php
Created January 20, 2014 18:33
CodeEval competition - Predict The Number. Thanks to ferhatelmas/algo for the idea! Very interesting solution.
<?php
$input = file_get_contents($argv[1]);
$rows = explode("\n", $input);
foreach($rows as $row) {
if($row >= 0 && $row <= 3000000000) {
$bin = decbin($row);
$sum = 0;
@fintara
fintara / Polynomial.php
Last active January 2, 2016 18:18
Polynomial class makes possible to do simple operations like additions, subtractions and multiplications on polynomials.
<?php
/**
* Polynomial class makes possible to do simple operations like additions, subtractions and
* multiplications on polynomials.
*
* There are two ways to initiate a Polynomial object: from string or from array.
*
* @package fintara
* @author Tsvetan Ovedenski <dev@tsovedenski.com>
*/
<?php
/**
* Напишете програма, която намира максимална редица от последователни еднакви елементи в масив.
* Пример: {2, 1, 1, 2, 3, 3, 2, 2, 2, 1} -> {2, 2, 2}.
*/
$array = [2,1,1,2,3,3,2,2,2,1];
//$array = [3,1,1,1,1,1,5,1,1,1,1,2,3,3,3];
$bestStart = 0;
@fintara
fintara / Maze.php
Last active January 1, 2016 20:19
We are given a matrix, in which we should count the steps of a path of a given number.
<?php
/**
* Maze.php
*
* We are given a matrix, in which we should count the steps of a path of a given number.
*
* @author Tsvetan Ovedenski
*/
// matrix
@fintara
fintara / QuickSort.php
Created December 24, 2013 21:45
QuickSort realized in PHP.
<?php
namespace Sort;
class QuickSorter {
private $_array;
public function __construct(array $array) {
$this->_array = $array;
}