Skip to content

Instantly share code, notes, and snippets.

@Lodo4ka
Lodo4ka / UserList.vue
Created September 16, 2019 15:36
custom table with my sort any data
if (event.target.classList[0] === "points") {
this.toggleSortTable.points ? this.users.sort((a, b) => b.points_earned - a.points_earned) : this.users.sort((a, b) => a.points_earned - b.points_earned);
this.toggleSortTable.points = !this.toggleSortTable.points;
} else if (event.target.classList[0] === "name") {
if(this.toggleSortTable.name) {
this.users.sort(function (a, b) {
if (a.name < b.name) {
return 1;
}
if (a.name > b.name) {
const fn = (f, list) => {
if(list.length === 0) {
return [];
}
const [x, ...xs] = list
return f(x) ? [x, ...fn(f, xs)]: fn(f,xs)
}
const arrEx = [4, 2, 5, 1, 3];
import { getQueue } from '../test/data';
import ExecutorExt from '../test/ExecutorExt';
import { IExecutor } from './Executor';
import ITask from './Task';
export default async function run(executor: IExecutor, queue: Iterable<ITask>, maxThreads = 0) {
maxThreads = Math.max(0, maxThreads);
/**
* Код надо писать сюда
* Тут что-то вызываем в правильном порядке executor.executeTask для тасков из очереди queue
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": false
},
"css.fileExtensions": ["css", "scss", "less"],
"editor.quickSuggestions": {
@Lodo4ka
Lodo4ka / settings.json for linux vs code
Created July 24, 2019 08:26
config vs code for linux development javascript
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"editor.formatOnSave": false,
// "css.fileExtensions": [
// "css",
// "scss",
// "less"
// ],
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"editor.formatOnSave": false,
// "css.fileExtensions": [
// "css",
// "scss",
// "less"
// ],
@Lodo4ka
Lodo4ka / customValidation.js
Created July 17, 2019 09:36
custom directive angularjs for replace input with only numbers
(function() {
angular.module("BauVoiceApp").directive("customValidation", function() {
return {
require: "ngModel",
link: function(scope, element, attrs, modelCtrl) {
modelCtrl.$parsers.push(function(inputValue) {
const numberPattern = /\d+/g;
let transformedInput = inputValue.match(numberPattern)[0];
if (transformedInput != inputValue) {
modelCtrl.$setViewValue(transformedInput);
@Lodo4ka
Lodo4ka / get list directive on element angualarjs
Created July 10, 2019 08:06
angularjs injector describe directive on element
let a = angular.element($0).injector();
a.get("formDirective");
function maybe(fn)
return function _maybe(...args) {
// Note that the == is deliberate.
if ((args.length === 0) || args.some(a => (a == null)) {
return undefined;
}
return fn.apply(this, args);
}
}
@Lodo4ka
Lodo4ka / gist:78e8bd9b606e56c83c5f6b2bea2791aa
Created July 6, 2019 13:14
sort table by javascritp with number and characters
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<style>
th {
cursor: pointer;
}