Skip to content

Instantly share code, notes, and snippets.

View criess's full-sized avatar

Christoph Rieß criess

  • Carl Finance
  • Berlin
View GitHub Profile
@criess
criess / update_bubble_via_curl.rb
Created April 29, 2021 13:02
migration script for IN-1246
require 'csv'
require 'active_support'
require 'active_support/core_ext'
def command(json, id)
"curl -v -s -X PATCH " \
"-H 'Authorization: Bearer #{ENV['BUBBLE_API_KEY']}' " \
"-H 'Content-Type: application/json' " \
"-d '#{json}' " \
"'https://#{ENV['BUBBLE_API_HOST']}/api/1.1/obj/project/#{id}'"
#!/usr/bin/env ruby
# a dump of the funnel_exec table from big query is needed in line-separated-json format
# also we need a csv file with information about lead creation, email and pipedrive ids
#
# three positional parameters must be passed:
# * input json path
# * input csv path
#!/usr/bin/env ruby
PROJECT_ID_KEY = 'respectiveproject_custom_project'.freeze
USER_ID_KEY = 'sender_user'.freeze
MESSAGETYPE_MATCHER = lambda { |k, entry| entry['messagetype_text'] == 'RequestProjectData' }
# message downloader extending from
module Imports
module BubbleApi
class Message < Record
#
# steps to migrate investors to user accounts:
#
# 1. generate users in correct state (can be declined if only declined profiles exist)
# 2. re-synchronize with bubble if necessary
# 3. send emails for password reset
#
# User generation
#!/usr/bin/env ruby
require 'csv'
require 'yaml'
require 'active_support/core_ext/string'
PUBLIC_ROLE = 'Public'
ROLES = ['Admin', 'Carl Employee', 'Investor', 'Advisor'].freeze
#!/bin/bash
# parse options
# a => Auth string formatted <user>:<pass>
# f => file location (hyperlink etc…)
# t => kodi/xbmc target in <ip>:<port>
while getopts 'a:f:t:' OPT; do
case $OPT in
a) AUTH=$OPTARG;;
f) URL=$OPTARG;;
---
- de: Baden-Württemberg
en: Baden-Württemberg
- de: Bayern
en: Bayern
- de: Berlin
en: Berlin
- de: Brandenburg
en: Brandenburg
- de: Bremen
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Nigeria;Nigeria
Gambia;Gambia
Argentinien;Argentina
Hongkong;Hong Kong
Turks- und Caicosinseln;Turks and Caicos Islands
Guernsey;Guernsey
Malediven;Maldives
Syrische Arabische Republik;Syrian Arab Republic
Vereinigte Arabische Emirate;United Arab Emirates
Tansania;Tanzania
#!/usr/bin/env ruby
BuyingProfile.new
Address.new
data = YAML.load_file('imports.yml')
import = Import.create!(source: 'CUSTOM/CR/201902', import_start_at: Time.current)
data[:addresses].each do |a|
#!/usr/bin/env ruby
ActiveRecord::Base.logger = nil
where_after_date = begin
Time.iso8601(ARGV[0])
rescue
Date.new(2018,10,30).end_of_day
end