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 components = recommendations.blueprint.host_groups.map(function(group) { | |
return group.components.map(function(component) { | |
return recommendations.blueprint_cluster_binding.host_groups.findProperty('name', group.name).hosts.map(function(host) { | |
return { component: component.name, host: host.fqdn}; | |
}); | |
}); | |
}); | |
components = [].concat.apply([], components); | |
components = [].concat.apply([], components); |
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
["DATANODE", "NODEMANAGER", "HBASE_REGIONSERVER", "SUPERVISOR", "JOURNALNODE", "ZKFC", "APP_TIMELINE_SERVER", "GANGLIA_MONITOR"] | |
["DATANODE", "NODEMANAGER", "HBASE_REGIONSERVER", "SUPERVISOR"] | |
["DataNode", "NodeManager", "RegionServer", "Supervisor"] | |
"CLIENT" | |
"Client" | |
isSlave | |
["DataNode DATANODE", |
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
Spree::CheckoutController.class_eval do | |
def update_with_marketplace_sync | |
if @order.completed? | |
# Тут используешь @order или @current_order пока он ещё не обнулён и всё другое | |
end | |
update_without_marketplace_sync | |
end | |
alias_method_chain :update, :marketplace_sync |
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
Spree::LineItem.class_eval do | |
#... | |
def listing | |
raw = read_attribute(:listing) | |
Marshal.load(raw) | |
end | |
def listing=(value) | |
raw = Marshal::dump(value) |
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
#!/bin/sh | |
HOST='api.*****.com' | |
USER='[email protected]' | |
PASSWORD='password' | |
CLIENT_ID='web' | |
ACCESS_TOKEN=$(curl -s -X POST --data "grant_type=password&username=$USER&password=$PASSWORD" http://$HOST/api/oauth/token | jq -r '.access_token') | |
echo "Access Token: $ACCESS_TOKEN" |
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
from __future__ import print_function | |
dna = raw_input('Enter dna:') | |
i = 1 | |
count = 1 | |
while i < len(dna): | |
if dna[i] != dna[i - 1]: | |
print(str(count) + dna[i - 1], end='') | |
count = 1 | |
else: |
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
m1 = [] # массивы | |
m2 = [] | |
s = gets.chomp #chomp на всякий случай, "обрезает строку" - удаляет пробелы и знаки переноса из конца строки (если есть) | |
while s != 'end' | |
row = s.split(' ').map(&:to_i) # разбиваем строку на массив, конвертируем элементы в числа | |
m1 << row # добавляем массив-строку в первую матрицу | |
m2 << row.dup # добавляем копию массива-строки во вторую матрицу | |
# копию потому что иначе можификация данных во втором массиве меняла бы их и в первом | |
s = gets.chomp |
This file has been truncated, but you can view the full file.
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
7776853593 | |
7776861490 | |
7776882710 | |
7776887054 | |
7776902778 | |
7776905184 | |
7776906914 | |
7776922758 | |
7776928781 | |
7776929158 |
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
, [2016-09-30T15:40:19.980356 #19848] INFO -- : Pull order 8763 status | |
I, [2016-09-30T15:40:19.980833 #19848] INFO -- : post https://oos.pscb.ru/merchantApi/checkPayment | |
D, [2016-09-30T15:40:19.980905 #19848] DEBUG -- request: User-Agent: "Faraday v0.9.1" | |
Signature: "c1a5df653143a1b098c26b304bf469e6edfaedfe483e07f2d88ba539ff8115ae" | |
Content-Type: "application/json" | |
D, [2016-09-30T15:40:19.980957 #19848] DEBUG -- request: {"orderId":"cce3666e5787909852fe","marketPlace":25633032} | |
I, [2016-09-30T15:40:20.851376 #19848] INFO -- Status: 200 | |
D, [2016-09-30T15:40:20.851564 #19848] DEBUG -- response: server: "Apache-Coyote/1.1" | |
content-type: "application/json;charset=UTF-8" | |
transfer-encoding: "chunked" |
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
def single_char_edit?(a, b) | |
if a.size == b.size | |
diffs = 0 | |
a.size.times do |i| | |
if a[i] != b[i] | |
diffs += 1 | |
end | |
end |