Skip to content

Instantly share code, notes, and snippets.

@MrTin
MrTin / fix-libv8-mac.txt
Last active February 19, 2019 12:57 — forked from fernandoaleman/fix-libv8-mac.txt
Fixing libv8 and therubyracer on Mac
brew tap homebrew/versions
brew install v8-315
gem install libv8 -v '3.16.14.15' -- --with-system-v8
gem install therubyracer -v '0.12.2' -- --with-v8-dir=/usr/local/opt/v8@3.15
bundle
@MrTin
MrTin / async.js
Created March 9, 2018 15:45 — forked from bschwartz757/async.js
Async/await function to fetch data from multiple URLs in parallel
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
// parse results as json; fetch data response has several reader methods available:
//.arrayBuffer()
@MrTin
MrTin / Gemfile
Last active June 2, 2017 15:18 — forked from jrgifford/Gemfile
Using Amazon Elasticsearch securely (signed requests) with Rails & searchkick gem on Heroku.
gem 'elasticsearch', '>= 1.0.15'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
gem 'patron'
gem 'faraday_middleware-aws-signers-v4'
gem 'searchkick'
@MrTin
MrTin / install-comodo-ssl-cert-for-nginx.rst
Created December 27, 2016 01:11 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@MrTin
MrTin / Elixir Email Validation
Created March 13, 2016 00:44 — forked from mgamini/Elixir Email Validation
Elixir Email Validation
defmodule EmailValidator do
# ensure that the email looks valid
def validate_email(email) when is_binary(email) do
case Regex.run(~r/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/, email) do
nil ->
{:error, "Invalid email"}
[email] ->
try do
Regex.run(~r/(\w+)@([\w.]+)/, email) |> validate_email
#!/bin/bash
#
# Install nginx on Debian.
# Expects to be run as root.
#
# Author : Scott Barr
# Date : 7 Jan 2010
#
VERSION=0.8.54