Skip to content

Instantly share code, notes, and snippets.

undefined

Bolaji Ayodeji BolajiAyodeji

undefined
Block or report user

Report or block BolajiAyodeji

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View postgresql cheatsheet.md

POSTGRESQL CHEATSHEET

Basic commands

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
View index.js
const SlackBot = require('slackbots');
const axios = require('axios')
const dotenv = require('dotenv')
dotenv.config()
const bot = new SlackBot({
token: `${process.env.BOT_TOKEN}`,
name: 'inspirenuggets'
})
View test.md

A First Level Header

A Second Level Header

This is just a regular paragraph. yen yen yen

Header 1

Header 2

View gist:5255bb1d2c81b7c63028b978a7a04768
const urlSlug = (postTitle) => {
let postUrl = postTitle.toLowerCase().split(' ');
let postSlug = postUrl.join('-');
return postSlug;
}
let postTitle = 'Handling Static Forms, The Client-side Way'
console.log(urlSlug(postTitle));
View netlify.html
<form action="/thanks.html" name="Bolaji's form" method="POST" data-netlify="true">
<div class="form-group">
<label>Name:</label>
<input type="text" class="form-control" id="name" placeholder="Name">
<div class="invalid-feedback">
Name must be between 2 and 20 characters
</div>
</div>
<div class="form-group">
<label>Email:</label>
View formspree.html
<form action="https://formspree.io/you@email.com" method="POST">
<input type="hidden" name="_subject" value="Bolaji's Form">
<input type="hidden" name="_next" value="/thanks.html" >
<div class="form-group">
<label>Name:</label>
<input type="text" class="form-control" id="name" placeholder="Name">
<div class="invalid-feedback">
Name must be between 2 and 20 characters
</div>
</div>
View greetings.js
import React from "react"
import ReactDOM from "react-dom"
function App() {
const date = new Date()
const hours = date.getHours()
let timeOfDay
if (hours < 12) {
timeOfDay = "morning"
View todo.js
class TodoApp extends React.Component {
constructor(props) {
super(props);
this.state = { items: [], text: '' };
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
render() {
return (
@BolajiAyodeji
BolajiAyodeji / regexCheatSheet.js
Created Apr 16, 2019
A Regular Expressions Cheat Sheet
View regexCheatSheet.js
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
View wc-final-index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="description" content="Simple weight converter">
<title>Weight Converter</title>
You can’t perform that action at this time.