Skip to content

Instantly share code, notes, and snippets.

View ManasJayanth's full-sized avatar

prometheansacrifice ManasJayanth

View GitHub Profile
@ManasJayanth
ManasJayanth / input-issue-1303-prepack.js
Created January 1, 2018 05:02
Prepack issue 1303 - input
this.out = this.out || {};
this.out.js = (function (exports) {
'use strict';
const minMargin = 1;
const sizes = [15, 20, 25 , 50, 40, 130];
const stepPi = (1 / 16) * Math.PI;
// this ensure we go through a wide range of values
@ManasJayanth
ManasJayanth / gist:2ae92469a61de70822e3c013453a10bc
Created January 1, 2018 04:59
Prepack output for issue #1303
(function () {
"use strict";
var _$0 = this;
var _2 = function (i) {
return _$0.Math.cos(i * 0.19634954084936207);
};
var _5 = function (value, min, max) {
@ManasJayanth
ManasJayanth / ReactFiberReconcilerTypes.js
Created December 17, 2017 16:01
ReactFiberReconcilerTypes.js
type Fiber = any;
type ReactNodeList = any;
type ExpirationTime = number;
type Batch = {
_defer: boolean,
_expirationTime: ExpirationTime,
_onComplete: () => mixed,
_next: Batch | null,
};
@ManasJayanth
ManasJayanth / canvas-immediate.js
Created April 19, 2017 05:50
Canvas Immediate mode rendering using React
import type { HostConfig, Reconciler } from 'react-fiber-types';
import type { ReactNodeList } from 'react-fiber-types/ReactTypes';
import DOMPropertyOperations from './DOMPropertyOperations';
import type {
Props,
Container,
Instance,
TextInstance,
OpaqueHandle,
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
set-option -g default-command "reattach-to-user-namespace -l bash"
@ManasJayanth
ManasJayanth / extract-domain-from-url.js
Last active December 30, 2015 13:01
RegExp to extract domain from a url
function extractDomain(url) {
return url.match(/(www\.)?([a-z0-9]+\.)+[a-z]{2,}/)[0];
}
@ManasJayanth
ManasJayanth / matrix.html
Created August 31, 2015 05:49
My crappy attempt the matrix screen
<html>
<head>
<style>
html, body {
height: 100%;
width: 100%;
margin: 0;
font-size: 100%;
background-color: #000000;
color: green;
function scrollTo(Y, duration, easingFunction, callback) {
var start = Date.now(),
elem = document.documentElement.scrollTop?document.documentElement:document.body,
from = elem.scrollTop;
if(from === Y) {
callback();
return; /* Prevent scrolling to the Y point if already there */
}
if(typeof escapeHtmlEntities == 'undefined') {
escapeHtmlEntities = function (text) {
return text.replace(/[\u00A0-\u2666<>\&]/g, function(c) {
return '&' +
(escapeHtmlEntities.entityTable[c.charCodeAt(0)] || '#'+c.charCodeAt(0)) + ';';
});
};
// all HTML4 entities as defined here: http://www.w3.org/TR/html4/sgml/entities.html
// added: amp, lt, gt, quot and apos
@ManasJayanth
ManasJayanth / gist:62f3e6fae2161b829723
Last active August 29, 2015 14:07
Hand compile bash with Shellshock fix (Source: https://news.ycombinator.com/item?id=8364385)
#assume that your sources are in /src
cd /src
wget http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
#download all patches
for i in $(seq -f "%03g" 0 25); do
wget http://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-$i;
done