Skip to content

Instantly share code, notes, and snippets.

View patrikengborg's full-sized avatar

Patrik Engborg patrikengborg

  • Stockholm, Sweden
View GitHub Profile
async login({ response, auth, request }) {
const { email, password } = request.all()
const data = await auth.attempt(email, password)
if (data.token) {
return response.cookie('token', data.token, {
domain: 'mydomain.com',
httpOnly: true,
secure: true,
sameSite: 'Lax',
export default class AppDelegate extends UIResponder { // eslint-disable-line
applicationPerformFetchWithCompletionHandler(application, completionHandler) {
console.log('App is running in background')
// Check for new data
const newData = true
// If new data exists, initiate a local notification
if (newData) {
// Let the OS know that there were new data and complete the task
@patrikengborg
patrikengborg / tailwind-rtl.js
Last active February 4, 2022 20:26
Function for Tailwind to add a custom variant plugin for RTL sites.
function ({ addVariant }) {
addVariant('rtl', ({ modifySelectors, separator }) => {
modifySelectors(({ className }) => {
return `[dir="rtl"] .rtl${separator}${className}`
})
})
}