Skip to content

Instantly share code, notes, and snippets.

View danielnv18's full-sized avatar

Daniel Noyola danielnv18

View GitHub Profile
<?php
function in_multiarray($elem, $array) {
$top = sizeof($array) - 1;
$bottom = 0;
while($bottom <= $top) {
if($array[$bottom] == $elem)
return true;
else
if(is_array($array[$bottom]))
if(in_multiarray($elem, ($array[$bottom])))
@danielnv18
danielnv18 / .gitignoreDrupal
Last active August 29, 2015 14:01
Git ignore for drupal projects
# Ignore configuration files that may contain sensitive information.
sites/*/settings*.php
# Ignore paths that contain user-generated content.
/sites/*/files
/sites/*/private
/files/*
/cache
# Packages #
@danielnv18
danielnv18 / RemoveInvisibleCharacter.php
Created June 18, 2014 14:19
This also wipes newline . This will come handy if you are trying to printing javascript code within php
<?php
preg_replace('/\p{C}+/u', '', $topic_obj->description)
@danielnv18
danielnv18 / .gitignoreAndroid
Created June 18, 2014 17:18
Git ignore for android projects
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
@danielnv18
danielnv18 / example.info.yml
Created December 22, 2014 04:22
Ejemplo de un archivo info en drupal 8
name: El nombre que nuestro modulo va a tener
description: 'la descripción de nuestro modulo'
type: module
core: 8.x
@danielnv18
danielnv18 / download-drush.sh
Created December 31, 2014 20:48
Shell steps for install latest drush version
cd /usr/share
sudo git clone --branch master https://github.com/drush-ops/drush.git
<?php
/**
* @file
* Contains Drupal\demo\Plugin\Block\DemoBlock.
*/
namespace Drupal\demo\Plugin\Block;
use Drupal\Core\Block\BlockBase;
@danielnv18
danielnv18 / AdminForm.php
Created January 4, 2015 21:02
Create a form in drupal 8
<?php
/**
* @file
* Contains Drupal\demo\Form\AdminForm.
*/
namespace Drupal\demo\Form;
use Drupal\Core\Form\ConfigFormBase;
<?php
namespace AppBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\HttpFoundation\RequestStack;
class MenuBuilder
{
private $factory;
@danielnv18
danielnv18 / Dockerfile
Last active March 24, 2021 18:38
Docker with php 7.0 with unixodbc, Microsoft ODBC Driver 13 for Linux and pdo_sql
FROM php:7.0.10-fpm
MAINTAINER Daniel Noyola <[email protected]>
# install the PHP extensions we need
RUN apt-get update && apt-get install -y locales unixodbc libgss3 odbcinst devscripts debhelper dh-exec dh-autoreconf libreadline-dev libltdl-dev unixodbc-dev wget unzip \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-install pdo \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen