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
%matplotlib inline | |
import scipy as sp | |
import numpy as np | |
import matplotlib.pylab as plt | |
def error(f, x, y): | |
return sp.sum((f(x) - y)**2) | |
x = np.linspace(-np.pi, 1+np.pi, 201) | |
plt.plot(x, np.sin(x)) |
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
{{ object }}_{{ time.strftime("%Y-%m-%d") }}_{{ time.strftime('%H')|int // 2 }} |
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 stream_django.activity import create_reference | |
user_feed = feed_manager.get_user_feed(user.id) | |
activity = { | |
'actor': create_reference(user), | |
'verb': 'like', | |
'object': create_reference(liked_item), | |
'foreign_id': create_reference(liked_item) | |
} |
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 celery.app import app_or_default | |
app = app_or_default() | |
connection = app.connection() | |
queue = connection.SimpleQueue('queue') |
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 stream_django import feed_manager | |
Rating.__bases__ = (Activity,) + Rating.__bases__ | |
feed_manager.bind_model(Rating) |
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
<?php | |
// Get curl version array | |
$version = curl_version(); | |
// These are the bitfields that can be used | |
// to check for features in the curl build | |
$bitfields = Array( | |
'CURL_VERSION_IPV6', | |
'CURL_VERSION_KERBEROS4', | |
'CURL_VERSION_SSL', |
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
<?php | |
$c = curl_init('https://us-east-api.getstream.io'); | |
// force curl to try IPv4 first | |
curl_setopt($c, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); | |
curl_exec($c); | |
echo curl_getinfo($c, CURLINFO_NAMELOOKUP_TIME); | |
?> |
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
Configure an instance for your project | |
-------------------------------------- | |
```js | |
var client = new StreamAnalytics({ | |
projectId: "YOUR_PROJECT_ID", | |
writeKey: "YOUR_WRITE_KEY" | |
}); | |
``` | |
User centered metrics |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>io.stream.example</groupId> | |
<artifactId>example</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<dependencyManagement> |
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
// Configure an instance for your project | |
var client = new StreamAnalytics({ | |
projectId: "YOUR_PROJECT_ID", | |
writeKey: "YOUR_WRITE_KEY" | |
}); | |
// Track impressions (eg. messages in the http://stocktwits.com/symbol/ING page) | |
// Every activity (eg. messages) shown to the user should be tracked as an impression | |
var impression = { | |
viewerId: 'user:Thierry', |