Skip to content

Instantly share code, notes, and snippets.

View nietzscheson's full-sized avatar

Cristian nietzscheson

View GitHub Profile
@nietzscheson
nietzscheson / 1 - BaseModel Event - EventListener
Last active August 29, 2015 14:24
[#Symfony] BaseModel Event - EventListener
1 - Inicio
2 - Se crea una class final
3 - Se crea una class Event
4 - Se crea una class EventListener
5 - Se registra el Listener como servicio
6 - Se lanza el event
@nietzscheson
nietzscheson / introrx.md
Last active August 29, 2015 14:24 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called Reactive Programming, particularly its variant comprising of Rx, Bacon.js, RAC, and others.

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@nietzscheson
nietzscheson / Template Render
Last active July 15, 2016 21:29
[#Symfony] - MessengerFlash
{% for flashMessage in app.session.flashbag.get('type') %}
<div class="alert alert-{{ app.session.flashbag.get('type') }} alert-dismissible fade in" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>{{ flashMessage }}</strong>
</div>
{% endfor %}
@nietzscheson
nietzscheson / MailerService
Created July 14, 2015 02:31
MailerService
<?php
namespace AppBundle\Utils;
class MailerService
{
private $contentType;
private $subject;
private $from;
## http://www.scott-sherwood.com/tutorial/symfony-2-0-embedded-forms-for-collections/
<form>
{% macro prototype(entities) %}
<tr>
<td>{{form_widget(entities.entitie[0])}}</td>
<td>{{form_widget(entities.entitie[1])}} </td>
<td>
{{ entity.vars.value.id }}
{% if course is defined %}
<ol class="breadcrumb">
<li><a href="{{ path('moocsy_admin_courses') }}">Courses</a></li>
{% if module is defined %}
<li><a href="{{ path('moocsy_admin_course', { course: course.slug }) }}">{{ course.course }}</a></li>
{% if item is defined %}
<li><a href="{{ path('moocsy_admin_course_module', { course: course.slug, module: module.slug }) }}">{{ module.module }}</a></li>
{% if question is defined %}
<li><a href="{{ path('moocsy_admin_course_module_item', { course: course.slug, module: module.slug, item:item.slug }) }}">{{ item.item }}</a></li>
<li class="active">{{ question.question }}</li>
@nietzscheson
nietzscheson / README.md
Created October 2, 2015 14:29 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@nietzscheson
nietzscheson / gist:0d074788f58a5a353c74
Created October 21, 2015 14:04 — forked from ptz0n/gist:1646171
Recursive merge of arrays with integer keys
<?php
/**
* Merge two dimensional arrays my way
*
* Will merge keys even if they are of type int
*
* @param array $array1 Initial array to merge.
* @param array ... Variable list of arrays to recursively merge.
*
@nietzscheson
nietzscheson / README.md
Created October 29, 2015 02:45 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet