Skip to content

Instantly share code, notes, and snippets.

View andrielfn's full-sized avatar
🏠
Working from home

Andriel Nuernberg andrielfn

🏠
Working from home
View GitHub Profile
@andrielfn
andrielfn / compare_bike_view.ex
Created April 13, 2019 14:20
Bike comparison with Phoenix Live View
defmodule GoBikesWeb.CompareSelectBikeView do
use Phoenix.LiveView
alias GoBikesWeb.Router.Helpers, as: Routes
alias GoBikes.Bikes
def render(assigns) do
GoBikesWeb.CompareView.render("show.html", assigns)
end
@andrielfn
andrielfn / nginx.conf
Created February 12, 2017 20:11
Best Nginx config for security.
# Best Nginx configuration for security.
#
# Score A in https://securityheaders.io.
# Score A+ in https://www.ssllabs.com/ssltest.
#
# References
#
# - https://letsecure.me/secure-web-deployment-with-lets-encrypt-and-nginx/
# - https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
# - https://gist.github.com/plentz/6737338
@andrielfn
andrielfn / .scss-lint.yml
Last active January 24, 2017 00:44
The structure that I use to start new front-end projects. Download only the `frontend-init` and run it on your terminal. :)
# This is the lint file for .scss files. It uses https://github.com/causes/scss-lint
# to search through .scss files and point out errors.
# You can view these errors in your editor.
#
# Here's a link to all the default configurations
# https://github.com/causes/scss-lint/blob/master/config/default.yml
# below is our settings.
linters:
BangFormat:

Rails Performance

Upgrade the Ruby version

Use Apache Benchmark (ab) to perform tests over each Ruby version.

Database

There are two mainly ways to do that:

@andrielfn
andrielfn / settings.json
Created April 18, 2016 00:37
ST3 Afterglow theme config
{
"auto_complete": true,
"auto_complete_selector": "source - comment",
"auto_indent": true,
"bold_folder_labels": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Colorsublime - Themes/Afterglow.tmTheme",
"detect_indentation": true,
"draw_indent_guides": true,
"enable_tab_scrolling": false,
@andrielfn
andrielfn / settings.json
Created December 4, 2015 17:34
My Sublime Text 3 config file.
{
"auto_complete": true,
"auto_complete_selector": "source - comment",
"auto_indent": true,
"bold_folder_labels": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Theme - Cobalt2/cobalt2.tmTheme",
"detect_indentation": true,
"draw_indent_guides": true,
"enable_tab_scrolling": false,
@andrielfn
andrielfn / main.go
Created June 16, 2015 00:47
UDP socket in Go.
package main
import (
"fmt"
"net"
"os"
)
/* A Simple function to verify error */
func CheckError(err error) {
@andrielfn
andrielfn / populate.go
Created April 28, 2015 16:24
Script to populate MySQL databases up to the *size-limit*. OS X binary download: https://www.dropbox.com/s/2gecxhqkxa7wpmq/bombsql?dl=0.
package main
import (
"database/sql"
"fmt"
"log"
"os"
"strconv"
_ "github.com/go-sql-driver/mysql"
@andrielfn
andrielfn / ssh.go
Created November 15, 2014 04:35
Go lang SSH connection
package main
import (
"bytes"
"code.google.com/p/go.crypto/ssh"
"fmt"
"io/ioutil"
"os"
)
@andrielfn
andrielfn / sublime-text.json
Last active August 29, 2015 13:58
Sublime Text configuration.
{
"auto_complete": true,
"auto_complete_selector": "source - comment",
"auto_indent": true,
"bold_folder_labels": true,
"detect_indentation": true,
"draw_white_space": "all",
"enable_tab_scrolling": false,
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":