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_relative "base58" | |
def bytes_to_base58(bytes) | |
hex = bytes.pack("C*").unpack("H*").first | |
Base58.encode(hex) | |
end | |
keypair = "6Tyktf6mEqUMEKm2ZpLn3srEwk9zsT5jiE54EgPgToikMFYww1LGFUXgwgr6hvc9CikpaNaBH2vmkmqN3Usrxpd" | |
keypair_hex = Base58.decode(keypair).rjust(128, "0") | |
keypair_bytes = [keypair_hex].pack('H*').bytes.to_a |
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
SELECT users.user_id, COUNT(post_id) AS post_count | |
FROM users | |
LEFT JOIN posts ON posts.user_id = users.user_id | |
GROUP BY 1 | |
+---------+------------+ | |
| user_id | post_count | | |
+---------+------------+ | |
| 1 | 3 | | |
| 2 | 2 | |
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
if account.owner != program_id { | |
msg!("Greeted account does not have the correct program id"); | |
return Err(ProgramError::IncorrectProgramId); | |
} |
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_relative "base58" | |
def bytes_to_base58(bytes) | |
hex = bytes.pack("C*").unpack("H*").first | |
Base58.encode(hex) | |
end | |
keypair_bytes = [4,182,130,247,119,117,227,207,112,73,170,126,222,197,244,99,215,107,255,202,33,43,36,17,104,111,157,246,196,192,174,95,240,23,238,206,118,215,154,238,229,96,11,37,156,123,51,223,5,231,17,117,86,136,103,14,75,95,175,132,148,54,1,46] | |
private_key_bytes = keypair_bytes[0, 32] | |
public_key_bytes = keypair_bytes[32..-1] |
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
setClass( | |
Class = "Distribution", | |
representation = representation( | |
name = "character", | |
participants = "numeric", | |
conversions = "numeric", | |
sample_proportion = "numeric", | |
se = "numeric", | |
color = "character", | |
x = "vector", |
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
SELECT | |
users.user_id, | |
COUNT(DISTINCT post_id) AS post_count, | |
COUNT(DISTINCT page_id) AS page_count | |
FROM users | |
LEFT JOIN posts ON posts.user_id = users.user_id | |
LEFT JOIN pages ON pages.user_id = users.user_id | |
GROUP BY 1 | |
+---------+------------+------------+ |
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
view: fb_conversions { | |
derived_table: { | |
sql: | |
select * | |
from fivetran.fb_ad_insights_action_values | |
where action_type = "offsite_conversion.fb_pixel_purchase" ;; | |
} | |
dimension: primary_key { | |
type: string |
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
explore: fb_ad_insights { | |
label: "Facebook" | |
view_label: "Facebook" | |
join: fb_conversions { | |
view_label: "Facebook" | |
type: left_outer | |
relationship: one_to_one | |
sql_on: ${fb_ad_insights.primary_key} = ${fb_conversions.primary_key} ;; | |
} |
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
select | |
campaign_id, | |
sum(value) as total_conversion_value | |
from facebook_ad_insights.ad_insights_action_values | |
where | |
action_type = 'offsite_conversion.fb_pixel_purchase' and | |
date = '2018-10-01' | |
group by 1 | |
order by 1 |
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
view: fb_ad_insights { | |
sql_table_name: fivetran.fb_ad_insights ;; | |
dimension: primary_key { | |
type: string | |
sql: concat(cast(${date_date} as string), ${campaign_id}, ${country}) ;; | |
hidden: yes | |
primary_key: yes | |
} |
NewerOlder