Skip to content

Instantly share code, notes, and snippets.

@asm-jaime
asm-jaime / average_fw.cpp
Created November 14, 2016 05:12
Average occurrence of the first word in sentence
#include <iostream>
#include <regex>
using namespace std;
int main()
{
regex sentense_regex("[^!?.]+");
string all_str;
string cmp_str;
@asm-jaime
asm-jaime / shit_cast.js
Created October 2, 2016 14:13
resolve summ without cast (]:_>)
'use strict'
const super_cast = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
const convert = (arr_char) => {
let real_num = 0;
for (let i = 0; i < arr_char.length; ++i) {
real_num = real_num + Math.pow(10, i) * super_cast.indexOf(arr_char[i]);
};
return real_num;
}
@asm-jaime
asm-jaime / win10_ssd.md
Created September 25, 2016 11:51
how to configure windows 10 with ssd
  1. powercfg -h off
  2. disable indexation disk->options->allow the index file...
  3. disable Superfetch in control services
@asm-jaime
asm-jaime / E212.md
Created September 25, 2016 08:16
vim, if error when you save a file.

: w !sudo tee % &gt; /dev/null

@asm-jaime
asm-jaime / signs_digits .c
Last active September 20, 2016 20:19
place plus/minus signs between the digits (on C)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int current_sum = 0;
/* return pointer on vector with random numbers*/
int* get_rnd1d_vector(const int *count_num, const int *max_num){/*{{{*/
int* vector = malloc((*count_num) * sizeof(int));
for (int i = 0; i < (*count_num); ++i)
@asm-jaime
asm-jaime / css-to-react-inline-css.md
Last active September 12, 2016 20:19
regular expression (regExp, vim), convert easy css to react inline-css
  1. %s/\(-\)\(\w\)/\U\2/g - replace something like font-size to fontSize
  2. %s/\(: \)\(.\+\);/\1"\2",/g - replace something like 25px; to "25px", fontSize
@asm-jaime
asm-jaime / enum_obj.js
Created August 29, 2016 21:12
enumeration object (JavaScript)
const abstract_object = {
first_pro : "first",
second_pro : "second",
third_pro : "third"
};
Object.keys(abstract_object).map((num, index) => {
abstract_object[num] = index+1;
});
console.log(abstract_object);
@asm-jaime
asm-jaime / rating_in_shool.js
Created August 27, 2016 11:44
best learner in school, without sort
"use strict";
const shool_rating = [
"Вова Петькин 2 2 3",
"Митька Залупкин 2 2 2",
"Антон Газенвагович 5 5 3",
"Антон Залупкин 2 2 3",
"Вова Залупкин 2 4 3",
"Вова Петькин 3 3 2"
];
@asm-jaime
asm-jaime / upd_object.js
Created August 17, 2016 16:49
updating array objects from otcher objects on id
'use strict'
const objects = [{
channel: {
id: "first"
}
}, {
channel: {
id: "second",
props: "old value"
@asm-jaime
asm-jaime / .editorconfig
Created August 16, 2016 15:16
.editorconfig use config with vim for jsbeautify
;.editorconfig
root = true
[**.js]
; path to optional external js beautifier, default is vim-jsbeautify/plugin/lib
path=/usr/local/lib/node_modules/js-beautify/js/lib/beautify.js
; Javascript interpreter to be invoked by default 'node'
bin = node
e4x = true