Skip to content

Instantly share code, notes, and snippets.

View ever-dev's full-sized avatar
🏠
Working from home

Ever Dev ever-dev

🏠
Working from home
View GitHub Profile
@ever-dev
ever-dev / RaisedButton.js
Last active October 20, 2019 22:28
React-Native RaisedButton code.
import React, { Component, PropTypes } from 'react';
import {
View,
Text,
Animated,
} from 'react-native';
import Button from '../internal/Button';
import Icon from '../Icon';
import React, {
createContext,
useEffect,
useState,
useContext,
useCallback,
Fragment
} from "react";
import { ScrollView } from "react-native";
import { Portal, Dialog, List, Button } from "react-native-paper";
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'dva'
import { Row, Col, Card } from 'antd'
import { Color } from 'utils'
import { Page, ScrollBar } from 'components'
import {
NumberCard,
Quote,
Sales,
from django_countries import countries
from django.db.models import Q
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.shortcuts import render, get_object_or_404
from django.utils import timezone
from rest_framework.generics import (
ListAPIView, RetrieveAPIView, CreateAPIView,
UpdateAPIView, DestroyAPIView
from django.contrib import admin
from .models import (
Item, OrderItem, Order, Payment, Coupon, Refund,
Address, UserProfile, Variation, ItemVariation
)
def make_refund_accepted(modeladmin, request, queryset):
queryset.update(refund_requested=False, refund_granted=True)
/** @jsx jsx */
import { jsx } from '@emotion/core'
import { FunctionComponent, HTMLAttributes, useMemo, useState, useEffect } from 'react'
import Calendar from 'react-calendar/dist/entry.nostyle'
import dayjs from 'dayjs'
import { Icon, Button, Clickover, Text } from '~/components'
import { styles } from './styles'
// @ts-ignore
@ever-dev
ever-dev / CustomCircularProgress
Last active January 13, 2020 02:56
Customize the Circular Progress of the component from Material UI to accept color and size and put it the center of the screen.
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import { CircularProgress } from '@material-ui/core';
const defaultSize = 50;
class ColoredCircularProgressComponent extends Component {
render() {
const { classes, size } = this.props;
@ever-dev
ever-dev / gist:e749e4ed746b56818e451f06cb7fffd2
Created January 27, 2020 22:49
Flatten Numerical Array & unit testing
// flatten the array of integers
const flatten = array =>
JSON.stringify(array) // JSON encode the array to make string
.match(/\d+/g) // extract numbers using regex
.map(x => parseInt(x)); // convert string to numbers
// unit testing with Mocha
var assert = require('assert');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
using Microsoft.Extensions.Options;
using System.Threading.Tasks;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
namespace Web2FA.Services
{
// This class is used by the application to send Email and SMS
// when you turn on two-factor authentication in ASP.NET Identity.