Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pbojinov's full-sized avatar

Petar Bojinov pbojinov

View GitHub Profile
@pbojinov
pbojinov / webrtc-internals.txt
Last active June 4, 2022 05:14
UberConference - chrome://webrtc-internals/
Create Dump
Download the PeerConnection updates and stats data
Enable diagnostic audio recordings
A diagnostic audio recording is used for analyzing audio problems. It consists of several files and contains the audio played out to the speaker (output) and captured from the microphone (input). The data is saved locally. Checking this box will enable recordings of all ongoing input and output audio streams (including non-WebRTC streams) and for future audio streams. When the box is unchecked or this page is closed, all ongoing recordings will be stopped and this recording functionality disabled. Recording audio from multiple tabs is supported as well as multiple recordings from the same tab.
When enabling, select a base filename to which the following suffixes will be added:
<base filename>.<render process ID>.aec_dump.<AEC dump recording ID>
<base filename>.input.<stream recording ID>.wav
// Andrew Clark's explanation: https://github.com/facebook/react/issues/9125#issuecomment-285531461
// ---
// Checking for isRequired on custom validator
// PropTypes source: https://github.com/facebook/prop-types/blob/master/factoryWithTypeCheckers.js#L206-L217
// -------------------------------------------------------------------------------------------------------
// This is a factory function (also called a higher-order function)
function createCustomPropType(isRequired) {
// The factory returns a custom prop type
return function(props, propName, componentName) {
const prop = props[propName];
@pbojinov
pbojinov / snippet.html
Last active July 10, 2018 16:58
Simple Analytics Queue - Fathom (https://github.com/usefathom/fathom)
<!-- Fathom - simple website analytics - https://github.com/usefathom/fathom -->
<script>
(function(f, a, t, h, o, m){
a[h]=a[h]||function(){
(a[h].q=a[h].q||[]).push(arguments)
};
o=f.createElement('script'),
m=f.getElementsByTagName('script')[0];
o.async=1; o.src=t; o.id='fathom-script';
m.parentNode.insertBefore(o,m)
@pbojinov
pbojinov / index.html
Created June 7, 2018 20:58
CSS Transitions using Material Design Motion Guidelines - https://codepen.io/pbojinov/pen/gwVMzv
<div class="animated fadeIn cardContainer">
<div class="card">
<div class="content">
<p>Forage kitsch Echo Park 8-bit Carles narwhal freegan irony Williamsburg bespoke artisan plaid sriracha food truck VHS.</p>
</div>
</div>
<div class="card">
<div class="content">
<p>Beard Bushwick viral cardigan bespoke umami Williamsburg YOLO Shoreditch mustache vinyl craft beer.</p>
/*
1. User interacts with Sender
2. Sender dispatches an action to modifiy state.deaddropto true or to any value that it wants to pass with the message.
3. Receiver has mapStateToProps with a selector for state.deaddrop, and thus gets rerendered with a new prop.
4. Receiver initiates whatever action is required.
*/
/*
I have used this pattern in my redux-form library to enable the triggering of a form submission via the dispatch of an action.
This allows the form component to know about how it needs to be submitted and validated, but also allows any actor in the entire application to trigger the submission.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@pbojinov
pbojinov / display.py
Last active April 8, 2018 02:31
Display External Images in Python
from IPython.display import display, HTML
images = [
"https://d1dwct2onyzkdl.cloudfront.net/720/120059691016_605718478856.jpg",
"https://d1dwct2onyzkdl.cloudfront.net/720/120059691016_605718609928.jpg",
"https://d1dwct2onyzkdl.cloudfront.net/720/120059691016_605718708232.jpg"
]
def make_html(src):
return '<img src="{}" width="50" height="50" style="display:inline;margin:1px"/>'.format(src)
@pbojinov
pbojinov / 00-node6.config
Created March 6, 2018 06:50 — forked from Nainterceptor/00-node6.config
Quick & dirty hack to get NodeJS 6 on AWS Elastic BeanStalk
option_settings:
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: NodeCommand
value: "npm start"
- namespace: aws:elasticbeanstalk:container:nodejs
option_name: NodeVersion
value: "4.4.3"
commands:
050-node-script-installer:
@pbojinov
pbojinov / blinkt-weather.py
Last active June 11, 2018 14:34 — forked from brentajones/blinkt-weather.py
A weather status script for the Raspberry Pi and Blinkt module - https://blog.bjones.net/2018/02/04/pi-blinkt-weather-status/
import json, time, os.path
import blinkt, requests
status_colors = {'current':[1,1,1],'high':[1,0,0],'low':[0,0,1],'precip':[0,1,0]}
blinkt.set_clear_on_exit()
blinkt.set_brightness(.1)
def getForecast(key,lat,lng):
url = 'https://api.darksky.net/forecast/' + key + '/' + str(lat) + ',' + str(lng)