Skip to content

Instantly share code, notes, and snippets.

View aoberoi's full-sized avatar
👷‍♂️
Under construction

Ankur Oberoi aoberoi

👷‍♂️
Under construction
View GitHub Profile
@aoberoi
aoberoi / README.md
Last active June 2, 2023 02:18
How macOS treats Spaces with multiple displays

How macOS treats Spaces with multiple displays

👷‍♀️ Under construction... 🚜

TL;DR: Leave the first space on your monitor empty forever and just have a second space. The empty first space on the monitor will merge with the first space on the laptop when you unplug the monitor. The 2nd through Nth spaces on the external monitor will move onto the laptop with thier windows. When you plug the monitor back in, the 2nd through Nth spaces will move back to the monitor as expected.

@aoberoi
aoberoi / CLA.md
Last active February 18, 2021 15:42
Slack Technologies, Inc. - Individual Contributor License Agreement (CLA)

Slack Individual Contributor License Agreement

Each individual submitting Contributions (as defined below) to Slack Technologies, Inc. (“Slack”) for inclusion in, or documentation of, any of the products owned or managed by Slack (the "Work"), must sign a Contributor License Agreement ("CLA") prior to submitting such Contributions to Slack. This CLA clarifies the intellectual property license You (as defined below) grant to Slack, and is for Your protection as a Contributor as well as the protection of Slack; it does not change Your rights to use Your own Contributions for any other purpose.

You acknowledge and agree that this CLA is in addition to the obligations You have under the MIT license (together, the “Agreement”), and You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Slack. Except for the license granted herein to Slack and recipients of software distributed by Slack, You reserve all right, title, and interest in and to Your Contribu

@aoberoi
aoberoi / CustomVideoCapturer.java
Created June 10, 2014 18:58
Android Custom Video Capturer
package com.opentok.android.demo.video;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import android.content.Context;
import android.graphics.ImageFormat;
import android.graphics.PixelFormat;
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
@aoberoi
aoberoi / example-listener-middleware.js
Last active September 1, 2020 17:27
example of a bolt listener middleware that catches errors in view submission handlers and pushes a view
import { App } from '@slack/bolt';
const app = new App(...);
// a listener middleware.
// could easily be shared. can be refactored into a global middleware too.
function pushViewOnErrors(errorViewTemplate) {
return async function _pushViewOnErrors({ body, client, logger, ack, next }) => {
try {
await next();
const { createServer } = require('http');
const express = require('express');
const bodyParser = require('body-parser');
const { createEventAdapter } = require('@slack/events-api');
const { createMessageAdapter } = require('@slack/interactive-messages');
const slackSigningSecret = process.env.SLACK_SIGNING_SECRET;
const port = process.env.PORT || 3000;
const slackEvents = createEventAdapter(slackSigningSecret);
const slackInteractions = createMessageAdapter(slackSigningSecret);

An exploration of ideas for the API and implementation of the next generation RTMClient in Python

Multiprocessing agnostic

At a minimum, the RTMClient must provide a means for application developers to bring their own multiprocessing opinions and implementaitons.

The simplest implementation an app developer might use is exactly what we've recommended every developer use in the current version of the package: an infinite loop that polls for new data in the main thread of a single process.

@aoberoi
aoberoi / README.md
Last active January 15, 2019 18:53
Working out an API proposal for Slapp v4

Slapp v4 Proposal

This proposal expresses a design that leans towards solving problems with middleware. This is motivated by the need to support migratability from Hubot, deliver extensibility in the framework, and to lay the ground work for a plugin API in the future.

Please add feedback Does this feel unintuitive? Complicated? Are there use cases that you beleive should be easy hard to implement using this API? Please comment below.

There are some wrinkles that still need to be ironed out. These are noted below where they come up.

@aoberoi
aoberoi / projects-change-column-with-touch.md
Last active November 2, 2018 19:45
A couple papercuts I'd like to see addressed in GitHub

What

Create an affordance in the GitHub Projects UI for users on touch-based interfaces to change the column of a card.

Why

Users can already drag and drop new cards into a project using a touch-based interface. But once that card is in a specific column, there's no way to move it to another. This feels maddening, because I'm forced to question whether I am too stupid to see something that should be obvious. I realize that adding drag events would be complicated, because dragging on both the X and Y axes are already bound to panning/scrolling the columns on the board. But, there's a flyout menu ... on each card, that seems like it could accomodate an additional "Move card to..." item, or something like that. This could also benefit users with accessibility

const http = require('http');
const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const { WebClient } = require('@slack/client');
const { createMessageAdapter } = require('@slack/interactive-messages');
const slack = new WebClient(process.env.SLACK_ACCESS_TOKEN);
const slackInteractions = createMessageAdapter(process.env.SLACK_SIGNING_SECRET);
// define dispatch table OR import it from somewhere else
// const commands = require('./commands/live/somewhere');
const commands = {
first: (foo, bar) => { /* ... */ },
second: (baz) => { /* ... */ },
help: (commandName) => { /* ... */ }
};
function usingDispatch(commandName, ...args) {
const command = commands[commandName] || commands.help;