Skip to content

Instantly share code, notes, and snippets.

View vadimstroganov's full-sized avatar

Vadim Stroganov vadimstroganov

  • Saint-Petersburg, Russia
View GitHub Profile
@ajdruff
ajdruff / fix-git-line-endings
Last active September 22, 2024 20:46
Forces all line endings to LF in your git repo.
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF
@davydovanton
davydovanton / operations.md
Last active June 25, 2020 09:31
Operations

Пример из pepegramming канала

Задача

Есть экшен в рельсе, который создает инвойс:

def create
  invoice = Invoice.new(params[:invoice])

 if invoice.save
@nalgeon
nalgeon / socrbase.md
Last active March 19, 2022 11:36
Типы адресных объектов в ФИАС
@andreibosco
andreibosco / creative-cloud-disable.md
Last active August 29, 2024 03:27
disable creative cloud startup on mac
@DianaEromosele
DianaEromosele / Change "origin" of your GIT repository
Created August 7, 2016 00:31
Change "origin" of your GIT repository
$ git remote rm origin
$ git remote add origin git@github.com:aplikacjainfo/proj1.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
@peterhellberg
peterhellberg / gateway_deploy.rb
Created December 17, 2014 16:24
Capistrano deploy via gateway host
set :user, 'username'
set :gateway, 'example.com'
set :ssh_options, {
user: fetch(:user),
forward_agent: false,
proxy: Net::SSH::Proxy::Command.new(
"ssh -l #{fetch(:user)} #{fetch(:gateway)} -W %h:%p"
)
}
@buntine
buntine / deploy.rb
Created July 14, 2014 01:36
Rails 4, Capistrano 3.2.1+ local precompilation using rsync
# Clear existing task so we can replace it rather than "add" to it.
Rake::Task["deploy:compile_assets"].clear
desc "Precompile assets locally and then rsync to web servers"
task :compile_assets do
on roles(:web) do
rsync_host = host.to_s
run_locally do
with rails_env: :production do ## Set your env accordingly.
@soheilhy
soheilhy / nginxproxy.md
Last active September 19, 2024 06:16
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

require 'nokogiri'
require 'open-uri'
# Get a Nokogiri::HTML:Document for the page we're interested in...
doc = Nokogiri::HTML(open('http://www.google.com/search?q=tenderlove'))
# Do funky things with it using Nokogiri::XML::Node methods...
####
@basti
basti / application.rb
Last active March 1, 2021 10:42 — forked from keighl/application.rb
Local Rails 4 assets precompilation using Capistrano 3 and rsync
# Speed things up by not loading Rails env
config.assets.initialize_on_precompile = false