Skip to content

Instantly share code, notes, and snippets.

var token = null;
function init(event) {
var topic = '';
if (window.getSelection) {
topic = window.getSelection().toString();
} else if (document.selection) {
topic = document.selection.createRange().topic;
} else {
return topic;
{% extends 'base.html' %}
{% load add_css is_checkbox field_type %}
{% block title %} Stock {% endblock title %}
{% block stylesheets %}
{{ block.super }}
{% endblock stylesheets %}
{% block content %}
from decouple import config
import dj_database_url
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'name',
'USER': 'username',
'PASSWORD': 'password',
'HOST': 'localhost',
class Employee(models.Model):
office = models.ForeignKey(
OfficeSetup, blank=False, null=False, on_delete=models.CASCADE)
name = models.CharField(max_length=150, blank=False, null=False)
designation = models.ForeignKey(Designation, blank=False, null=False)
section = models.ForeignKey(DepartmentSetup, blank=True, null=True)
phone_number = models.CharField(max_length=150, blank=True, null=True)
mobile_number = models.CharField(max_length=150, blank=True, null=True)
email = models.EmailField(max_length=150, blank=True, null=True)
gender = models.CharField(
import React from 'react';
import InputField from 'components/common/Forms/InputField';
import { Button } from 'semantic-ui-react';
const RulesInput = props =>
<div>
<form className="form">
<InputField
type="text"
import React from "react";
import InputField from "components/common/Forms/InputField";
import { Button } from "semantic-ui-react";
const RulesInput = props => {
return (
<form className="form">
<InputField
label={`Rule ${props.num + 1}`}
const RulesInput = props => {
return (
<form className="form">
<InputField
label={`Rule ${props.num + 1}`}
type="text"
name={`${props.num}`}
value={props.value[props.num] || ""}
onChange={props.handleChange}
/>
import React from "react";
import { Editor, EditorState, RichUtils } from "draft-js";
const handleEditorChange = editorState => props.editorChange(editorState);
const toggleBlockType = blockType =>
handleEditorChange(
RichUtils.toggleBlockType(this.state.editorState, blockType)
);
// here server response and error is fetched from selectors and is passed to toaster
const mapStateToProps = createStructuredSelector({
errorResponse: selectAgentApplicationError(),
successResponse: selectAgentApplicationResponse(),
});
if (successResponse && typeof successResponse === 'string') {
message = <Toaster message={successResponse} timeout={1000} success />;
import React from 'react';
const FeatureList = ({ feature, type }) => {
// type is the category of feature like media-technology, food-drinks etc
// feature is the list of features that falls under the specific type
return (
<ul>
<h1>media-technology</h1>
<li>
Computer