Skip to content

Instantly share code, notes, and snippets.

Avatar

Arpit Mathur arpit

View GitHub Profile
@arpit
arpit / indiehackerhome.js
Created Feb 15, 2022
A userscript for TamperMonkey that adds a home button to IndieHackers.com
View indiehackerhome.js
// ==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
News from I/O 2021
View google_io_2021.md

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 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: [
0.012,
0.012,
@arpit
arpit / flutter.md
Last active May 10, 2020
Flutter notes
View flutter.md

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
arpit / dart_snippets.md
Last active Jul 22, 2019
Dart snippets
View dart_snippets.md

Null check operator ??

String name = person.name ?? "Adam"

Optional ?.

pages[0]?.contributors[0]?.authorDetails?.basicInfo?.firstName ?? 
@arpit
arpit / ml.md
Last active Jul 25, 2019
Learning ML
View ml.md
View design.md
View setInterval.md

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: