Skip to content

Instantly share code, notes, and snippets.

Leonid Shevtsov leonid-shevtsov

Block or report user

Report or block leonid-shevtsov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
# Put in $PATH/git-pr; chmod +x
# Call with `git pr` to open a compare view for the current branch and a pull request from that
# Depends on
hub compare dev..`git rev-parse --abbrev-ref HEAD`
View leproimages.js
//Ctrl+C, Ctrl+V в адресную строку
javascript:els=$$('#js-commentsHolder div.dt img');$(document.body).empty();els.each(function(el) { el.set('styles',{display:'block'});el.inject($(document.body)); });
View editor.js
function quote_sel(username)
element = document.getElementById('post_text');
if (window.getSelection) {
var str = window.getSelection();
} else if (document.selection && document.selection.createRange) {
var range = document.selection.createRange();
var str = range.text;
} else {
alert("К сожалению, Ваш браузер не поддерживает эту функцию");
View lighthouse-post-receive-hook.rb
#!/usr/bin/env ruby
# Lighthouse + Git
# post-receive hook
LIGHTHOUSE_TOKEN = 'owner token here (the default one)'
LIGHTHOUSE_ACCOUNT = 'account (the subdomain)'
LIGHTHOUSE_PROJECT = 'project id (look in /projects/[id])'
# Store individual user tokens here.
# They are required so that changesets are mapped to the correct Lighthouse username
View rescue.erb
<% environments_to_check = ['staging', 'production' ] %>
<script type="text/javascript">
var Hoptoad = {
host : <%= host.to_json %>,
api_key : <%= api_key.to_json %>,
notice : <%= notice.to_json %>,
checkEnvironment : function(environment) {
View cache_title.rb
# put this into yer initializers
# class Ad < ActiveRecord::Base
# belongs_to :city
# belongs_to :color
# cache_title :city, :color
# end
# then Ad.first.city_title
View VirtualBox.ini
Env = - 2.0.50727.4927.Microsoft Windows NT 6.1.7600.0
Target = Windows XP Home Edition SP3 - 5.1.2600.5512 - English (United States)
Remove Components
Create a Bootable ISO
View ssh_to_putty.rb
#!/usr/bin/env ruby
require 'etc'
windows_keyfile_dir = "D:\\users\\leonid\\keys\\"
keyfile_dir = File.expand_path('~/putty_keys')
puttygen = `which puttygen`.strip
default_ssh_port = 22
default_user =
View _visitor.rb
require 'ipaddr'
# This is a class that tracks visits on a site internally.
# One of the major demands was determining where the visitor came from.
class Visitor < ActiveRecord::Base
validates_presence_of :entry_uri
validates_presence_of :exit_uri
validates_presence_of :ip
def self.recognizes_source(source_name, options = nil)
View git-ls.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'active_support/core_ext'
pattern = ARGV[0]
pattern += "/*"
You can’t perform that action at this time.