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
// 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
// Example of using the optional() helper
print optional($dessert->name)->category;
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);
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';
var list = [1, 2, 3];
list.forEach((v) => print(v * 10));
@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
}
}
struct SomeView: View {
var body: some View {
List {
ForEach(1...10, id: \.self) { item in
Text("Item Number \(item)")
.swipeActions(edge: .leading) {
Button {
//enter button actions here
} label: {
Text("Action Here")
struct Cars: Identifiable {
var id = UUID()
var name: String
}
struct SomeView: View {
@State var searchText: String = ""
@State var cars: [Cars] = [Cars(name: "Nissan"), Cars(name: "Mercedes"), Cars(name: "BMW")]
var body: some View {
NavigationView {
List($cars) { $car in
define( 'WP_POST_REVISIONS', false );
define( 'WP_POST_REVISIONS', 3 );