Skip to content

Instantly share code, notes, and snippets.

@ivoba
ivoba / ThemeSwitcher.astro
Created January 7, 2024 12:27
Astro PicoCss V2 DarkMode Switcher
---
---
<button id="theme-switcher"></button>
<style is:global>
#theme-switcher {
background: none;
border: 0;
}
@ivoba
ivoba / DateTimeNoSecondsTransformer.php
Created November 3, 2022 11:07
DataTransformer to remove seconds for HTML5 datepicker with symfony forms
<?php
namespace App\Form;
use Symfony\Component\Form\DataTransformerInterface;
class DateTimeNoSecondsTransformer implements DataTransformerInterface
{
public function transform(mixed $value)
{
@ivoba
ivoba / PostgisPostgreSqlPlatform.php
Created October 31, 2022 09:11
Postgis Postgres Platform for Doctrine
<?php
namespace App\DBAL;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform as PostgreSqlPlatformBase;
class PostgisPostgreSqlPlatform extends PostgreSqlPlatformBase
{
public function getListNamespacesSQL()
{
{
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Ivo Bathke",
"label": "Software Developer",
"picture": "https://gist.githubusercontent.com/ivoba/e60c4a537dfa773d37f12cfc02a33798/raw/6c5f4160e1ba2956bcf28eb90bf8eeac30374ba3/resume_ivoba.JPG",
"summary": "I am a senior Software Developer with 20+ years experience in APIs and web applications for ecommerce, travel industry and other sectors. I prefer the backend yet im not afraid of frontends. I even can do DevOps, i would not call me a Admin though. I like open source, remote work, putting tickets to \"Ready for Review\", meetings in videochats across timezones, tagging releases, refactoring, writing tests, checking the commit log and posting smilies to the chat.",
"website": "https://ivo-bathke.name",
@ivoba
ivoba / composer.json
Created April 11, 2022 10:59
SilverStripe 4.10 & PHP8.1 fix deprecation warnings
"require": {
...
"cweagans/composer-patches": "^1.7"
...
"extra": {
"patches": {
"silverstripe/framework": {
"Fix SilverStripe deprecations error_reporting for PHP 8.1": "./fix-deprecation-error_reporting.4.10.4.patch"
}
}
@ivoba
ivoba / filterCsv.mjs
Last active January 17, 2022 08:41
Filter a csv file with nodejs streams
import {pipeline} from 'stream';
import {parse, transform, stringify} from 'csv';
import {createReadStream, createWriteStream} from 'fs';
pipeline(
createReadStream(`./members.csv`),
parse(),
transform(data => data[2] !== '' ? data : null),
stringify({}),
createWriteStream(`./members_filtered.csv`),
@ivoba
ivoba / IndexController.php
Created July 10, 2012 10:15
symfony2 caching data via doctrine/commons
$cache = $this->get('cache');
$cache->setNamespace('mynamespace.cache');
if (false === ($cached_data = $cache->fetch($cache_key))) {
$cached_data = $SOMEAPI->getData($params);
$cache->save($cache_key, $cached_data, 3600);//TTL 1h
}
@ivoba
ivoba / post-merge
Created November 13, 2014 17:13
post-merge hook for composer php apps
#/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# forked by Gianluca Guarini
# phponly by Ivo Bathke ;)
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
}
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@ivoba
ivoba / SS4_lemp_config.conf
Last active January 9, 2018 08:38
SS4 lemp config
server {
listen 80;
# server_name domain.tld www.domain.tld;
index index.php;
root /var/www/current;
charset utf8;
autoindex off;