Skip to content

Instantly share code, notes, and snippets.

@assoft
assoft / logging.php
Created November 7, 2024 00:06 — forked from SohanChy/logging.php
Configuring Laravel for JSON Logging Using Monolog (For Kibana)
...
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'monolog',
'path' => storage_path('logs/laravel.log'),
@assoft
assoft / defaults.sh
Created February 24, 2023 17:58 — forked from andrewpetrochenkov/launchd.sh
macOS security
#!/usr/bin/env bash
# Disable Face Detect in Photos app
defaults write com.apple.iPhoto PKFaceDetectionEnabled 0
defaults write com.apple.gamed Disabled -bool true
defaults write com.apple.NetworkBrowser DisableAirDrop -bool YES # log out, log in
@assoft
assoft / auth.js
Created June 30, 2022 01:56 — forked from Stiropor/auth.js
Nuxt3 auth demo
import { nextTick } from 'vue'
export const useProperCookie = () => useCookie('proper_token')
export const useAuthFetch = (url, fetchOptions = {}) => {
return $fetch(url, {
baseURL: 'https://l9.test/api/v1',
...fetchOptions,
headers: {
Authorization: `Bearer ${useProperCookie().value}`,
...fetchOptions.headers,
@assoft
assoft / vimeo-downloader.js
Created July 8, 2021 18:12 — forked from aik099/vimeo-downloader.js
Download video from Vimeo (chopped m4s files)
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// (done automatically now) 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');
const { exec } = require('child_process');
@assoft
assoft / db:create.php
Created June 13, 2021 20:25
Valet DB Create Extension
<?php
namespace Valet;
use function Valet\info;
use function Valet\warning;
// Put this file in your ~/config/.valet/Extensions directory!
/**
@assoft
assoft / title-case.js
Last active March 26, 2021 18:47
Javascript Title Case
/* To Title Case © 2018 David Gouch | https://github.com/gouch/to-title-case */
// eslint-disable-next-line no-extend-native
String.prototype.toTitleCase = function () {
'use strict'
var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|v.?|vs.?|via)$/i
var alphanumericPattern = /([A-Za-z0-9\u00C0-\u00FF])/
var wordSeparators = /([ :–—-])/
return this.split(wordSeparators)
@assoft
assoft / selenium-youtube.rb
Created December 28, 2020 02:32 — forked from mqu/selenium-youtube.rb
selenium and youtube player
#!/usr/bin/ruby
require "selenium-webdriver"
require 'pp'
# install :
# sudo apt-get install ruby ruby-dev chromium-chromedriver firefoxdriver
# sudo gem install selenium-webdriver
# sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin/
@assoft
assoft / DocumentContentExtractor.php
Created August 10, 2020 04:41 — forked from lubobill1990/DocumentContentExtractor.php
Extract content from docx, doc and rtf
<?php
/**
* Created by IntelliJ IDEA.
* User: bill
* Date: 2018/11/06
* Time: 13:24
*/
use InvalidArgumentException;
@assoft
assoft / RouteDirectives.php
Created January 4, 2020 13:10 — forked from calebporzio/RouteDirectives.php
Blade Route Directives
<?php
// Register these inside a service provider:
Blade::directive('route', function ($expression) {
return "<?php echo route({$expression}) ?>";
});
Blade::directive('routeIs', function ($expression) {
return "<?php if (request()->routeIs({$expression})) : ?>";
@assoft
assoft / 01.md
Created July 23, 2019 18:24 — forked from nasrulhazim/01.md
Laravel Default API Login

Setup

Migration

Create new migration script:

php artisan make:migration add_api_token --table=users