Skip to content

Instantly share code, notes, and snippets.

😀
😀

Jordi Boggiano Seldaek

😀
😀
Block or report user

Report or block Seldaek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Of redirects
// format: html, POST /register, dev calls setRedirectRoute('welcome')
302 => /welcome, browser redirects, gets a new page
// format: json, POST /register, dev calls setRedirectRoute('welcome')
302 => /welcome, browser redirects, /welcome returns a 200 with {"some json shit"}, ajax callback gets json
// format: html, GET|POST /anypage, dev calls setRedirectUri('http://google.com/FUUUUU')
View config_dev.yml
imports:
- file:config.yml
- file:somestuff.yml
services:
foo.controller:
class: Application\FooBundle\Controller\FooController
arguments:
- @router
- @request
View FooController.php
class FooController
{
public function viewArticleAction($articleId)
{
$article = $this->articleRepository->getById($articleId);
$parameters = array(
'article' => $article,
);
// beginner
View results
<?php
class Field {
protected static $options = array('a', 'b');
public static function getOptions() {
return static::$options;
}
public static $options2 = array('a', 'b');
}
View res
float 3.8314838409424
float 2.6161198616028
View gist:874689
# /usr/bin/grep -rh '<service id=' --include='*.xml' src/Symfony/ | sed -re 's/ *<service id="([^"]+)".+/\1/g'
assetic.filter_manager
assetic.asset_manager
assetic.asset_factory
assetic.filter.cssrewrite
assetic.filter.less
assetic.filter.sass
assetic.filter.scss
assetic.filter.google_closure_compiler
@Seldaek
Seldaek / ContactControllerTest.php
Created May 25, 2011
Mailer service mocking for Symfony2
View ContactControllerTest.php
<?php
namespace Nelmio\HomeBundle\Tests\Controller;
use Nelmio\HomeBundle\Controller\ContactController;
use Liip\FunctionalTestBundle\Test\WebTestCase;
class ContactControllerTest extends WebTestCase
{
public function testEmail()
View Annot_RFC.mdown

Annotation Change RFC

Most of those changes are ideas taken from the php-annotations lib (see its wiki too) by Rasmus Schultz.

Goals

I am not the author of that lib but have been discussing with him for a while and I am convinced that this could benefit Symfony users and PHP as a whole on the long run, if we standardized the annotations a bit more than what we have right now.

@Seldaek
Seldaek / Default.sublime-theme
Created Jan 13, 2012
Patch for Sublime Text 2 "highlight_modified_tabs" (missing in b2165)
View Default.sublime-theme
/* Path: Packages/Theme - Default/Default.sublime-theme, add add the end before the ']' */
/* Patch for highlight_modified_tabs */
,{
"class": "tab_control", "attributes": ["dirty"],
"tint_modifier": [255, 255, 0, 230],
"layer0.texture": "Theme - Default/dark_tab_mask3.png",
"layer2.texture": "Theme - Default/dark_unselected_tab_bg2.png",
"layer2.opacity": 1.0
},
@Seldaek
Seldaek / sha1hmac.js
Created Feb 3, 2012
SHA1 + HMAC in JS
View sha1hmac.js
var Crypto = {};
Crypto.sha1_hmac = function (msg, key) {
"use strict";
var oKeyPad, iKeyPad, iPadRes, bytes, i, len;
if (key.length > 64) {
// keys longer than blocksize are shortened
key = Crypto.sha1(key, true);
}
You can’t perform that action at this time.