Skip to content

Instantly share code, notes, and snippets.

View pfefferle's full-sized avatar
😴
zzZZzzzZzzZZzZZZ

Matthias Pfefferle pfefferle

😴
zzZZzzzZzzZZzZZZ
View GitHub Profile
@jwage
jwage / SplClassLoader.php
Last active April 9, 2024 21:04
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,
@fabioyamate
fabioyamate / nokogiri
Created June 18, 2010 02:56
nokogiri installation from libxml2 and libxslt macosx
# using rvm with ruby-1.8.7-p249
# latest version 2.7.7 2010-06-17
brew install libxml2
# installing libxslt from source code
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7
make
sudo make install
@Zodiac1978
Zodiac1978 / .htaccess
Last active March 15, 2024 08:29
Make your Website faster - a safe htaccess way
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
# https://andreashecht-blog.de/4183/
<?php
function twitter_metadata($metadata) {
$metadata['twitter:card'] = 'summary';
$metadata['twitter:creator'] = '@willnorris';
foreach (array('url', 'title', 'description', 'image') as $attr) {
if (array_key_exists("og:$attr", $metadata)) {
$metadata["twitter:$attr"] = $metadata["og:$attr"];
}
@dhrrgn
dhrrgn / console
Last active December 12, 2021 01:24
Adding global Options/Arguments to Symfony Console Applications
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
require 'vendor/autoload.php';
$app = new Application;
#!/usr/bin/env bash
#==========================================================================================
# Original Script from Clemens Lang, neverpanic.de
# https://neverpanic.de/blog/2014/03/19/downloading-google-web-fonts-for-local-hosting/
# Modified by Chris Jung, campino2k.de
# * Rename Files to be compatible with Windows File System (remove spaces and colon)
# * Add "local()" to src like Google does to skip downloading if System has font installed
# Modified by Robert
# * Fix Mac execution
(function () {
if (window.parent !== window) {
window.parent.postMessage(JSON.stringify({
// The config of your endpoint
reply: 'http://voxpelli.com/reply?u={url}'
}), '*');
}
// Pick a way to invoke the registerProtocolHandler, through a submit handler in admin or something
document.getElementById('confForm').addEventListener('submit', function (e) {
@voxpelli
voxpelli / indieconfig-loader.html
Last active August 29, 2015 14:06
Promise based loading of indie-config, wrapped in an example page using that promise. More info @ http://indiewebcamp.com/indie-config
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Indie Configuration</title>
<link rel="stylesheet" href="/css/style.css" />
</head>
<body>
<div class="page" id="page-wrapper">
<header>
@adactio
adactio / ampify.php
Last active October 3, 2022 06:26
Make a chunk of markup AMP-ready
<?php
# Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
# http://creativecommons.org/publicdomain/zero/1.0/
function ampify($html='') {
# Replace img, audio, and video elements with amp custom elements
$html = str_ireplace(
['<img','<video','/video>','<audio','/audio>'],
@jkphl
jkphl / Micrometa Bookmarklet
Last active June 20, 2016 17:10
Bookmarklet for submitting the current page to http://micrometa.jkphl.is and analyzing the embedded Microformats2 and schema.org markup. Create a new bookmark in your browser and paste this code as the bookmark target.
javascript:var f=document.createElement("form");f.action="https://micrometa.jkphl.is",f.method="post",f.target="_blank";var u=document.createElement("input");u.type="hidden",u.name="url",u.value=document.location,f.appendChild(u);var s=document.createElement("input");s.type="hidden",s.name="microdata",s.value=1,f.appendChild(s),document.body.appendChild(f),f.submit();