Skip to content

Instantly share code, notes, and snippets.

@KELiON
KELiON / migrate.md
Created April 23, 2019 08:24
How to migrate to new mac

Old mac

  • Install dropbox
  • Install mackup: https://github.com/lra/mackup
  • Sync app settings using mackup and dropbox
  • Copy all .env files from all projects to envs file
File.open('./envs', 'w+') do |f|
  `find ./*/.env`.split("\n").each do |path|
class ApplicationController < ActionController::Base
before_action :authenticate!
end
@KELiON
KELiON / test hidden.md
Created May 16, 2017 13:35
test hidden
Click to toggle

Summary for hidden text

@KELiON
KELiON / test.md
Created March 28, 2017 14:23
test

After discussion of rocket -> messaging integration we found 3 directions of work:

faast client

We should implement unload/unmount/whatever function, that removes all added elements. It should be something like:

faast(...).then(sloow => {
  // calling sloow will remove all added <script> and <link> tags
})
@KELiON
KELiON / xss-test.js
Created June 21, 2016 09:01
xss-test.js
window.alert('TEST');
@KELiON
KELiON / alfred.md
Last active December 20, 2015 12:24
Tools

Первое, без чего я уже не могу работать — alfred. Кроме запуска программ я в нем ищу файлы/папки, т.к. finder тупой: Постоянно использую clipboard history:

В сниппетах у меня сохранены какие-то линуксовые команды, которые я никак не могу запомнить, смайлы (╯°□°)╯︵ ┻━┻ и ¯_(ツ)_/¯ (не запоминать же их)

Из плагинов постоянно использую:

@KELiON
KELiON / gist:6a4e8bb5ca06d1097153
Created August 13, 2014 09:56
Default date parsing with locale
module ActiveRecord
module ConnectionAdapters
class Column
class << self
protected
def fallback_string_to_date(string)
format = I18n.t("date.formats.default")
date = begin
::Date._strptime(string, format)
rescue
@KELiON
KELiON / application.rb
Created July 16, 2014 09:45
Compile all assets from roots
# Precompile all JS/CSS in root of app/assets/stylesheets and app/assets/javascripts
config.assets.precompile +=
Dir[::Rails.root.join('app/assets/*/*.{js,css,coffee,sass,scss}*')].
map { |i| File.basename(i).sub(/(\.js)?\.coffee$/, '.js') }.
map { |i| File.basename(i).sub(/(\.css)?\.(sass|scss)$/, '.css') }.
reject { |i| i =~ /^application\.(js|css)$/ }
@KELiON
KELiON / fish_prompt.fish
Last active September 17, 2021 21:11
Fish-fish shell prompt with ruby version and git info
function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null)
end
function _rb_prompt
echo (rbenv version | awk '{print $1}')
@KELiON
KELiON / gist:4562940
Created January 18, 2013 07:31
Google analytics: track page view
var trackPageView = function(url) {
if (typeof _gat === 'undefined') {
_gaq.push(['_setAccount', googleAccountId]);
_gaq.push(['_trackPageview', url]);
} else {
var pageTracker = _gat._getTracker(googleAccountId);
pageTracker._trackPageview(url);
}
};