Рубрики
TypeScript

TypeScript — Установка в IDE

  • установка TypeScript в командной строке IDE
    • npm install -g typescript
  • использование в проекте TypeScript в project
    • project\ts\test.ts
  • конфигурация в проекте для упрощения компиляции TypeScript в JavaScript
    • project\tsconfig.json
      • {
           "compilerOptions": {
               "target": "es5",
               "removeComments": true,
               "outFile": "app.js"
           }
        } 
      • outFile
        • все файлы ts компилируются и сохраняются в корневую папку проекта с указанным именем из примера app.js  

  • Компилирование ts через cmd
    • компилирование только одного файла
      • tsc tsc\file.ts
    • Права на выполнение команд в терминале
      • Set-ExecutionPolicy RemoteSigned
    • компилирование всех файлов tsc в проекте
      • tsc
      •  
    Рубрики
    PHP

    Настройка WordPress

    • Настройка стиля WordPress
      • Внешний вид
        • Темы
          • Twenty Twenty = Активировать
    • привязка php файла к файлу php в WordPress по теме
      • Внешний вид\Редактор тем
    • Раздел Функций
      • localhost\wp-content\themes\twentytwenty\functions.php
        • include_once $_SERVER[‘DOCUMENT_ROOT’].’/IDE/wp/wp_functions.php’;
      • localhost\IDE\wp\wp_functions.php
        • include_once__DIR__.»/ajax_wp/main.php»;
    • localhost\wp-content\themes\twentytwenty\footer.php
      • include_once__DIR__.»/ajax_wp/main.php»;
    include_once $_SERVER['DOCUMENT_ROOT'].'/IDE/src/WordPress/ToolTip/main.php';
    Рубрики
    IDE "Visual Studio Code" WordPress project PHP

    Настройка проекта в локальном редакторе VSCode для WordPress хостинга

    • настройка IDE
      • F:\project\VSCode\Web\OSPanel\domains\localhost\IDE
        • локальный путь редактирование проекта
      • добавить в список проектов IDE
        • плагин Projects Manager
    • создание GIT
      • .gitignore
      • структура проекта
        • src
        • dist
      • создание репозитория в GitHub
      • создание туннеля SSH на хостинг с WordPress (плагин SFTP)
        • .vscode\sftp.json
        • настройка на хостинге (на примере Джино)
          • добавить доступ для своего IP
        • uploadFolder
          • отправить файлы с локального проекта

    Рубрики
    Windows Delphi Desktop App development

    Delphi «Сохранение/Загрузка значения из Регистра ОС»

    • unit Main;
      • interface
        • uses
          • Winapi.Windows, Winapi.Messages,
          • System.SysUtils, System.Variants, System.Classes,
          • Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls,Vcl.StdCtrls;
        • type TfmUnity = class(TForm)
          • pg: TPageControl;
          • TabSheet1: TTabSheet;
          • tabOptions: TTabSheet;
          • gbField: TGroupBox;
          • editField: TEdit;
          • procedure gbFieldClick(Sender: TObject);
          • procedure FormCreate(Sender: TObject);
          • private { Private declarations }
          • public { Public declarations }
        • end;
      • var fmUnity: TfmUnity;
      • implementation
        • uses Registry, FileCtrl; //путь к файлу
        • {$R *.dfm}
        • procedure ЗаписатьВРеестр(val:string; name:string=Str1;project:string=namespace_unity);
          • var reg : tregistry;
          • begin
            • reg := tregistry.create;
            • try
              • reg.RootKey := HKEY_CURRENT_USER; reg.OpenKey(Software\Microsoft\Windows\+project,true);
              • reg.WriteString(name, val);
            • finally
              • reg.free;
            • end;
          • end;
        • function ПрочитатьВРеестре(name:string=Str1;project:string=namespace_unity):string;
          • var reg : tregistry;
          • begin
            • reg := tregistry.create;
            • try
              • reg.RootKey := HKEY_CURRENT_USER;
              • reg.OpenKey(Software\Microsoft\Windows\+project,true);
              • Result := reg.ReadString(name);
            • finally
              • reg.free;
            • end;
          • end;
        • procedure TfmUnity.FormCreate(Sender: TObject);
          • begin
            • editField.Text:=ПрочитатьВРеестре(i+editField.tag.ToString());
          • end;
        • procedure TfmUnity.gbFieldClick(Sender: TObject);
          • var SelectedFolder: string;
          • begin
            • if (SelectDirectory(Выберите директорию,»,SelectedFolder)) then
              • begin
                • editField.Text:=SelectedFolder;
                • ЗаписатьВРеестр(SelectedFolder,i+editField.tag.ToString());
              • end;
          • end;
    • end.
    Рубрики
    back-end PHP Web development

    Web development «WorldPress — Записи — открываем через ссылку в окно с движением»

    • function mypost_content_replace($content) {
      • $id = str_replace(array([post),«,$content);
      • $id = substr($id, 0,strpos($id,«));
      • return mypost_el($id);
    • }
    • function mypost_content_callback($matches) {
      • return mypost_content_replace($matches[0]);
    • }
    • function mypost_content_write($content){
      • return preg_replace_callback(/\\[post.*?\\]/i,mypost_content_callback, $content);
    • }
    • $GLOBALS[myposts]=array();
    • function mypost_load_content($content,$name,$link,$ID,$title,$id{
      • $GLOBALS[myposts][]=$ID;
      • $content = mypost_content_write($content);
      • $el=<div data-id=".$ID." id="posts'.$ID.'" class="block-mouse data2206241820 color2206241820" style="padding:2px;font-size:9pt;display:none;position:absolute;z-index:1003">; $el=$el.»\n».<div style="display:inline-block;font-weight: bold;color:red">.$title.`</div><div style=»float:right;display:inline-block»>`.$id.</div>;
        $el=$el.»\n».<div class="btns" style="none">;
      • $el=$el.»\n».<div style="display:inline-block">.$link.</div>; $el=$el.»\n».<a href="#" onclick="$('.block-mouse').css('display','none')" style="text-decoration: none;margin-right:2px;vertical-align: middle;float:right;display:inline-block;">Все</a>;
      • $el=$el.»\n».<img onclick="$('#posts.$ID.).css('display','none')" src="https://codegid.ru/img/close.png" style="margin-right:2px;cursor:pointer;float:right;display:inline block;height:18px;width:18px">;
      • $el=$el.»\n».</div>;
      • $el=$el.»\n».<div style="font-weight: bold;color:green">.$name.</div>;
      • $el=$el.»\n».<div class="res" style="overflow:scroll;height:400px;width:400px;">'.$content.'</div></div>;
      • return $el;
    • }
    • function mypost_el($id){
      • $ID=p.$id;
      • $href=https://codegid.ru/?p=.$id;
      • $my_post=get_post($id);
      • $name=$my_post->post_name;
      • $name=urldecode($name);
      • $title=$my_post->post_title;
      • $content=$my_post->post_content;
      • $link=<a title=".$name." style="text-decoration: none;margin-right:2px;vertical-align: middle;display:inline-block;" target="_blank" href="'.$href.'">.$title.</a>;
      • $post_categories = wp_get_post_categories($id); foreach($post_categories as $c ){
        • $cat = get_category($c);
        • $cat = <a style="text-decoration: none;color:green;margin-left:2px" href="'.get_category_link($cat->term_id).'">.$cat->name.</a>;
        • $link=$cat./.$link;
      • }
      • $el=<div style="margin-bottom:2px;"><a class="posts-root" onmouseover="posts_root_mouseover($(this))" data-id=".$ID." style="text-decoration: none;margin-left:2px;" href="'.$href.'">.$title.</a></div>;
      • if(array_search($ID,$GLOBALS[myposts]) == false){
        • $el=$el.»\n».mypost_load_content($content,$name,$link,$ID,$title,$id);
      • }
      • return $el;
    • }
    • Вызов через простой текст c вводом номера поста
      • function mypost_content_replace($content) {…}
        • $id = str_replace(array([post),«,$content);
        • $id = substr($id, 0,strpos($id,` `));
        • return mypost_el($id);
    [post10644 описание]