Skip to content

Instantly share code, notes, and snippets.

View ogii's full-sized avatar

Aaron Clark ogii

View GitHub Profile

Tweak your CircleCI server to build forked PRs even if the fork has an active CircleCI project

Overview

This instruction consists of 2 parts:

  1. Apply a patch to examine the special project flag.

  2. Set a special flag for projects which should run pipelines for every forked PRs.

@ogii
ogii / check-array.sh
Created December 16, 2022 07:07
Iterate through an associative array in bash
declare -A channels=( ["mocha1"]="channel1" ["mocha2"]="channel2" ["mocha3"]="channel3")
for key in "${!channels[@]}"; do
if [ "$key" = "<< parameters.test-name >>" ]; then
echo "${channels[$key]}"
fi
done
@ogii
ogii / config.yml
Created May 16, 2022 15:07
Pass in template from .json file for Slack Orb
version: '2.1'
orbs:
slack: circleci/slack@4.2.1
jobs:
job1:
docker:
- image: 'cimg/base:2020.01'
steps:
@ogii
ogii / elementCheck.js
Last active February 5, 2019 10:29
Wait until an element exists on the page and then fire some code
function waitForElement() {
if (!document.querySelector("/* put element selector here */")) {
window.requestAnimationFrame(waitForElement);
} else {
/* put code to fire after element exists here */
}
};
@ogii
ogii / timeOnPageTracker.js
Created February 5, 2019 10:24
Track time spent on page and fire VWO goals
setInterval(function(){
if(parseInt(timeSpentOnSite/1000) >= 5){
window._vis_opt_queue = window._vis_opt_queue || [];
window._vis_opt_queue.push(function() {_vis_opt_goal_conversion(212);});
}
if(parseInt(timeSpentOnSite/1000) >= 10){
window._vis_opt_queue = window._vis_opt_queue || [];
window._vis_opt_queue.push(function() {_vis_opt_goal_conversion(213);});
}
if(parseInt(timeSpentOnSite/1000) >= 20){
@ogii
ogii / scrollEventTracker.js
Created February 5, 2019 10:22
Tracking scroll goals in VWO
var scrollPos = window.innerHeight;
window.addEventListener('scroll', function(e) {
var pos = window.scrollY + window.innerHeight;
window._vis_opt_queue = window._vis_opt_queue || [];
if (scrollPos < pos) {
// down
if ((document.querySelector('div.top').getBoundingClientRect().top + window.scrollY) < pos) {
window._vis_opt_queue.push(function() {
_vis_opt_goal_conversion(200);
});
@ogii
ogii / gist:74c6161d887a5f3cee7fa9c1185c65df
Created June 7, 2018 08:37
Turn lists into dropdowns
//
var arrayLocation = [];
var arrayArea = [];
var arrayTheme = [];
$('#g-body').prepend('<select style="display: block;" id="select1"></select><select style="display: block;" id="select2"></select><select style="display: block;" id="select3"></select>');
$('div#plase ul.m-tileLink:eq(0) > li').each(function(i,e){
arrayLocation.push([vwo_$(this).children('a').html(), vwo_$(this).children('a').attr('href')]);
});
$('div#plase ul.m-tileLink:eq(1) > li').each(function(i,e){
arrayArea.push([vwo_$(this).children('a').html(), vwo_$(this).children('a').attr('href')]);
@ogii
ogii / imageselect-vwo.js
Created February 1, 2018 05:32
Loading images into array + showing based on selection in VWO
vwo_$('a#severModalBTN, a#selectModalBTN').on('click', function(element) {
step2(vwo_$('#select-server input[type*="radio"]').filter(':checked').attr('value'));
});
function step2(input) {
switch (input) {
case '27':
isSlimOrNot = true;
step3(vwo_$('div.normal').find(':checked').attr('value'));
break;