Skip to content

Instantly share code, notes, and snippets.

Avatar

Venkat Dinavahi venkatd

View GitHub Profile
@venkatd
venkatd / index.js
Created Sep 22, 2020
Netlify plugin for Flutter
View index.js
// @ts-check
const fs = require('fs')
const url = require('url')
const path = require('path')
const { promisify } = require('util')
const exists = promisify(fs.exists)
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile)
View composition-challenges.md

Composition challenges

  • State management
    • pending messages
    • file upload progress
    • replacing the initState logic in ChatScreen
  • Reusing screens
    • Time entry edit vs. create time entry
    • popping screen returns value?
View watch
#!/bin/bash
OUTPUT_PATH=${1:-~/bin/tdev}
echo "Compiling $PWD to $OUTPUT_PATH whenever a *.go file changes..."
fswatch -e “.*” -i “\\.go$” . | xargs -n1 -I{} go build -v -o $OUTPUT_PATH
View minty.ex
defmodule Minty do
defmodule Response do
defstruct [:status, :headers, :data]
end
def request(method, url, opts \\ []) do
%{scheme: scheme, host: host, port: port, path: path} = URI.parse(url)
payload = Keyword.get(opts, :payload)
headers = Keyword.get(opts, :headers, [])
View play.dart
import 'dart:io';
Future<void> startPlayServer(int port) async {
HttpServer server = await HttpServer.bind(
InternetAddress.loopbackIPv4,
port,
);
await for (var request in server) {
_handleRequest(request);
}
View crawl.go
type linkCollector func(page crawler.Page) []string
func crawl(client crawler.Client, startPageURL string, collect linkCollector, maxConcurrency int) {
concurrencyLimiter := make(chan struct{}, maxConcurrency)
var wg sync.WaitGroup
for i := 0; i < maxConcurrency; i++ {
concurrencyLimiter <- struct{}{}
}
wg.Add(1)
View components.button-ui.js
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'button',
click(e) {
alert('yo')
if(this.get('action')){
this.get('action')(this.get('params'));
}
}
View components.task-tree.js
import Ember from 'ember';
export default Ember.Component.extend({
isExpanded: false,
isExpandedAtFirst: false,
init() {
this._super(...arguments)
this.set('isExpanded', this.get('isExpandedAtFirst'))
},
View pghero-setup.md

Setting up pghero

Install docker for Mac

https://www.docker.com/docker-mac

Install pghero

Run the following commands

localip=$(ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\  -f2)
dburl=postgres://venkat@docker.local:5432/turtle_dev
View gisty.txt
0x1E65F71b024937b988fdba09814d60049e0Fc59d
You can’t perform that action at this time.