Skip to content

Instantly share code, notes, and snippets.

View rowlandekemezie's full-sized avatar
🏠
Working from home

Rowland I. Ekemezie rowlandekemezie

🏠
Working from home
View GitHub Profile
@rameerez
rameerez / postgres-production-setup.sh
Last active December 8, 2024 20:57
PostgreSQL Production Server Setup - Set up a new Ubuntu Server 24.04 LTS machine to run a production Postgres server
#!/bin/bash
# This script takes a clean Ubuntu Server 24.04 LTS image and installs and configures
# everything needed to deploy a production-ready PostgreSQL server.
set -euo pipefail
# --- AESTHETICS ---
GREEN='\033[0;32m'
@trvswgnr
trvswgnr / fetchJson.test.ts
Last active October 8, 2024 10:53
nice lil typescript fetch wrapper with errors as values
import { describe, it, expect, spyOn } from "bun:test";
import { fetchJson } from "./fetchJson";
class MockResponse {
static instanceCount = 0;
constructor(
public readonly ok: boolean,
private jsonSuccess: boolean | "bad parse",
) {
MockResponse.instanceCount++;
import React from "react";
export type ColorScheme = "light" | "dark";
export default function useColorSchemePreference(
defaultColorScheme: ColorScheme = "light"
) {
let darkQuery = "(prefers-color-scheme: dark)";
let [colorScheme, setColorScheme] = React.useState<ColorScheme>(
typeof window === "object" && window.matchMedia
@getify
getify / monads-and-friends.md
Created July 16, 2020 19:38
Monads and Friends...

Monads and Friends...

Over the last 24-48 hours, I've fielded quite a flurry of tweets related to a couple of threads I posted recently. Upon reflection on the feedback, especially the negative stuff, I decided to write this blog post to clarify a few things about my background on the topic, what I was trying to say, what I've done so far, and what I'm hoping to do (and learn!) in the future.

It's a bit of a lengthy read, but if you find you've got the time, I hope you'll read it.

To be clear, the feedback has been on a broad spectrum. A lot of it was actually quite positive, people thanking me and appreciating my continued efforts to try to make dev topics approachable. As a matter of fact, over the years, I've received boat loads of such positive feedback, and I'm tremendously grateful that I've had a helpful impact on so many lives.

But some of it veered decidedly the other direction. I'm deliberately not linking to it, because I don't want to either amplify or gang up on those folks. I'm offended an

@jason-carter
jason-carter / first.erl
Last active February 26, 2017 17:25
FutureLearn Functional Programming In Erlang 1.9: First Erlang Program
-module(first).
-export([double/1, mult/2, area/3, square/1, treble/1]).
mult(X,Y) ->
X*Y.
double(X) ->
mult(2,X).
area(A,B,C) ->
# (Run this code with Python 3 only.)
#
# This program decodes a secret message by advancing each
# letter by 2 places. Spaces and punctuation should remain
# unchanged.
# Examples:
# "nwrfml" decodes into: "python"
# "ynnjc" decodes into: "apple"
#
@jonathansick
jonathansick / query.graphql
Last active January 20, 2024 07:58
GitHub GraphQL repo commit history query
{
repository(name: "sickvim", owner: "jonathansick") {
ref(qualifiedName: "master") {
target {
... on Commit {
id
history(first: 5) {
pageInfo {
hasNextPage
}
In the [first part](https://pub.scotch.io/@rowland/build-a-media-library-with-react-redux-and-redux-saga-part-1) of this tutorial, we had a running app. We covered basic React setup, project workflow; defined basic components and configured our application's routes.
In part 2 of this tutorial, which is unarguably the most interesting part of building React/redux application, we will setup application state management with redux, connect our React components to the store, and then deploy to Heroku. We will walk through this part in eight steps:
1. Define Endpoints of interest.
2. Create a container component.
3. Define action creators.
4. Setup state management system.
5. Define async task handlers.
6. Create presentational components.
@rowlandekemezie
rowlandekemezie / ajaxWithinReactComponent.js
Last active March 23, 2019 12:22
A basic implementation of Ajax within the react component.
// UserProfile Component
class UserProfile extends React.Component {
constructor() {
super();
this.state = {
user: []
}
}
// componentDidMount lifecycle method allows dynamic behaviour, AJAX,
// side effects, etc. We issue our API call here and set the
@abiodun0
abiodun0 / gulpfile.js
Last active June 26, 2016 20:58
Seeting up react gist
"use strict";
var gulp = require('gulp');
var connect = require('gulp-connect'); // Runs a local dev server
var open = require('gulp-open');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var concat = require('gulp-concat');
var eslint = require('gulp-eslint');
var babelify = require('babelify');