Skip to content

Instantly share code, notes, and snippets.

@dupuchba
dupuchba / gist:2776253
Created May 23, 2012 16:36
symfony2 : search request
public function indexAction()
{
$form = $this->container->get('form.factory')->create(new CustomerSearchType());
$searchresult = '';
$keyword = '';
$request = $this->container->get('request');
$keyword = $request->request->get('customersearch_keyword');
@dupuchba
dupuchba / gist:2776247
Created May 23, 2012 16:36
symfony2 : json route
* @Route("/search.{_format}", name="customer_search", defaults={"_format" = "~"})
@dupuchba
dupuchba / gist:2727261
Created May 18, 2012 19:43
Backbone.js : search filter function
search : function(letters){
if(letters == "") return this;
var pattern = new RegExp(letters,"i");
return _(this.filter(function(data) {
return pattern.test(data.get("name"));
}));
}
@dupuchba
dupuchba / gist:2726604
Created May 18, 2012 17:33
Backbone.js : AppRouter initializiation
// AppRouter initializiation
var AppRouter = Backbone.Router.extend({
routes:{
"":"list"
},
list:function () {
this.customerCollection = new CustomerCollection();
this.CustomerListView = new CustomerListView({model:this.customerCollection});
@dupuchba
dupuchba / gist:2726579
Created May 18, 2012 17:30
Backbone.js : ItemView and ItemView creation
$("a.confirmsuppr").click(function () {
$("#confirmsuppr").show("slow");
});
$("a.hidesuppr").click(function () {
$("#confirmsuppr").hide("slow");
});
$("a.hint").click(function () {
@dupuchba
dupuchba / gist:2726560
Created May 18, 2012 17:26
Backbone.js : model creation RESTFul
//Model Backbone.js sur les Customer
window.Customer = Backbone.Model.extend();
window.Customer = Backbone.Collection.extend({
model:Customer,
url:"http://localhost:8888/PiggiBox/web/app_dev.php/customer/search.json"
});
@dupuchba
dupuchba / Backbone-fw_agnostic.js
Created May 14, 2012 16:58 — forked from piotr-cz/Backbone-fw_agnostic.js
Backbone.js Framework agnostic
// Backbone.js 0.5.3
// (c) 2010 Jeremy Ashkenas, DocumentCloud Inc.
// Backbone may be freely distributed under the MIT license.
// For all details and documentation:
// http://documentcloud.github.com/backbone
(function(){
// Initial Setup
// -------------