Skip to content

Instantly share code, notes, and snippets.

View paperscissors's full-sized avatar

Tom Filepp paperscissors

  • Albany, NY
View GitHub Profile

🚀 Product Import Preview Report

Preview Mode - This shows what WOULD be imported (no changes will be made)

📄 Source Files Analysis

File Size Records
m1.xml 29.7 KB 23 records
m2.xml 34.1 KB 243 records
import re
from collections import Counter
from tabulate import tabulate
import multiprocessing
import os
from wordcloud import WordCloud
import matplotlib.pyplot as plt
from langdetect import detect
import random
@paperscissors
paperscissors / FieldRepeater.php
Created October 31, 2023 17:32
Laravel Livewire 3 Field Repeater
<?php
namespace App\Livewire;
use Livewire\Component;
class FieldRepeater extends Component
{
public array $rows = [];
public string $field;
switchphp () {
phpversion="$(php -v | head -n 1 | cut -d " " -f 2 | cut -f1-2 -d".")"
brew unlink php@$phpversion && brew link php@$1 && valet use php@$1 --force
}
<?php
public function getSummaryAttribute()
{
$summary = Str::words($this->description, 250, '...');
$summary = html_entity_decode($summary);
$summary = html_entity_decode($summary);
$summary = html_entity_decode($summary);
$summary = html_entity_decode($summary);
$summary = htmlspecialchars_decode($summary);
@paperscissors
paperscissors / switchphp.sh
Created August 19, 2022 13:41
Bash command to switch between multiple versions of PHP on MacOs, Homebrew, and Valet
switchphp () {
phpversion="$(php -v | head -n 1 | cut -d " " -f 2 | cut -f1-2 -d".")"
brew unlink php@$phpversion && brew link php@$1 && valet use php@$1 --force
}
# then switchphp 8.1, switchphp 7.4, whatever versions installed
@paperscissors
paperscissors / app.js
Created August 9, 2021 18:01
jquery content repeater
$('.repeater').on('click', '.repeater-btn', function(e) {
e.preventDefault();
var $this = $(this),
$repeater = $this.closest('.repeater').find('[data-repeatable]'),
count = $repeater.length,
$clone = $repeater.first().clone();
$clone.find('[id]').each(function() {
this.id = this.id + '_' + count;
@paperscissors
paperscissors / AppServiceProvider.php
Last active March 2, 2021 21:41
LAravel response macro for file attachment download response
Response::macro('attachment', function ($content, $filename) {
$headers = [
'Content-type' => 'text/plain',
'Content-Disposition' => 'attachment; filename="'.$filename.'"',
];
return Response::make($content, 200, $headers);
});
<?php
/**
* Complete the order, send notifications and invoice, if applicable
* @param Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function complete(Request $request)
{
$user = $request->user();
@paperscissors
paperscissors / intro.js
Created July 20, 2020 18:49
quick intro animation for multiple staggered elements
/*
.orc {
transition: top 1s ease 0s;
position: relative;
top: -3000px;
&.shown {
top: 0;
}
}