Skip to content

Instantly share code, notes, and snippets.

View realtebo's full-sized avatar
💭
I may be slow to respond.

Mirko Tebaldi realtebo

💭
I may be slow to respond.
  • Somewhere over the raimbow
  • Ferrara, Italy
View GitHub Profile
@pxpm
pxpm / App\Http\Controllers\UserCrudController
Last active January 20, 2022 17:24
Backpack 4.1 BelongsToMany with pivot data
<?php
namespace App\Http\Controllers;
use Backpack\CRUD\app\Http\Controllers\CrudController;
use Backpack\CRUD\app\Library\CrudPanel\CrudPanelFacade as CRUD;
class UserCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\ListOperation;
@Splode
Splode / Laravel-Scheduler-Windows.md
Last active April 30, 2024 07:26
Laravel Scheduler on Windows

Run Laravel Scheduled Tasks on Windows

The following are instructions for running scheduled tasks defined in a Laravel project on Windows. The Laravel documentation provides instructions for running scheduled tasks using cron jobs on Linux systems. However, cron jobs are not available on Windows. The built-in Windows Task Scheduler can be used to run scheduled tasks instead.

Create a Scheduled Task

  1. Open Task Scheduler
  2. Select Create Task...
  3. Give the task a name and description
  4. To run the task in the background, select Run whether the user is logged on or not and check the Hidden checkbox.
@cristoni
cristoni / service-worker.js
Created November 15, 2018 07:56
Esempio di service worker con workbox per workbox-webpack-plugin
if (workbox) {
console.log(`Yay! Workbox is loaded 🎉`);
// workbox.setConfig({ debug: false });
// workbox.precaching.suppressWarnings();
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerRoute(/^https?.*/, workbox.strategies.networkFirst(), 'GET');
} else {
console.log(`Boo! Workbox didn't load 😬`);
}
@mbrochh
mbrochh / some_test.js
Last active February 8, 2024 13:02
Controlling a Stripe payent popup with Cypress.io
// for this to work you need to set `"chromeWebSecurity": false` in cypress.json
describe('Make Stripe Payment', function() {
before(function() {
cy.visit('http://localhost:3000/en/stripe/checkout/')
Cypress.Cookies.preserveOnce('sessionid')
})
it('should enter credit card details and finalise payment', function() {
cy.get('[data-test="button-FormStripeCart-PayWithCreditCard"]').click()
@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@emmanuelbarturen
emmanuelbarturen / testing mail in droplet with laravel
Created November 3, 2017 23:12
send email from artisan with tinker of laravel
# SSH into droplet
# go to project
$ php artisan tinker
$ Mail::send('errors.401', [], function ($message) { $message->to('emmanuelbarturen@gmail.com')->subject('this works!'); });
# check your mailbox
lxrun /uninstall /full
sc stop lxssmanager
rmdir %localappdata%\lxss /s
@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');
@nolanlawson
nolanlawson / windows_node.md
Created July 27, 2016 14:04
My Windows setup for Node/npm development

My Windows setup for Node/npm development

Quick writeup on how I do Node/npm on Windows.

Instructions

  1. Install Git Bash (i.e. install Git for Windows, use the built-in Bash shell)
  2. Install windows-build-tools. Be sure to run in an elevated prompt in PowerShell (i.e. right click -> "run as administrator")
  3. Install Bash on Ubuntu on Windows
@daredude
daredude / docker-clear.bat
Created June 5, 2016 10:53
delete all docker container and images on windows
@echo off
FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm %%i
FOR /f "tokens=*" %%i IN ('docker images --format "{{.ID}}"') DO docker rmi %%i