Skip to content

Instantly share code, notes, and snippets.

View jakewtaylor's full-sized avatar

Jake Taylor jakewtaylor

View GitHub Profile
@jakewtaylor
jakewtaylor / readme.md
Last active January 6, 2024 23:29
VS Code CSS addition to increase readability on file tree.

Increases indentation on the file tree and adds some lines to each directory/file.

Works 15 levels deep, but you can expand it by just adding more of each line thats repeating, i.e.:

  • add another box shadow
    • (n*-20px) 0 0 0 rgba(255, 255, 255, 0.4)
  • add another padding-left
    • .monaco-tree-row[aria-level="n"] { padding-left: ((n-1)*20)px; }
  • add another :before & :after with left positioning
    • .monaco-tree-row[aria-level="n"]:before { left: (((n-1)*20)-9)px; }
  • .monaco-tree-row[aria-level="n"]:after { left: (((n-1)*20)-9)px; }
{
"name": "African Elephant",
"latinName": "Loxodonta Africana",
"facts": [
{
"key": "Class",
"value": "Mammal"
},
{
"key": "Countries Found",
<?php
$sql = "SELECT id, forename, surname
FROM character_information
WHERE project_name='$project_name'
AND username='$usernamevariable'";
$characters = $conn->query($sql);
while ($character = $characters->fetch_assoc()) {
@jakewtaylor
jakewtaylor / 0_composer_readme.md
Last active November 6, 2017 12:08
Autoload example for Salem

Composer.json

You'll need to add the following to composer.json (some of it is already in there, you need to add the files key and contents.

The app/Support/helpers.php is just an example, and where I would typically put helper functions, but you can put them wherever you like. If you do change it, just change all occurences of app/Support/helpers.php to the path you chose.

@jakewtaylor
jakewtaylor / Extensions.md
Last active October 9, 2018 14:19
VS Code Settings
@jakewtaylor
jakewtaylor / Tooltip.js
Created November 13, 2018 14:10
useMouseCoordinates()
const Tooltip = (props) => {
const [x, y] = useMouseCoordinates();
return (
<p>Mouse is at x: {x}, y: {y}.</p>
);
}
@jakewtaylor
jakewtaylor / problem.md
Last active November 19, 2018 16:47
help me pls

Folders

There is a table that contains data about a set of folders. Each folder can be a child of another. If folder_id is null, then it's a root level folder. If folder_id is a number, it is a child of the folder with that number.

id name folder_id
1 images null
2 css null
3 home 1
@jakewtaylor
jakewtaylor / GoogleFontLoader.js
Last active November 28, 2018 23:19
GoogleFontLoader React Component.
import React from 'react';
class GoogleFontLoader extends React.PureComponent {
link = null;
createLink = () => {
const { fonts } = this.props;
const families = fonts.reduce((acc, font) => {
const family = font.font.replace(/ +/g, '+');
@jakewtaylor
jakewtaylor / maybe.js
Last active January 10, 2019 09:15
Maybe function
const maybe = (item, fallback = null) => item ? item : new Proxy({}, {
get () {
return fallback;
}
});
// Usage:
const items = [{ id: 1, value: 'a' }, { id: 2, value: 'b' }];
maybe(items.find(itm => itm.id === 1)).value; // 'a'
export const arrayEqual = (arr1, arr2) => {
// If either item is falsey we can short circuit and warn
if (!arr1 || !arr2) {
console.warn('arrayEqual(): One of the supplied arrays is falsey.');
return false;
}
// If they're equal we can short circuit
if (arr1 === arr2) return true;