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 / TestController.php
Created November 17, 2016 21:39
/Users/edutrul/Projects/magic-gen/src/AppBundle/Controller/TestController.php
<?php
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Finder\Finder;
class TestController extends Controller
@edutrul
edutrul / block_context.php
Created November 20, 2016 23:30
Create a block with Context to be used in panels and load context entity:node
<?php
namespace Drupal\dies_event\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* @file
* Article Library Menu.
*/
<?php
//https://api.drupal.org/api/views/views.api.php/function/hook_views_pre_view/7.x-3.x
/**
* Implements hook_views_pre_view().
*/
function dies_service_views_pre_view(ViewExecutable $view, $display_id, array &$args) {
// The term name cannot be extracted and assigned to the view as a
// contextual filter using page_manager currently. Instead, we
// pass keyword argument here.
@edutrul
edutrul / SocialBlock.php
Created November 23, 2016 19:15
Social links (@todo FB SHARE and Linkedin)
<?php
namespace Drupal\dies_event\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* @file
* Render Social links.
*/
@edutrul
edutrul / block--entity-field--node--title.html.twig
Created November 24, 2016 21:18
themes/custom/dies/templates/block/block--entity-field--node--title.html.twig
{#
/**
* @file
* Theme override to display a block.
*
* Available variables:
* - plugin_id: The ID of the block implementation.
* - label: The configured label of the block if visible.
* - configuration: A list of the block's configuration values.
* - label: The configured label for the block.
@edutrul
edutrul / anom_function_map.js
Last active March 27, 2017 01:51
JAVASCRIPT self study - EDUTRUL
var passengers = [
["Thomas", "Meeks"],
["Gregg", "Pollack"],
["Christine", "Wong"],
["Dan", "McGaw"]
];
var modifiedNames = passengers.map(function (arrayCell) {
return arrayCell[0] + ' ' + arrayCell[1];
});
@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(
@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 / 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);
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() {