Skip to content

Instantly share code, notes, and snippets.

View UcheSylvester's full-sized avatar
🚀

Uchenna Sylvester Okoro UcheSylvester

🚀
View GitHub Profile

LINUX CHEAT LIST

This is a collection of all I have learned when using Linux (ubuntu)

  • ctrl+shift+T: opens terminal
  • cd <directory-name>: change directory
  • ls': Lists all files and directories in a directory
@UcheSylvester
UcheSylvester / setAttributes.js
Last active June 30, 2019 08:07
setAttributes.js
// setAttributes function for setting multiple attributes to a particular element at once!
function setAttributes(element, attributes) {
for(let key in attributes) {
element.setAttribute(key, attributes[key])
}
}
// Call it like this:
setAttributes(element, {"class": "center", "width": "100%", "height": "100%", ...});
@hubgit
hubgit / SelectField.tsx
Last active December 29, 2023 03:41
Use react-select with Formik
import { FieldProps } from 'formik'
import React from 'react'
import Select, { Option, ReactSelectProps } from 'react-select'
export const SelectField: React.SFC<ReactSelectProps & FieldProps> = ({
options,
field,
form,
}) => (
<Select
@robertpainsi
robertpainsi / commit-message-guidelines.md
Last active June 27, 2024 14:45
Commit message guidelines

Commit Message Guidelines

Short (72 chars or less) summary

More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).

Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
@randallreedjr
randallreedjr / heroku-remote.md
Last active April 25, 2024 07:06
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@coryhouse
coryhouse / mockDataSchema.js
Last active April 15, 2023 15:09
Mock Data Schema for "Building a JavaScript Development Environment" on Pluralsight
export const schema = {
"type": "object",
"properties": {
"users": {
"type": "array",
"minItems": 3,
"maxItems": 5,
"items": {
"type": "object",
"properties": {
@taniarascia
taniarascia / header-scroll.js
Created September 30, 2015 16:41
Change Header Color on Scroll
var scroll_start = 0;
var startchange = $('#scroll-color');
var offset = startchange.offset();
$(document).scroll(function () {
scroll_start = $(this).scrollTop();
if (scroll_start > offset.top) {
$('.navigation').css('background', '#e63c2d');
} else {
$('.navigation').css('background', 'transparent');
}
@ygotthilf
ygotthilf / jwtRS256.sh
Last active June 27, 2024 16:13
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@MoOx
MoOx / comments-trick.json
Last active October 17, 2022 15:00
How to make comment in JSON file
{
"//field": "These 'double quote' 'double quote' are used as comments, because JSON doesnt' allow comment",
"field": {},
"#another-field": "Another comment",
"another-field": {},
"/*stuff": "Be careful to use them when you have full control of the content :)",
"stuff": [],
"bla": "bla"
}
@axelpale
axelpale / combinations.js
Last active July 7, 2023 10:37
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,