Skip to content

Instantly share code, notes, and snippets.

View colonelrascals's full-sized avatar
:shipit:

Patrick Hildreth colonelrascals

:shipit:
View GitHub Profile
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>
# @users_index.doc_type
class User(DocType):
email = Text()
first_name = Text()
last_name = Text()
date_joined = Date()
expertise = Text()
institution = Text()
position = Text()
# -*- 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):
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)
import React, { Component } from 'react';
import request from 'superagent';
class UserClickButton extends Component {
constructor(props) {
super(props);
this.state = {
clicks: 0,
};
class Search extends React.Component {
constructor(props) {
super(props);
this.state = {
locationValue: [],
resourceValue: [],
keywords: null,
results: {
loading: false,
data: { resources: [], num_hits: 0 },
(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}
@colonelrascals
colonelrascals / deck-of-cards.py
Created June 28, 2018 14:43
Data Class example python 3.7 release
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)
@colonelrascals
colonelrascals / jsMap.js
Created June 28, 2018 16:43
JavaScripts map function deconstructed
//--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)