Skip to content

Instantly share code, notes, and snippets.

View DevEarley's full-sized avatar
🎯
Focusing

Alex Earley DevEarley

🎯
Focusing
View GitHub Profile
@DevEarley
DevEarley / UsingNVM.md
Last active April 9, 2020 21:01
Using NVM
@DevEarley
DevEarley / arrayTo3DGrid.js
Last active March 29, 2020 23:25
Convert a 1D array into a 3D grid
function arrayTo3DGrid(xMax, yMax, zMax) {
let vertices = []
let totalVertices = xMax * yMax * zMax;
let xySquare = xMax * yMax;
for (let i = 0; i < totalVertices; i++) {
let x = i % xMax;
let z = Math.floor(i / (xySquare));
let ii = i - (z * xySquare);
let y = Math.floor(ii / xMax);
vertices.push(x, y, z);
@DevEarley
DevEarley / fix.py
Created January 26, 2020 01:59
Fix all files in a folder with python
import os
folder = 'D:\Projects\python\poems_need_fixing\\'
for filename in os.listdir(folder):
full_filename = folder+filename
print " START " + filename
r = open(full_filename,'r')
lines = r.readlines()
open(full_filename, "w").close()
@DevEarley
DevEarley / scraping.py
Last active January 8, 2020 03:02
Web Scraping with Python (2.7)
import requests
url = '<webpage address>'
page = requests.get(url)
from bs4 import BeautifulSoup
soup = BeautifulSoup(page.text, 'html.parser')
text = soup.find_all('h1')[0].get_text()
file = open('data.txt', 'w')
file.write(text)
file.close()
print(text)
@DevEarley
DevEarley / download-files-from-list.sh
Last active July 24, 2020 04:59
Download Multiple URLs with Bash
xargs -n 1 curl -L -O < list-of-files.txt
@DevEarley
DevEarley / OSColorScheme.css
Created December 30, 2019 04:38
User Preferred Color Scheme in CSS - OS Theme
:root {
--background-color: #fff;
--font-color: #000;
}
@media (prefers-color-scheme: light) {
:root {
--background-color: #fff;
--font-color: #000;
}
@DevEarley
DevEarley / OSColorScheme.css
Created December 30, 2019 04:38
User Preferred Color Scheme in CSS - OS Theme
:root {
--background-color: #fff;
--color: #000;
}
@media (prefers-color-scheme: light) {
:root {
--background-color: #fff;
--color: #000;
}
@DevEarley
DevEarley / count-lines.sh
Created December 27, 2019 16:26
Counts LOC for all files in a folder
find . -name '*.*' | xargs wc -l
@DevEarley
DevEarley / cnp.cmd
Last active July 11, 2020 17:49
C n' P ... Commit & Push ... Command for Git. Just type 'cnp' and then your commit message.
echo off
git add .
git commit -m "%*"
git push
@DevEarley
DevEarley / manifest.json
Created November 14, 2019 03:01
Working Manifest for Unity3d and RTX Small Office Demo
{
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ads": "2.0.8",
"com.unity.analytics": "3.3.2",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ide.rider": "1.1.0",
"com.unity.ide.visualstudio": "1.0.11",