Skip to content

Instantly share code, notes, and snippets.

View kasunvimarshana's full-sized avatar

kasun vimarshana kasunvimarshana

View GitHub Profile
@kasunvimarshana
kasunvimarshana / main.py
Created February 5, 2024 11:29 — forked from sirex/main.py
sqlalchemy joins with AS
import sqlalchemy as sa
import sqlparse
metadata = sa.MetaData()
tasks = sa.Table(
'tasks', metadata,
sa.Column('id', sa.Integer, primary_key=True),
sa.Column('bot', sa.String(255), nullable=False),
sa.Column('task', sa.String(255), nullable=False),
@kasunvimarshana
kasunvimarshana / App.js
Created May 23, 2023 05:52 — forked from darryl-davidson/App.js
Example Expo 35 App that registers Background Fetch and Location Updates
import React, { useEffect } from "react";
import { StyleSheet, Text, View } from "react-native";
import * as BackgroundFetch from "expo-background-fetch";
import * as TaskManager from "expo-task-manager";
import * as Permissions from "expo-permissions";
import * as Location from "expo-location";
import { Notifications } from "expo";
import { Button } from "react-native";
const LOCATION_FETCH_TASK = "upload-job-task-with-location";
@kasunvimarshana
kasunvimarshana / README.md
Created April 7, 2023 10:04 — forked from claytonrcarter/README.md
Share named routes between Laravel and Javascript

Share named routes between Laravel and Javascript

This is a 2-part technique to share named routes between Laravel and Javascript. It uses a custom artisan command to export your named routes to JSON, and a Javascript route() helper to lookup the route and fill in any parameters. Written for Laravel 5.3; not tested in 5.4.

Installation

1. Install RouteJson.php

Copy RouteJson.php into your app as app/Console/Commands/RouteJson.php

@kasunvimarshana
kasunvimarshana / StringBladeRenderer.php
Created December 5, 2022 09:16 — forked from n1215/StringBladeRenderer.php
Compile string by Blade template engine.
<?php
declare(strict_types=1);
namespace App\View;
use Illuminate\View\Compilers\BladeCompiler;
use Illuminate\View\Factory;
use Symfony\Component\Debug\Exception\FatalThrowableError;
/**
@kasunvimarshana
kasunvimarshana / EnsureQueueListenerIsRunning.php
Created October 21, 2021 07:50 — forked from ivanvermeyen/EnsureQueueListenerIsRunning.php
Ensure that the Laravel queue listener is running with "php artisan queue:checkup" and restart it if necessary. You can run this automatically with a cron job: http://laravel.com/docs/scheduling
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class EnsureQueueListenerIsRunning extends Command
{
/**
* The name and signature of the console command.
@kasunvimarshana
kasunvimarshana / VideoStream.php
Created November 17, 2020 11:14 — forked from ranacseruet/VideoStream.php
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
if needToAuth then
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
if needToAuth then
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
if needToAuth then
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
@kasunvimarshana
kasunvimarshana / AuthServiceProvider.php
Created July 18, 2019 06:20 — forked from gbuckingham89/AuthServiceProvider.php
Blog: Laravel Authentication Customer User Provider Demo
<?php
namespace App\Authentication;
use Auth;
use App\Authentication\UserProvider;
use Illuminate\Support\ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{