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
# The function that defines are Guassian function for a | |
# random variable X who is normally distrubted with | |
# mean 'm' and standard deviation 's' | |
def guass_func(x, m, s): | |
a = 1 / (s * ((2 * math.pi) ** 0.5)) | |
b = -0.5 * (((x - m) / s) ** 2) | |
return a * math.exp(b) | |
# Generate a linearly spaced range of x-values from -5 to 5 (1000 of them) |
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
wasm-function[0]: | |
sub rsp, 8 ; 0x000000 48 83 ec 08 | |
mov ecx, edi ; 0x000004 8b cf | |
mov eax, ecx ; 0x000006 8b c1 | |
add eax, 0xa ; 0x000008 83 c0 0a | |
nop ; 0x00000b 66 90 | |
add rsp, 8 ; 0x00000d 48 83 c4 08 | |
ret ; 0x000011 c3 |
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
(module | |
(type $type0 (func (param i32) (result i32))) | |
(table 0 anyfunc) | |
(memory 1) | |
(export "memory" memory) | |
(export "main" $func0) | |
(func $func0 (param $var0 i32) (result i32) | |
get_local $var0 | |
i32.const 10 | |
i32.add |
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
int addTen(int a) { | |
return a + 10; | |
} |
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
/*IMPORTS GO HERE*/ | |
// The functional component of our index page | |
const IndexPage = (props) => { | |
// Getting the data | |
const notes = props.data.allMarkdownRemark; | |
// Grouping based on the slug - the first part being the subject | |
const subjects = _.chain(notes.edges) | |
.groupBy(node => node.node.fields.slug.split('/')[1]) | |
.map(node => node) |
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 from 'react'; | |
import Layout from '../components/layout'; | |
import { graphql } from 'gatsby'; | |
// Functional component | |
const notes = (props) => { | |
const notesMarkdown = props.data.markdownRemark; | |
const { title } = notesMarkdown.frontmatter; | |
// Setting the inner HTML to the HTML provided by MarkdownRemark |
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
exports.createPages = ({ actions, graphql }) => { | |
const { createPage } = actions; | |
// A template for generating a new page from | |
const notesTemplate = path.resolve(`src/templates/notes.js`); | |
// A promise which collects all the MarkdownRemark nodes and then generates pages | |
return new Promise((resolve, reject) => { | |
// Our graphql query wrapped in a resolve | |
// Note how you can add more information in the allMarkdownRemark parameters to fine tune the query | |
resolve(graphql(` |
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
// Defining what should happen whenever we create a new node | |
exports.onCreateNode = ({ node, getNode, actions }) => { | |
const { createNode, createNodeField } = actions | |
// Check if the node being passed is the right type (our markdown content) | |
if (node.internal.type === 'MarkdownRemark') { | |
// Generate a new slug for this file using the createFilePath function | |
// Note we are setting the basePath as pages that way the slug will also include subdirectories | |
const slug = createFilePath({ node, getNode , basePath: 'pages'}); | |
// Add a new field to node of name 'slug' with value slug | |
createNodeField({ |
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
license: mit |
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
//We first perform a selectAll on the circles of the SVG (i.e. the nodes of our graph) | |
//And if a node is clicked, we perform the function supplying that nodes values as an argument | |
svg.selectAll("circle").on("click", function(d){ | |
//We first create a string for the country's name of the node clicked | |
let name = "Country: " + d.name.toUpperCase(); | |
//We then set up the exporters string | |
let string = "Exporters: "; | |
//From our predefined object containing key-value pairs of linked nodes we check to see what our node is linked to | |
//To make the linkedByIndex object we iterated over the links of the graph and placed them in it |