Skip to content

Instantly share code, notes, and snippets.

View fabricekabongo's full-sized avatar
🇨🇩
proudly congolese

Fabrice Kabongo fabricekabongo

🇨🇩
proudly congolese
View GitHub Profile
$data = '[{"id":1,"first_name":"Halli","last_name":"Serridge","date":"2017-01-31","location":"Prosyana"},
{"id":2,"first_name":"Henrieta","last_name":"Salzburg","date":"2016-08-20","location":"Antalaha"},
{"id":3,"first_name":"Matteo","last_name":"Fogt","date":"2016-04-15","location":"Fucheng"},
{"id":4,"first_name":"Gray","last_name":"Trosdall","date":"2016-08-15","location":"Yinglong"},
{"id":5,"first_name":"Jerome","last_name":"Edmonson","date":"2017-05-24","location":"San Jose"},
{"id":6,"first_name":"Else","last_name":"Massie","date":"2016-07-14","location":"Tours"},
{"id":7,"first_name":"Marleah","last_name":"Tamblyn","date":"2017-07-29","location":"Kazimierz Dolny"},
{"id":8,"first_name":"Richy","last_name":"Nowaczyk","date":"2017-05-24","location":"Torsby"},
{"id":9,"first_name":"Yuma","last_name":"Torn","date":"2016-10-20","location":"Veruela"},
{"id":10,"first_name":"Leann","last_name":"Giberd","date":"2017-05-31","location":"Najin"}]';
@fabricekabongo
fabricekabongo / consul.xml
Created January 23, 2017 09:55
Service definition of Consul for Firewalld
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>consul</short>
<description>Consul makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. Register external services such as SaaS providers as well.</description>
<port protocol="tcp" port="8300"/>
<port protocol="tcp" port="8301"/>
<port protocol="tcp" port="8302"/>
<port protocol="tcp" port="8400"/>
<port protocol="tcp" port="8500"/>
<port protocol="tcp" port="8600"/>
@fabricekabongo
fabricekabongo / .htaccess
Created December 12, 2015 16:48
How to avoid cross errors
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "15552000"
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"
# and after RewriteEngine On
RewriteCond %{REQUEST_METHOD} OPTIONS
RewriteRule ^(.*)$ $1 [R=200,L]
@fabricekabongo
fabricekabongo / easygallery.html
Last active November 16, 2015 11:03
small gallery
<!Doctype html>
<html>
<head>
<title>Easy Gallery by Fabrice Kabongo</title>
</head>
<body>
<div class="carousel-item" style="display: block">
<img src="http://lorempixel.com/200/200/sports" width="100" />
</div>
<div class="carousel-item" style="display: none">
@fabricekabongo
fabricekabongo / formatDate.js
Created September 26, 2015 17:23 — forked from cstipkovic/formatDate.js
A simple format Date function using Javascript prototype
/*
Based on Rick Strahl code
http://www.west-wind.com/weblog/posts/2008/Mar/18/A-simple-formatDate-function-for-JavaScript
Contributors:
Clauber Stipkovic - @clauberhalic
Mário Rinaldi - @MarioRinaldi
*/
Date.prototype.formatDate = function (format) {
@fabricekabongo
fabricekabongo / request scope issue
Created June 3, 2015 14:31
How to bypass request scope issue on command with twig
try{
$em->flush();
}catch(InactiveScopeException $ex){
/*
* if the request scope is not yet created in another command
* we create a new request
* and try to save
*/
if (PHP_SAPI == 'cli') {
$request = new Request();
<?php
namespace Sacoza\ClientBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sacoza\CoreBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sacoza\ClientBundle\Entity\CompanyAuditor;
@fabricekabongo
fabricekabongo / social content
Last active August 29, 2015 14:20
A good way to show a media content on your application using the api (this gist only cover the rendering theme, using bootstrap 2.6)
<div class="media">
<a class="pull-left" href="#">
<img src="" style="width: 64px; height: 64px;" alt="64x64" class="media-object">
</a>
<div class="media-body">
<div class="thumbnail row">
<div class="row">
<img src="" class="span12" />
</div>
<div class="row">