Skip to content

Instantly share code, notes, and snippets.

View adg29's full-sized avatar
📱

Alan Garcia adg29

📱
View GitHub Profile
@adg29
adg29 / business_discovery.json
Created September 7, 2019 03:40
Instagram Graph API
{
"business_discovery": {
"followers_count": 267793,
"media_count": 1205,
"media": {
"data": [
{
"id": "17858843269216389"
},
{
@adg29
adg29 / crca-teams.csv
Last active February 7, 2017 16:58
Century Road Club Association Teams 2017
year team
2017 CityMD Racing
2017 NY Vision Group/Fuoriclasse Racing
2017 Blue Ribbon-Pennell Venture Partners
2017 Houlihan Lokey
2017 Foundation
2017 e2Value
2017 Axis Theatre
2017 Sid's Bikes NYC
2017 Radical Media
/* 1 */
{
"_id" : ObjectId("585b117d111849c160443616"),
"searchString" : "chicken%20sandwich",
"searchResults" : [
{
"name" : "Seasoning Mix, Honey BBQ Chicken Glaze",
"levenshteinDistance" : 34,
"hit" : {
"item_id" : "51c549ef97c3e6efadd6020e",
@adg29
adg29 / index.js
Last active December 16, 2016 22:40
express server rendering nutritionix fooditem JSON response after request-promise request
var express = require('express')
var rp = require('request-promise')
var bodyParser = require("body-parser");
var app = express()
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
@adg29
adg29 / README.md
Created September 21, 2016 19:13 — forked from veltman/README.md
Smoother polygon transitions

Smooth transitioning US tour in the same vein as this example. Steps:

  1. Compares both shapes and adds evenly-spaced points to whichever polygon has fewer so that both have the same number of points
  2. Picks the winding of the first polygon that minimizes the sum of the squared distances between point pairs

Some possible improvements:

  • Adding additional points to both shapes first such that every segment longer than a certain distance is bisected
  • Tweaking the placement of added points with simulated annealing
  • Using a cost function that factors in self-intersections at the halfway mark in addition to distance traveled
@adg29
adg29 / tdf-2015-stage-1-top10.csv
Created September 7, 2016 21:29
TDF 2015 Stage Top 10 Results Data
Rank Rider Team Time Seconds Time Label
1 Rohan Dennis (AUS) BMC Racing Team 0 14' 56"
2 Tony Martin (GER) Etixx–Quick-Step 5 + 5"
3 Fabian Cancellara (SUI) Trek Factory Racing 6 + 6"
4 Tom Dumoulin (NED) Giant–Alpecin 8 + 8"
5 Jos Van Emden (NED) LottoNL–Jumbo 15 + 15"
6 Jonathan Castroviejo (ESP) Movistar Team 23 + 23"
7 Matthias Brandle (AUT) IAM Cycling 23 + 23"
8 Adriano Malori (ITA) Movistar Team 29 + 29"
9 Wilco Kelderman (NED) LottoNL–Jumbo 30 + 30"
@adg29
adg29 / concat.js
Created August 22, 2016 21:17
Concat Handlebars helper
module.exports.register = function (Handlebars, options) {
Handlebars.registerHelper('concat', function() {
var outStr = '';
for(var arg in arguments){
if(typeof arguments[arg]!='object'){
outStr += arguments[arg];
}
}
return outStr;
@adg29
adg29 / README.md
Last active July 26, 2016 15:29 — forked from monfera/.block
circinus

Playing with reusing d3.geo for plotting. Subsequent example: http://bl.ocks.org/monfera/11085004

Mike Bostock and Jason Davies have added cool geo features, some of which can be of interest for regular data plotting too (most of which not covered in this example):

  1. The use of projections to easily change between Cartesian, polar, spiral, etc. plots
  • d3.geo supports spherical projections; this example projects a sphere-bound spiral
  1. Traditional, but data-intensive plots can benefit from adaptive resampling and line simplification
<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="StravaGPX" version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<trk>
<name>Tour de France - Etape 20... MAGIQUE!</name>
<trkseg>
<trkpt lat="45.2027360" lon="6.6691160">
<ele>0.0</ele>
</trkpt>
<trkpt lat="45.2027360" lon="6.6691160">
<ele>1061.0</ele>
@adg29
adg29 / JSONToCSVConvertor.js
Created May 31, 2016 19:21
JSONToCSVConvertor
function JSONToCSVConvertor(JSONData, ReportTitle, ShowLabel) {
//If JSONData is not an object then JSON.parse will parse the JSON string in an Object
var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;
var CSV = '';
//Set Report title in first row or line
CSV += ReportTitle + '\r\n\n';
//This condition will generate the Label/Header