Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block decisionmechanics

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
#!/usr/bin/env python3
# pip3 install requests
import requests
import pprint
res = requests.get("", timeout=10)
print(f"Status code: {res.status_code}")
decisionmechanics / App.js
Created May 30, 2019
Export Highcharts as SVG using external button
View App.js
import React, { Component } from "react";
import "./App.css";
import Highcharts from "highcharts";
import HighchartsReact from "highcharts-react-official";
import HighchartsExporting from "highcharts/modules/exporting";
class App extends Component {
constructor(props) {
decisionmechanics / postman_problem_fetch_test.txt
Created Mar 15, 2019
Node fetch for API that has a Postman problem
View postman_problem_fetch_test.txt
const fetch = require("node-fetch");
("use strict");
const fetchData = async url => {
try {
const response = await fetch(url, {
method: "POST",
decisionmechanics / controller.R
Created Feb 5, 2019
Controller for FPET/FPEM container
View controller.R
do_one_country_run <- function(survey_data_file_path) {
survey_data <- readr::read_csv(survey_data_file_path)
division_numeric_code <- survey_data$division_numeric_code[1]
decisionmechanics / recommendation_engine_example.R
Last active Jun 28, 2018
Create item-based recommendations using a co-occurrence matrix
View recommendation_engine_example.R
get_recommendation_ratings <- function(rating_file_path) {
# Read user ID, item ID, user preference CSV data
ratings <- read.csv(file = rating_file_path, header = FALSE, col.names = c('user', 'item', 'preference'))
# Create item co-occurrence matrix
co_occurrence_matrix <- crossprod(table(ratings[, c('user', 'item')]))
# Convert long format to wide format and replace NAs with 0s
user_ratings <- tidyr::spread(ratings, user, preference, fill = 0)
decisionmechanics / spark_random_forest.R
Created Mar 21, 2017
Predicting wine quality using a random forest classifier in SparkR
View spark_random_forest.R
url <- ""
df <-
read_delim(url, delim = ";") %>%
dplyr::mutate(taste = as.factor(ifelse(quality < 6, "bad", ifelse(quality > 6, "good", "average")))) %>%
decisionmechanics / app.R
Created Jul 13, 2016
2012 General Social Survey cross tabulation Shiny app demo
View app.R
ui <- fluidPage(
headerPanel("2012 General Social Survey cross tabulation"),
selectInput("row", "Row variable", names(gss2012), selected = "polviews"),
selectInput("column", "Column variable", names(gss2012), selected = "sex")
View gss2012-exploratory-analysis.Rmd
# 2012 General Social Survey analysis
This report contains a basic exploratory analysis of the 2012 General Social Survey data from the `tigerstats` package.
```{r include=FALSE}
Survey response count by gender is
decisionmechanics / RouteConfig.cs
Created Jul 1, 2016
Configuration for route localization in ASP.NET MVC app
View RouteConfig.cs
namespace RouteLocalizationDemo
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.Routing;
using RouteLocalization.Mvc;
using RouteLocalization.Mvc.Setup;
using Controllers;
decisionmechanics / Program.cs
Last active Nov 13, 2017
Microsoft Cognitive Services Face and Emotion API demo
View Program.cs
namespace FaceRecognitionDemo
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
You can’t perform that action at this time.