Skip to content

Instantly share code, notes, and snippets.

View MwirabuaTimothy's full-sized avatar

Timothy Mwirabua MwirabuaTimothy

View GitHub Profile
@MwirabuaTimothy
MwirabuaTimothy / ItemsList.js
Last active May 8, 2020 11:01
Turning a class component to functional component
import React from "react"
import { connect } from "react-redux"
import { addItems } from "../../redux/actions/items"
const enhance = connect(
({ items }) => ({ items }),
{ addItems }
)
class ItemsList extends React.Component {
2018/01/13 13:25:41 [error] 205#0: *40 client intended to send too large body: 765502933 bytes, client: 127.0.0.1, server: localhost, request: "POST /import.php HTTP/1.1", host: "localhost:306"
2018/01/22 15:20:31 [error] 256#0: *1963 client intended to send too large body: 22744960 bytes, client: 127.0.0.1, server: localhost, request: "POST /import.php HTTP/1.1", host: "localhost:306"
2018/01/22 15:42:06 [error] 88528#0: *2 FastCGI sent in stderr: "PHP message: PHP Warning: POST Content-Length of 22744960 bytes exceeds the limit of 8388608 bytes in Unknown on line 0" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /import.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:306"
2018/01/22 15:43:06 [error] 88528#0: *2 upstream timed out (60: Operation timed out) while reading upstream, client: 127.0.0.1, server: localhost, request: "POST /import.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost:306"
2018/01/22 19:51:36 [e
@MwirabuaTimothy
MwirabuaTimothy / facebook-contact-info-summary.rb
Created March 25, 2018 10:34 — forked from dylanmckay/facebook-contact-info-summary.rb
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@MwirabuaTimothy
MwirabuaTimothy / react-native-validator-login-example
Last active February 25, 2018 16:50
Example of using validate.js to validate a login form (email and password) on react native
import React, { Component } from 'react';
import {
View,
Text,
TextInput,
TouchableOpacity } from 'react-native';
// Validate.js validates your values as an object
@MwirabuaTimothy
MwirabuaTimothy / users.blade.php
Last active January 30, 2017 09:38
A view to manage users via table and bootstrap modal
@extends('layouts.dashboard')
@section('content')
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Manage Users</h3>
@MwirabuaTimothy
MwirabuaTimothy / libapache2-mod-php
Last active January 23, 2017 15:51
troubles installing/removing apache php mod
-!- apache2/sites-available » sudo apt-get remove libapache2-mod-php7.1 100 ↵
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libapache2-mod-php : Depends: libapache2-mod-php7.1 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
-!- apache2/sites-available » apt-get -f install 100 ↵
@MwirabuaTimothy
MwirabuaTimothy / grive-cron.sh
Last active January 15, 2017 18:38
Backup Latest MySQL Dumps Every Date of the Month to Google Drive
# Adapted from https://petermolnar.net/database-backups-to-google-drive/
# Works for linux systems
#
# 1. Install grive https://github.com/Grive/grive
#
# for ubuntu/debian use:
# $ sudo add-apt-repository ppa:nilarimogard/webupd8
# $ sudo apt-get update
# $ sudo apt-get install grive
#
@MwirabuaTimothy
MwirabuaTimothy / array-sorting.php
Last active June 9, 2016 15:27
php - sorting an array of words by their relevance to a keyword
<?php
$query = 'ma';
$names = ['Kevin', 'Michael', 'Joseph', 'Mark', 'Edward', 'Velma', 'William', 'Mary', 'Kimani'];
// $target = ['Mark', 'Mary', 'Michael', 'Kimani', 'Velma', 'William', 'Edward', 'Joseph', 'Kevin'];
// $result = ['Mark', 'Mary', 'Kimani', 'Michael', 'Velma', 'William', 'Edward', 'Kevin', 'Joseph'];
// the slight difference is because the longer words have more irrelevant characters
function weights($query) { // return weight of letters determined by their order of appearance
$query = strtolower($query); // eliminate case sensitivity
@MwirabuaTimothy
MwirabuaTimothy / AppURL.php
Created January 13, 2016 16:34
Laravel artisan command for switching the url for your app depending on the environment. Usage `php artisan app:url http://shopofficer.com` or `php artisan app:url http://localhost:7000`
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class AppURL extends Command {
/**
* The console command name.
@MwirabuaTimothy
MwirabuaTimothy / AppDebug.php
Last active January 13, 2016 19:36
Laravel artisan command for switching between debug modes for your app. Usage `php artisan app:debug true` and `php artisan app:debug false`
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class AppDebug extends Command {
/**
* The console command name.