Skip to content

Instantly share code, notes, and snippets.

@sprobejames
sprobejames / AttachmentController.php
Last active September 24, 2024 00:51 — forked from zahidhasanemon/Controller.php
Multiple file upload asynchronously using Laravel and Dropzone JS. Works perfectly with multiple files dragged and dropped or selected at a time. Images are uploaded via ajax request.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class AttachmentController extends Controller
{
public function store(Request $request)
{
@sprobejames
sprobejames / tree.css
Created June 20, 2024 01:54 — forked from dylancwood/tree.css
CSS to create a simple tree structure with connecting lines. No images or JS required.
ul.tree, ul.tree ul {
list-style: none;
margin: 0;
padding: 0;
}
ul.tree ul {
margin-left: 10px;
}
ul.tree li {
margin: 0;
@sprobejames
sprobejames / customCalendar.js
Created April 25, 2024 00:54 — forked from aibrahim3546/customCalendar.js
Gist containing code for creating custom calendar in react using hooks.
import React, { useState, useEffect } from 'react';
import styled from 'styled-components'
const { datesGenerator } = require('dates-generator');
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
const Container = styled.div`
width: 300px;
border: 1px solid black;
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@sprobejames
sprobejames / SetLocale.md
Created February 6, 2024 01:46 — forked from xarmengol/SetLocale.md
Set locale for authenticated users in laravel

Intro

What we want to do is to set the locales of a laravel 5.6 application, by depending of the language of the authenticated user. We store the language preferences of a user on the database, in the users table.

Steps

Create a new Middleware:

php artisan make:middleware AuthUserSetLocale
@sprobejames
sprobejames / Dockerfile
Created September 22, 2023 00:51 — forked from ptflp/Dockerfile
docker php install imagemagick alpine 3.8
FROM php:7.0-fpm-alpine3.8
RUN apk add --no-cache --virtual .build-deps \
libxml2-dev \
shadow \
autoconf \
g++ \
make \
&& apk add --no-cache imagemagick-dev imagemagick \
&& pecl install imagick-beta \
FROM node:slim
# We don't need the standalone Chromium
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
# Install Google Chrome Stable and fonts
# Note: this installs the necessary libs to make the browser work with Puppeteer.
RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
@sprobejames
sprobejames / gist:0ff98370b0a0092a3346cce9610aafbe
Created October 13, 2022 07:45 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@sprobejames
sprobejames / install-docker.md
Created October 10, 2022 03:41 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
function interceptNetworkRequests(ee) {
const open = XMLHttpRequest.prototype.open;
const send = XMLHttpRequest.prototype.send;
const isRegularXHR = open.toString().indexOf('native code') !== -1;
// don't hijack if already hijacked - this will mess up with frameworks like Angular with zones
// we work if we load first there which we can.
if (isRegularXHR) {