Skip to content

Instantly share code, notes, and snippets.

View radermacher's full-sized avatar

Richard Radermacher radermacher

View GitHub Profile
@radermacher
radermacher / ThemosisValetDriver.php
Created February 8, 2017 14:12 — forked from ramon-villain/ThemosisValetDriver.php
Themosis 1.3 Valet Driver
<?php
class ThemosisValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@radermacher
radermacher / AppServiceProvider.php
Created January 20, 2017 14:20 — forked from lukepolo/AppServiceProvider.php
Laravel Scout Engine for Elasticsearch
// inside boot()
resolve(EngineManager::class)->extend('elasticsearch', function () {
return new ElasticsearchEngine(ClientBuilder::fromConfig(config('scout.elasticsearch.config')), config('scout.elasticsearch.index'));
});
@radermacher
radermacher / install_elasticsearch.sh
Last active March 11, 2016 08:35
Install Elasticsearch 2.x by mikestivala (http://forgerecipes.com/recipes/73)
echo ">> Installing Elastic GPG Key"
wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -
echo ">> Adding deb package"
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
echo ">> Updating apt"
add-apt-repository ppa:webupd8team/java
apt-get update
@radermacher
radermacher / php_object_to_array.php
Last active September 16, 2015 10:00 — forked from victorbstan/php_object_to_array.php
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);
@radermacher
radermacher / install.sh
Last active August 29, 2015 14:13 — forked from fideloper/install.sh
Vagrant Provisioning Script for PHP applications. This installs a LAMP stack.
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
# Install MySQL without prompt
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@radermacher
radermacher / vhost.sh
Created January 14, 2015 22:08 — forked from fideloper/vhost.py
Create vHost Ubuntu Lamp-Server (bash)
#! /bin/bash
# Run this as sudo!
# I move this file to /usr/local/bin/vhost and run command 'vhost' from anywhere, using sudo.
#
# Show Usage, Output to STDERR
#
function show_usage {
cat <<- _EOF_
alias restart-network="sudo ifconfig en0 down; sudo ifconfig en1 down;sudo ifconfig en0 up; sudo ifconfig en1 up";
/* Clear Floated Elements
----------------------------------------------------------------------------------------------------*/
/* http://sonspring.com/journal/clearing-floats */
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z]+)/([^/]*)$ resize.php?size=$1&file=$2