Skip to content

Instantly share code, notes, and snippets.

View vaibhav93's full-sized avatar

Vaibhav Bansal vaibhav93

  • Amherst, Massachusetts
View GitHub Profile
import 'package:flutter/material.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart';
class WebViewContainer extends StatefulWidget {
final url;
WebViewContainer(this.url);
@override
createState() => _WebViewContainerState();
}
@vaibhav93
vaibhav93 / auto_brightness.py
Last active August 11, 2020 23:16
Adjust brightness when switching to chrome workspace in i3
import i3ipc
import os
SET_BRIGHTNESS = 'xbacklight -set '
GET_BRIGHTNESS = 'xbacklight'
i3 = i3ipc.Connection()
class BrightnessController:
def __init__(self):
self.brightness_map = {}
@vaibhav93
vaibhav93 / install.txt
Created January 13, 2019 06:36
Running freaco
1. Clone code from repo https://github.com/vaibhav93/freaco
2. Install docker for windows/mac/linux
3. Create AWS account (if you need push notification on phone app.
If you dont want push notification, skip step 3 & 4. Backend can run without this too)
4. Use "accessKeyId" and "secretAccessKey" for this AWS account ( to update the file "server/boot/awsconfig.json".
You can google how to get accessKey and secretAccessKey from aws console
@vaibhav93
vaibhav93 / flutter_log.txt
Created December 30, 2018 07:51
Flutter run logs
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
Syncing files to device Android SDK built for x86...
I/flutter (26407): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (26407): The following assertion was thrown during performLayout():
I/flutter (26407): 'package:flutter/src/rendering/viewport.dart': Failed assertion: line 1213 pos 12: 'center.parent ==
@vaibhav93
vaibhav93 / main.dart
Created December 30, 2018 07:49
Flutter CustomScrollView Bug
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@vaibhav93
vaibhav93 / parse.java
Created October 8, 2018 00:31
Get action
while ((line = br.readLine()) != null) {
// process the line.
Pattern pattern = Pattern.compile(".*_([a-zA-Z] )_.*");
Matcher matcher = pattern.matcher(line);
if (matcher.find())
{
// Action = If, Tiger, After, .....
String action = matcher.group(1);
System.out.println(action);
@vaibhav93
vaibhav93 / upadate_payment.json
Last active July 29, 2018 18:31
Update payment
// POST http://admin.pinkcityrickshawcompany.com/v1/users/:user_id/update_payment
// NOTE user_id as params in URL
// NOTE send access-token in request headers
{
"razor_payment_id" : "razr345466"
}
//RESPONSE
{
"createdAt": "2018-07-29T18:15:51.699Z",
@vaibhav93
vaibhav93 / request.json
Last active July 29, 2018 19:12
payment create
// POST http://admin.pinkcityrickshawcompany.com/v1/users/:user_id/create_payment
// NOTE user_id as params in URL
// NOTE send access-token in request headers
{
"customer_name":"Vaibhav Bansal",
"customer_contact":"9911020699",
"customer_email": "[email protected]",
"activity_id": 8,
"activity_name": "Jaipur tour" // Helps avoid join on backend. So please send
"pickup_time": "10:00AM",
@vaibhav93
vaibhav93 / response.json
Created July 28, 2018 18:47
acitvity response
{
"id": 8,
"name": "kdjgkjd",
"longitude": 43.434,
"latitude": 23.4343,
"shortDescription": "k",
"knowMore": "k",
"beforeYouGo": null,
"behindScenes": null,
"duration": null,
var Kafka = require('node-rdkafka');
var producer = require('./producer');
var consumer = new Kafka.KafkaConsumer({
//'debug': 'all',
'metadata.broker.list': 'gc-mskafka1002.pp-devqa-ms-thirdparty.us-central1.gcp.dev.paypalinc.com:9092',
'group.id': 'node-rdkafka-consumer-flow-example',
'enable.auto.commit': false,
'socket.keepalive.enable': true,
'reconnect.backoff.jitter.ms': 500