Skip to content

Instantly share code, notes, and snippets.

View vinitkumar's full-sized avatar
🪀
Focusing

Vinit Kumar vinitkumar

🪀
Focusing
View GitHub Profile
/* Build a new parser Adjective to recognize descriptions */
mpc_parser_t* Adjective = mpc_or(4,
mpc_sym("wow"), mpc_sym("many"),
mpc_sym("so"), mpc_sym("such")
);
/* Build a new parser 'Noun to recognize' things*/
mpc_parser_t* Noun = mpc_or(5
mpc_sym("lisp"), mpc_sym("language"),
mpc_sym("c"), mpc_sym("book"),
u'admin.add_logentry',
u'admin.change_logentry',
u'admin.delete_logentry',
u'auth.add_group',
u'auth.add_permission',
u'auth.add_user',
u'auth.change_group',
u'auth.change_permission',
u'auth.change_user',
u'auth.delete_group',
from django.contrib import admin
from django.db.models.signals import post_syncdb
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.contrib.util import flatten_fieldsets
from django.contrib.admin.templatetags.admin_modify import *
from django.contrib.admin.templatetags.admin_modify import submit_row as original_submit_row
def add_cannot_edit_record_permission(sender, **kwargs):
from django.contrib import admin
from django.db.models.signals import post_syncdb
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin.util import flatten_fieldsets
from django.contrib.admin.templatetags.admin_modify import *
from django.contrib.admin.templatetags.admin_modify import submit_row as original_submit_row
def add_cannot_edit_record_permission(sender, **kwargs):
"""
This syncdb hooks takes care of adding a view permission to all our
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Utilities for rendering most visited thumbnails and titles.
*/
// Copyright 2013 The Chromium Authors. All rights reserved.
@vinitkumar
vinitkumar / index.html
Created April 19, 2014 17:05
Addy osmani backbonejs book
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
var ListView = Backbone.View.extend({
// template: _.template($('#item-template').html()),
// render: function() {
// this.$el.html(this.template(this.model.attributes));
// return this;
// }
// });
// var TodoView = Backbone.View.extend({
// tagName: 'li',
var Todo = Backbone.Model.extend({
// defaults: {
// title: '',
// completed: false
// }
// });
// var TodosCollection = Backbone.Collection.extend({
// model: Todo,
// });
@vinitkumar
vinitkumar / bb.js
Created April 21, 2014 01:45
This is gist
var ListView = Backbone.View.extend({
render: function () {
var items = this.model.get('items');
// loop thorough all the items
_.each(items, function (item) {
var itemView = new itemView({ model: item });
this.$el.append( itemView.render().el );
}, this);
var ListView = Backbone.View.extend({
render: function () {
var items = this.model.get('items');
// loop thorough all the items
_.each(items, function (item) {
var itemView = new itemView({ model: item });
this.$el.append( itemView.render().el );
}, this);