Skip to content

Instantly share code, notes, and snippets.

@dlegatt
dlegatt / Symfony request handler.php
Last active April 21, 2024 12:16
Example of how to handle entity deserialization and validation without a form type class in Symfony
<?php
/** DefaultController.php **/
namespace AppBundle\Controller;
use AppBundle\Entity\Person;
use AppBundle\Service\RequestHandler;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@dlegatt
dlegatt / masterControllerSpec.ts
Last active December 6, 2016 01:59
Testing JavaScript with Jasmine and Typescript
/// <reference path="../../typings/index.d.ts" />
import vdog = dogsrus.virtdog;
describe('In the file masterController.ts', () => {
describe('The masterController\'s', () => {
let sut: vdog.MasterController,
$rootScope: ng.IRootScopeService,
$controller: ng.IControllerService,
masterControllerParams: {
$rootScope: ng.IRootScopeService,
@dlegatt
dlegatt / Http.js
Created September 26, 2016 21:57 — forked from manar007/Http.js
Promises with vanilla js, helper http function
// Support: http://caniuse.com/promises
function Http () {
/**
* Helper for http calls
* @param method
* @param url
* @param data
* @returns {Promise}
*/
function makeRequest(method,url,data) {