Skip to content

Instantly share code, notes, and snippets.

View akadlec's full-sized avatar
🏠
Working from home

Adam Kadlec akadlec

🏠
Working from home
View GitHub Profile
@loilo
loilo / pass-slots.md
Last active September 13, 2024 02:14
Vue: Pass Slots through from Parent to Child Components

Vue: Pass Slots through from Parent to Child Components

The Situation

  • We've got some components A, B and C which provide different slots.
    const A = {
      template: `<div><slot name="a">Default A Content</slot></div>`
    }

const B = {

@carousel
carousel / snake-to-camel.php
Last active September 7, 2024 13:21
Convert snake to camel case and back with PHP
<?php
function camel_to_snake($input)
{
return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
}
function snakeToCamel($input)
{
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', $input))));
}
@mgk
mgk / SAMDChipId.ino
Created January 29, 2016 15:25
Arduino SAMD / Arduino Zero / Arduino M0 chip unique serial number
/**
* Print SAMD chip serial number.
*
* http://atmel.force.com/support/articles/en_US/FAQ/Reading-unique-serial-number-on-SAM-D20-SAM-D21-SAM-R21-devices
*/
void setup() {
Serial.begin(9600);
delay(1000);
}
@Sitebase
Sitebase / Doctrine.php
Created February 22, 2013 13:48
Custom doctrine type to store uuid's as binary(16) values in a MySQL database. Set the column type that you want to use as BINARY(16) in MySQL and your good to go.
\Doctrine\DBAL\Types\Type::addType('uuid', 'BuboBox\Doctrine2\DBAL\Types\UuidType');
@fprochazka
fprochazka / BasePresenter.php
Created October 6, 2012 16:22
Image pipe for #nettefw templates
<?php
/**
* @author Filip Procházka <filip@prochazka.su>
*/
abstract class BasePresenter extends Nette\Application\UI\Presenter
{
/**
* @var \Img\ImagePipe