This file contains 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
const Bookmark = ({ clickHandler, icon, tooltip, bookmarkId }) => ( | |
<DropdownButton | |
onSelect={(evt) => clickHandler(evt)} | |
title={ <i className={`fa fa-${icon} fa-lg`} aria-hidden="true" /> } | |
bsSize="small" | |
noCaret | |
> | |
<MenuItem eventKey="food">Food</MenuItem> | |
<MenuItem eventKey='transportation'>Transportation</MenuItem> | |
<MenuItem eventKey='utilites'>Utilities</MenuItem> |
This file contains 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
# @users_index.doc_type | |
class User(DocType): | |
email = Text() | |
first_name = Text() | |
last_name = Text() | |
date_joined = Date() | |
expertise = Text() | |
institution = Text() | |
position = Text() |
This file contains 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
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from django.shortcuts import render, redirect | |
from django.views import View | |
from django.contrib import messages | |
from ..forms import contact_form | |
class IndexView(View): |
This file contains 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 TimelineView(CreateView): | |
fields= ['text'] | |
model = Post | |
success_url = reverse_lazy('timeline_feed') | |
template_name = 'stream/timeline.html' | |
def form_valid(self, form): | |
form.instance.user = self.request.user | |
return super(TimelineView, self).form_valid(form) |
This file contains 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 Search extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
locationValue: [], | |
resourceValue: [], | |
keywords: null, | |
results: { | |
loading: false, | |
data: { resources: [], num_hits: 0 }, |
This file contains 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
(ns hobbit) | |
(defn asym-hobbit-body-parts [{:name "head" :size 3} | |
{:name "left-eye" :size 1} | |
{:name "left-ear" :size 1} | |
{:name "mouth" :size 1} | |
{:name "nose" :size 1} | |
{:name "neck" :size 2} | |
{:name "left-shoulder" :size 3} | |
{:name "left-upper-arm" :size 3} |
This file contains 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 dataclass import dataclass, field | |
from typing import List | |
RANKS = '2 3 4 5 6 7 8 9 10 J Q K A'.split() | |
SUITS = '♣ ♢ ♡ ♠'.split() | |
def make_french_deck(): | |
return [PlayingCard(r,s) for s in SUITS for r in RANKS] | |
@dataclass(order=True) |
This file contains 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
//--Write your own map() function | |
// | |
//--Input: array, callback funtion | |
// | |
//--Output: new array where every element is transformed by the callback function | |
const map = (array, callback) => { | |
let newArr = []; | |
for (var i = 0; i < array.length; i++) { | |
newArr[i] = callback(array[i], i) |