Skip to content

Instantly share code, notes, and snippets.

View czachor's full-sized avatar

czachor

View GitHub Profile
@jwage
jwage / SplClassLoader.php
Last active July 23, 2024 18:42
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
@hakre
hakre / dl-file.php
Created January 2, 2012 21:41
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+
@jimmynotjim
jimmynotjim / gist:3666470
Created September 7, 2012 13:59
Use Modernizr to conditionally use Columnizer.js when css columns aren't supported
<script type="text/javascript">
//
// Requires Modernizr, jquery, and columnizer.js
// http://modernizr.com (Requires a production version, demo doesn't include yep/nope)
// http://jquery.com
// http://welcome.totheinter.net/columnizer-jquery-plugin/
//
// Replace [url], [target], and [options] w/ your specific needs
//
@nbomberger
nbomberger / autoloader.php
Last active December 16, 2015 18:08 — forked from adriengibrat/l.php
PSR-0 Compliant autoloader.
/**
* Small PSR-0 compliant autloader
*/
<?php
set_include_path(get_include_path().PATH_SEPARATOR.__DIR__);
spl_autoload_register(
function ($c) {
@include preg_replace('#\\\|_(?!.*\\\)#','/',$c).'.php';
}
);
@jamesmoey
jamesmoey / ExtendedArrayCollection.php
Last active July 24, 2023 07:02
Extend array collection from Doctrine with operation to perform on all the item in the collection.
<?php
namespace Collections;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\PropertyAccess\PropertyAccess;
class ExtendedArrayCollection extends ArrayCollection
{
/**
@fevangelou
fevangelou / my.cnf
Last active July 26, 2024 12:48
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@tattali
tattali / Use fullcalendar.js library in your Symfony project with doctrine.md
Last active August 5, 2023 10:53
Use fullcalendar.js library in your Symfony project with doctrine

Use fullcalendar.js library in your Symfony 4 project with doctrine

FullCalendar.js is a JavaScript event calendar customizable and open source. You can display a full-size event calendar that also compatible with google calendar.

Installation

Download tattali/CalendarBundle using composer

$ composer require tattali/calendar-bundle