This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb | |
index 236eedd..eb35d3d 100644 | |
--- a/lib/bundler/resolver.rb | |
+++ b/lib/bundler/resolver.rb | |
@@ -291,6 +291,10 @@ module Bundler | |
end | |
end | |
+ local = matching_versions.reject { |mv| mv[0].class == Bundler::RemoteSpecification } | |
+ others = matching_versions - local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd ~/.ssh/ | |
$ touch config | |
$ subl -a config | |
Then added | |
#activehacker account | |
Host github.com-activehacker | |
HostName github.com | |
User git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* A simple jQuery-based Table of Contents generator | |
* I needed a table of contents for some static markdown pages I created | |
* with bluecloth and rails (I'll make this a gem yet) and this is the result. | |
* | |
* This is one of my first afternoon forays into jQuery so it probably isn't | |
* the greatest code I've ever written. I have fully annotated the code with | |
* comments for others to learn and understand. Remove them before use. | |
* | |
* Requires jQuery | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/image.rb | |
class Image < ActiveRecord::Base | |
has_many :taggings, :as => :taggable | |
has_many :tags, :through => :taggings | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CompiledJsBacktracer | |
def initialize(trace_arr, path, original_filename, ancor = '/*UNIQ_ANCOR_D6791*/', context_lines = 200) | |
@trace = trace_arr | |
@path = path | |
@original_fname = original_filename | |
@ancor = ancor | |
@context_lines = context_lines | |
end | |
def process |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require 'tempfile' | |
branch = ARGV.first || 'HEAD' | |
data = `git log --no-merges [email protected] --oneline master..#{branch}` | |
commits = data.split("\n").map { |s| s.scan(/\w+ /).first.strip } | |
patch = '' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var obj = JSON.parse('[[{"sort_index":0,"value":0,"title":"index"},{"sort_index":1,"value":"ezxczxcst","title":"tags"},{"sort_index":2,"value":"Rhozxczxcda","title":"name"},{"sort_index":3,"value":"Onezxcczxil","title":"lastName"},{"sort_index":4,"value":"A582978zxczxc6d114cb16e52a8959b","title":"passport"},{"sort_index":5,"value":"373 Kensizxcczx ngton Walk, Independence","title":"adress"}],[{"sort_index":0,"value":0,"title":"index"},{"sort_index":1,"value":"vbbest","title":"tags"},{"sort_index":2,"value":"zx Rhoda","title":"name"},{"sort_index":3,"value":"Oneil","title":"lastName"},{"sort_index":4,"value":"A582zxc9786d114cb16e52a8959b","title":"passport"},{"sort_index":5,"value":"373 Kenzxczxcsington Walk, Independence","title":"adress"}],[{"sort_index":0,"value":0,"title":"index"},{"sort_index":1,"value":"zxc zxcest","title":"tags"},{"sort_index":2,"value":"zxczxcRhoda","title":"name"},{"sort_index":3,"value":"Ozxczxcneil","title":"lastName"},{"sort_index":4,"value":"zxczxcA5829786d114cb16e52a8959b","title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function declOfNum(number, titles) { | |
var cases = [2, 0, 1, 1, 1, 2]; | |
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ]; | |
} | |
//usage: | |
var num = 15; | |
declOfNum(num, ['товар', 'товара', 'товаров']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/tasks/db.rake | |
namespace :db do | |
desc "Dumps the database to db/APP_NAME.dump" | |
task :dump => :environment do | |
cmd = nil | |
with_config do |app, host, db, user| | |
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
end | |
puts cmd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InitMigration < ActiveRecord::Migration | |
def change | |
create_table 'pictures', force: :cascade do |t| | |
t.string 'name', null: false | |
t.string 'guid', null: false | |
t.timestamps null: false | |
end | |
add_index :pictures, :guid, unique: true |