Skip to content

Instantly share code, notes, and snippets.

View n0nag0n's full-sized avatar
😁

n0nag0n n0nag0n

😁
View GitHub Profile
@awebartisan
awebartisan / dynamic_input_fields.html
Created March 1, 2021 09:29
Dynamic input fields with Alpine.js
<div x-data="{ bankAccounts: [{
id: '',
accountNumber: ''
}] }">
<template x-for="(bankAccount, index, bankAccounts) in bankAccounts" :key="index">
<div class="grid grid-cols-6 gap-6 mt-2">
<div class="col-span-3 md:col-span-3 sm:col-span-2">
<x-jet-label for="city">Bank</x-jet-label>
<select :name="`bank_info[${index}][bank_id]`" id="bank"
class="border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm mt-1 block w-full">
@bezborodow
bezborodow / Adapter.php
Last active March 23, 2024 04:52
MySQLi to PDO Shim
<?php
namespace MySQLi\PDO\Adapter;
use PDO;
use PDOStatement;
class Connection
{
public $affected_rows;
<?php
namespace App;
use Latte\Engine;
class LatteWithGlobalVariables extends Engine
{
private $globals = [];
@lukehedger
lukehedger / ffmpeg-compress-mp4
Last active September 18, 2024 18:02
Compress mp4 using FFMPEG
$ ffmpeg -i input.mp4 -vcodec h264 -acodec mp2 output.mp4
@fcingolani
fcingolani / import_csv_to_sqlite.php
Last active April 8, 2024 02:52
PHP function to import a CSV into an SQLite database. Creates a table if needed. Uses PDO.
<?php
function import_csv_to_sqlite(&$pdo, $csv_path, $options = array())
{
extract($options);
if (($csv_handle = fopen($csv_path, "r")) === FALSE)
throw new Exception('Cannot open CSV file');
if(!$delimiter)
$delimiter = ',';