Skip to content

Instantly share code, notes, and snippets.

@toori67
toori67 / adbwifi.sh
Last active November 1, 2019 09:31
Android adb wifi debug shell script.
#!/bin/bash
adb kill-server
adb start-server
echo "Connect device with usb cable"
adb wait-for-device
ANDROID_IP=`adb shell ifconfig wlan0 | awk '/inet addr/ {gsub("addr:", "", $2); print $2}'`
adb tcpip 5555
adb connect $ANDROID_IP:5555
@tanmatra
tanmatra / algebraic_effects.kt
Created October 9, 2019 12:16
Simple "algebraic effects" implementation on Kotlin
/*
* https://overreacted.io/algebraic-effects-for-the-rest-of-us/
*/
private val effectsStack = ThreadLocal<EffectsFrame>()
fun <T> perform(effectKey: Any): T {
var frame = effectsStack.get()
while (frame != null) {
@Suppress("UNCHECKED_CAST")
@johngrib
johngrib / contribution.sh
Created December 31, 2018 14:58
Show github contribution graph on terminal
#! /usr/local/bin/bash
MYGITHUB=johngrib
RAW=/tmp/$MYGITHUB-github
TABLE=/tmp/$MYGITHUB-github-table
COLORS=/tmp/$MYGITHUB-github-colors
curl -s https://github.com/$MYGITHUB/ > $RAW
TITLE=`cat /tmp/johngrib-github | pcregrep -M '[0-9,]+ contributions\s*\n\s*in the last year'`
@sledorze
sledorze / projections.ts
Last active July 8, 2019 02:22
Wip TS interface for (Get)EventStore Projections
function options(o: Options): void
interface Options {
// Overrides the default resulting stream name for the outputState() transformation, which is $projections-{projection-name}-result.
resultStreamName?: string
// Configures the projection to include / exclude link to events.Default: false
$includeLinks?: boolean
// When reorderEvents is turned on, this value is used to compare the total milliseconds between the first and last events in the buffer and if the value is equal or greater, the events in the buffer will be processed. The buffer is an ordered list of events. Default: 500ms
// Only valid for fromStreams() selector
processingLag?: number
@SuperPaintman
SuperPaintman / npm-f3-install.sh
Last active April 21, 2024 23:41
NPM install for low RAM machins. And "npm install ... killed" problem
#!/bin/bash
#
# Author: SuperPaintman <SuperPaintmanDeveloper@gmail.com>
#
###
# Constants
###
RETVAL=0
@OlegIlyenko
OlegIlyenko / Event-stream based GraphQL subscriptions.md
Last active May 28, 2024 17:41
Event-stream based GraphQL subscriptions for real-time updates

In this gist I would like to describe an idea for GraphQL subscriptions. It was inspired by conversations about subscriptions in the GraphQL slack channel and different GH issues, like #89 and #411.

Conceptual Model

At the moment GraphQL allows 2 types of queries:

  • query
  • mutation

Reference implementation also adds the third type: subscription. It does not have any semantics yet, so here I would like to propose one possible semantics interpretation and the reasoning behind it.

@paulirish
paulirish / what-forces-layout.md
Last active June 26, 2024 20:47
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@Vestride
Vestride / encoding-video.md
Last active June 5, 2024 14:38
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus