Skip to content

Instantly share code, notes, and snippets.

View jartaud's full-sized avatar

Josué Artaud jartaud

View GitHub Profile
@marcus-at-localhost
marcus-at-localhost / compiler.js
Last active June 12, 2021 19:13
[How to initialize an Alpine.js component in Unpoly.js] Alpine initializes itself after pageload, but what if the page comes out of unpoly's cache? Based on this: https://gist.github.com/marcus-at-localhost/68cbf0e637a39ddeca59199b717d46cb #alpinejs #unpolyjs
up.compiler('#gists-listing', function(element) {
// https://github.com/alpinejs/alpine/issues/359#issuecomment-614623246
Alpine.initializeComponent(element);
return function() {
console.log('Destroy Alpine Nodes? Does this take care of it: https://github.com/alpinejs/alpine/pull/174/commits/8001e12f9155c0c9ef4f4e3ccb885b4f17e04915 ?')
};
});
@karlhillx
karlhillx / laravel-mix-font-awesome.md
Last active December 21, 2022 15:35
Want to use Laravel and Font Awesome? (Regularly updated)

Laravel Mix & Font Awesome Setup: Compiling Assets

This document provides help on getting your Laravel instance running with the latest versions of Laravel Mix and Font Awesome. Note: This guide is for Laravel versions 5 through 7. If you are using Laravel 8, please go here.

Laravel Mix
@nonsocode
nonsocode / n-errorbag.js
Created August 9, 2018 13:19
A simple Frontend Validation Error bag meant to work with Laravel validation
class ErrorBag {
constructor(errors = {}) {
this.setErrors(errors);
}
hasErrors() {
return !!this.keys.length;
}
get keys() {
@muhozi
muhozi / Laravel-permission.md
Last active February 28, 2024 13:14
Setting proper permissions to laravel directory

Setting up proper permissions to a laravel directory

There are basically two ways to setup your ownership and permissions. Either you give yourself ownership or you make the webserver the owner of all files.

Webserver as owner (the way most people do it):

Assuming www-data is your webserver user.

@brenopolanski
brenopolanski / export-svg-inkscape.md
Created December 26, 2017 13:29
Exporting an object as svg from inkscape
  1. Select the object(s) to export
  2. Open the document properties window (Ctrl+Shift+D)
  3. Select "Resize page to drawing or selection"
  4. File > Save As Copy...
  5. Select Optimized SVG as the format if you want to use it on the web
@javilobo8
javilobo8 / download-file.js
Last active April 9, 2024 12:01
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@BARNZ
BARNZ / GenerateToken.php
Last active September 7, 2023 18:39
Generate a Laravel 5.x hash/token
<?php
use Illuminate\Support\Facades\Password;
# Generate a token in the same style as laravels password reset tokens.
# Will generate something like: 785f616c4978a87ad65a899ed4133b358a4697649c55b0965a7ebb7486bd9801
/** @var DatabaseTokenRepository */
$repo = Password::getRepository();
$token = $repo->createNewToken($user);
@MFry
MFry / Webpack and toastr
Last active February 16, 2023 16:58
Getting toastr npm to play with webpack
//In case anyone was having the same issue in getting toastr to run with webpack and es6
1. install openjdk
`sudo apt-get install openjdk-7-jdk`
2. install `android sdk`
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
@justbuchanan
justbuchanan / sources.list
Created September 16, 2015 20:21
/etc/apt/sources.list from an Ubuntu 14.04 installation
#deb cdrom:[Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted