Skip to content

Instantly share code, notes, and snippets.

View baumannsven's full-sized avatar

Sven Baumann baumannsven

  • way.vision
  • Deutschland
View GitHub Profile
#!/usr/bin/env bash
rm -rf var/cache
# If the console using not same version as the web, then add before vendor the executable php command.
vendor/bin/contao-console cache:warmup --env=pro
vendor/bin/contao-console cache:warmup --env=dev
var isInViewport = function (elem) {
var bounding = elem.getBoundingClientRect();
return (
bounding.top >= 0 &&
bounding.left >= 0 &&
bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
bounding.right <= (window.innerWidth || document.documentElement.clientWidth)
);
};
@baumannsven
baumannsven / contao3.conf
Created July 21, 2017 21:51 — forked from RavuAlHemio/contao3.conf
Contao 3 and 4 nginx.conf
index index.php index.html;
location ~ ^/(favicon\.ico|robots\.txt)$ {
allow all;
log_not_found off;
access_log off;
}
# don't show templates
location ~* \.(tpl|html5|xhtml)$ {
@baumannsven
baumannsven / gist:1f3d6e880b21911f4900e2a2b398f799
Last active June 27, 2017 21:04
Contao Managed Edition add Backend User with command line
vendor/bin/contao-console doctrine:query:sql "INSERT INTO tl_user (tstamp, username, name, email, language, backendTheme, showHelp, thumbnails, useRTE, useCE, admin, dateAdded)VALUES(TIME, 'USERNAME', 'NAME', 'EMAIL', 'de', 'flexible', '1', '1', '1', '1', '1', TIME);"
vendor/bin/contao-console contao:user:password "USERNAME" --password="PASSWORD"
<?php
die ('This is not executable now! Please comment out this line.');
$config = array(
'url' => 'https://getcomposer.org/composer.phar',
'dir' => __DIR__ . '/composer',
'bin' => __DIR__ . '/composer/composer.phar',
'json' => __DIR__ . '/composer/composer.json',
'command' => 'install' // The composer command update/install
@baumannsven
baumannsven / default
Created August 10, 2016 21:12 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
@baumannsven
baumannsven / gist:505ed5fc39f334a508b2
Last active August 29, 2015 14:22
open links with jquery
$(document).ready(function () {
$('.box').click(function (handler) {
if ($(this).find('a').length > 0) {
//best cross browser way for trigger links
var link = $(this).find('a')[0];
// open links with target _blank or ctrl/cmd pressed in a new tab
// open links with shift key in a new window
if (link.target != ''
@baumannsven
baumannsven / gist:d4e95650a76179d66f5c
Created May 28, 2015 05:40
Compass better spriting
$sprite-layout: smart;
$sprite: sprite-map('sprite/*.png');
@mixin sprite-with-demension($map, $sprite-image) {
background-image: $map;
@include sprite-dimensions($map, $sprite-image);
@include sprite-background-position($map, $sprite-image);
}
@mixin sprite-without-demension($map, $sprite-image) {