Skip to content

Instantly share code, notes, and snippets.

View dommmel's full-sized avatar
💭
That worked!

Dominik dommmel

💭
That worked!
View GitHub Profile
@dommmel
dommmel / mamp_function
Last active March 24, 2018 20:10 — forked from jonathanstark/mamp_function
Serve the current directory with MAMP from the command line
function mamp() {
#
# Default location of the apache conf file for MAMP
CONF_FILE="/Applications/MAMP/conf/apache/httpd.conf"
#
# Fish existing doc root out of conf file
LINE=$(cat $CONF_FILE | grep "^DocumentRoot")
QUOTED_STRING=${LINE/DocumentRoot /}
OLD_DOC_ROOT=${QUOTED_STRING//\"/}
#
require 'rufus/scheduler'
scheduler = Rufus::Scheduler.start_new
if Rails.env.production?
scheduler.every '10m' do
require "net/http"
require "uri"
Net::HTTP.get_response(URI.parse(ENV["HOSTNAME"]))
end
end
@dommmel
dommmel / static_server.js
Last active August 1, 2018 13:29 — forked from ryanflorence/static_server.js
Node.JS static file web server. Put it in your path to fire up servers in any directory, takes an optional port argument.
#!/usr/bin/env node
var http = require("http"),
url = require("url"),
path = require("path"),
fs = require("fs"),
port = process.argv[2] || 8888;
http.createServer(function(request, response) {