Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
lbvf50mobile / default
Created January 6, 2017 10:07
nginx puma rails_app
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
Жила-была курица. И решила она вступить в мафию.
Пошла курица к самому главному мафиози, к суровому дону, и говорит:
хочу в мафию! А дон ей отвечает: нет никакой мафии.
Тогда курица пошла к советнику дона, консильери, и попросила принять
ее в мафию. Но консильери ответил курице: нет никакой мафии.
Тогда курица пошла к капитану мафии и попросилась к нему солдатом.
Но капитан сказал курице: нет никакой мафии.
Курица загрустила и побрела к себе курятник.
А там к ней прибежали курицы-подружки и засыпали ее вопросами.
На все вопросы курица отвечала: нет никакой мафии...
@lbvf50mobile
lbvf50mobile / about_hashes.rb
Created January 18, 2017 13:42
ruby_koans_hashes
require File.expand_path(File.dirname(__FILE__) + '/neo')
class AboutHashes < Neo::Koan
def test_creating_hashes
empty_hash = Hash.new
assert_equal __, empty_hash.class
assert_equal(__, empty_hash)
assert_equal __, empty_hash.size
end
##
# Thursday 2016.07.15 21:22 http://vjuh-developer.livejournal.com/5319.html
# Monday 2017.01.23 19:14
# Start to create the configuration for my PUMA
# http://stackoverflow.com/questions/17450672/how-to-start-puma-with-unix-socket
##
upstream sitenumber1_app {
server unix:///tmp/sitenumber1.socket;
}
@lbvf50mobile
lbvf50mobile / Gemfile
Last active February 1, 2017 12:15
undrstanding assets pilline
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
@lbvf50mobile
lbvf50mobile / Category.rb
Created February 8, 2017 14:33
Category model that have self association.
class Category < ActiveRecord::Base
has_many :sub_cat, class_name: "Category",
foreign_key: "categoriable_id"
belongs_to :main_cat, class_name: "Category"
end
@lbvf50mobile
lbvf50mobile / ifelse.rb
Last active February 11, 2017 05:45
if_else using messages and objects
class TrueClass
def is_true
yield
self
end
def is_false
self
end
end
@lbvf50mobile
lbvf50mobile / 1.rb
Last active February 17, 2017 06:52
using require
$LOAD_PATH.unshift(File.dirname(__FILE__))
require "two"
require "two"
puts "It works."
@lbvf50mobile
lbvf50mobile / vscoderuby.sh
Created May 8, 2017 02:48
Pseudo bsh file to configure plugin in visual studio code (debug)
# https://github.com/rubyide/vscode-ruby/wiki/1.-Debugger-Installation
# This is configuration for rubyide/vscode https://github.com/rubyide/vscode-ruby
# Debugger
# An interface which glues ruby-debug to IDEs like Eclipse (RDT), NetBeans and RubyMine.
# https://rubygems.org/gems/ruby-debug-ide/versions/0.6.0
gem list ruby-debug-ide --remote
gem install ruby-debug-ide -v 0.6.0
gem list ruby-debug-ide --local
@lbvf50mobile
lbvf50mobile / index.html
Created July 11, 2017 15:10
fix atlas-free-responsive-parallax-html5
<!-- remove this lines --!>
<link href='http://fonts.googleapis.com/css?family=Raleway:400,500,600,700,800,300' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,500,600,700,800,300' rel='stylesheet' type='text/css'>