Skip to content

Instantly share code, notes, and snippets.

View srdjanmarjanovic's full-sized avatar

Srdjan Marjanovic srdjanmarjanovic

View GitHub Profile
@srdjanmarjanovic
srdjanmarjanovic / curl-verbose.php
Created August 31, 2017 07:31 — forked from hubgit/curl-verbose.php
Verbose cURL in PHP
<?php
// Request URL
$url = 'http://www.google.com/';
// HTTP headers
$headers = array(
//'Content-Type: application/json',
//'Accept: application/json',
);
@srdjanmarjanovic
srdjanmarjanovic / nginx-mamp-macports.txt
Created August 28, 2017 11:01 — forked from raamdev/nginx-mamp-macports.txt
These are the steps to get Nginx running alongside MAMP on a Mac.
# These steps will get nginx installed on your Mac for local development and
# testing purposes, to be used alongside MAMP (which already includes Apache).
# The following steps assume that you're running MAMP and that you already
# have php-cgi in /Applications/MAMP/bin/php/php5.4.10/bin/php-cgi.
# The start-nginx and stop-nginx scripts created at the end do not
# start or stop MySQL because it is assumed that you normally run MAMP
# with Apache + MySQL turned on and that you occasionally want to switch
# your web server to Nginx for testing purposes and that you leave MySQL running.
# This process was tested successfully on OS X 10.9.
@srdjanmarjanovic
srdjanmarjanovic / gist:44b5fa6a5fcf8b3e29b84c5c536f71f7
Last active May 18, 2017 20:35 — forked from tabacitu/gist:dbcfd71375e72c857474
Tabacitu Laravel Package Service Provider boilerplate code
<?php
namespace League\Skeleton;
use Illuminate\Support\ServiceProvider;
use Illuminate\Routing\Router;
class SkeletonServiceProvider extends ServiceProvider
{
/**
@srdjanmarjanovic
srdjanmarjanovic / pattern-strategy.php
Created December 30, 2016 22:12
Simple PHP example of the Strategy Design Pattern
<?php
interface StrategyInterface {
/**
* Do something.
*/
public function handle();
}
class Context {
@srdjanmarjanovic
srdjanmarjanovic / pattern-state.php
Last active December 29, 2016 23:22
Simple Light On/Off PHP example of the State Design Pattern
<?php
interface StateInterface {
/**
* Turn the light on.
*/
public function ligthOn();
/**
* Turn the light off.
@srdjanmarjanovic
srdjanmarjanovic / SSH key copy
Last active December 24, 2016 20:33 — forked from JeffreyWay/gist:6176883
Add this to your bash_profile. Now, whenever you need to fetch your ssh-key, just type sshkey, and it'll be copied to your clipboard.
alias sshkey="cat ~/.ssh/id_rsa.pub | pbcopy && echo 'Copied to clipboard.'"
@srdjanmarjanovic
srdjanmarjanovic / Vagrantfile
Created December 24, 2016 20:28 — forked from JeffreyWay/Vagrantfile
Quickie vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.21"
@srdjanmarjanovic
srdjanmarjanovic / decorator.php
Created December 24, 2016 20:10 — forked from JeffreyWay/decorator.php
Decorator PHP dummy example
<?php
interface Thing {
public function execute();
}
class A implements Thing {
public function execute()
@srdjanmarjanovic
srdjanmarjanovic / Pretty git log
Created December 24, 2016 20:07 — forked from JeffreyWay/.bash_profile
Prettier git logs
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

Keybase proof

I hereby claim:

To claim this, I am signing this object: