Skip to content

Instantly share code, notes, and snippets.

View arpit's full-sized avatar

Arpit Mathur arpit

View GitHub Profile
@arpit
arpit / gist:d8457b7e87b71d0ca0e1f410d7b9ff9c
Created July 11, 2024 16:40
Dart code for calendar event creation
import 'package:app_client/shared/models/video_asset_preview.dart';
import 'package:intl/intl.dart';
class CalendarHelpers{
static String _formatDateTime(DateTime dateTime) {
final DateFormat formatter = DateFormat('yyyyMMddTHHmmss');
return '${formatter.format(dateTime)}Z';
}
import 'package:flutter/material.dart';
import 'dart:math' as math;
class DotPainter extends CustomPainter {
final int dotCount;
double outerDotsPositionAngle = 51.42;
{
"name": "Lorem Ipsum 0",
"description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur condimentum feugiat sollicitudin",
"external_url": "https://hypermint.com",
"image": "https://cdn.glitch.global/a23b8c7b-ba8f-40fa-8139-f59e44b54a66/moments-logo.png?v=1664984068978",
"animation_url": null,
"attributes": null
}
@arpit
arpit / indiehackerhome.js
Created February 15, 2022 19:33
A userscript for TamperMonkey that adds a home button to IndieHackers.com
// ==UserScript==
// @name Indiehackers home button
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add Home to IndieHackers.com
// @author Arpit Mathur
// @match https://www.indiehackers.com/*
// @icon https://www.google.com/s2/favicons?domain=indiehackers.com
// @grant none
// ==/UserScript==
@arpit
arpit / google_io_2021.md
Created May 21, 2021 15:58
News from I/O 2021

Google IO

AI:

  • New conversational dialog model LAMDA
  • MUM AI model for Search: Better understanding of queries, learns 75 languages together, 1000x more powerful vs Bert
  • "I’ve hiked Mt. Adams and now want to hike Mt. Fuji next fall, what should I do differently to prepare?"
  • Starline
  • Photos create memories based on object detection
  • Cinematic moments > add frames between images > Apple live photos (which record video)
@arpit
arpit / create_linear_gradiet.dart
Created February 24, 2020 03:22
Creates a linear gradient in Flutter
static LinearGradient getGradient(Color color, double ratio, double sign) {
return LinearGradient(
colors: [
color.withOpacity(ratio * 1.0),
color.withOpacity(ratio * 0.30),
color.withOpacity(ratio * 0.10),
],
stops: [
0.012,
0.012,
@arpit
arpit / flutter.md
Last active May 10, 2020 05:06
Flutter notes

Sizing Widgets:

  • Expanded
  • Flexible
  • LimitedBox <-> ConstrainedBox
  • FittedBox
  • SizedBox

Note: When creating widgets in column / row, if the size is too big (like when presenting in a modal screen) use the attribute: mainAxisSize.min to contain the widget

Use Spacer when you want to create space using a flex property. Use SizedBox when you want to create space using a specific number of logical pixels.

String s = "😀 hello";
s.runes.forEach((int i){
String x = String.fromCharCode(i); // Get emoji as 1 string and now 2 CodePoints
}
@arpit
arpit / dart_snippets.md
Last active July 22, 2019 15:10
Dart snippets

Null check operator ??

String name = person.name ?? "Adam"

Optional ?.

pages[0]?.contributors[0]?.authorDetails?.basicInfo?.firstName ??