I hereby claim:
- I am g-cassie on github.
- I am gcassie (https://keybase.io/gcassie) on keybase.
- I have a public key ASD9neDIs0Tf_0oGyWZqGg3dxsdDb9VfBGiZvYSyl2IFHwo
To claim this, I am signing this object:
const std = @import("std"); | |
const Ops = enum { mov, imm, imm_mem, mem_acc, acc_mem }; | |
const Mod = enum { reg, mem0, mem8, mem16 }; | |
pub fn parseMod(byte: u8) Mod { | |
return switch (byte & 0b11_000_000) { | |
0b11_000000 => Mod.reg, | |
0b01_000000 => Mod.mem8, | |
0b10_000000 => Mod.mem16, | |
0b00_000000 => Mod.mem0, |
// I am a complete Zig noob so please be kind! | |
const std = @import("std"); | |
pub fn getName(addr: u8, w: bool, dest: []u8) void { | |
if (w) { | |
std.mem.copy(u8, dest, switch (addr) { | |
0b00_000_000 => "ax", | |
0b00_000_001 => "cx", | |
0b00_000_010 => "dx", |
I hereby claim:
To claim this, I am signing this object:
// 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() | |
}); |
import md5 | |
def find_key(secret): | |
""" | |
>>> find_key('abcdef') | |
609043 | |
>>> find_key('pqrstuv') | |
1048970 | |
""" |
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 = []; |
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 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): |
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) | |
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 ' |