Skip to content

Instantly share code, notes, and snippets.

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

Denis Stepanov denstepa

👨‍💻
focusing
View GitHub Profile
http://cronus.allowed.org works for me, 2018.1.6
@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
@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"
git config remote.origin.push HEAD
<script type="text/javascript">
//<![CDATA[
var _flocktory = window._flocktory = _flocktory || [];
_flocktory.push({
'order_id': '10778083-0001',
'email': 'testmail@flocktory.com',
'name': 'denis ',
'price': '1400',
'items': [{
'id': '1',
1) О культуре написания кода очень хорошо здесь - http://www.amazon.com/The-Readable-Code-Theory-Practice/dp/0596802293
Есть море аналогов (которые я все перечитал), к примеру:
http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882
http://www.ozon.ru/context/detail/id/4187085/
Но "art of redable code" показался мне самым интересным изданием, как в плане содеражтельности, так и в плане оформления :)
2) Очень важно прочесть Фаулера и особенно его http://martinfowler.com/books/eaa.html
Если интересно, то про рефакторинг - http://martinfowler.com/books/refactoring.html, я честно скажу, там все идеи очень простые, поэтому бежать можно буквально по верхушкам и особо не вникать, потому что он там часто простые идеи описывает 5-ую страница текста.
/**
* ================== 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