Skip to content

Instantly share code, notes, and snippets.

View Rub21's full-sized avatar
๐Ÿ•

Ruben L. Mendoza Rub21

๐Ÿ•
View GitHub Profile
@Rub21
Rub21 / python_environment_setup.md
Created January 17, 2018 14:37 — forked from wronk/python_environment_setup.md
Setting up your python development environment (with pyenv, virtualenv, and virtualenvwrapper)

Overview

When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. That way you can keep each project in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. This intermediate guide covers one way to handle multiple Python versions and Python environments on your own (i.e., without a manager like Anaconda). See the Using the workflow section to view the end result.

Use cases

  1. Working on 2+ projects that each have their own dependencies; e.g., a Python 2.7 project and a Python 3.6 project, or developing a module that needs to work across multiple versions of Python. It's not reasonable to uninstall/reinstall modules every time you want to switch environments.
  2. If you want to execute code on the cloud, you can set up a Python environment that mirrors the relevant cloud
@Rub21
Rub21 / README.md
Created December 11, 2017 16:18 — forked from danswick/README.md
Mapbox GL JS labels on top of radar raster

A Mapbox GL JS demo that creates a layer from a third-party tiles source and draws it below the Mapbox Style's label layers. Layers in the Mapbox GL Style Spec draw in the order in which they're listed in the layers array.

Look for the following in the style JSON below:

"sources": {
        "mapbox": {
            "url": "mapbox://mapbox.mapbox-streets-v7",
            "type": "vector"
 }, 
@Rub21
Rub21 / slugify.js
Created September 27, 2017 04:50 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@Rub21
Rub21 / node-folder-structure-options.md
Created September 18, 2017 02:33 — forked from lancejpollard/node-folder-structure-options.md
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@Rub21
Rub21 / 01-directory-structure.md
Created September 18, 2017 02:30 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@Rub21
Rub21 / index.html
Last active January 17, 2017 17:10 — forked from tmcw/index.html
tomar imagen del mapa.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Leaflet Image</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.0.1/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@Rub21
Rub21 / index.html
Created January 15, 2017 15:05 — forked from danswick/index.html
save from leaflet draw
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Demo</title>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
<!--Add mapbox.js -->
@Rub21
Rub21 / node-and-npm-in-30-seconds.sh
Last active July 13, 2016 21:05 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/v4.4.7/node-v4.4.7.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
wget https://www.npmjs.org/install.sh | sh
chmod +x install.sh
@Rub21
Rub21 / node-on-ec2-port-80.md
Created March 30, 2016 13:17 — forked from kentbrew/node-on-ec2-port-80.md
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);