Skip to content

Instantly share code, notes, and snippets.

View sudoanand's full-sized avatar
👋
Hey there!

Anand Singh sudoanand

👋
Hey there!
View GitHub Profile
@sudoanand
sudoanand / composer.js
Created April 19, 2020 09:18
Discourse composer controller mod
import { isEmpty } from "@ember/utils";
import { and, or, alias, reads } from "@ember/object/computed";
import { debounce } from "@ember/runloop";
import { inject as service } from "@ember/service";
import { inject } from "@ember/controller";
import Controller from "@ember/controller";
import DiscourseURL from "discourse/lib/url";
import Quote from "discourse/lib/quote";
import Draft from "discourse/models/draft";
import Composer from "discourse/models/composer";
@sudoanand
sudoanand / webrtc.html
Last active January 12, 2020 10:39
WebRTC one to one video call demo, usage https://websocket.in as signalling server. Need help? Tweet to @hack4mer
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes">
<style>
body {
display: flex;
height: 100vh;
@sudoanand
sudoanand / android-fonts
Last active April 8, 2019 09:44
Available fonts (as of Oreo) for android
Using these fonts
Set the android:fontFamily and android:textStyle attributes, e.g.
<!-- Roboto Bold -->
<TextView
android:fontFamily="sans-serif"
android:textStyle="bold" />
to the desired values from this table:
<?php
//Complete guide: https://hack4m.com/how-to-implement-wildcard-routes-in-ratchet-websocket-server
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use Ratchet\Http\HttpServerInterface;
<?php
$host = '0.0.0.0'; //host
$port = 12345; //port
$null = NULL; //null var
//Create TCP/IP sream socket
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
//reuseable port
socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1);