Skip to content

Instantly share code, notes, and snippets.

Avatar

Christopher Murphy Splode

View GitHub Profile
@Splode
Splode / electron-reset.css
Last active Nov 29, 2021
Disable selection/highlighting and element draggin in Electron
View electron-reset.css
/* disable selection */
:not(input):not(textarea),
:not(input):not(textarea)::after,
:not(input):not(textarea)::before {
-webkit-user-select: none;
user-select: none;
cursor: default;
}
input, button, textarea, :focus {
outline: none;
@Splode
Splode / Laravel-Scheduler-Windows.md
Last active Dec 7, 2021
Laravel Scheduler on Windows
View Laravel-Scheduler-Windows.md

Run Laravel Scheduled Tasks on Windows

The following are instructions for running scheduled tasks defined in a Laravel project on Windows. The Laravel documentation provides instructions for running scheduled tasks using cron jobs on Linux systems. However, cron jobs are not available on Windows. The built-in Windows Task Scheduler can be used to run scheduled tasks instead.

Create a Scheduled Task

  1. Open Task Scheduler
  2. Select Create Task...
  3. Give the task a name and description
  4. To run the task in the background, select Run whether the user is logged on or not and check the Hidden checkbox.
@Splode
Splode / fullscreen.bat
Created Apr 17, 2019
Start Brave/Chrome in fullscreen mode
View fullscreen.bat
"C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\Brave.exe" --start-fullscreen http://localhost
@Splode
Splode / backup.bat
Created Mar 28, 2019
Recursively copy directory on Windows and log output to file
View backup.bat
cd C:\Users\MT_User\scripts
IF NOT EXIST .\logs mkdir .\logs
robocopy C:\Users\MT_User\scripts\test C:\Users\MT_User\scripts\backup /s >> .\logs\%date%.log
@Splode
Splode / perm.sh
Created Jun 5, 2018
Allow Laravel `php artisan` permissions on Ubuntu
View perm.sh
sudo chgrp -R www-data storage
sudo chgrp -R www-data bootstrap/cache
sudo chmod -R ug+rwx storage
sudo chmod -R ug+rwx bootstrap/cache
@Splode
Splode / iterate.js
Created Dec 18, 2017
Iterate over the array-like object, HTMLCollection using Array.prototype
View iterate.js
// HTML Collection
const articles = document.querySelectorAll('.article')
// Iterate using Array.prototype
Array.prototype.forEach.call(articles, el => {
// iterate over el
}
@Splode
Splode / index.html
Created Dec 4, 2017
Intrinsic Image Placholders
View index.html
<div class="Intrinsic-wrapper">
<img class="Intrinsic-item Intrinsic-item--1x1" src="">
</div>
<style>
.Intrinsic-wrapper {
display: block;
padding-top: 100%;
position: relative;
width: 100%;
@Splode
Splode / preload-img.js
Last active Nov 20, 2017
Pre-load images for faster painting of new images
View preload-img.js
// example imgObj
const img = {
filename: 'example.jpg',
caption: 'example-caption'
}
function preloadImgs (imageLs) {
imageLs.forEach(imgObj => {
let img = new Image()
img.src = imgObj.filename
@Splode
Splode / node-cli-commands.md
Created Sep 29, 2017
A list of useful commands for running Node
View node-cli-commands.md

Run a Process in the Background

  1. When a process is running, press ctrl+z to step out of the current process and show running processes.
  2. To continue running a process in the background, use the following command: bg %1, where the %1 is the index of the process.

List Running Processes and Filter by Name

ps -ef | grep node

Kill a Process by Name

@Splode
Splode / .gitignore
Created Aug 9, 2017
Gitignore Template
View .gitignore
# ================ Windows =====================
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump