Skip to content

Instantly share code, notes, and snippets.

View Hateman31's full-sized avatar
🏠
Working from home

Hateman31

🏠
Working from home
  • Russian Federation
View GitHub Profile
@Hateman31
Hateman31 / README
Last active February 17, 2020 14:21
sum pairs
We have a vector of integer numbers. Size of this vector between 1 and 4.
And we need write function which transformate that vector on way like this:
[2 2 2 2] => [4 4]
[4 2 2] => [4 4]
[2 2 4] => [4 4]
[2 2 2] = [4 2]
[2 4 2 4] => [2 4 2 4]
[2 4 2] => [2 4 2]
[2 4 2 2] = [2 4 4]
@Hateman31
Hateman31 / core.clj
Created December 22, 2019 08:53
Pascal triangle
(ns main.core)
(defn recur-call [f x n]
(if (= n 1)
(f x)
(recur-call f (f x) (dec n))))
(defn sum-pairs [row]
(mapv + row (rest row)))
@Hateman31
Hateman31 / index.php
Created November 5, 2018 16:56
editable table
<!--
index.html
Copyright 2017 vlad <vlad@vlad-Presario-CQ58-Notebook-PC>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@Hateman31
Hateman31 / index.html
Last active September 9, 2018 21:18
vue editable field
<script type="text/x-template" id="cell-template">
<div>
<span
v-show="edit == false"
@click="$emit('set-focus', cell)"
>{{cell.value}}</span>
<input
v-show="edit == true"
v-model="cell.value"
>
@Hateman31
Hateman31 / index.php
Created July 28, 2018 17:33
CatalogViewer
<?php
require_once('utils.php');
$table = json_decode('[
{
"id": 1,
"parent": 0,
"name": "Каталог",
"path": "catalog",
@Hateman31
Hateman31 / app.js
Last active December 30, 2017 08:14
Editable table
window.onload= function(){
var stringCell = function(field,value){
return {field:field,value:value,edit:false,type:'string'}
};
var binaryCell = function(field,value = 0){
return {field:field,value:value,edit:value == 0 ? true: false,type:'binary'}
}
$mask = "SELECT
l.UID
, l.Tel
, l.Region
, l.service_base
, t.NResult
, sd_sex$
, sd_age$
, l.service_blocked
, l.service_dtimport
@Hateman31
Hateman31 / case_generator.py
Last active November 25, 2016 14:59
generating case-expression
import unittest
def get_cases(fields):
res = []
return res
def get_fields_from_str():
pass
/my_project
__init__.py
/foo
__init__.py
bar.py
/test
__init__.py
test.py
import random
def get_current_values(number,values):
while values:
value = values.pop(-1)
if number//value:
values.append(value)
return values
def print_row(row):