Skip to content

Instantly share code, notes, and snippets.

@axelf
axelf / inherit-box-sizing.css
Created August 14, 2023 07:06
Reset box-sizing by inheritence
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
@axelf
axelf / htaccess.expires.headers
Created June 14, 2021 13:58 — forked from solancer/htaccess.expires.headers
htaccess expires headers
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 month"
# CSS
ExpiresByType text/css "access plus 1 year"
# Data interchange
ExpiresByType application/atom+xml "access plus 1 hour"
@axelf
axelf / uuid.php
Created October 14, 2019 22:51
Create a UUID
<?php
function uuid()
{
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000,
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
<?php
/**
* GitHub webhook handler template.
*
* @see https://developer.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
@axelf
axelf / rsync.md
Last active December 16, 2018 13:20
@axelf
axelf / hash_assets_file.php
Last active February 12, 2017 12:46
Append a hash to the asset file for cache-busting
<?php
/**
* Elixir asset helper
*
* @param string $file File name
* @return string
*
* @throws \InvalidArgumentException
*/
function elixir($file)

Löschen der letzten n commits

git reset --hard HEAD~n

// push to remote
git push -f
@axelf
axelf / tools.md
Last active March 12, 2017 15:56
Sammlung verschiedener Tools
## From https://github.com/te-online
# BEGIN Performance
# Compress text files
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
@axelf
axelf / manual.md
Created January 30, 2017 12:17 — forked from te-online/git-deployment-manual.md
Git Deployment strategy set-up manual 👀 🚀

Steps

  1. Init local git repository (remember to create .gitginore with wp-config.php before staging anything)
  2. Configure SSH-key access to server with git [https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/, https://help.ubuntu.com/community/SSH/OpenSSH/Keys#Transfer_Client_Key_to_Host]
  3. Init a bare repo on the server git init && git config core.bare true
  4. Create a new post-receive hook with nano .git/hooks/post-receive (content see below!)
  5. Execute chmod 755 post-receive on the script
  6. Add remote to local repository git remote add staging user-name@your-domain.com:www/your-website
  7. Try pushing git push staging master
  8. Check if everything works as expected.
  9. Add a .htaccess to the .git directory with content: deny from all