Skip to content

Instantly share code, notes, and snippets.

rmongodb Tutorial

This is a quick document aimed at highlighting the basics of what you might want to do using MongoDB and R. I am coming at this, almost completely, from a SQL mindset.

Install

The easiest way to install, I believe, is

@sh4n3d4v15
sh4n3d4v15 / Google Directions API
Last active February 9, 2018 02:11
R functions to lookup distance and duration from two given points
library(RCurl)
library(RJSONIO)
library(plyr)
url <- function(origin, destination) {
root <- "https://maps.googleapis.com/maps/api/directions/json"
u <- paste(root, "?origin=", origin, "&destination=", destination, "&key=AIzaSyAuj0ix2b8t54hrhIEHRsQNk0r6y9eBK2U", sep = "")
return (URLencode(u))
}
@sh4n3d4v15
sh4n3d4v15 / Instantiate view
Created April 14, 2013 12:39
Instantiate and push view with storyboard identifier
LoginViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"LoginIdentifier"];
[self.navigationController pushViewController:controller animated:YES];
@sh4n3d4v15
sh4n3d4v15 / DOSKEY
Created November 20, 2012 09:42
DOS :: SUBLIME TEXT
doskey subl="C:\Program Files\Sublime Text 2\sublime_text.exe" $*
{
"src_files":[
"tests/*coffee",
"scripts/*.coffee"
],
"serve_files": [
"scripts/*.js",
"tests/*.js"
],
"before_tests" : "coffee -c ."
@sh4n3d4v15
sh4n3d4v15 / Hello world
Created October 29, 2012 07:41
hello world function
var foo = function(){
return 'hello world';
}
@sh4n3d4v15
sh4n3d4v15 / Hello world
Created October 27, 2012 20:20
hello world function
<script>
var foo = function(){
return 'hello world';
}
</script>
@sh4n3d4v15
sh4n3d4v15 / SpecRunner.js
Created October 9, 2012 11:11
JASMINE: index file for jasmine, require, backbone
require.config({
baseUrl: "/js/",
urlArgs: 'cb=' + Math.random(),
paths : {
jquery : 'libs/jquery/jquery-1.8.0.min',
bootstrap : 'libs/bootstrap/bootstrap',
underscore : 'libs/underscore/underscore-min',
backbone : 'libs/backbone/backbone-min',
text : 'libs/require/text',
mainConfigFile : "public/js/main",
@sh4n3d4v15
sh4n3d4v15 / Fetch.sublime.settings
Created September 30, 2012 11:37
SUBLIME: Package for fetch
{
"files":
{
"backbone": "http://documentcloud.github.com/backbone/backbone.js",
"backbone.min": "http://documentcloud.github.com/backbone/backbone-min.js",
"history": "https://raw.github.com/balupton/history.js/master/scripts/compressed/history.js",
"jquery": "http://code.jquery.com/jquery.js",
"jquery-extra-selectors": "https://raw.github.com/keithclark/JQuery-Extended-Selectors/master/jquery-extra-selectors.js",
"jquery.min": "http://code.jquery.com/jquery.min.js",
"json2": "https://raw.github.com/douglascrockford/JSON-js/master/json2.js",
@sh4n3d4v15
sh4n3d4v15 / gist:3806517
Created September 30, 2012 11:32
pubSubTrick
// Works in modern browsers + IE9, but Modernizr has a polyfill baked in for function.bind.
// Hat tip Paul Irish
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = o.off.bind(o);
$.publish = o.trigger.bind(o);
// Usage
$(document.body).on( 'click', function() {