Skip to content

Instantly share code, notes, and snippets.

View usingthesystem's full-sized avatar

Markus Müller usingthesystem

View GitHub Profile
#!/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 / 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
@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 / 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 / functions.php
Last active November 3, 2016 10:31
robotsTxtDisallowOnDevEnv.php
<?php
add_filter( 'robots_txt', NS . 'customRobotsTxt', 10, 2 );
function customRobotsTxt($output, $public) {
if(WP_ENV == 'production') {
return $output;
} else {
return "User-agent: *\nDisallow: /";
}
}
@usingthesystem
usingthesystem / kill-meteor.sh
Created November 12, 2015 16:41
Kill all running meteor instances
kill -9 `ps ax | grep node | grep meteor | awk '{print $1}'`
@usingthesystem
usingthesystem / snippets.cson
Created October 30, 2015 02:14
Atom.io webpack-starter code snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@usingthesystem
usingthesystem / switch-node-version-with-nave.sh
Created October 12, 2015 18:06
Switch Node Version with nave
switch node version to 4.1.1
nave use 4.1.1
nave usemain 4.1.1
@usingthesystem
usingthesystem / CSScomb.sublime-settings
Created February 12, 2015 20:05
CSScomb.sublime-settings for Sublime Text
{
// Full list of supported options and acceptable values can be found here:
// https://github.com/csscomb/csscomb.js/blob/master/doc/options.md
"config": {
"block-indent": " ",
"vendor-prefix-align": true,
"space-before-closing-brace": "\n",
"space-before-selector-delimiter": 0,
"space-before-selector-delimiter": "",
"space-after-selector-delimiter": 1,
@usingthesystem
usingthesystem / rules-delimiter.js
Last active August 29, 2015 14:15
csscomb - rules-delimiter.js
// create the following file to insert the extra functionality rules-delimiter.js
// add the following to the configuration of csscomb: "rules-delimiter": 1
// ~/Library/Application Support/Sublime Text 3/Packages/CSScomb/node_modules/csscomb/lib/options/rules-delimiter.js
module.exports = {
name: 'rules-delimiter',
syntax: ['css', 'less', 'sass', 'scss'],
runBefore: "strip-spaces",
setValue: function(value) {
if (typeof value === 'number') {
value = Array(value + 1).join('\n');