Skip to content

Instantly share code, notes, and snippets.

View Samuell1's full-sized avatar
πŸ––

Samuel Samuell1

πŸ––
View GitHub Profile
@brytey2k
brytey2k / CreateGeneralExportFileJob.php
Last active February 11, 2025 19:32
A simple Laravel job that can help you export data through CSV from a database with millions of rows.
<?php
namespace App\Jobs;
use App\Models\GeneralExport;
use Storage;
class CreateGeneralExportFileJob implements ShouldQueue
{
// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open('app').then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
@Chocksy
Chocksy / sentry-config.html
Last active September 12, 2024 09:14 — forked from impressiver/raven-config.html
Sentry.js configuration for logging JavaScript exceptions to Sentry (https://sentry.io/). Without the added ignore options, you'll quickly find yourself swamped with unactionable exceptions due to shoddy browser plugins and 3rd party script errors.
<!-- Sentry.js Config -->
<script src="https://js.sentry-cdn.com/{{ENV['SENTRY_PUBLIC_DSN']}}.min.js" type="text/javascript"></script>
<script type="text/javascript">
// custom functions to handle errors in JS.
function handleRouteError(err) {
Sentry.captureException(err);
}
function errorHandler(error, data, level) {
level = level || 'info';
@gjerokrsteski
gjerokrsteski / remove env file from git forever
Last active April 11, 2025 00:55
remove env file from git history forever
echo '.env' >> .gitignore
git rm -r --cached .env
git add .gitignore
git commit -m 'untracking .env'
git push origin master
@yyx990803
yyx990803 / commits.vue
Last active May 13, 2022 16:43
Vue examples comparisons in 2.x and function-based APIs
<template>
<div id="demo">
<h1>Latest Vue.js Commits</h1>
<template v-for="branch in branches">
<input type="radio"
:id="branch"
:value="branch"
name="branch"
v-model="currentBranch">
<label :for="branch">{{ branch }}</label>
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "October CMS demo infrastructure.",
"Parameters": {
"KeyName": {
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
"Type": "AWS::EC2::KeyPair::KeyName",
"ConstraintDescription": "must be the name of an existing EC2 KeyPair."
},
"StagingInstanceType": {
@ramantehlan
ramantehlan / README-Fancy.md
Last active May 25, 2025 09:27
README template I use for most of my projects.

Introduction

  • Add your project logo.
  • Write a short introduction to the project.
  • If you are using badges, add them here.

πŸ“’ Index

@renoirtech
renoirtech / createCsvAndUploadToAwsS3.php
Created January 29, 2019 19:07
[Laravel] Create a CSV and upload to AWS S3
<?php
use League\Csv\Writer;
use League\Csv\Reader;
use League\Csv\CannotInsertRecord;
use Illuminate\Support\Facades\Storage;
$now = now()->format('U');
$fileName = "file-$now.csv";
$storageInstance = Storage::disk('s3');
@zzerjae
zzerjae / index.js
Last active March 9, 2021 11:51
sample code - Resizing Images with Amazon CloudFront & Lambda@Edge
'use strict';
const querystring = require('querystring');
const aws = require('aws-sdk');
const s3 = new aws.S3({
region: 'ap-northeast-2',
signatureVersion: 'v4'
});
const sharp = require('sharp');
@jkrnak
jkrnak / handler.js
Last active April 6, 2021 12:30
Example Lambda@Edge function to add cache control header to assets
// Lambda function to set cache control public header in case of missing cache control header
exports.handler = (event, context, callback) => {
const { response } = event.Records[0].cf;
const { headers } = response;
const headerCacheControl = 'Cache-Control';
const defaultTimeToLive = 60 * 60 * 24 * 14; // 14 days
if (response.status === '200') {
if (!headers[headerCacheControl.toLowerCase()]) {