Skip to content

Instantly share code, notes, and snippets.

@prrraveen
prrraveen / .js
Last active August 26, 2015 09:35
login sudo code
top_bar.js
events
{
'clicl login' : open_login
}
open_login : function(){
this.child_views.login_regi_bare_modal = login_regi_bare_modal();
}
@prrraveen
prrraveen / landing.js
Created August 26, 2015 10:36
Populer bike sude code
/views/landing.js
initialize_ui : {
//add populer_bike as child view
this.child_views.popular_item = Popular_item({parent_view : this})
}
{
"esnext": true,
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
@prrraveen
prrraveen / filter.html
Created September 4, 2015 13:08
Handling stateful search pages , filters and labels
here take the filters model and apply filter accordingly
@prrraveen
prrraveen / fav_items.js
Created September 9, 2015 08:26
Sync fav item
in fav item collection
override add and remove backbone collection method.
How to overide? You can see its example in label.js and extend.js
add : (){
step 1: call the backbone add
step 2: if user is logged in call user model method sycn_shortlist
}
@prrraveen
prrraveen / filter.html
Last active September 12, 2015 07:37
restfull search
make filter panel with filter_model value
@prrraveen
prrraveen / database and hosting
Last active September 12, 2015 14:26
For App backend
Go with sqlite. Its simple and easy to start with.
Host server on https://www.heroku.com/ . Its good
@prrraveen
prrraveen / search.py
Last active September 30, 2015 07:21
Search api
Its a post call on search
Some pointers :
Search api has nothing to with user logged in. User shortlisted bike should be diffrent api.
if decoded_query has not attr assume enum = all
I think we should build up raw postgress query depending upon enum , query , and filters and page_no
Part 1 : assume things if not present in POST vaiables
Part 2 : Build Query
Part 3 : Apply sort method on querydict
part 4 : Apply page no on query set
<a href="#search/q=grabadeal">
you can replace a tag with button for exampel
<button class='grab-deal'>
# Create your views here.
def search(request , query):
'''
Product search algo
query = {
enum : '', @not_required @assume
search_string: '', @not_required but if !enum && !query assume enum all @assume
brands: list of dict, @not_required
mfg_year: dict with min max value @not_required