Skip to content

Instantly share code, notes, and snippets.

View arpit's full-sized avatar

Arpit Mathur arpit

View GitHub Profile
@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.

@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 / regex.txt
Created June 28, 2017 16:34
Regex for Comcast stuff
(.*?)$
//Note the space at the beginning
^[A-Za-z]+
@arpit
arpit / ml.md
Last active July 25, 2019 01:07
Learning ML
@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 ?? 
String s = "😀 hello";
s.runes.forEach((int i){
String x = String.fromCharCode(i); // Get emoji as 1 string and now 2 CodePoints
}
@arpit
arpit / setInterval.md
Last active September 10, 2018 20:58

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:

@arpit
arpit / http.md
Last active August 15, 2018 21:44
HTTP basics

Basic HTTP

The Client Server Model

The core working of the internet is based on the idea of client / server communication. The client is anything close to the user (a web browser, an app, a terminal with ssh) and a server that can respond to client queries.

Clients can talk to servers via a variety of protocols. The protocols are just a way for the client and server to agree on how to send data back and forth. Its like you and I talking. We can agree that we use English and with a friend of mine I can use Hindi.

Different Client / Server protocols include:

  • HTTP
@arpit
arpit / understanding-word-vectors.ipynb
Created March 2, 2018 15:31 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@arpit
arpit / Ruby_plan.md
Last active June 17, 2018 14:20
Ruby Plan

Skills

  • Follow the Rabbit: Verify the code path
  • Understand the state machine
  • Learn the nomenclature: What exactly is:
    • Class, Method, variable, constant, Module
    • Design Pattern, Algorithm, Data Structure
      • Program = Data Structures + Logic / Code
    • Polymorphism, idempotency
  • How do you learn new ideas? Whats one new idea you learnt this week?
  • Patience, Persistence, Concentration, Communication