Skip to content

Instantly share code, notes, and snippets.

function unfold(arr) {
var result = [];
arr.forEach(function(elem, i) {
if ( elem instanceof Array) {
intermediate = unfold(elem);
result = result.concat(intermediate)
return
}
result.push(elem);
})
@devsergiy
devsergiy / docker-cleanup-resources.md
Created May 22, 2018 11:32 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@devsergiy
devsergiy / rdoc-example.rb
Created December 17, 2015 22:15 — forked from nicholasjhenry/rdoc-example.rb
RDoc Example
# * Style guide based on Rails documention
module Namespace #:nodoc: don't document this
# Generic Namespace exception class
class NamespaceError < StandardError
end
# Raised when...
class SpecificError < NamespaceError
end

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

@devsergiy
devsergiy / Rakefile
Created August 4, 2014 12:12 — forked from stas/Rakefile
#!/usr/bin/env rake
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec => :dummy_app) do |t|
t.pattern = File.expand_path('../spec/**/*_spec.rb', __FILE__)
end
task :default => :spec
desc 'Generates a dummy app for testing'
task :dummy_app => [:setup, :migrate]
App.AccountEditRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', this.get('currentUser'));
}
});
#place this in config/locales/translit.rb
# encoding: utf-8
# I18n transliteration delegates to Russian::Transliteration (we're unable
# to use common I18n transliteration tables with Russian)
#
# Правило транслитерации для I18n использует Russian::Transliteration
# (использовать обычный механизм и таблицу транслитерации I18n с
# русским языком не получится)