Skip to content

Instantly share code, notes, and snippets.

View soundyogi's full-sized avatar
🦊

km soundyogi

🦊
View GitHub Profile
@soundyogi
soundyogi / general-purpose-reducers.js
Created February 10, 2017 01:55 — forked from crisu83/general-purpose-reducers.js
General-purpose reducers for Redux.
/**
* This gist was inspired by the video course titled "Building React Applications with Idiomatic Redux"
* available on Egghead.io by the creator of Redux, Dan Abramov.
*
* The purpose of this gist is to demonstrate general purpose reducers that can be used via Redux's combineReducers
* to compose more complex reducers and therefore maximize code reuse.
*
* Feedback is more than welcome!
*
* @author Christoffer Niska <[email protected]>
@soundyogi
soundyogi / react_router_v4_nesting_routes.js
Created March 29, 2017 05:37
react router v4 nesting
// wrap <Route> and use this everywhere instead
function RouteNest(props){ return (
<Route exact={props.exact} path={props.path} render={ p => <props.component {...p} children={props.children}/> } />
)}
export const MainRoutes = props =>
<div className='content layout'>
<Route exact path="/" component={Landing}/>
@soundyogi
soundyogi / main.es6
Created April 1, 2017 22:20 — forked from mfellner/main.es6
Playing with RxJS Observables and ES6
const Rx = require('Rx');
require('babel/register');
const Observables = require('./observables.es6');
// Define a very simple, router-like object
class Router {
constructor() {
this.routes = {};
}
@soundyogi
soundyogi / stack_trace.py
Created April 2, 2017 20:33 — forked from socrateslee/stack_trace.py
A Stack Trace Decorator of Python Functions
import sys
import functools
'''
Usage:
consider following functions
import stack_trace
def foo():
pass
def bar():
import { matchPath } from 'react-router';
class MainRouter extends Component {
static displayName = 'MainRouter';
static propTypes = {
store: React.PropTypes.object,
component: React.PropTypes.oneOfType([
React.PropTypes.element,
React.PropTypes.func,
])
@soundyogi
soundyogi / Enhance.js
Created April 5, 2017 14:23 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@soundyogi
soundyogi / stuns
Created April 6, 2017 03:44 — forked from yetithefoot/stuns
STUN+TURN servers list
{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},

MTG Cheat Sheet

Phases

  1. Untap
  2. Upkeep (taxes/transformations etc.)
  3. Draw a Card
  4. Play lands, spells, creatures, etc.)
  5. Combat
  • Opponent Reaction
  • Self: Declare attackers
@soundyogi
soundyogi / hashcode.js
Created April 19, 2017 23:14
hash string to int
function hashCode (str){
var hash = 0;
if (str.length == 0) return hash;
for (i = 0; i < str.length; i++) {
char = str.charCodeAt(i);
hash = ((hash<<5)-hash)+char;
hash = hash & hash; // Convert to 32bit integer
}
return hash;
}
@soundyogi
soundyogi / seo.md
Created April 26, 2017 13:18 — forked from dypsilon/seo.md