Skip to content

Instantly share code, notes, and snippets.

View kdambekalns's full-sized avatar

Karsten Dambekalns kdambekalns

View GitHub Profile
@seeekr
seeekr / apache-webp-rewrite.conf
Last active March 10, 2024 22:34
enabling apache to serve WebP image files if accepted by browser (and .webp files available)
## !! This snippet has been updated, but not tested in practice. It should work, please check / leave comments in case it doesn't. !! ##
# originally from https://groups.google.com/a/webmproject.org/group/webp-discuss/browse_thread/thread/196ac4ea705688d8
<IfModule mod_rewrite.c>
# TODO: don't forget to put
# AddType image/webp .webp
# in your mods-available/mime.conf
# (though this is optional because we're setting
# the mime type manually in the RewriteRule)
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

<?php
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_STRICT);
$project = getenv('GERRIT_PROJECT');
$path = dirname(__DIR__ . '../');
$submodules = shell_exec(sprintf("cd %s && git submodule foreach --recursive 'git config remote.origin.url | grep \"%s.git\" || :'", $path, $project));
$submodules = explode(chr(10), $submodules);
@christianjul
christianjul / Installing FLOW3.md
Created September 9, 2012 20:40
Installing FLOW3 via Composer

Please note: This is work in progress

FLOW3 is installable via Composer and excutable from the commandline with this fork, but has not been fully tested.

Most likely several things are broken. Also the package structure has changed, a migration tool will be provided

Installing FLOW3 with Composer

  1. Create an empty directory for your project
@Allisone
Allisone / getConfigurationFor.php
Created September 18, 2012 08:48
Example that fails using Change I2fa8802e
<?php
public function getConfigurationFor($propertyName) {
if (isset($this->subConfigurationForProperty[$propertyName])) {
return $this->subConfigurationForProperty[$propertyName];
} elseif (isset($this->subConfigurationForProperty[self::PROPERTY_PATH_PLACEHOLDER])) {
return $this->subConfigurationForProperty[self::PROPERTY_PATH_PLACEHOLDER];
}
return new \TYPO3\FLOW3\Property\PropertyMappingConfiguration();
}
@bwaidelich
bwaidelich / Menu.html
Created December 6, 2012 11:36
TYPO3 Flow menu with Fluid and DTOs
<ul class="nav{f:if(condition: menuClass, then: ' {menuClass}')}"<f:for each="{menu.attributes}" as="attributeValue" key="attributeName"> {attributeName}="{attributeValue}"</f:for>>
<f:for each="{menu.menuItems}" as="menuItem" iteration="iteration">
<f:if condition="{menuItem.header}">
<f:then>
<li class="nav-header {menuItem.class}"<f:for each="{menuItem.attributes}" as="attributeValue" key="attributeName"> {attributeName}="{attributeValue}"</f:for>>{menuItem.label}</li>
</f:then>
<f:else>
<f:if condition="{menuItem.separator}">
<f:then>
<li class="divider {menuItem.class}"<f:for each="{menuItem.attributes}" as="attributeValue" key="attributeName"> {attributeName}="{attributeValue}"</f:for>></li>
@robertlemke
robertlemke / httpd-vhosts.conf
Last active January 23, 2022 14:42
Apache Virtualhosts file for creating dynamic virtual hosts
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http:/httpd.apache.org/docs/2.2/vhosts/>
@bwaidelich
bwaidelich / AbstractTreeRepository.php
Last active March 2, 2016 11:14
A simple example showing how doctrine behaviours (in this chase (nested) tree and soft-delete) can be used within TYPO3 Flow.
<?php
namespace Your\Package\Domain\Repository;
use TYPO3\Flow\Annotations as Flow;
/**
* @Flow\Scope("singleton")
*/
abstract class AbstractTreeRepository extends \Gedmo\Tree\Entity\Repository\NestedTreeRepository implements \TYPO3\Flow\Persistence\RepositoryInterface {
#!/usr/bin/php
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_STRICT);
define('FLOW_PATH_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
define('FLOW_PATH_PACKAGES', FLOW_PATH_ROOT . 'Packages' . DIRECTORY_SEPARATOR);
class Gerrit {
@jbonney
jbonney / rotated-header.css
Created July 18, 2013 20:29
Rotate HTML header in table
.table-header-rotated th.row-header{
width: auto;
}
.table-header-rotated td{
width: 40px;
border-top: 1px solid #dddddd;
border-left: 1px solid #dddddd;
border-right: 1px solid #dddddd;
vertical-align: middle;