Skip to content

Instantly share code, notes, and snippets.

View a-r-m-i-n's full-sized avatar

Armin Vieweg a-r-m-i-n

View GitHub Profile
@a-r-m-i-n
a-r-m-i-n / center.css
Created February 27, 2015 11:13
CSS3 Center (horizontally and vertically)
.center {
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
}
@a-r-m-i-n
a-r-m-i-n / PayPal Rest API - Simple Transaction
Created February 26, 2015 10:24
PayPal Rest API - Simple Transaction
This example uses the Rest API PHP SDK of Paypal. To get it, just use composer.
@a-r-m-i-n
a-r-m-i-n / PayPal Classic API - Express Checkout
Last active April 25, 2018 16:58
PayPal Classic API - Express Checkout
This example uses the Merchant PHP SDK of Paypal. To get it, just use composer.
@a-r-m-i-n
a-r-m-i-n / .gitattributes
Last active July 19, 2018 09:25
.gitattributes to force LF for all text files
# Autodetect text files
* text=auto
# Force the following filetypes to have unix eols, so Windows does not break them
*.* text eol=lf
# Force images/fonts to be handled as binaries
*.jpg binary
*.jpeg binary
*.gif binary
@a-r-m-i-n
a-r-m-i-n / YourTCA.php
Last active August 29, 2015 14:14
UserFields for TYPO3 (TCA)
<?php
if (!defined ('TYPO3_MODE')) {
die ('Access denied.');
}
$TCA['tx_ext_domain_model_whatever'] = array(
'ctrl' => $TCA['tx_ext_domain_model_whatever']['ctrl'],
'interface' => array(
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden',
),
@a-r-m-i-n
a-r-m-i-n / precise_round.js
Created January 28, 2015 14:43
How to round correctly in JavaScript
function sign(num) {
// IE does not support method sign here
if (typeof Math.sign === 'undefined') {
if (num > 0) {
return 1;
}
if (num < 0) {
return -1;
}
return 0;
@a-r-m-i-n
a-r-m-i-n / mainMenu.ts
Last active August 29, 2015 14:14
Simple <ul> Menu using TypoScript
lib.mainMenu = HMENU
lib.mainMenu {
1 = TMENU
1 {
noBlur = 1
expAll = 1
NO = 1
NO.wrapItemAndSub = <li class="first">|</li>|*|<li>|</li>|*|<li class="last">|</li>
@a-r-m-i-n
a-r-m-i-n / FluidTemplate.html
Last active July 30, 2020 14:02
How to render responsive images in fluid templates (dce example)
{namespace dce=ArminVieweg\Dce\ViewHelpers}
<f:layout name="Default" />
<f:section name="main">
<f:for each="{dce:fal(field:'images', contentObject:contentObject)}" as="image">
<!-- This is the normal unresponsive way -->
<f:image image="{image}" />
<!-- Here we referer to typoscript to render the responsive image -->
<f:cObject typoscriptObjectPath="lib.responsiveImage" data="{image.uid}"></f:cObject>
</f:for>
@a-r-m-i-n
a-r-m-i-n / fieldconfiguration.xml
Created January 21, 2015 13:23
DCE field configuration for FAL inline field with
<config>
<type>inline</type>
<foreign_table>sys_file_reference</foreign_table>
<foreign_field>uid_foreign</foreign_field>
<foreign_sortby>sorting_foreign</foreign_sortby>
<foreign_table_field>tablenames</foreign_table_field>
<foreign_match_fields>
<fieldname>images</fieldname> <!-- Name of variable! -->
</foreign_match_fields>
<foreign_label>uid_local</foreign_label>
@a-r-m-i-n
a-r-m-i-n / OverrideIconOverlayHook.php
Created November 25, 2014 13:51
Approach to add my own overlay icons to pages in TYPO3
<?php
namespace Sunzinet\SzPagesettings\Hooks;
/**
* Class OverrideIconOverlay
*
* @package Sunzinet\SzFalExpiredate\Hooks
*/
class OverrideIconOverlayHook {