Skip to content

Instantly share code, notes, and snippets.

View denstepa's full-sized avatar
👨‍💻
focusing

Denis Stepanov denstepa

👨‍💻
focusing
View GitHub Profile
@denstepa
denstepa / key.md
Created February 6, 2019 09:39
FREE IntelliJ IDEA key 2018.2!

READ or DIE

  • put 0.0.0.0 account.jetbrains.com into your hosts file (C:\Windows\System32\drivers\etc\hosts or /etc/hosts)
  • for GayOS macOS read that
  • use the key below
K71U8DBPNE-eyJsaWNlbnNlSWQiOiJLNzFVOERCUE5FIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiSUkiLCJwYWlkVXBUbyI6IjIwMTktMDUtMDQifSx7ImNvZGUiOiJSUzAiLCJwYWlkVXBUbyI6IjIwMTktMDUtMDQifSx7ImNvZGUiOiJXUyIsInBhaWRVcFRvIjoiMjAxOS0wNS0wNCJ9LHsiY29kZSI6IlJEIiwicGFpZFVwVG8iOiIyMDE5LTA1LTA0In0seyJjb2RlIjoiUkMiLCJwYWlkVXBUbyI6IjIwMTktMDUtMDQifSx7ImNvZGUiOiJEQyIsInBhaWRVcFRvIjoiMjAxOS0wNS0wNCJ9LHsiY29kZSI6IkRCIiwicGFpZFVwVG8iOiIyMDE5LTA1LTA0In0seyJjb2RlIjoiUk0iLCJwYWlkVXBUbyI6IjIwMTktMDUtMDQifSx7ImNvZGUiOiJETSIsInBhaWRVcFRvIjoiMjAxOS0wNS0wNCJ9LHsiY29kZSI6IkFDIiwicGFpZFVwVG8iOiIy
http://cronus.allowed.org works for me, 2018.1.6
@denstepa
denstepa / html_export.rb
Created October 7, 2016 16:13 — forked from bofrede/html_export.rb
Export Word documents as HTML
=begin
This script requires a Ruby intepeter to run:
http://rubyinstaller.org/
This script also requires Microsoft Windows and Microsoft Word to be installed.
A few libraries, used by this script:
HTML Sanitizer:
https://github.com/rgrove/sanitize/
@denstepa
denstepa / awk-example.sh
Created April 23, 2016 10:30 — forked from raecoo/awk-example.sh
awk/grep commands for Rails log analysis
# Access number
cat production.log | grep "^Processing" | wc | awk '{print $1}'
# Each IP access number
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq -c
# Independent IP number
cat production.log | grep "^Processing" | awk '{print $4}' | uniq | wc | awk '{print $1}'
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq | wc -l
@denstepa
denstepa / capistrano-robots.rb
Created March 1, 2016 23:47
capistrano 3 task to update robots.txt for staging
desc "Uploads a robots.txt that mandates the site as off-limits to crawlers"
task :block_robots do
content = [
'# This is a staging site. Do not index.',
'User-agent: *',
'Disallow: /'
].join($/)
on roles(:all) do
within release_path do
puts "Uploading blocking robots.txt"
/**
* ================== angular-ios9-uiwebview.patch.js v1.1.1 ==================
*
* This patch works around iOS9 UIWebView regression that causes infinite digest
* errors in Angular.
*
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular
* have the workaround baked in.
*
* To apply this patch load/bundle this file with your application and add a
@denstepa
denstepa / email_dots_validator.rb
Created September 14, 2015 11:49
rails - stop dots abuseing in emails
def no_dots_email_abuse
if User.where("(regexp_replace(users.email, '\\.', '', 'gi') LIKE ?)", email.gsub('.', '')).any?
errors.add(:email, 'is already taken. Please try another email.')
end
end
@denstepa
denstepa / nginx.conf
Last active August 29, 2015 14:27 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# A limitation to this method is that Nginx doesn't currently send headers
@denstepa
denstepa / deploy.rb
Last active August 29, 2015 14:26 — forked from andrey-skat/deploy.rb
Local assets precompilation on Rails 4 using Capistrano 3
# also you need to uncomment next line in Capfile
# require 'capistrano/rails/assets'
namespace :deploy do
namespace :assets do
Rake::Task['deploy:assets:precompile'].clear_actions
desc 'Precompile assets locally and upload to servers'
task :precompile do
/*
* Flatten Object @gdibble: Inspired by https://gist.github.com/penguinboy/762197
* input: { 'a':{ 'b':{ 'b2':2 }, 'c':{ 'c2':2, 'c3':3 } } }
* output: { 'a.b.b2':2, 'a.c.c2':2, 'a.c.c3':3 }
*/
var flattenObject = function(ob) {
var toReturn = {};
var flatObject;
for (var i in ob) {
if (!ob.hasOwnProperty(i)) {