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
a = [0, 1, 2, 3, 4, 5] | |
# example 1 | |
def reverse(array) | |
array.each_with_index do |val, index| | |
break if index >= array.count / 2 | |
temp = array[index] | |
array[index], array[-index-1] = array[-index-1], temp | |
end |
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
#!/bin/sh | |
sudo chown -R foxweb:foxweb ./* | |
find . -name "*" -type d -print0 | xargs -0 /bin/chmod 755 | |
find . -name "*" -type f -print0 | xargs -0 /bin/chmod 644 | |
find . -name ".DS_Store" -type f -print0 | xargs -0 /bin/rm | |
find . -name "._*" -type f -print0 | xargs -0 /bin/rm | |
find . -name ".AppleDouble" -type d -print0 | xargs -0 /bin/rm -rf |
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 GpsParser | |
def initialize(file_path) | |
@file_path = file_path | |
end | |
def converted_gps | |
return if raw_exif_data.empty? | |
{ | |
latitude: float_gps(:GPSLatitude, :GPSLatitudeRef), |
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
require 'benchmark' | |
n = 100_000 | |
abc = ('A'..'Z').to_a | |
Benchmark.bm do |x| | |
x.report { n.times { rand(65..90).chr } } | |
x.report { n.times { rand('A'.ord..'Z'.ord).chr } } | |
x.report { n.times { ('A'..'Z').to_a.sample } } | |
x.report { n.times { abc.sample } } |
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
Style/FrozenStringLiteralComment: | |
EnforcedStyle: never | |
Layout/AccessModifierIndentation: | |
EnforcedStyle: outdent | |
Layout/EmptyLinesAroundAccessModifier: | |
Enabled: false | |
Layout/ExtraSpacing: |
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
swagger: '2.0' | |
info: | |
version: '1.0' | |
title: Nightingale API | |
description: Перед вами документация по Nightingale API (система управления контентом). Пока API без версионирования. Звёздочками отмечены обязательные поля. В двойных фигурных {{скобках}} указаны переменные, заданные в environment. | |
host: example.com | |
basePath: / | |
schemes: | |
- http | |
consumes: |
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
2017-07-10 13:54:32 +0300: Rack app error: #<Faraday::ConnectionFailed> | |
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:641:in `rescue in connection_for' | |
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:589:in `connection_for' | |
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/net-http-persistent-2.9.4/lib/net/http/persistent.rb:994:in `request' | |
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http_persistent.rb:25:in `perform_request' | |
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:40:in `block in call' | |
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http_persistent.rb:21:in `with_net_http_connection' | |
/usr/local/opt/rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb:32:in |
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
0x9f9263e8a207de5f4a102cfcf02ee87e463bcc4d |
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
Retrieving cheshire-5.7.0.jar from https://clojars.org/repo/ | |
Retrieving instaparse-1.4.5.jar from https://clojars.org/repo/ | |
Retrieving jackson-dataformat-cbor-2.8.6.jar from https://repo1.maven.org/maven2/ | |
Retrieving jackson-core-2.8.6.jar from https://repo1.maven.org/maven2/ | |
Retrieving jackson-dataformat-smile-2.8.6.jar from https://repo1.maven.org/maven2/ | |
clojure.lang.ExceptionInfo: | |
data: {:file "parser.clj", :line 85} | |
java.lang.NullPointerException: | |
clojure.core/file-seq/fn core.clj: 4772 | |
clojure.core/tree-seq/walk/fn core.clj: 4762 |
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
rake aborted! | |
ActiveAdmin::DatabaseHitDuringLoad: Your file, app/models/subscription_type.rb (line 22), caused a database error while Active Admin was loading. This is most common when your database is missing or doesn't have the latest migrations applied. To prevent this error, move the code to a place where it will only be run when a page is rendered. One solution can be, to wrap the query in a Proc.Original error message: PG::UndefinedTable: ERROR: relation "subscription_types" does not exist | |
LINE 5: WHERE a.attrelid = '"subscription_types"'::re... | |
^ | |
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), | |
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod | |
FROM pg_attribute a LEFT JOIN pg_attrdef d | |
ON a.attrelid = d.adrelid AND a.attnum = d.adnum | |
WHERE a.attrelid = '"subscription_types"'::regclass | |
AND a.attnum > 0 AND NOT a.attis |
NewerOlder