Skip to content

Instantly share code, notes, and snippets.

View sunny-g's full-sized avatar

Sunny Gonnabathula sunny-g

View GitHub Profile
@yinghaochan
yinghaochan / barChart.html
Last active February 29, 2016 21:10
Bar chart in react
<html>
<head>
<meta name="description" content="React Barchart animated">
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.5.1/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-with-addons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.7/react-dom.js"></script>
<meta charset="utf-8">
@joshduck
joshduck / gist:0c35f70cdd3abf88770c
Created February 24, 2016 21:58
ReactPerf to Web Tracing Framework
const ReactPerf = require('ReactPerf');
const TRACE_DOM = false;
function reactPerfTrace(objName: string, fnName: string, func: any): any {
return function(component) {
let label;
if (objName === 'ReactCompositeComponent') {
var instName = this.getName() || 'Unknown';
label = fnName === 'mountComponent' || fnName === 'updateComponent' ? instName : `${instName}.${fnName}`;

🚥 solve the Error: Naming collision detected for fbjs on react-native start

rm -rf node_modules/
npm i
npm uninstall fbjs
find . -name 'fbjs' -print | grep "\./node_modules/fbjs" -v | xargs rm -rf
npm i fbjs
@vasanthk
vasanthk / System Design.md
Last active April 21, 2025 02:58
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@oxyflour
oxyflour / hindley-milner.ts
Last active October 23, 2024 07:09
a typescript implement of hindley-milner type inference
// a typescript implement of hindley-milner type inference
// reference http://smallshire.org.uk/sufficientlysmall/2010/04/11/a-hindley-milner-type-inference-implementation-in-python/
/// <reference path="./lib.es6.d.ts" />
// ...
interface AstNode {
}
class Id implements AstNode {
@t20100
t20100 / mpl_interaction.py
Created January 29, 2016 09:53
Pan and zoom interaction over a matplotlib Figure
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# /*##########################################################################
#
# Copyright (c) 2016 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
const stateIdLens = propLens('id')
const stateTokenLens = propLens('token')
let setCurrentUserId = (state, action) => set(idLens, action.payload.result, state)
let setCurrentUserToken = (state, action) => set(tokenLens, action.payload.token, state)
compose(setCurrentUserId, setCurrentUserToken)
@paulvictor
paulvictor / ObservableT.js
Created January 28, 2016 09:06
Demonstrate how to use monadTransformers to combine monads(Observerable and IO in this case) to form higher order monads
"use strict"
var m = require("monet");
var MonadT = m.MonadT;
var IO = m.IO;
var Observable = require("rx").Observable;
class IOObs {
constructor(ioObservable){
this.value = ioObservable;
}
@henrik
henrik / test_helper.exs
Last active June 10, 2020 20:16
Improved `assert_compile_time_raise` based on this comment by Andrea Leopardi: http://andrealeopardi.com/posts/compile-time-work-with-elixir-macros/#comment-2347206739
ExUnit.start()
defmodule CompileTimeAssertions do
defmacro assert_compile_time_raise(expected_exception, expected_message, fun) do
# At compile-time, the fun is in AST form and thus cannot raise.
# At run-time, we will evaluate this AST, and it may raise.
fun_quoted_at_runtime = Macro.escape(fun)
quote do
assert_raise unquote(expected_exception), unquote(expected_message), fn ->
@justinwoo
justinwoo / post.md
Created November 5, 2015 17:27
How to make a Cycle.js + Elm hybrid Etch-a-Sketch app. Original: http://qiita.com/kimagure/items/d6ac01e6258ecd363ffe

How to make a Cycle.js + Elm hybrid Etch-a-Sketch app

A couple of days ago, I wrote a Cycle.js app using Elm to render stuff to the page. This was pretty fun and got some attention, so I might as well write about it some.

Writing this thing

Overview

A Cycle.js application consists of three parts: your main function declaration, your drivers setup, and your application initialization with Cycle.run (which sets up the "Cycle" part of your application). We'll do the following in our app: