Skip to content

Instantly share code, notes, and snippets.

View shameemreza's full-sized avatar
🇧🇩
Problem-Solver | WooCommerce Expert | Customer-First Mindset

Shameem Reza shameemreza

🇧🇩
Problem-Solver | WooCommerce Expert | Customer-First Mindset
View GitHub Profile
@shameemreza
shameemreza / refreshable.swift
Last active June 15, 2021 06:07
refreshable()
struct SomeView: View {
var body: some View {
VStack {
List(1...10) { item in
Text("Item number \(item)")
}
.refreshable {
//enter code to execute during refresh here
}
}
var list = [1, 2, 3];
list.forEach((v) => print(v * 10));
import 'package:meta/meta.dart';
int sum(List<int> list, [int initial = 0]) {
var total = initial;
list.forEach((v) => total += v);
return total;
}
String joinToString(List<String> list,
{@required String separator, String prefix = ", String
suffix = "}) =>
'$prefix${list.join(separator)}$suffix';
WebSocket.connect('ws://demos.kaazing.com/echo').
then((WebSocket webSocket) {
webSocket.listen(print, onError: print);
webSocket.add('hello');
webSocket.add('world');
webSocket.close();
}).catchError(print);
// Example of using the optional() helper
print optional($dessert->name)->category;
// We import the support for this helper
use Illuminate\Support\Str;
// We use the helper
echo($imagename) Str::uuid();
// We get a random identifier
6e358c39-9663-4a1f-b911-4fd6baaa5b1c
@shameemreza
shameemreza / arrhas.php
Created April 7, 2020 00:00
Arr::has()
// We import the support for this Helper
use Illuminate\Support\Arr;
$products = ['drinks' => ['Name' => 'Strawberry Juice', 'price' => '3.60']];
$check = Arr::has($products, 'drinks.name');
// We get true
$check = Arr::has($products, ['drinks.name', 'drinks.price']);
@shameemreza
shameemreza / strslug2.php
Created April 6, 2020 23:53
Str::slug()
$url = Str::slug('Shameem Reza', '+');
// We get the following friendly URL
shameem+reza
@shameemreza
shameemreza / strslug.php
Created April 6, 2020 23:52
Str::slug()
$url = Str::slug('Shameem Reza');
// We get the following friendly URL
gelatina-de-fresa
@shameemreza
shameemreza / blank.php
Created April 6, 2020 23:49
blank() Helper
// We analyze if there are blank or null values
blank('');
blank(' '); //Here we have blank spaces
blank(null);
// If there is a blank value or blank spaces we get 'true'
blank(0);
blank(true);
blank(false);