Skip to content

Instantly share code, notes, and snippets.

View koomai's full-sized avatar

Sid koomai

  • Sydney, Australia
View GitHub Profile
@koomai
koomai / PhpStorm Keyboard Shortcuts.md
Last active January 4, 2026 10:50
Frequently Used PhpStorm Keyboard Shortcuts

Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.

####Search, Go to, Navigation ####

Cmd + P - Search file

Cmd + Shift + O - Search everywhere

(I swapped the above two recently because I use Cmd + P to search for files most of the time).

@koomai
koomai / CronSchedule.php
Created March 24, 2019 13:54 — forked from m4tthumphrey/CronSchedule.php
CronSchedule.php - Allows one to parse a cron expression into human readable text.
<?php
/*
* Plugin: StreamlineFoundation
*
* Class: Schedule
*
* Description: Provides scheduling mechanics including creating a schedule, testing if a specific moment is part of the schedule, moving back
* and forth between scheduled moments in time and translating the created schedule back to a human readable form.
*
* Usage: ::fromCronString() creates a new Schedule class and requires a string in the cron ('* * * * *', $language) format.
@koomai
koomai / ksfetch_die
Created April 15, 2015 23:13
Uninstall Google's ksfetch
sudo /Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/Resources/GoogleSoftwareUpdateAgent.app/Contents/Resources/install.py --uninstall
@koomai
koomai / Password Validation
Last active October 19, 2022 06:46
Regex.js
// 8-24 length with at least 1 uppercase letter, 1 number and 1 special character
((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[`~!@#$%^&*()_+\-{}\[\]|\\:;'",./<>?]).{8,24})
// 8-24 length with at least 1 uppercase letter, 1 number OR special character
/((?=.*[a-z])(?=.*[A-Z])(?=.*[\d`~!@#$%^&*()_+\-{}\[\]|\\:;'",./<>?]).{8,24})/
@koomai
koomai / Laravel-Container.md
Created March 24, 2019 13:32
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@koomai
koomai / puzzle-1.php
Created July 26, 2018 13:58
Tighten Laracon Challenge (https://challenge.tighten.co)
<?php
echo str_rot13('ynenpba vf tbvat gb or jbaqebhf guvf lrne.');
// laracon is going to be wondrous this year.
@koomai
koomai / leaderboard.json
Created January 8, 2018 04:03
leaderboard
{
"response_type": "in_channel",
"text": "```\nTokens Leaderboard\n--------------------\nSid: 10\nRohan: 10\n```"
}
@koomai
koomai / email-client-quirks.md
Last active June 30, 2017 19:40
Email Clients quirks

A list of stupid email client quirks as I discover them

TL;DR - Gmail sucks balls.

  • Outlook ignores display:block on inline elements, e.g. span. Use default block elements like div or p.
  • Outlook 2003/2007 doesn't support background-image. Use a fallback colour and make sure the text is still legible.
  • Gmail supports background-image but ignores background-position. Stupid Gmail.
  • Gmail's mobile app ignores media queries. Yes, a mobile app ignores media queries. Did I mention Gmail is stupid?
  • Gmail clips your email if it thinks it's too long. The file size limit is around 100kb but keep it under 80kb to be safe. Images don't count. Minify your HTML.
@koomai
koomai / global.php
Last active December 16, 2015 14:01
Allow array of IP addresses to bypass Laravel Maintenance Mode
App::down(function()
{
if ( ! in_array(Request::getClientIp(), ['10.0.2.2']))
{
return Response::view('maintenance', [], 503);
}
});
@koomai
koomai / jquery.scrollTop.animate
Created March 18, 2012 14:11
Javascript: jQuery scrollTop animate
//animates to top of page
$('html, body').animate({
scrollTop: $(".selector").offset().top
}, 2000);