This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @class pdfView | |
* @extends {Ember.View} | |
*/ | |
var PDFView = Ember.View.extend({ | |
tagName: 'canvas', | |
/** | |
* Url to pdf file. | |
* @property src | |
* @type {string} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Model | |
number: Ember.computed(function(){ | |
var cid = this.get('CID'), | |
promise; | |
promise = this.get('deal').then(function(deal){ | |
var num = deal.get('contentNumbering')[cid]; | |
return num ? num + '.' : ''; | |
}); | |
return DS.PromiseObject.create({promise: promise}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import forms from 'cb-forms'; | |
export default forms.Form.extend({ | |
fields: { | |
username: forms.CharField.create({ | |
userStore: Ember.inject.service(), | |
maxLength: 10, | |
minLength: 2, | |
validate(value){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
from django.core.exceptions import ObjectDoesNotExist | |
from rest_framework.relations import RelatedField | |
class EmbeddedPrimaryKeyRelatedField(RelatedField): | |
default_error_messages = { | |
'required': 'This field is required.', | |
'does_not_exist': "Invalid pk '{pk_value}' - object does not exist.", | |
'incorrect_type': 'Incorrect type. Expected pk value, received ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Organization(models.Model): | |
name = models.CharField() | |
class Project(models.Model): | |
name = models.CharField() | |
users = models.ManyToManyField('User', related_name='users', through='UserProjectPermission') | |
organization = models.ForeignKey(Organization) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this uses the models setout in this gist: https://gist.github.com/g-cassie/6b9b0f29371677f48659 | |
from projects.models import Project, User, UserProjectAccess | |
class UserProjectChildProfile(permissions.Profile): | |
# ProjectChild refers to any model that has a ForeignKey to Project | |
def __init__(self, request): | |
self.user = request.user | |
def get_queryset_filters(self, request, queryset): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from firm.precedents.corporate.agreements import StartupShareholdersAgreement | |
from firm.precedents.corporate.mixins import DragAlongMixin, RightOfRefusalMixin | |
from jursidictions import Delaware | |
from votes import super_majority | |
from legal_entities import Corporation, Individual | |
# First lets create some parties to be part of our agreement | |
john = Individual(name='John Smith', jurisdiction=UK) | |
sam = Individual(name='Sam Smith', jurisdiction=Delaware) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
const BoxToWrap = Ember.Object.extend({ | |
length: 0, | |
height: 0, | |
width: 0, | |
sides: Ember.computed('length', 'width', 'height', function(){ | |
const dims = ['length', 'width', 'height']; | |
const sides = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import md5 | |
def find_key(secret): | |
""" | |
>>> find_key('abcdef') | |
609043 | |
>>> find_key('pqrstuv') | |
1048970 | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// my-addon/templates/components/addon-componenent.hbs | |
We are going to render a component here: | |
{{component selectedComponent}} | |
// my-app/components/app-component.js | |
Ember.Component.extend({ | |
// using ember inspect myService === undefined when using the application template below | |
myService: Ember.inject.service() | |
}); |
OlderNewer