This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using MySite.Models; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.EntityFrameworkCore; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def iptoint(ip): | |
h=list(map(int,ip.split("."))) | |
return (h[0]<<24)+(h[1]<<16)+(h[2]<<8)+(h[3]<<0) | |
def inttoip(ip): | |
return ".".join(map(str,[((ip>>24)&0xff),((ip>>16)&0xff),((ip>>8)&0xff),((ip>>0)&0xff)])) | |
iptoint("8.8.8.8") # 134744072 | |
inttoip(134744072) # 8.8.8.8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Command from '@ckeditor/ckeditor5-core/src/command'; | |
export default class EditDailyNoteCommand extends Command { | |
execute() { | |
const editor = this.editor; | |
const model = editor.model; | |
const doc = model.document; | |
const selection = doc.selection; | |
const selectedElement = selection.getSelectedElement(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example of data provided in ckEditor | |
// DATA = '`some text text text and: .... <div class="article-note js-tooltip">листовки<span class="article-note__tooltip"><span class="article-note__body js-tooltip-body" data-referal=""><img src="https://img03.rl0.ru/afisha/290x-/daily.afisha.ru/uploads/images/9/b5/9b50660636a19bb09f4314aa920cda1d.jpg" class="article-note__img js-article-note-img"></span></span></div>`;' | |
import Plugin from '@ckeditor/ckeditor5-core/src/plugin'; | |
import Widget from '@ckeditor/ckeditor5-widget/src/widget'; | |
import CKEditorInspector from '@ckeditor/ckeditor5-inspector'; | |
import {toWidget, toWidgetEditable, viewToModelPositionOutsideModelElement} from "@ckeditor/ckeditor5-widget/src/utils"; | |
const baseEditingCls = 'dailynote'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python -c 'import random; print "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)])' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compose = (f, g) => x => f(g(x)); // Receives functions | |
const join = x => { | |
return y => { | |
if (typeof y === 'string') { | |
y = y.split(); | |
} | |
return y.join(x); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// array_rotate.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы. | |
// | |
#include "pch.h" | |
#include <iostream> | |
using namespace std; | |
void left(int a[], unsigned N) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthorsComponent implements OnInit, OnDestroy { | |
authorsForm: FormGroup; | |
authorsFormArray: FormArray; | |
getAuthorFormField(person?: EntryAuthorRoleViewModel, mainAuthorId?: number) { | |
return this.fb.group({ | |
name: new FormControl(person.author || '', Validators.required), | |
role: new FormControl(person.authorRole || '', Validators.required), | |
isMain: new FormControl(mainAuthorId === person.authorId || false, Validators.required) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
web: | |
restart: "no" | |
command: "echo 'web disabled'" | |
backup: | |
restart: "no" | |
command: > | |
bash -c "while ! nc -w 1 -z db 5432; do sleep 0.1; echo 'waiting for db...'; done; | |
sleep 2 && |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pips() { | |
local pkg=$1 | |
if [ -z "$1" ]; then | |
echo "usage: pips <pkg name>" | |
return 1 | |
fi | |
local _ins="pip install $pkg" | |
eval $_ins |
NewerOlder