Skip to content

Instantly share code, notes, and snippets.

View kaitwalla's full-sized avatar

Kaitlyn Concilio kaitwalla

View GitHub Profile
@kaitwalla
kaitwalla / next.php
Created February 20, 2024 03:42
A PHP script for sending URLs to NextDNS deny/allow lists
<?php
$requestBody = $_REQUEST;
$token = 'INSERT-YOUR-VALUES-HERE';
$apiKey = 'INSERT-YOUR-VALUES-HERE';
$profileId = 'INSERT-YOUR-VALUES-HERE';
$requred = ['token', 'action', 'domain'];
@kaitwalla
kaitwalla / elf.ts
Created January 18, 2023 15:58
NGXS vs. NGRX vs. Elf
// reports.service.ts
import { trackRequestResult } from '@ngneat/elf-requests';
import { setReports } from './reports.repository';
export function fetchReports() {
return http.get(reportsUrl).pipe(
tap(setReports),
trackRequestResult(['reports'])
);
@kaitwalla
kaitwalla / install.sh
Last active February 7, 2024 04:09
PopOS enhanced session install.sh
#!/bin/bash
#
# This script is for Ubuntu 20.04 Focal Fossa to download and install XRDP+XORGXRDP via
# source.
#
# Major thanks to: http://c-nergy.be/blog/?p=11336 for the tips.
#
###############################################################################
@kaitwalla
kaitwalla / DOM Element Creator.js
Last active May 31, 2020 05:38
Small vanilla JS helper to create DOM elements with one command
function DomEl(creationString) {
var elType = creationString.match(/^(\w+)*/g);
var classes = creationString.match(/\.([^\s\.\#\[]*)/g);
var id = creationString.match(/\#([^\s\.\[]*)/g);
var attributes = creationString.match(/\[([^\]]*)/g);
if (elType) {
var el = document.createElement(elType);
if (classes && classes.length > 0) {
for (var i = 0; i < classes.length; i++) {
el.classList.add(classes[i].replace('.',''));
@kaitwalla
kaitwalla / pristinejs-ajax-validator.js
Last active May 23, 2020 05:38
An AJAX validator mini-library that can be used with PristineJS
/** usage */
var form = document.getElementById('formId');
var ajaxValidator = AjaxValidator(form);
ajaxValidator.add_field('fieldId', {url: '/url/to/validate/againt/{value}', message: 'Message to show user if it doesn\'t validate});
// {value} will be replaced by the value of the input
// The url should return a JSON (with proper header) message of {type: 'success', message: true|false}, where true means it's valid and false means it's not
var AjaxValidator = function(formElement, pristine=false) {
var form;
@kaitwalla
kaitwalla / folders_to_skip.json
Created September 2, 2017 04:19
A small utility for copying music to a folder with a limit on the number of files per folder (copying music to a USB drive for use in a car)
{"Folders" :
{
"Comedy": false,
"Famous": false,
"Mellow": false,
"Mixes": ["Youtube Mixes"],
"Musicals": false,
"OST - Instrumental": false,
"Standup": false,
"XMas": false
*~
.DS_Store
.svn
.cvs
*.bak
*.swp
Thumbs.db
wp-config.php
wp-content/*
!wp-content/plugins/
@kaitwalla
kaitwalla / Readme.md
Last active September 10, 2021 20:36
Make Vagrant Great Again, or: Down Is the Frigging Antonym of Up, and Other Useful Things.

Better Vagrant Commmands

The purpose of this shell command is to make the vagrant commands

  1. slightly easier to use if you're not already in the Vagrant directory
  2. parallel

(Not gonna lie, 2 was actually the bigger motivator. Can't tell you how many times I typed vagrant down to have nothing happen.)

The file is structured a little oddly because it's actually part of another, larger command used for deployments and the like. If there are any bugs, let me know, as I probably didn't parse it out very carefully.

@kaitwalla
kaitwalla / datatables.modal
Created October 15, 2014 14:17
DataTables show all fields (including hidden) using jQuery Modal
$('#dtable tbody').on('click','tr',function() {
$(this).addClass('selected');
row = dTable.row('.selected').data();
$('#201314YorkAdamsTeacherSalaries1411419301 .modal table').html('');
for (var i = 0; i < cols.length; i++) {
$('<tr><td><strong>'+cols[i]+'</strong></td><td>'+row[i]+'</td></tr>').appendTo('#201314YorkAdamsTeacherSalaries1411419301 .modal table');
}
$('#201314YorkAdamsTeacherSalaries1411419301 .modal').modal().on($.modal.BEFORE_CLOSE,function() {
$('#201314YorkAdamsTeacherSalaries1411419301 tr.selected').removeClass('selected');
});
@kaitwalla
kaitwalla / dequeue
Created September 11, 2014 19:09
Dequeuer for push in Javascript
function dequeue(data) {
if (temp) {
queue.push(data);
var time = temp.getTimeLeft();
temp.stop();
temp = new timer(function () {
temp = false;
dequeue();
},time);
}