Skip to content

Instantly share code, notes, and snippets.

View karakhanyans's full-sized avatar

Sergey Karakhanyan karakhanyans

View GitHub Profile
<script setup>
import {onMounted, ref} from "vue";
import Lightning from "@/Components/Icons/Lightning.vue";
import Card3d from 'card3d'
const effectRef = ref(null)
onMounted(() => {
if (effectRef.value) {
new Card3d(effectRef.value, {perspective: 1000, fullPageListening: true})
}
@karakhanyans
karakhanyans / TrafficMiddleware.php
Created May 1, 2024 10:13
TrafficMiddleware.php
<?php
namespace App\Http\Middleware;
use App\Models\Traffic;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
<div id="about" class="max-w-2xl mx-auto my-16 px-8">
<div class="flex items-start">
<Avatar class="flex-shrink-0" src="/images/serg.webp"/>
<div class="flex-shrink ml-4">
<p class="font-bold text-lg">Hey, I am Serg</p>
<Paragraph>
Since the early years of my career I always loved to build different open-source packages and provide to the community.
Some of <a target="_blank" class="text-secondary underline" href="https://docs.lionix.io">my packages</a> got tens of thousand of downloads.
</Paragraph>
</div>
@karakhanyans
karakhanyans / LemonSqueezyService.php
Created March 24, 2024 11:14
LemonSqueezyServiceProvider
<?php
namespace App\Services;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Http;
class LemonSqueezyService
{
@karakhanyans
karakhanyans / readme.md
Last active May 3, 2024 13:09
Typesense

Typesense

Typesense is an open source, typo tolerant search engine that is optimized for instant sub-50ms searches, while providing an intuitive developer experience.

When using the Typesense driver you will need to install the Typesense PHP SDK via the Composer package manager:

composer require typesense/typesense-php
<?php
namespace App\Providers;
use App\Services\PaginationService;
use Illuminate\Support\Collection;
use Illuminate\Support\ServiceProvider;
class CollectionMacroServiceProvider extends ServiceProvider
{
<?php
namespace App\Contracts;
interface QuestionnaireInterface
{
public function setQuestion(string $question);
public function setAnswer(string $answer, bool $isValid);
@karakhanyans
karakhanyans / js
Created May 14, 2020 08:38
js-example
const User = require('../models/user');
const jwtHelper = require('../helpers/jwt');
const HTTP = require('http-status-codes');
const passwordHelper = require('../helpers/password');
const storage = require('../helpers/storage');
// Registration
exports.registration = async (req, res) => {
let statusCode = HTTP.BAD_REQUEST;
let success = false;
@karakhanyans
karakhanyans / sass
Created May 14, 2020 08:36
sass-example
.content {
border-top-left-radius: 6px;
border-top-right-radius: 6px;
border-top: 4px solid #148cf0;
width: 600px;
max-width: 600px;
height: 640px;
display: flex;
flex-direction: column;
margin-top: 160px;
@karakhanyans
karakhanyans / Modify string with given arguments
Created February 6, 2019 12:14
Modify string with given arguments
function getString()
{
$arg_list = func_get_args();
$arguments_number = func_num_args();
if ($arguments_number >= 2) {
$string = $arg_list[0];
preg_match_all('/{(.*?)}/', $string, $output_array);
$params = $output_array[1];
array_shift($arg_list);
foreach ($params as $param) {