Skip to content

Instantly share code, notes, and snippets.

View edutrul's full-sized avatar
💭
Changing the world

Eduardo Telaya edutrul

💭
Changing the world
View GitHub Profile
@edutrul
edutrul / mymodule.install
Created June 7, 2017 16:02
Removes FIELD_NAME from ALL content types on DRUPAL8
/**
* Removes FIELD_NAME from ALL content types.
*/
function MYMODULE_update_8001(&$sandbox) {
$contentTypes = [
'blog_post',
'case_study',
'industry',
'video',
'whitepaper'
@edutrul
edutrul / KINT-tip.md
Created May 26, 2017 23:03
KINT tip from Jorge Salinas

Si usan {{ dump(variable) }} o {{ kint(variable) }} en twig y les da un wod o un error 500 al cargar la página, 99% del tiempo es por falta de memoria. En kint lo solucionan poniendo esto en el settings.local.php

require_once DRUPAL_ROOT . ‘/modules/contrib/devel/kint/kint/Kint.class.php’; Kint::$maxLevels = 6;

con dump() no hay solucion :( Por si sirve 🤓

@edutrul
edutrul / views-view-unformatted--hero_slider--block_homepage_slider.htm.twig
Created May 26, 2017 19:08
templates/views/views-view-unformatted--hero_slider--block_homepage_slider.html.twig
{#
/**
* @file
* Theme override for main view template.
*
* Available variables:
* - attributes: Remaining HTML attributes for the element.
* - css_name: A css-safe version of the view name.
* - css_class: The user-specified classes names, if any.
* - header: The optional header.
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
@edutrul
edutrul / ScrollDown_with_awesome_loop.js
Created April 22, 2017 17:15
ScrollDown_with_awesome_loop.js
import React, { Component } from 'react';
import { AppRegistry, ScrollView, Image, Text } from 'react-native'
class IScrolledDownAndWhatHappenedNextShockedMe extends Component {
render() {
return (
<ScrollView>
{Array.apply(0 , Array(50)).map(function (x, i) {
return <Text style={{fontSize:1+i, color: 'red'}}>Te amo Alexandra ♡ {i} - {x}</Text>;
@edutrul
edutrul / ScrollDown_with_classic_loop.js
Created April 22, 2017 15:56
[REACT NATIVE] Scroll down with classic loop
import React, { Component } from 'react';
import { AppRegistry, ScrollView, Image, Text } from 'react-native'
class IScrolledDownAndWhatHappenedNextShockedMe extends Component {
render() {
var rows = [];
for (var i = 0; i < 30; i++) {
rows.push(<Text style={{fontSize:1+i}}>Te amo Alexandra</Text>);
}
return (
import React, { Component } from 'react';
import { AppRegistry, Text, TextInput, View } from 'react-native';
class PizzaTranslator extends Component {
constructor(props) {
super(props);
this.state = {text: ''};
}
render() {
@edutrul
edutrul / template_string.js
Created April 12, 2017 06:16
template_string.js
let topic = {
'title': 'my title',
'author': 'edu',
'body': 'omg'
};
let title = `<h2> ${topic.title} </h2>`;
let author = `<small> ${topic.author} </small>`;
let body = `<p> ${topic.body}</p>`;
let message = { title, author, body };
console.log(message);
@edutrul
edutrul / MessageApp.js
Created April 12, 2017 04:54
MessageApp.js in react native
import React, { Component } from 'react';
import { AppRegistry, Text } from 'react-native';
class MessageApp extends Component {
render() {
return (
<Text>This is my message yes sir!! tomorrow meeting! :)</Text>
);
}
}
@edutrul
edutrul / CustomFormatter.php
Last active April 2, 2017 21:59
How to attach a library from a custom FieldFormatter! :) Works
<?php
namespace Drupal\custom\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
/**
* Plugin implementation of the 'Custom' formatter.
*
* @FieldFormatter(