This file contains 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 http = require('http'); | |
var events = require('events'); | |
var jsdom = require('jsdom'); | |
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://localhost/crawler'); | |
var Schema = mongoose.Schema; | |
var ObjectId = Schema.ObjectId; |
This file contains 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Database base on list set % | |
% Andrew N. Shalaev % | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
-module(db). | |
-export([start/0, stop/0, read/1, write/2, delete/1]). | |
-export([init/0]). | |
% process loop |
This file contains 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 SeqList | |
attr_accessor :first | |
class Node | |
attr_accessor :key, :val, :next_node | |
def initialize(key, val, next_node) | |
@key, @val, @next_node = key, val, next_node |
This file contains 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
source 'https://rubygems.org' | |
gem 'benchmark-ips' | |
gem 'activesupport' | |
gem 'jbuilder' | |
gem 'rabl' | |
gem 'oj' |
This file contains 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
company_id = 11973147 | |
wrong_field = :active_reviews_count | |
# before | |
CoreDenormalization::Fields::Company::Reviews.value_as_string(object: company_id, field: wrong_field) | |
sql_for_data = initialize_statement # with company_id filter | |
data = ActiveRecord::Base.connection.execute sql_for_data | |
hash_with_object_key = {data.delete(:object_id) => data} | |
CoreDenormalization::Fields::Company::Reviews.instance.write_data hash_with_object_key |
This file contains 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
package ru.cohab; | |
import java.io.InputStreamReader; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
public class App { | |
public static final int COUNT = 4; | |
public static void main(String[] args) throws Exception { |
This file contains 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
build_package_patch_ruby_railsexpress() { | |
fetch_git rvm-patchsets git://github.com/skaes/rvm-patchsets.git master | |
for p in rvm-patchsets/patches/ruby/1.9.3/p551/railsexpress/* ; do | |
patch -p1 < $p | |
done | |
} | |
install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz#36c852831d02cf90508c29852361d01b" | |
install_package "ruby-1.9.3-p551" "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p551.tar.gz" patch_ruby_railsexpress autoconf standard |
This file contains 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
(ns Player | |
(:gen-class)) | |
; Auto-generated code below aims at helping you parse | |
; the standard input according to the problem statement. | |
; --- | |
; Hint: You can use the debug stream to print initialTX and initialTY, if Thor seems not follow your orders. | |
(defn -main [& args] |
This file contains 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
(ns Solution | |
(:gen-class)) | |
(defn int-to-bin | |
"Converts integer to binary" | |
[n] | |
(reverse (cond | |
(= n 1) [1] | |
(= n 0) [0] | |
:else (loop [q (quot n 2) |
This file contains 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
(ns renamer.core | |
(:gen-class) | |
(:require [clojure.java.io :as io])) | |
(defn file-list | |
[path] | |
(-> | |
path | |
(io/file) | |
(.listFiles) |
OlderNewer