Skip to content

Instantly share code, notes, and snippets.


Arpit Mathur arpit

View GitHub Profile
arpit / indiehackerhome.js
Created Feb 15, 2022
A userscript for TamperMonkey that adds a home button to
View indiehackerhome.js
// ==UserScript==
// @name Indiehackers home button
// @namespace
// @version 0.1
// @description Add Home to
// @author Arpit Mathur
// @match*
// @icon
// @grant none
// ==/UserScript==
arpit /
Created May 21, 2021
News from I/O 2021

Google IO


  • 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 / create_linear_gradiet.dart
Created Feb 24, 2020
Creates a linear gradient in Flutter
View create_linear_gradiet.dart
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: [
arpit /
Last active May 10, 2020
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.

View emoji.dart
String s = "😀 hello";
s.runes.forEach((int i){
String x = String.fromCharCode(i); // Get emoji as 1 string and now 2 CodePoints
arpit /
Last active Jul 22, 2019
Dart snippets

Null check operator ??

String name = ?? "Adam"

Optional ?.

pages[0]?.contributors[0]?.authorDetails?.basicInfo?.firstName ?? 
arpit /
Last active Jul 25, 2019
Learning ML

setInterval and clearInterval are top level functions part of JavaScript

What does that mean?

Basically these functions are defined by the window object. You can either call this function like window.setInterval( ... ) or just setInterval( ... )

setinterval is used to call any function again and again every few milliseconds.

It takes 2 parameters: the function to call periodically and what the duration between the calls is. So for example: