1679048280
The plugin help you to swip rating bar using double value(like : 0.1 , 0,5, 1)
#example
Rating(functionUpdateRating: (value){},
iterativeValue: 1,
initialRating: 0,
isVertical: Axis.horizontal,
itemSize: 5,
);
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
channel: stable
project_type: package
Author: hisham-safade
Source code: https://github.com/hisham-safade/rating_bar_swipe
License: MIT license
1678885044
Привет, друзья,
В этом кратком примере давайте посмотрим, как сладкое предупреждение подтверждает удаление примера laravel 10. Вы узнаете сладкое предупреждение laravel 10, затем я приведу простой пример с решением. это простой пример сладкого оповещения cdn для отображения окна подтверждения перед удалением любой строки из файла блейд-сервера laravel. в этой статье подробно рассказывается о сладком окне предупреждения laravel 10 с использованием удаления данных в таблице.
В этом примере мы узнаем, как открыть приятное предупреждение перед удалением пользователя в приложении laravel 10. Я покажу jquery-плагин сладкого оповещения, использующий удаление в laravel 10. Я покажу простой пример сладкого оповещения перед удалением пользователя в laravel 10.
Давайте удалим метод с Sweet Alert в Laravel 10, Laravel 9, Laravel 8, Laravel 7 простым способом шаг за шагом с нуля.
Шаг 1: Загрузите Laravel
Давайте начнем урок с установки нового приложения laravel. если вы уже создали проект, пропустите следующий шаг.
composer create-project laravel/laravel example-app
Шаг 2. Добавьте фиктивных пользователей
На этом шаге нам нужно добавить несколько фиктивных пользователей, используя factory.
php artisan tinker
User::factory()->count(10)->create()
Шаг 3: Добавьте маршрут
На этом этапе нам нужно создать несколько маршрутов для функции добавления в корзину.
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('users', [UserController::class, 'index'])->name('users.index');
Route::delete('users/{id}', [UserController::class, 'delete'])->name('users.delete');
Шаг 4: Добавьте контроллер
На этом шаге нам нужно создать UserController и добавить в этот файл следующий код:
приложение/Http/Контроллеры/UserController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\User;
use DataTables;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$users = User::select("*")->paginate(8);
return view('users', compact('users'))->with('no', 1);
}
/**
* Write code on Method
*
* @return response()
*/
public function delete($id)
{
User::find($id)->delete();
return back();
}
}
Шаг 5: Добавьте файлы Blade
здесь нам нужно создать блейд-файлы для пользователей, продуктов и страницы корзины. поэтому давайте создадим один за другим файлы:
ресурсы/представления/users.blade.php
<!DOCTYPE html>
<html>
<head>
<title>Laravel 10 Sweet Alert Confirm Delete Example - Nicesnippets.com</title>
<meta name="csrf-token" content="{{ csrf_token() }}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/5.0.7/sweetalert2.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h3 class="text-center mt-4 mb-5">Laravel 10 Sweet Alert Confirm Delete Example - Nicesnippets.com</h3>
<table class="table table-bordered table-striped data-table">
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th>Email</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<td>{{ $no++ }}</td>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
<td class="text-center">
<form method="POST" action="{{ route('users.delete', $user->id) }}">
@csrf
<input name="_method" type="hidden" value="DELETE">
<button type="submit" class="btn btn-xs btn-danger btn-flat show-alert-delete-box btn-sm" data-toggle="tooltip" title='Delete'>Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
<script type="text/javascript">
$('.show-alert-delete-box').click(function(event){
var form = $(this).closest("form");
var name = $(this).data("name");
event.preventDefault();
swal({
title: "Are you sure you want to delete this record?",
text: "If you delete this, it will be gone forever.",
icon: "warning",
type: "warning",
buttons: ["Cancel","Yes!"],
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((willDelete) => {
if (willDelete) {
form.submit();
}
});
});
</script>
</body>
</html>
Запустите приложение Laravel:
Все шаги выполнены, теперь вам нужно ввести данную команду и нажать Enter, чтобы запустить приложение laravel:
php artisan serve
Теперь вам нужно открыть веб-браузер, ввести указанный URL-адрес и просмотреть вывод приложения:
localhost:8000/users
Выход:
Я надеюсь, что это может помочь вам...
Оригинальный источник статьи: https://www.nicesnippets.com/
1678881300
嗨朋友们,
在这个快速示例中,让我们看看 sweet alert 确认删除示例 laravel 10。您将学习 laravel 10 sweet alert 然后我将给出一个简单的示例和解决方案。这是甜蜜警报 cdn 的简单示例,用于在从 laravel blade 文件中删除任何行之前显示确认框警报。本文详细介绍了使用表中数据删除的 laravel 10 甜蜜警报框。
在这个例子中,我们将学习如何在 laravel 10 应用程序中删除用户之前打开一个甜蜜的警报。我将展示在 laravel 10 中使用 delete 的 sweet alert jquery 插件。我将在 laravel 10 中删除用户之前展示一个简单的 sweet alert 示例。
让我们从头开始逐步在 Laravel 10、Laravel 9、Laravel 8、Laravel 7 中使用 Sweet Alert 删除方法。
第 1 步:下载 Laravel
让我们通过安装一个新的 Laravel 应用程序开始本教程。如果您已经创建了项目,则跳过以下步骤。
composer create-project laravel/laravel example-app
第 2 步:添加虚拟用户
在这一步中,我们需要使用工厂创建添加一些虚拟用户。
php artisan tinker
User::factory()->count(10)->create()
第 3 步:添加路线
在这一步中,我们需要创建一些用于添加到购物车功能的路线。
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('users', [UserController::class, 'index'])->name('users.index');
Route::delete('users/{id}', [UserController::class, 'delete'])->name('users.delete');
第 4 步:添加控制器
在此步骤中,我们需要创建 UserController 并在该文件中添加以下代码:
应用程序/Http/Controllers/UserController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\User;
use DataTables;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$users = User::select("*")->paginate(8);
return view('users', compact('users'))->with('no', 1);
}
/**
* Write code on Method
*
* @return response()
*/
public function delete($id)
{
User::find($id)->delete();
return back();
}
}
第 5 步:添加刀片文件
在这里,我们需要为用户、产品和购物车页面创建刀片文件。所以让我们一个一个地创建文件:
资源/视图/users.blade.php
<!DOCTYPE html>
<html>
<head>
<title>Laravel 10 Sweet Alert Confirm Delete Example - Nicesnippets.com</title>
<meta name="csrf-token" content="{{ csrf_token() }}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/5.0.7/sweetalert2.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h3 class="text-center mt-4 mb-5">Laravel 10 Sweet Alert Confirm Delete Example - Nicesnippets.com</h3>
<table class="table table-bordered table-striped data-table">
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th>Email</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<td>{{ $no++ }}</td>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
<td class="text-center">
<form method="POST" action="{{ route('users.delete', $user->id) }}">
@csrf
<input name="_method" type="hidden" value="DELETE">
<button type="submit" class="btn btn-xs btn-danger btn-flat show-alert-delete-box btn-sm" data-toggle="tooltip" title='Delete'>Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
<script type="text/javascript">
$('.show-alert-delete-box').click(function(event){
var form = $(this).closest("form");
var name = $(this).data("name");
event.preventDefault();
swal({
title: "Are you sure you want to delete this record?",
text: "If you delete this, it will be gone forever.",
icon: "warning",
type: "warning",
buttons: ["Cancel","Yes!"],
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((willDelete) => {
if (willDelete) {
form.submit();
}
});
});
</script>
</body>
</html>
运行 Laravel 应用程序:
所有步骤都已完成,现在您必须键入给定的命令并按回车键来运行 laravel 应用程序:
php artisan serve
现在,您必须打开 Web 浏览器,输入给定的 URL 并查看应用程序输出:
localhost:8000/users
输出:
我希望它可以帮助你...
文章原文出处:https: //www.nicesnippets.com/
1678870163
Hi friends,
In this quick example, let's see sweet alert confirm delete example laravel 10. you'll learn laravel 10 sweet alert then i will give a simple example with solution. it's simple example of sweet alert cdn to showing confirm box alert before deleting any row from laravel blade file. this article goes in detailed on laravel 10 sweet alert box using data delete in table.
In this example, we will learn how to open a sweet alert before deleting a user in laravel 10 application. I will show the sweet alert jquery plugin using delete in laravel 10. I will show an easy example of a sweet alert before deleting the user in laravel 10.
Let’s Delete method with Sweet Alert in Laravel 10, Laravel 9, Laravel 8, Laravel 7 easy way step by step from scratch.
Step 1: Download Laravel
Let us begin the tutorial by installing a new laravel application. if you have already created the project, then skip following step.
composer create-project laravel/laravel example-app
Step 2: Add Dummy Users
In this step, we need to create add some dummy users using factory.
php artisan tinker
User::factory()->count(10)->create()
Step 3: Add Route
In this is step we need to create some routes for add to cart function.
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('users', [UserController::class, 'index'])->name('users.index');
Route::delete('users/{id}', [UserController::class, 'delete'])->name('users.delete');
Step 4: Add Controller
In this step, we need to create UserController and add following code on that file:
app/Http/Controllers/UserController.php
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\User;
use DataTables;
class UserController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$users = User::select("*")->paginate(8);
return view('users', compact('users'))->with('no', 1);
}
/**
* Write code on Method
*
* @return response()
*/
public function delete($id)
{
User::find($id)->delete();
return back();
}
}
Step 5: Add Blade Files
here, we need to create blade files for users, products and cart page. so let's create one by one files:
resources/views/users.blade.php
<!DOCTYPE html>
<html>
<head>
<title>Laravel 10 Sweet Alert Confirm Delete Example - Nicesnippets.com</title>
<meta name="csrf-token" content="{{ csrf_token() }}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/5.0.7/sweetalert2.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h3 class="text-center mt-4 mb-5">Laravel 10 Sweet Alert Confirm Delete Example - Nicesnippets.com</h3>
<table class="table table-bordered table-striped data-table">
<thead>
<tr>
<th>No</th>
<th>Name</th>
<th>Email</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
@foreach($users as $user)
<tr>
<td>{{ $no++ }}</td>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
<td class="text-center">
<form method="POST" action="{{ route('users.delete', $user->id) }}">
@csrf
<input name="_method" type="hidden" value="DELETE">
<button type="submit" class="btn btn-xs btn-danger btn-flat show-alert-delete-box btn-sm" data-toggle="tooltip" title='Delete'>Delete</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>
<script type="text/javascript">
$('.show-alert-delete-box').click(function(event){
var form = $(this).closest("form");
var name = $(this).data("name");
event.preventDefault();
swal({
title: "Are you sure you want to delete this record?",
text: "If you delete this, it will be gone forever.",
icon: "warning",
type: "warning",
buttons: ["Cancel","Yes!"],
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((willDelete) => {
if (willDelete) {
form.submit();
}
});
});
</script>
</body>
</html>
Run Laravel App:
All steps have been done, now you have to type the given command and hit enter to run the laravel app:
php artisan serve
Now, you have to open web browser, type the given URL and view the app output:
localhost:8000/users
Output:
I hope it can help you...
Original article source at: https://www.nicesnippets.com/
1677902940
This is an example pet name generator app used in the OpenAI API quickstart tutorial. It uses the Flask web framework. Check out the tutorial or follow the instructions below to get set up.
If you don’t have Python installed, install it from here
Clone this repository
Navigate into the project directory
$ cd openai-quickstart-python
Create a new virtual environment
$ python -m venv venv
$ . venv/bin/activate
Install the requirements
$ pip install -r requirements.txt
Make a copy of the example environment variables file
$ cp .env.example .env
Add your API key to the newly created .env
file
Run the app
$ flask run
You should now be able to access the app at http://localhost:5000! For the full context behind this example app, check out the tutorial.
Author: openai
Source Code: https://github.com/openai/openai-quickstart-python
License:
1677866220
Online meeting app like google meet, build with flutter for all platforms. this app uses WebRTC for media real-time communication, and socket.io for signaling & messaging. Server running on nodejs with SFU method.
Features
Tested platform status
#SS AppsDesktop-windows
#How to use
create dotenv file
MEDIA_SERVER_HOST = "localhost:5000"
ALLOW_TURN_SERVER = "false"
TURN_SERVER_HOST = "turn:ip:port" #example: "turn:192.168.1.9:3478"
TURN_SERVER_USERNAME = "" #exampe: "zomie"
TURN_SERVER_PASSWORD = "" #example: "password"
android config
build
run debug
#Flutter info
compileSdkVersion 33
minSdkVersion 23
targetSdkVersion 33
Note
WebRTC
Socket io
- server(nodejs): "socket.io": "^2.4.1"
- client(flutter): socket_io_client: ^1.0.1 | ^1.0.2
- server(nodejs): "socket.io": "^4.5.3"
- client(flutter): socket_io_client: ^2.0.0
References
Socket Io
WebRTC
Flutter Code
Author: Mamena2020
Source code: https://github.com/Mamena2020/zomie-app
License: MIT license
1677735900
Functions and algorithms implemented purely with TypeScript's type system
TypeScript's type system lets us catch bugs and errors in our code as we write it, instead of later on when the code runs. But... that's the obvious way to use the type system... 😜
This project attempts to push TypeScript's type system to its limits by actually implementing various functions and algorithms, purely on top of the type system.
Every implementation includes comments describing in detail what's going on. Some functions and algorithms use creative (and sometimes not officially supported) solutions to overcome some limitations of the type system.
☝ Please note that this project is meant to be used for fun and learning purposes and not for practical use.
Start by installing dependencies:
$ yarn
Open a file of any function or algorithm and hover over the types to see the results of "running" that function with some input (try hovering the resulting type).
You can also run tests (written with tsd) with:
$ yarn test
Math:
Lists
n
elements dropped from the beginning.n
elements taken from the beginning.Sorting
Utility
Puzzles
Author: Ronami
Source Code: https://github.com/ronami/meta-typing
License: MIT license
1677668905
Mocking library for TypeScript inspired by http://mockito.org/
mock
) (also abstract classes) #examplespy
) #examplewhen
) via:verify
)reset
, resetCalls
) #example, #examplecapture
) #example'Expected "convertNumberToString(strictEqual(3))" to be called 2 time(s). But has been called 1 time(s).'
)npm install ts-mockito --save-dev
// Creating mock
let mockedFoo:Foo = mock(Foo);
// Getting instance from mock
let foo:Foo = instance(mockedFoo);
// Using instance in source code
foo.getBar(3);
foo.getBar(5);
// Explicit, readable verification
verify(mockedFoo.getBar(3)).called();
verify(mockedFoo.getBar(anything())).called();
// Creating mock
let mockedFoo:Foo = mock(Foo);
// stub method before execution
when(mockedFoo.getBar(3)).thenReturn('three');
// Getting instance
let foo:Foo = instance(mockedFoo);
// prints three
console.log(foo.getBar(3));
// prints null, because "getBar(999)" was not stubbed
console.log(foo.getBar(999));
// Creating mock
let mockedFoo:Foo = mock(Foo);
// stub getter before execution
when(mockedFoo.sampleGetter).thenReturn('three');
// Getting instance
let foo:Foo = instance(mockedFoo);
// prints three
console.log(foo.sampleGetter);
Syntax is the same as with getter values.
Please note, that stubbing properties that don't have getters only works if Proxy object is available (ES6).
// Creating mock
let mockedFoo:Foo = mock(Foo);
// Getting instance
let foo:Foo = instance(mockedFoo);
// Some calls
foo.getBar(1);
foo.getBar(2);
foo.getBar(2);
foo.getBar(3);
// Call count verification
verify(mockedFoo.getBar(1)).once(); // was called with arg === 1 only once
verify(mockedFoo.getBar(2)).twice(); // was called with arg === 2 exactly two times
verify(mockedFoo.getBar(between(2, 3))).thrice(); // was called with arg between 2-3 exactly three times
verify(mockedFoo.getBar(anyNumber()).times(4); // was called with any number arg exactly four times
verify(mockedFoo.getBar(2)).atLeast(2); // was called with arg === 2 min two times
verify(mockedFoo.getBar(anything())).atMost(4); // was called with any argument max four times
verify(mockedFoo.getBar(4)).never(); // was never called with arg === 4
// Creating mock
let mockedFoo:Foo = mock(Foo);
let mockedBar:Bar = mock(Bar);
// Getting instance
let foo:Foo = instance(mockedFoo);
let bar:Bar = instance(mockedBar);
// Some calls
foo.getBar(1);
bar.getFoo(2);
// Call order verification
verify(mockedFoo.getBar(1)).calledBefore(mockedBar.getFoo(2)); // foo.getBar(1) has been called before bar.getFoo(2)
verify(mockedBar.getFoo(2)).calledAfter(mockedFoo.getBar(1)); // bar.getFoo(2) has been called before foo.getBar(1)
verify(mockedFoo.getBar(1)).calledBefore(mockedBar.getFoo(999999)); // throws error (mockedBar.getFoo(999999) has never been called)
let mockedFoo:Foo = mock(Foo);
when(mockedFoo.getBar(10)).thenThrow(new Error('fatal error'));
let foo:Foo = instance(mockedFoo);
try {
foo.getBar(10);
} catch (error:Error) {
console.log(error.message); // 'fatal error'
}
You can also stub method with your own implementation
let mockedFoo:Foo = mock(Foo);
let foo:Foo = instance(mockedFoo);
when(mockedFoo.sumTwoNumbers(anyNumber(), anyNumber())).thenCall((arg1:number, arg2:number) => {
return arg1 * arg2;
});
// prints '50' because we've changed sum method implementation to multiply!
console.log(foo.sumTwoNumbers(5, 10));
You can also stub method to resolve / reject promise
let mockedFoo:Foo = mock(Foo);
when(mockedFoo.fetchData("a")).thenResolve({id: "a", value: "Hello world"});
when(mockedFoo.fetchData("b")).thenReject(new Error("b does not exist"));
You can reset just mock call counter
// Creating mock
let mockedFoo:Foo = mock(Foo);
// Getting instance
let foo:Foo = instance(mockedFoo);
// Some calls
foo.getBar(1);
foo.getBar(1);
verify(mockedFoo.getBar(1)).twice(); // getBar with arg "1" has been called twice
// Reset mock
resetCalls(mockedFoo);
// Call count verification
verify(mockedFoo.getBar(1)).never(); // has never been called after reset
You can also reset calls of multiple mocks at once resetCalls(firstMock, secondMock, thirdMock)
Or reset mock call counter with all stubs
// Creating mock
let mockedFoo:Foo = mock(Foo);
when(mockedFoo.getBar(1)).thenReturn("one").
// Getting instance
let foo:Foo = instance(mockedFoo);
// Some calls
console.log(foo.getBar(1)); // "one" - as defined in stub
console.log(foo.getBar(1)); // "one" - as defined in stub
verify(mockedFoo.getBar(1)).twice(); // getBar with arg "1" has been called twice
// Reset mock
reset(mockedFoo);
// Call count verification
verify(mockedFoo.getBar(1)).never(); // has never been called after reset
console.log(foo.getBar(1)); // null - previously added stub has been removed
You can also reset multiple mocks at once reset(firstMock, secondMock, thirdMock)
let mockedFoo:Foo = mock(Foo);
let foo:Foo = instance(mockedFoo);
// Call method
foo.sumTwoNumbers(1, 2);
// Check first arg captor values
const [firstArg, secondArg] = capture(mockedFoo.sumTwoNumbers).last();
console.log(firstArg); // prints 1
console.log(secondArg); // prints 2
You can also get other calls using first()
, second()
, byCallIndex(3)
and more...
You can set multiple returning values for same matching values
const mockedFoo:Foo = mock(Foo);
when(mockedFoo.getBar(anyNumber())).thenReturn('one').thenReturn('two').thenReturn('three');
const foo:Foo = instance(mockedFoo);
console.log(foo.getBar(1)); // one
console.log(foo.getBar(1)); // two
console.log(foo.getBar(1)); // three
console.log(foo.getBar(1)); // three - last defined behavior will be repeated infinitely
Another example with specific values
let mockedFoo:Foo = mock(Foo);
when(mockedFoo.getBar(1)).thenReturn('one').thenReturn('another one');
when(mockedFoo.getBar(2)).thenReturn('two');
let foo:Foo = instance(mockedFoo);
console.log(foo.getBar(1)); // one
console.log(foo.getBar(2)); // two
console.log(foo.getBar(1)); // another one
console.log(foo.getBar(1)); // another one - this is last defined behavior for arg '1' so it will be repeated
console.log(foo.getBar(2)); // two
console.log(foo.getBar(2)); // two - this is last defined behavior for arg '2' so it will be repeated
Short notation:
const mockedFoo:Foo = mock(Foo);
// You can specify return values as multiple thenReturn args
when(mockedFoo.getBar(anyNumber())).thenReturn('one', 'two', 'three');
const foo:Foo = instance(mockedFoo);
console.log(foo.getBar(1)); // one
console.log(foo.getBar(1)); // two
console.log(foo.getBar(1)); // three
console.log(foo.getBar(1)); // three - last defined behavior will be repeated infinity
Possible errors:
const mockedFoo:Foo = mock(Foo);
// When multiple matchers, matches same result:
when(mockedFoo.getBar(anyNumber())).thenReturn('one');
when(mockedFoo.getBar(3)).thenReturn('one');
const foo:Foo = instance(mockedFoo);
foo.getBar(3); // MultipleMatchersMatchSameStubError will be thrown, two matchers match same method call
You can mock interfaces too, just instead of passing type to mock
function, set mock
function generic type Mocking interfaces requires Proxy
implementation
let mockedFoo:Foo = mock<FooInterface>(); // instead of mock(FooInterface)
const foo: SampleGeneric<FooInterface> = instance(mockedFoo);
You can mock abstract classes
const mockedFoo: SampleAbstractClass = mock(SampleAbstractClass);
const foo: SampleAbstractClass = instance(mockedFoo);
You can also mock generic classes, but note that generic type is just needed by mock type definition
const mockedFoo: SampleGeneric<SampleInterface> = mock(SampleGeneric);
const foo: SampleGeneric<SampleInterface> = instance(mockedFoo);
You can partially mock an existing instance:
const foo: Foo = new Foo();
const spiedFoo = spy(foo);
when(spiedFoo.getBar(3)).thenReturn('one');
console.log(foo.getBar(3)); // 'one'
console.log(foo.getBaz()); // call to a real method
You can spy on plain objects too:
const foo = { bar: () => 42 };
const spiedFoo = spy(foo);
foo.bar();
console.log(capture(spiedFoo.bar).last()); // [42]
Author: NagRock
Source Code: https://github.com/NagRock/ts-mockito
License: MIT license
1676997546
IEnumerable is an interface in C# representing a collection of elements that can be enumerated. The IEnumerable interface is defined in the System.Collections namespace.
Here are some essential things to know about IEnumerable,
Enumeration
The primary purpose of IEnumerable is to provide a way to enumerate (loop through) a collection of elements. The interface defines a single method, GetEnumerator(), which returns an IEnumerator object that allows you to iterate over the collection.
Lazy Evaluation
IEnumerable supports lazy evaluation, which means that the collection elements are not computed until they are actually needed. This can improve performance by avoiding unnecessary computations.
LINQ
In C #, IEnumerable is an integral part of the LINQ (Language-Integrated Query) system. Many LINQ operators, such as Where, Select, and OrderBy operate on IEnumerable objects.
Extension Methods
The IEnumerable interface includes a set of extension methods that make it easier to work with collections in C#. These methods include ToList(), ToArray(), Count(), First(), Last(), and many others.
Here is an example of using IEnumerable in C#,
using System;
using System.Collections;
using System.Collections.Generic;
namespace IEnumerableExample
{
class Program
{
static void Main(string[] args)
{
// Create a List of strings
List<string> fruits = new List<string>();
fruits.Add("Apple");
fruits.Add("Banana");
fruits.Add("Cherry");
fruits.Add("Date");
fruits.Add("Elderberry");
// Iterate over the List using a foreach loop
foreach (string fruit in fruits)
{
Console.WriteLine(fruit);
}
// Iterate over the List using an IEnumerator object
IEnumerator enumerator = fruits.GetEnumerator();
while (enumerator.MoveNext())
{
string fruit = (string)enumerator.Current;
Console.WriteLine(fruit);
}
// Use LINQ to query the List
IEnumerable<string> query = fruits.Where(fruit => fruit.Length > 5);
foreach (string fruit in query)
{
Console.WriteLine(fruit);
}
}
}
}
In this example, we create a List<string> object called fruits that contains five different fruits. We then demonstrate three different ways to iterate over the elements of the collection:
Using a foreach loop
We use a foreach loop to iterate over the fruits list and print each element to the console.
Using an IEnumerator object
We create an IEnumerator object by calling the GetEnumerator() method on the fruits list and then use a while loop to iterate over the elements of the collection and print each one to the console.
Using LINQ
We use LINQ to query the fruits list and create a new IEnumerable<string> object called query that contains only the fruits with more than 5 characters in their name. We then use a foreach loop to iterate over the elements of the query and print each one to the console.
Note that the IEnumerable interface provides a powerful way to work with data collections in C# and is an integral part of the language's support for LINQ and other data manipulation tools.
Original article source at: https://www.c-sharpcorner.com/
1675918920
As a marketer, you have a lot of things on your plate and can’t manage everything on your own. Moreover, some tasks are just not possible or practical to manage manually. At some point, you’re going to need to work with other businesses that offer tools or services to help you do your job more efficiently. That’s where a request for proposal comes in, enabling you to attract prospective vendors who can help you achieve your business goals.
If you’ve never written a request for proposal (RFP) before, you may not know how to get started or what you need to include. The good news is, we’re here to help. This guide walks you through the process of writing a successful request for proposal that drives responses from the most viable vendors. Let’s dive right in.
A request for proposal or RFP is a document that provides a list of requirements that vendors need to meet to complete a project. Typically sent out by businesses that need to find the right technology solution or professional service, it serves as an open invitation for vendors to submit their proposals. This enables them to attract potential vendors who can provide them with the tools they need or to whom they can outsource some of their work.
It's crucial to get your request for proposal right because it details all the criteria that vendors must meet in order to win the bid. As such, it enables you to collect proposals from the most relevant vendors, making it easier to decide on the right one for your business.
So, if a request for proposal is so important, how do you write one? Check out the steps below to start writing your very own request for proposal.
Start with a clear definition of what the project is and understand the role that the vendor will play in it. In other words, have a proper idea of what you need from the vendor before you can write your request for proposal. Discuss what you need the vendor to do, how it should be done, and how long it should ideally take to be completed.
Additionally, you’d also need to talk about how much you’re willing to spend for the service or platform. This provides you with a solid foundation for your RFP as you clearly know what you’re looking for.
Now that you have a clear idea of what you’re looking for, it’s time to write an introduction explaining your project and expectations. The introduction should be able to help potential vendors understand the purpose of your RFP and what they need to help you achieve. This would also be a good opportunity to explain if you’re facing any challenges and how the vendor can help you overcome them.
Besides these basics, you may also want to include additional information about your project. This may be details such as when you intend to start the project and how long it will run. The introduction should help potential vendors get a better idea of your needs so they can assess their ability to meet them.
Next, it’s time to introduce your company to the vendors. Give them a brief history of your company and what you do as well as the project you’re undertaking. Talk about your brand values, history, and other important background information. This information should be able to help vendors understand your market and where your business currently stands.
Keep in mind that many of the potential vendors may have never heard of your company before. Make it easy for them to make an informed decision by giving them a sense of who you are as a brand. They can then use this information to assess whether they’re the right fit for your needs and whether they’d want to work with you.
Now comes the most important part where you describe exactly what you need in a vendor. Provide specific details about the services or solutions that you’re looking for to help you achieve your goal. Be sure to include details such as the level of experience you’re looking for (in the case of service solutions). For software solutions, you may also want to include details such as the level of access you need based on your team size.
It’s important to get as specific as possible in this section so potential vendors can know if they’re offering the solution you need. This will help them decide if they should send in a proposal or not, allowing you to instantly filter your options to get proposals from the most suitable prospects.
For example, if you’re looking for a social media marketing agency, you may be in need of an agency that can take care of content planning, production, and scheduling. Additionally, you may even need them to manage your community on your behalf. In this case, an agency that doesn’t offer community management may opt to avoid sending in a bid, so you don’t need to waste your time reviewing their proposal.
Alternatively, let’s say you’re looking for a social media management tool for a team of three. And you want to be able to plan your content, schedule your posts, monitor your comments, and analyze results all in one place. That way, only those vendors who can meet the above requirements will send in a proposal for you to review so you’re instantly filtering your options.
Vendors who plan on sending in a proposal should know how to respond to your request for proposal. Make sure you’re providing clear instructions on the structure they should follow in their proposal as well as what they need to include. When all the proposals are formatted in a similar way, it becomes easier for you to process the information and evaluate them.
For example, you may require them to include a certain number of headings. Or you may even request them to provide a list of points under each heading. Additionally, you may also ask them to send in samples of their previous work, case studies, and demos to better evaluate their quality of work or platform capabilities.
It’s also important that you include a detailed list of the criteria using which you’ll be evaluating the proposals. This gives vendors an idea of how they’ll be evaluated so they can understand their chances of winning the bid. As such, only the most qualified vendors will respond to your request for proposal, making it easier for you to sort through your options.
Provide details about your priorities, basic requirements, and preferences so vendors know exactly what you’re looking for and how to position their offerings. For example, you may prioritize agencies that specialize in content production beyond their marketing services. The basic requirements could be the ability to plan and execute social media marketing campaigns, while you may prefer agencies that have experience working with companies in a certain industry.
Additionally, it’s crucial for everyone involved to know your target timeline. When do you expect to receive the responses? When will the selected vendor be announced? Make sure to include these key deadlines so vendors don’t have to keep reaching out to you for updates when you haven’t made your selection.
Besides these, you’d also want to include your project start time and end time. Knowing these timelines will allow vendors to plan their schedules and assess their availability before they choose to respond. This benefits both parties because you don’t want to end up working with a vendor who’d eventually not be able to help you meet the deadline. Also, vendors will be able to understand whether they can fit your project in considering their current workload.
This is particularly important for RFPs that are seeking service solutions. Keep in mind that depending on how detailed your requirements are, you’ll need to adjust your timeline accordingly. If vendors have to provide a highly detailed proposal, they may require more time to plan their response.
Now that you’ve written down all the crucial information, it’s time to proofread your request for proposal. Look for spelling mistakes and grammatical errors as well as complicated sentences that may be difficult to understand. You want to come across as professional and trustworthy while avoiding any chances of miscommunication.
Besides the basics, make sure you’re on the lookout for mistakes that could be detrimental to your project’s timeline. For instance, a typo in your deadline could result in you losing out on potential vendors because they couldn’t meet it or a huge delay in receiving your proposals. Alternatively, a missing 0 in your project budget could mean losing out on potential vendors who declined to bid because the pay was too low.
Make any necessary revisions and give the RFP a once-over to ensure that it’s professional and clear. You’ll then be able to finally go live with your request for proposal.
In addition to simply following the steps above, there’s a certain way to make sure that your RFP gets the responses it deserves. Follow these best practices to write an effective request for proposal.
To avoid the chances of miscommunication, make sure you use language that’s understandable to your potential vendors. You may want to cut back on the industry jargon and resort to simple English while still keeping it professional. Try to avoid long run-on sentences and instead cut them to shorter, more bite-sized sentences that are easier to process.
Headings and bullet points make your RFP easier to digest compared to large blocks of text. Make the most of them to break up your request for proposal and make it more scannable.
Don’t miss important details that could help potential vendors understand your project and requirements better. Vendors are more likely to respond with the right proposal when they have a clear idea of what you’re looking for and what kind of role they’ll play.
Still not sure what your request for proposal should look like? Let’s take a look at an example of how a typical RFP looks so you can get a better idea.
Request for Proposal: Social Media Services for June’s Vintage
16 December 2022
Issued by: June’s Vintage
Contact Person: June Phillips
j.phillips@junesvintage.com
(445)917-3069
Introduction
June’s Vintage, a retail store that deals in vintage clothing, is accepting proposals to find a reliable agency to manage our social media on our behalf. The purpose is to:
The objective of this request for proposal is to find a social media agency that will provide the best overall value and deliver impressive results. We’re hoping to run a test project for three months after which we may decide on a long-term partnership.
Background
Our vintage business was established in 2007 and has since established a strong customer base throughout Philadelphia. Most of our customers are local fashion enthusiasts roughly between the ages of 25 and 50 and shop in-store. However, as we expand to online shopping channels, there’s an opportunity to extend this reach beyond the local area. This has proved to be challenging as our social media presence is fairly limited and we lack the time and know-how to actively engage our audience on social media.
Project Overview
We would like to be able to consistently post and engage with audiences across three key social media platforms–Instagram, Facebook, and TikTok. As such, we’re looking for an agency that can help us with the following:
Our budget is $2,500 per month with some room for flexibility depending on the level of service that can be provided. Ideally, we would like to employ an agency that has experience working with small retail stores and local businesses.
Submission Guidelines
All proposals must be created using the format below (bulleted lists will be highly appreciated):
Please submit your proposal in .pdf format to j.phillips@junesvintage.com by January 30, 2023.
Evaluation Criteria
June’s Vintage will use the following criteria to evaluate proposals and select the right vendor:
Timeline
June’s Vintage expects to complete the RFP and project according to the following timeline:
Now that you know exactly what a request for proposal looks like and what to include in it, it’s time to write your very own. There are plenty of free templates available online that can help you draft the perfect request for proposal.
Original article source at: https://influencermarketinghub.com/
1665085860
🐘🎯 Hexagonal Architecture, DDD & CQRS in PHP
Example of a PHP application using Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) principles keeping the code as simple as possible.
git clone https://github.com/CodelyTV/php-ddd-example php-ddd-example
cd php-ddd-example
cp .env .env.local
) if you want to modify any parametermake build
make deps
make test
This project tries to be a MOOC (Massive Open Online Course) platform. It's decoupled from any framework, but it has some Symfony and Laravel implementations.
This repository follows the Hexagonal Architecture pattern. Also, it's structured using modules
. With this, we can see that the current structure of a Bounded Context is:
$ tree -L 4 src
src
|-- Mooc // Company subdomain / Bounded Context: Features related to one of the company business lines / products
| `-- Videos // Some Module inside the Mooc context
| |-- Application
| | |-- Create // Inside the application layer all is structured by actions
| | | |-- CreateVideoCommand.php
| | | |-- CreateVideoCommandHandler.php
| | | `-- VideoCreator.php
| | |-- Find
| | |-- Trim
| | `-- Update
| |-- Domain
| | |-- Video.php // The Aggregate of the Module
| | |-- VideoCreatedDomainEvent.php // A Domain Event
| | |-- VideoFinder.php
| | |-- VideoId.php
| | |-- VideoNotFound.php
| | |-- VideoRepository.php // The `Interface` of the repository is inside Domain
| | |-- VideoTitle.php
| | |-- VideoType.php
| | |-- VideoUrl.php
| | `-- Videos.php // A collection of our Aggregate
| `-- Infrastructure // The infrastructure of our module
| |-- DependencyInjection
| `-- Persistence
| `--MySqlVideoRepository.php // An implementation of the repository
`-- Shared // Shared Kernel: Common infrastructure and domain shared between the different Bounded Contexts
|-- Domain
`-- Infrastructure
Our repositories try to be as simple as possible usually only containing 2 methods search
and save
. If we need some query with more filters we use the Specification
pattern also known as Criteria
pattern. So we add a searchByCriteria
method.
You can see an example here and its implementation here.
You can see an example of an aggregate here. All aggregates should extend the AggregateRoot.
There is 1 implementations of the command bus.
The Query Bus uses the Symfony Message Bus.
The Event Bus uses the Symfony Message Bus. The MySql Bus uses a MySql+Pulling as a bus. The RabbitMQ Bus uses RabbitMQ C extension.
Every time a domain event is published it's exported to Prometheus. You can access to the Prometheus panel here.
There are some things missing (add swagger, improve documentation...), feel free to add this if you want! If you want some guidelines feel free to contact us :)
This code was shown in the From framework coupled code to #microservices through #DDD talk and doubts where answered in the DDD y CQRS: Preguntas Frecuentes video.
🎥 Used in the CodelyTV Pro courses:
Author: CodelyTV
Source Code: https://github.com/CodelyTV/php-ddd-example
1664298060
This is alpha, but if you do everything just right you might get some worthwhile output. Thanks so much to @tholman for the underlying Javascript library intense-images. Check out Tim's other library giflinks for a laugh.
As I was working on imageR
, I discovered this poster Redesign of cluster heatmap visualization technique through this tweet. The full-page zoomable is very similar to the effect achieved by imageR
, so imageR
might be a good preview for your next conference poster.
`# devtools::install_github("timelyportfolio/imageR")
library(imageR)
tf <- tempfile()
png( file = tf, height = 400, width = 600 )
plot(1:50)
dev.off()
intense(base64::img(tf))
library(shiny)
library(htmltools)
library(lattice)
library(imageR)
tf <- tempfile()
tf2 <- tempfile()
png( file = tf, height = 400, width = 1600 )
#example from ?lattice::cloud
cloud(Sepal.Length ~ Petal.Length * Petal.Width | Species, data = iris,
screen = list(x = -90, y = 70), distance = .4, zoom = .6)
dev.off()
png( file = tf2, height = 1000, width = 1000)
#### example from http://www.cceb.med.upenn.edu/pages/courses/BSTA670/2012/R_3D_plot_ex.r
#--------------------------------
# persp plot of function
#--------------------------------
x <- seq(-10, 10, length= 30)
y <- x
f <- function(x,y) { r <- sqrt(x^2+y^2); 10 * sin(r)/r }
z <- outer(x, y, f)
z[is.na(z)] <- 1
op <- par(bg = "white")
persp(x, y, z, theta = 30, phi = 30, expand = 0.5, col = "lightblue")
dev.off()
html_print(fluidPage(
tags$h1("Cloud and Wireframe from Lattice")
,fluidRow(style = "height:60%; overflow:hidden;"
,column(width = 6, intense(base64::img(tf)))
,column(width = 6, intense(base64::img(tf2)))
)
))
tf <- tempfile()
png( file = tf, height = 600, width = 1400 )
plot(1:50)
dev.off()
intense(
tags$img(
style = "height:25%;"
,"data-title" = "sample intense plot"
,"data-caption" = "imageR at work"
,src = paste0("data:image/png;base64,",base64enc::base64encode(tf))
)
)
img
Targetlibrary(htmltools)
library(imageR)
library(ggplot2)
tf <- tempfile()
png( file = tf, height = 1400, width = 1400 )
ggplot(diamonds, aes(carat, price)) + geom_hex()
dev.off()
intense(
tags$div(
tags$h1("does this work? click and see")
,"data-image" = paste0("data:image/png;base64,",base64enc::base64encode(tf))
)
)
library(htmltools)
library(curl)
library(navr)
library(sortableR)
library(imageR)
n1 <- navr(
selector = "#sortableR-toolbar"
,taglist = tagList(
tags$ul(id = "sort-navr"
,style="line-height:120px; text-align:center; vertical-align:middle;"
,tags$li(
style="border: solid 0.1em white;border-radius:100%;line-height:inherit;width:130px;height:130px;"
, class="fa fa-binoculars fa-4x"
# attribution everywhere Creative Commons Flickr
# awesome picture by https://www.flickr.com/photos/12859033@N00/2288766662/
, "data-image" = paste0(
"data:image/jpg;base64,"
,base64enc::base64encode(
curl("https://farm4.staticflickr.com/3133/2288766662_c40c168b76_o.jpg","rb")
)
)
, "data-title" = "Binoculars, a working collection"
, "data-caption" = "awesome picture courtesy Flickr Creative Commons
<a href = 'https://www.flickr.com/photos/12859033@N00/2288766662/'>jlcwalker</a>"
)
,tags$li(
style="border: solid 0.1em white;border-radius:100%;line-height:inherit;width:130px;height:130px;"
, class="fa fa-camera fa-4x"
# attribution everywhere Creative Commons Flickr
# awesome picture by https://www.flickr.com/photos/s58y/5607717791
, "data-image" = paste0(
"data:image/jpg;base64,"
,base64enc::base64encode(
curl("https://farm6.staticflickr.com/5309/5607717791_b030229247_o.jpg","rb")
)
)
, "data-title" = "Leica IIIc converted to IIIf BD ST"
, "data-caption" = "awesome picture courtesy Flickr Creative Commons
<a href = 'https://www.flickr.com/photos/s58y/5607717791'>s58y</a>"
)
)
)
)
html_print(tagList(
tags$div(
id = "sortableR-toolbar"
,style="width:300px;border: dashed 0.2em lightgray; float:left;"
,tags$h3("sortableR Icons for Intense Images")
,"These icons drag and drop. Click on them for an"
,tags$strong("intense")
,"result."
)
,add_font_awesome(n1)
,sortableR("sort-navr")
,intense( selector = "#sort-navr li" )
))
Author: Timelyportfolio
Source Code: https://github.com/timelyportfolio/imageR
License: MIT license
1659455820
Intern is a complete test system for JavaScript designed to help you write and run consistent, high-quality test cases for your JavaScript libraries and applications. It can be used to test any JavaScript code.
This repository is a collection of examples of using Intern in web applications. Use these examples as your guide to integrate Intern into your projects! Every example has a README that will guide you through the process of setting it up.
It is based on the TodoMVC Dojo Example.
Install the JRE or JDK. This demo uses Selenium, which requires Java, to run WebDriver tests.
Install node modules
$ npm install
Run unit and functional tests in Chrome
$ npm test
Run unit and functional tests in other browsers
$ npm test config=@firefox
$ npm test config=@ie
Note that the above commands all require that the browser be available on the test system.
This example is based on the React Redux example, running in Electron. It contains two sets of functional tests, one that uses Intern’s built-in WebDriver library, and one that uses Spectron. It also contains unit tests, but these are run in Node rather than Electron as Intern 4.x does not currently support running unit tests in Electron.
Install the JRE or JDK. This demo uses Selenium, which requires Java, to run WebDriver tests.
Install node modules
$ npm install
Build the example
$ npm run build
Unit tests (in Node) and functional tests
$ npm test
On Windows, run
$ npm test config=@windows
WebDriver tests using Spectron
$ npm test config=@spectron
This example is based on the TodoMVC jQuery Example.
Install the JRE or JDK. This demo uses Selenium, which requires Java, to run WebDriver tests.
Install node modules
npm install
To run the unit and functional tests in Chrome:
$ npm test
This example is based on the React Redux example.
Install the JRE or JDK. This demo uses Selenium, which requires Java, to run WebDriver tests.
Install node modules
npm install
Build the example (this is necessary for functional tests to work)
$ npm run build
Unit tests in Node
$ npm test
WebDriver tests
$ npm test webdriver
In the intern.json
file, there are separate browserSuites
and nodeSuites
properties. This is because some of the unit tests don't work in the browser, but all of them will work in Node.
This example uses Intern to test a jQuery + Backbone TodoMVC app written in TypeScript.
Install the JRE or JDK This demo runs with local Selenium, which Intern will automatically install.
Install node modules
npm install
From a browser
npm start
Navigate to http://localhost:9000/__intern/
Using WebDriver
npm test
The npm test
command will run tests in Chrome by default. The test config in this project contains convenience configurations for other browsers as well.
npm test config=@edge
npm test config=@firefox
npm test config=@ie
npm test config=@safari
Install the JRE or JDK. This demo uses Selenium, which requires Java, to run WebDriver tests.
Install grunt-cli
$ npm install -g grunt-cli
Install node modules
$ npm install
Unit tests in Node
$ grunt test
WebDriver tests
$ grunt test:browser
Check the Gruntfile for details. If you haven't used Grunt before, here are some commands that are also available using the Gruntfile in this example:
grunt
runs the default task in the Gruntfile, which is test
in this case.grunt intern:node
will run Intern’s Node executorgrunt intern:webdriver
will run Intern’s WebDriver executor, which will run unit tests in a browserIf you need more information check out the task documentation.
Each of the examples can be switched from running tests locally to using a cloud testing provider by setting the relevant Cloud testing Intern settings within the Intern config for that example.
Install the JRE or JDK This demo runs with local Selenium, which Intern will automatically install.
Install intern command line interface
npm install -g intern-cli
Install node modules and intern
npm install
Local browser tests
intern serve
Navigate to http://localhost:9000/node_modules/intern/client.html?config=tests/intern.js
.
Remote node / browser tests
intern run --webdriver
Install the JRE or JDK This demo runs with local Selenium, which Intern will automatically install.
Install intern command line interface
npm install -g intern-cli
Install node modules and intern
npm install
Local browser tests
intern serve
Navigate to http://localhost:9000/node_modules/intern/client.html?config=tests/intern.js
.
Remote node / browser tests
intern run --webdriver
Install node modules and intern
npm install
Setup tunnelOptions
and capabilities
.
Run tests in parallel
./parallel.sh
.travis.yml
You can find more information on continuous integration with Intern in the wiki.
Intern 4 hasn’t been out for very long yet, so most of these are still based on Intern 3.
We welcome contributions of new examples, or improvements/updates to existing examples. Just fork this repo, add your example to a new branch, and make a PR. Note that like most open source projects, we require everyone to sign a contributor license agreement when making non-trivial PRs.
© SitePen, Inc. and its contributors
Author: Theintern
Source Code: https://github.com/theintern/intern-examples
1658821140
Video SDK Flutter to simply integrate Audio & Video Calling API or Live Video Streaming API to your app with just a few lines of code.
Feature | Android | iOS | Web |
---|---|---|---|
Audio/Video | ✔️ | ✔️ | ⌛ |
Recorder | ✔️ | ✔️ | ⌛ |
RTMP Live | ✔️ | ✔️ | ⌛ |
Simulcast | ✔️ | ✔️ | ⌛ |
Screen Share | ✔️ | ⌛ | ⌛ |
Data Channel | ⌛ | ⌛ | ⌛ |
Add videosdk
as a dependency in your pubspec.yaml file.
Ensure the following permission is present in your Android Manifest file, located in <project root>/android/app/src/main/AndroidManifest.xml
:
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
If you need to use a Bluetooth device, please add:
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
The Flutter project template adds it, so it may already be there.
Also you will need to set your build settings to Java 8, because official WebRTC jar now uses static methods in EglBase
interface. Just add this to your app level build.gradle
:
android {
//...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
If necessary, in the same
build.gradle
you will need to increaseminSdkVersion
ofdefaultConfig
up to23
(currently default Flutter generator set it to16
).
If necessary, in the same
build.gradle
you will need to increasecompileSdkVersion
andtargetSdkVersion
up to31
(currently default Flutter generator set it to30
).
## iOS Setup
Add the following entry to your Info.plist file, located in `<project root>`/ios/Runner/Info.plist:
```xml
<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) Camera Usage!</string>
<key>NSMicrophoneUsageDescription</key>
<string>$(PRODUCT_NAME) Microphone Usage!</string>
This entry allows your app to access camera and microphone.
Now in your Dart code, you can use:
import "package:videosdk/meeting.dart";
import "package:videosdk/meeting_builder.dart";
import "package:videosdk/participant.dart";
import "package:videosdk/rtc.dart";
import "package:videosdk/stream.dart";
Run this command:
With Flutter:
$ flutter pub add videosdk
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
videosdk: ^0.0.14
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:videosdk/rtc.dart';
import 'package:videosdk/utils/constants.dart';
example/lib/main.dart
import 'package:flutter/material.dart';
import 'constants/colors.dart';
import 'navigator_key.dart';
import 'screens/splash_screen.dart';
void main() {
// Run Flutter App
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// Material App
return MaterialApp(
title: 'VideoSDK Flutter Example',
theme: ThemeData.dark().copyWith(
appBarTheme: const AppBarTheme().copyWith(
color: primaryColor,
),
primaryColor: primaryColor,
backgroundColor: secondaryColor,
),
home: const SplashScreen(),
navigatorKey: navigatorKey,
);
}
}
Author: Videosdk-live
Source Code: https://github.com/videosdk-live/videosdk-rtc-flutter-sdk-example
License: BSD-3-Clause
1658322540
Shows how to use the Airpay plugin.
Run this command:
With Flutter:
$ flutter pub add airpay_example
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
airpay_example: ^2.0.0
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:airpay_example/main.dart';
import 'package:airpay_example/screens/home.dart';
import 'package:airpay_example/screens/launch.dart';
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
Original article source at: https://pub.dev/packages/airpay_example