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 "byebug" | |
def fetch_values(str) | |
keys=str.scan(/\w*\s+(?=\=)|\w*+(?=>\=)/) | |
values = str.scan(/(?<=")\w+(?=")/) | |
root_key=str.scan(/(?<=^<)+\w*/) | |
h={} | |
keys.each_with_index { |key, index| h[key.strip!] = values[index] } | |
h | |
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
def flattern(array, main_array, index) | |
while( index < array.length) | |
if(array[index].class == Array) | |
flattern(array[index], main_array, 0) | |
else | |
main_array.push(array[index]) | |
end | |
index = index + 1 | |
end | |
main_array |
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 Node | |
attr_accessor :next, :data | |
def initialize | |
@next = nil | |
@data = nil | |
end | |
def initialize(d) | |
@data = d |
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 Node | |
attr_accessor :next, :data | |
def initialize | |
@next = nil | |
@data = nil | |
end | |
def initialize(d) | |
@data = d |
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
#all_path_breadth function will let you traverse directores from an origin and then a code block will make it more productive. | |
#Below I wrote two different calls for #all_path_breadth, in the first call #virus I am creating a file named "test" at each location and in #anti_virus I am deleting that same file. | |
def all_path_breadth(origin, &block) | |
current_directories = [] | |
Dir.entries(origin).each{ |p| current_directories.push(p) if p != "." && p != ".." && File.directory?(origin+"/"+p) } | |
block.call(origin) if current_directories.empty? | |
current_directories.each do |p| | |
path_r = origin+"/"+p | |
block.call(path_r) |
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
{ SequelizeDatabaseError: type "enum_estimates_type" does not exist | |
at Query.formatError (/home/mfq/workspace/grazer-backend/node_modules/sequelize/lib/dialects/postgres/query.js:357:14) | |
at Query.<anonymous> (/home/mfq/workspace/grazer-backend/node_modules/sequelize/lib/dialects/postgres/query.js:88:19) | |
at emitOne (events.js:96:13) | |
at Query.emit (events.js:188:7) | |
at Query.handleError (/home/mfq/workspace/grazer-backend/node_modules/pg/lib/query.js:143:8) | |
at Connection.<anonymous> (/home/mfq/workspace/grazer-backend/node_modules/pg/lib/client.js:180:26) | |
at emitOne (events.js:96:13) | |
at Connection.emit (events.js:188:7) | |
at Socket.<anonymous> (/home/mfq/workspace/grazer-backend/node_modules/pg/lib/connection.js:136:12) |
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
Error: EstimateCondition (conditions) is not associated to EstimateCondition! | |
at Model.validateIncludedElement (/home/mfq/workspace//grazer-backend/node_modules/sequelize/lib/model.js:558:11) | |
at /home/mfq/workspace//grazer-backend/node_modules/sequelize/lib/model.js:440:29 | |
at Array.map (native) | |
at Model.validateIncludedElements (/home/mfq/workspace//grazer-backend/node_modules/sequelize/lib/model.js:436:37) | |
at Model.build (/home/mfq/workspace//grazer-backend/node_modules/sequelize/lib/model.js:1760:32) | |
at Model.create (/home/mfq/workspace//grazer-backend/node_modules/sequelize/lib/model.js:1815:15) | |
at Model.models.EstimateCondition.findById.then (/home/mfq/workspace//grazer-backend/controllers/estimations.js:175:39) | |
at bound (domain.js:280:14) | |
at Model.runBound (domain.js:293:12) |
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
'use strict'; | |
const moment = require('moment'); | |
const now = moment().format('YYYY-MM-DD HH:mm:ss Z'); | |
module.exports = { | |
up: function (queryInterface, Sequelize) { | |
return queryInterface.bulkInsert("Estimates", [ | |
{ | |
name: 'When was the last time your property received a cleanup ?', |
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 'nokogiri' | |
xml_source = '<item id="0001" type="donut"> | |
<batters> | |
<batter>Regular</batter> | |
<batter data-target="neat">Regular</batter> | |
<batter>Regular</batter> | |
</batters> | |
</item>' | |
doc = Nokogiri::XML(xml_source) |
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
➜ gcse-ionic git:(develop) ✗ npm run build-android-sdk-production | |
> gcse@1.0.0 build-android-sdk-production /Users/mfq/workspace/outsourcing/gcse-ionic | |
> npm run conf-production-package && npm run build-android-sdk | |
> gcse@1.0.0 conf-production-package /Users/mfq/workspace/outsourcing/gcse-ionic | |
> npm run create-dirs && gulp config:production-package | |