Skip to content

Instantly share code, notes, and snippets.

View rizkhal's full-sized avatar
🌴
On vacation

Rizkhal rizkhal

🌴
On vacation
View GitHub Profile
@MattApril
MattApril / ConsoleSchedulingTest.php
Last active October 19, 2023 13:58
A simple way of testing that your Lumen commands are scheduled exactly when and how you expect. This approach does not trigger commands to actually execute, which is what a lot of other suggestions do.
<?php
use App\Console\Kernel;
use Carbon\Carbon;
use Illuminate\Console\Scheduling\Event;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Support\Collection;
class ConsoleSchedulingTest extends TestCase
{
@sdwru
sdwru / Laravel-websockets-on-Laravel-API-backend+Laravel-Echo-on-Vue.js-front-end-on-different-server-domain-using-private-channel.md
Last active May 20, 2024 02:19
Laravel-websockets on Laravel API backend + Laravel Echo on Vue.js front end on different server/domain using private channel.md

These are my notes on how I got all the basics working end to end.

Laravel API backend and Vue.js frontend are 2 different servers on different public IP addresses and different domains. I am using pure Vue.js on the front end. Most instructions assume Laravel Vue.js is being used which is structured slightly different with different file names and directories.

  • Laravel API backend domain name (api.somedomain.com)
  • Vue.js frontend domain name (client.somedomain.com)

No database is needed for any of this to work using sync queue. That is only needed in production if/when you use a database queue.


@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active April 9, 2024 14:08
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@vielhuber
vielhuber / Component.vue
Last active January 17, 2023 21:29
global helpers helper functions #vue
<template>
<div :test="$helpers.foo1()" :test2="bar()"></div>
</template>
<script>
import { bar } from '@/helpers/utils';
</script>
@qoomon
qoomon / conventional_commit_messages.md
Last active May 20, 2024 03:57
Conventional Commit Messages

Conventional Commit Messages

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions and generate verion and changelogs

Commit Message Formats

Default

@tanaikech
tanaikech / submit.md
Last active March 20, 2024 04:21
Upload Files to Google Drive using Javascript

Upload Files to Google Drive using Javascript

News

At October 11, 2019, I published a Javascript library to to run the resumable upload for Google Drive. When this is used, the large file can be uploaded. You can also use this js library.

Description

This is a sample script for uploading files to Google Drive using Javascript. The files are uploaded by Drive API v3. gapi.client.drive.files.create() can create an empty file on Google Drive. But it cannot directly upload files including contents. I think that this might not be able to upload files and metadata with the multipart/related, although this might be resolved by the future update. So now, as one of workarounds, I use using XMLHttpRequest.

  • This sample uses gapi.
  • Before you use this, please enable Drive API at API console and carr
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@ziluvatar
ziluvatar / token-generator.js
Last active April 11, 2024 07:10
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jsonwebtoken');
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 19, 2024 21:02
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@jeffersfp
jeffersfp / fix.sh
Created September 14, 2016 19:14 — forked from icsaas/fix.sh
dpkg: warning: files list file for package `*****' missing, assuming package has no files currently installed
#!/bin/bash
set -e
# Clean out /var/cache/apt/archives
apt-get clean
# Fill it with all the .debs we need
apt-get --reinstall -dy install $(dpkg --get-selections | grep '[[:space:]]install' | cut -f1)
DIR=$(mktemp -d -t info-XXXXXX)
for deb in /var/cache/apt/archives/*.deb