Skip to content

Instantly share code, notes, and snippets.

View usingthesystem's full-sized avatar

Markus Müller usingthesystem

View GitHub Profile
@usingthesystem
usingthesystem / Autoloader.php
Last active November 14, 2016 20:39
autoload files in php
<?php
// source: http://php.net/manual/de/language.oop5.autoload.php#99173
class autoloader {
public static $loader;
public static function init()
{
if (self::$loader == NULL)
self::$loader = new self();
@usingthesystem
usingthesystem / gist:879491d2690974c97ebc810fecdf5977
Created November 15, 2016 21:29
Get all script tags from a string
<?php
$js = "";
$content = file_get_contents("http://website.com");
preg_match_all('#<script(.*?)</script>#is', $content, $matches);
foreach ($matches[0] as $value) {
$js .= $value;
}
@usingthesystem
usingthesystem / fix-wordpress-permissions.sh
Created November 23, 2016 11:57 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
#!/bin/bash
#By Nate Flink
#Invoke on the terminal like this
#curl -s https://gist.github.com/nateflink/9056302/raw/findreplaceosx.sh | bash -s "find-a-url.com" "replace-a-url.com"
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: ./$0 [find string] [replace string]"
exit 1
fi
@usingthesystem
usingthesystem / index.js
Created September 29, 2017 23:06 — forked from sillysachin/index.js
headless chrome screenshot index
const CDP = require('chrome-remote-interface');
const argv = require('minimist')(process.argv.slice(2));
const file = require('fs');
// CLI Args
const url = argv.url || 'https://www.google.com';
const format = argv.format === 'jpeg' ? 'jpeg' : 'png';
const viewportWidth = argv.viewportWidth || 1440;
const viewportHeight = argv.viewportHeight || 900;
const delay = argv.delay || 0;
const puppeteer = require('puppeteer');
//const mkdirp = require('mkdirp');
const fs = require('file-system');
// Put your custom dimension and name Here
const devices = [
{ name: 'Highest', width: 1920, height: 1080 },
{ name: 'Laptop-1', width: 1366, height: 768 },
{ name: 'Laptop-2', width: 1360, height: 768 },
{ name: 'Small-Desktop-1', width: 1280, height: 800 },
@usingthesystem
usingthesystem / git-commit-log-stats.md
Created February 17, 2018 03:27 — forked from eyecatchup/git-commit-log-stats.md
Some commands to get git commit log statistics for a repository on the command line.

git commit stats

Commands to get commit statistics for a Git repository from the command line -
using git log, git shortlog and friends.




@usingthesystem
usingthesystem / .htaccess
Created April 5, 2018 17:36
flynt .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@usingthesystem
usingthesystem / flynt-composer.sh
Last active April 5, 2018 18:08
flynt composer packages
composer require "mdsimpson/contact-form-7-to-database-extension"
composer require "wpackagist-plugin/contact-form-7"
composer require "wpackagist-plugin/duplicate-page"
composer require "wpackagist-plugin/duplicate-post"
composer require "wpackagist-plugin/email-address-encoder"
composer require "wpackagist-plugin/enable-media-replace"
composer require "wpackagist-plugin/favicon-by-realfavicongenerator"
composer require "wpackagist-plugin/redirection"
composer require "wpackagist-plugin/regenerate-thumbnails"
composer require "wpackagist-plugin/relevanssi"
# A; B Run A and then B, regardless of success of A
# A && B Run B if A succeeded
# A || B Run B if A failed
# A & Run A in background.