Skip to content

Instantly share code, notes, and snippets.

View msonowal's full-sized avatar
I zapp it.

Manash Sonowal msonowal

I zapp it.
View GitHub Profile
@wobsoriano
wobsoriano / auth.js
Last active February 29, 2024 07:37
nuxtServerInit like implementation for Pinia
import { defineStore } from 'pinia'
export const useAuthStore = defineStore({
id: 'auth',
state: () => ({
isAuthenticated: false,
user: null
}),
actions: {
async nuxtServerInit() {
@reinink
reinink / query.sql
Last active November 14, 2023 11:08
Text search across multiple tables using MySQL
select
first_name,
last_name
from
users
left join
companies on companies.id = users.company_id
where (
companies.name like 'TERM%' or
first_name like 'TERM%' or
@bastienlemaitre
bastienlemaitre / cookie-server.service.ts
Created June 20, 2019 09:20
ngx-cookie-service for Angular Universal
<?php
namespace App\Libraries\Queue;
use Illuminate\Events\Dispatcher;
use Illuminate\Queue\DatabaseQueue;
use Illuminate\Support\Str;
use Laravel\Horizon\Events\JobDeleted;
use Laravel\Horizon\Events\JobPushed;
use Laravel\Horizon\Events\JobReleased;
@MetalArend
MetalArend / swarm.yml
Last active April 16, 2024 13:54
Run a GitLab Runner on your Swarm
version: '3.4'
secrets:
# Find your registration token at: "Your project" > "Settings" > "CI/CD" > "Runners settings" > "Specific Runners" (look for registration token)
# Register it as `GITLAB_REGISTRATION_TOKEN`: `docker secret create GITLAB_REGISTRATION_TOKEN YOUR_REGISTRATION_TOKEN`
GITLAB_REGISTRATION_TOKEN:
external: true
# Find your personal access token at: "Your user account" > "Settings" > "Access Tokens" > "Create personal access token" (for api)
# Register it as `GITLAB_PERSONAL_ACCESS_TOKEN`: `docker secret create GITLAB_PERSONAL_ACCESS_TOKEN <YOUR ACCESS TOKEN>`
@dobromir-hristov
dobromir-hristov / PusherService.js
Created May 4, 2018 13:35
Busting SPA chunk cache for active users after a deploy
import Pusher from 'pusher-js'
Pusher.logToConsole = process.env.NODE_ENV === 'development'
export const PusherService = new Pusher(process.env.PUSHER_KEY, {
cluster: 'eu',
encrypted: true
})
@jleonardolemos
jleonardolemos / coverage_for_dusk.php
Created March 31, 2018 23:58
generating code coverage for Laravel Dusk tests
<?php
/**
* This is a tool for help coverage generation on Dusk
* This was based on this article: http://tarunlalwani.com/post/php-code-coverage-web-selenium/
*1. add this file to your laravel tests directory
*2. add the following line to your nginx config:
* fastcgi_param PHP_VALUE "auto_prepend_file=\"/absolute_path/tests/coverage_for_dusk.php\"";
* if you are using apache you can use this line on .htaccess:
* php_value auto_prepend_file "/absolute_path/tests/coverage_for_dusk.php"
*3. Sample test:
@calebporzio
calebporzio / SvgIcon.vue
Created February 19, 2018 19:08
SVG Icon Vue Component
<template>
<div class="inline-block" v-html="require('icon-' + this.icon + '.svg')"></div>
</template>
<style module>
.svg {
fill: currentColor;
height: 1em;
margin-top: -4px;
vertical-align: middle;
/**
* Summernote StripTags
*
* This is a plugin for Summernote (www.summernote.org) WYSIWYG editor.
* To strip unwanted HTML tags and attributes while pasting content in editor.
*
* @author Hitesh Aggarwal, Extenzine
*
*/
@BryanHeath
BryanHeath / scrollTo.md
Last active March 13, 2019 11:26
Laravel Dusk scrollTo Macro
Browser::macro('scrollTo', function($selector) {
    $this->driver->executeScript("$(\"html, body\").animate({scrollTop: $(\"$selector\").offset().top}, 0);");
    return $this;
});