This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy import sparse | |
class Proposition: | |
def __init__(self, title): | |
self.title = title | |
self.votes = {} | |
self.delegations = {} | |
def vote(self, user, vote): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
def example(): | |
leafs = tf.contrib.lookup.index_table_from_file( | |
vocabulary_file='leafs.txt') | |
parents = tf.contrib.lookup.index_table_from_file( | |
vocabulary_file='parents.txt') | |
leafs2parents = tf.contrib.lookup.index_to_string_table_from_file( | |
vocabulary_file='leaf2parents.txt') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {Component, PropTypes} from 'react'; | |
import {Tabs, Tab} from 'material-ui/Tabs'; | |
class MyAwesomeTabTemplate extends Component { | |
static propTypes = { | |
children: PropTypes.node, | |
selected: PropTypes.bool, | |
}; | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
let firebase = require('firebase'); | |
let fs = require('fs'); | |
let spawn = require('child_process').spawn; | |
let throttle = require('lodash.throttle'); | |
let request = require('superagent'); | |
let AWS = require('aws-sdk'); | |
let ref = new Firebase('https://neural.firebaseio.com/'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Firebase from 'firebase'; | |
const firebaseUrl = 'https://spatially.firebaseio.com/clients'; | |
const timeOffsetUrl = 'https://spatially.firebaseio.com/.info/serverTimeOffset'; | |
let ref = new Firebase(firebaseUrl); | |
let timeRef = new Firebase(timeOffsetUrl); | |
let cachedUid; | |
export default ({dispatch, getState}) => next => action => { | |
// The first action rehydrates, so now we've probably got the uid now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// known mcc/mnc values for our sim card (this is Telenor Norway) | |
var mcc = 242; | |
var mnc = 01; | |
// First get the sim card number (API supports multi sim phones) | |
var simNum = Array.slice(window.navigator.mozMobileConnections) | |
.reduce(function(current, connection, i) { | |
if (connection && connection.data && connection.data.network) { | |
// For ONCE we're actually using type coercion as it's meant here! | |
if (connection.data.network.mcc == mcc && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gameoflife(matrix) { | |
var population = []; | |
for (var i = 0; i < matrix.length; i++) { | |
population[i] = []; | |
for (var j = 0; j < matrix[0].length; j++) | |
population[i][j] = 0; | |
} | |
matrix.forEach(function(row, i) { | |
row.forEach(function(col, j) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var React = require('react'); | |
var RCSS = require('rcss'); | |
var tweenState = require('react-tween-state'); | |
var DragMixin = require('./mixins/drag-mixin'); | |
var headerStyle = RCSS.registerClass({ | |
position: 'relative', | |
width: '100%', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<!-- Web Component Polyfill for old browsers --> | |
<script src="https://www.polymer-project.org/platform.js"></script> | |
<!-- Release candidate of next React --> | |
<script src="http://fb.me/react-with-addons-0.12.0-rc1.js"></script> | |
<script src="http://fb.me/JSXTransformer-0.12.0-rc1.js"></script> | |
<!-- Import a web component --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Summary1 = React.createClass({ | |
render: function(() { | |
var cards = this.props.cards | |
return ( | |
<div> | |
<Notification /> | |
<div> | |
cards.map(function(card, i) { | |
return <Card key={'key' + i} data={card}> |
NewerOlder