Skip to content

Instantly share code, notes, and snippets.

View mgmilcher's full-sized avatar

Marius Milcher mgmilcher

View GitHub Profile
@mgmilcher
mgmilcher / osx-server-aliases
Last active March 18, 2018 16:02
osx-server-aliases
### SERVER SERVICES ALIAS
# Nginx
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.restart='nginx.stop && nginx.start'
# PHP-FPM
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist"
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist"
alias php-fpm.restart='php-fpm.stop && php-fpm.start'
@mgmilcher
mgmilcher / gist:5eaed7714d031a12ed97
Last active March 28, 2023 14:53
Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X

This is my take on how to get up and running with NGINX, PHP-FPM, MySQL and phpMyAdmin on OSX Yosemite.

This article is adapted from the original by Jonas Friedmann. Who I just discovered is from Würzburg in Germany. A stonesthrow from where I was born ;)

Xcode

Make sure you have the latest version of XCode installed. Available from the Mac App Store.

Install the Xcode Command Line Tools:

xcode-select --install

@mgmilcher
mgmilcher / gist:029e9ebe78cc2e6c8efa
Created April 30, 2015 10:01
WP Export Posts as JSON
<?php
include "wp-load.php";
$posts = new WP_Query('post_type=any&posts_per_page=-1&post_status=publish');
$posts = $posts->posts;
/*
global $wpdb;
$posts = $wpdb->get_results("
SELECT ID,post_type,post_title
@mgmilcher
mgmilcher / range-finder.js
Created October 5, 2015 08:56
Range Finder
var x1 = 1;
var x2 = 100;
var y1 = 99;
var y2 = 1250100;
function rangeFinder(x1,x2,y1,y2) {
return Math.max(x1,y1) <= Math.min(x2,y2);
}
function initLazyImages() {
const lazyImages = document.querySelectorAll(".lazy-image");
function onIntersection(imageEntities) {
imageEntities.forEach(image => {
if (image.isIntersecting) {
observer.unobserve(image.target);
image.target.src = image.target.dataset.src;
}
});