Skip to content

Instantly share code, notes, and snippets.

View fgilio's full-sized avatar

Franco Gilio fgilio

View GitHub Profile
@hexsprite
hexsprite / serviceworker-errors.js
Created August 18, 2017 16:00
service worker error tracking example
/* eslint-env browser, serviceworker */
self.addEventListener('error', function (event) {
logError(event.error)
})
self.addEventListener('unhandledrejection', function (event) {
let { reason, detail } = event
if (!reason && detail) {
reason = detail.reason
}
@fideloper
fideloper / stream_file.php
Last active March 15, 2025 03:08
Stream file from S3 to browser, assume Laravel Filesystem usage
<?php
/*************************************************************************
* Get File Information
*/
// Assuming these come from some data source in your app
$s3FileKey = 's3/key/path/to/file.ext';
$fileName = 'file.ext';
@calebporzio
calebporzio / PreviewOfUpcomingPackage.php
Last active December 2, 2024 12:10
A model trait that allows child models to use parent table names and relationship keys.
<?php
namespace App\Abilities;
use Illuminate\Support\Str;
use ReflectionClass;
/**
* Note: This is a preview of an upcoming package from Tighten.
**/
@mswieboda
mswieboda / Theming-Slack-OSX.md
Last active December 3, 2017 23:45 — forked from DrewML/Theming-Slack-OSX.md
Theming Slack for OSX 🕶️

Theming Slack for OSX

So, you love Slack, but you hate applications with large white backgrounds? Why not use Dark Mode! 🕶️

Unfortunately, Slack does not have a Dark Mode, although it's on their list of possibilities.

But, don't fret - there is a solution! Because the slack native desktop apps are just wrappers around a web app, we can inject our own CSS to customize the application to our liking.

(I take no credit for this exploit, graciously found via @DrewML https://gist.github.com/DrewML/0acd2e389492e7d9d6be63386d75dd99 and suggestions by @bradens, @jouni, @gkostov and others).

@edwinheij
edwinheij / streamLargeFile.php
Last active November 18, 2024 18:33
Stream large file with Laravel
<?php
//disable execution time limit when downloading a big file.
set_time_limit(0);
/** @var \League\Flysystem\Filesystem $fs */
$fs = Storage::disk('local')->getDriver();
$fileName = 'bigfile';
$metaData = $fs->getMetadata($fileName);
@renatorib
renatorib / operator_with_ligatures.md
Last active January 11, 2024 06:45
Using Operator Mono with Fira Code ligatures in Atom.

Using Operator Mono with Fira Code ligatures in Atom.

  1. Open your Atom's Stylesheet
    image

  2. Put this css

atom-text-editor {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
@sj26
sj26 / LICENSE.md
Last active April 7, 2025 21:12
Bash retry function

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit

@mmasashi
mmasashi / creaet_read_only_user.sql
Created November 14, 2016 20:24
Create read-only user on MySQL
CREATE USER r_only_user identified by 'password';
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO 'r_only_user'@'%' IDENTIFIED BY 'password';
GRANT SELECT, SHOW VIEW, PROCESS, REPLICATION CLIENT ON *.* TO 'r_only_user'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
@derhuerst
derhuerst / 00-about.md
Last active November 10, 2018 16:16
making asynchronous JS code synchronous

making asynchronous JS code synchronous

This script demonstrates challenges when inlining async function calls like setTimeout as well as a solution.

inspect-code does this.

Things to be solved:

  • setTimeout needs to return a timer id.
  • clearTimeout
@joshcanhelp
joshcanhelp / scrollTo.js
Last active January 28, 2022 13:21
Animated scrollTo for specific element or top of page
//
// Smooth scroll-to inspired by:
// http://stackoverflow.com/a/24559613/728480
//
module.exports = function (scrollTo, scrollDuration) {
//
// Set a default for where we're scrolling to
//