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
| task :fix_repo do | |
| on roles(:app) do | |
| config = repo_path.join('config') | |
| execute :sed, '-i', '--', 's/github.com/bitbucket.org/g', config | |
| end | |
| 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
| { | |
| "$schema": "http://json-schema.org/draft-04/schema#", | |
| "id": "http://rating.vc/unijson_v1", | |
| "type": "array", | |
| "items": [ | |
| { | |
| "id": "http://rating.vc/unijson_v1/0", | |
| "type": "object", | |
| "properties": { | |
| "company": { |
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
| import sys | |
| import sqlite3 | |
| import json | |
| import resource | |
| def intersects(sample_file, db): | |
| conn = sqlite3.connect(db) | |
| c = conn.cursor() | |
| def check(id): |
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
| $stack, $draws = [], {} | |
| def method_missing *args | |
| return if args[0][/^to_/] | |
| $stack << args.map { |a| a or $stack.pop } | |
| $draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
| end | |
| class Array | |
| def +@ |
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 | |
| require 'benchmark/ips' | |
| Benchmark.ips do |x| | |
| x.config(time: 5, warmup: 2) | |
| def block_call &block | |
| block.call | |
| 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
| # -*- coding: utf-8 -*- | |
| # Вопрос: что делает следующий код? | |
| (->(g){(->(u){u===u}).(->(x){->(*s){g[x[x]][*s]}})}).(->(c){->{ Hash.new {|h,k| h[k] = c.call }}}) |
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
| Gibbon::API.key = ENV['GIBBON_API'] | |
| api = Gibbon::API.new | |
| list_id = ENV['SARAFAN_MC_LIST'] | |
| to_mailchimp = -> (u) { | |
| api.lists.subscribe({ | |
| id: list_id, | |
| email: { email: u.email }, | |
| merge_vars: { | |
| 'CATEGORY' => u.business.category.translit, |
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
| require 'json' | |
| require 'net/http' | |
| require 'csv' | |
| uri = URI('https://api.foursquare.com/v2/venues/categories?oauth_token=QRY3YNHKTYK24JSQPFVBII2YI233T5OZHO2ZQMCG3YU2U05P&v=20140708&locale=ru') | |
| PUSH = -> (categories, scope) do | |
| categories.inject([]) do |res, category| | |
| row = scope + [category['id'], category['name']] | |
| res + [row, *PUSH[category['categories'] || [], row]] | |
| 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
| parents = Category.where(parent_id: nil); | |
| DUMP = -> (category) { | |
| [ | |
| category.id, | |
| category.name, | |
| TulpSeo::Data.lookup( | |
| "seo.info.categories.#{category.translit}.default", | |
| { city_parent: 'Санкт-Петербурга' } | |
| ) |
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
| module Interviews | |
| class DemoController < Interviews::ApplicationController | |
| # explicit call of ask is not needed, implicit call will be perform when needed | |
| def show | |
| ask(:interview, :other_interviews) | |
| end | |
| def index |