Skip to content

Instantly share code, notes, and snippets.

View nietzscheson's full-sized avatar

Cristian Angulo nietzscheson

View GitHub Profile
@nietzscheson
nietzscheson / Modal Embed
Last active January 19, 2016 17:45
#Symfony, #Twig - Modal Embed
{% set _title = block('title') %}
{% set _body = block('body') %}
<div class="modal fade {% if type is defined %} bs-example-modal-{{ type }} {% endif %}" id="{{ id|default('modal')}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog {% if type is defined %} modal-{{ type }} {% endif %}" role="document">
<div class="modal-content">
{% if _title is not empty %}
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
@nietzscheson
nietzscheson / MenuBuilder.php
Created January 26, 2016 18:03 — forked from nielsmouthaan/MenuBuilder.php
Custom KnpMenuBundle navigation bar twig template to support Font Awesome icons & Twitter bootstrap lay-out
<?php
namespace Acme\HelloBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class MenuBuilder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@nietzscheson
nietzscheson / jQuery Plugin
Last active February 12, 2016 14:15
JQuery Plugin
1.
jQuery.fn.extend({
setBackground: function(color){
this.each(function(){
jQuery(this).css('background-color", color);
});
}
});
@nietzscheson
nietzscheson / README.md
Created February 22, 2016 00:39 — forked from nikcub/README.md
Facebook PHP Source Code from August 2007
@nietzscheson
nietzscheson / form-data.js
Last active March 2, 2016 22:54
Send form-data from Angular to Symfony
'use strict';
angular.module('myApp', ['ngRoute','ngResource'])
.config(function($routeProvider, $locationProvider, $httpProvider){
$routeProvider.when('/posts', {templateUrl: 'bundles/app/tpl/posts.html', controller: 'postsController'});
$routeProvider.when('/users', {templateUrl: 'bundles/app/tpl/users.html', controller: 'usersController'});
$httpProvider.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded";
@nietzscheson
nietzscheson / form-collection.html.twig
Created March 4, 2016 21:39
Theme for data collection in Symfony forms
{% use "bootstrap_3_layout.html.twig" %}
{%- block collection_widget -%}
{% if prototype is defined %}
{%- set attr = attr|merge({'data-prototype': form_row(prototype) }) -%}
{% endif %}
<div class="panel panel-default">
<div class="panel-body">
@nietzscheson
nietzscheson / gulpfile.js
Created March 23, 2016 00:26 — forked from kurtisdunn/gulpfile.js
Gulp Config for Drupal 8, Drush, SASS & BrowserSync.
/rest//*global -$ */
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var mainBowerFiles = require('main-bower-files');
var $ = require('gulp-load-plugins')();
var browserSync = require('browser-sync');
var reload = browserSync.reload;
// Error notifications
@nietzscheson
nietzscheson / sum.php
Last active March 29, 2016 22:19
Sum of array data between items
<?php
$data[] = array('Colombia', 13279);
$data[] = array('United States', 27);
$data[] = array('Israel', 7);
$data[] = array('Colombia', 1755);
$data[] = array('Guatemala', 7);
$data[] = array('México', 7);
$paises = array();
@nietzscheson
nietzscheson / jquery.scroll-header.js
Created June 10, 2016 20:56
Scroll Header Plugin
(function(){
$.fn.extend({
scrollHeader: function(){
this.each(function(){
$(window).on('scroll', function(e){
var scroll = $(window).scrollTop();
@nietzscheson
nietzscheson / APIBaseRestController.php
Created June 22, 2016 21:30
APIBaseRestController.php
<?php
/*
*
* (c) Cristian Angulo <cristianangulonova@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
* API to Response Object of Symfony.
*/
namespace AppBundle\Controller;