Skip to content

Instantly share code, notes, and snippets.

@lensraster
lensraster / PostController.php
Created June 12, 2018 08:46
SAWA's PostController.php
<?php
namespace App\Http\Controllers;
use DB;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Response;
@lensraster
lensraster / logos.js
Created June 12, 2018 08:44
SAWA's logos.js
import React, {Component} from 'react'
import FileReaderInput from 'react-file-reader-input'
import { connect } from "react-redux"
import {
Modal,
ModalHeader,
ModalTitle,
ModalBody,
ModalFooter
} from 'react-modal-bootstrap'
@lensraster
lensraster / views.py
Created June 12, 2018 08:31
Parting's bisinesses/views.py
import json
import copy
import urllib
import urlparse
import geocoder
from apps.businesses.forms import ReviewForm
from apps.businesses.helpers import Pagination
from apps.businesses.models import Business, Address, CustomBusinessServicePackage
from apps.geos.models import State, GeoPoint
from apps.utils.states import states
@lensraster
lensraster / models.py
Created June 12, 2018 08:30
Parting's businesses/models.py
import os
import uuid
import urllib
import json
from urlparse import urlparse
from django.urls import reverse
from django.db import models
from django.db.models import Avg, Q
from django.db.models.functions import Length
from django.contrib.gis.measure import D
{
"level1": [
{
"id": 1,
"name": "Level1: # 1"
},
{
"id": 2,
"name": "Level1: # 2"
}
@lensraster
lensraster / fields.py
Last active August 29, 2015 14:10 — forked from yprez/fields.py
import base64
from django.core.files.base import ContentFile
from rest_framework import serializers
class Base64ImageField(serializers.ImageField):
def from_native(self, data):
if isinstance(data, basestring) and data.startswith('data:image'):
# base64 encoded image - decode