Skip to content

Instantly share code, notes, and snippets.

View daverogers's full-sized avatar
🤘

Dave Rogers daverogers

🤘
View GitHub Profile
@daverogers
daverogers / kebab-case.php
Last active March 12, 2023 11:33
Laravel's `Str::kebab()` format is basically just `Str::snake()` with the hyphen delimiter, but the downside being when you have groups of capitalized letters it'll hyphenate in between each of them instead of just before the first of the group. This isn't always desirable, like in some column name format styles...
<?php
// default Laravel output
Str::of('TableID')->kebab();
// result: 'table-i-d'
// my way, grouping by capital letters
Str::of('TableID')
@daverogers
daverogers / roundrobin.php
Created November 4, 2021 15:29
PHP Round Robin
<?php
// evenly distribute colors across $return keys
$colors = [ 'red', 'blue', 'green', 'pink' ];
$return = [ 0,1,2,3,4,5,6,7,8,9 ];
foreach($return as $i => $loop) {
$return[$loop] = $colors[$i % count($colors)];
}
@daverogers
daverogers / Copy As JIRA Table
Created October 5, 2016 07:50
Copies Sequel Pro result into JIRA's table format. Save with the Bundle Editor (as new Copy bundle).
#!/usr/bin/php
<?php
/*
* COPY AS JIRA TABLE by @daverogers
* Copies Sequel Pro result into JIRA's table format. Save with the Bundle Editor (as new Copy bundle).
*
* Thanks to @jakob-stoeck for his example Gist!
*/

Keybase proof

I hereby claim:

  • I am daverogers on github.
  • I am daverogers (https://keybase.io/daverogers) on keybase.
  • I have a public key whose fingerprint is 3E60 69FA 897B 97EF 1C7C 4949 0400 4D9C 54CB 0F66

To claim this, I am signing this object:

@daverogers
daverogers / footer.js
Created April 12, 2013 22:41
Assign "active" class to navbar item based on current page URL with jQuery