Skip to content

Instantly share code, notes, and snippets.

View drjonnicholson's full-sized avatar

Jon Nicholson drjonnicholson

View GitHub Profile
@drjonnicholson
drjonnicholson / List Applications
Created September 29, 2021 16:22
List all 32 and 64 bit applications installed on a Windows 10 machine
@echo off
echo Fetching 32 bit applications...
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | sort-object -property DisplayName | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate}" > %USERNAME%.32bit.txt
echo Fetching 64 bit applications...
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | sort-object -property DisplayName | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate}" > %USERNAME%.64bit.txt
echo Completed...
pause
@drjonnicholson
drjonnicholson / fractalPaginate.php
Last active September 23, 2020 17:52
Use Laravel Fractal (https://github.com/spatie/laravel-fractal) to transform data, but produce standard Laravel Pagination formatted result. This keeps compatibility with existing Vue components designed for Laravel (e.g. https://github.com/gilbitron/laravel-vue-pagination)
// copy'n'paste to use, e.g. into your support.php file
if (! function_exists('fractalPaginate')) {
function fractalPaginate($query, $transformer, $size = 10) {
$paginator = $query->paginate($size);
return [
'total'=> $paginator->total(),
'count' => $paginator->count(),
'per_page'=> $paginator->perPage(),
'current_page'=> $paginator->currentPage(),
/**
* Slider wrapper.
*
* @author Htmlstream
* @version 1.0
*
*/
;
(function ($) {
'use strict';
@drjonnicholson
drjonnicholson / GuessModule.php
Last active October 4, 2016 09:33
GuessModule middleware to guess the Caffeinated/Module based on the request subdomain. Developed for the Caffeinated/Modules package, Laravel 5.x
<?php
namespace App\Http\Middleware;
use Caffeinated\Modules\Modules;
use Closure;
class GuessModule
{
/**
@drjonnicholson
drjonnicholson / BulkInsert.php
Last active June 6, 2020 08:56
Laravel 5.3 BulkInsert Trait
<?php
namespace App\Traits;
use Carbon\Carbon;
use DB;
/*
* Original idea from: https://github.com/laravel/framework/issues/1295#issuecomment-193025045
*/
trait BulkInsert
@drjonnicholson
drjonnicholson / portfolio.php
Last active October 18, 2015 13:26
A bit of code I use in my child theme (of the Spacious theme) to present my portfolio projects. Rather than doing this on a page I created a page template with this code that loops through all project types and displays the respective projects.
<?php foreach ( get_terms( Jetpack_Portfolio::CUSTOM_TAXONOMY_TYPE, array( 'orderby' => 'id', 'order' => 'ASC' ) ) as $t ) { ?>
<section class="portfolio_section">
<h2><?php echo $t->name; ?></h2>
<p><?php echo $t->description; ?></p>
<?php
echo Jetpack_Portfolio::portfolio_shortcode(array(
'display_types' => false,
'display_tags' => true,
'display_content' => true,
'show_filter' => true,
@drjonnicholson
drjonnicholson / README.md
Last active April 23, 2016 16:22
Templates, formats, and CSS I use with the Papercite plugin for Wordpress on my homepage (correct as of 2014-09-22).

Papercite Tweaks

This gist contains the templates, formats, and CSS I use with the Papercite plugin for Wordpress on my homepage (correct as of 2014-09-22). It lets users see formatted bibtex entries (using WP-Syntax plugin), abstracts and notes. Clicks on DOIs and PDFs are tracked using Google Analytics events.

Feedback welcome.

Files

  • mybibshow.tpl Goes into /papercite-data/tpl. Edit the URL at the end of the file to link to your main list of publications.