Skip to content

Instantly share code, notes, and snippets.

View SelrahcD's full-sized avatar

Charles SelrahcD

View GitHub Profile
@SelrahcD
SelrahcD / gist:7042692
Last active December 25, 2015 21:29
AngularJs directive for PrismJs
angular.module('Prism', []).
directive('prism', [function() {
return {
restrict: 'A',
link: function ($scope, element, attrs) {
element.ready(function() {
Prism.highlightElement(element[0]);
});
}
}
var module = angular.module('Test', []);
module.service('TestService', ['ServiceA', function(serviceA) {
}]);
module.service('ServiceA', function() {
// First implementation of Service A
});
module.service('ServiceABis', function() {
@SelrahcD
SelrahcD / Readme.md
Last active August 29, 2015 14:03
Git hooks

#Git-hooks

*pre-commit : Checks phpcs rules against files in the index (after git add) before allowing you to commit. *post-merge/post-checkout : Run composer if needed and display a message if parameters.yml.dist is changed

Options

You can add a file called config with your githooks to override some of the scripts options.

Some more goodness

You should install ponysay and

@SelrahcD
SelrahcD / Clean Cotcot.md
Last active August 29, 2015 14:07
Clean cotcot

Nettoyage CotCot & Eve

Controllers & Templates

Liste des quotes

Controller

  • Passer sur le ListController de ev-fdm
  • Revoir le système de filtres
@SelrahcD
SelrahcD / gist:c5d4f03b61860ecb174e
Created January 22, 2015 10:00
Perf test method
function test($closure, $name = null, $loop = 1000000) {
$start = microtime(true);
for($i = 0; $i < $loop; $i++) {
$closure();
}
$time = microtime(true) - $start;
if($name) {
<?php
class Discussion
{
private $id;
private function __construct(DiscussionId $discussionId)
{
$this->id = $discussionId;
}
@SelrahcD
SelrahcD / talks.md
Last active January 15, 2018 13:04
<?php
$str = "Something";
$stringValue = array_reduce(str_split($str), function($carry, $char) {
return $carry + ord($char);
}, 0);
while($stringValue > 10)
{
@SelrahcD
SelrahcD / TypeTest.php
Last active November 9, 2016 09:32
TypeTest.php
<?php
class Type {
const TYPE_A = 1;
const TYPE_B = 2;
const TYPE_C = 3;
private $type;
private function __construct($type)