Skip to content

Instantly share code, notes, and snippets.

@litvil
litvil / deploy.rake
Created May 10, 2016 15:01 — forked from amejiarosario/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app, tail logs, ps, and more!
# rake deploy # Push app to heroku:production, migrate, restarts and tail logs
# rake deploy:production # Push app to production, migrate, restarts, tag and tail logs
# rake deploy:production:config # production config
# rake deploy:production:console # production console
# rake deploy:production:logs # production logs
# rake deploy:production:ps # production ps
# rake deploy:production:releases # production releases
# rake deploy:staging # Push app to staging, migrate, restarts, tag and tail logs
# rake deploy:staging:config # staging config
# rake deploy:staging:console # staging console
@litvil
litvil / center-in-div.scss
Created August 17, 2016 14:46
center content horizontaly and verticaly
.cnt-top{
display: table;
height: 100%;
width: 100%;
text-align: center;
.cnt-middle{
display: table-cell;
vertical-align: middle;
.cnt-inner{
margin-left: auto;
@litvil
litvil / gist:32c5e3bd113fc198e536f27891d8f82c
Last active December 15, 2016 15:11
GIT: list all brunches sorted by age
git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
AES is a block-level algorithm. So when data encrypted it is padded. So you can calculate the length of the result string using this formula:
1
16 × (trunc(string_length / 16) + 1)
So if your address field structure is = VARCHAR(100) ; //100 length of varchar
Then before your encryption it should be converted
= 16 * (trunc(100/ 16) + 1)
= 16 * (6.25 + 1)
= 16 * 7.25
= 116
Git Tips & Tricks
Add your best Git tricks here!
Share the love!
The "I can never remember that alias I set" Trick
[alias]
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /' | sort
@litvil
litvil / gist:84662a0a4e50bee5a13f1626990ecc3c
Created March 27, 2017 02:04 — forked from bds/gist:2207826
Convert files from .scss to .sass
sass-convert -F scss -T sass application_styles.css.scss application_styles.css.sass
@litvil
litvil / Makefile
Created May 2, 2017 19:58
Databases with Vagrant in Docker containers
DB_USERNAME ?= dbuser
DB_PASSWORD ?= dbpass
BIND_HOST ?= 0.0.0.0
POSTGRESQL_IMAGE ?= postgres:9.6
POSTGRESQL_CONTAINER ?= upper-postgresql
POSTGRESQL_PORT ?= 5432
MYSQL_IMAGE ?= mysql:5.7
@litvil
litvil / macosx_remove_java9.sh
Created October 25, 2017 15:22 — forked from schnell18/macosx_remove_java9.sh
MacOS X remove Java 9
sudo rm -fr /Library/Java/JavaVirtualMachines/jdk-9.jdk/
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
@litvil
litvil / gist:c36071aa4a149ca84ad12d99fea0246c
Created April 13, 2018 18:18
AsyncConfiguration with custom timeout
package com.ruby.cms.comp.aggregator.util.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.annotation.AsyncConfigurer;