Skip to content

Instantly share code, notes, and snippets.

View asakurayoh's full-sized avatar

Maxime Lafontaine asakurayoh

View GitHub Profile
@ziadoz
ziadoz / awesome-php.md
Last active March 4, 2024 08:42
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@anchetaWern
anchetaWern / laravel-ums.markdown
Created December 6, 2012 11:14
Building a User Management System in Laravel

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users
@adamwathan
adamwathan / promise-take-at-least.js
Last active February 26, 2023 14:25
Promise.takeAtLeast
// Creates a new promise that automatically resolves after some timeout:
Promise.delay = function (time) {
return new Promise((resolve, reject) => {
setTimeout(resolve, time)
})
}
// Throttle this promise to resolve no faster than the specified time:
Promise.prototype.takeAtLeast = function (time) {
return new Promise((resolve, reject) => {
@lyrixx
lyrixx / post-checkout
Created June 26, 2013 13:37
Git post checkout
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
NOCOLOR='\e[0m'
@NamelessCoder
NamelessCoder / injectionmethods.md
Last active February 12, 2020 15:59
Why you should never use @Inject in TYPO3 Extbase

This mini-article describes the methods of dependency injection, what each method implies in terms of both performance and simplicity.

  1. Constructor injection

This method is half manual and quite well known. Declare your classes' dependencies as constructor and pass the dependencies when you construct your instances. This approach completely skips the automation around detection of injections - but performs the best of all methods.

@kapv89
kapv89 / query-logger.php
Last active January 8, 2019 15:21
Log Queries in L4
<?php
Event::listen('illuminate.query', function($query, $bindings, $time) {
static $count;
if(App::make('env') === 'local')
{
$logFile = __DIR__.'/../storage/logs/queries';
ob_start();
var_dump($bindings, $query);
$str = ob_get_clean();
if($count === null)
@daum
daum / gist:5051173
Last active December 14, 2015 07:29
static public function listenToRoutingLoadConfigurationEvent(sfEvent $event)
{
$r = $event->getSubject();
$r->prependRoute('landing_page_noParam', new sfRoute('/some-route-there', array('module' => 'someModule', 'action' => 'showPage')));
}