Skip to content

Instantly share code, notes, and snippets.

View inem's full-sized avatar
🌰
In progress

Ivan Nemytchenko inem

🌰
In progress
View GitHub Profile
=trip_points
-include
:item
:profile
:operations
-methods do
:author
current_user
:full_name
:availability_line
def calculate_params(context, method_name, params)
if params.kind_of?(Array)
context.send(method_name, *params)
elsif params.kind_of?(Hash)
context = context.send(method_name)
calculate_params(context, params.keys[0], params.values[0])
elsif params.respond_to?(:to_sym)
context.send(method_name, params)
else raise ArgumentError, "Unknown type of function params"
end
// BNF parser framework for JavaScript
// Oleg Andreev
var result = (function(text){
// The Y Combinator
var Y=function (gen) {
return function(f) {return f(f)}(
function(f) {
return gen(function() {return f(f).apply(null, arguments)})})}
# first you'll want to create a gist then `git clone` the private url
# second you'll want to run this script in the gist's directory
loop do
`git commit -a -m save && git push origin master`
sleep 60 * 4
end
# In boot.rb
require File.join RAILS_ROOT, 'config/autogit_libs.rb'
require "railties/lib/initializer"
Rails::Initializer.run(:set_load_path)
# Rails.boot!
class AutogitPluginLocator < Rails::Plugin::Locator
def plugins
protein_hits.to_json(:methods =>
[:mascot_identified_hit, :label, :confirmed?, :spot, :descrption, :comment_text,
:mascot_filename, :mascot_db_result_link, :order_name,
:isoelectric_point, :rms_error, :mascot_dat_file_id,
:peptides_above_identity_threshold, :peptides_above_homology_threshold, :sequence_coverage_percent, :sequence_coverage_percent_ms_ms, {:sequence_method_wrapper => 70}, :tag_list,
:peptides_with_ions_score, :score, :ms_score, :info_dump], :include => {:comments => {:only => [:comment, :id, :commenter_id], :methods => [:commenter_name, :date]}, :taggings => {:methods => [{:created_at => {:to_s => :short}}], :only => [], :include => {:tag => {:only => [:name, :background, :foreground]}, :tagger => {:only => :login}}}} )
// по дефолту protein_hits (1)
// "=>" ренэймим в proteins (2)
=@protein_hits => :proteins
:json => concat_json({
# :items => items.to_json(:methods => [:beds, :capacity, :title]),
# :locations => locations.to_json(:methods => :address, :include => :items)
:items => items.to_json(:methods => [:beds, :capacity],
:except => [:created_at, :updated_at, :search_timestamp, :verified, :active, :subcategories]),
:locations => locations.to_json(:methods => :address, :include => {:items => {:only => [:id], :methods => []}})
})
@items
-methods
-comments
:only
.name
.background
.foreground
:methods
.commenter_name
.date
-@protein_hits
:methods
.label
.spot
.descrption
.comment_text
:include
-comments
-taggings
:methods
-@roads
:only
.name
:include
-cars
:only
.number
.model
.name
.year