Skip to content

Instantly share code, notes, and snippets.

@cookieguru
cookieguru / index.php
Created May 23, 2021 20:41
AJAX response logging with Symfony Panther
<?php
use Symfony\Component\Panther\Client;
require 'vendor/autoload.php';
$client = Client::createFirefoxClient();
try {
$crawler = $client->request('GET', 'https://www.example.com/');
$client->executeScript(/** @lang JavaScript */ 'function addXMLRequestCallback(callback) {
@cookieguru
cookieguru / generate_sql.sh
Created September 29, 2018 00:57
Graphing lines of code over time
cd /path/to/your/code
mkdir ../counts
git log --format=format:"git reset --hard %H&&cloc --skip-uniqueness --force-lang=HTML,twig --sql-project=\"%ai\" --sql=../counts/%H.sql ." --no-merges > ../runme.sh
bash ../runme.sh
mysql -u root -p stats < grep -h ../counts/* insert
@cookieguru
cookieguru / update-fork-using-rebase.sh
Created May 5, 2017 23:24
Updating a fork using git rebase instead of merge
git clone git@github.com:yourname/repo-name.git
cd repo-name
git remote add upstream https://github.com/original-user/repo-name.git
git checkout master
git fetch upstream
git rebase upstream/master
git push
@cookieguru
cookieguru / qif.php
Last active April 11, 2017 04:14
Interactive command line utility to convert a QIF (Quicken export) file to CSV or display on screen
<?php
//First check the current directory for any QIF files
//If one is found, use that name by default
foreach(scandir('.') as $file) {
if(strtolower(substr($file, -4)) == '.qif') {
$filename = $file;
break;
}
}
@cookieguru
cookieguru / pnwphp.php
Last active September 1, 2016 05:33
Scrapes the PNWPHP Dryfta site and generates a COD-style JSON document of the sessions
<?php
define('URL_BASE', 'https://pnwphp2016.dryfta.com');
class PageRetriever {
/** @var array */
private $cache = [];
/** @var resource */
private $curl;
public function __construct() {
@cookieguru
cookieguru / userStyle.css
Last active February 5, 2016 19:09
Jira Black CSS stylesheet
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("jira.example.com") {
.aui-lozenge {
text-transform: none !important;
}
#dashboard,
#footer-logo,
#issue-content,
#issuetable > tbody > tr,