Skip to content

Instantly share code, notes, and snippets.

View cheesinglee's full-sized avatar

Chee Sing Lee cheesinglee

View GitHub Profile
function predictStatus(fundedAmount, country, loanAmount, sector, fundedDateDayOfWeek, fundedDateDayOfMonth, fundedDateMonth, fundedDateYear)
function makeStatusIndicator(loan_id){
// this function executes the Kiva API query for a particular loan id, feeds the result through
// the actionable model, and returns a green light or red light icon depending on the result.
// create DOM object for icon
var img = $('<img class="indicator">') ;
// Kiva API call
var url = "http://api.kivaws.org/v1/loans/" + loan_id + ".json" ;
$.get(url,function(data){
{
"manifest_version": 2,
"name": "Kiva Predictor",
"description": "Predict the success of Kiva loans using BigML models",
"version": "0.1",
"content_scripts": [
{
"matches": ["http://www.kiva.org/lend*"],
@cheesinglee
cheesinglee / kivapredict.js
Last active August 29, 2015 14:03
Snippets for browser extension blog post
// check if a loan ID is at the end of the url
var re = /lend\/(\d+)/ ;
var result = re.exec(window.location.href) ;
if (result !== null){
// individual loan page
var loan_id = result[1] ;
img = makeStatusIndicator(loan_id) ;
$("#lendFormWrapper").append(img) ;
}else{
@cheesinglee
cheesinglee / reddit_scraper.py
Created June 20, 2014 03:17
Python subreddit scraper
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 3 12:24:41 2013
@author: cheesinglee
"""
import praw
from csv import DictWriter
@cheesinglee
cheesinglee / adult.json
Last active August 29, 2015 14:02
BigML dataset scatter plot
{
"all_fields": true,
"category": 0,
"cluster": null,
"cluster_status": true,
"code": 200,
"columns": 15,
"created": "2013-05-07T20:30:05.554000",
"credits": 3.790340423584,
"description": "",