Skip to content

Instantly share code, notes, and snippets.

View galetahub's full-sized avatar

Igor Galeta galetahub

View GitHub Profile
@galetahub
galetahub / mail_domain.conf
Created March 23, 2018 12:49
Nginx mailer
server {
listen <%= @config[:ip] %>:80;
server_name <%= @config[:domain] %>;
server_tokens off;
location ~ /.well-known {
proxy_pass http://127.0.0.1:9797;
}
location / {
@galetahub
galetahub / nginx.conf
Last active September 26, 2022 10:00
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
server {
listen [::]:80;
server_name domain.tld www.domain.tld;
# Redirect all non-https requests
rewrite ^ https://$host$request_uri? permanent;
}
server {
listen [::]:443 ssl http2;
$ = jQuery
$.fn.extend({
gmap: (options) ->
el = this.data("gmap")
return el if el?
$(this).each((input_field) ->
el = new Gmap(this, $(this).data())
@galetahub
galetahub / translate.rb
Last active August 29, 2015 13:57
MongoId translates
module Adriano
module Translate
extend ::ActiveSupport::Concern
module ClassMethods
attr_accessor :translated_fields
def translates(*args)
self.translated_fields = *args
@galetahub
galetahub / phone_number.rb
Created July 1, 2011 10:16
Phone numbers parser
# PhoneNumber parser
# Example:
# p = PhoneNumber.new('+380971265128')
# => #<PhoneNumber:0xb37b404 @value="380971265128", @locale=:uk, @pattern=[38, "097", ["126", "51", "28"]]>
# p.valid?
# => true
# p.to_s
# => "38 (097) 126-51-28"
# p.to_s(:prefix => true)
# => "+38 (097) 126-51-28"