Skip to content

Instantly share code, notes, and snippets.

Login
Login Cached?
cached? -> Enter Credentials
not cached? -> Login Downloading
Login Downloading
downloaded -> Enter Credentials
Enter Credentials
login success -> File Manager
@camwest
camwest / permutations.js
Created February 14, 2018 22:23 — forked from wassname/permutations.js
Combinatorics permutatons and product in javascript using lodash.js (like python's itertools)
/**
* Lodash mixins for combinatorics
* Inspired by python itertools: https://docs.python.org/2.7/library/itertools.html
*
* Usage:
* permutations([0,1,2],2) // [[0,1],[0,2],[1,0],[1,2],[2,0],[2,1]]
* combinations([0,1,2],2) // [[0,1],[0,2],[1,2]]
* combinations_with_replacement([0,1,2],2)// [[0,0],[0,1],[0,2],[1,1],[1,2],[2,2]]
* product([0,1,2],[0,1,2]) // [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2]]
*
function rootReducer(state, action) {
return {
part1: part1Reducer(state.part1, action),
part2: part2Reducer(state.part2, action)
}
}
function part1Reducer(state, action) {
return {
part1A: part1AReducer(state.A, action),
function* watchEvents(): any {
const initial = yield call(ExternalApi.getCurrent);
yield put(receiveEvent(initial);
const chan = yield call(setupEvents);
while (true) {
const event = yield take(chan);
yield put(receiveEvent(event));
}
@camwest
camwest / 1-myapp.jsx
Last active April 20, 2016 22:11
redux with events
<div>
<MyCollection name="ONE" />
<MyCollection name="TWO" />
</div>
// define main angular module
var app = angular.module('app-module', []);
// inject $provide into the application config
app.config(['$provide', function($provide) {
// provide the LOGIN_DATA as a constant to angular
$provide.constant('LOGIN_DATA', window.LOGIN_DATA)
}]);
app.controller('MyCtrl', function(LOGIN_DATA) {
$(function () {
var chart;
$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'area'
},
title: {
text: 'Weekly Cohorts: States'
{
"name": "kera-proxy",
"version": "0.0.1",
"author": "Kera Software Inc <team@kera.io>",
"private": true,
"dependencies": {
"faux": "https://github_username:github_password@github.com/kera-inc/faux.git",
"express": "2.5.x",
"directory-tree-watcher": "0.0.5",
"coffee-script": "1.3.1"
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<style>
#outer {
position:relative;
[~] rake db:create:all