Skip to content

Instantly share code, notes, and snippets.

View kayode-adechinan's full-sized avatar

Kayode Adechinan kayode-adechinan

  • Dakar, Senegal
View GitHub Profile
input, textarea {
outline: none;
border:1px solid #ccc !important;
box-shadow:none !important;
}
@kayode-adechinan
kayode-adechinan / reactjs_quickstart
Created December 1, 2019 12:22
reactjs_quickstart
import React, { Component } from "react";
import axios from "axios";
class Row extends React.Component {
render() {
return (
<tr>
<td>{this.props.data.id}</td>
<td>{this.props.data.name}</td>
</tr>
@kayode-adechinan
kayode-adechinan / java8-one-liners-for-statistical-properties.md
Created October 26, 2019 23:58 — forked from asela38/java8-one-liners-for-statistical-properties.md
Java 8 One liners for statistical properties : Mean, Mode, Median(Q2), Q1, Q2, Variance, Standard Deviation

While working on a Hacker Rank Problem I wrote few one lines using java stream to find mean, median, mode, Q1, Q3, variance and standard deviation. Thought to share since it's quite interesting.

        // mean
        double mean = list.stream().mapToInt(Integer::intValue).average().getAsDouble();
        System.out.println(mean);
        
        // mode - create count map using group by and sorted with custom comparator to give minimum from competing probable mode values
        Integer mode = list.stream()
                .collect(Collectors.groupingBy(i -> i, () -> new TreeMap<Integer, Long>(), Collectors.counting()))
@kayode-adechinan
kayode-adechinan / upload-a-file.MD
Created August 21, 2019 10:04 — forked from ahmadawais/upload-a-file.MD
Upload a file using the WordPress REST API

Upload files

Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a POST-Request to the wp/v2/media route.

There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle:

@kayode-adechinan
kayode-adechinan / docker-compose.yml_django
Created August 6, 2019 17:19
simple docker-compose for django
version: '3.7'
services:
db:
image: postgres:10.1-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
@kayode-adechinan
kayode-adechinan / Dockerfile_django
Created August 6, 2019 17:18
Simple dockerfile for django
# Pull base image
FROM python:3.7-slim
# Set environment varibles
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set work directory
WORKDIR /code
version: "3"
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.3
environment:
discovery.type: single-node
volumes:
- elastic-data:/usr/share/elasticsearch/data
ports:
@kayode-adechinan
kayode-adechinan / geo.js
Created August 5, 2019 10:28 — forked from mkhatib/geo.js
A Javascript utility function to generate number of random Geolocations around a center location and in a defined radius.
/**
* Generates number of random geolocation points given a center and a radius.
* @param {Object} center A JS object with lat and lng attributes.
* @param {number} radius Radius in meters.
* @param {number} count Number of points to generate.
* @return {array} Array of Objects with lat and lng attributes.
*/
function generateRandomPoints(center, radius, count) {
var points = [];
for (var i=0; i<count; i++) {
@kayode-adechinan
kayode-adechinan / IntelliJ_IDEA__Perf_Tuning.txt
Created July 24, 2019 21:37 — forked from P7h/IntelliJ_IDEA__Perf_Tuning.txt
Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
openFile
-vm
/home/honolulu/Downloads/zulu12.2.3-ca-jdk12.0.1-linux_x64/bin/java