Skip to content

Instantly share code, notes, and snippets.

@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
// -------------
@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 / 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: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: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:2776247
Created May 23, 2012 16:36
symfony2 : json route
* @Route("/search.{_format}", name="customer_search", defaults={"_format" = "~"})
@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 / README.markdown
Created May 24, 2012 20:05 — forked from Yavari/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@dupuchba
dupuchba / gitlivelog.sh
Created October 17, 2012 06:49 — forked from xero/gitlivelog.sh
git graph live log
#!/bin/sh
while true;
do
clear
git log \
--graph \
--all \
--color \
--date=short \
-10 \
@dupuchba
dupuchba / row.js
Last active December 28, 2015 18:18
Filter to be used with Twitter Bootstrap col-md's and row's. Can be optimized greatly but still work well
'use strict';
angular.module('dailymotionApp')
.filter('col', function(){
return function(input, numColumns){
if(input !== undefined) {
var filtered = [];
for(var x = 0; x < input.length; x++){
if(x % numColumns === 0){
filtered.push(filtered.length);