Skip to content

Instantly share code, notes, and snippets.

@garrett
garrett / ollama-start.sh
Created June 25, 2024 18:43
ollama with rocm (AMD GPU) and webui, in podman
podman run --pull newer --detach --security-opt label=type:container_runtime_t --replace --device /dev/kfd --device /dev/dri -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:rocm; podman run --replace --pull newer -d --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --name open-webui --restart always ghcr.io/open-webui/open-webui:main
@Log1x
Log1x / PostSearch.php
Last active October 13, 2024 11:58
Post Search component example using Acorn v4 and Livewire 3
<?php
namespace App\Livewire;
use Livewire\Attributes\Url;
use Livewire\Component;
use WP_Query;
class PostSearch extends Component
{
@programmerShinobi
programmerShinobi / setup-php-with-sqlsrv-pdo_sqlsrv-on-linux-ubuntu.sh
Last active February 6, 2025 14:15
Setup PHP 7.2 with sqlsrv & pdo_sqlsrv on Linux (Ubuntu 22.04)
faqih@shinobi:~$ sudo apt-get update
faqih@shinobi:~$ sudo apt-get upgrade
faqih@shinobi:~$ sudo service packagekit restart
faqih@shinobi:~$ sudo apt-get update --fix-missing
faqih@shinobi:~$ sudo apt install software-properties-common
faqih@shinobi:~$ sudo add-apt-repository ppa:ondrej/php
faqih@shinobi:~$ sudo apt update
@Shelob9
Shelob9 / vite.config.js
Created July 22, 2022 16:18
Code for Laravel vite React fast refresh with tailwind https://twitter.com/Josh412/status/1547628986695446530
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: 'resources/js/app.jsx',
refresh: [
'resources/js/app.jsx',
'front-end-client/src/**',
'resources/components/react.blade.php',
@sebastiaanluca
sebastiaanluca / CarbonImmutableCaster.php
Last active March 24, 2024 14:39
Lazy Laravel Harvest API service
<?php
declare(strict_types=1);
namespace App\DataTransferObjects;
use Carbon\CarbonImmutable;
use Spatie\DataTransferObject\Caster;
class CarbonImmutableCaster implements Caster
@sibelius
sibelius / webpack.tailwind.js
Created July 30, 2021 11:45
webpack tailwind production config
const webpackCommonConfig = require("./webpack.config");
const { merge } = require('webpack-merge');
const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { trimEnd } = require('lodash');
module.exports = merge(webpackCommonConfig, {
mode: 'production',
devtool: 'source-map',
optimization: {
@wmandai
wmandai / AppServiceProvider.php
Created June 23, 2021 21:21 — forked from greenspace10/AppServiceProvider.php
Laravel, Livewire, Alpine JS Toast Notifications
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Component::macro('notify', function ($message, $title = '', $type = 'success') {
$this->dispatchBrowserEvent('notify', ['message' => $message, 'title' => $title, 'type' => $type]);
});
@rummykhan
rummykhan / Octane-Apache.conf
Last active October 20, 2024 21:05
Apache Configuration for Octane
#### Enable Apache Proxy related modules
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_ajp
sudo a2enmod rewrite
sudo a2enmod deflate
sudo a2enmod headers
sudo a2enmod proxy_balancer
sudo a2enmod proxy_connect
@troccoli
troccoli / CookieConsent.php
Created April 30, 2021 15:09
Cookie consent livewire component
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class CookieConsent extends Component
{
public bool $askForConsent;
@Balakrishnan-flycart
Balakrishnan-flycart / Woo Discount Rules v2 - Get discount details against product.php
Last active March 2, 2023 04:44
Woo Discount Rules v2 - Get discount details against product
/**
* Get the discount details of given product with custom price
* @param $price float/integer
* @param $product object (Product object Example: wc_get_product($product_id))
* @param $quantity int
* @param $custom_price float/integer (0 for calculate discount from product price)
* @param $return_details string (Default value 'discounted_price' accepted values = 'discounted_price','all')
* @param $manual_request boolean (Default value false: pass this as true for get discount even if there is no item in cart)
* @param $is_cart boolean (Default value true)
* @return array|float|int - is product has no discounts, returns $price;else return array of discount details based on $return_details