Skip to content

Instantly share code, notes, and snippets.

View jamiejohnsonkc's full-sized avatar

Jamie Johnson jamiejohnsonkc

View GitHub Profile
@jamiejohnsonkc
jamiejohnsonkc / flipcard css
Created June 2, 2019 16:15
flipcard #html, #css
/* The flip card container - set the width and height to whatever you want. We have added the border property to demonstrate that the flip itself goes out of the box on hover (remove perspective if you don't want the 3D effect */
.flip-card {
background-color: transparent;
width: 300px;
height: 200px;
border: 1px solid #f1f1f1;
perspective: 1000px; /* Remove this if you don't want the 3D effect */
}
/* This container is needed to position the front and back side */
@jamiejohnsonkc
jamiejohnsonkc / simple react hooks hide function via styles
Created July 3, 2020 15:42
hide div using react hooks useState button
/** @jsx jsx */
import { jsx, Container } from "theme-ui"
import React, { useState } from "react"
function Demo2() {
const [isVisible, setIsVisible] = useState(true)
return (
<div style={{ display: isVisible ? "block" : "none" }}>
<p>This is the visibilityi test div</p>
@jamiejohnsonkc
jamiejohnsonkc / clone_and_create_new_repo.md
Last active September 9, 2021 15:57
git clone & create new repo

First clone the repository you want to work with. This step could be skipped if you want it all to happen in the folder you are already in.

git clone file:///path/to/repo/

Cloning will bring over the remotes specified in that directory. So you'll need to remove the remotes you don't want.

git remote rm <remote>
@jamiejohnsonkc
jamiejohnsonkc / randomColor.js
Last active September 7, 2021 23:08
js generate random colors
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
@jamiejohnsonkc
jamiejohnsonkc / TimeStampOnEdit.js
Created August 30, 2021 16:13
GoogleSheets TimeStampOnEdit (js)
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "Sheet1" ) { //checks that we're on Sheet1 or not
var r = s.getActiveCell();
if( r.getColumn() == 1 ) { //checks that the cell being edited is in column A
var nextCell = r.offset(0, 1);
if( nextCell.getValue() === '' ) //checks if the adjacent cell is empty or not?
nextCell.setValue(new Date()).setNumberFormat("yyyy-MM-dd" );
var nextNextCell = r.offset(0, 2);
if( nextNextCell.getValue() === '' ) //checks if the adjacent cell is empty or not?
@jamiejohnsonkc
jamiejohnsonkc / loop_output_prime_numbers.js
Last active May 28, 2021 20:39
js loop output prime numbers
// For each i in the interval {
// check if i has a divisor from 1..i
// if yes => the value is not a prime
// if no => the value is a prime, show it
// }
let n = 10;
@jamiejohnsonkc
jamiejohnsonkc / loop_repeat_until_condition_met.js
Created May 28, 2021 20:35
js loop repeat until condition is met
let num;
do {
num = prompt("Enter a number greater than 100?", 0);
} while (num <= 100 && num);
@jamiejohnsonkc
jamiejohnsonkc / even numbers.js
Last active May 28, 2021 20:35
js loop output even numbers
for (let i = 2; i <= 10; i++) {
if (i % 2 == 0) {
alert( i );
}
}
@jamiejohnsonkc
jamiejohnsonkc / guestList.js
Last active May 28, 2021 18:41
guest list
const people = ['Chris', 'Anne', 'Colin', 'Terri', 'Phil', 'Lola', 'Sam', 'Kay', 'Bruce'];
const admitted = document.querySelector('.admitted');
const refused = document.querySelector('.refused');
admitted.textContent = 'Admit: ';
refused.textContent = 'Refuse: '
for (let i = 0; i < people.length; i++) {
@jamiejohnsonkc
jamiejohnsonkc / random_string--from_array.js
Created March 31, 2021 22:09
random string from array #JS_random_string
const movesArray = ['rock', 'paper', 'scissors']
const rand = movesArray[Math.floor(Math.random() * movesArray.length)]
console.log(rand)