Skip to content

Instantly share code, notes, and snippets.

View mingsai's full-sized avatar
🎯
Focusing

Tommie N. Carter, Jr. mingsai

🎯
Focusing
View GitHub Profile
@mingsai
mingsai / stopwatch_example.dart
Last active May 7, 2020 13:45
Stopwatch Example ( Dependency Injection, multiple listeners for hundredths, seconds, minutes )
import 'package:flutter/material.dart';
import 'dart:async';
class ElapsedTime {
final int hundreds;
final int seconds;
final int minutes;
ElapsedTime({
this.hundreds,
@mingsai
mingsai / scale_route.dart
Last active December 7, 2019 19:13
Scale Route Transition Sample (encapsulates widget)
import 'package:flutter/material.dart';
class ScaleRoute extends PageRouteBuilder {
final Widget widget;
ScaleRoute({this.widget})
: super(
pageBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
return widget;
},
transitionsBuilder: (BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
return new ScaleTransition(
@ponnamkarthik
ponnamkarthik / bloc_provider.dart
Created September 16, 2019 05:43
Flutter Bloc Provider
/**
* Copyright (c) Foodie Labs, Inc - All Rights Reserved
*
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Karthik Ponnam for Foodie Labs, Inc , April 2019.
*/
// Generic Interface for all BLoCs
import 'package:flutter/material.dart';
# Image / Video Picker — Flutter
Hello All Flutter Developers
All of you know that flutter 1.9 has release and supports many new widgets. To know more what added [release notes here](https://github.com/flutter/flutter/wiki/Release-Notes-Flutter-1.9.1)
Today we are gonna see how to use `image_picker` plugin to get Image & Video file from Gallery & Camera
Here how it the flow will
1) Add `image_picker` plugin in `pubspec.yaml`
@phpfiddle
phpfiddle / fiddle_085440.php
Created July 17, 2019 16:37
[ Posted by Tommie C ] Convert PHP object to array using JSON methods
<?php
$nested_object = new stdClass;
$nested_object->apple = "apple value";
$nested_object->orange = "orange value";
$nested_object->grape = "grape value";
$nested_object->pear = "pear value";
$array = json_decode(json_encode($nested_object), true);
var_dump($nested_object, "object converted to array using json methods" , $array);
?>
@timothycosta
timothycosta / UIViewController+SwiftUI.swift
Last active April 28, 2023 07:00
Using UIViewController via the SwiftUI Environment
struct ViewControllerHolder {
weak var value: UIViewController?
init(_ value: UIViewController?) {
self.value = value
}
}
struct ViewControllerKey: EnvironmentKey {
static var defaultValue: ViewControllerHolder { return ViewControllerHolder(UIApplication.shared.windows.first?.rootViewController ) }
@ponnamkarthik
ponnamkarthik / auto_resize_webview.dart
Created June 5, 2019 04:07
Flutter auto resize webview based on its content
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
do {
  let appPList = try PListFile<InfoPList>()
 
  // then read values
  let url = appPList.data.configuration.url // it’s an URL
} catch let err {
  print(“Failed to parse data: \(err)”)
}
@kharrison
kharrison / RSSFeed.swift
Last active September 1, 2021 01:59
Swift Decodable With Multiple Custom Dates
import Foundation
extension DateFormatter {
static let iso8601Full: DateFormatter = {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ"
formatter.calendar = Calendar(identifier: .iso8601)
formatter.timeZone = TimeZone(secondsFromGMT: 0)
formatter.locale = Locale(identifier: "en_US_POSIX")
return formatter
@esimonetti
esimonetti / repair.php
Last active November 20, 2023 13:17
Sugar CLI Repair - Instance as script argument - USE TOOTHPASTE INSTEAD! https://github.com/esimonetti/toothpaste
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2017-11-01 on Sugar 7.9.2.0
function usage($error = '') {
if (!empty($error)) print(PHP_EOL . 'Error: ' . $error . PHP_EOL);
print(' php ' . __FILE__ . ' --instance /full/path' . PHP_EOL);