Skip to content

Instantly share code, notes, and snippets.

View mdjaman's full-sized avatar
🏠
Working from home

Marcel Djaman mdjaman

🏠
Working from home
View GitHub Profile
@mdjaman
mdjaman / y.php
Last active August 29, 2015 14:21 — forked from alixaxel/y.php
<?php
namespace alixaxel;
class y
{
public static function Coalesce()
{
foreach (func_get_args() as $argument)
{
@mdjaman
mdjaman / react-helper.js
Created October 14, 2015 19:21 — forked from tungd/react-helper.js
React Helper to initialize the component from HTML, similar to AngularJS.
/**
* react-helper.js
*
* Helper for Facebook's React UI Library. Add support for declare
* component on DOM (similar to AngularJS Directive).
*
* Usage:
* - Register a component:
* ReactHelper.register('MyComponent', MyComponent)
* - Declare the DOM node:
@mdjaman
mdjaman / VBOX_E_INVALID_VM_STATE.md
Created November 2, 2015 10:03 — forked from hsiboy/VBOX_E_INVALID_VM_STATE.md
rescue a VM from VBOX_E_INVALID_OBJECT_STATE

#Issue

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
@mdjaman
mdjaman / Q.js Examples
Created November 10, 2015 16:19 — forked from guptag/Q.js Examples
Q.js examples - Small snippets to understand various api methods in Q.js
//To run Q.js examples:
// 1. Open a new browser tab in Chrome and turn on developer toolbar.
// 2. Copy/Paste this gist in the console (opened from any http site) and hit enter to run the snippets.
// Based on the inspiration from samples @ https://github.com/kriskowal/q
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
@mdjaman
mdjaman / application.js
Created November 28, 2015 12:43 — forked from dshaw/application.js
socket.io application and haproxy configuration
var express = require('express');
var redis = require('redis');
const serverType = process.argv[2];
const serverHost = process.argv[3];
const serverPort = parseInt(process.argv[4]);
const redisPort = 6379;
const redisHost = '127.0.0.1';
@mdjaman
mdjaman / generator.php
Created December 4, 2015 20:18 — forked from tawfekov/generator.php
Doctrine2 Generate Entities form Existing Database
<?php
include '../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Entities', __DIR__);
$classLoader->register();
$classLoader = new \Doctrine\Common\ClassLoader('Proxies', __DIR__);
$classLoader->register();
// config
$config = new \Doctrine\ORM\Configuration();
@mdjaman
mdjaman / gist:c9bc76269035157d6b977312e44303c8
Created May 25, 2016 10:46 — forked from tairov/gist:11289983
php, rabbitmq, delayed messages
// include the AMQPlib Classes || use an autoloader
// queue/exchange names
$queueRightNow = 'right.now.queue';
$exchangeRightNow = 'right.now.exchange';
$queueDelayed5sec = 'delayed.five.seconds.queue';
$exchangeDelayed5sec = 'delayed.five.seconds.exchange';
$delay = 5; // delay in seconds
@mdjaman
mdjaman / test.js
Created June 30, 2016 15:05 — forked from mscdex/test.js
sharing sessions between node.js and php using redis
var express = require('express'),
app = express(),
cookieParser = require('cookie-parser'),
session = require('express-session'),
RedisStore = require('connect-redis')(session);
app.use(express.static(__dirname + '/public'));
app.use(function(req, res, next) {
if (~req.url.indexOf('favicon'))
return res.send(404);
@mdjaman
mdjaman / supervisord-example.conf
Created August 18, 2016 21:08 — forked from didip/supervisord-example.conf
Example for supervisord conf file
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
@mdjaman
mdjaman / backup.sh
Created August 18, 2016 21:11 — forked from karussell/backup.sh
Backup ElasticSearch with rsync
# TO_FOLDER=/something
# FROM=/your-es-installation
DATE=`date +%Y-%m-%d_%H-%M`
TO=$TO_FOLDER/$DATE/
echo "rsync from $FROM to $TO"
# the first times rsync can take a bit long - do not disable flusing
rsync -a $FROM $TO
# now disable flushing and do one manual flushing