Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/material.dart';
import 'dart:math' show pi;
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
import com.brandongogetap.stickyheaders.exposed.StickyHeader
import com.brandongogetap.stickyheaders.exposed.StickyHeaderHandler
import io.github.luizgrp.sectionedrecyclerviewadapter.SectionedRecyclerViewAdapter
/**
* [SectionedRecyclerViewAdapter] that implements [StickyHeaderHandler].
*/
class StickyHeaderSectionedRecyclerViewAdapter: SectionedRecyclerViewAdapter(), StickyHeaderHandler {
override fun getAdapterData(): List<*> {
@kuyazee
kuyazee / UIDevice+DeviceModel.swift
Last active June 16, 2021 13:35
This will help identify what kind of device a user is using.
import UIKit
public extension UIDevice {
public static var modelCode: String {
if let simulatorModelIdentifier = ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] { return simulatorModelIdentifier }
var systemInfo = utsname()
uname(&systemInfo)
return withUnsafeMutablePointer(to: &systemInfo.machine) {
ptr in String(cString: UnsafeRawPointer(ptr).assumingMemoryBound(to: CChar.self))
}
@andrelsmoraes
andrelsmoraes / bottom_sheet.dart
Created June 22, 2018 21:03
Modal Bottom Sheet with Input Fields fix for Flutter (Fix issue with overlap with keyboard and fix for tapping to dismiss) - Flutter Version: Channel beta, v0.5.1
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@netsmertia
netsmertia / main.dart
Created May 4, 2018 13:53
flutter image drawing in canvas
import 'package:flutter/material.dart';
import 'dart:ui' as ui;
import 'package:flutter/services.dart' show rootBundle;
import 'dart:async';
import 'dart:typed_data';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@swavkulinski
swavkulinski / cupertino_navigation_bar_constructor.dart
Created February 27, 2018 19:10
CupertinoNavigationBar constructor
CupertinoNavigationBar ({
this.leading,
this.middle,
})
@collinjackson
collinjackson / main.dart
Last active August 17, 2023 20:06
PageView example with dots indicator
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
@demixdn
demixdn / EditTextDebounce.java
Created April 24, 2017 09:58
Get text from EditText with debounce without RxJava
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import java.lang.ref.WeakReference;
@vincent284
vincent284 / cocoapods_disable_log.txt
Created December 22, 2016 09:35
[Cocoapods] Disable NSLog in pods
# Only allow NSLog in DEBUG build, for all Pods
# Referenced from https://gist.github.com/krzyzanowskim/7690635
# Pods-environment.h is no longer supported
post_install do | installer |
Dir.glob("#{installer.sandbox.target_support_files_root}/**/*.pch") do |item|
open(item, "a") do |file|
print "[post_install] Updating #{item}\n"
file.puts <<EOF
// Disable logs
#ifndef DEBUG
@davidmerrick
davidmerrick / gist:7f42b4442e6dc3f91dc9
Created December 8, 2015 22:45
Python: check if ports are open on a remote server
import socket;
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex((host,port))
if result == 0:
print "Port is open"
else:
print "Port is not open"