344. Reverse String

Write a function that reverses a string. The input string is given as an array of characters s. You must do this by modifying the input array in-place with O(1) extra memory.
/**
 * @param {character[]} s
 * @return {void} Do not return anything, modify s in-place instead.
 */
var reverseString = function(s) {
    // Initialize two pointers, one at the start of the array, and one at the end
    let start = 0;
    let end = s.length - 1;

    // While the start pointer is less than the end pointer
    while (start < end) {
        // Swap the characters at the start and end indices
        let tem = s[start];
        s[start] = s[end];
        s[end] = temp;

        

GDPR compliance

Privacy and Cookie policies to allow users to opt in/out of using their personal information.
• Complianz - https://complianz.io/
• Termaggedon - https://termageddon.com/ - $12/mo. or $119/yr.

Select with library slim-select

<select class="select" data-select>
  <option data-placeholder="true">Placeholder</option>
  <option>Option</option>
  <option>Option</option>
  <option>Option</option>
</select>

Flutter 串口通讯

import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'dart:typed_data';

import 'package:usb_serial/usb_serial.dart';

part 'alarm_lamp_serial.g.dart';

/// 串口 485 WiFi 警灯通讯
class AlarmLampSerial {
  UsbPort? _port;

  SerialCommand serialCommand;

  void Function(String event)? onData;
  void Function(String event, {Object? e, StackTrace st})? onError;

  AlarmLampSerial({required this.serialCommand, this.onData, this.onError});

  /// 发送指令
  Future sendCommand(String com

Command line runner helper

A helper library to assist running multiple command lines and combine their output into the current console. See `sample.fsx` about how to use it. To run the sample, use the command line `dotnet fsi sample.fsx`
[<AutoOpen>]
module RunHelpers

#r "nuget: FSharp.Control.Reactive"

open System
open System.Diagnostics
open System.IO
open System.Threading
open FSharp.Control.Reactive

printfn "run-helpers 0.1.0"

module private Process =
    let private streamToObservable (stream: StreamReader) =
        let observable = Subject.broadcast
        let rec loop () =
            async {
                let! line = stream.ReadLineAsync() |> Async.AwaitTask
                if line = null then

3110. Score of a String

You are given a string s. The score of a string is defined as the sum of the absolute difference between the ASCII values of adjacent characters. Return the score of s.
/**
 * @param {string} s
 * @return {number}
 */
var scoreOfString = function(s) {
    // Initialize a variable to store the score
    let score = 0;

    // Loop through each character in the string, except the last one
    for (let i = 0; i < s.length - 1; i++) {
        // Get the ASCII value of the current character and the next character
        let currentChar = s.charCodeAt(i);
        let nextChar = s.charCodeAt(i + 1);

        // Calculate the absolute difference between the ASCII valu

Laravel Core

public function boot () {
        $siteSettings = cache()->remember(
            'siteSettings',
            3600,
            fn() => Setting::all()->keyBy('key');
        );
        View::share('siteSettings', $siteSettings);
    }

Chart

$withdrawMonths = collect([]);
$withdrawTotalAmount = collect([]);

Withdraw::where('status', 1)
->select(DB::raw('SUM(withdraw_amount) as total'), DB::raw('MONTHNAME(created_at) month'))
->groupby('month')
->get()
->map(function ($q) use ($withdrawMonths, $withdrawTotalAmount) {
    $withdrawMonths->push($q->month);
    $withdrawTotalAmount->push($q->total);
});


@push('script')
    <script src="{{ asset('asset/admin/js/chart.min.js') }}"></script>

    <script>
        'use strict'

        v

Varieties JS Package List

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.0.2/pace.min.js"></script>
    <script>paceOptions = {ajax: true, document: true, eventLag: false}; Pace.on('done', function () { $('#preloader').delay(0).fadeOut(300); });</script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudfl

PhpStorm

npm install --g uglify-js
Program: uglifyjs
Arguments: $FileName$ -o $FileNameWithoutExtension$.min.js
Output paths: $FileNameWithoutExtension$.min.js
Working Directory: $FileDir$



npm install -g csso-cli
Program: csso
Arguments: -i $FileName$ -o $FileNameWithoutExtension$.min.css
Output paths: $FileNameWithoutExtension$.min.css
Working Directory: $FileDir$

Laravel Package List

https://github.com/enlightn/enlightn/
Performance -- https://github.com/beyondcode/laravel-query-detector
https://spatie.be/docs/laravel-activitylog/v4/introduction
websockets -- https://github.com/beyondcode/laravel-websockets
PDF - https://spatie.be/docs/browsershot/v4/introduction
PDF -- https://spatie.be/docs/laravel-pdf/v1/introduction
https://github.com/inFureal/artisan-gui

https://github.com/BenSampo/laravel-enum
https://github.com/spatie/laravel-backup

https://github.com/rappasoft/lara

PDF Laravel

<?php

namespace App\Http\Controllers\Products\Products;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Barryvdh\DomPDF\Facade\Pdf;


class PDFController extends Controller {
    public function generate_invoice_pdf() {
        $users = User::get();

        $data = [
            'title' => 'Welcome to ItSolutionStuff.com',
            'date' => date('m/d/Y'),
            'users' => $users
        ];

        $pdf = PDF::loadView('pages.invoices.invoicePDF', $data)
      

Blade file format

@forelse($users as $key => $row)
        <tr>
            <td>{{ $loop->iteration }}</td>
            <td>{{ $row->fullname }}</td>
            <td>{{ $row->phone }}</td>
            <td>{{ $row->email }}</td>
            <td>@if(App\Models\User::where('id', intval($row->reffered_by))->value('username'))<a href="{{ url('admin/users/details/' . $row->reffered_by) }}" class="btn btn-sm btn-link">{{ App\Models\User::where('id', intval($row->reffered_by))->value('username') }}</a>@else-@endif</td>
 

Barcode & QR Code

composer require milon/barcode
***** https://github.com/Bacon/BaconQrCode
https://github.com/milon/barcode
 
 composer require bacon/bacon-qr-code
 
"require": {
    "milon/barcode": "^8.0"
}
'providers' => [
    Milon\Barcode\BarcodeServiceProvider::class,
]
'aliases' => [
    'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class,
    'DNS2D' => Milon\Barcode\Facades\DNS2DFacade::class,
]
php artisan vendor:publish
 
Basic Usages
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T');
echo DNS1D::ge

Paginator

<form method="GET" action="{{ route('admin.user') }}">
  <div class="d-flex justify-content-between align-items-center mb-2" style="background-color: #fff; border-bottom-color: #e5e5e5; padding: 15px 20px; border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0;">
      <div class="table-filter-left d-flex justify-content-between align-items-center">
          <div class="d-flex align-items-center">
              <label for="per_page">Show Page</label>
              <select class="custom-sele

Download as Word Format

https://github.com/PHPOffice/PHPWord/tree/master/samples

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Session;
use DB;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Storage;
use File;

use Exception;
use PhpOffice\PhpWord\Shared\Converter;
use PhpOffice\PhpWord\Style\TablePosition;

// 1440 twip = 1 inch