Skip to content

Instantly share code, notes, and snippets.

View franz-josef-kaiser's full-sized avatar

Franz Josef Kaiser franz-josef-kaiser

View GitHub Profile
@jbroadway
jbroadway / Dockerfile
Last active February 4, 2016 02:00
Dockerfile for Nginx + PHP server.
FROM ubuntu:13.04
MAINTAINER Johnny Broadway "[email protected]"
RUN apt-get update
RUN apt-get install -y wget git vim postfix nginx sqlite
RUN apt-get install -y mysql-server mysql-client
RUN apt-get install -y php5-cli php5-common php5-mysql php5-sqlite php5-curl php5-fpm
RUN wget -O /etc/nginx/sites-available/default https://gist.github.com/jbroadway/6369183/raw/682a1ed8078cc39f59c3624f460b128addff95db/nginx-default
@james2doyle
james2doyle / slugify.php
Last active January 12, 2022 13:19
Simple slugify function for PHP. Creates a slug for the passed string, taking into account international characters as well.
<?php
function slugify($string, $replace = array(), $delimiter = '-') {
// https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Utils/Slug.php
if (!extension_loaded('iconv')) {
throw new Exception('iconv module not loaded');
}
// Save the old locale and set the new locale to UTF-8
$oldLocale = setlocale(LC_ALL, '0');
setlocale(LC_ALL, 'en_US.UTF-8');
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
@mhawksey
mhawksey / gist:9199459
Last active February 16, 2022 11:13
Google Apps Script snippet to send tracking data to Google Analytics using the Measurement Protocol
function onOpen(){
// example send for Sheets
sendGAMP("UA-XXXX-1", SpreadsheetApp.getActiveSpreadsheet().getUrl());
// example send for Documents
//sendGAMP("UA-XXXX-1", DocumentApp.getActiveDocument().getUrl());
// example send for Forms *NOTE* getUrl not implemented yet in New Sheets
//sendGAMP("UA-XXXX-1", FormApp.getActiveForm().getUrl());
}
@miki725
miki725 / .bash_prompt.sh
Last active April 2, 2025 13:32
Custom bash prompt which displays: (virtualenv) user:/path (git-branch)
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the active virtualenv
# * the branch of the current git/mercurial repository
# * the return value of the previous command
# * the fact you just came from Windows and are used to having newlines in
# your prompts.
@tomjn
tomjn / composer.json
Last active August 29, 2015 14:05
Checking if composer ran succesfully after the fact
{
"require": {
"justinrainsdasdfbow/json-schema": "~1.1"
},
"scripts": {
"post-update-cmd": "cftp\\composer_checker::post",
"post-install-cmd": "cftp\\composer_checker::post",
"pre-install-cmd": "cftp\\composer_checker::pre",
"pre-update-cmd": "cftp\\composer_checker::pre"
},
@SimpleHomelab
SimpleHomelab / advancedsettings.xml
Last active November 5, 2021 20:43
AdvacedSettings.xml for Kodi with MySQL and other tweaks.
<!-- General Settings -->
<advancedsettings>
<loglevel hide="true">-1</loglevel> <!-- Comment: Disables logging -->
<playcountminimumpercent>95</playcountminimumpercent>
<skiploopfilter>0</skiploopfilter> <!-- Comment: For RPi or similar use 16 or higher (low CPU usage) -->
<nodvdrom>true</nodvdrom>
<!-- MySQL Library -->
<videodatabase>
<type>mysql</type>
@omegahm
omegahm / create_labels.sh
Created April 7, 2015 19:00
Create Gtihub labels from Bash
#!/usr/bin/env bash
# Colours picked from https://robinpowered.com/blog/best-practice-system-for-organizing-and-tagging-github-issues/
###
# Label definitions
###
declare -A LABELS
# Platform
@tisunov
tisunov / twitter_stylebot.css
Last active September 26, 2015 12:49
CLEAN UP TWITTER
/* CLEAN UP TWITTER
by @levelsio
use Stylebot Chrome extension to load this by default:;
https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha?hl=en
*/
/* Removes all borders in layout */
* {
border:none !important;
}
@lopezjurip
lopezjurip / README.md
Created October 22, 2015 21:05
Stackedit.io - Justify

Settings -> Extensions -> UserCustom

userCustom.onReady = function() {
    $('head').append(`<style>p, pre, blockquote {
      text-align: justify;
    }
    blockquote p, li p {
      text-indent: 0
    }</style>`);
};
@gmazzap
gmazzap / AutoPaginatedQuery.php
Last active April 8, 2016 21:49
`WP_Query` subclass that takes a non-paginated query and split into different paginated queries offering a transparent interface to "standard loop" usage.
<?php
namespace GM;
/**
* `WP_Query` subclass that takes a non-paginated query and split into different
* paginated queries offering a transparent interface to "standard loop" usage.
*
* The class is not 100% transparent:
* - the var `$posts` and the method `get_posts()`, that are not used directly
* in standard loop usage, here don't return array of all posts, but only posts