Skip to content

Instantly share code, notes, and snippets.

View alle's full-sized avatar

Alessandro Frangioni alle

View GitHub Profile
@ShawnMcCool
ShawnMcCool / A Simple PHP Postmark Library.md
Last active February 21, 2017 12:18
Simple postmark email send / batching.

Examples:

public function sendSingleExample() {
    (new SendMailViaAPI('<postmark-server-token>'))->single(
        new Mail('sender name', 'sender email', 'recipient email', 'hello from exampletown', '<strong>this is bold</strong> this is not.')
    );
}

public function sendBatchExample() {
@mathiasverraes
mathiasverraes / water.php
Last active July 19, 2018 05:23
Water Kata
<?php declare(strict_types = 1);
function volume (array $levels) {
return array_sum(
zipWith(
'subtract',
zipWith(
'min',
scanl('max', $levels),
scanr('max', $levels)
#!/bin/bash
echo "$@" | sed -e 's|\\|/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/mnt/\L\1\E/\2|'
@jeroenvdgulik
jeroenvdgulik / Talklist.md
Last active December 17, 2023 19:04
My mostly incomplete list of memorable talks that should probably be required material

The list is now hosted on a repository so you can PR -> https://github.com/jeroenvdgulik/awesome-talks/blob/master/README.md

The list

@yvoyer
yvoyer / CalculationCommand.php
Last active November 22, 2019 01:45 — forked from webdevilopers/AbstractCreateCalculationHandler.php
Domain Driven Design Command Bus and Handler example in Symfony
<?php
/**
* This class is used as date_class in form component
*/
class CalculationCommand
{
const BASIC_TYPE = 'basic_calculaction_type';
public $subTotal;
@marcj
marcj / do-it.sh
Last active April 12, 2020 08:47
OSX PhpStorm, better performance - more FPS using OpenGL
cp /Applications/PhpStorm.app/Contents/bin/phpstorm.vmoptions ~/Library/Preferences/WebIde*
echo -ne "\n-Dawt.useSystemAAFontSettings=lcd\n-Dawt.java2d.opengl=true" >> ~/Library/Preferences/WebIde*/phpstorm.vmoptions
@duzun
duzun / uuid.js
Last active February 27, 2024 18:31
A simple UUID v4 generator, relying on Math.random() + Date.now()
/** Generates UUID v4
*
* @node There is a bug in Chrome's Math.random() according to http://devoluk.com/google-chrome-math-random-issue.html
* For that reason we use Date.now() as well.
*/
function UUID() {
function s(n) { return h((Math.random() * (1<<(n<<2)))^Date.now()).slice(-n); }
function h(n) { return (n|0).toString(16); }
return [
s(4) + s(4), s(4),
@josecelano
josecelano / validation-in-ddd.php
Created March 31, 2015 14:45
Validation in DDD
<?php
class PaymentController
{
public function makePayment()
{
// POST data:
// fromCustomerId
// toCustomerId
// amount
@linhmtran168
linhmtran168 / after.sh
Last active March 23, 2016 14:36
Laravel Homestead setup script
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
# Uupdate
sudo apt-get update
# Install some base packages
@chucheng
chucheng / gist:0728e38f6edd972a345b
Last active November 27, 2022 03:17
Remove Wow! eBook PDF Watermark
#install pdftk
#export LC_CTYPE=C # if you encounter "sed: RE error: illegal byte sequence"
pdftk original.pdf output uncompressed.pdf uncompress
sed -e "s/Download from Wow! eBook \<www.wowebook.com\>/ /g" < uncompressed.pdf > temp.pdf
pdftk temp.pdf output fixed.pdf compress
rm temp.pdf