Skip to content

Instantly share code, notes, and snippets.

View feynon's full-sized avatar
tiled

Ankesh Bharti feynon

tiled
View GitHub Profile
@feynon
feynon / monad-stream-example.js
Created August 26, 2019 15:04 — forked from mpj/monad-stream-example.js
This is the code from Monads - episode #21 of FunFunFunction (https://www.youtube.com/playlist?list=PL0zVEGEvSaeFSwPn06GKArptSxiP1Gff8)
const fetch = require('node-fetch')
const Bacon = require('baconjs')
function getInPortuguese(word) {
// Google Translate API is a paid (but dirt cheap) service. This is my key
// and will be disabled by the time the video is out. To generate your own,
// go here: https://cloud.google.com/translate/v2/getting_started
const apiKey =
'AIzaSyB4DyRHIsNhogQXmH16YKbZfR-lTXrQpq0'
const url =
document.addEventListener("DOMContentLoaded", function(event) {
var orderModule = (function() {
var orders = {},
EST_DELIVERY = "current estimated delivery time",
estimatedDeliveryTime;
PubSub.subscribe(EST_DELIVERY, function(msg, data) {
console.log(msg);
estimatedDeliveryTime = data;
});
@feynon
feynon / solid.js
Created August 24, 2019 20:15 — forked from crizstian/solid.js
Code examples of SOLID principles for JavaScript
/*
Code examples from the article: S.O.L.I.D The first 5 priciples of Object Oriented Design with JavaScript
https://medium.com/@cramirez92/s-o-l-i-d-the-first-5-priciples-of-object-oriented-design-with-javascript-790f6ac9b9fa#.7uj4n7rsa
*/
const shapeInterface = (state) => ({
type: 'shapeInterface',
area: () => state.area(state)
})
@feynon
feynon / interfaceSegregation.js
Created August 24, 2019 20:03
A client should never be forced to implement an interface that it doesn’t use or clients shouldn’t be forced to depend on methods they do not use.
const manageShapeInterface = fn => ({
type: "manageShapeInterface",
calculate: () => fn()
});
const circle = radius => {
const proto = {
radius,
type: "Circle",
area: args => Math.PI * Math.pow(args.radius, 2)
import Events from 'eventemitter3';
const modelMixin = Object.assign({
attrs: {},
set (name, value) {
this.attrs[name] = value;
this.emit('change', {
prop: name,
value: value

Keybase proof

I hereby claim:

  • I am shermix on github.
  • I am shermix (https://keybase.io/shermix) on keybase.
  • I have a public key whose fingerprint is 737D 87D0 29AC F2AA DFA4 523D 11FE E6AE CB8B 923C

To claim this, I am signing this object:

@feynon
feynon / gpg_ssh.md
Created August 17, 2019 13:23
Exporting a private GPG key from primary machine to another and setting it up on another by importing it and building trust. Last commands include steps to add it to your local git settings.
  • Exporting Keys from machine holding the primary key
hermisaurus@pop-os:~$ gpg --list-secret-keys
/home/shermisaurus/.gnupg/pubring.kbx
-------------------------------------
sec   rsa2048 2019-08-17 [SC]
      91E3CA9C218F5DA0214E8D78D6A03EC9488BECA2
uid           [ultimate] Ankesh Bharti (https://keybase.io/shermisaurus) <[email protected]>
ssb   rsa2048 2019-08-17 [E]
@feynon
feynon / NOMODESET_fix.md
Created August 16, 2019 19:36
How to set NOMODESET and other kernel boot options in grub2 for fixing bad screens where propetiary nvidia drivers are not included by default.

Here's the chat excerpt that helped me out resolving stuff on my black screen boots after login on distros that did not included non-free bundle by default. Thanks to @ramansarda2000 for helping out.

lotuspsychje: The_LoudSpeaker: for the GTX versions we reccomend latest drivers from the ubuntu graphics ppa, first you need to enter system with !nomodeset, then add the ppa and install the latest driver [17:31] lotuspsychje: !nomodeset | The_LoudSpeaker [17:31] ubottu: The_LoudSpeaker: A common kernel (boot)parameter is nomodeset, which is needed for some graphic cards that otherwise boot into a black screen or show corrupted splash screen. See http://ubuntuforums.org/showthread.php?t=1613132 on how to use this parameter [17:31] lotuspsychje: !nvidia | The_LoudSpeaker [17:31] ubottu: The_LoudSpeaker: For nvidia and matrox graphics cards, see https://help.ubuntu.com/community/VideoDriverHowto . For AMD/ATI graphics cards, see « /msg ubottu ati » and « /msg ubottu fglrxmissing » For the latest Nvidia drivers

Notes: <select></select> <button>Add</button><br>
<textarea style="width: 100%"></textarea>
<script>
let list = document.querySelector("select");
let note = document.querySelector("textarea");
let state;
function setState(newState) {
list.textContent = "";
body footer nav::after {
content: " by Ankesh Bharti";
color: var(--accent-color);
font-size: 1em;
}
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&display=swap&subset=latin-ext');
:root {
--accent-color: #0000ff;