Skip to content

Instantly share code, notes, and snippets.

View mpautasso's full-sized avatar

Mauricio Pautasso mpautasso

  • Freelance programmer
  • Río Cuarto, Argentina
View GitHub Profile
# frozen_string_literal: true
desc 'update existing engagements with direction'
task :update_direction_in_engagement, %i[tenant] =>
[:environment] do |_t, args|
logger = Logger.new(Rails.root.join('log', 'rake.log'))
logger.info 'UpdateDirectionInEngagement -- START'
Apartment::Tenant.switch(args[:tenant]) do
ActiveRecord::Base.connection.uncached do
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="rbates"
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="rbates"
# ~/.oh-my-zsh/custom/mauricio.plugin.zsh
########## My alias ##########
# up 'n' folders
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
# cp
[21] pry(#<Mandrill::CreateLocalMessageFromIncoming>)> headers
=> {
"Received"=>
["from NAM03-BY2-obe.outbound.protection.outlook.com (unknown [104.47.42.65]) by relay-5.us-west-2.relay-prod (Postfix) with ESMTPS id 5E94E26BBC for <mauricio-pautasso.people@rubylandia.getsynap.email>; Thu, 28 Jun 2018 20:05:48 +0000 (UTC)",
"from CY4PR08MB3432.namprd08.prod.outlook.com (10.171.253.149) by CY4PR08MB3464.namprd08.prod.outlook.com (10.171.253.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.20; Thu, 28 Jun 2018 20:05:46 +0000",
"from CY4PR08MB3432.namprd08.prod.outlook.com ([fe80::118e:ef5b:8352:e544]) by CY4PR08MB3432.namprd08.prod.outlook.com ([fe80::118e:ef5b:8352:e544%2]) with mapi id 15.20.0906.023; Thu, 28 Jun 2018 20:05:46 +0000"],
"Dkim-Signature"=>
"v=1; a=rsa-sha256; c=relaxed/relaxed; d=hyasrl.onmicrosoft.com; s=selector1-harriague-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M2yU3c8ht
upstream site_server {
server unix:/tmp/site.sock fail_timeout=0;
}
server {
listen 80;
server_name lottosend.sk, www.lottosend.sk;
return 301 $scheme://www.lottosend.com$request_uri;
}
Application.Hashtable
jQuery ->
class HashTable
constructor: (@obj) ->
@length = 0
@items = {}
for p of @obj
if @obj.hasOwnProperty(p)
@items[p] = @obj[p]
@length++
@mpautasso
mpautasso / admin_controller_decorator.rb
Created May 9, 2012 04:00
Open Refinery controllers
Refinery::AdminController.class_eval do
before_filter :restrict_refinery_to_refinery_users
private
def restrict_refinery_to_refinery_users
return if current_user && current_user.has_role?(:refinery)
redirect_to root_path #this user is not a refinery user because they have no refinery roles.
return false
end
@mpautasso
mpautasso / Gemfile
Created April 10, 2012 08:43
RefineryCMS integration with existing Rails 3.2.3
source 'https://rubygems.org'
gem 'rails', '3.2.3'
gem 'pg'
gem 'thin'
gem 'activeadmin'
# Add users roles management
gem 'cancan'
# Add IP reverse geocoding support
@mpautasso
mpautasso / pg_hba.conf
Created March 5, 2012 15:00
/etc/postgresql/8.4/main/pg_hba.conf
...
# Database administrative login by UNIX sockets
local all postgres ident
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections: