Skip to content

Instantly share code, notes, and snippets.

View rictorres's full-sized avatar
💅
startuppin'

Ricardo Torres rictorres

💅
startuppin'
View GitHub Profile
// Simplest Lambda URL test
package main
import (
"context"
"fmt"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
IGNORE_FILE=$([ -f .eslintignore ] && echo ".eslintignore" || echo ".gitignore")
ESLINT_REPORT=$(echo "npx eslint . --cache=true --ignore-path=$IGNORE_FILE -f json || true")
echo $ESLINT_REPORT
@rictorres
rictorres / check-deps.js
Created March 1, 2019 16:23
check deps ("success" exit code)
const npmCheck = require('npm-check')
const chalk = require('chalk')
const stripAnsi = require('strip-ansi')
const _flatten = require('lodash.flatten')
const _compact = require('lodash.compact')
const table = require('text-table')
const emoji = require('node-emoji')
function uppercaseFirstLetter(str) {
return str[0].toUpperCase() + str.substr(1)

JavaScript to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in JavaScript and Rust so that programmers most comfortable with JavaScript can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

JavaScript:

@rictorres
rictorres / letsencrypt_2018.md
Created June 18, 2018 20:45 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

'use strict'
const crypto = require('crypto')
/**
* Do a constant time string comparison. Always compare the complete strings
* against each other to get a constant time. This method does not short-cut
* if the two string's length differs.
*
* @param {string} a
@rictorres
rictorres / free-ssl.md
Last active April 14, 2017 12:55
getting ssl with certbot

Free SSL with Certbot on Ubuntu

1. install certbot

sudo add-apt-repository ppa:certbot/certbot

2. obtain a cert

certbot certonly --standalone --email EMAIL -d example.com -d www.example.com
@rictorres
rictorres / composition.js
Created September 19, 2016 19:16
Inheritance vs. Composition
/**
* position trait
*/
const position = (state) => ({
setPosition (x, y) {
state.x = x
state.y = y
}
})
@rictorres
rictorres / Preferences.sublime-settings.json
Created July 14, 2016 09:27
My Sublime Text Preferences
{
"always_show_minimap_viewport": true,
"color_scheme": "Packages/Dracula Color Scheme/Dracula.tmTheme",
"default_encoding": "UTF-8",
"default_line_ending": "unix",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": false,
"file_exclude_patterns":
[
".DS_Store",
// go to http://marak.com/faker.js/
var employees = [];
for (var i = 1; i <= 50; i++) {
var firstName = faker.name.firstName();
var lastName = faker.name.lastName();
employees.push({
id: i,