SSH into Root
$ ssh root@123.123.123.123
Change Root Password
defmodule FizzBuzz do | |
def start do | |
IO.inspect Enum.map(1..100, fizz_or_buzz) | |
end | |
def fizz_or_buzz(n) do | |
cond do | |
rem(n,15) == 0 -> "FizzBuzz" | |
rem(n,5) == 0 -> "Buzz" |
require 'roo' | |
module ExcelValidator | |
class Cause | |
#EXCEL_COLUMN_NAMES = ['NOMBRE DEL CLIENTE', 'ASUNTO', 'CODIGO DE LA CAUSA', 'JUZGADO', 'MATERIA', 'CODIGO', 'PERSONAS INVOLUCRADAS EN LA CAUSA'] | |
# column_names = { id: 'NOMBRE DEL CLIENTE', .... } | |
class << self | |
def manage_file(file, **column_names) | |
@column_names = column_names | |
case File.extname(file.original_filename) |
git log --numstat --pretty="%H" --author=$1 | grep -v "public/" | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}' |
SSH into Root
$ ssh root@123.123.123.123
Change Root Password
As your business logic gets complex you may need to implement transactions. The classic example is a bank funds transfer from account A to account B. If the withdrawal from account A fails then the deposit to account B should either never take place or be rolled back.
All the complexity is handled by ActiveRecord::Transactions
. Any model class or instance has a method named .transaction
. When called and passed a block, that block will be executed inside a database transaction. If there's an exception raised, the transaction will automatically be rolled back.
morse_dict = Hash.new({ | |
"a" => ".-", | |
"b" => "-...", | |
"c" => "-.-.", | |
"d" => "-..", | |
"e" => ".", | |
"f" => "..-.", | |
"g" => "--.", | |
"h" => "....", | |
"i" => "..", |
require 'bundler/capistrano' | |
set :application, "net" | |
set :repository, "git@githost.com:net.git" | |
set :scm, :git | |
set :default_environment, { | |
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" | |
} |
# Tell system when Xcode utilities live: | |
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer | |
# Set "opendiff" as the default mergetool globally: | |
git config --global merge.tool opendiff |
#!bin/bash | |
if [ -z "$1" ]; then | |
echo "Debes ingresar el nombre del proyecto o directorio" | |
exit 1 | |
else | |
if [ -e "$1" ]; then | |
echo "El Directorio $1 ya existe" | |
exit 1 | |
fi |