Skip to content

Instantly share code, notes, and snippets.

View ochui's full-sized avatar
🌏
Working from home and farm

Ochui, Princewill Patrick ochui

🌏
Working from home and farm
View GitHub Profile
@ochui
ochui / quadratic.bas
Last active April 22, 2017 16:43
******QBAIC PROGRAM TO CALCULATE THE ROOT OF QUADRATIC EQUATION*********
REM *******QBAIC PROGRAM TO CALCULATE THE ROOT OF QUADRATIC EQUATION*********
REM *******http://niarageeks.com.ng**************************************
CLS
DIM v(3) AS INTEGER
DIM x(2) AS DOUBLE
DIM s AS INTEGER
DIM d AS INTEGER
DO
CLS
@ochui
ochui / Uqname.py
Created December 30, 2018 10:59
A simple Django snippet to generate unique username
from random import choice
from string import ascii_lowercase, digits
from django.contrib.auth import get_user_model
def generate_random_username(length=16, chars=ascii_lowercase+digits, split=4, delimiter='-'):
username = ''.join([choice(chars) for i in xrange(length)])
if split:
username = delimiter.join([username[start:start+split] for start in range(0, len(username), split)])
{
"expo": {
"name": "Txxx A",
"description": "Txx Booking App",
"slug": "snack-xxxxx",
"privacy": "unlisted",
"sdkVersion": "31.0.0",
"version": "1.0.0",
"orientation": "portrait",
"primaryColor": "#cccccc",
@ochui
ochui / mobile-user-agent.txt
Created July 1, 2019 14:06
237 mobile broswer user agent
Mozilla/5.0 (Android; Mobile; rv:36.0) Gecko/36.0 Firefox/36.0
Opera/9.80 (Android; Opera Mini/7.5/34.1784; U; en) Presto/2.8 Version/11.10
Opera/9.80 (Android; Opera Mini/7.5/34.1153; U; en) Presto/2.8 Version/11.10
Opera/9.80 (Android; Opera Mini/7.5/34.1944; U; en) Presto/2.8 Version/11.10
Mozilla/5.0 (Android; Mobile; rv:27.0) Gecko/27.0 Firefox/27.0
Opera/9.80 (Android; Opera Mini/7.5/34.1088; U; en) Presto/2.8 Version/11.10
Mozilla/5.0 (Android; Mobile; rv:27.0) Gecko/27.0 Firefox/27.0
Opera/9.80 (Android; Opera Mini/7.5/35.3956; U; en) Presto/2.8 Version/11.10
Opera/9.80 (Android; Opera Mini/7.5/34.1697; U; en) Presto/2.8 Version/11.10
Opera/9.80 (Android; Opera Mini/7.5/34.1244; U; en) Presto/2.8 Version/11.10
-- phpMyAdmin SQL Dump
-- version 4.7.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 30, 2018 at 02:57 PM
-- Server version: 5.5.16
-- PHP Version: 7.1.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@ochui
ochui / redux-socket-middleware-example.js
Created November 15, 2019 22:26 — forked from markerikson/redux-socket-middleware-example.js
Redux socket middleware example usage
const createMySocketMiddleware = (url) => {
return storeAPI => {
let socket = createMyWebsocket(url);
socket.on("message", (message) => {
storeAPI.dispatch({
type : "SOCKET_MESSAGE_RECEIVED",
payload : message
});
});
@ochui
ochui / actions.py
Last active January 11, 2020 17:56 — forked from jeremyjbowers/actions.py
Export to CSV for Django admin
import csv
from django.http import HttpResponse
def export_as_csv_action(description="Export selected objects as CSV file", fields=None, exclude=None, header=True):
"""
This function returns an export csv action
'fields' and 'exclude' work like in django ModelForm
'header' is whether or not to output the column names as the first row
"""
const MONTH_NAMES = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
];
const getFormattedDate = (date, prefomattedDate = false, hideYear = false) => {
const day = date.getDate();
const month = MONTH_NAMES[date.getMonth()];
const year = date.getFullYear();
@ochui
ochui / Gender.js
Last active February 13, 2020 06:27
NativeBase and Redux Form - Radio button
import React from 'react'
import { View } from 'native-base'
import { Field } from 'redux-form'
// Custom components
import { RadioButton } from '../Form'
export default class Gender extends React.Component {
state = {
selected: 'male'
@ochui
ochui / spintax.php
Created June 17, 2020 08:04 — forked from irazasyed/spintax.php
PHP: Text Spinner Class - Nested spinning supported.
<?PHP
/**
* Spintax - A helper class to process Spintax strings.
*
* @author Jason Davis - https://www.codedevelopr.com/
*
* Tutorial: https://www.codedevelopr.com/articles/php-spintax-class/
*
* Updated with suggested performance improvement by @PhiSYS.