Skip to content

Instantly share code, notes, and snippets.

View Mulkave's full-sized avatar
🍅
binge coding

Abed Halawi Mulkave

🍅
binge coding
View GitHub Profile
@Mulkave
Mulkave / drupal-nginx-virtualhost.conf
Created July 29, 2013 09:08
drupal virtual host configuration for Nginx
server {
server_name [host];
root /var/www/[document_root]; ## <-- Your only path reference.
# Enable compression, this will help if you have for instance advagg module
# by serving Gzip versions of the files.
gzip_static on;
location = /favicon.ico {
@Mulkave
Mulkave / php-built-in-server-runners.php
Last active March 20, 2021 05:31
This is a way to leverage the PHP built-in web server in your tests. Uses the new @beforeClass and @afterclass annotation introduced in phpunit v3.8.x.
<?php
Class MyTest extends PHPUnit_Framework_TestCase {
static $pidfile = './.pidfile';
static $serverHost = 'localhost';
static $serverPort = '6767';
public static function serverURL()
{
<?php
/**
* @dataProvider generousDataProvider::giveMeInput()
*/
public fucntion test_thy_feature($input)
{
// Mock Job that make an external HTTP request
$mOperation = Mockery::mock(GetTheBeansOperation::class, [$input])->makePartial();
$mOperation->shouldReceive('run')
@Mulkave
Mulkave / Dockerfile-supervisor
Last active November 16, 2020 21:01
A Dockerfile for Fedora/CentOS/Red Hat based systems that creates an image with supervisord running sshd that uses SSH keys for authentication.
##
#
# setup:
# - generate an ssh key to be used as an authentication key with `ssh-keygen` and call it `docker_ssh_rsa`
# - make sure your current ssh agent has the identity file added
# - $ eval `ssh-agent`
# - $ ssh-add docker_ssh_rsa
#
# build: $ sudo docker build -t <you>/spvssh .
#
#!/bin/bash
echo -n "GitHub User: "
read USER
echo -n "GitHub Password: "
read -s PASS
echo ""
echo -n "GitHub Repo (e.g. foo/bar): "
@Mulkave
Mulkave / fm-synth-avaudioengine.swift
Created March 24, 2016 12:58 — forked from rgcottrell/gist:5b876d9c5eea4c9e411c
An FM Synthesizer in Swift using AVAudioEngine
import AVFoundation
import Foundation
// The maximum number of audio buffers in flight. Setting to two allows one
// buffer to be played while the next is being written.
private let kInFlightAudioBuffers: Int = 2
// The number of audio samples per buffer. A lower value reduces latency for
// changes but requires more processing but increases the risk of being unable
// to fill the buffers in time. A setting of 1024 represents about 23ms of
@Mulkave
Mulkave / mb_parse_url.php
Created February 27, 2015 10:15
UTF-8 aware parse_url() replacement
// Courtesy of http://php.net/manual/en/function.parse-url.php#114817
/**
* UTF-8 aware parse_url() replacement.
*
* @return array
*/
function mb_parse_url($url)
{
$enc_url = preg_replace_callback(
@Mulkave
Mulkave / gcrgc.sh
Created October 28, 2017 16:27 — forked from ahmetb/gcrgc.sh
Script to clean up Google Container Registry images pushed before a particular date
#!/bin/bash
# Copyright © 2017 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
<?php
class CreateArticleFeature extends Feature
{
public function handle(Request $request)
{
$this->run(new ValidateArticleInputForCreationJob($request->input()));
// process cover photo
$cover = $this->run(ProcessArticleCoverOperation::class);
<?php
class ProcessArticleCoverOperation extends Operation
{
public function handle(Request $request)
{
$photo = $this->run(MakePhotoFromDataJob::class, ['data' => $request->input('photo')]);
$this->run(new ValidateCoverPhotoDimensionsJob($photo));
$variations = $this->run(new GeneratePhotoVariationsJob($photo));
$uploads = $this->run(new UploadFilesToCdnJob($variations));