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
const weightData$ = get$(`/1/user/-/body/log/weight/date/${today}.json`) | |
.map(response => response.data.weight[0]); |
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
server.get('/user', (req, res) => { | |
res.send({ | |
token: req.user.token | |
}); | |
}); |
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
const token$ = rx.Observable.fromPromise(axios.get('/user')) | |
.map(response => response.data.token); | |
const get$ = path => token$.flatMap(token => rx.Observable.fromPromise(axios.get(`https://api.fitbit.com${path}`, | |
{headers: {Authorization: 'Bearer ' + token}}))); |
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
passport.use(new FitbitStrategy({ | |
clientID: process.env.ID, | |
clientSecret: process.env.SECRET, | |
callbackURL: host + "/auth/callback" | |
}, | |
function(accessToken, refreshToken, profile, done) { | |
done(null, {token: accessToken}); | |
} | |
)); |
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 AWS = require("aws-sdk"); | |
AWS.config.update({ | |
region: "eu-west-1", | |
}); | |
var dynamodbDoc = new AWS.DynamoDB.DocumentClient() | |
var table = "serverless-counter"; |
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 HelloMessage = React.createClass({ | |
render: function() { | |
var generateList = function() { | |
return [1, 2, 4].map(function(i) { return <li>{i}</li> }); | |
}; | |
return ( | |
<div>Hello {this.props.name} | |
<ul>{generateList()}</ul> | |
</div> | |
); |
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
(ns clojure-json.core | |
(:require [cheshire.core])) | |
(defn my-json | |
[numbers-to-take numbers-to-map] | |
{:time (new java.util.Date) | |
:topic "Generating json from clojure" | |
:numbersToTake numbers-to-take | |
:letsNestIt {:someNumbers (take numbers-to-take (repeatedly rand))} | |
:numbersDoubled (map (partial * 2) numbers-to-map)}) |
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 React = require('react-native') | |
var {Text, ListView, AppRegistry} = React | |
var StationMetadataStore = require('./StationMetadataStore') | |
var StationList = React.createClass({ | |
getInitialState() { | |
var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}) | |
return {stations: ds.cloneWithRows([])} | |
}, |
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 React = require('react') | |
var StationMetadataStore = require('./StationMetadataStore') | |
var StationList = React.createClass({ | |
getInitialState() { | |
return {stations: []} | |
}, | |
componentDidMount: function() { | |
this.unsubscribe = |
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 Bacon = require('bacon') | |
var _ = require('lodash') | |
var METADATA_URL = 'http://rata.digitraffic.fi/api/v1/metadata/station' | |
var stations = Bacon.fromPromise(fetch(METADATA_URL)) | |
.flatMap(response => Bacon.fromPromise(response.json())) | |
var stationsByCode = stations.map((stations) => | |
_.indexBy(stations, 'stationShortCode')) |
NewerOlder