Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am magmel48 on github.
  • I am magmel48 (https://keybase.io/magmel48) on keybase.
  • I have a public key ASDLyhlA9QhIewZsAFCHSQxT7aVxp0c-FPQChVCrHIfpLgo

To claim this, I am signing this object:

const fs = require('fs');
const dict = fs.readFileSync('./RusS.txt', { encoding: 'utf8' }).split('\r\n');
const LAST_FIELD_INDEX = 4;
const MINIMAL_WORD_LENGTH = 3;
const MAXIMAL_TRIES = 25000;
const letters = [
'кийые',
'исряк',
@magmel48
magmel48 / VBA
Last active May 12, 2017 18:50
VBA
Dim text As String
Dim d As Date
Dim y As Integer
text = "28.02.1899"
If IsDate(text) Then
'Date is correct, let's check validity: date more than 1900 and less than 2010
d = CDate(text)
y = Year(d)
"""
Write a class representing two-dimensional vector (with x and y coordinates),
which supports the following operations:
1. Addition of two vectors: v1 + v2
2. Subtraction of two vectors: v1 - v2
3. Dot product of two vectors:
a. Using operator v1 * v2
b. Using method v1.dot(v2)
c. Using class method Vector2d.dot(v1, v2)
4. Vector length property:
@magmel48
magmel48 / c
Created March 15, 2016 17:08
parser
#include "parser.h"
char* substring(char *src, int start, int length) {
char* res = (char *)malloc(sizeof(char) * (length + 1));
if (res == NULL)
{
return NULL;
}
memcpy(res, src + start, length);
atom
@magmel48
magmel48 / taylor.cpp
Last active September 14, 2015 18:37
#include <stdio.h>
#include <math.h>
#include <conio.h>
#define PI 3.1415926
double mysin(double n)
{
if (n >= 0) {
while (n >= 1) {
@magmel48
magmel48 / factory
Created December 31, 2014 09:50
factory
angular
.module('app')
.factory('staffFactory', [
'$http', 'staffUrl',
($http, staffUrl) ->
class getStaff
constructor: () ->
$http
.jsonp(staffUrl + '?callback=JSON_CALLBACK')
.then(success)
@magmel48
magmel48 / segment.cpp
Created November 30, 2014 15:52
segment
float[] segment() {
float min = 0.0f;
float max = 0.0f;
float num = 0.0f;
do {
cin >> num;
if (num > max) max = num;
if (num < min) min = num;
} while (abs(num) > FLT_EPSILON);
@magmel48
magmel48 / solve problem
Created October 19, 2014 11:49
for alexander
#include <iostream>
#include <vector>
#include <map>
int main (void) {
int arr[] = {1, 2, 3, 4, 5, 4, 3, 2, 2, 1, 1, 2, 2, 2};
std::vector<int> source (arr, arr + sizeof(arr) / sizeof(arr[0]));
std::map<int, int> result;
std::map<int, int>::iterator iter;