Skip to content

Instantly share code, notes, and snippets.

View mglaman's full-sized avatar

Matt Glaman mglaman

View GitHub Profile
@elazar
elazar / readme.md
Last active December 10, 2022 02:53
Personal Finance Project RFC

Problem

Existing software-based personal finance systems (hereafter abbreviated as PFS) tend to lack data portability, customizability, support for self-hosting, mobile-friendliness, or some combination thereof, and are often used as an indirect form of advertising or to otherwise promote paid third-party services.

@Berdir
Berdir / example
Last active October 26, 2022 20:44
Alias for drupal-mrn.dev
$ mrn
<p><em>Add a summary here</em></p>
<h3>Contributors (1)</h3>
<p><a href="https://www.drupal.org/u/tim.plunkett">tim.plunkett</a></p>
<h3>Changelog</h3>
<p><strong>Issues:</strong> 1 issues resolved.</p>
<p>Changes since <a href="https://www.drupal.org/project/currency/releases/8.x-3.3">8.x-3.3</a>:</p>
<h4>Task</h4>
<ul>
<li><a href="https://www.drupal.org/i/3223997">#3223997</a> by tim.plunkett: Allow PHP 8, Drupal 10 compatibility</li>
@davidpiesse
davidpiesse / tailwind_md_all_colours.js
Last active May 11, 2024 17:16
A colour set for Tailwind CSS that include all Material Design Colours, shades, accents and contrast colours
// https://davidpiesse.github.io/tailwind-md-colours/
//
//Notes
//
//All colours are generated from Material Design Docs
//Colours have a base, a set of shades (50-900) accent colours
//In addition a companion set of contrast colours are included for colouring text / icons
// Example usage
// class="w-full bg-red-600 text-red-600-constrast"
@mglaman
mglaman / contributor-parser.php
Last active December 22, 2017 22:06
Parsing things
<?php
$git_command = 'git --git-dir=./.git log 8.x-2.x --format="%ae||%s" -s --no-merges --reverse';
$contributors = [];
$commits = [];
$fallback_commits = [];
$regex = [
'issue' => '/by (\w+\,?.*?):/',
@lsloan
lsloan / iso8601TimestampWithMilliseconds.php
Last active January 17, 2023 07:40
Get PHP DateTime objects with fractional seconds and format them according to ISO 8601.
/*
* The `DateTime` constructor doesn't create objects with fractional seconds.
* However, the static method `DateTime::createFromFormat()` does include the
* fractional seconds in the object. Finally, since ISO 8601 specifies only
* millisecond precision, remove the last three decimal places from the timestamp.
*/
// DateTime object with microseconds
$now = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''));
@pfaocle
pfaocle / gen-d8-salt.sh
Created March 8, 2016 09:39
Generate Drupal 8 hash salt
drush eval "var_dump(Drupal\Component\Utility\Crypt::randomBytesBase64(55))"
diff --git a/commerce_discount.module b/commerce_discount.module
index c5e82bf..3b41161 100644
--- a/commerce_discount.module
+++ b/commerce_discount.module
@@ -6,12 +6,44 @@
* their bundles, and all surrounding functionality (API, UI).
*/
+function commerce_discount_line_items_hash($wrapper) {
+ $line_items = $wrapper->commerce_line_items->value();
@Seldaek
Seldaek / rant.log
Created April 17, 2015 20:54
freenode/#composer rant
03:54 -!- THEBEEFSTEAK has joined #composer
03:54 <THEBEEFSTEAK> hey guyys
03:54 <THEBEEFSTEAK> RobLoach
03:55 <THEBEEFSTEAK> sandvige
03:55 <THEBEEFSTEAK> scottrigby
03:55 <THEBEEFSTEAK> skoop
03:55 <THEBEEFSTEAK> Spea
03:55 <THEBEEFSTEAK> tonton
03:55 <THEBEEFSTEAK> tystr:
03:55 <THEBEEFSTEAK> s+e:
@mattes
mattes / check.go
Last active May 3, 2024 22:20
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}