Skip to content

Instantly share code, notes, and snippets.

View koomai's full-sized avatar

Sid koomai

  • Sydney, Australia
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / index.html
Created November 26, 2014 05:08 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
a {
font-family: Arial;
color: white;
text-shadow: 1px 2px 1px #000000;
App::down(function()
{
if ( ! is_admin_ip(Request::getClientIp()))
{
return Response::view('maintenance', [], 503);
}
});
@koomai
koomai / helpers.php
Created September 4, 2014 16:10
Helper file with functions to match IP address
<?php
if ( ! function_exists('is_admin_ip'))
{
/**
* Checks whether an IP address exists in a given array of IP addresses
*
* @return boolean
*/
function is_admin_ip($ip)