Skip to content

Instantly share code, notes, and snippets.

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

David Flores dmouse

🏠
Working from home
View GitHub Profile
@dmouse
dmouse / oauth.module
Created August 22, 2013 18:53
Drupal 8, OAuth sample hook_menu
<?php
function oauth_menu() {
//...
$menu['admin/config/services/oauth'] = array(
'title' => 'OAuth',
'description' => 'Settings for OAuth',
'route_name' => 'oauth_admin_form',
@dmouse
dmouse / composer.json
Last active October 19, 2021 20:04
Run composer command from php script, controller, web,
{
"name": "hechoendrupal/composer-ui",
"description": "Composer UI",
"minimum-stability": "dev",
"authors": [
{
"name": "David Flore",
"email": "[email protected]"
}
],
<?php
$finder = new Finder();
$dot_dot = '';
while (true){
try {
$iterator = $finder
->files()
->name('bootstrap.inc')
->in(getcwd() . '/'. $dot_dot . 'core/includes/');
<?php
namespace Drupal\badcamp\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\ExtraModule\Annotation\Permission;
use Drupal\Core\Template\TwigEnvironment;
@dmouse
dmouse / composer.json
Created February 27, 2014 02:33
default composer.json in composer_manager
{
"repositories": [
{
"type": "composer",
"url": "http://drugist.org"
}
]
}
@dmouse
dmouse / Dockerfile
Last active June 18, 2016 04:13
This is a Dockerfile for build a image with scala and play framework
# Docker image with scala and play framework
FROM centos
MAINTAINER David Flores "[email protected]"
RUN yum update -y
RUN yum install java-1.7.0-openjdk.x86_64 -y
RUN /bin/rpm -ivh http://downloads.typesafe.com/scala/2.11.0/scala-2.11.0.rpm
RUN yum install wget unzip -y >/dev/null
RUN cd /opt && wget http://downloads.typesafe.com/play/2.2.3/play-2.2.3.zip && unzip play-2.2.3.zip
@dmouse
dmouse / composer.json
Last active August 29, 2015 14:01
Symfony Reponse examples
{
"name": "dmouse/response",
"description": "Response sample",
"require": {
"symfony/http-foundation": "2.4.*"
},
"license": "MIT",
"authors": [
{
"name": "David Flores",
@dmouse
dmouse / DefaultController.php
Last active July 20, 2021 17:03
Return a Symfony Response Object in Drupal 9 and Drupal 8
<?php
namespace Drupal\response\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\Response;
class DefaultController extends ControllerBase
{
/**
@dmouse
dmouse / Dockerfile
Last active August 29, 2015 14:01
Dockerfile to build a image with conscript and n8han/giter8 for Scala application
FROM centos
MAINTAINER David Flores "[email protected]"
RUN yum update -y
RUN yum install java-1.7.0-openjdk.x86_64 -y
RUN yum install wget unzip which -y >/dev/null
ENV HOME /root
RUN cd /tmp && wget https://raw.githubusercontent.com/n8han/conscript/master/setup.sh
RUN sh /tmp/setup.sh
<?php
/**
* @file
* Contains \Drupal\Acme\Command\AcmeCommand.
*/
namespace Drupal\Acme\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;