Skip to content

Instantly share code, notes, and snippets.

furniture/__init__.py
import os
# Use 'dev', 'beta', or 'final' as the 4th element to indicate release type.
VERSION = (1, 6, 0, 'dev')
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
import gql from 'graphql-tag';
import { commonResponse } from 'app/gql/fragments';
export default gql`
mutation AddCommentMutation($commentData: AddCommentInput!){
addComment(addCommentData: $commentData){
...ResponseFrag
}
}
${commonResponse}
//reducer for adding and updating menu. Adding is working fine but editing is not working as in editing, the user can switch
// from one menu to another
const restaurantsMenu = {
food_beverages: {
restaurant: {
food_menu: [],
beverages_menu: []
},
coffee_shop: {
# credit - zsoobhan from SO (https://stackoverflow.com/questions/46731426/show-distance-in-km-or-m-of-each-restaurant/46732398#46732398)
def calculate_distance(restaurant, current_lat, current_long):
from django.contrib.gis.geos import GEOSGeometry
pnt = GEOSGeometry(restaurant.location)
pnt2 = GEOSGeometry('SRID=4326;POINT({0} {1})'.format(
current_long, current_lat))
print(pnt.distance(pnt2) * 100)
return round(pnt.distance(pnt2) * 100, 2)
import React from 'react';
import Link from 'react-router-dom/Link';
import { Label, Menu, Table } from 'semantic-ui-react';
import { capitalize } from 'utils/helper';
import { isEmpty } from 'utils/helper';
const perPageToShow = 10;
const style = {
paginationBtn: {
import React from 'react';
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';
const transitionOptions = {
transitionName: 'notification-fade',
transitionEnterTimeout: 400,
transitionLeaveTimeout: 400
};
const LogList = ({ logs, ...props }) => {
export const logRequest = action(LOGS_FETCH_REQUEST);
export const logFetched = action(LOGS_FETCH_SUCCESS, "logs");
export const logFetchingError = action(LOGS_FETCH_FAILURE, "error");
where action is a generic function
export default function action(TYPE, ...keys) {
return (...values) => {
const axn = { type: TYPE };
from django.db import models
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from smart_selects.db_fields import ChainedForeignKey
class PropertyType(models.Model):
"""Class that implements properties types, as House or Apartment."""