Skip to content

Instantly share code, notes, and snippets.

View bipiane's full-sized avatar
🤖
git status

Ivan Pianetti bipiane

🤖
git status
View GitHub Profile
@bipiane
bipiane / kaviyo.html
Last active March 18, 2022 13:19
kaviyo & segment
<script type="text/javascript">
window.addEventListener('klaviyoForms', function(e){
if (typeof analytics != 'undefined' && e.detail.type === 'stepSubmit' && e.detail.metaData) {
console.debug('klaviyoForms: ', e.detail.metaData);
if (e.detail.metaData.$email) {
const userId = '';
const traits = {
email: e.detail.metaData.$email,
accepts_email_marketing: true
};
@bipiane
bipiane / isValidBinaryString.groovy
Created August 12, 2020 21:08
isValidBinaryString
def isValidBinaryString(String list) {
def total = list?.size()
// TODO check one or more 0's or 1's with regex: \[0|1]+\g 🤔
if (total == 0 || total % 2 != 0) {
return false
}
// The number of 0's is equal to the number of 1's.
if (list.findAll { it == '1' }?.size() != list.findAll { it == '0' }?.size()) {
return false
}
console.log('Ahora si! 🚀')