Skip to content

Instantly share code, notes, and snippets.

@z3tt
z3tt / github.R
Last active October 11, 2024 07:26
Configure GitHub for Rstudio
#### 1. Sign up at GitHub.com ################################################
## If you do not have a GitHub account, sign up here:
## https://github.com/join
# ----------------------------------------------------------------------------
#### 2. Install git ##########################################################
## If you do not have git installed, please do so:
@steadyfish
steadyfish / dplyr_functions_programmatic_use.R
Last active October 12, 2020 09:27
using dplyr functions programmatically
# using dplyr finctions in non-interactive mode
# examples
library(plyr)
library(dplyr)
d1 = data_frame(x = seq(1,20),y = rep(1:10,2),z = rep(1:5,4))
head(d1)
#### single table verbs ####
stat_smooth_func <- function(mapping = NULL, data = NULL,
geom = "smooth", position = "identity",
...,
method = "auto",
formula = y ~ x,
se = TRUE,
n = 80,
span = 0.75,
fullrange = FALSE,
level = 0.95,
@jennybc
jennybc / r-fcsn-in-wild-search.md
Last active January 6, 2020 08:09
Search for "natural" usage of a function across all CRAN packages

What if a function in a package has no examples? Or is poorly exampled? Wouldn't it be nice to find functioning instances of it "in the wild"?

Via Twitter, Noam Ross taught me a clever way to do such searches on GitHub. Put this into the GitHub search box to see people using the llply() function from plyr:

"llply" user:cran language:R

Or just click here.

@lyzidiamond
lyzidiamond / maptime-onboarding.md
Last active May 1, 2019 18:52
Maptime Onboarding!

What time is it? It's onboarding time!

Hi! This is a document with everything you need to know about getting started with your Maptime chapter. Please read through it carefully and respond with any information we've asked for. Thanks! We're so happy to have you!

About MaptimeHQ

MaptimeHQ includes Beth Schechter, Lyzi Diamond, Alan McConchie and Camille Teicheira. All of us are available to help get your chapter onboarded, so don't hesitate to reach out! You can also reach all four of us at hello@maptime.io.

@konklone
konklone / apis-workshop.md
Last active May 2, 2016 05:35
Notes for an "Intro to APIs" workshop.

Intro to APIs - March 4-5, 2016

An introduction to working with URLs, JSON, APIs, and open data -- without writing any code.

URL of this document: bit.ly/intro-to-apis

You will need

  • A laptop, with a working connection to the public Internet.
  • A recent version of Firefox or Chrome.
@andrewxhill
andrewxhill / AlaskaHawaiiShift.sql
Last active January 3, 2016 09:09
Moving Alaska and Hawaii in CartoDB
-- The SQL below was used to tweak a normal dataset of the USA. If you want to download the
-- already modified version, head over to,
-- https://andrew.cartodb.com/tables/cd113_01_shift/map
--Alaska, move and rotate
UPDATE cd113_01_shift SET the_geom = ST_Transform(ST_Scale(ST_Translate(the_geom_webmercator,-13000000,-4000000),0.5,0.5),4326) WHERE statefp='02';
UPDATE cd113_01_shift SET the_geom = ST_Transform(ST_Rotate(the_geom_webmercator,pi()/8,-16500000,2800000),4326) WHERE statefp='02'
--Hawaii, shift right and scale
UPDATE cd113_01_shift SET the_geom = ST_Multi(ST_Transform(ST_Scale(ST_Translate(the_geom_webmercator,-6000000,3000000), 0.5, 0.5),4326)) WHERE statefp='15'
@vdavez
vdavez / docx2md.md
Last active June 17, 2024 19:40
Convert a Word Document into MD

Converting a Word Document to Markdown in Two Moves

The Problem

A lot of important government documents are created and saved in Microsoft Word (*.docx). But Microsoft Word is a proprietary format, and it's not really useful for presenting documents on the web. So, I wanted to find a way to convert a .docx file into markdown.

The Solution

As it turns out, there are several open-source tools that allow for conversion between file types. Pandoc is one of them, and it's powerful. In fact, pandoc's website says "If you need to convert files from one markup format into another, pandoc is your swiss-army knife." But, although pandoc can convert from markdown into .docx, it doesn't work in the other direction.

@skorasaurus
skorasaurus / Osm_Terms.md
Last active March 20, 2016 19:58
OpenStreetMap cheat sheet for Common terms and lexicon used in OSM. [assuming node, line, and polygon is covered in the presentation itself)

Changeset: A group of changes that you made to OSM data. Once uploaded to OSM, your edits are instantly available to others if they download OSM data. They may take a few minutes or several hours to appear on the map.

Extract: A large chunk of OSM data for a specific area (like a state, country, or geographic area).

Layer: A data source that's displayed on a slippy map (often is thought of as a group of tiles stitched together). (It also has another meaning in OSM, but don't worry about it right now).

Render: to convert from the OSM data into an image. Rendered data is a map.

Stylesheet: it means a text file of rules that define what features (like roads, buildings) are displayed, and how (what color should the road be ? How wide should be? What icon should be used for a restaurant?) on a map.

@tmcw
tmcw / mapcss_cartocss_cascadenik.md
Created December 17, 2012 16:33
MapCSS vs CartoCSS

In which I begrudglingly compare MapCSS and CartoCSS because people keep asking.

I hate this kind of writing - it's annoying to try to describe one bit of software versus another, and this can and will fall out of date every time that somebody makes a big change to their library. But people want it, or whatever, so here it is.

Since CartoCSS and Cascadenik are weird cousins, the big difference is between them and MapCSS.

Let's see, differences:

  • CartoCSS is designed for Mapnik. That is, it tries to expose every possible Mapnik style option and ability, and supports every Mapnik datasource.
  • MapCSS is designed for OSM. That is, it makes it easy to style based on OpenStreetMap data types, tags, and so on.